Skip to content

HBASE-27463 Reset sizeOfLogQueue when refresh replication source - #4863

Merged
Apache9 merged 2 commits into
apache:masterfrom
frostruan:HBASE-27463
Nov 27, 2022
Merged

HBASE-27463 Reset sizeOfLogQueue when refresh replication source#4863
Apache9 merged 2 commits into
apache:masterfrom
frostruan:HBASE-27463

Conversation

@frostruan

Copy link
Copy Markdown
Contributor

No description provided.

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 38sDocker 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 _
+1 💚mvninstall2m 25smaster passed
+1 💚compile2m 14smaster passed
+1 💚checkstyle0m 28smaster passed
+1 💚spotless0m 38sbranch has no errors when running spotless:check.
+1 💚spotbugs1m 12smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 0sthe patch passed
+1 💚compile2m 9sthe patch passed
+1 💚javac2m 9sthe patch passed
+1 💚checkstyle0m 27sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck7m 47sPatch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚spotless0m 35spatch has no errors when running spotless:check.
+1 💚spotbugs1m 18sthe patch passed
_ Other Tests _
+1 💚asflicense0m 9sThe patch does not generate ASF License warnings.
27m 11s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#4863
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux a74866d7b672 5.4.0-1088-aws #96~18.04.1-Ubuntu SMP Mon Oct 17 02:57:48 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 655f19c
Default JavaTemurin-1.8.0_352-b08
Max. process+thread count64 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/console
versionsgit=2.34.1 maven=3.8.6 spotbugs=4.7.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 🆗reexec3m 15sDocker 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 _
+1 💚mvninstall2m 39smaster passed
+1 💚compile0m 41smaster passed
+1 💚shadedjars3m 55sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 29sthe patch passed
+1 💚compile0m 42sthe patch passed
+1 💚javac0m 42sthe patch passed
+1 💚shadedjars3m 54spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 22sthe patch passed
_ Other Tests _
+1 💚unit197m 16shbase-server in the patch passed.
221m 0s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#4863
Optional Testsjavac javadoc unit shadedjars compile
unameLinux dbc7506af0b0 5.4.0-1085-aws #92~18.04.1-Ubuntu SMP Wed Aug 31 17:21:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 655f19c
Default JavaEclipse Adoptium-11.0.17+8
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/testReport/
Max. process+thread count3018 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/console
versionsgit=2.34.1 maven=3.8.6
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 🆗reexec2m 29sDocker 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 _
+1 💚mvninstall2m 40smaster passed
+1 💚compile0m 39smaster passed
+1 💚shadedjars3m 45sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 25smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 13sthe patch passed
+1 💚compile0m 39sthe patch passed
+1 💚javac0m 39sthe patch passed
+1 💚shadedjars3m 46spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23sthe patch passed
_ Other Tests _
+1 💚unit217m 31shbase-server in the patch passed.
238m 44s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#4863
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 7596ecd6e947 5.4.0-124-generic #140-Ubuntu SMP Thu Aug 4 02:23:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 655f19c
Default JavaTemurin-1.8.0_352-b08
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/testReport/
Max. process+thread count2558 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/1/console
versionsgit=2.34.1 maven=3.8.6
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

if (toRemove != null) {
LOG.info("Terminate replication source for " + toRemove.getPeerId());
// Reset sizeOfLogQueue, log will re enqueue to the created new source.
toRemove.getSourceMetrics()

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.

@frostruan Do you think we need to reset just size of log queue metric or other source metrics also? IMO we should reset all the metrics and start with clean state?

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.

Thanks for reviewing @shahrs87

Currently we monitor the replication status by the sizeOfLogQueue metric, so I just reset the sizeOfLogQueue here. I'll check if there is any other metrics need to be reset. Thanks for your suggestion.

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.

Are there any rules about which metrics should be reset while others should not?

@frostruanfrostruanNov 6, 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.

Thanks for review Duo.@Apache9

Sorry, currently have no idea about the rule you mentioned, maybe the rule is a little complicated.

I think what makes the rule complicated is that we first create the new ReplicationSource, then replace the old ReplicationSource with the new one, and then if the old ReplicationSource exists, terminate it. And since HBASE-23231, we will not clear the old metrics when terminate the old ReplicationSource to avoid the metric for the new ReplicationSource being cleared. Then it's a little complicated to keep the new ReplicationSourceMetric and the GlobalReplicationSourceMetric right and consistent.

If we adjust the order, first terminate the old ReplicationSource if it exists and then create and register the new ReplicationSource, the logic of metric here maybe will be much simpler, and of course we can clear the metric when terminate the old ReplicationSource. But I'm not sure yet, still need to confirm

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 change will effectively undo HBASE-23231@Apache9 Since you were one of the reviewer on HBASE-23231, do you think it is safe to do this?

@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 7sDocker 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 _
+1 💚mvninstall4m 2smaster passed
+1 💚compile3m 2smaster passed
+1 💚checkstyle0m 36smaster passed
+1 💚spotless0m 48sbranch has no errors when running spotless:check.
+1 💚spotbugs1m 48smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 29sthe patch passed
+1 💚compile2m 44sthe patch passed
+1 💚javac2m 44sthe patch passed
+1 💚checkstyle0m 37sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck13m 33sPatch does not cause any errors with Hadoop 3.2.4 3.3.4.
+1 💚spotless0m 58spatch has no errors when running spotless:check.
+1 💚spotbugs2m 25sthe patch passed
_ Other Tests _
+1 💚asflicense0m 18sThe patch does not generate ASF License warnings.
43m 11s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR#4863
Optional Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti spotless checkstyle compile
unameLinux 64ce1c7fca40 5.4.0-1085-aws #92~18.04.1-Ubuntu SMP Wed Aug 31 17:21:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 41c7bd3
Default JavaEclipse Adoptium-11.0.17+8
Max. process+thread count77 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/console
versionsgit=2.34.1 maven=3.8.6 spotbugs=4.7.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 12sDocker 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 _
+1 💚mvninstall4m 1smaster passed
+1 💚compile1m 1smaster passed
+1 💚shadedjars4m 32sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 31smaster passed
_ Patch Compile Tests _
+1 💚mvninstall3m 24sthe patch passed
+1 💚compile0m 50sthe patch passed
+1 💚javac0m 50sthe patch passed
+1 💚shadedjars4m 30spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 29sthe patch passed
_ Other Tests _
-1 ❌unit214m 29shbase-server in the patch failed.
239m 51s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR#4863
Optional Testsjavac javadoc unit shadedjars compile
unameLinux f9656020f7e7 5.4.0-1085-aws #92~18.04.1-Ubuntu SMP Wed Aug 31 17:21:08 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 41c7bd3
Default JavaEclipse Adoptium-11.0.17+8
unithttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/artifact/yetus-jdk11-hadoop3-check/output/patch-unit-hbase-server.txt
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/testReport/
Max. process+thread count2434 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/console
versionsgit=2.34.1 maven=3.8.6
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 20sDocker 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 _
+1 💚mvninstall2m 10smaster passed
+1 💚compile0m 39smaster passed
+1 💚shadedjars3m 45sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23smaster passed
_ Patch Compile Tests _
+1 💚mvninstall2m 11sthe patch passed
+1 💚compile0m 39sthe patch passed
+1 💚javac0m 39sthe patch passed
+1 💚shadedjars3m 45spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 23sthe patch passed
_ Other Tests _
-1 ❌unit229m 43shbase-server in the patch failed.
247m 56s
SubsystemReport/Notes
DockerClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR#4863
Optional Testsjavac javadoc unit shadedjars compile
unameLinux 2dc3b709f90c 5.4.0-124-generic #140-Ubuntu SMP Thu Aug 4 02:23:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 41c7bd3
Default JavaTemurin-1.8.0_352-b08
unithttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/artifact/yetus-jdk8-hadoop3-check/output/patch-unit-hbase-server.txt
Test Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/testReport/
Max. process+thread count2416 (vs. ulimit of 30000)
modulesC: hbase-server U: hbase-server
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4863/2/console
versionsgit=2.34.1 maven=3.8.6
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache9

Copy link
Copy Markdown
Contributor

So the fix here is to create the new replication source after terminating the old replication source.

First, how could this fix the problem?
Second, I guess why we create the replication source outside the lock is to reduce the locking time, but anyway, IIRC the start up of a replication source is asynchronous, so probably it is OK to move it into the lock protection.

@frostruan

Copy link
Copy Markdown
ContributorAuthor

So the fix here is to create the new replication source after terminating the old replication source.

First, how could this fix the problem? Second, I guess why we create the replication source outside the lock is to reduce the locking time, but anyway, IIRC the start up of a replication source is asynchronous, so probably it is OK to move it into the lock protection.

Thanks for reviewing Duo @Apache9

The problem arises like this

  1. Imagine we have a replication source A whose sizeOfLogQueue is x, and the global sizeOfLogQueue is y.
  2. When disable the peer, we will create a new replication source A', and enqueue the log queue, that makes the sizeOfLogQueue of A' also grows to x.
    https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java#L473
  3. To avoid the metric being cleared, we introduce a flag to keep the old metric. See HBASE-23231 for more details.
    As a result, the global sizeOfLogQueue is x+y, however actually it should still be y.
  4. In the first commit, I only decrease the global sizeOfLogQueue when terminate the old replication source, but @shahrs87 point out that maybe there are metrics should also be reset, for example the sizeOfHFileRefsQueue.

So I think maybe we can change the order, terminate old replication first and then create the new one. That will make the problem less complicated.

@Apache9

Copy link
Copy Markdown
Contributor

So the fix here is to create the new replication source after terminating the old replication source.
First, how could this fix the problem? Second, I guess why we create the replication source outside the lock is to reduce the locking time, but anyway, IIRC the start up of a replication source is asynchronous, so probably it is OK to move it into the lock protection.

Thanks for reviewing Duo @Apache9

The problem arises like this

  1. Imagine we have a replication source A whose sizeOfLogQueue is x, and the global sizeOfLogQueue is y.
  2. When disable the peer, we will create a new replication source A', and enqueue the log queue, that makes the sizeOfLogQueue of A' also grows to x.
    https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java#L473
  3. To avoid the metric being cleared, we introduce a flag to keep the old metric. See HBASE-23231 for more details.
    As a result, the global sizeOfLogQueue is x+y, however actually it should still be y.
  4. In the first commit, I only decrease the global sizeOfLogQueue when terminate the old replication source, but @shahrs87 point out that maybe there are metrics should also be reset, for example the sizeOfHFileRefsQueue.

So I think maybe we can change the order, terminate old replication first and then create the new one. That will make the problem less complicated.

OK, so if we terminate the replication source first, we do not need to keep the old metrics, just let it decrease and after we create the new replication source, the metrics will be restored?

@frostruan

Copy link
Copy Markdown
ContributorAuthor

yes. I think so.

@Apache9

Copy link
Copy Markdown
Contributor

@shahrs87 Do you have any other concerns?

@shahrs87

Copy link
Copy Markdown
Contributor

@frostruan Thank you for the update. I think this is more cleaner way. +1.

@Apache9
Apache9 merged commit bb9f43c into apache:masterNov 27, 2022
Apache9 pushed a commit that referenced this pull request Nov 27, 2022
Co-authored-by: huiruan <huiruan@tencent.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Reviewed-by: Rushabh Shah <shahrs87@gmail.com>
(cherry picked from commit bb9f43c)
Apache9 pushed a commit that referenced this pull request Nov 27, 2022
Co-authored-by: huiruan <huiruan@tencent.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Reviewed-by: Rushabh Shah <shahrs87@gmail.com>
(cherry picked from commit bb9f43c)
Apache9 pushed a commit that referenced this pull request Nov 27, 2022
Co-authored-by: huiruan <huiruan@tencent.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Reviewed-by: Rushabh Shah <shahrs87@gmail.com>
(cherry picked from commit bb9f43c)
vinayakphegde pushed a commit to vinayakphegde/hbase that referenced this pull request Apr 4, 2024
…che#4863)
Co-authored-by: huiruan <huiruan@tencent.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
Reviewed-by: Rushabh Shah <shahrs87@gmail.com>
(cherry picked from commit bb9f43c)
(cherry picked from commit 5ce1d8f)
Change-Id: I9f8a19286df32d68de472e8f4b3f8f7926551178
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

@frostruan@Apache-HBase@Apache9@shahrs87