Skip to content

Commit

Permalink
fix underReplicatedLedgerTotalSize calculate problem. (#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 Jul 26, 2022
1 parent 1908b7e commit ded05aa
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 ded05aa

Please sign in to comment.