Skip to content

Commit

Permalink
fix underReplicatedLedgerTotalSize calculate problem. (apache#3337)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
horizonzy authored and Anup Ghatage committed Jul 12, 2024
1 parent 7779140 commit 09020b1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1233,8 +1233,9 @@ private CompletableFuture<?> publishSuspectedLedgersAsync(Collection<String> mis
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),
Expand Down

0 comments on commit 09020b1

Please sign in to comment.