Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added changes to enable full file cache stats #17538

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mayanksharma27
Copy link

Description

  • Added Changes to enable FullFileCacheStats
  • Added integration tests for FileCacheStats and FullFileCacheStats for writable warm.

Related Issues

Resolves #17537
Meta Issue #13149

Check List

  • [ ✓ ] Functionality includes testing.
  • [ NA] API changes companion pull request created, if applicable.
  • [NA] Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Contributor

github-actions bot commented Mar 6, 2025

❌ Gradle check result for da0dcc9: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

/**
* Statistics on full file cache.
*/
@PublicApi(since = "3.0.0")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets mark all the new classes as ExperimentalAPI as it gives us flexibility to make changes w/o breaking the compatibility in next releases.

Comment on lines +19 to +20
private final CounterMetric activeFullFileBytes = new CounterMetric();
private final CounterMetric activeFullFileCount = new CounterMetric();
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets remove this along with hitsCount , missCount for now. It is easy for accounting this on block based files as it is on per block level. For full file, accounting for every read will make the bring the counting in every read/write adding to CPU/latency overhead. We can revisit it once we feel the need for it.

@@ -103,6 +111,7 @@ public void testWritableWarmFeatureFlagDisabled() {
}

public void testWritableWarmBasic() throws Exception {

Copy link
Collaborator

Choose a reason for hiding this comment

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

nit : remove unintended changes.

for (NodeStats stats : response.getNodes()) {
FileCacheStats fcStats = stats.getFileCacheStats();
if (!Objects.isNull(fcStats)) {
if (!isFileCacheEmpty(fcStats)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit : we use convention of == false to increase readability throughout our repo . Pls follow the same.


FileCache fileCache = internalTestCluster.getDataNodeInstance(Node.class).fileCache();

// TODO: Make these validation more robust.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pls add when are we going to do that . I guess switchable index input ?

Comment on lines +65 to +87
this.theCache = SegmentedCache.<Path, CachedIndexInput>builder()
// use length in bytes as the weight of the file item
.weigher(CachedIndexInput::length)
.listener((removalNotification) -> {
RemovalReason removalReason = removalNotification.getRemovalReason();
CachedIndexInput value = removalNotification.getValue();
Path key = removalNotification.getKey();

if (removalReason != RemovalReason.REPLACED) {

// check if full file and publish metric
if (value instanceof CachedFullFileIndexInput) {
fullFileCacheStatsCollector.recordUsedFileBytes(value.length(), false);
}

catchAsRuntimeException(value::close);
catchAsRuntimeException(() -> Files.deleteIfExists(key));
}
})
.capacity(capacity)
.build();
;

Copy link
Collaborator

Choose a reason for hiding this comment

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

Lets de-dupe the code which is there in other cxtor as well .

@gbbafna gbbafna requested review from rayshrey and shourya035 March 10, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working _No response_
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Added FullFileCacheStats for writable warm.
2 participants