-
Notifications
You must be signed in to change notification settings - Fork 131
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
drainer/: Reduce memory usage (#735) #737
Merged
lichunzhu
merged 23 commits into
pingcap:master
from
lichunzhu:czli/drainer/reduceMemoryUsage
Sep 25, 2019
Merged
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
0dfc864
Change unreasonable buff size and reduce memory usage
lichunzhu 212d716
Merge branch 'master' of https://github.com/pingcap/tidb-binlog into …
lichunzhu 4520757
wait for 0.01s for goroutines to update status
lichunzhu 04d71a1
Merge branch 'master' of https://github.com/pingcap/tidb-binlog into …
lichunzhu 8a6124a
change defaultBinlogItemCount to 8; revise /tests/status/run.sh to sk…
lichunzhu b860497
fix check error
lichunzhu dafce05
Merge branch 'master' of https://github.com/pingcap/tidb-binlog into …
lichunzhu f9fc0e0
Merge branch 'master' of https://github.com/pingcap/tidb-binlog into …
lichunzhu e21f41c
Merge branch 'czli/drainer/reduceMemoryUsage' of https://github.com/l…
lichunzhu 9bd6252
eliminate loader & syncer buffer usage
lichunzhu e513e0d
Merge branch 'czli/drainer/reduceMemoryUsage' of https://github.com/l…
lichunzhu 4b74231
reduce memory usage for success channel
lichunzhu 1e51514
add txn manager
lichunzhu 60bd55e
remove info clear and reduce success channel buffer
lichunzhu be6146d
Merge branch 'master' into czli/drainer/reduceMemoryUsage
july2993 9b4a2e5
Add more comments and logs for txnManager. Refine txnManager's code.
lichunzhu e6aded0
simplify atomic operations
lichunzhu 6ddab70
Merge branch 'master' into czli/drainer/reduceMemoryUsage
IANTHEREAL 03427a7
add two unit tests for txnManager to test whether txnManager can quit…
lichunzhu 21d4efc
reduce wait time
lichunzhu 6789bdf
simplify load_test
lichunzhu 81e586c
simplify failMsg
lichunzhu 64aa654
Update pkg/loader/load_test.go
lichunzhu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -396,7 +396,7 @@ func (s *txnManagerSuite) TestRunTxnManager(c *check.C) { | |
for i := 0; i < 5; i++ { | ||
select { | ||
case input <- txn: | ||
case <-time.After(50 * time.Microsecond): | ||
case <-time.After(10 * time.Microsecond): | ||
c.Fatal("txnManager gets blocked while receiving txns") | ||
} | ||
} | ||
|
@@ -413,13 +413,13 @@ func (s *txnManagerSuite) TestRunTxnManager(c *check.C) { | |
case t := <-output: | ||
txnManager.pop(t) | ||
c.Assert(t, check.DeepEquals, txn) | ||
case <-time.After(50 * time.Microsecond): | ||
default: | ||
c.Fatal("Fail to pick txn from txnManager") | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. select {
case t := <-output:
case <-time.After...
} This pattern appears a lot in this test, is it possible to extract this as a helper function to simplify the test? |
||
// Now txn won't be blocked but txnManager should be blocked at cond.Wait() | ||
select { | ||
case input <- txn: | ||
case <-time.After(50 * time.Microsecond): | ||
case <-time.After(10 * time.Microsecond): | ||
c.Fatal("txnManager gets blocked while receiving txns") | ||
} | ||
// close txnManager and output should be closed when txnManager is closed | ||
|
@@ -455,21 +455,21 @@ func (s *txnManagerSuite) TestAddBigTxn(c *check.C) { | |
} | ||
select { | ||
case input <- txnBig: | ||
case <-time.After(50 * time.Microsecond): | ||
case <-time.After(10 * time.Microsecond): | ||
c.Fatal("txnManager gets blocked while receiving txns") | ||
} | ||
select { | ||
case t := <-output: | ||
txnManager.pop(t) | ||
c.Assert(t, check.DeepEquals, txnSmall) | ||
case <-time.After(50 * time.Microsecond): | ||
default: | ||
c.Fatal("Fail to pick txn from txnManager") | ||
} | ||
select { | ||
case t := <-output: | ||
txnManager.pop(t) | ||
c.Assert(t, check.DeepEquals, txnBig) | ||
case <-time.After(50 * time.Microsecond): | ||
case <-time.After(10 * time.Microsecond): | ||
c.Fatal("Fail to pick txn from txnManager") | ||
} | ||
txnManager.Close() | ||
|
@@ -501,7 +501,7 @@ func (s *txnManagerSuite) TestCloseLoaderInput(c *check.C) { | |
case t := <-output: | ||
txnManager.pop(t) | ||
c.Assert(t, check.DeepEquals, txn) | ||
case <-time.After(50 * time.Microsecond): | ||
case <-time.After(10 * time.Microsecond): | ||
c.Fatal("Fail to pick txn from txnManager") | ||
} | ||
// output should be closed when input is closed | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the 5th txn get blocked sending to
input
, why didn't this test fail?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 5th txn was picked from
input
but can't be added to thetxnManager.cacheChan
. Although it gets blocked atcond.Wait()
but it's still picked out frominput
. By the way, we can't know atxn
's size when it is not picked out frominput
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check
c.Assert(output, check.HasLen, 4)
can make sure it's not added.