Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make slogger use current class #3994

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DirectWriter implements LogWriter {
final ExecutorService writeExecutor;
final Object bufferLock = new Object();
final List<Future<?>> outstandingWrites = new ArrayList<Future<?>>();
final Slogger slog;
Buffer nativeBuffer;
long offset;
private static volatile boolean useFallocate = true;
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
/**
Expand All @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
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.EntryLogger;
import org.apache.bookkeeper.bookie.storage.directentrylogger.DirectEntryLogger;
import org.apache.bookkeeper.bookie.storage.directentrylogger.EntryLogIdsImpl;
import org.apache.bookkeeper.bookie.storage.ldb.KeyValueStorageFactory.DbConfigType;
import org.apache.bookkeeper.bookie.storage.ldb.SingleDirectoryDbLedgerStorage.LedgerLoggerProcessor;
import org.apache.bookkeeper.common.util.MathUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down