This is an automated email from the ASF dual-hosted git repository.
chenhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new cfc6b9770f skipping placementPolicyCheck when ledger replication
disabled (#3561)
cfc6b9770f is described below
commit cfc6b9770f2189b17ac9ce61c763b4ce6a2d7e55
Author: wenbingshen <[email protected]>
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`.
---
.../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 243203da0e..e3ad6f3735 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
@@ -878,6 +878,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();
@@ -953,6 +958,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);