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 ded05aa221 fix underReplicatedLedgerTotalSize calculate problem.
(#3337)
ded05aa221 is described below
commit ded05aa2218f1e98c650070e9d0152213c4d09fe
Author: Yan Zhao <[email protected]>
AuthorDate: Tue Jul 26 13:28:34 2022 +0800
fix underReplicatedLedgerTotalSize calculate problem. (#3337)
Descriptions of the changes in this PR:
```
LongAdder underReplicatedSize = new LongAdder();
FutureUtils.processList(
Lists.newArrayList(ledgers),
ledgerId ->
ledgerManager.readLedgerMetadata(ledgerId).whenComplete((metadata, exception)
-> {
if (exception == null) {
underReplicatedSize.add(metadata.getValue().getLength());
}
}), null);
underReplicatedLedgerTotalSize.registerSuccessfulValue(underReplicatedSize.longValue());
```
`FutureUtils.processList` is async process, should record
`underReplicatedLedgerTotalSize` when it completed.
---
.../src/main/java/org/apache/bookkeeper/replication/Auditor.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
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 bccdb1d1df..428f763ea7 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
@@ -1233,8 +1233,9 @@ public class Auditor implements AutoCloseable {
if (exception == null) {
underReplicatedSize.add(metadata.getValue().getLength());
}
- }), null);
-
underReplicatedLedgerTotalSize.registerSuccessfulValue(underReplicatedSize.longValue());
+ }), null).whenComplete((res, e) -> {
+
underReplicatedLedgerTotalSize.registerSuccessfulValue(underReplicatedSize.longValue());
+ });
return FutureUtils.processList(
Lists.newArrayList(ledgers),