Skip to content

HBASE-29313 RecoverableZooKeeper.getZooKeeper() returns null for new object #6987

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

Merged
merged 3 commits into from
May 15, 2025

Conversation

stoty
Copy link
Contributor

@stoty stoty commented May 13, 2025

…object

@stoty stoty changed the title HBASE-29313 RecoverableZooKeeper.getZooKeeper() returns null for new … HBASE-29313 RecoverableZooKeeper.getZooKeeper() returns null for new object May 13, 2025
@stoty stoty requested a review from Apache9 May 13, 2025 12:37
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

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.

I'm not sure whether we should initialize zookeeper when calling getZooKeeper, as returning null also indicate that there is no request yet, and can be used to as a test condition.

But anyway, since this class is IA.Private, we are OK to change the behavior if it does not break anything, just more javadoc to explain the logic.

// Callers expect an initialized ZooKeeper instance
// Pre HBASE-28529 the constructor used to call checkZk()
try {
checkZk();
Copy link
Contributor

Choose a reason for hiding this comment

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

Just return checkZk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense

try {
checkZk();
} catch (Exception x) {
// Just return null zk
Copy link
Contributor

Choose a reason for hiding this comment

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

Better log the exception and return null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

@@ -726,6 +726,13 @@ public synchronized States getState() {
}

public synchronized ZooKeeper getZooKeeper() {
Copy link
Contributor

Choose a reason for hiding this comment

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

checkZk itself is synchronized, so we can remove the synchronized?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We probably could, but I don't think this is a performance hotspot, so I'd just leave it as is.

@stoty
Copy link
Contributor Author

stoty commented May 13, 2025

I'm not sure whether we should initialize zookeeper when calling getZooKeeper, as returning null also indicate that there is no request yet, and can be used to as a test condition.

But anyway, since this class is IA.Private, we are OK to change the behavior if it does not break anything, just more javadoc to explain the logic.

None of the existing code uses it like that.
All of the callers are using the returned ZK objects to perform operations on it, as that's how it used to work before your last change.

I think that ideally getZokkeper() would throw an exception just like most other RecoverableZooKeeper methods, but the callers aren't expecting that, and I didn't want to makemore changes to handle re-tries etc in all of the callers.

@stoty stoty requested a review from Apache9 May 13, 2025 15:58
@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 49s Docker mode activated.
-0 ⚠️ yetus 0m 4s Unprocessed 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 💚 mvninstall 4m 40s master passed
+1 💚 compile 0m 28s master passed
+1 💚 javadoc 0m 22s master passed
+1 💚 shadedjars 7m 53s branch has no errors when building our shaded downstream artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 4m 22s the patch passed
+1 💚 compile 0m 22s the patch passed
+1 💚 javac 0m 22s the patch passed
+1 💚 javadoc 0m 18s the patch passed
+1 💚 shadedjars 8m 7s patch has no errors when building our shaded downstream artifacts.
_ Other Tests _
+1 💚 unit 0m 56s hbase-zookeeper in the patch passed.
29m 18s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6987/3/artifact/yetus-jdk17-hadoop3-check/output/Dockerfile
GITHUB PR #6987
Optional Tests javac javadoc unit compile shadedjars
uname Linux b98246138526 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 / 14c7093
Default Java Eclipse Adoptium-17.0.11+9
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6987/3/testReport/
Max. process+thread count 314 (vs. ulimit of 30000)
modules C: hbase-zookeeper U: hbase-zookeeper
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6987/3/console
versions git=2.34.1 maven=3.9.8
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 27s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
_ master Compile Tests _
+1 💚 mvninstall 3m 20s master passed
+1 💚 compile 0m 21s master passed
+1 💚 checkstyle 0m 9s master passed
+1 💚 spotbugs 0m 21s master passed
+1 💚 spotless 0m 46s branch has no errors when running spotless:check.
_ Patch Compile Tests _
+1 💚 mvninstall 2m 57s the patch passed
+1 💚 compile 0m 20s the patch passed
+1 💚 javac 0m 20s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 8s the patch passed
+1 💚 spotbugs 0m 28s the patch passed
+1 💚 hadoopcheck 12m 0s Patch does not cause any errors with Hadoop 3.3.6 3.4.0.
+1 💚 spotless 0m 45s patch has no errors when running spotless:check.
_ Other Tests _
+1 💚 asflicense 0m 10s The patch does not generate ASF License warnings.
29m 41s
Subsystem Report/Notes
Docker ClientAPI=1.43 ServerAPI=1.43 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6987/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #6987
Optional Tests dupname asflicense javac spotbugs checkstyle codespell detsecrets compile hadoopcheck hbaseanti spotless
uname Linux 759cc89c4049 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 / 14c7093
Default Java Eclipse Adoptium-17.0.11+9
Max. process+thread count 82 (vs. ulimit of 30000)
modules C: hbase-zookeeper U: hbase-zookeeper
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-6987/3/console
versions git=2.34.1 maven=3.9.8 spotbugs=4.7.3
Powered by Apache Yetus 0.15.0 https://yetus.apache.org

This message was automatically generated.

@stoty stoty merged commit d9b1aa1 into apache:master May 15, 2025
1 check passed
stoty added a commit that referenced this pull request May 15, 2025
…object (#6987)

Signed-off-by: Duo Zhang <[email protected]>
(cherry picked from commit d9b1aa1)
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