athanatos commented on a change in pull request #1819: ISSUE-1770: Add local
checker for Sorted/InterleavedLedgerStorage
URL: https://github.com/apache/bookkeeper/pull/1819#discussion_r239954869
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
##########
@@ -601,6 +602,64 @@ public Bookie(ServerConfiguration conf)
this(conf, NullStatsLogger.INSTANCE);
}
+ private static LedgerStorage buildLedgerStorage(ServerConfiguration conf)
throws IOException {
+ // Instantiate the ledger storage implementation
+ String ledgerStorageClass = conf.getLedgerStorageClass();
+ LOG.info("Using ledger storage: {}", ledgerStorageClass);
+ return LedgerStorageFactory.createLedgerStorage(ledgerStorageClass);
+ }
+
+ /**
+ * Initialize LedgerStorage instance without checkpointing for use within
the shell
+ * and other RO users. ledgerStorage must not have already been
initialized.
+ *
+ * @param conf Bookie config.
+ * @param ledgerStorage Instance to initialize.
+ * @return Passed ledgerStorage instance
+ * @throws IOException
+ */
+ static LedgerStorage mountLedgerStorageOffline(
+ ServerConfiguration conf,
+ LedgerStorage ledgerStorage) throws IOException {
+ StatsLogger statsLogger = NullStatsLogger.INSTANCE;
+ DiskChecker diskChecker = new
DiskChecker(conf.getDiskUsageThreshold(), conf.getDiskUsageWarnThreshold());
+
+ LedgerDirsManager ledgerDirsManager = createLedgerDirsManager(
+ conf, diskChecker, statsLogger.scope(LD_LEDGER_SCOPE));
+ LedgerDirsManager indexDirsManager = createIndexDirsManager(
+ conf, diskChecker, statsLogger.scope(LD_INDEX_SCOPE),
ledgerDirsManager);
+
+ if (null == ledgerStorage) {
+ ledgerStorage = buildLedgerStorage(conf);
Review comment:
Sure it is, the caller of this method is responsible for dealing with it.
I'll clarify that in the comment.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services