Files
neon/safekeeper
Arseny Sher 003e967a33 Rename full segment to .partial in WAL truncation if needed.
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.
2023-06-11 17:11:02 +04:00
..
2022-05-28 14:02:05 +03:00