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

Add fadvise:AUTO_RANDOM mode #1243

Open
wants to merge 5 commits into
base: branch-2.2.x
Choose a base branch
from
Open

Add fadvise:AUTO_RANDOM mode #1243

wants to merge 5 commits into from

Conversation

singhravidutt
Copy link
Contributor

No description provided.

@singhravidutt
Copy link
Contributor Author

/gcbrun

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 86.66667% with 14 lines in your changes missing coverage. Please review.

Project coverage is 80.74%. Comparing base (e956f85) to head (fa69dd7).

Files with missing lines Patch % Lines
...e/cloud/hadoop/gcsio/FileAccessPatternManager.java 85.71% 3 Missing and 6 partials ⚠️
...ud/hadoop/gcsio/GoogleCloudStorageReadChannel.java 87.50% 0 Missing and 3 partials ⚠️
...oop/gcsio/GoogleCloudStorageClientReadChannel.java 80.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                Coverage Diff                 @@
##             branch-2.2.x    #1243      +/-   ##
==================================================
- Coverage           80.84%   80.74%   -0.10%     
- Complexity           2418     2433      +15     
==================================================
  Files                 167      168       +1     
  Lines               10815    10871      +56     
  Branches             1197     1208      +11     
==================================================
+ Hits                 8743     8778      +35     
- Misses               1544     1557      +13     
- Partials              528      536       +8     
Flag Coverage Δ
hadoop2integrationtest 63.62% <56.19%> (-0.38%) ⬇️
hadoop2unittest 67.18% <84.76%> (-0.08%) ⬇️
hadoop3integrationtest 63.62% <56.19%> (-0.19%) ⬇️
hadoop3unittest 67.26% <84.76%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@singhravidutt singhravidutt marked this pull request as ready for review August 30, 2024 03:29
return;
}
if (readOptions.getFadvise() == Fadvise.AUTO_RANDOM) {
if (isSequentialAccessPattern(currentPosition)) {

Choose a reason for hiding this comment

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

will it only switch from sequential -> random once and not go back to sequential? Is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it is as per the request as mentioned in the document AUTO_RANDOM starts assuming "RANDOM" file access and adapts to "SEQUENTIAL" if read pattern is so. Once it's adapted it will not flip again.

gcs/CONFIGURATION.md Show resolved Hide resolved
gcs/CONFIGURATION.md Show resolved Hide resolved
}
}

public AdaptiveFileAccessPattern(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this class is not a "Pattern", but rather a "PatternTracker". Why not name this accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't track the pattern of access but decide on pattern which is derived by tracking the requests. I agrees that it's also not a "Pattern". Will change it to AccessPatternManager or something on those lines.

consecutiveRequestsDistances.add(currentPosition - lastServedIndex);
}

if (!shouldDetectSequentialAccess()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not have this as the first check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will help populate the distance accurately. I do agree that it will not be used if shouldDetectSequentialAccess returns true. I find it to be helpful in maintaining the correct state.

this.randomAccess = readOptions.getFadvise() == Fadvise.RANDOM;
this.fileAccessPattern = new AdaptiveFileAccessPattern(resourceId, readOptions);
if (gzipEncoded) {
fileAccessPattern.overrideAccessPattern(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not have this as part of constructor. That way we can make the overRideAccessPattern final. Even better have a dummy noop FileAccessPattern for this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is part of the constructor.
Only reason fileAccessPattern is not final is because we are cleaning up the state maintained in it during close.

Copy link
Contributor

Choose a reason for hiding this comment

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

Have a set method breaks the encapsulation. I think in this case it can be easily avoided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I understand.
We have two scenarios in one we will know the gzip info before hand and in other we will get to know about it at later point hence the fn:overrideAccessPattern.

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