As a caller, I would expect that I could use the blockForAtMost value to control how long I'm willing to wait for the lock before giving up. So I would expect that this code would wait for 10 seconds to acquire the lock and then fail by throwing a LockAcquisitionException if it cannot acquire the lock.
However, the AdvisoryLocksCondition that is used here will end up retrying the lock request 10 times. So this code will actually wait for up to 100 seconds to acquire the lock. This is surprising behavior and can result in much higher latency than callers intended.
With these retries, it is difficult for callers to reliably control how long they wait to acquire locks, since the actual time depends on implementation details of AtlasDB - namely, how many retries are performed here.
It seems much better to avoid retries here so callers are in complete control over how long to wait for locks.
Some of the blocking modes don't really makes sense to retry anyways. The only blocking mode that would be reasonable to retry is BLOCK_UNTIL_TIMEOUT and that has the problems mentioned above.
After this PR
When running transactions with locks, AtlasDB does not retry the lock request if it was unable to acquire the locks on the first attempt.
What do the change types mean?
- `feature`: A new feature of the service.
- `improvement`: An incremental improvement in the functionality or operation of the service.
- `fix`: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
- `break`: Has the potential to break consumers of this service's API, inclusive of both Palantir services
and external consumers of the service's API (e.g. customer-written software or integrations).
- `deprecation`: Advertises the intention to remove service functionality without any change to the
operation of the service itself.
- `manualTask`: Requires the possibility of manual intervention (running a script, eyeballing configuration,
performing database surgery, ...) at the time of upgrade for it to succeed.
- `migration`: A fully automatic upgrade migration task with no engineer input required.
_Note: only one type should be chosen._
How are new versions calculated?
- ❗The `break` and `manual task` changelog types will result in a major release!
- 🐛 The `fix` changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
- ✨ All others will result in a minor version release.
Advisory lock acquisition is no longer retried. Lock acquisition will behave exactly as specified in the provided `LockRequest`.
**Check the box to generate changelog(s)**
- [x] Generate changelog entry
Before this PR
Consider the following code:
As a caller, I would expect that I could use the
blockForAtMost
value to control how long I'm willing to wait for the lock before giving up. So I would expect that this code would wait for 10 seconds to acquire the lock and then fail by throwing aLockAcquisitionException
if it cannot acquire the lock.However, the
AdvisoryLocksCondition
that is used here will end up retrying the lock request 10 times. So this code will actually wait for up to 100 seconds to acquire the lock. This is surprising behavior and can result in much higher latency than callers intended.With these retries, it is difficult for callers to reliably control how long they wait to acquire locks, since the actual time depends on implementation details of AtlasDB - namely, how many retries are performed here.
It seems much better to avoid retries here so callers are in complete control over how long to wait for locks.
Some of the blocking modes don't really makes sense to retry anyways. The only blocking mode that would be reasonable to retry is
BLOCK_UNTIL_TIMEOUT
and that has the problems mentioned above.After this PR
When running transactions with locks, AtlasDB does not retry the lock request if it was unable to acquire the locks on the first attempt.