Skip to content

Commit 240f2bf

Browse files
committed
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.
1 parent 2c92e61 commit 240f2bf

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/osiris_log.erl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,12 +2123,6 @@ build_segment_info(SegFile, LastChunkPos, IdxFile) ->
21232123
_Reserved:24>>} ->
21242124
LastChunkSize = LastFSize + LastSize + LastTSize,
21252125
Size = LastChunkPos + ?HEADER_SIZE_B + LastChunkSize,
2126-
%% TODO: this file:position/2 all has no actual function and
2127-
%% is only used to emit a debug log. Remove?
2128-
{ok, Eof} = file:position(Fd, eof),
2129-
?DEBUG_IF("~s: segment ~ts has trailing data ~w ~w",
2130-
[?MODULE, filename:basename(SegFile),
2131-
Size, Eof], Size =/= Eof),
21322126
_ = file:close(Fd),
21332127
FstChInfo = #chunk_info{epoch = FirstEpoch,
21342128
timestamp = FirstTs,

0 commit comments

Comments
 (0)