Skip to content

Commit

Permalink
chore(s3stream/wal): more logs during building the wal channel (#944)
Browse files Browse the repository at this point in the history
Signed-off-by: Ning Yu <[email protected]>
  • Loading branch information
Chillax-0v0 authored Feb 26, 2024
1 parent 619ea28 commit 23bf90c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.automq.stream.s3.wal.WALNotInitializedException;
import com.automq.stream.utils.Threads;
import io.netty.buffer.ByteBuf;
import java.io.File;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -244,11 +245,12 @@ public WALChannelBuilder recoveryMode(boolean recoveryMode) {

public WALChannel build() {
String directNotAvailableMsg = WALBlockDeviceChannel.checkAvailable(path);
boolean isBlockDevice = isBlockDevice(path);
boolean useDirect = false;
if (direct != null) {
// Set by user.
useDirect = direct;
} else if (isBlockDevice(path)) {
} else if (isBlockDevice) {
// We can only use direct IO for block devices.
useDirect = true;
} else if (directNotAvailableMsg == null) {
Expand All @@ -261,9 +263,12 @@ public WALChannel build() {
}

if (useDirect) {
if (!isBlockDevice) {
LOGGER.warn("WAL in a file system, which may cause performance degradation. path: {}", new File(path).getAbsolutePath());
}
return new WALBlockDeviceChannel(path, capacity, initBufferSize, maxBufferSize, recoveryMode);
} else {
LOGGER.warn("Direct IO not used for WAL, which may cause performance degradation. path: {}", path);
LOGGER.warn("Direct IO not used for WAL, which may cause performance degradation. path: {}", new File(path).getAbsolutePath());
return new WALFileChannel(path, capacity, recoveryMode);
}
}
Expand Down

0 comments on commit 23bf90c

Please sign in to comment.