-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backupccl: handle range keys in BACKUP
Previously BACKUP would not back up range tombstones. With this patch, BACKUPs with revision_history will backup range tombstones. Non-revision history backups are not affected by this diff because MVCCExportToSST filters all tombstones out of the backup already. Specifically, this patch replaces the iterators used in the backup_processor with the pebbleIterator, which has baked in range key support. Fixes #71155 Release note: none
- Loading branch information
Showing
5 changed files
with
349 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Tests that Backups without Revisions History and Restore properly handle | ||
# range keys | ||
|
||
new-server name=s1 | ||
---- | ||
|
||
exec-sql | ||
CREATE DATABASE orig; | ||
USE orig; | ||
CREATE TABLE foo (i INT PRIMARY KEY, s STRING); | ||
INSERT INTO foo VALUES (1, 'x'),(2,'y'); | ||
CREATE TABLE baz (i INT PRIMARY KEY, s STRING); | ||
INSERT INTO baz VALUES (11, 'xx'),(22,'yy'); | ||
---- | ||
|
||
# Ensure a full backup properly captures range keys | ||
# - with foo, delete then insert, and ensure no original data surfaces in restore | ||
# - with baz: chill for now | ||
|
||
kv request=DeleteRange target=foo | ||
---- | ||
|
||
exec-sql | ||
INSERT INTO foo VALUES (3,'z'); | ||
---- | ||
|
||
exec-sql | ||
BACKUP INTO 'nodelocal://0/test-root/'; | ||
---- | ||
|
||
exec-sql | ||
RESTORE DATABASE orig FROM LATEST IN 'nodelocal://0/test-root/' with new_db_name='orig1'; | ||
---- | ||
|
||
query-sql | ||
SELECT count(*) from orig1.foo; | ||
---- | ||
1 | ||
|
||
query-sql | ||
SELECT count(*) from orig1.baz; | ||
---- | ||
2 | ||
|
||
exec-sql | ||
DROP DATABASE orig1 CASCADE | ||
---- | ||
|
||
# Ensure incremental backup without revision history | ||
# handles range tombstones: | ||
# - with foo, insert and ensure latest data from previous backup surfaces in RESTORE | ||
# - with baz, delete then insert, and ensure no data from previous backup surfaces in RESTORE | ||
|
||
exec-sql | ||
INSERT INTO foo VALUES (4,'a'),(5,'b'); | ||
---- | ||
|
||
kv request=DeleteRange target=baz | ||
---- | ||
|
||
exec-sql | ||
INSERT INTO baz VALUES (33,'zz'); | ||
---- | ||
|
||
exec-sql | ||
BACKUP INTO LATEST IN 'nodelocal://0/test-root/'; | ||
---- | ||
|
||
exec-sql | ||
RESTORE DATABASE orig FROM LATEST IN 'nodelocal://0/test-root/' with new_db_name='orig1'; | ||
---- | ||
|
||
query-sql | ||
SELECT count(*) from orig1.foo | ||
---- | ||
3 | ||
|
||
query-sql | ||
SELECT count(*) from orig1.baz | ||
---- | ||
1 | ||
|
||
|
||
|
Oops, something went wrong.