Skip to content

HBASE-27203 Clean up error-prone findings in hbase-client [branch-2] - #4651

Merged
apurtell merged 2 commits into
apache:branch-2from
apurtell:HBASE-27203-2
Jul 27, 2022
Merged

HBASE-27203 Clean up error-prone findings in hbase-client [branch-2]#4651
apurtell merged 2 commits into
apache:branch-2from
apurtell:HBASE-27203-2

Conversation

@apurtell

Copy link
Copy Markdown
Contributor

No description provided.

@apurtellapurtell left a comment

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.

Notable findings exclusive to branch-2.

handleException();
if (this.closed) {
return null;
try {

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.

We were missing an inner try here.


@Override
public void close() {
lock.lock();

@apurtellapurtellJul 27, 2022

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 bug like above but still a nit.

* Global nonceGenerator shared per client.Currently there's no reason to limit its scope. Once
* it's set under nonceGeneratorCreateLock, it is never unset or changed.
*/
// XXX: It is a bad pattern to assign a value to a static field from a constructor. However

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.

Declined to fix the issue because we'd have to use a Configuration instance at static class init time, not the Configuration that gets passed into the Constructor. However, marked it as a code smell with XXX.

public void mergeRegions(final byte[] nameOfRegionA, final byte[] nameOfRegionB,
final boolean forcible) throws IOException {
mergeRegionsAsync(nameOfRegionA, nameOfRegionB, forcible);
try {

@apurtellapurtellJul 27, 2022

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.

mergeRegions will return immediately without waiting for or surfacing any exception from the operation. This seems wrong. We don't expect to wait for the master to complete the merge but we would expect to surface an IOException from the RPC. Yet, it is a semantic change over previously released versions. For discussion.

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.

IIRC this is a known issue. You can see the comments in the Admin interface.

 /**
* Merge two regions. Asynchronous operation.
* @param nameOfRegionA encoded or full name of region a
* @param nameOfRegionB encoded or full name of region b
* @param forcible <code>true</code> if do a compulsory merge, otherwise we will only merge
* two adjacent regions
* @throws IOException if a remote or network exception occurs
* @deprecated Since 2.0. Will be removed in 3.0. Use
* {@link #mergeRegionsAsync(byte[], byte[], boolean)} instead.
*/
@Deprecated
void mergeRegions(byte[] nameOfRegionA, byte[] nameOfRegionB, boolean forcible)
throws IOException;

@apurtellapurtellJul 27, 2022

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'm not sure an IOException will get thrown as expected because we don't get() the Future. On the other hand this has been the behavior for a long time. I will stick to warning cleanups and come back to this later.

// call out to master to do split now
splitRegionAsync(r, splitPoint);
try {
splitRegionAsync(r, splitPoint).get();

@apurtellapurtellJul 27, 2022

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.

split will return immediately without waiting for or surfacing any exception from the operation. This seems wrong. We don't expect to wait for the split to complete but we would expect to surface an IOException from the RPC. Yet, it is a semantic change over previously released versions. For discussion.

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.

Should be the same with mergeRegions method.

@apurtellapurtellJul 27, 2022

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.

Same, will come back to this later.

return this.maxLatency.getAndSet(0);
}

@SuppressWarnings("FutureReturnValueIgnored")

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.

Same

private long fastFailClearingTimeMilliSec;

private final ThreadLocal<MutableBoolean> threadRetryingInFastFailMode = new ThreadLocal<>();
private static final ThreadLocal<MutableBoolean> threadRetryingInFastFailMode =

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.

ThreadLocals should to be class fields not instance fields. Otherwise the coder may get the false impression interactions with the thread local is also scoped to the instance. They are not, they are scoped to the thread.


/**
* Set the tracker that should be used for tracking statistics about the server
* @deprecated Does nothing. Since 2.5.0, will be removed in 4.0.0.

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.

Remove this in 3.0.0 instead?

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.

This class is IA.Private so we are free to remove it at any time.

throw new IOException("Imposible? Arrive at an unreachable line...");
}

@SuppressWarnings("FutureReturnValueIgnored")

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.

Suppressed here because scheduling the callable returns a future we don't care about.


private boolean reloginInProgress;

@SuppressWarnings("FutureReturnValueIgnored")

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.

Suppressed here because the scheduling returns a future we don't care about.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 7sDocker mode activated.
-0 ⚠️yetus0m 6sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ branch-2 Compile Tests _
+1 💚mvninstall2m 18sbranch-2 passed
+1 💚compile0m 18sbranch-2 passed
+1 💚shadedjars3m 43sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 19sbranch-2 passed
_ Patch Compile Tests _
+1 💚mvninstall2m 8sthe patch passed
+1 💚compile0m 20sthe patch passed
+1 💚javac0m 20sthe patch passed
+1 💚shadedjars3m 38spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 16sthe patch passed
_ Other Tests _
+1 💚unit2m 33shbase-client in the patch passed.
18m 14s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/artifact/yetus-jdk8-hadoop2-check/output/Dockerfile
GITHUB PR#4651
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 093629bc8d87 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionbranch-2 / 4c08a8a
Default JavaAdoptOpenJDK-1.8.0_282-b08
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/testReport/
Max. process+thread count169 (vs. ulimit of 12500)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/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 🆗reexec1m 56sDocker 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.
_ branch-2 Compile Tests _
+1 💚mvninstall2m 55sbranch-2 passed
+1 💚compile0m 51sbranch-2 passed
+1 💚checkstyle0m 23sbranch-2 passed
+1 💚spotless1m 6sbranch has no errors when running spotless:check.
+1 💚spotbugs1m 7sbranch-2 passed
_ Patch Compile Tests _
+1 💚mvninstall2m 39sthe patch passed
+1 💚compile0m 50sthe patch passed
-0 ⚠️javac0m 50shbase-client generated 69 new + 36 unchanged - 109 fixed = 105 total (was 145)
+1 💚checkstyle0m 21shbase-client: The patch generated 0 new + 283 unchanged - 83 fixed = 283 total (was 366)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck8m 50sPatch does not cause any errors with Hadoop 3.1.2 3.2.1.
+1 💚spotless0m 56spatch has no errors when running spotless:check.
+1 💚spotbugs1m 5sthe patch passed
_ Other Tests _
+1 💚asflicense0m 9sThe patch does not generate ASF License warnings.
29m 37s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#4651
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux 906aacbf0f85 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionbranch-2 / 4c08a8a
Default JavaAdoptOpenJDK-1.8.0_282-b08
javachttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/artifact/yetus-general-check/output/diff-compile-javac-hbase-client.txt
Max. process+thread count64 (vs. ulimit of 12500)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2
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 🆗reexec1m 43sDocker mode activated.
-0 ⚠️yetus0m 7sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ branch-2 Compile Tests _
+1 💚mvninstall4m 27sbranch-2 passed
+1 💚compile0m 34sbranch-2 passed
+1 💚shadedjars5m 55sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 41sbranch-2 passed
_ Patch Compile Tests _
+1 💚mvninstall4m 12sthe patch passed
+1 💚compile0m 30sthe patch passed
+1 💚javac0m 30sthe patch passed
+1 💚shadedjars5m 45spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23shbase-client generated 0 new + 81 unchanged - 11 fixed = 81 total (was 92)
_ Other Tests _
+1 💚unit3m 24shbase-client in the patch passed.
29m 34s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#4651
Optional Testsjavac javadoc unit shadedjars compile
unameLinux a35b2be73d55 5.4.0-1025-aws #25~18.04.1-Ubuntu SMP Fri Sep 11 12:03:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionbranch-2 / 4c08a8a
Default JavaAdoptOpenJDK-11.0.10+9
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/testReport/
Max. process+thread count200 (vs. ulimit of 12500)
modulesC: hbase-client U: hbase-client
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4651/1/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@apurtell

apurtell commented Jul 27, 2022

Copy link
Copy Markdown
ContributorAuthor

Rolled back the HBaseAdmin changes called out above, just cleanups now, proceeding to merge. I will file a follow up for that, with a more considered set of changes.

@apurtell
apurtell merged commit 29f51c0 into apache:branch-2Jul 27, 2022
@apurtell
apurtell deleted the HBASE-27203-2 branch July 27, 2022 22:58
asfgit pushed a commit that referenced this pull request Jul 27, 2022
…4651)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Viraj Jasani <vjasani@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.

4 participants

@apurtell@Apache-HBase@Apache9@virajjasani