Skip to content

fix: separate storage location accounting for internal cache holds - #20150

Merged
clintropolis merged 3 commits into
apache:masterfrom
clintropolis:fix-storage-location-accounting
Aug 27, 2026
Merged

fix: separate storage location accounting for internal cache holds#20150
clintropolis merged 3 commits into
apache:masterfrom
clintropolis:fix-storage-location-accounting

Conversation

@clintropolis

Copy link
Copy Markdown
Member

Description

Partially loaded segments use the same type of 'holds' a query places on cache entries for 'structural' reasons such as preventing metadata entry or parent bundle entries from being evicted, partial load rules also place holds to pin all entries that the rule requires be loaded, etc. This PR distinguishes these internal usages by adding methods to StorageLocation which internal callers can use to influence how metrics are reported so that these internal usages do not count as cache hits and the like.

@FrankChen021 FrankChen021 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.

Severity Findings
P0 0
P1 0
P2 1
P3 0
Total 1
Severity Findings
P0 0
P1 0
P2 1
P3 0
Total 1

Reviewed 7 of 7 changed files.

Validation: focused git diff --check passed. Builds and tests were not run.


This is an automated review by Codex GPT-5.6-Luna(max)

currHoldBytes.updateAndGet(v -> Math.max(0L, v - holdDelta));
}
// Same correction for internal holds
final long activeInternalHolds = weak.internalHolds.get();

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.

[P2] Internal hold bytes race with reservation resize

adjustReservation changes the entry size before reading internalHolds, while ReservationHold.close() updates internalHolds and subtracts entry.getSize() without the location lock. If a hold closes after resizeReservation but before this read, release subtracts the new size from the old contribution and this correction is skipped, leaving internalHoldBytes nonzero even though internalHoldCount is zero. Synchronize resize and hold accounting or use a consistent per-hold size snapshot, and add a concurrent resize/release test.

@FrankChen021 FrankChen021 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.

I have reviewed the code for correctness, edge cases, concurrency, and integration risks; no issues found.

Reviewed 7 of 7 changed files.

Validation: focused git diff --no-ext-diff --check passed. Builds and tests were not run.


This is an automated review by Codex GPT-5.6-Luna(max)

@cryptoe cryptoe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look good to me.

@clintropolis
clintropolis merged commit 7c367db into apache:master Aug 27, 2026
44 of 45 checks passed
@clintropolis
clintropolis deleted the fix-storage-location-accounting branch August 27, 2026 19:20
@github-actions github-actions Bot added this to the 39.0.0 milestone Aug 27, 2026
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.

3 participants