lease
lease copied to clipboard
Should not update uuid in old held leases
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
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.
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.
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.