Skip to content

HBASE-27570 Unify tracking of block IO across all read request types - #5004

Merged
bbeaudreault merged 2 commits into
apache:masterfrom
HubSpot:HBASE-27570-2
Feb 4, 2023
Merged

HBASE-27570 Unify tracking of block IO across all read request types#5004
bbeaudreault merged 2 commits into
apache:masterfrom
HubSpot:HBASE-27570-2

Conversation

@bbeaudreault

@bbeaudreaultbbeaudreault commented Feb 1, 2023

Copy link
Copy Markdown
Contributor

There are two benefits to this change:

  1. The old model totally ignores blocks retained by filtered cells. Filtered blocks are still retained, so should be counted.
  2. The old model required covering all request types with addSize calls, and missed checkAndMutate/append/increment. The new model simplifies and unifies accounting between Multiget/Scan and makes it possible to consistently report accurate block IO in metrics (future PR).

However, there is one important functional change here. Previously we kept track of lastBlock in order to try not to overcount blocks when submitting multigets for individual cells of the same row or multiple contiguous rows in the same block. For example:

  • Block A contains rows 1, 2, 3
  • Submit table.get(List.of(1, 2, 3))
  • Existing code would only count block A's size once, while new code will count it 3 times.

I could add similar handling by stashing lastBlock in RpcCallContext (see example commit here). For measuring work done by a request, the new solution is more accurate as-is. For limiting retained blocks, the overcounting may just cause some requests to be broken into smaller chunks than they are today.

The default block size is 64kb and default max result size is 100mb. So one would need to submit a multiget with 1600 gets for individual columns of a row or perfectly ordered contiguous rows within 1 block in order to run into a difference. This feels like an edge case, and lastBlock tracking has numerous ways it can mess up:

  • If the table in the above example had 2 CFs, the same example would overcount in existing solution because each row would have 2 blocks. So lastBlock would keep swapping between those 2 blocks and not actually work.
  • If rows get writes over time, a row is likely to be spread across multiple StoreFiles/blocks and the same above would happen even with 1 CF.
  • If the multiget batch has rows in multiple blocks, and the batch is not ordered by row order. For example block A contains rows 1 and 2, block B contains row 3. Submitting a batch for 1, 3, 2 and lastBlock would be A - B - A, so A would get counted twice
  • If setCacheBlocks(false), the equality check would not work.

With those caveats, it did not feel worth adding the complexity of RpcCallContext lastBlock tracking. But I could easily be convinced otherwise.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

Comment on lines +185 to +189
// This get returns nothing since the filter doesn't match. Filtered cells still retain
// blocks, and this is a full row scan of both blocks. This equals 100 bytes so we should
// throw a multiResponseTooLarge after this get if we are counting filtered cells correctly.
Get g0 = new Get(row).addFamily(FAMILY).setFilter(
new QualifierFilter(CompareOperator.EQUAL, new BinaryComparator(Bytes.toBytes("sdf"))));

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

old method removed from addSize would not count any block io for this get.

Comment on lines +192 to 200
// g1 and g2 each count the first 55 byte block, so we end up with block size of 110
// after g2 and throw a multiResponseTooLarge before g3
Get g1 = new Get(row);
g1.addColumn(FAMILY, cols[0]);
gets.add(g1);

Get g2 = new Get(row);
g2.addColumn(FAMILY, cols[3]);
gets.add(g2);

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

old method would have returned these 2 gets in the same rpc, because of lastBlock tracking (both columns in the same block). We could add that functionality back with a change like this

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

but this only works because of the order of the gets g1, g2, g3. if we instead ordered it g1, g3, g2 lastBlock would not help.

@Apache-HBase

This comment was marked as outdated.

1 similar comment
@Apache-HBase

This comment was marked as outdated.

@bbeaudreault
bbeaudreault marked this pull request as ready for review February 3, 2023 01:29
@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 0sDocker mode activated.
-1 ❌patch0m 3s#5004 does not apply to master. Rebase required? Wrong Branch? See https://yetus.apache.org/documentation/in-progress/precommit-patchnames for help.
SubsystemReport/Notes
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/5/console
versionsgit=2.17.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 0sDocker mode activated.
-1 ❌docker0m 0sDocker failed to build yetus/hbase:e7d1a6a052.
SubsystemReport/Notes
GITHUB PR#5004
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/5/console
versionsgit=2.17.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@bbeaudreault

Copy link
Copy Markdown
ContributorAuthor

Build broken due to https://issues.apache.org/jira/browse/HBASE-27608. Will rebase once that's merged.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 21sDocker mode activated.
-0 ⚠️yetus0m 4sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 56smaster passed
+1 💚compile0m 39smaster passed
+1 💚shadedjars4m 16sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 25smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 42sthe patch passed
+1 💚compile0m 39sthe patch passed
+1 💚javac0m 39sthe patch passed
+1 💚shadedjars4m 18spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23sthe patch passed
_ Other Tests _
+1 💚unit203m 46shbase-server in the patch passed.
224m 47s
SubsystemReport/Notes
DockerClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/5/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#5004
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 907543e9bb83 5.4.0-137-generic #154-Ubuntu SMP Thu Jan 5 17:03:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 55b4bbc
Default JavaTemurin-1.8.0_352-b08
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/5/testReport/
Max. process+thread count2462 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/5/console
versionsgit=2.34.1 maven=3.8.6
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 59sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+1 💚mvninstall3m 39smaster passed
+1 💚compile2m 24smaster passed
+1 💚checkstyle0m 34smaster passed
+1 💚spotless0m 43sbranch has no errors when running spotless:check.
+1 💚spotbugs1m 27smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 11sthe patch passed
+1 💚compile2m 19sthe patch passed
+1 💚javac2m 19sthe patch passed
+1 💚checkstyle0m 32sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck12m 20sPatch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚spotless0m 41spatch has no errors when running spotless:check.
+1 💚spotbugs1m 37sthe patch passed
_ Other Tests _
+1 💚asflicense0m 13sThe patch does not generate ASF License warnings.
37m 42s
SubsystemReport/Notes
DockerClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#5004
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux ec972a4be251 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / bbc20f3
Default JavaEclipse Adoptium-11.0.17+8
Max. process+thread count85 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/console
versionsgit=2.34.1 maven=3.8.6 spotbugs=4.7.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 24sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall2m 45smaster passed
+1 💚compile0m 38smaster passed
+1 💚shadedjars4m 15sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 43sthe patch passed
+1 💚compile0m 40sthe patch passed
+1 💚javac0m 40sthe patch passed
+1 💚shadedjars4m 15spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23sthe patch passed
_ Other Tests _
+1 💚unit203m 41shbase-server in the patch passed.
224m 9s
SubsystemReport/Notes
DockerClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#5004
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 36deaa319c14 5.4.0-137-generic #154-Ubuntu SMP Thu Jan 5 17:03:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / bbc20f3
Default JavaTemurin-1.8.0_352-b08
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/testReport/
Max. process+thread count2343 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/console
versionsgit=2.34.1 maven=3.8.6
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 18sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall3m 41smaster passed
+1 💚compile0m 46smaster passed
+1 💚shadedjars4m 25sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 26smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 17sthe patch passed
+1 💚compile0m 47sthe patch passed
+1 💚javac0m 47sthe patch passed
+1 💚shadedjars4m 25spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 25sthe patch passed
_ Other Tests _
+1 💚unit204m 24shbase-server in the patch passed.
227m 3s
SubsystemReport/Notes
DockerClientAPI=1.42 ServerAPI=1.42 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#5004
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 4bfeab1f54e8 5.4.0-135-generic #152-Ubuntu SMP Wed Nov 23 20:19:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / bbc20f3
Default JavaEclipse Adoptium-11.0.17+8
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/testReport/
Max. process+thread count2444 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5004/6/console
versionsgit=2.34.1 maven=3.8.6
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

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

Nice clean up!

@bbeaudreault
bbeaudreault merged commit 7b26b2a into apache:masterFeb 4, 2023
@bbeaudreault
bbeaudreault deleted the HBASE-27570-2 branch February 4, 2023 17:14
bbeaudreault added a commit that referenced this pull request Feb 4, 2023
bbeaudreault added a commit to HubSpot/hbase that referenced this pull request Feb 5, 2023
bbeaudreault added a commit to HubSpot/hbase that referenced this pull request Feb 10, 2023
bbeaudreault added a commit to HubSpot/hbase that referenced this pull request Feb 10, 2023
bbeaudreault added a commit to HubSpot/hbase that referenced this pull request Feb 28, 2023
…ead request types (apache#5004)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Sign up for freeto 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

@bbeaudreault@Apache-HBase@Apache9