-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fix a flaky test in boltdb shipper #2550
fix a flaky test in boltdb shipper #2550
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2550 +/- ##
==========================================
- Coverage 63.46% 63.37% -0.10%
==========================================
Files 166 166
Lines 14582 14584 +2
==========================================
- Hits 9254 9242 -12
- Misses 4586 4601 +15
+ Partials 742 741 -1
|
@@ -379,3 +377,10 @@ func loadBoltDBsFromDir(dir string) (map[string]*bbolt.DB, error) { | |||
|
|||
return dbs, nil | |||
} | |||
|
|||
// getOldestActiveShardTime returns the time of oldest active shard with a buffer of 1 minute. | |||
func getOldestActiveShardTime() time.Time { |
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.
Admittedly I'm not that familiar with this code, but I'm having a bit of difficulty following. Wouldn't it make more sense as func getOldestActiveShardTime(from time.Time) time.Time
, which could then be passed time.Now()
as an argument?
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.
We actually always have 1 active shard at a time but we consider last active shard as still active if it was active a minute back. This is to avoid any race conditions. I don't mind changing the function to accept a time.Time
as a parameter but it would always be getting time.Now
as input. Do you want me to change it?
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.
No worries. I think I get this now.
* add Redis cache flags used by redigo: idle-timeout, wait, max-conn-lifetime Signed-off-by: Kyeongwon Seo <ruddnjs1230@gmail.com> * update CHANGELOG.md Signed-off-by: Kyeongwon Seo <ruddnjs1230@gmail.com> * apply check-doc comments Signed-off-by: Kyeongwon Seo <ruddnjs1230@gmail.com> * remove white-noise Signed-off-by: Kyeongwon Seo <ruddnjs1230@gmail.com> * rename the Redis flag: wait -> wait-on-pool-exhaustion Signed-off-by: Kyeongwon Seo <ruddnjs1230@gmail.com>
What this PR does / why we need it:
The test
TestTable_ImmutableUploads
was flaky and was failing based on when tests are running.This PR fixes the tests by making the time calculation for oldest active shard time uniform between the actual code and the test by moving it to a function.
Checklist