private void checkForExtraLogs(Context context) throws Exception { val maxLogId = context.serviceConfig.getContainerCount() * 10; for (int logId = context.serviceConfig.getContainerCount(); logId < maxLogId; logId++) { @Cleanup DebugLogWrapper log = context.logFactory.createDebugLogWrapper(logId); val m = log.fetchMetadata(); if (m != null) { throw new Exception(String.format("Discovered BookKeeperLog %d which is beyond the maximum log id (%d) as specified in the configuration.", logId, context.serviceConfig.getContainerCount() - 1)); } } }
private void collectAllReferencedLedgerIds(Collection<Long> referencedLedgerIds, Context context) throws Exception { referencedLedgerIds.clear(); for (int logId = 0; logId < context.serviceConfig.getContainerCount(); logId++) { @Cleanup DebugLogWrapper log = context.logFactory.createDebugLogWrapper(logId); val m = log.fetchMetadata(); if (m == null) { continue; } for (val lm : m.getLedgers()) { referencedLedgerIds.add(lm.getLedgerId()); } } }
@Override public void execute() throws Exception { ensureArgCount(0); // Loop through all known log ids and fetch their metadata. @Cleanup val context = createContext(); for (int logId = 0; logId < context.serviceConfig.getContainerCount(); logId++) { @Cleanup DebugLogWrapper log = context.logFactory.createDebugLogWrapper(logId); val m = log.fetchMetadata(); outputLogSummary(logId, m); } }
val context = createContext(); @Cleanup val log = context.logFactory.createDebugLogWrapper(logId);
val context = createContext(); @Cleanup val log = context.logFactory.createDebugLogWrapper(logId);
val context = createContext(); @Cleanup val log = context.logFactory.createDebugLogWrapper(logId); val m = log.fetchMetadata(); outputLogSummary(logId, m);
val log = context.logFactory.createDebugLogWrapper(containerId); val bkLog = log.asReadOnly();