Skip to content

Switch to a new WAL after a failed WAL write with paranoid_checks=false - #15932

Open
jevolk wants to merge 1 commit into
meta:mainfrom
jevolk:wal-writer-after-error
Open

jevolk wants to merge 1 commit into
meta:mainfrom
jevolk:wal-writer-after-error

Conversation

@jevolk

@jevolk jevolk commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

Summary:

Background

With paranoid_checks=false, a failed WAL write does not stop the DB. WALIOStatusCheck() clears the WAL writer's error so that later writes can go on (db_impl_write.cc L2146-L2149), and #15193 kept that on purpose: its comment says WALIOStatusCheck() "preserves the legacy behavior of resetting the writer so a later operation can retry" (db_impl.cc L2730-L2738). Later writes go to the same WAL.

log::Writer splits records into 32 KiB blocks and tracks its offset in the current block (block_offset_). When a write to the file fails, WritableFileWriter drops the buffered bytes it could not write, but log::Writer has already counted them. A partial write(), as when the file system fills up part-way through a request, leaves some of them in the file. From then on the writer's block boundaries do not match the file's.

The problem

The writes that follow the failed one are lost on the next DB::Open(). Each record is framed for block boundaries that are not where the file has them. On DB::Open(), log::Reader expects a record header at the start of each 32 KiB block of the file, finds the middle of a record there instead, and drops the block as corruption. Writes acknowledged after the error are lost, including sync=true writes that were written in full and synced.

A real ENOSPC, on a 32 MiB tmpfs with 512 KiB left, default options except paranoid_checks=false:

write(7</db-fs/db/000004.log>, ..., 1039) = 959                 <- ends exactly where block 16 starts
write(7</db-fs/db/000004.log>, ..., 80) = -1 ENOSPC             <- writer counts these 80 bytes
write(7</db-fs/db/000004.log>, ..., 1032) = -1 ENOSPC    x3     <- and three more 1,032-byte records

The writer now places its block boundaries 3,176 bytes before the file's. Space is then freed and 300 Put()s with sync=true follow, every write() complete and every fdatasync() returning 0. On reopen, 31 of the 300 synced writes are recovered; with 516 KiB left the tear falls inside a block and none are. #15930 (the report of this bug) has the reproducer and the field cases that led here.

New behavior

With paranoid_checks=false, on the default write path:

  • After a write to the current WAL fails, no record is added to that WAL again. The next write switches to a new WAL, under a new file number, without a memtable switch. The old WAL stays like any older WAL: it is synced, tracked in the MANIFEST when track_and_verify_wals_in_manifest is set, and replayed by DB::Open(), which reads it up to the failed write and then reads the new WAL from its start. The reopen is with paranoid_checks=false, as in the tests; with paranoid_checks=true the torn end of the old WAL is handled as any torn WAL that is not the last one is in the chosen wal_recovery_mode.
  • If the old WAL is empty, or no write to it was ever acknowledged, it is deleted instead of kept, unless file deletions are disabled, a sync of it is in progress, or SwitchWAL() is flushing memtables to free it. So repeated failures leave at most two WAL files, not one per failed write. With manual_wal_flush=true a write is acknowledged when it enters the WAL buffer, so an old WAL that holds any byte is kept: if every FlushWAL() writes part of the buffer and then fails, one WAL per failure is kept until the memtables are flushed.
  • If creating the new WAL fails, the write returns that error and the next write tries again. An IOFenced error also stops writes, as it does in WALIOStatusCheck().
  • A failed sync, of the current WAL, an older WAL or the WAL directory, leaves the WAL's contents intact, so writes continue in the same WAL as before. A FlushWAL() or a write that meets the error of a failed sync before it is reported returns that error without writing anything, and the WAL is kept. If the sync fails while a write is already being added, the write can still be refused part-way and switch WALs. The switch then first writes what the old WAL's buffer holds, as a memtable switch does; if that fails, that write returns the error, as a failed FlushWAL() would, and the next write switches. The error is now cleared on every WAL writer, not only the current one: after a switch, a sync also syncs the old WAL, and a failure there would otherwise fail every later sync.

On the reproducer above, with only this change:

Free space left manual_wal_flush Values Synced writes after the error recovered, main With this change
512 KiB false b 31 of 300 300 of 300
516 KiB false b 0 of 300 300 of 300
512 KiB true b 31 of 300 300 of 300
516 KiB true b 0 of 300 300 of 300
512 or 516 KiB false or true 0x05 DB::Open() does not return (#13333) 300 of 300

With manual_wal_flush=true, writes that were acknowledged into the WAL buffer and dropped when writing it failed remain lost, with or without this change.

On POSIX, merge with or after #15931: with manual_wal_flush=true and 512 KiB left, the failed FlushWAL() writes 61,854 of 66,062 bytes, which hold 59 complete records of acknowledged writes. With this change those bytes end the old WAL, and PosixWritableFile::Close() truncates the file to the size it counted, which leaves out a partial write, so those records are cut off. Of the 700 writes acknowledged before space was freed, with 512 / 516 KiB left:

Build Recovered
main 507 / 511
this change alone 448 / 448
all three pull requests in #15930 507 / 511

#15931 counts the partial write. In every row with this change, all 300 synced writes after the error are recovered. The truncation is PosixWritableFile::Close()'s; the Windows file does not truncate on close.

Why a new WAL

Two other approaches were considered:

  • Realign the writer to the file's size: that needs the true size after a failed write, and FSWritableFile::GetFileSize() is not specified to be exact after a failed append; on POSIX it misses the bytes of a partial write today (Count the bytes of a partial write in PosixWritableFile's size #15931). The switch needs no size. Only the deletion of an old WAL that holds nothing reads one, and it keeps the WAL unless nothing written to it succeeded and the file system reports a size of 0.
  • Persist the memtables before taking more writes, as DB::Resume() does for file-scoped WAL errors. That needs SST and MANIFEST space during the condition being handled, stops writes until it succeeds, and ResumeImpl() does not support manual_wal_flush or track_and_verify_wals_in_manifest (db_impl.cc L489-L524). With paranoid_checks=false writes are meant to continue.

A WAL switch without a memtable switch leaves the existing WAL retention unchanged: memtables already span several WALs whenever another column family triggered the switch, and each column family's log number still decides when a WAL becomes obsolete.

Scope

The switch is done only when all of these hold: paranoid_checks=false, one write queue, no pipelined or unordered writes, allow_2pc=false, recycle_log_file_num=0 and track_and_verify_wals=false. Every other configuration keeps writing to the same WAL, so the loss of later records described above remains there:

  • With 2PC, a commit can follow a prepare that was in the dropped buffer.
  • A new recycled WAL can hold a stale tail after the torn record, which stops replay under kPointInTimeRecovery even with paranoid_checks=false.
  • track_and_verify_wals records the predecessor WAL's exact size and last sequence number, which are not known after a failed write.
  • Two write queues, pipelined and unordered writes have their own leaders and sequence allocation, and the second queue does not go through PreprocessWrite(). A switch there needs its own design and is left for a follow-up (possible, not planned).

Three changes reach those configurations: the error reset and the bonus fix under "Other effects", and the early return in WriteToWAL() when the WAL file already has an error, which fails the write with the same error as before, but before anything else is done for it.

This change does not stop a failed write's sequence numbers from being reused. When its record reached the WAL in full and only the file's Flush() or Sync() failed, the next write gets the same numbers and DB::Open() fails with Corruption: Sequence number is being set backwards during recovery, as on main. #15819 fixes the same reuse after a failed MANIFEST commit and leaves this case to a separate change. Skipping the numbers here would not be enough: after a failed write that did not land, the skipped range is a gap between the old WAL and the new one, and kPointInTimeRecovery with paranoid_checks=true resumes after a torn WAL only when the next WAL's sequence numbers follow on (MaybeReviseStopReplayForCorruption()), so it would drop the new WAL.

Other effects

  • With manual_wal_flush=true, a write whose sync found that a concurrent FlushWAL() had dropped its record now returns an error instead of OK.
  • Bonus fix: with manual_wal_flush=true, WriteToWAL() returned without unlocking wal_write_mutex_ when writing the user-defined timestamp size record failed, so the next write waited forever (covered by DamagedWalBufferIsWrittenBeforeSwitch).
  • Clearing the error on every WAL writer is not limited to the configurations above: it applies wherever WALIOStatusCheck() resets instead of setting a background error, which is every configuration with paranoid_checks=false, and a Busy or Incomplete status with paranoid_checks=true.
  • Not changed: a checkpoint copies an open WAL up to the bytes WritableFileWriter counted as written, and an append that reached the file but returned an error is not counted. The copy can then miss those bytes, with or without this change. Before, the current WAL was copied short by that amount at its end; now it is the old WAL that is.
  • Do not retry a failed WAL writer after a fatal background error #15820 (open) changes WALIOStatusCheck() and FlushWAL() for WAL errors that become background errors. It sets no mark for a failed WAL write with paranoid_checks=false, because RocksDB keeps using that WAL; with this change RocksDB stops using it, so that reasoning would need a second look if both land.

Test Plan:

New tests in db/db_wal_test.cc, using a FileSystem wrapper that fails a WAL file's Append(), Flush() or Sync(), or its creation, on request:

Test Checks On main
DBWALWriteErrorTest.WritesAfterFailedWalWriteAreRecovered A failed write that lands 0 or 5 bytes, with manual_wal_flush and track_and_verify_wals_in_manifest on and off, then 10 synced writes crossing several blocks: a new WAL is used, the old one does not grow, and all 10 are recovered in all four wal_recovery_mode values fails: 3 of 10 recovered
DBWALWriteErrorTest.WalFilesBoundedWhileWritesFail 20 failing writes that land 0 or 5 bytes each (with manual_wal_flush, 0 bytes only) leave at most two WAL files, and synced writes after the failures are recovered fails: later writes lost
DBWALWriteErrorTest.FailedWalWriteThatLandedIsKept With manual_wal_flush, the first FlushWAL() of a new WAL that reaches the file in full and returns an error: the old WAL is kept and its writes are recovered fails: no new WAL is used; the writes are recovered
DBWALWriteErrorTest.NewWalCreationFails A failed WAL creation fails the write, leaves no file, and the next write succeeds fails: the write goes to the same WAL
DBWALWriteErrorTest.FlushWalFailsWhileWriteIsInProgress With manual_wal_flush, a FlushWAL() that fails after a write chose the WAL (sync point): the write fails and the old WAL does not grow fails: the write is accepted
DBWALWriteErrorTest.WalSwitchBeforeFlushWalReportsError With manual_wal_flush, a synced write that switches WALs while a failed FlushWAL() has not yet reported its error (new sync point DBImpl::FlushWAL:WriteBufferFailed): the write and later syncs succeed fails, with the new sync point added to main: IO error: Seen injected error. Skip writing buffer. (a debug build's wording)
DBWALWriteErrorTest.FailedSyncOfOldWalIsRetried After a switch, a sync of the old WAL fails once: later synced writes and SyncWAL() succeed fails: no new WAL is used
DBWALWriteErrorTest.DamagedWalBufferIsWrittenBeforeSwitch With manual_wal_flush, the WAL is marked damaged by an error that dropped nothing (injected at a sync point) while an acknowledged write is only in its buffer: the switch writes the buffer first and keeps the WAL, and the write is recovered; if writing the buffer fails, that write returns the error and the next write switches hangs: the failed write leaves wal_write_mutex_ locked (the bonus fix)
DBWALWriteErrorTest.FailedWalSyncKeepsWal A failed sync keeps the WAL, and data accepted before it is recovered passes: unchanged behavior
DBWALWriteErrorTest.FailedSyncSeenBeforeItIsReportedKeepsWal With manual_wal_flush, a FlushWAL() or a write that runs after a failed SyncWAL() and before its error is reported (sync point): it fails, the WAL is kept, and an acknowledged write that was only in the WAL buffer is recovered passes: unchanged behavior
DBWALWriteErrorTest.WalNotSwitchedInOtherConfigurations Pipelined, two queues, unordered, recycled WALs, allow_2pc and track_and_verify_wals: each keeps writing to the same WAL passes: unchanged behavior

Undoing any one of these rules fails a test. Writing the old WAL's buffer before the switch, or returning the error when that fails: DamagedWalBufferIsWrittenBeforeSwitch loses the acknowledged write, or reports no error. Clearing the error on every writer: FailedSyncOfOldWalIsRetried. Deleting an old WAL that no acknowledged write reached, not only an empty one: three files are left in WalFilesBoundedWhileWritesFail. Returning early in WriteToWAL(), or marking the WAL in FlushWAL() only when writing the buffer dropped it: FailedSyncSeenBeforeItIsReportedKeepsWal switches WALs although nothing was lost; these two keep a failed sync from costing a WAL. The same rule in WriteGroupToWAL() has no test of its own.

db_crashtest.py does not run with paranoid_checks=false, so the crash test does not cover this path; the coverage is the tests above and the real-ENOSPC runs.

The real-ENOSPC reproducer and its runs are in #15930.

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

✅ clang-tidy: No findings on changed lines

Completed in 236.8s.

Summary:
With `paranoid_checks=false`, a failed WAL write does not stop the DB.
`WALIOStatusCheck()` clears the WAL writer's error so that later writes
can go on, and meta#15193 kept that on purpose: its comment says
`WALIOStatusCheck()` "preserves the legacy behavior of resetting the
writer so a later operation can retry". Later writes go to the same WAL,
and they are lost on the next `DB::Open()`. `log::Writer` splits records
into 32 KiB blocks and tracks its offset in the current block. When a
write to the file fails, `WritableFileWriter` drops the buffered bytes
it could not write, but `log::Writer` has already counted them, and a
partial `write()`, as when the file system fills up part-way through a
request, leaves some of them in the file. From then on the writer's
block boundaries do not match the file's. On `DB::Open()`, `log::Reader`
expects a record header at the start of each 32 KiB block of the file,
finds the middle of a record there instead, and drops the block as
corruption. Writes acknowledged after the error are lost, including
`sync=true` writes that were written in full and synced. On a real
`ENOSPC` (a 32 MiB tmpfs with 512 KiB left, default options except
`paranoid_checks=false`), 31 of 300 synced writes made after space was
freed are recovered; with 516 KiB left, none are.

With this change, with `paranoid_checks=false` on the default write
path:
- After a write to the current WAL fails, no record is added to that WAL
  again. The next write switches to a new WAL, under a new file number,
  without a memtable switch. The old WAL stays like any older WAL: it is
  synced, tracked in the MANIFEST when
  `track_and_verify_wals_in_manifest` is set, and replayed by
  `DB::Open()`, which reads it up to the failed write and then reads the
  new WAL from its start. The reopen is with `paranoid_checks=false`, as
  in the tests; with `paranoid_checks=true` the torn end of the old WAL
  is handled as any torn WAL that is not the last one is in the chosen
  `wal_recovery_mode`.
- If the old WAL is empty, or no write to it was ever acknowledged, it
  is deleted instead of kept, unless file deletions are disabled, a sync
  of it is in progress, or `SwitchWAL()` is flushing memtables to free
  it. So repeated failures leave at most two WAL files, not one per
  failed write. With `manual_wal_flush=true` a write is acknowledged
  when it enters the WAL buffer, so an old WAL that holds any byte is
  kept: if every `FlushWAL()` writes part of the buffer and then fails,
  one WAL per failure is kept until the memtables are flushed.
- If creating the new WAL fails, the write returns that error and the
  next write tries again. An `IOFenced` error also stops writes, as it
  does in `WALIOStatusCheck()`.
- A failed sync, of the current WAL, an older WAL or the WAL directory,
  leaves the WAL's contents intact, so writes continue in the same WAL
  as before. A `FlushWAL()` or a write that meets the error of a failed
  sync before it is reported returns that error without writing
  anything, and the WAL is kept. If the sync fails while a write is
  already being added, the write can still be refused part-way and
  switch WALs. The switch then first writes what the old WAL's buffer
  holds, as a memtable switch does; if that fails, that write returns
  the error, as a failed `FlushWAL()` would, and the next write
  switches. The error is now cleared on every WAL writer, not only the
  current one: after a switch, a sync also syncs the old WAL, and a
  failure there would otherwise fail every later sync.

In that setup, with 512 or 516 KiB left and `manual_wal_flush` off or
on, all 300 synced writes made after the error are recovered. With
values of 0x05 bytes, where main's `DB::Open()` does not return
(meta#13333), the same holds. With `manual_wal_flush=true`, writes that were
acknowledged into the WAL buffer and dropped when writing it failed
remain lost, with or without this change.

On POSIX this change should land with or after the change that counts
the bytes of a partial write in `PosixWritableFile`'s size. With
`manual_wal_flush=true` and 512 KiB left, the failed `FlushWAL()` writes
61,854 of 66,062 bytes, which hold 59 complete records of acknowledged
writes. With this change those bytes end the old WAL, and
`PosixWritableFile::Close()` truncates the file to the size it counted,
which leaves out a partial write. Of the 700 writes acknowledged before
space was freed, main recovers 507 (511 with 516 KiB left), this change
alone 448 in both cases, and this change with that one and the WAL
reader fix for meta#13333, 507 and 511. `WinWritableFile` does not truncate
on close.

Two other approaches were considered. Realigning the writer to the
file's size needs the true size after a failed write, and
`FSWritableFile::GetFileSize()` is not specified to be exact after a
failed append; on POSIX it misses the bytes of a partial write today.
The switch needs no size; only the deletion of an old WAL that holds
nothing reads one, and it keeps the WAL unless nothing written to it
succeeded and the file system reports a size of 0. Persisting the
memtables before taking more writes, as `DB::Resume()` does for
file-scoped WAL errors, needs SST and MANIFEST space during the
condition being handled and stops writes until it succeeds, and
`ResumeImpl()` does not support `manual_wal_flush` or
`track_and_verify_wals_in_manifest`. With `paranoid_checks=false` writes
are meant to continue.

A WAL switch without a memtable switch leaves the existing WAL retention
unchanged: memtables already span several WALs whenever another column
family triggered the switch, and each column family's log number still
decides when a WAL becomes obsolete.

The switch is done only when all of these hold: `paranoid_checks=false`,
one write queue, no pipelined or unordered writes, `allow_2pc=false`,
`recycle_log_file_num=0` and `track_and_verify_wals=false`. Every other
configuration keeps writing to the same WAL, so the loss of later
records remains there. With 2PC, a commit can follow a prepare that was
in the dropped buffer. A new recycled WAL can hold a stale tail after
the torn record, which stops replay under `kPointInTimeRecovery` even
with `paranoid_checks=false`. `track_and_verify_wals` records the
predecessor WAL's exact size and last sequence number, which are not
known after a failed write. Two write queues, pipelined and unordered
writes have their own leaders and sequence allocation, and the second
queue does not go through `PreprocessWrite()`; a switch there needs its
own design. Three changes reach those configurations: the error reset
and the bonus fix below, and the early return in `WriteToWAL()` when the
WAL file already has an error, which fails the write with the same error
as before, but before anything else is done for it.

This change does not stop a failed write's sequence numbers from being
reused. When its record reached the WAL in full and only the file's
`Flush()` or `Sync()` failed, the next write gets the same numbers and
`DB::Open()` fails with
`Corruption: Sequence number is being set backwards during recovery`, as
before. meta#15819 fixes the same reuse after a failed MANIFEST commit and
leaves this case to a separate change. Skipping the numbers here would
not be enough: after a failed write that did not land, the skipped range
is a gap between the old WAL and the new one, and `kPointInTimeRecovery`
with `paranoid_checks=true` resumes after a torn WAL only when the next
WAL's sequence numbers follow on, so it would drop the new WAL.

Other effects:
- With `manual_wal_flush=true`, a write whose sync found that a
  concurrent `FlushWAL()` had dropped its record now returns an error
  instead of OK.
- Clearing the error on every WAL writer is not limited to the
  configurations above. It applies wherever `WALIOStatusCheck()` resets
  instead of setting a background error, which is every configuration
  with `paranoid_checks=false`, and a `Busy` or `Incomplete` status with
  `paranoid_checks=true`.
- Not changed: a checkpoint copies an open WAL up to the bytes
  `WritableFileWriter` counted as written, and an append that reached
  the file but returned an error is not counted, so the copy can miss
  those bytes, with or without this change. Before, the current WAL was
  copied short by that amount at its end; now it is the old WAL that is.
- meta#15820 changes `WALIOStatusCheck()` and `FlushWAL()` for WAL errors
  that become background errors. It sets no mark for a failed WAL write
  with `paranoid_checks=false`, because RocksDB keeps using that WAL;
  with this change RocksDB stops using it, so that reasoning would need
  a second look if both land.

Bonus fix: with `manual_wal_flush=true`, `WriteToWAL()` returned without
unlocking `wal_write_mutex_` when writing the user-defined timestamp
size record failed, so the next write waited forever.

Test Plan:
New tests in `db/db_wal_test.cc`, using a `FileSystem` wrapper that
fails a WAL file's `Append()`, `Flush()` or `Sync()`, or its creation,
on request. Each of the first eight fails or hangs without the change:
- `DBWALWriteErrorTest.WritesAfterFailedWalWriteAreRecovered`: a failed
  write that lands 0 or 5 bytes, with `manual_wal_flush` and
  `track_and_verify_wals_in_manifest` on and off, then 10 synced writes
  crossing several blocks. A new WAL is used, the old one does not grow,
  and all 10 are recovered in all four `wal_recovery_mode` values.
  Without the change, 3 of 10 are recovered.
- `DBWALWriteErrorTest.WalFilesBoundedWhileWritesFail`: 20 failing
  writes that land 0 or 5 bytes each (with `manual_wal_flush`, 0 bytes
  only) leave at most two WAL files, and synced writes after the
  failures are recovered. Without the change, those writes are lost.
- `DBWALWriteErrorTest.FailedWalWriteThatLandedIsKept`: with
  `manual_wal_flush`, the first `FlushWAL()` of a new WAL reaches the
  file in full and returns an error. The old WAL is kept and its writes
  are recovered. Without the change no new WAL is used.
- `DBWALWriteErrorTest.NewWalCreationFails`: a failed WAL creation fails
  the write and leaves no file, and the next write succeeds. Without the
  change the write goes to the same WAL.
- `DBWALWriteErrorTest.FlushWalFailsWhileWriteIsInProgress`: with
  `manual_wal_flush`, a `FlushWAL()` fails after a write chose the WAL
  (sync point). The write fails and the old WAL does not grow. Without
  the change the write is accepted.
- `DBWALWriteErrorTest.WalSwitchBeforeFlushWalReportsError`: with
  `manual_wal_flush`, a synced write switches WALs while a failed
  `FlushWAL()` has not yet reported its error (new sync point
  `DBImpl::FlushWAL:WriteBufferFailed`). The write and later syncs
  succeed. Without the change, with the new sync point added, the write
  fails with `IO error: Seen injected error. Skip writing buffer.` (a
  debug build's wording).
- `DBWALWriteErrorTest.FailedSyncOfOldWalIsRetried`: after a switch, a
  sync of the old WAL fails once, and later synced writes and
  `SyncWAL()` succeed. Without the change no new WAL is used.
- `DBWALWriteErrorTest.DamagedWalBufferIsWrittenBeforeSwitch`: with
  `manual_wal_flush`, the WAL is marked damaged by an error that dropped
  nothing (injected at a sync point) while an acknowledged write is only
  in its buffer. The switch writes the buffer first and keeps the WAL,
  and the write is recovered; if writing the buffer fails, that write
  returns the error and the next write switches. Without the change the
  next write hangs, because the failed write leaves `wal_write_mutex_`
  locked (the bonus fix).
- `DBWALWriteErrorTest.FailedWalSyncKeepsWal`: a failed sync keeps the
  WAL, and data accepted before it is recovered. Unchanged behavior;
  passes without the change.
- `DBWALWriteErrorTest.FailedSyncSeenBeforeItIsReportedKeepsWal`: with
  `manual_wal_flush`, a `FlushWAL()` or a write runs after a failed
  `SyncWAL()` and before its error is reported (sync point). It fails,
  the WAL is kept, and an acknowledged write that was only in the WAL
  buffer is recovered. Unchanged behavior; passes without the change.
- `DBWALWriteErrorTest.WalNotSwitchedInOtherConfigurations`: pipelined,
  two queues, unordered, recycled WALs, `allow_2pc` and
  `track_and_verify_wals` each keep writing to the same WAL. Unchanged
  behavior; passes without the change.

`db_crashtest.py` does not run with `paranoid_checks=false`, so the
crash test does not cover this path; the coverage is the tests above and
the real-`ENOSPC` runs.

Undoing any one of these rules fails a test. Writing the old WAL's
buffer before the switch, or returning the error when that fails:
`DamagedWalBufferIsWrittenBeforeSwitch` loses the acknowledged write, or
reports no error. Clearing the error on every writer:
`FailedSyncOfOldWalIsRetried`. Deleting an old WAL that no acknowledged
write reached, not only an empty one: three files are left in
`WalFilesBoundedWhileWritesFail`. Returning early in `WriteToWAL()`, or
marking the WAL in `FlushWAL()` only when writing the buffer dropped it:
`FailedSyncSeenBeforeItIsReportedKeepsWal` switches WALs although
nothing was lost; these two keep a failed sync from costing a WAL. The
same rule in `WriteGroupToWAL()` has no test of its own.
@jevolk
jevolk force-pushed the wal-writer-after-error branch from 43342d1 to b929a2e Compare December 5, 2026 06:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant