use of io.pravega.segmentstore.storage.impl.bookkeeper.LedgerMetadata in project pravega by pravega.
the class BookKeeperDetailsCommand method execute.
@Override
public void execute() throws Exception {
ensureArgCount(1);
int logId = getIntArg(0);
@Cleanup val context = createContext();
@Cleanup val log = context.logFactory.createDebugLogWrapper(logId);
val m = log.fetchMetadata();
outputLogSummary(logId, m);
if (m == null) {
// Nothing else to do.
return;
}
if (m.getLedgers().size() == 0) {
output("There are no ledgers for Log %s.", logId);
return;
}
for (LedgerMetadata lm : m.getLedgers()) {
LedgerHandle lh = null;
try {
lh = log.openLedgerNoFencing(lm);
val bkLm = context.bkAdmin.getLedgerMetadata(lh);
output("\tLedger %d: Seq=%d, Status=%s, LAC=%d, Length=%d, Bookies=%d, Frags=%d, E/W/A=%d/%d/%d, Ensembles=%s.", lm.getLedgerId(), lm.getSequence(), lm.getStatus(), lh.getLastAddConfirmed(), lh.getLength(), lh.getNumBookies(), lh.getNumFragments(), bkLm.getEnsembleSize(), bkLm.getWriteQuorumSize(), bkLm.getAckQuorumSize(), getEnsembleDescription(bkLm));
} catch (Exception ex) {
output("\tLedger %d: Seq = %d, Status = %s. BK: %s", lm.getLedgerId(), lm.getSequence(), lm.getStatus(), ex.getMessage());
} finally {
if (lh != null) {
lh.close();
}
}
}
}
Aggregations