Skip to content

Commit

Permalink
fix(s3stream/wal): automatically detected whether to use direct IO by… (
Browse files Browse the repository at this point in the history
#698)

Signed-off-by: Ning Yu <ningyu@automq.com>
  • Loading branch information
Chillax-0v0 authored Nov 22, 2023
1 parent 1c99473 commit cc5c862
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ private SlidingWindowService.WALHeaderFlusher flusher() {
public static class BlockWALServiceBuilder {
private final String blockDevicePath;
private long blockDeviceCapacityWant = CAPACITY_NOT_SET;
private boolean direct = false;
private Boolean direct = null;
private int initBufferSize = 1 << 20; // 1MiB
private int maxBufferSize = 1 << 24; // 16MiB
private int ioThreadNums = 8;
Expand Down Expand Up @@ -621,13 +621,15 @@ public BlockWALService build() {

BlockWALService blockWALService = new BlockWALService();

blockWALService.walChannel = WALChannel.builder(blockDevicePath)
WALChannel.WALChannelBuilder walChannelBuilder = WALChannel.builder(blockDevicePath)
.capacity(blockDeviceCapacityWant)
.direct(direct)
.initBufferSize(initBufferSize)
.maxBufferSize(maxBufferSize)
.recoveryMode(recoveryMode)
.build();
.recoveryMode(recoveryMode);
if (direct != null) {
walChannelBuilder.direct(direct);
}
blockWALService.walChannel = walChannelBuilder.build();
if (!blockWALService.walChannel.useDirectIO()) {
LOGGER.info("block wal not using direct IO");
}
Expand Down

0 comments on commit cc5c862

Please sign in to comment.