Skip to content

Commit 18cb1dd

Browse files
chore(20379): Enable FileChannel api and DontSync (#20381)
Signed-off-by: mxtartaglia <[email protected]>
1 parent c788699 commit 18cb1dd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/PcesConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ public record PcesConfig(
8686
@ConfigProperty(defaultValue = "1ms") Duration replayHealthThreshold,
8787
@ConfigProperty(defaultValue = "true") boolean limitReplayFrequency,
8888
@ConfigProperty(defaultValue = "5000") int maxEventReplayFrequency,
89-
@ConfigProperty(defaultValue = "EVERY_SELF_EVENT") FileSyncOption inlinePcesSyncOption,
90-
@ConfigProperty(defaultValue = "OUTPUT_STREAM") PcesFileWriterType pcesFileWriterType,
89+
@ConfigProperty(defaultValue = "DONT_SYNC") FileSyncOption inlinePcesSyncOption,
90+
@ConfigProperty(defaultValue = "FILE_CHANNEL") PcesFileWriterType pcesFileWriterType,
9191
@ConfigProperty(defaultValue = "OUTPUT_STREAM") PcesFileWriterType macPcesFileWriterType) {}

platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/PcesFileChannelWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ public void writeVersion(final int version) throws IOException {
6565
@Override
6666
public long writeEvent(@NonNull final GossipEvent event) throws IOException {
6767
final int size = GossipEvent.PROTOBUF.measureRecord(event);
68-
final boolean expandBuffer = size > buffer.capacity();
68+
final boolean expandBuffer = (size + Integer.BYTES) > buffer.capacity();
6969
if (expandBuffer) {
7070
MemoryUtils.closeDirectByteBuffer(buffer);
71-
buffer = ByteBuffer.allocateDirect(size);
71+
buffer = ByteBuffer.allocateDirect(size + Integer.BYTES);
7272
writableSequentialData = BufferedData.wrap(buffer);
7373
}
7474
buffer.putInt(size);

0 commit comments

Comments
 (0)