Skip to content

feat(log): make log file can be opened with truncated or appended - #300

Merged
GabriFedi97 merged 5 commits into
mainfrom
dev/299
Jul 23, 2026
Merged

feat(log): make log file can be opened with truncated or appended#300
GabriFedi97 merged 5 commits into
mainfrom
dev/299

Conversation

@litaocdl

@litaocdl litaocdl commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

This patch make the log file opened with os.O_APPEND flag by default. Provides
user options in go and cli to overwrite this default to O_TRUNC.

Closes #299

@litaocdl
litaocdl requested a review from a team as a code owner July 17, 2026 08:08
@litaocdl litaocdl changed the title feat: make log destination file configurable for truncated or appended feat(log): enhance log destination file can be opened with truncated or appended Jul 17, 2026
@litaocdl litaocdl changed the title feat(log): enhance log destination file can be opened with truncated or appended feat(log): enhance log file can be opened with truncated or appended Jul 17, 2026
@litaocdl litaocdl changed the title feat(log): enhance log file can be opened with truncated or appended feat(log): make log file can be opened with truncated or appended Jul 17, 2026
Comment thread pkg/log/flags.go Outdated
Comment thread pkg/log/flags.go
@litaocdl
litaocdl force-pushed the dev/299 branch 3 times, most recently from 6ada221 to 233cd49 Compare July 22, 2026 07:14
litaocdl and others added 4 commits July 22, 2026 15:15
…or appended

Signed-off-by: Tao Li <tao.li@enterprisedb.com>
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
…com>

Signed-off-by: Tao Li <tao.li@enterprisedb.com>
Co-authored-by: Gabriele Fedi <gabriele.fedi@enterprisedb.com>
Signed-off-by: Tao Li <tao.li@enterprisedb.com>
The append-by-default and truncate options only reshape how a regular file
is opened; for a FIFO destination both O_APPEND and O_TRUNC are ignored by
the kernel, which the flag help and SetTruncateDestination doc both promise.
Nothing exercised that path, even though a FIFO is the destination type this
logging setup is most often pointed at. Add specs that open a FIFO
destination in both append and truncate modes and confirm the open succeeds
without blocking or panicking.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
@GabriFedi97
GabriFedi97 merged commit b250f27 into main Jul 23, 2026
8 of 9 checks passed
@GabriFedi97
GabriFedi97 deleted the dev/299 branch July 23, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: customDestination opens the log destination with neither O_APPEND nor O_TRUNC, so reopening it overwrites from offset 0

4 participants