Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: implement disk-based sort (Part 2) #14279

Merged
merged 56 commits into from
Feb 7, 2020

Conversation

wshwsh12
Copy link
Contributor

@wshwsh12 wshwsh12 commented Dec 30, 2019

What problem does this PR solve?

part of #12431

Implement externalSorting .

What is changed and how it works?

In this pr, I do the following things.

  1. Read as mush as rows into memory.
  2. If memory quota is triggered, sort these rows in memory and put them into disk as partition 1, then reset the memory quota trigger and return to step 1
  3. If memory quota is not triggered and child is consumed, sort these rows in memory as parition N
    merge sort if the count of partitions is larger than 1.
  4. If there is only one partition in step 4, it works just like in-memory sort before.

Check List

Tests

  • Unit test
  • Integration test

Code changes

Side effects

  • Increased code complexity

Related changes

Release note

Benchstat

In memory, master vs this pr.

name                                                     old time/op  new time/op  delta
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[0_0])-8      192ms ± 7%   204ms ± 3%    ~     (p=0.095 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[1_0])-8      267ms ± 2%   275ms ± 4%    ~     (p=0.222 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[1_0])-8       20.4ms ± 1%  21.3ms ± 0%  +4.75%  (p=0.008 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[1_0])-8        191ms ± 1%   198ms ± 6%    ~     (p=0.095 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[2_0])-8      270ms ± 1%   269ms ± 3%    ~     (p=0.421 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[2_0])-8       28.7ms ± 5%  29.9ms ± 4%    ~     (p=0.151 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[2_0])-8        195ms ± 2%   197ms ± 2%    ~     (p=0.222 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[4_0])-8      270ms ± 5%   270ms ± 4%    ~     (p=0.690 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[4_0])-8       37.2ms ± 6%  39.1ms ± 4%    ~     (p=0.151 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[4_0])-8        192ms ± 1%   203ms ± 4%  +5.47%  (p=0.008 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[8_0])-8      269ms ± 2%   271ms ± 2%    ~     (p=0.690 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[8_0])-8       48.7ms ± 7%  51.7ms ± 2%    ~     (p=0.056 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[8_0])-8        193ms ± 2%   200ms ± 3%  +3.50%  (p=0.032 n=5+4)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[16_0])-8     271ms ± 7%   286ms ± 9%    ~     (p=0.310 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[16_0])-8      62.5ms ± 1%  65.2ms ± 7%  +4.37%  (p=0.008 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[16_0])-8       196ms ± 3%   204ms ± 4%    ~     (p=0.095 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[32_0])-8     270ms ± 2%   272ms ± 3%    ~     (p=0.548 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[32_0])-8      77.7ms ± 2%  78.6ms ± 2%    ~     (p=0.548 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[32_0])-8       194ms ± 2%   201ms ± 7%    ~     (p=0.548 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[64_0])-8     262ms ± 3%   282ms ±22%    ~     (p=0.222 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[64_0])-8      91.9ms ± 3%  96.0ms ± 5%    ~     (p=0.095 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[64_0])-8       194ms ± 1%   202ms ± 4%  +4.27%  (p=0.008 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[128_0])-8    262ms ± 2%   284ms ±24%    ~     (p=0.421 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[128_0])-8      105ms ± 2%   110ms ± 6%    ~     (p=0.151 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[128_0])-8      192ms ± 1%   194ms ± 2%    ~     (p=0.222 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[256_0])-8    254ms ± 2%   256ms ± 4%    ~     (p=0.548 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[256_0])-8      118ms ± 3%   123ms ± 5%  +4.49%  (p=0.016 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[256_0])-8      192ms ± 1%   204ms ± 4%  +6.13%  (p=0.008 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[512_0])-8    254ms ± 4%   263ms ± 8%    ~     (p=0.151 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[512_0])-8      130ms ± 3%   133ms ± 6%    ~     (p=0.548 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[512_0])-8      192ms ± 2%   196ms ± 1%    ~     (p=0.095 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[1024_0])-8   252ms ± 2%   241ms ± 4%    ~     (p=0.056 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[1024_0])-8     140ms ± 2%   143ms ± 2%    ~     (p=0.222 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[1024_0])-8     191ms ± 1%   196ms ± 5%    ~     (p=0.056 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[2048_0])-8   244ms ± 4%   238ms ± 3%    ~     (p=0.222 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[2048_0])-8     152ms ± 3%   158ms ± 8%    ~     (p=0.095 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[2048_0])-8     192ms ± 2%   195ms ± 3%    ~     (p=0.310 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[4096_0])-8   237ms ± 2%   235ms ± 2%    ~     (p=0.548 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[4096_0])-8     161ms ± 2%   160ms ± 2%    ~     (p=0.841 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[4096_0])-8     193ms ± 4%   196ms ± 9%    ~     (p=0.841 n=5+5)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[8192_0])-8   231ms ± 1%   235ms ± 4%    ~     (p=0.222 n=5+5)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[8192_0])-8     171ms ± 1%   182ms ±16%    ~     (p=1.000 n=5+5)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[8192_0])-8     198ms ± 3%   192ms ± 3%    ~     (p=0.095 n=5+5)

Master in memory vs this ps in disk.

name                                                     old time/op  new time/op    delta
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[0_0])-8      192ms ± 7%    1510ms ± 2%   +685.99%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[1_0])-8      267ms ± 2%    1574ms ± 2%   +489.57%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[1_0])-8       20.4ms ± 1%   259.4ms ± 0%  +1173.63%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[1_0])-8        191ms ± 1%    1519ms ± 1%   +694.35%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[2_0])-8      270ms ± 1%    1574ms ± 3%   +483.40%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[2_0])-8       28.7ms ± 5%   339.7ms ± 0%  +1084.61%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[2_0])-8        195ms ± 2%    1497ms ± 1%   +666.35%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[4_0])-8      270ms ± 5%    1562ms ± 1%   +479.18%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[4_0])-8       37.2ms ± 6%   357.2ms ± 1%   +859.32%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[4_0])-8        192ms ± 1%    1503ms ± 2%   +682.86%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[8_0])-8      269ms ± 2%    1564ms ± 1%   +482.00%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[8_0])-8       48.7ms ± 7%   407.7ms ±23%   +736.85%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[8_0])-8        193ms ± 2%    1484ms ± 1%   +669.76%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[16_0])-8     271ms ± 7%    1533ms ± 1%   +464.74%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[16_0])-8      62.5ms ± 1%   523.8ms ± 1%   +738.54%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[16_0])-8       196ms ± 3%    1474ms ± 1%   +651.60%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[32_0])-8     270ms ± 2%    1522ms ± 0%   +463.74%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[32_0])-8      77.7ms ± 2%  1018.1ms ± 1%  +1211.04%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[32_0])-8       194ms ± 2%    1480ms ± 1%   +662.06%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[64_0])-8     262ms ± 3%    1525ms ± 1%   +481.10%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[64_0])-8      91.9ms ± 3%  1090.3ms ± 1%  +1086.54%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[64_0])-8       194ms ± 1%    1484ms ± 1%   +665.99%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[128_0])-8    262ms ± 2%    1523ms ± 1%   +480.56%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[128_0])-8      105ms ± 2%    1169ms ± 0%  +1011.15%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[128_0])-8      192ms ± 1%    1475ms ± 1%   +670.14%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[256_0])-8    254ms ± 2%    1507ms ± 1%   +492.98%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[256_0])-8      118ms ± 3%    1248ms ± 2%   +959.31%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[256_0])-8      192ms ± 1%    1484ms ± 2%   +671.74%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[512_0])-8    254ms ± 4%    1510ms ± 1%   +494.94%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[512_0])-8      130ms ± 3%    1323ms ± 1%   +915.77%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[512_0])-8      192ms ± 2%    1480ms ± 0%   +669.33%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[1024_0])-8   252ms ± 2%    1513ms ± 1%   +501.58%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[1024_0])-8     140ms ± 2%    1378ms ± 2%   +882.65%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[1024_0])-8     191ms ± 1%    1476ms ± 1%   +672.55%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[2048_0])-8   244ms ± 4%    1504ms ± 1%   +515.85%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[2048_0])-8     152ms ± 3%    1436ms ± 1%   +843.61%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[2048_0])-8     192ms ± 2%    1481ms ± 1%   +672.22%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[4096_0])-8   237ms ± 2%    1495ms ± 1%   +530.49%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[4096_0])-8     161ms ± 2%    1436ms ± 0%   +792.24%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[4096_0])-8     193ms ± 4%    1462ms ± 1%   +656.35%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0_1],_ndvs:_[8192_0])-8   231ms ± 1%    1497ms ± 1%   +546.76%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[0],_ndvs:_[8192_0])-8     171ms ± 1%    1470ms ± 1%   +758.94%  (p=0.036 n=5+3)
SortExec/(rows:300000,_orderBy:[1],_ndvs:_[8192_0])-8     198ms ± 3%    1485ms ± 2%   +651.97%  (p=0.036 n=5+3)

@wshwsh12
Copy link
Contributor Author

/run-all-tests

executor/sort.go Outdated Show resolved Hide resolved
executor/sort.go Outdated Show resolved Hide resolved
executor/sort.go Outdated Show resolved Hide resolved
executor/sort.go Outdated Show resolved Hide resolved
@sre-bot
Copy link
Contributor

sre-bot commented Jan 1, 2020

@SunRunAway, @qw4990, PTAL.

SunRunAway
SunRunAway previously approved these changes Feb 6, 2020
Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SunRunAway SunRunAway added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 6, 2020
@SunRunAway SunRunAway linked an issue Feb 6, 2020 that may be closed by this pull request
@sre-bot
Copy link
Contributor

sre-bot commented Feb 6, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Feb 6, 2020

@wshwsh12 merge failed.

@SunRunAway
Copy link
Contributor

DATA RACE:

[2020-02-06T07:51:04.154Z] ==================
[2020-02-06T07:51:04.154Z] WARNING: DATA RACE
[2020-02-06T07:51:04.154Z] Read at 0x00c00cabe730 by goroutine 85:
[2020-02-06T07:51:04.154Z]   github.com/pingcap/tidb/util/chunk.(*SpillDiskAction).Action()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/chunk/row_container.go:219 +0x42
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/util/memory.(*Tracker).Consume()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/memory/tracker.go:194 +0x240
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/util/memory.(*Tracker).AttachTo()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/memory/tracker.go:125 +0x1ae
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*SortExec).fetchRowChunks()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/sort.go:268 +0x61f
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*SortExec).Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/sort.go:128 +0xa6f
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*WindowExec).fetchChild()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:154 +0x12b
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*WindowExec).consumeOneGroup()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:78 +0xdd3
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*WindowExec).Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:56 +0xb4
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*shuffleWorker).run()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:342 +0x273
[2020-02-06T07:51:04.155Z] 
[2020-02-06T07:51:04.155Z] Previous write at 0x00c00cabe730 by goroutine 707:
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*SortExec).fetchRowChunks()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/chunk/row_container.go:245 +0x7b4
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*SortExec).Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/sort.go:128 +0xa6f
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*WindowExec).fetchChild()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:154 +0x12b
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*WindowExec).consumeOneGroup()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:78 +0xdd3
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*WindowExec).Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:56 +0xb4
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*shuffleWorker).run()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:342 +0x273
[2020-02-06T07:51:04.155Z] 
[2020-02-06T07:51:04.155Z] Goroutine 85 (running) created at:
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).prepare4ParallelExec()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:164 +0x163
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:179 +0x77f
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*projectionInputFetcher).run()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/projection.go:368 +0x41c
[2020-02-06T07:51:04.155Z] 
[2020-02-06T07:51:04.155Z] Goroutine 707 (running) created at:
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).prepare4ParallelExec()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:164 +0x163
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:179 +0x77f
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.155Z]   github.com/pingcap/tidb/executor.(*projectionInputFetcher).run()
[2020-02-06T07:51:04.155Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/projection.go:368 +0x41c
[2020-02-06T07:51:04.155Z] ==================
[2020-02-06T07:51:04.155Z] ==================
[2020-02-06T07:51:04.156Z] WARNING: DATA RACE
[2020-02-06T07:51:04.156Z] Read at 0x00c00cabe720 by goroutine 85:
[2020-02-06T07:51:04.156Z]   sync/atomic.LoadInt32()
[2020-02-06T07:51:04.156Z]       /usr/local/go/src/runtime/race_amd64.s:206 +0xb
[2020-02-06T07:51:04.156Z]   sync.(*Once).Do()
[2020-02-06T07:51:04.156Z]       /usr/local/go/src/sync/once.go:55 +0x3a
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/util/chunk.(*SpillDiskAction).Action()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/chunk/row_container.go:224 +0xa5
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/util/memory.(*Tracker).Consume()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/memory/tracker.go:194 +0x240
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/util/memory.(*Tracker).AttachTo()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/memory/tracker.go:125 +0x1ae
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*SortExec).fetchRowChunks()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/sort.go:268 +0x61f
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*SortExec).Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/sort.go:128 +0xa6f
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*WindowExec).fetchChild()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:154 +0x12b
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*WindowExec).consumeOneGroup()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:78 +0xdd3
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*WindowExec).Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:56 +0xb4
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*shuffleWorker).run()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:342 +0x273
[2020-02-06T07:51:04.156Z] 
[2020-02-06T07:51:04.156Z] Previous write at 0x00c00cabe720 by goroutine 707:
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*SortExec).fetchRowChunks()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/util/chunk/row_container.go:240 +0x80d
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*SortExec).Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/sort.go:128 +0xa6f
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*WindowExec).fetchChild()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:154 +0x12b
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*WindowExec).consumeOneGroup()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:78 +0xdd3
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*WindowExec).Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/window.go:56 +0xb4
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*shuffleWorker).run()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:342 +0x273
[2020-02-06T07:51:04.156Z] 
[2020-02-06T07:51:04.156Z] Goroutine 85 (running) created at:
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).prepare4ParallelExec()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:164 +0x163
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:179 +0x77f
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*projectionInputFetcher).run()
[2020-02-06T07:51:04.156Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/projection.go:368 +0x41c
[2020-02-06T07:51:04.156Z] 
[2020-02-06T07:51:04.156Z] Goroutine 707 (running) created at:
[2020-02-06T07:51:04.156Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).prepare4ParallelExec()
[2020-02-06T07:51:04.157Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:164 +0x163
[2020-02-06T07:51:04.157Z]   github.com/pingcap/tidb/executor.(*ShuffleExec).Next()
[2020-02-06T07:51:04.157Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/shuffle.go:179 +0x77f
[2020-02-06T07:51:04.157Z]   github.com/pingcap/tidb/executor.Next()
[2020-02-06T07:51:04.157Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/executor.go:212 +0x167
[2020-02-06T07:51:04.157Z]   github.com/pingcap/tidb/executor.(*projectionInputFetcher).run()
[2020-02-06T07:51:04.157Z]       /home/jenkins/agent/workspace/tidb_ghpr_unit_test/go/src/github.com/pingcap/tidb/executor/projection.go:368 +0x41c
[2020-02-06T07:51:04.157Z] ==================

@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Feb 6, 2020

/rebuild

@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Feb 6, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Feb 6, 2020

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Feb 6, 2020

@wshwsh12 merge failed.

@wshwsh12
Copy link
Contributor Author

wshwsh12 commented Feb 7, 2020

/merge

@sre-bot
Copy link
Contributor

sre-bot commented Feb 7, 2020

/run-all-tests

@sre-bot sre-bot merged commit 13bf6cc into pingcap:master Feb 7, 2020
hsqlu pushed a commit to hsqlu/tidb that referenced this pull request Feb 8, 2020
@wshwsh12 wshwsh12 deleted the sort_part2 branch April 21, 2020 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/new-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disk-based sort executor
5 participants