From 240f2bf9cb9de2568e4f2ff568caeaf3e2f8c2bf Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Mon, 16 Feb 2026 11:45:31 -0500 Subject: [PATCH] osiris_log: Remove debug log about trailing data This debug log prints fairly often when publishing at a reasonably high throughput, for example with: stream-perf-test --producers 1 --consumers 0 --streams sq --size 1000 --rate 50000 Callers of `build_segment_info/3` (retention and resolving some offset specs) find the last chunk position by reading the index file first and then reading the segment. If any new chunks are appended between the read of the index file and the read of the segment file, `Eof` will naturally not be equal to `Size`. And the segment file is written before the index file, so there's a non-trivial window where this is true. When publishing with that throughput (50 MB/sec) I see this log printed by retention very consistently. There's a TODO here wondering whether we should remove the extra `position` syscall. I don't think we need it so this commit removes the `position` call and `DEBUG_IF` log. --- src/osiris_log.erl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/osiris_log.erl b/src/osiris_log.erl index 95c8ab24..a022d53b 100644 --- a/src/osiris_log.erl +++ b/src/osiris_log.erl @@ -2123,12 +2123,6 @@ build_segment_info(SegFile, LastChunkPos, IdxFile) -> _Reserved:24>>} -> LastChunkSize = LastFSize + LastSize + LastTSize, Size = LastChunkPos + ?HEADER_SIZE_B + LastChunkSize, - %% TODO: this file:position/2 all has no actual function and - %% is only used to emit a debug log. Remove? - {ok, Eof} = file:position(Fd, eof), - ?DEBUG_IF("~s: segment ~ts has trailing data ~w ~w", - [?MODULE, filename:basename(SegFile), - Size, Eof], Size =/= Eof), _ = file:close(Fd), FstChInfo = #chunk_info{epoch = FirstEpoch, timestamp = FirstTs,