Skip to content
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

Improvements to reservation column in FATE table and bug fix #4992

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

kevinrr888
Copy link
Member

@kevinrr888 kevinrr888 commented Oct 17, 2024

This PR

  • Makes it so the reservation column is created on reservation and deleted on unreservation (no longer store an unreserved value in the column)
  • Addresses a bug with MultipleStoresIT.testDeadReservationsCleanup() (ZooUtil.LockID was missing equals() and hashCode()) (see NOTE)

NOTE about original bug when I first attempted these changes:
After making the reservation column changes, I tested testDeadReservationsCleanup() to see if I could recreate the same bug noted in this thread #4524 (comment) (TLDR - <4 transactions would show as being reserved, even though 4 threads were working on 4 transactions). I was able to recreate the bug (extremely rarely until I messed with the DeadReservationCleaner timings), but found that it is not related to the reservation column changes and is instead just a bug with the test. I'm not sure why I only saw this bug with the column changes the first go-around, but regardless it's fixed now. I was concerned if this test was identifying a bug with the code, but turns out it was just a problem with the test. The issue was the dead reservation cleaner was removing transactions that weren't dead because the isLockHeld predicate being passed was:
final Predicate<ZooUtil.LockID> isLockHeld = liveLocks::contains;
where
final Set<ZooUtil.LockID> liveLocks = new HashSet<>();
ZooUtil.LockID did not have equals() or hashCode() methods resulting in transactions being unexpectedly unreserved by the dead reservation cleaner.
The real code (the Manager code) never calls equals on the LockID object, so this was just a bug with the test.

closes #4907

* Makes it so the reservation column is created on reservation and deleted on unreservation (no longer store an unreserved value in the column)
* Addresses a bug with MultipleStoresIT.testDeadReservationsCleanup() (ZooUtil.LockID was missing equals() and hashCode())

closes apache#4907
@kevinrr888 kevinrr888 self-assigned this Oct 17, 2024
@kevinrr888 kevinrr888 added this to the 4.0.0 milestone Oct 17, 2024
Copy link
Contributor

@keith-turner keith-turner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find with the LockId problem.

@@ -231,7 +228,9 @@ public Optional<FateTxStore<T>> tryReserve(FateId fateId) {
// Create a unique FateReservation for this reservation attempt
FateReservation reservation = FateReservation.from(lockID, UUID.randomUUID());

FateMutator.Status status = newMutator(fateId).putReservedTx(reservation).tryMutate();
// requiring any status prevents creating an entry if the fate id doesn't exist
FateMutator.Status status =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice comment here. Interesting, I suppose the status check was not needed previously because it was assumed the reservation column always existed if the fate operation existed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, before this, putReservedTx only worked if the reservation column had a NOT_RESERVED value, which was only set on creation and unreservation.

@kevinrr888 kevinrr888 merged commit 1e301e8 into apache:main Oct 21, 2024
8 checks passed
@kevinrr888 kevinrr888 deleted the 4.0-feature-4907 branch October 21, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor how the RESERVATION_COLUMN works for UserFateStore
2 participants