-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
etcd-tester: check expired lease with -1 TTL #7415
Conversation
@@ -133,7 +132,7 @@ func (lc *leaseChecker) checkShortLivedLease(ctx context.Context, leaseID int64) | |||
var resp *pb.LeaseTimeToLiveResponse | |||
for i := 0; i < retries; i++ { | |||
resp, err = lc.getLeaseByID(ctx, leaseID) | |||
if rpctypes.Error(err) == rpctypes.ErrLeaseNotFound { | |||
if err == nil && resp.TTL == -1 { // lease not found |
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 (err == nil && resp.TTL == -1) || (err != nil && rpctypes.Error(err) == rpctypes.ErrLeaseNotFound)
?
} | ||
if rpctypes.Error(err) == rpctypes.ErrLeaseNotFound { | ||
return true, nil | ||
return resp.TTL == -1, nil |
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 err != nil {
if rpctypes.Error(err) == rpctypes.ErrLeaseNotFound {
return true, nil
}
} else {
return resp.TTL == -1, nil
}
15e4a4a
to
15b9052
Compare
@@ -133,7 +133,8 @@ func (lc *leaseChecker) checkShortLivedLease(ctx context.Context, leaseID int64) | |||
var resp *pb.LeaseTimeToLiveResponse | |||
for i := 0; i < retries; i++ { | |||
resp, err = lc.getLeaseByID(ctx, leaseID) | |||
if rpctypes.Error(err) == rpctypes.ErrLeaseNotFound { | |||
// lease not found when it's follower or leader | |||
if (err == nil && resp.TTL == -1) || (err != nil && rpctypes.Error(err) == rpctypes.ErrLeaseNotFound) { |
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.
I don't think TimeToLive() ever returns ErrLeaseNotFound err via #7305
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 does when it's leader. Now fixed.
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.
was mostly concerned about compat with older clusters, but I guess it only returned ErrLeaseNotFound in the rc's for 3.1?
Following the change at etcd-io@2ca1823 Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
15b9052
to
fb81fb4
Compare
lgtm |
@fanminshi @heyitsanthony I added comments on v3.1 compatibility, since TTL -1 only lives on master branch. Will make sure we highlight those in release note. |
Codecov Report
@@ Coverage Diff @@
## master #7415 +/- ##
==========================================
+ Coverage 70.7% 71.12% +0.42%
==========================================
Files 236 236
Lines 21093 21093
==========================================
+ Hits 14914 15003 +89
+ Misses 5047 4970 -77
+ Partials 1132 1120 -12
Continue to review full report at Codecov.
|
Following the change at
2ca1823
This fixes the error that we are getting