Skip to content

[server] release remote log index cache entries on deletion#3737

Open
zuston wants to merge 1 commit into
apache:mainfrom
zuston:removeremoteentry
Open

[server] release remote log index cache entries on deletion#3737
zuston wants to merge 1 commit into
apache:mainfrom
zuston:removeremoteentry

Conversation

@zuston

@zuston zuston commented Jul 22, 2026

Copy link
Copy Markdown
Member

Purpose

Explicitly release remote log index cache entries on deletion.

Brief change log

Tests

API and Format

Documentation

@zuston

zuston commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

ptal @fresh-borzoni

@fresh-borzoni fresh-borzoni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@zuston Thank you, this is a very good addition 👍 Left suggestion, PTAL

if (success) {
if (!expiredRemoteLogSegments.isEmpty()) {
// Release the mmap-backed local indexes before deleting the remote files.
remoteLogIndexCache.removeAll(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Q: shall we removeAll after deleteRemoteLogSegmentFiles instead of before?
In the gap between manifest commit and remote deletion, an in-flight reader can miss the cache and re-download the index (remote files still exist at that point), re-inserting an entry that nothing will ever remove again, essentially the exact leak this PR fixes.

The read-refcount TODO would fix the reader-error half of this race, but not the leak half and the reorder(the thing that I propose here) composes with it if it ever lands: drain -> delete files -> removeAll.

WDYT?

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.

2 participants