diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectCompactionEntryLog.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectCompactionEntryLog.java index fadde648de6..58ac98fec53 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectCompactionEntryLog.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectCompactionEntryLog.java @@ -87,7 +87,7 @@ private DirectCompactionEntryLog(int srcLogId, this.srcLogId = srcLogId; this.dstLogId = dstLogId; - this.slog = slog.kv("dstLogId", dstLogId).kv("srcLogId", srcLogId).ctx(); + this.slog = slog.kv("dstLogId", dstLogId).kv("srcLogId", srcLogId).ctx(DirectCompactionEntryLog.class); } @Override diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectEntryLogger.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectEntryLogger.java index f5b74d1265d..0d2d509598f 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectEntryLogger.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectEntryLogger.java @@ -53,7 +53,6 @@ import org.apache.bookkeeper.bookie.EntryLogMetadata; import org.apache.bookkeeper.bookie.storage.CompactionEntryLog; import org.apache.bookkeeper.bookie.storage.EntryLogIds; -import org.apache.bookkeeper.bookie.storage.EntryLogIdsImpl; import org.apache.bookkeeper.bookie.storage.EntryLogScanner; import org.apache.bookkeeper.bookie.storage.EntryLogger; import org.apache.bookkeeper.common.util.nativeio.NativeIO; @@ -112,7 +111,7 @@ public DirectEntryLogger(File ledgerDir, this.maxSaneEntrySize = maxSaneEntrySize; this.readBufferSize = Buffer.nextAlignment(readBufferSize); this.ids = ids; - this.slog = slogParent.kv("directory", ledgerDir).ctx(); + this.slog = slogParent.kv("directory", ledgerDir).ctx(DirectEntryLogger.class); this.stats = new DirectEntryLoggerStats(stats); diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectWriter.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectWriter.java index be411982d32..20a3d855b4a 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectWriter.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/DirectWriter.java @@ -45,6 +45,7 @@ class DirectWriter implements LogWriter { final ExecutorService writeExecutor; final Object bufferLock = new Object(); final List> outstandingWrites = new ArrayList>(); + final Slogger slog; Buffer nativeBuffer; long offset; private static volatile boolean useFallocate = true; @@ -60,6 +61,7 @@ class DirectWriter implements LogWriter { this.filename = filename; this.writeExecutor = writeExecutor; this.nativeIO = nativeIO; + this.slog = slog.ctx(DirectWriter.class); offset = 0; @@ -76,7 +78,7 @@ class DirectWriter implements LogWriter { if (useFallocate) { if (!SystemUtils.IS_OS_LINUX) { disableUseFallocate(); - slog.warn(Events.FALLOCATE_NOT_AVAILABLE); + this.slog.warn(Events.FALLOCATE_NOT_AVAILABLE); } else { try { int ret = nativeIO.fallocate(fd, NativeIO.FALLOC_FL_ZERO_RANGE, 0, maxFileSize); @@ -85,7 +87,7 @@ class DirectWriter implements LogWriter { // fallocate(2) is not supported on all filesystems. Since this is an optimization, disable // subsequent usage instead of failing the operation. disableUseFallocate(); - slog.kv("message", ex.getMessage()) + this.slog.kv("message", ex.getMessage()) .kv("file", filename) .kv("errno", ex.getErrno()) .warn(Events.FALLOCATE_NOT_AVAILABLE); diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/EntryLogIdsImpl.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/EntryLogIdsImpl.java similarity index 96% rename from bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/EntryLogIdsImpl.java rename to bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/EntryLogIdsImpl.java index 704d07ed6c5..6b43fca47aa 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/EntryLogIdsImpl.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/directentrylogger/EntryLogIdsImpl.java @@ -18,7 +18,7 @@ * under the License. * */ -package org.apache.bookkeeper.bookie.storage; +package org.apache.bookkeeper.bookie.storage.directentrylogger; import java.io.File; import java.io.IOException; @@ -29,7 +29,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.bookkeeper.bookie.LedgerDirsManager; -import org.apache.bookkeeper.bookie.storage.directentrylogger.Events; +import org.apache.bookkeeper.bookie.storage.EntryLogIds; import org.apache.bookkeeper.slogger.Slogger; import org.apache.commons.lang3.tuple.Pair; /** @@ -48,7 +48,7 @@ public class EntryLogIdsImpl implements EntryLogIds { public EntryLogIdsImpl(LedgerDirsManager ledgerDirsManager, Slogger slog) throws IOException { this.ledgerDirsManager = ledgerDirsManager; - this.slog = slog; + this.slog = slog.ctx(EntryLogIdsImpl.class); findLargestGap(); } diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java index a941aeb3be9..cba8f5d0763 100644 --- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java +++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java @@ -54,7 +54,7 @@ import org.apache.bookkeeper.bookie.LedgerDirsManager; import org.apache.bookkeeper.bookie.LedgerStorage; import org.apache.bookkeeper.bookie.StateManager; -import org.apache.bookkeeper.bookie.storage.EntryLogIdsImpl; +import org.apache.bookkeeper.bookie.storage.directentrylogger.EntryLogIdsImpl; import org.apache.bookkeeper.bookie.storage.EntryLogger; import org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger; import org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageFactory.DbConfigType; diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/EntryLogTestUtils.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/EntryLogTestUtils.java index 8fa4bb9f845..f88e3883af5 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/EntryLogTestUtils.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/EntryLogTestUtils.java @@ -32,6 +32,7 @@ import org.apache.bookkeeper.bookie.DefaultEntryLogger; import org.apache.bookkeeper.bookie.LedgerDirsManager; import org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger; +import org.apache.bookkeeper.bookie.storage.directentrylogger.EntryLogIdsImpl; import org.apache.bookkeeper.common.util.nativeio.NativeIOImpl; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.slogger.Slogger; diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/TestEntryLogIds.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/directentrylogger/TestEntryLogIds.java similarity index 98% rename from bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/TestEntryLogIds.java rename to bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/directentrylogger/TestEntryLogIds.java index 8b0d7f68bd5..787a0514be1 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/TestEntryLogIds.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/directentrylogger/TestEntryLogIds.java @@ -18,7 +18,7 @@ * under the License. * */ -package org.apache.bookkeeper.bookie.storage; +package org.apache.bookkeeper.bookie.storage.directentrylogger; import static org.apache.bookkeeper.bookie.storage.EntryLogTestUtils.logIdFromLocation; import static org.apache.bookkeeper.bookie.storage.EntryLogTestUtils.makeEntry; @@ -33,8 +33,8 @@ import io.netty.buffer.ByteBuf; import java.io.File; import org.apache.bookkeeper.bookie.LedgerDirsManager; -import org.apache.bookkeeper.bookie.storage.directentrylogger.DirectCompactionEntryLog; -import org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger; +import org.apache.bookkeeper.bookie.storage.EntryLogIds; +import org.apache.bookkeeper.bookie.storage.EntryLogger; import org.apache.bookkeeper.slogger.Slogger; import org.apache.bookkeeper.test.TmpDirs; import org.apache.commons.lang3.tuple.Pair; diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/directentrylogger/TestTransactionalEntryLogCompactor.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/directentrylogger/TestTransactionalEntryLogCompactor.java index db79988af37..86d760d4598 100644 --- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/directentrylogger/TestTransactionalEntryLogCompactor.java +++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/directentrylogger/TestTransactionalEntryLogCompactor.java @@ -49,7 +49,6 @@ import org.apache.bookkeeper.bookie.MockLedgerStorage; import org.apache.bookkeeper.bookie.TransactionalEntryLogCompactor; import org.apache.bookkeeper.bookie.storage.CompactionEntryLog; -import org.apache.bookkeeper.bookie.storage.EntryLogIdsImpl; import org.apache.bookkeeper.bookie.storage.EntryLogScanner; import org.apache.bookkeeper.bookie.storage.EntryLogger; import org.apache.bookkeeper.common.util.nativeio.NativeIOImpl;