Skip to content

Commit

Permalink
fix unlock when version of bind changed (#21206)
Browse files Browse the repository at this point in the history
fix unlock when version of bind changed

Approved by: @zhangxu19830126, @sukki37
  • Loading branch information
iamlinjunhong authored Jan 14, 2025
1 parent 22e1ce8 commit adc1e70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions pkg/lockservice/service_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,7 @@ func (s *service) handleRemoteUnlock(
req *pb.Request,
resp *pb.Response,
cs morpc.ClientSession) {
l, err := s.getLocalLockTable(req, resp)
if err != nil ||
l == nil {
// means that the lockservice sending the lock request holds a stale lock
// table binding.
writeResponse(s.logger, cancel, resp, err, cs)
return
}
err = s.Unlock(ctx, req.Unlock.TxnID, req.Unlock.CommitTS, req.Unlock.Mutations...)
err := s.Unlock(ctx, req.Unlock.TxnID, req.Unlock.CommitTS, req.Unlock.Mutations...)
writeResponse(s.logger, cancel, resp, err, cs)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/lockservice/service_remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func TestUnlockWithBindIsStable(t *testing.T) {

checkBind(
t,
pb.LockTable{ServiceID: l1.serviceID, Version: alloc.version + 1, Table: table, OriginTable: table, Valid: true},
pb.LockTable{ServiceID: l1.serviceID, Version: alloc.version, Table: table, OriginTable: table, Valid: true},
l2)
},
)
Expand Down Expand Up @@ -441,7 +441,7 @@ func TestUnlockWithBindNotFound(t *testing.T) {

checkBind(
t,
pb.LockTable{ServiceID: l1.serviceID, Version: alloc.version, Table: table, OriginTable: table, Valid: true},
pb.LockTable{Table: table, ServiceID: "s3", Valid: true, Version: alloc.version},
l2)
},
)
Expand Down

0 comments on commit adc1e70

Please sign in to comment.