Skip to content

HBASE-26614 Refactor code related to "dump"ing ZK nodes - #3969

Merged
ndimiduk merged 5 commits into
apache:masterfrom
ndimiduk:26614-refector-zkdump
Jan 24, 2022
Merged

HBASE-26614 Refactor code related to "dump"ing ZK nodes#3969
ndimiduk merged 5 commits into
apache:masterfrom
ndimiduk:26614-refector-zkdump

Conversation

@ndimiduk

Copy link
Copy Markdown
Member

The code starting at ZKUtil.dump(ZKWatcher) is a small mess – it has cyclic dependencies woven
through itself, ZKWatcher and RecoverableZooKeeper. It also initializes a static variable in
ZKUtil through the factory for RecoverableZooKeeper instances. Let's decouple and clean it
up.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@ndimiduk

Copy link
Copy Markdown
MemberAuthor

We crash errorprone? 😭

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

@apurtell

Copy link
Copy Markdown
Contributor

Is the replication unit result in the precommit a repeatable failure?

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@joshelserjoshelser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Of course, after I went through the new ZKDump class, I realized that this was all copy-paste :). Leaving the comments as-is, but I'm not concerned about them.

Are there any shell scripts which might have called the old dump() static method you removed? Is it possible to deprecate the old method and have it just call the new location of the utility in the ZKDump class instead?

return connect(conf, ensemble, watcher);
}

public static RecoverableZooKeeper connect(Configuration conf, String ensemble,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would be nice to have Javadoc on all of the connect public methods in this class, but just a nit since this is @private

try {
sb.append("\n ").append(MasterAddressTracker.getMasterAddress(zkWatcher));
} catch (IOException e) {
sb.append("<<FAILED LOOKUP: ").append(e.getMessage()).append(">>");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"FAILED MASTER LOOKUP"? Something to indicate what we were trying to do which failed?

for (String child : backupMasterChildrenNoWatchList) {
sb.append("\n ").append(child);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

An else to indicate that we found no backups (or you think not printing anythign is sufficient?)

}
}
try {
getReplicationZnodesDump(zkWatcher, sb);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would recommend printing some header here like for the other sections.

* @return The array of response strings.
* @throws IOException When the socket communication fails.
*/
private static String[] getServerStats(String server, int timeout)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: getZkServerStats

}
}
for (String zNodeChild : ZKUtil.listChildrenNoWatch(zkw, znodeToProcess)) {
stack.add(ZNodePaths.joinZNode(znodeToProcess, zNodeChild));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you want to insert these at the front of the list rather than append them to the rest, otherwise you would be doing a depth-first traversal but over the reverse-sorted order of the children of znodeToProcess (if I remember correctly that listChildrenNoWatch will return the children in sorter order).

@ndimiduk

ndimiduk commented Jan 5, 2022

Copy link
Copy Markdown
MemberAuthor

Are there any shell scripts which might have called the old dump() static method you removed?

Oh, nice thinking. Yeah, looks like admin.rb.

$ find . -type f ! -iname '*.java' -exec grep -iIn 'ZKUtil' {} \+ | grep dump
./hbase-shell/target/classes/hbase/admin.rb:480: org.apache.hadoop.hbase.zookeeper.ZKUtil.dump(@zk_wrapper)
./hbase-shell/src/main/ruby/hbase/admin.rb:480: org.apache.hadoop.hbase.zookeeper.ZKUtil.dump(@zk_wrapper)

sorry for the edits

Is it possible to deprecate the old method and have it just call the new location of the utility in the ZKDump class instead?

I could, but why? You want to protect users who are calling into an IA.Private class?

@ndimiduk
ndimidukforce-pushed the 26614-refector-zkdump branch from f010576 to 2aee01cCompareJanuary 5, 2022 19:43
@ndimiduk

Copy link
Copy Markdown
MemberAuthor

Is the replication unit result in the precommit a repeatable failure?

I don't think so but I don't have logs from the failed test runs. Let's see if it's still there for the next one.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@ndimiduk

Copy link
Copy Markdown
MemberAuthor

I think this error prone failure is not related to my change. Mike is working on a fix/upgrade over on #3979

@Apache-HBase

This comment has been minimized.

@Apache9

Copy link
Copy Markdown
Contributor

I think this error prone failure is not related to my change. Mike is working on a fix/upgrade over on #3979

It is related.

You call MetaTableLocator.getMetaRegionLocation in ZKDump but the method has a RestrictedApi annotation which only allow calling from ZKUtil and tests code. Since you just move some code in ZKUtil out to a separated class, you need to change the RestrictedApi annotation in MetaTableLocator.

Thanks.

@ndimiduk
ndimidukforce-pushed the 26614-refector-zkdump branch from 2aee01c to ecb0471CompareJanuary 7, 2022 22:56
@Apache-HBase

This comment has been minimized.

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

The error prone failure is related. Please fix it before merging. Use a 'request changes' to make it more clear since there are already too many comments.

@ndimiduk

ndimiduk commented Jan 12, 2022

Copy link
Copy Markdown
MemberAuthor

Thanks for the mention @Apache9 . I did miss your earlier comment. You are correct in that my patch introduces an ErrorProne violation according to the annotation that you point how. However, I didn't know this because the use of that annotation in our code is not compatible with the version of ErrorProne run by Yetus on pre-commit. I think Mike's patch that upgrades ErrorProne will fix this, but I'll need to do some testing to be sure.

In the mean time, let me progress on this ticket.

@ndimiduk
ndimidukforce-pushed the 26614-refector-zkdump branch from ecb0471 to 16ad718CompareJanuary 12, 2022 00:08
@Apache-HBase

This comment has been minimized.

@ndimiduk

Copy link
Copy Markdown
MemberAuthor

@joshelser do you mind if we address your code comments in a subsequent change? I'd like to keep this one isolated to the relocations only, as much as possible.

@Apache-HBase

This comment has been minimized.

@Apache-HBase

This comment has been minimized.

@ndimiduk

Copy link
Copy Markdown
MemberAuthor

Unit test failure looks like HBASE-26651.

@ndimiduk
ndimiduk requested a review from Apache9January 12, 2022 17:05
The code starting at `ZKUtil.dump(ZKWatcher)` is a small mess – it has cyclic dependencies woven
through itself, `ZKWatcher` and `RecoverableZooKeeper`. It also initializes a static variable in
`ZKUtil` through the factory for `RecoverableZooKeeper` instances. Let's decouple and clean it
up.
@ndimiduk
ndimidukforce-pushed the 26614-refector-zkdump branch from 16ad718 to 028f5b3CompareJanuary 18, 2022 23:55
@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.

@ndimiduk

Copy link
Copy Markdown
MemberAuthor

Argh. Build 9 Jdk11/Hadoop3 failed due to Read-only file system.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 25sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 1sNo 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 _
+0 🆗mvndep0m 31sMaven dependency ordering for branch
+1 💚mvninstall4m 0smaster passed
+1 💚compile4m 51smaster passed
+1 💚checkstyle1m 49smaster passed
+1 💚spotbugs3m 14smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 15sMaven dependency ordering for patch
+1 💚mvninstall3m 49sthe patch passed
+1 💚compile4m 50sthe patch passed
-0 ⚠️javac0m 30shbase-zookeeper generated 5 new + 87 unchanged - 6 fixed = 92 total (was 93)
+1 💚checkstyle1m 47sthe patch passed
+1 💚rubocop0m 8sThere were no new rubocop issues.
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck19m 28sPatch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚spotbugs3m 48sthe patch passed
_ Other Tests _
+1 💚asflicense0m 51sThe patch does not generate ASF License warnings.
58m 40s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#3969
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile rubocop
unameLinux eb0cf5892b63 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1d2b8a0
Default JavaAdoptOpenJDK-1.8.0_282-b08
javachttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/artifact/yetus-general-check/output/diff-compile-javac-hbase-zookeeper.txt
Max. process+thread count96 (vs. ulimit of 30000)
modulesC: hbase-zookeeper hbase-server hbase-shell hbase-it U: .
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2 rubocop=0.80.0
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 25sDocker 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 _
+0 🆗mvndep0m 31sMaven dependency ordering for branch
+1 💚mvninstall3m 59smaster passed
+1 💚compile2m 15smaster passed
+1 💚shadedjars8m 21sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc1m 27smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 18sMaven dependency ordering for patch
+1 💚mvninstall3m 51sthe patch passed
+1 💚compile2m 15sthe patch passed
+1 💚javac2m 15sthe patch passed
+1 💚shadedjars8m 18spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc1m 27sthe patch passed
_ Other Tests _
+1 💚unit0m 45shbase-zookeeper in the patch passed.
+1 💚unit148m 0shbase-server in the patch passed.
+1 💚unit7m 39shbase-shell in the patch passed.
+1 💚unit1m 18shbase-it in the patch passed.
193m 30s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#3969
Optional Testsjavac javadoc unit shadedjars compile
unameLinux f0004fd6c333 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1d2b8a0
Default JavaAdoptOpenJDK-1.8.0_282-b08
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/testReport/
Max. process+thread count4846 (vs. ulimit of 30000)
modulesC: hbase-zookeeper hbase-server hbase-shell hbase-it U: .
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/console
versionsgit=2.17.1 maven=3.6.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 25sDocker 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 _
+0 🆗mvndep0m 11sMaven dependency ordering for branch
+1 💚mvninstall4m 39smaster passed
+1 💚compile2m 38smaster passed
+1 💚shadedjars8m 25sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc1m 32smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 16sMaven dependency ordering for patch
+1 💚mvninstall4m 41sthe patch passed
+1 💚compile2m 45sthe patch passed
+1 💚javac2m 45sthe patch passed
+1 💚shadedjars8m 39spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc1m 34sthe patch passed
_ Other Tests _
+1 💚unit0m 47shbase-zookeeper in the patch passed.
+1 💚unit148m 41shbase-server in the patch passed.
+1 💚unit7m 12shbase-shell in the patch passed.
+1 💚unit1m 12shbase-it in the patch passed.
196m 14s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#3969
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 2d25590a453f 4.15.0-156-generic #163-Ubuntu SMP Thu Aug 19 23:31:58 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1d2b8a0
Default JavaAdoptOpenJDK-11.0.10+9
Test Resultshttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/testReport/
Max. process+thread count3944 (vs. ulimit of 30000)
modulesC: hbase-zookeeper hbase-server hbase-shell hbase-it U: .
Console outputhttps://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@ndimiduk
ndimiduk merged commit 625d610 into apache:masterJan 24, 2022
@ndimiduk
ndimiduk deleted the 26614-refector-zkdump branch January 24, 2022 19:33
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Jan 24, 2022
The code starting at `ZKUtil.dump(ZKWatcher)` is a small mess – it has cyclic dependencies woven
through itself, `ZKWatcher` and `RecoverableZooKeeper`. It also initializes a static variable in
`ZKUtil` through the factory for `RecoverableZooKeeper` instances. Let's decouple and clean it
up.
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Josh Elser <elserj@apache.org>
ndimiduk added a commit that referenced this pull request Jan 25, 2022
The code starting at `ZKUtil.dump(ZKWatcher)` is a small mess – it has cyclic dependencies woven
through itself, `ZKWatcher` and `RecoverableZooKeeper`. It also initializes a static variable in
`ZKUtil` through the factory for `RecoverableZooKeeper` instances. Let's decouple and clean it
up.
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Josh Elser <elserj@apache.org>
ndimiduk added a commit to ndimiduk/hbase that referenced this pull request Jan 25, 2022
The code starting at `ZKUtil.dump(ZKWatcher)` is a small mess – it has cyclic dependencies woven
through itself, `ZKWatcher` and `RecoverableZooKeeper`. It also initializes a static variable in
`ZKUtil` through the factory for `RecoverableZooKeeper` instances. Let's decouple and clean it
up.
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Josh Elser <elserj@apache.org>
ndimiduk added a commit that referenced this pull request Jan 26, 2022
The code starting at `ZKUtil.dump(ZKWatcher)` is a small mess – it has cyclic dependencies woven
through itself, `ZKWatcher` and `RecoverableZooKeeper`. It also initializes a static variable in
`ZKUtil` through the factory for `RecoverableZooKeeper` instances. Let's decouple and clean it
up.
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Josh Elser <elserj@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.

5 participants

@ndimiduk@Apache-HBase@apurtell@Apache9@joshelser