Refactor Restore()
This commit refactors out the complexity of downloading ordered WAL files in parallel to a type called `WALDownloader`. This makes it easier to test the restore separately from the download.
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
To reproduce this testdata, run sqlite3 and execute:
|
||||
|
||||
PRAGMA journal_mode = WAL;
|
||||
CREATE TABLE t (x);
|
||||
INSERT INTO t (x) VALUES (1);
|
||||
INSERT INTO t (x) VALUES (2);
|
||||
|
||||
sl3 split -o generations/0000000000000000/wal/00000000 db-wal
|
||||
cp db generations/0000000000000000/snapshots/00000000.snapshot
|
||||
lz4 -c --rm generations/0000000000000000/snapshots/00000000.snapshot
|
||||
|
||||
|
||||
Then execute:
|
||||
|
||||
PRAGMA wal_checkpoint(TRUNCATE);
|
||||
INSERT INTO t (x) VALUES (3);
|
||||
|
||||
sl3 split -o generations/0000000000000000/wal/00000001 db-wal
|
||||
|
||||
|
||||
Then execute:
|
||||
|
||||
PRAGMA wal_checkpoint(TRUNCATE);
|
||||
INSERT INTO t (x) VALUES (4);
|
||||
INSERT INTO t (x) VALUES (5);
|
||||
|
||||
sl3 split -o generations/0000000000000000/wal/00000002 db-wal
|
||||
|
||||
|
||||
Finally, obtain the final snapshot:
|
||||
|
||||
PRAGMA wal_checkpoint(TRUNCATE);
|
||||
|
||||
cp db 00000002.db
|
||||
rm db*
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user