Skip to content

Commit

Permalink
[fix][ml] Fix race conditions in RangeCache (apache#22789)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed May 31, 2024
1 parent 7ad157c commit c39f9f8
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 c39f9f8

Please sign in to comment.