Skip to content
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

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

Merged
merged 5 commits into from
Jan 24, 2022

Conversation

ndimiduk
Copy link
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
Member Author

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

Copy link
Member

@joshelser joshelser left a comment

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
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
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
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
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
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
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
Copy link
Member Author

ndimiduk commented Jan 5, 2022

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 ndimiduk force-pushed the 26614-refector-zkdump branch from f010576 to 2aee01c Compare January 5, 2022 19:43
@ndimiduk
Copy link
Member Author

ndimiduk commented Jan 5, 2022

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
Member Author

ndimiduk commented Jan 6, 2022

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
Contributor

Apache9 commented Jan 6, 2022

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 ndimiduk force-pushed the 26614-refector-zkdump branch from 2aee01c to ecb0471 Compare January 7, 2022 22:56
@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.

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
Copy link
Member Author

ndimiduk commented Jan 12, 2022

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 ndimiduk force-pushed the 26614-refector-zkdump branch from ecb0471 to 16ad718 Compare January 12, 2022 00:08
@Apache-HBase

This comment has been minimized.

@ndimiduk
Copy link
Member Author

@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
Member Author

Unit test failure looks like HBASE-26651.

@ndimiduk ndimiduk requested a review from Apache9 January 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 ndimiduk force-pushed the 26614-refector-zkdump branch from 16ad718 to 028f5b3 Compare January 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
Member Author

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

@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 25s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s 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 _
+0 🆗 mvndep 0m 31s Maven dependency ordering for branch
+1 💚 mvninstall 4m 0s master passed
+1 💚 compile 4m 51s master passed
+1 💚 checkstyle 1m 49s master passed
+1 💚 spotbugs 3m 14s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 15s Maven dependency ordering for patch
+1 💚 mvninstall 3m 49s the patch passed
+1 💚 compile 4m 50s the patch passed
-0 ⚠️ javac 0m 30s hbase-zookeeper generated 5 new + 87 unchanged - 6 fixed = 92 total (was 93)
+1 💚 checkstyle 1m 47s the patch passed
+1 💚 rubocop 0m 8s There were no new rubocop issues.
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 19m 28s Patch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚 spotbugs 3m 48s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 51s The patch does not generate ASF License warnings.
58m 40s
Subsystem Report/Notes
Docker ClientAPI=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 Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile rubocop
uname Linux 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1d2b8a0
Default Java AdoptOpenJDK-1.8.0_282-b08
javac https://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 count 96 (vs. ulimit of 30000)
modules C: hbase-zookeeper hbase-server hbase-shell hbase-it U: .
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/console
versions git=2.17.1 maven=3.6.3 spotbugs=4.2.2 rubocop=0.80.0
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 25s 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 _
+0 🆗 mvndep 0m 31s Maven dependency ordering for branch
+1 💚 mvninstall 3m 59s master passed
+1 💚 compile 2m 15s master passed
+1 💚 shadedjars 8m 21s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 1m 27s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 18s Maven dependency ordering for patch
+1 💚 mvninstall 3m 51s the patch passed
+1 💚 compile 2m 15s the patch passed
+1 💚 javac 2m 15s the patch passed
+1 💚 shadedjars 8m 18s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 1m 27s the patch passed
_ Other Tests _
+1 💚 unit 0m 45s hbase-zookeeper in the patch passed.
+1 💚 unit 148m 0s hbase-server in the patch passed.
+1 💚 unit 7m 39s hbase-shell in the patch passed.
+1 💚 unit 1m 18s hbase-it in the patch passed.
193m 30s
Subsystem Report/Notes
Docker ClientAPI=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 Tests javac javadoc unit shadedjars compile
uname Linux 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1d2b8a0
Default Java AdoptOpenJDK-1.8.0_282-b08
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/testReport/
Max. process+thread count 4846 (vs. ulimit of 30000)
modules C: hbase-zookeeper hbase-server hbase-shell hbase-it U: .
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/console
versions git=2.17.1 maven=3.6.3
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 25s 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 _
+0 🆗 mvndep 0m 11s Maven dependency ordering for branch
+1 💚 mvninstall 4m 39s master passed
+1 💚 compile 2m 38s master passed
+1 💚 shadedjars 8m 25s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 1m 32s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 16s Maven dependency ordering for patch
+1 💚 mvninstall 4m 41s the patch passed
+1 💚 compile 2m 45s the patch passed
+1 💚 javac 2m 45s the patch passed
+1 💚 shadedjars 8m 39s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 1m 34s the patch passed
_ Other Tests _
+1 💚 unit 0m 47s hbase-zookeeper in the patch passed.
+1 💚 unit 148m 41s hbase-server in the patch passed.
+1 💚 unit 7m 12s hbase-shell in the patch passed.
+1 💚 unit 1m 12s hbase-it in the patch passed.
196m 14s
Subsystem Report/Notes
Docker ClientAPI=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 Tests javac javadoc unit shadedjars compile
uname Linux 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 tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1d2b8a0
Default Java AdoptOpenJDK-11.0.10+9
Test Results https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/testReport/
Max. process+thread count 3944 (vs. ulimit of 30000)
modules C: hbase-zookeeper hbase-server hbase-shell hbase-it U: .
Console output https://ci-hadoop.apache.org/job/HBase/job/HBase-PreCommit-GitHub-PR/job/PR-3969/11/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@ndimiduk ndimiduk merged commit 625d610 into apache:master Jan 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 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.

5 participants