-
Notifications
You must be signed in to change notification settings - Fork 467
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
Get latest counter before attempting a take to ensure take succeeds #886
Conversation
Change log level from debug to warn when update stale leases
dfb7de9
to
e48f6c6
Compare
if (lease.isMarkedForLeaseSteal()) { | ||
try { | ||
return leaseRefresher.getLease(lease.leaseKey()); | ||
} catch (DependencyException | InvalidStateException | ProvisionedThroughputException e) { |
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.
this needs to be addressed
The log line information doesn't really make sense. You can keep the original log line as is, but explain why we would run into getting these exception in the first place
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.
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.
"Unable to retrieve the current lease while refreshing the stale lease" this means that we know for a fact that the leases being refreshed are stale while in fact they can be just the same as in DDB. This is not accurate. You can explain in comment naming different cases we run into exceptions.
"Like while we tried to update the stale leases" <- i am not sure this is the right reason why we would run into such exception. He might have confused it with a conditional update; while this is in fact just a get ddb request. I am guessing his intention is we explain how we would run into dependencyException and invalidStateException
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.
Here we are trying to update the local copy of the leases with latest info in the event of leases going stale. Note that we already fetched the leases from ddb table just a while ago, but now we want to get their latest state in order to successfully steal the leases. Having a message like "Failed to fetch latest state of the lease that needs to be stolen" would help.
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.
can you add leasekey to the msg
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.
leaseKey
is added to the logline
* @param epsilonMillis Allow for some variance when calculating lease expirations | ||
*/ | ||
public static long getRenewerTakerIntervalMillis(long leaseDurationMillis, long epsilonMillis) { | ||
return leaseDurationMillis / 3 - epsilonMillis; |
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.
is this essentially veryOldLeaseDurationNanosMultiplier?
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.
yep, being extracted into a static function
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.
can you use veryOldLeaseDurationNanosMultiplier instead?
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.
it's not from my commit, do you have strong preference about it?
Also can you check why travis ci is complaining? might be transient but double confirm by rerunning |
@avahuang0429 the new run succeeded: https://app.travis-ci.com/github/awslabs/amazon-kinesis-client/builds/243951865 |
9415adb
to
379998e
Compare
try { | ||
return leaseRefresher.getLease(lease.leaseKey()); | ||
} catch (DependencyException | InvalidStateException | ProvisionedThroughputException e) { | ||
log.warn("Failed to fetch latest state of the lease {} that needs to be stolen, " |
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.
added leaseKey
in the logline
Thanks I need to go over the PR one more time. Can you do a functional test for this change and update the CR? Yu Zeng 10:33 AM Ashwin Giridharan 10:34 AM 10:35 Yu Zeng 10:37 AM |
@ashwing Verification section is added in the description with example logs: #886 (comment) |
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.
lgtm
Issue #, if available:
Description of changes:
Get latest counter before attempting a take to ensure take succeeds
raised by @Renjuju, also addressed comments left by @ashwing.Previous Changes
ashwing#94
#765
Verification
isMarkedForSteal
is updated for each lease in each cycle of renewing leasesSee logs here
For all changes made for testing, see here: https://gist.github.com/zengyu714/ef2b46b051a97b4e43184948f25d7a93/revisions?diff=split
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.