You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by yo...@apache.org on 2022/10/26 01:11:51 UTC
[bookkeeper] 09/11: skipping placementPolicyCheck when ledger replication disabled (#3561)
This is an automated email from the ASF dual-hosted git repository.
yong pushed a commit to branch branch-4.15
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
commit 9db36f9b8aa4ce71e57d2f0ae9ee4f5506cb6943
Author: wenbingshen <ol...@gmail.com>
AuthorDate: Tue Oct 25 09:49:44 2022 +0800
skipping placementPolicyCheck when ledger replication disabled (#3561)
### Motivation
When `placementPolicyCheck` is enabled and then `bookkeeper shell autorecovery -disable` is executed, `placementPolicyCheck` will detect ledgers that do not satisfy `placementPolicy` and write to zookeeper, but `ReplicationWorker` no longer obtains ledgers from zookeeper for replication work because autorecovery is disabled, which results in a large number of temporary nodes on zookeeper , when there are more ledgers that do not satisfy placementPolicy, the problem will get worse.
The method of `ReplicationWorker` to get ledger:
```java
private boolean rereplicate() throws InterruptedException, BKException,
UnavailableException {
long ledgerIdToReplicate = underreplicationManager
.getLedgerToRereplicate();
...
```
So we should also disable `placementPolicyCheck`.
(cherry picked from commit cfc6b9770f2189b17ac9ce61c763b4ce6a2d7e55)
---
.../src/main/java/org/apache/bookkeeper/replication/Auditor.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
index 428f763ea7..8afb0cc74f 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
@@ -880,6 +880,11 @@ public class Auditor implements AutoCloseable {
@Override
public void run() {
try {
+ if (!ledgerUnderreplicationManager.isLedgerReplicationEnabled()) {
+ LOG.info("Ledger replication disabled, skipping placementPolicyCheck");
+ return;
+ }
+
Stopwatch stopwatch = Stopwatch.createStarted();
LOG.info("Starting PlacementPolicyCheck");
placementPolicyCheck();
@@ -955,6 +960,8 @@ public class Auditor implements AutoCloseable {
numOfLedgersFoundInPlacementPolicyCheckValue,
numOfLedgersFoundSoftlyAdheringInPlacementPolicyCheckValue,
numOfURLedgersElapsedRecoveryGracePeriodValue, e);
+ } catch (ReplicationException.UnavailableException ue) {
+ LOG.error("Underreplication manager unavailable running periodic check", ue);
}
}
}), initialDelay, interval, TimeUnit.SECONDS);