vinyl: make snapshot consistent
A set of run files created by a snapshot is inconsistent, meaning w/o replaying xlog it is not guaranteed that it contains a database state that existed when the snapshot was taken. This is because we dump all ranges independently and each range as a whole, so that if a statements happens to be inserted to a range after snapshot was started and before the range is dumped, it will be included in the dump. This peculiarity stands in the way of backups and replication, both of which require a consistent database state. To make snapshot consistent, let's force rotation of all in-memory trees on snapshot and make the dump task only dump trees that need to be snapshotted if snapshot is in progress. The rotation is done lazily, on insertion to the tree, similarly to how we handle DDL. The difference is instead of sc_version we check vy_mem->min_lsn against checkpoint_lsn.
Loading
Please register or sign in to comment