mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
c058e1cec2 omitted it if write_lsn is equal to truncation position, but
write_lsn is updated only on full record, so following was possible:
- insert half of record, crossing segment, and thus rename .partial to full;
write_lsn doesn't change
- next truncate omits rename full back to .partial
- write after truncate errors about write into non-partial segment
Fixes regression looking like
ERROR WAL acceptor{cid=22 ...}:panic{thread=WAL acceptor
19b6c1743666ec02991a7633c57178db/b07db8c88f4c76ea5ed0954c04cc1e74
location=safekeeper/src/wal_storage.rs:230:13}: unexpected write into
non-partial segment file
I'd prefer to drop .partial segments completely, but let's do it separately.
Also fsync last segment on safekeeper restart to make sure we correctly init
flush_lsn.