Skip to content

HBASE-27531 AsyncRequestFutureImpl unnecessarily clears meta cache for full server - #4930

Merged
bbeaudreault merged 1 commit into
apache:branch-2from
HubSpot:HBASE-27531
Jan 10, 2023
Merged

HBASE-27531 AsyncRequestFutureImpl unnecessarily clears meta cache for full server#4930
bbeaudreault merged 1 commit into
apache:branch-2from
HubSpot:HBASE-27531

Conversation

@bbeaudreault

Copy link
Copy Markdown
Contributor

This reverts to the original behavior prior to https://issues.apache.org/jira/browse/HBASE-21775, which never cleared the full server cache for normal multigets. The null tableName scenario is only in the case of HTableMultiplexer, otherwise tableName is always available. It only makes sense to clear the full cache for requests where we can't determine the correct region to clear, like in HTableMultiplexer.

Skipping the full server clear here is good because:

  1. We already clear the meta cache for the individual regions with failures. Each case where cleanServerCache is called has a subsequent call to updateCachedLocations for the individual regions.
  2. Clearing the cache for a full server is very expensive. The more regions a server hosts, the more expensive it is. An active client would expect to need to re-fill any cleared locations in short order. Clearing 100 regions results in 100x more work than just clearing one, increasing latency on the client and load on the meta region.

The test provided in HBASE-21775 didn't actually test the problem. It just tested that the newly ungated call to cleanServerCache was called. I updated the tests here which help verify that the existing call to updateCachedLocations is enough to recover from any failure.

There are two ways errors are handled:

  1. Failures to submit the multi requests themselves (timeouts or other exceptions thrown by the server prior to handling the multi actions). These go through receiveGlobalFailure.
  2. Failures with one or more of the actions in one of the batch (thrown by the server when it's already started handling the request, but fails partway through). These go through receiveMultiAction.

I added two test cases, one for each case.

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

@bbeaudreault

Copy link
Copy Markdown
ContributorAuthor

Current spotless failure is due to https://issues.apache.org/jira/browse/HBASE-27474. The net-new code here is clean for spotless.

@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

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 48sDocker mode activated.
-0 ⚠️yetus0m 5sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ branch-2 Compile Tests _
+1 💚mvninstall2m 4sbranch-2 passed
+1 💚compile0m 16sbranch-2 passed
+1 💚shadedjars3m 54sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 13sbranch-2 passed
_ Patch Compile Tests _
+1 💚mvninstall2m 4sthe patch passed
+1 💚compile0m 17sthe patch passed
+1 💚javac0m 17sthe patch passed
+1 💚shadedjars3m 55spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 14sthe patch passed
_ Other Tests _
+1 💚unit2m 31shbase-client in the patch passed.
17m 46s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/artifact/yetus-jdk8-hadoop2-check/output/Dockerfile
GITHUB PR#4930
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 26cdaef40649 5.4.0-1092-aws #100~18.04.2-Ubuntu SMP Tue Nov 29 08:39:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionbranch-2 / edc2cbd
Default JavaTemurin-1.8.0_352-b08
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/testReport/
Max. process+thread count164 (vs. ulimit of 30000)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/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 52sDocker mode activated.
-0 ⚠️yetus0m 5sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ branch-2 Compile Tests _
+1 💚mvninstall3m 8sbranch-2 passed
+1 💚compile0m 20sbranch-2 passed
+1 💚shadedjars4m 15sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 18sbranch-2 passed
_ Patch Compile Tests _
+1 💚mvninstall2m 43sthe patch passed
+1 💚compile0m 20sthe patch passed
+1 💚javac0m 20sthe patch passed
+1 💚shadedjars4m 12spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 17sthe patch passed
_ Other Tests _
+1 💚unit2m 59shbase-client in the patch passed.
20m 48s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#4930
Optional Testsjavac javadoc unit shadedjars compile
unameLinux f28e23418a85 5.4.0-1085-aws #92~18.04.1-Ubuntu SMP Wed Aug 31 17:21:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionbranch-2 / edc2cbd
Default JavaEclipse Adoptium-11.0.17+8
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/testReport/
Max. process+thread count192 (vs. ulimit of 30000)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/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 51sDocker 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.
_ branch-2 Compile Tests _
+1 💚mvninstall2m 26sbranch-2 passed
+1 💚compile0m 43sbranch-2 passed
+1 💚checkstyle0m 15sbranch-2 passed
+1 💚spotless0m 41sbranch has no errors when running spotless:check.
+1 💚spotbugs0m 51sbranch-2 passed
_ Patch Compile Tests _
+1 💚mvninstall2m 30sthe patch passed
+1 💚compile0m 43sthe patch passed
+1 💚javac0m 43shbase-client generated 0 new + 108 unchanged - 1 fixed = 108 total (was 109)
+1 💚checkstyle0m 15sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck13m 2sPatch does not cause any errors with Hadoop 2.10.2 or 3.2.4 3.3.4.
+1 💚spotless0m 39spatch has no errors when running spotless:check.
+1 💚spotbugs0m 52sthe patch passed
_ Other Tests _
+1 💚asflicense0m 8sThe patch does not generate ASF License warnings.
25m 38s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#4930
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux e74c6b34d4f3 5.4.0-1092-aws #100~18.04.2-Ubuntu SMP Tue Nov 29 08:39:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionbranch-2 / edc2cbd
Default JavaEclipse Adoptium-11.0.17+8
Max. process+thread count78 (vs. ulimit of 30000)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4930/4/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.


private void cleanServerCache(ServerName server, Throwable regionException) {
if (ClientExceptionsUtil.isMetaClearingException(regionException)) {
if (tableName == null && ClientExceptionsUtil.isMetaClearingException(regionException)) {

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.

In which case tableName could be null?

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.

It's only null for HTableMultiplexer

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.

This reverts the logic back to pre-21775: 5f25985#diff-7c58ffd83c150488599591ed5a3a068599646ebdbbbfdcd2233386e5472cca35L921

The tableName == null check here was standing for very long prior to that. I don't think it was correct to remove, since in the tableName != null (most usages) we'd fall into updateCachedLocations which clears the cache just for the individual regions.

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.

@Apache9 can you give another look?

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.

@saintstack Do you still remember something sir? Skimmed the patch, I'm not sure why removing the tableName == null check can fix the problem described in HBASE-21775, as Tommy Li said

from what I can see, tableName shouldn't be null unless you manually create a BufferedMutatorImpl instead of using ConnectionFactory.createConnection().getBufferedMutator(). I not sure if the bufferedmutator would work at all without a table name.

@bbeaudreault
bbeaudreault merged commit 06c7548 into apache:branch-2Jan 10, 2023
@bbeaudreault
bbeaudreault deleted the HBASE-27531 branch January 10, 2023 12:54
bbeaudreault added a commit that referenced this pull request Jan 10, 2023
…r full server (#4930)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
stoty pushed a commit to stoty/hbase that referenced this pull request Nov 26, 2024
… clears meta cache for full server (apache#4930) (apache#158)
* CDPD-73638: Backport HBASE-27531 AsyncRequestFutureImpl unnecessarily clears meta cache for full server (apache#4930)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 1c98931)
Change-Id: If18b2add03e0509b7b778fcb14c2448353adf442
* CDPD-73638 - TestAsyncProcess.java fix
Change-Id: I1d18f40b052ca2b62bd5428678cbd6a90a859977
---------
Co-authored-by: Bryan Beaudreault <bbeaudreault@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