Skip to content

HBASE-28468: Integration of time-based priority caching in eviction logic. #5826

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

Closed
wants to merge 1 commit into from

Conversation

jhungund
Copy link
Contributor

HBASE-28468: Integration of time-based priority caching in eviction logic.

The time-based priority caching relies on the presence of file paths in the block-cache key.
However, in case of the persitent cache, the file paths are not persisted in the files.

Hence, when the region server is restarted, the block cache keys need to be
repopulated with the file paths.

This change addresses the following:

  1. Always populate the block-cache key with path during its creation.
  2. Fetch the file paths corresponding to the file names of the block-cache key
    during restarts.
  3. Use the Data-Tiering-Manager APIs during cache-full scenario to evict the cold file blocks.

Copy link
Contributor

@wchevreuil wchevreuil left a comment

Choose a reason for hiding this comment

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

You are passing @vinayakphegde 's commit together with yours in this PR, and this is causing conflicts with the target branch (the PR can't be merged). Please rebase your local branch first, resolve any conflicts locally and force push to your branch, making sure the PR is mergeable.

…ogic.

The time-based priority caching relies on the presence of file paths in the block-cache key.
However, in case of the persitent cache, the file paths are not persisted in the files.

Hence, when the region server is restarted, the block cache keys need to be
repopulated with the file paths.

This change addresses the following:
1. Always populate the block-cache key with path during its creation.
2. Fetch the file paths corresponding to the file names of the block-cache key
   during restarts.
3. Use the Data-Tiering-Manager APIs during cache-full scenario to evict the cold file blocks.

Change-Id: Ice19bd41064c73538ee3d3755057813a531b9171
BlockCacheKey key = new BlockCacheKey(protoKey.getHfilename(), protoKey.getOffset(),
protoKey.getPrimaryReplicaBlock(), fromPb(protoKey.getBlockType()));

BlockCacheKey key;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need handling with and without paths in the BlockCacheKey creation

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 0s Docker mode activated.
-1 ❌ docker 1m 24s Docker failed to build yetus/hbase:8a715fadd5.
Subsystem Report/Notes
GITHUB PR #5826
JIRA Issue HBASE-28468
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/console
versions git=2.17.1
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@jhungund
Copy link
Contributor Author

You are passing @vinayakphegde 's commit together with yours in this PR, and this is causing conflicts with the target branch (the PR can't be merged). Please rebase your local branch first, resolve any conflicts locally and force push to your branch, making sure the PR is mergeable.

Ack!

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 49s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ HBASE-28463 Compile Tests _
+1 💚 mvninstall 3m 5s HBASE-28463 passed
+1 💚 compile 0m 51s HBASE-28463 passed
+1 💚 shadedjars 5m 17s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 27s HBASE-28463 passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 49s the patch passed
+1 💚 compile 0m 51s the patch passed
+1 💚 javac 0m 51s the patch passed
+1 💚 shadedjars 5m 13s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 26s the patch passed
_ Other Tests _
-1 ❌ unit 243m 6s hbase-server in the patch failed.
269m 17s
Subsystem Report/Notes
Docker ClientAPI=1.45 ServerAPI=1.45 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #5826
JIRA Issue HBASE-28468
Optional Tests javac javadoc unit shadedjars compile
uname Linux ca34f533425f 5.4.0-172-generic #190-Ubuntu SMP Fri Feb 2 23:24:22 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision HBASE-28463 / b7bb8b9
Default Java Eclipse Adoptium-11.0.17+8
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/artifact/yetus-jdk11-hadoop3-check/output/patch-unit-hbase-server.txt
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/testReport/
Max. process+thread count 5087 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/console
versions git=2.34.1 maven=3.8.6
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 26s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ HBASE-28463 Compile Tests _
+1 💚 mvninstall 2m 47s HBASE-28463 passed
+1 💚 compile 0m 41s HBASE-28463 passed
+1 💚 shadedjars 5m 45s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s HBASE-28463 passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 29s the patch passed
+1 💚 compile 0m 41s the patch passed
+1 💚 javac 0m 41s the patch passed
+1 💚 shadedjars 5m 46s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 23s the patch passed
_ Other Tests _
-1 ❌ unit 247m 40s hbase-server in the patch failed.
271m 56s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #5826
JIRA Issue HBASE-28468
Optional Tests javac javadoc unit shadedjars compile
uname Linux f1920bd54ea5 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision HBASE-28463 / b7bb8b9
Default Java Temurin-1.8.0_352-b08
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/artifact/yetus-jdk8-hadoop3-check/output/patch-unit-hbase-server.txt
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/testReport/
Max. process+thread count 4768 (vs. ulimit of 30000)
modules C: hbase-server U: hbase-server
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5826/1/console
versions git=2.34.1 maven=3.8.6
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@wchevreuil wchevreuil left a comment

Choose a reason for hiding this comment

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

Can we add a UT for the eviction logic? I can't see any test for that.

@@ -79,7 +79,7 @@ public void run() {
// so we check first if the block exists on its in-memory index, if so, we just
// update the offset and move on to the next block without actually going read all
// the way to the cache.
BlockCacheKey cacheKey = new BlockCacheKey(name, offset);
BlockCacheKey cacheKey = new BlockCacheKey(path, offset, true, BlockType.DATA);
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you know this is a Data block? At this point, I don't think this can be assumed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The constructor used earlier(BlockCacheKey(name, offset);) sets these parameters internally. Hence, I used these parameters:

public BlockCacheKey(String hfileName, long offset) {
this(hfileName, offset, true, BlockType.DATA);
}

Comment on lines +146 to +148
// Data-Tiering manager has not been set up.
// Ignore the error and proceed with the normal flow.
LOG.error("Error while getting DataTieringManager instance: {}", e.getMessage());
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this to be expected often? If so, let's lower the log level to DEBUG. If not, it seems we can still continue RS normal functioning, so it should rather be a WARNING than an ERROR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack!

Comment on lines +939 to +948

// Check the list of files to determine the cold files which can be readily evicted.
Set<String> coldFiles =
DataTieringManager.getInstance().getColdDataFiles(backingMap.keySet());
if (coldFiles != null) {
for(String fileName : coldFiles) {
evictBlocksByHfileName(fileName);
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

We can do like this here, but then can we think if we can modify DataTieringManager somehow to track when we have no CF with TIME_RANGE type? That way we could avoid this extra loops through the whole set of block keys unnecessarily.

Alternatively, we could follow the BucketEntryGroup logic starting from #987. We could define a COLD priority group and add that as the first group in the priority queue. That way we don't need this extra loop over the whole block sets to find out which blocks are cold. We would leverage the already existing loop from line #996 for that.

@wchevreuil
Copy link
Contributor

Can we close this PR and favour the #5829 as the solution for HBASE-28468?

@jhungund
Copy link
Contributor Author

Can we close this PR and favour the #5829 as the solution for HBASE-28468?

ack!

@jhungund jhungund closed this Apr 19, 2024
@jhungund
Copy link
Contributor Author

Closing this PR in favour of #5829 as the solution for HBASE-28468?

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