Skip to content

HBASE-28192 Master should recover if meta region state is inconsistent #5513

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

virajjasani
Copy link
Contributor

Jira: HBASE-28192

@virajjasani virajjasani requested a review from apurtell November 9, 2023 20:31
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 33s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 4m 8s master passed
+1 💚 compile 3m 5s master passed
+1 💚 checkstyle 0m 56s master passed
+1 💚 spotless 1m 4s branch has no errors when running spotless:check.
+1 💚 spotbugs 2m 11s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 28s the patch passed
+1 💚 compile 2m 57s the patch passed
+1 💚 javac 2m 57s the patch passed
+1 💚 checkstyle 0m 48s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 13m 37s Patch does not cause any errors with Hadoop 3.2.4 3.3.6.
+1 💚 spotless 1m 3s patch has no errors when running spotless:check.
+1 💚 spotbugs 2m 17s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 13s The patch does not generate ASF License warnings.
44m 46s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #5513
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
uname Linux 85bbcd0830eb 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 master / 7f3921a
Default Java Eclipse Adoptium-11.0.17+8
Max. process+thread count 83 (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-5513/1/console
versions git=2.34.1 maven=3.8.6 spotbugs=4.7.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

// pending SCPs. It's worth waiting for ~20s before arriving at the conclusion, rather
// than looping through procedures to figure out how/when/why they are able to or not
// able to make any progress and eventually abort master initialization anyway.
Threads.sleep(20000);
Copy link
Contributor

Choose a reason for hiding this comment

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

Interrupt is not handled here.
But, more generally, do not unconditionally wait for so long. Use the Waiter pattern. Why 20 seconds and not some other value? Why not make this configurable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

introduced 2 configs to improve the retry logic

// If already many SCPs are scheduled, but they are not progressing because of
// meta's unavailability, the best action item is to throw PleaseRestartMasterException
// and let new active master init take care of on-lining meta and process all other
// pending SCPs. It's worth waiting for ~20s before arriving at the conclusion, rather
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 true? Have we really thought about prioritizing execution of the procedures related to meta and namespace before the others? I agree this could lead to complex code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added proc state based waiting

if (this.getServerManager().isServerOnline(rs.getServerName())) {
return true;
} else {
throw new PleaseRestartMasterException("meta is still not online on live server yet");
Copy link
Contributor

@apurtell apurtell Nov 9, 2023

Choose a reason for hiding this comment

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

What you check here, for this particular region, is if it is supposed to be online on a server, that the server is considered online. This does not seem to check anything specifically pertaining to the meta table. If you want to break out of this loop because meta is not available you should make an explicit check of the region state for the meta regions.

Also, this is the same logic as if we would just loop around again, so why not do that? D.R.Y.

Finally, do we really need to restart the master here or is there some other way to address this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This does not seem to check anything specifically pertaining to the meta table.

This utility is used by both meta and namespace regions only.

Finally, do we really need to restart the master here or is there some other way to address this?

That's what will guarantee prioritizing SCP of the server where meta was hosted. So we schedule SCP of the server hosting meta and abort master, new master failover is guaranteed to process SCP of that server, and then continue processing other SCPs that were stuck due to unavailable meta (due to inconsistent meta state).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried improving this overall in the latest revision.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 27s 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 _
_ master Compile Tests _
+1 💚 mvninstall 2m 36s master passed
+1 💚 compile 0m 37s master passed
+1 💚 shadedjars 5m 23s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 23s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 19s the patch passed
+1 💚 compile 0m 38s the patch passed
+1 💚 javac 0m 38s the patch passed
+1 💚 shadedjars 5m 22s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 21s the patch passed
_ Other Tests _
-1 ❌ unit 256m 21s hbase-server in the patch failed.
278m 16s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #5513
Optional Tests javac javadoc unit shadedjars compile
uname Linux 8e84fa2d2746 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 master / 7f3921a
Default Java Temurin-1.8.0_352-b08
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/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-5513/1/testReport/
Max. process+thread count 4518 (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-5513/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 43s Docker mode activated.
-0 ⚠️ yetus 0m 4s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+1 💚 mvninstall 3m 32s master passed
+1 💚 compile 1m 2s master passed
+1 💚 shadedjars 5m 48s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 31s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 3m 14s the patch passed
+1 💚 compile 0m 49s the patch passed
+1 💚 javac 0m 49s the patch passed
+1 💚 shadedjars 4m 57s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 26s the patch passed
_ Other Tests _
-1 ❌ unit 256m 42s hbase-server in the patch failed.
282m 3s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #5513
Optional Tests javac javadoc unit shadedjars compile
uname Linux 0ba8245296d2 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7f3921a
Default Java Eclipse Adoptium-11.0.17+8
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/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-5513/1/testReport/
Max. process+thread count 5086 (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-5513/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

@Apache9 Apache9 left a comment

Choose a reason for hiding this comment

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

Unless we know what is root cause I'm always -1 for doing things like this in our normal code logic. HBCK is the correct way for fixing the incosistency which is caused by a code bug.

So why there is no SCP for the old server after it is already dead?

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 32s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+1 💚 mvninstall 2m 53s master passed
+1 💚 compile 2m 26s master passed
+1 💚 checkstyle 0m 36s master passed
+1 💚 spotless 0m 43s branch has no errors when running spotless:check.
+1 💚 spotbugs 1m 33s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 35s the patch passed
+1 💚 compile 2m 25s the patch passed
+1 💚 javac 2m 25s the patch passed
+1 💚 checkstyle 0m 35s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 9m 27s Patch does not cause any errors with Hadoop 3.2.4 3.3.6.
+1 💚 spotless 0m 41s patch has no errors when running spotless:check.
+1 💚 spotbugs 1m 36s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 12s The patch does not generate ASF License warnings.
31m 53s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #5513
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
uname Linux e069f5f58e6c 5.4.0-156-generic #173-Ubuntu SMP Tue Jul 11 07:25:22 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7f3921a
Default Java Eclipse Adoptium-11.0.17+8
Max. process+thread count 79 (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-5513/2/console
versions git=2.34.1 maven=3.8.6 spotbugs=4.7.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@virajjasani
Copy link
Contributor Author

Unless we know what is root cause I'm always -1 for doing things like this in our normal code logic. HBCK is the correct way for fixing the incosistency which is caused by a code bug.

So why there is no SCP for the old server after it is already dead?

Added some comments on Jira, still it's suspicious, not a guaranteed root cause and maybe this can happen only during upgrade from 2.4 to 2.5? Let me check what happened to SCP of old server.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 25s 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 _
_ master Compile Tests _
+1 💚 mvninstall 3m 8s master passed
+1 💚 compile 0m 46s master passed
+1 💚 shadedjars 5m 29s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 52s the patch passed
+1 💚 compile 0m 46s the patch passed
+1 💚 javac 0m 46s the patch passed
+1 💚 shadedjars 5m 29s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 22s the patch passed
_ Other Tests _
-1 ❌ unit 236m 15s hbase-server in the patch failed.
260m 3s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #5513
Optional Tests javac javadoc unit shadedjars compile
uname Linux 04f2cef806db 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 master / 7f3921a
Default Java Eclipse Adoptium-11.0.17+8
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/2/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-5513/2/testReport/
Max. process+thread count 4748 (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-5513/2/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 12s 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 _
_ master Compile Tests _
+1 💚 mvninstall 2m 32s master passed
+1 💚 compile 0m 41s master passed
+1 💚 shadedjars 4m 51s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 25s master passed
_ Patch Compile Tests _
+1 💚 mvninstall 2m 20s the patch passed
+1 💚 compile 0m 41s the patch passed
+1 💚 javac 0m 41s the patch passed
+1 💚 shadedjars 4m 52s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 24s the patch passed
_ Other Tests _
-1 ❌ unit 244m 59s hbase-server in the patch failed.
266m 7s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #5513
Optional Tests javac javadoc unit shadedjars compile
uname Linux c9935834d86f 5.4.0-153-generic #170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 7f3921a
Default Java Temurin-1.8.0_352-b08
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-5513/2/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-5513/2/testReport/
Max. process+thread count 4661 (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-5513/2/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.

I agree with the other comments, this doesn't seem to address the real issue, which is: why meta SCP was missed?
And even if we don't understand what caused the above and just want to make master resilient to abnormal situations, shouldn't we try to identify if meta is not yet online and if there isn't any SCP for meta, trigger a new one, rather than checking for SCPs for any regions and crashing master if we don't find any such SCP?

return true;
}
}
throw new PleaseRestartMasterException("Scheduled SCP for old server for region "
Copy link
Contributor

Choose a reason for hiding this comment

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

So the solution here is to "crash" master once we never find an SCP for this region's RS?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we crash only because even after scheduling SCP for the region (meta or namespace), we still find the region not online.

.filter(p -> p instanceof ServerCrashProcedure
&& serverNameForRegion.equals(((ServerCrashProcedure) p).getServerName()))
.findFirst();
if (scpForServer.isPresent()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if an SCP is triggered and finished successfully whilst we are sleeping? Won't we miss the update and keep retrying?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is also fine because eventually this will be successful:

            if (numRetries == 0) {
              rs = this.assignmentManager.getRegionStates().getRegionState(ri);
              if (rs != null && rs.isOpened()) {
                if (this.getServerManager().isServerOnline(rs.getServerName())) {
                  return true;
                }
              }

So if the region (meta/namespace) was assigned successfully, we will return true from here eventually.

@bbeaudreault
Copy link
Contributor

I would definitely prefer automated solutions rather than rely on HBCK. IMO anything requiring hbck is a bug.

@virajjasani
Copy link
Contributor Author

I would definitely prefer automated solutions rather than rely on HBCK. IMO anything requiring hbck is a bug.

I agree.

For this case, we now know that the root cause was (upgrade to 2.5 + downgrade to 2.4 + meta move + upgrade to 2.5) and hence master did not have correct server address in master local region.

I wonder if there is anything else that could also ever cause this problem.

@Apache9
Copy link
Contributor

Apache9 commented Nov 20, 2023

I would definitely prefer automated solutions rather than rely on HBCK. IMO anything requiring hbck is a bug.

I agree.

For this case, we now know that the root cause was (upgrade to 2.5 + downgrade to 2.4 + meta move + upgrade to 2.5) and hence master did not have correct server address in master local region.

I wonder if there is anything else that could also ever cause this problem.

Could you explain more on the root cause? Why this could cause this problem? Because the downgrading to 2.4 does not do all the necessary rollbacks?

@virajjasani
Copy link
Contributor Author

Correct, downgrading to 2.4 does not remove meta's address from master local region's info:sn. Hence, any downgrade from 2.5 to older versions has this risk: it neither removes info CF from master local region, nor do they use master local region to update meta location (since HBASE-26193 is only applicable to 2.5.0+ releases).

@Apache9
Copy link
Contributor

Apache9 commented Nov 20, 2023

Correct, downgrading to 2.4 does not remove meta's address from master local region's info:sn. Hence, any downgrade from 2.5 to older versions has this risk: it neither removes info CF from master local region, nor do they use master local region to update meta location (since HBASE-26193 is only applicable to 2.5.0+ releases).

So I think we should add a tool in HBCK2 to for deleting data from master local region? Or at least, remove meta locations from master local region. So after downgrading to 2.4, we need a manual step to remove the location.

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.

6 participants