Skip to content

HBASE-29251 Procedure gets stuck if the procedure state cannot be persisted - #6910

Merged
virajjasani merged 7 commits into
apache:masterfrom
virajjasani:HBASE-29251-master
Apr 23, 2025
Merged

HBASE-29251 Procedure gets stuck if the procedure state cannot be persisted#6910
virajjasani merged 7 commits into
apache:masterfrom
virajjasani:HBASE-29251-master

Conversation

@virajjasani

@virajjasanivirajjasani commented Apr 16, 2025

Copy link
Copy Markdown
Contributor

Comment on lines +159 to +162
if (updateFailForTest) {
// test for HBASE-29251
throw new IOException("Update failed");
}

@virajjasanivirajjasaniApr 16, 2025

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.

Not a good way to test his, but since MasterRegion is final class, extending it is also not possible.

Using this, we can reproduce the exact issue with the test if we don't abort master with IOE.

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.

I think it should be fine to remove final from MasterRegion class so that we can extend it for testing purpose.

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.

Let's do that and then make this test more clean.

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.

MasterRegion has a private constructor, that's why we mark it as final.

Since UpdateMasterRegion is just a interface, I think it is very easy to verify the changes?

@Apache9Apache9Apr 17, 2025

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.

And inside MasterRegion we just use HRegion, for HRegion, we have a way to inject specify implementation class. Please see HRegion.newHRegion

 public static HRegion newHRegion(Path tableDir, WAL wal, FileSystem fs, Configuration conf,
RegionInfo regionInfo, final TableDescriptor htd, RegionServerServices rsServices) {
try {
@SuppressWarnings("unchecked")
Class<? extends HRegion> regionClass =
(Class<? extends HRegion>) conf.getClass(HConstants.REGION_IMPL, HRegion.class);
Constructor<? extends HRegion> c =
regionClass.getConstructor(Path.class, WAL.class, FileSystem.class, Configuration.class,
RegionInfo.class, TableDescriptor.class, RegionServerServices.class);
return c.newInstance(tableDir, wal, fs, conf, regionInfo, htd, rsServices);
} catch (Throwable e) {
// todo: what should I throw here?
throw new IllegalStateException("Could not instantiate a region instance.", e);
}
}

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.

Any custom implementation of UpdateMasterRegion also needs custom hooks in Procedure executor classes, which make it more complicated to test.

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.

Thanks @Apache9@apurtell! Updated the test, now it's clean.

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.

You need to define what you want to test, if you just want to make sure that if there is an exception you will call abort, it is very easy, and even do not need to bring up a cluster.

If you want to do something like a integration tests, you can extend HRegion, and there are bunch of ways to decide whether to throw an exception in batchMutate method. You can make the specific HRegion implementation an inner class of the testcase, and set a static field in the test class to control whether to throw an exception...

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

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

Approved but do consider a cleaner test

Comment on lines +159 to +162
if (updateFailForTest) {
// test for HBASE-29251
throw new IOException("Update failed");
}

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.

Let's do that and then make this test more clean.

server.abort("WAL sync timeout", e);
} catch (IOException e) {
LOG.error(HBaseMarkers.FATAL, "MasterRegion mutation is not successful. Aborting server.");
server.abort("MasterRegion mutation is not successful", e);

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.

Aborting is a start.
The rest of my question here is addressed by the discussion on the JIRA.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

} catch (WALSyncTimeoutIOException e) {
LOG.error(HBaseMarkers.FATAL, "WAL sync timeout. Aborting server.");
server.abort("WAL sync timeout", e);
} catch (IOException e) {

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.

Better add some comments here, to summary the discussion on the jira, and also give a pointer to the jira, to let later developpers know why here we will abort for any IOExceptions.

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.

Done, thanks!

public static void setUpBeforeClass() throws Exception {
TEST_UTIL.getConfiguration().setClass(HConstants.REGION_IMPL, TestRegion.class, HRegion.class);
StartTestingClusterOption.Builder builder = StartTestingClusterOption.builder();
builder.numMasters(4).numRegionServers(3);

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.

We need 4 masters?

@virajjasanivirajjasaniApr 18, 2025

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.

3 would also work (2 are aborted) but i just kept one additional. I can keep it 3 if you are not fine with this.

@Apache-HBase

This comment has been minimized.

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

LGTM

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

// RegionTooBusyException is the type of IOException for which we can retry
// for few times before aborting the active master. The master region might
// have genuine case for delayed flushes and/or some procedure bug causing
// heavy pressure on the memstore.

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.

If RegionTooBusyException is caught, here can trigger flusherAndCompactor.onUpdate();

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.

You mean for tries == (maxRetriesForRegionUpdates - 1) condition? Otherwise, it will do it anyways for all retries as per the above loop.

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.

I mean like this:

 } catch (RegionTooBusyException e) {
flusherAndCompactor.onUpdate();
if (tries == (maxRetriesForRegionUpdates - 1)) {
***
}
}

The time interval hasn't been reached, but the changesAfterLastFlush threshold has been met, could happen, so when this exception caught. you need to trigger flusherAndCompactor.onUpdate();

Or otherwise, you need to switch the execution order

flusherAndCompactor.onUpdate(); // first
action.update(region); // after

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.

Makes sense!

@Reidddddd

Copy link
Copy Markdown
Contributor

Will you add back-off feature in next ticket?

abortServer(e);
}
LOG.info("Master region {} is too busy... retry attempt: {}", region, tries);
Threads.sleep(ConnectionUtils.getPauseTime(regionUpdateRetryPauseTime, tries));

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.

@Reidddddd exponential backoff is added here. I think I should add comment here, because single line is not readable enough, let me do that.

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

+1

@virajjasani

Copy link
Copy Markdown
ContributorAuthor

Thanks everyone for the reviews! Awaiting final build results before merging the PR, the jenkins build is still stuck scheduling the build to a VM.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 27sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+0 🆗codespell0m 0scodespell was not available.
+0 🆗detsecrets0m 0sdetect-secrets was not available.
+1 💚@author0m 0sThe patch does not contain any @author tags.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
_ master Compile Tests _
+1 💚mvninstall3m 40smaster passed
+1 💚compile3m 22smaster passed
+1 💚checkstyle0m 41smaster passed
+1 💚spotbugs1m 47smaster passed
+1 💚spotless0m 52sbranch has no errors when running spotless:check.
-0 ⚠️patch0m 59sUsed diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+1 💚mvninstall3m 28sthe patch passed
+1 💚compile3m 14sthe patch passed
+1 💚javac3m 14sthe patch passed
+1 💚blanks0m 0sThe patch has no blanks issues.
+1 💚checkstyle0m 39sthe patch passed
+1 💚spotbugs1m 53sthe patch passed
+1 💚hadoopcheck14m 33sPatch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚spotless0m 56spatch has no errors when running spotless:check.
_ Other Tests _
+1 💚asflicense0m 22sThe patch does not generate ASF License warnings.
44m 23s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6910/8/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#6910
Optional Testsdupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
unameLinux 0ad8e13010a8 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 47edd9a
Default JavaEclipse Adoptium-17.0.11+9
Max. process+thread count83 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6910/8/console
versionsgit=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeLogfileComment
+0 🆗reexec0m 29sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --author-ignore-list --blanks-eol-ignore-file --blanks-tabs-ignore-file --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚mvninstall3m 19smaster passed
+1 💚compile0m 56smaster passed
+1 💚javadoc0m 28smaster passed
+1 💚shadedjars5m 55sbranch has no errors when building our shaded downstream artifacts.
-0 ⚠️patch6m 3sUsed diff version of patch file. Binary files and potentially other changes not applied. Please rebase and squash commits if necessary.
_ Patch Compile Tests _
+1 💚mvninstall3m 3sthe patch passed
+1 💚compile0m 56sthe patch passed
+1 💚javac0m 56sthe patch passed
+1 💚javadoc0m 27sthe patch passed
+1 💚shadedjars5m 52spatch has no errors when building our shaded downstream artifacts.
_ Other Tests _
-1 ❌unit211m 28s/patch-unit-hbase-server.txthbase-server in the patch failed.
237m 13s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6910/8/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR#6910
Optional Testsjavac javadoc unit compile shadedjars
unameLinux a54f91b8d3a0 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 47edd9a
Default JavaEclipse Adoptium-17.0.11+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6910/8/testReport/
Max. process+thread count4947 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6910/8/console
versionsgit=2.34.1 maven=3.9.8
Powered byApache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@virajjasani
virajjasani merged commit f0e069e into apache:masterApr 23, 2025
virajjasani added a commit that referenced this pull request Apr 23, 2025
…sisted (#6910)
Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Reid Chan <reidchan@apache.org>
Signed-off-by: gvprathyusha6 <70918688+gvprathyusha6@users.noreply.github.com>
virajjasani added a commit that referenced this pull request Apr 23, 2025
…sisted (#6916) (#6910)
Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Reid Chan <reidchan@apache.org>
Signed-off-by: gvprathyusha6 <70918688+gvprathyusha6@users.noreply.github.com>
virajjasani added a commit that referenced this pull request Apr 23, 2025
…sisted (#6916) (#6910)
Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Reid Chan <reidchan@apache.org>
Signed-off-by: gvprathyusha6 <70918688+gvprathyusha6@users.noreply.github.com>
virajjasani added a commit that referenced this pull request Apr 23, 2025
…sisted (#6916) (#6910)
Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Reid Chan <reidchan@apache.org>
Signed-off-by: gvprathyusha6 <70918688+gvprathyusha6@users.noreply.github.com>
mokai87 pushed a commit to mokai87/hbase that referenced this pull request Aug 7, 2025
…sisted (apache#6916) (apache#6910)
Signed-off-by: Andrew Purtell <apurtell@apache.org>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Reid Chan <reidchan@apache.org>
Signed-off-by: gvprathyusha6 <70918688+gvprathyusha6@users.noreply.github.com>
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.

6 participants

@virajjasani@Apache-HBase@Reidddddd@apurtell@Apache9@gvprathyusha6