Skip to content

HBASE-24396 : RetryCounter#sleepUntilNextRetry and ThrottledInputStre… - #1765

Closed
virajjasani wants to merge 1 commit into
apache:masterfrom
virajjasani:HBASE-24396-master
Closed

HBASE-24396 : RetryCounter#sleepUntilNextRetry and ThrottledInputStre…#1765
virajjasani wants to merge 1 commit into
apache:masterfrom
virajjasani:HBASE-24396-master

Conversation

@virajjasani

Copy link
Copy Markdown
Contributor

…am#throttle should use uninterrupted sleep

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 30sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo 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 22sMaven dependency ordering for branch
+1 💚mvninstall3m 45smaster passed
+1 💚checkstyle1m 48smaster passed
+1 💚spotbugs2m 40smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 13sMaven dependency ordering for patch
+1 💚mvninstall3m 17sthe patch passed
-0 ⚠️checkstyle0m 24shbase-common: The patch generated 1 new + 5 unchanged - 0 fixed = 6 total (was 5)
-0 ⚠️checkstyle1m 5shbase-server: The patch generated 1 new + 75 unchanged - 0 fixed = 76 total (was 75)
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck11m 4sPatch does not cause any errors with Hadoop 3.1.2 3.2.1.
+1 💚spotbugs3m 9sthe patch passed
_ Other Tests _
+1 💚asflicense0m 32sThe patch does not generate ASF License warnings.
37m 26s
SubsystemReport/Notes
DockerClient=19.03.9 Server=19.03.9 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#1765
Optional Testsdupname asflicense spotbugs hadoopcheck hbaseanti checkstyle
unameLinux e79296a098fb 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / a9fefd7
checkstylehttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-general-check/output/diff-checkstyle-hbase-common.txt
checkstylehttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-general-check/output/diff-checkstyle-hbase-server.txt
Max. process+thread count94 (vs. ulimit of 12500)
modulesC: hbase-common hbase-server hbase-it U: .
Console outputhttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/console
versionsgit=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f) spotbugs=3.1.12
Powered byApache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 29sDocker 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 22sMaven dependency ordering for branch
+1 💚mvninstall3m 39smaster passed
+1 💚compile1m 44smaster passed
+1 💚shadedjars5m 31sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc1m 13smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 17sMaven dependency ordering for patch
+1 💚mvninstall3m 24sthe patch passed
+1 💚compile1m 44sthe patch passed
+1 💚javac1m 44sthe patch passed
+1 💚shadedjars5m 39spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc1m 12sthe patch passed
_ Other Tests _
+1 💚unit1m 20shbase-common in the patch passed.
+1 💚unit132m 19shbase-server in the patch passed.
+1 💚unit1m 11shbase-it in the patch passed.
162m 41s
SubsystemReport/Notes
DockerClient=19.03.9 Server=19.03.9 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#1765
Optional Testsjavac javadoc unit shadedjars compile
unameLinux fbc869a72dd2 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 / a9fefd7
Default Java1.8.0_232
Test Resultshttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/testReport/
Max. process+thread count5250 (vs. ulimit of 12500)
modulesC: hbase-common hbase-server hbase-it U: .
Console outputhttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/console
versionsgit=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered byApache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 6sDocker 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 19sMaven dependency ordering for branch
+1 💚mvninstall4m 40smaster passed
+1 💚compile2m 3smaster passed
+1 💚shadedjars6m 25sbranch has no errors when building our shaded downstream artifacts.
-0 ⚠️javadoc0m 18shbase-common in master failed.
-0 ⚠️javadoc0m 40shbase-server in master failed.
_ Patch Compile Tests _
+0 🆗mvndep0m 13sMaven dependency ordering for patch
+1 💚mvninstall4m 31sthe patch passed
+1 💚compile2m 3sthe patch passed
+1 💚javac2m 3sthe patch passed
+1 💚shadedjars6m 24spatch has no errors when building our shaded downstream artifacts.
-0 ⚠️javadoc0m 17shbase-common in the patch failed.
-0 ⚠️javadoc0m 39shbase-server in the patch failed.
_ Other Tests _
+1 💚unit1m 56shbase-common in the patch passed.
-1 ❌unit200m 37shbase-server in the patch failed.
+1 💚unit1m 15shbase-it in the patch passed.
235m 54s
SubsystemReport/Notes
DockerClient=19.03.9 Server=19.03.9 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#1765
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 7b1e653a7dd5 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / a9fefd7
Default Java2020-01-14
javadochttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-common.txt
javadochttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-jdk11-hadoop3-check/output/branch-javadoc-hbase-server.txt
javadochttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-common.txt
javadochttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-jdk11-hadoop3-check/output/patch-javadoc-hbase-server.txt
unithttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/artifact/yetus-jdk11-hadoop3-check/output/patch-unit-hbase-server.txt
Test Resultshttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/testReport/
Max. process+thread count2557 (vs. ulimit of 12500)
modulesC: hbase-common hbase-server hbase-it U: .
Console outputhttps://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1765/1/console
versionsgit=2.17.1 maven=(cecedd343002696d0abb50b32b541b8a6ba2883f)
Powered byApache Yetus 0.11.1 https://yetus.apache.org

This message was automatically generated.

} catch (InterruptedException e) {
throw new InterruptedIOException("Thread aborted");
}
Uninterruptibles.sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS);

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.

Do we need to this jira? When during the throttle sleep, if we interrupt this thread, it would have come out of sleep by throwing an IOE as per the current code. But a call to sleepUninterruptibly will make sure the thread is in sleep state for that much time. The interrupt might be for a genuine case to stop the running thread. Now this change will make it such that even if been interrupted, the thread will still continue to be executed!

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 here, throttle()'s purpose should ideally be to throttle without any interruption.

} catch (InterruptedException e) {
throw new RuntimeException(e);
}
retryCounter.sleepUntilNextRetry();

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.

Here also we are changing the behave. Previously throw RTE when interrupted. But now this is been changed Main thing is even if interrupted, the RetryCounter will make sure the thread been slept for the specified time (Which might not be really wanted some times)

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 believe the purpose of retryCounter.sleepUntilNextRetry() should be uninterrupted sleep because RetryCounter is mainly being used by retries with sleeps and retries with different backoff policies. In such scenario, RetryCounter being a library should not ideally throw InterruptedException even if sleep is interrupted because it is being retried by clients to achieve certain tasks.

@virajjasani

virajjasani commented May 23, 2020

Copy link
Copy Markdown
ContributorAuthor

Both RetryCounter and ThrottledInputStream are Private.IA being used by clients to retry/throttle with sleep and IMHO, the sleep used internally by these libraries should be uninterruptible and clients should not worry about handling InterruptedException because clients will require smooth retries with backoff.

ServerRegionReplicaUtil.getRegionInfoForDefaultReplica(region.getRegionInfo())
.getRegionNameAsString(),
region.getRegionInfo().getRegionNameAsString(), counter.getAttemptTimes(), e);
try {

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.

You did not get what I was saying I believe.
This is triggerFlushInPrimaryRegion() method and u can see a while loop within which the call happening. The while loop is to be terminated once this RS is set to be stopped/abort. When such happens, there might be many non daemon threads running within the server. Our logic in different places will interrupt these threads. so if the thread is sleeping or waiting it will get InterruptedException and allow the thread NOT to continue in running/waiting state. The logic should be checking the server status and allow to come out of loops etc.
But your change will make it such that even if the main thread interrupt this thread, it will continue to sleep for the specified time. That is totally against our intent.

@virajjasanivirajjasaniMay 24, 2020

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.

Ok got it. Yes this example makes sense. Are you saying that similar to this one, all the other places also need to handle Interruptions and there is no need to have uninterrupted sleep during client side retries?

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.

I did not check all places.. Most of the places where the RetryCounter is being used is in test I can see. But within RetryCounter we should not change. Tomorrow some other code path might use it too. IMO we can just keep the code as is. Let the calling part handle the InterruptedException the way they want. we can not generalise it. So just close this Jira Viraj

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.

Okk just saw that many places are in asynchronously getting executed in separate threads from main thread and if this is how interruptions were planned to be handled, it's fine. No need to make change.

@virajjasani
virajjasani deleted the HBASE-24396-master branch May 24, 2020 07:47
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.

3 participants

@virajjasani@Apache-HBase@anoopsjohn