Search in sources :

Example 1 with LedgerMetadata

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();
            }
        }
    }
}
Also used : lombok.val(lombok.val) LedgerMetadata(io.pravega.segmentstore.storage.impl.bookkeeper.LedgerMetadata) LedgerHandle(org.apache.bookkeeper.client.LedgerHandle) Cleanup(lombok.Cleanup)

Aggregations

LedgerMetadata (io.pravega.segmentstore.storage.impl.bookkeeper.LedgerMetadata)1 Cleanup (lombok.Cleanup)1 lombok.val (lombok.val)1 LedgerHandle (org.apache.bookkeeper.client.LedgerHandle)1