Skip to content

Commit

Permalink
[fix][ml] Fix race conditions in RangeCache (#22789)
Browse files Browse the repository at this point in the history
(cherry picked from commit c39f9f8)
  • Loading branch information
lhotari committed Jun 3, 2024
1 parent c0aab49 commit a8b8324
Show file tree
Hide file tree
Showing 3 changed files with 254 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
import org.apache.bookkeeper.client.api.LedgerEntry;
import org.apache.bookkeeper.mledger.Entry;
import org.apache.bookkeeper.mledger.util.AbstractCASReferenceCounted;
import org.apache.bookkeeper.mledger.util.RangeCache;

public final class EntryImpl extends AbstractCASReferenceCounted implements Entry, Comparable<EntryImpl>,
ReferenceCounted {
RangeCache.ValueWithKeyValidation<PositionImpl> {

private static final Recycler<EntryImpl> RECYCLER = new Recycler<EntryImpl>() {
@Override
Expand Down Expand Up @@ -205,4 +206,8 @@ protected void deallocate() {
recyclerHandle.recycle(this);
}

@Override
public boolean matchesKey(PositionImpl key) {
return key.compareTo(ledgerId, entryId) == 0;
}
}
Loading

0 comments on commit a8b8324

Please sign in to comment.