mattisonchao commented on code in PR #16420:
URL: https://github.com/apache/pulsar/pull/16420#discussion_r915382317
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -1482,18 +1482,17 @@ public synchronized void createComplete(int rc, final
LedgerHandle lh, Object ct
lastLedgerCreationFailureTimestamp = clock.millis();
} else {
log.info("[{}] Created new ledger {}", name, lh.getId());
- ledgers.put(lh.getId(),
LedgerInfo.newBuilder().setLedgerId(lh.getId()).setTimestamp(0).build());
- currentLedger = lh;
- currentLedgerEntries = 0;
- currentLedgerSize = 0;
-
final MetaStoreCallback<Void> cb = new MetaStoreCallback<Void>() {
@Override
public void operationComplete(Void v, Stat stat) {
if (log.isDebugEnabled()) {
log.debug("[{}] Updating of ledgers list after create
complete. version={}", name, stat);
}
ledgersStat = stat;
+ ledgers.put(lh.getId(),
LedgerInfo.newBuilder().setLedgerId(lh.getId()).setTimestamp(0).build());
Review Comment:
I still have concerns because in this method, if the ledger is not persisted
to the metadata, it means the ledger cannot be used. But we put it in the
ledger map; it is not persistent and may be used by other operations under
multi-threaded conditions.
However, I'm not sure what it will affect. Just a minor concern. Please feel
free to go on.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]