lease icon indicating copy to clipboard operation
lease copied to clipboard

Should not update uuid in old held leases

Open cjorba opened this issue 7 years ago • 3 comments

We've found issues when trying to update the lease with extra fields when it has been renewed by the renewer gorutine. Looking into it we've found that it is because the concurrencyToken is being updated (along with the whole Lease struct) every time it is renewed. By comparing it with the base Java implementation I think the concurrencyToken should not change on Renew, only in Take. In the commit history we've seen you already had fixed this on commit 5737f37 yet you changed your mind on commit e663b4a; I was wondering if you could elaborate on why this last commit was needed.

If you need more info or want to comment about it please don't hesitate to contact me.

Greetings

cjorba avatar Dec 15 '17 23:12 cjorba

Hey @cjorba, Thanks for taking the time to open this issue, and sorry for the delay. I was a bit busy lately. The commit message is a bit poor (I need to work on that), but I think I added it because of the ForceUpdate method. After investigating it, I quite sure that the problem is here. I'm generating a new concurrency-token each update, instead of reusing the existing one. I'll planning to fix that, revert the commit you mentioned, and add integration tests for this package.

I'll continue to update this ticket.

a8m avatar Dec 23 '17 09:12 a8m

Hi, sorry for the delay, I think the Decode function it's ok as it is now. I think the only change that is needed is to revert commit e663b4a. I can do the pull request for you to review.

cjorba avatar Jan 02 '18 20:01 cjorba

I've created this Pull Request: #4 Besides putting back the missing if in Renew I've added a line in RenewLease that updates lastRenew along with the Counter.

cjorba avatar Jan 03 '18 17:01 cjorba