Skip to content

Commit

Permalink
Don't insert to entry cache for the ShadowManagedLedger
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertIndie committed Sep 3, 2024
1 parent 570edbd commit d60d5bb
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,8 @@ public void run() {
ManagedLedgerImpl.TOTAL_SIZE_UPDATER.addAndGet(ml, dataLength);

long ledgerId = ledger != null ? ledger.getId() : ((Position) ctx).getLedgerId();
// Don't insert to the entry cache when the entry payload is empty
final var duplicatedData = data.duplicate();
Commands.skipBrokerEntryMetadataIfExist(duplicatedData);
Commands.skipChecksumIfPresent(duplicatedData);
long metadataSize = duplicatedData.readUnsignedInt();
if (duplicatedData.readableBytes() > metadataSize && ml.hasActiveCursors()) {
// Don't insert to the entry cache for the ShadowManagedLedger
if (!(ml instanceof ShadowManagedLedgerImpl) && ml.hasActiveCursors()) {
// Avoid caching entries if no cursor has been created
EntryImpl entry = EntryImpl.create(ledgerId, entryId, data);
// EntryCache.insert: duplicates entry by allocating new entry and data. so, recycle entry after calling
Expand Down

0 comments on commit d60d5bb

Please sign in to comment.