-
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.
67497: backupccl: stop splitting at invalid split keys r=pbardea a=pbardea Restore could perform invalid splits during the split and scatter phase. This commit ensures that splits are always performed at safe keys. Fixes #67488. Release note (bug fix): Fix a bug where restores of data with multiple column families could be split illegally (within a single SQL row). This could result in temporary data unavailability until the ranges on either side of the invalid split are merged. Co-authored-by: Paul Bardea <[email protected]>
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
new-server name=s1 localities=us-east-1,us-west-1,us-west-2,eu-central-1 | ||
---- | ||
|
||
exec-sql | ||
CREATE DATABASE orig; | ||
USE orig; | ||
CREATE TABLE cfs (a INT PRIMARY KEY, b STRING, c STRING, d STRING, FAMILY (b), FAMILY (c)); | ||
INSERT INTO cfs SELECT x, repeat('abc', 100), repeat('abc', 100) FROM generate_series(0, 3) AS x; | ||
ALTER TABLE cfs SPLIT AT SELECT a FROM cfs; | ||
-- Split the output files very small to catch output SSTs mid-row. | ||
SET CLUSTER SETTING kv.bulk_sst.target_size = '1'; | ||
BACKUP cfs TO 'nodelocal://1/foo'; | ||
CREATE DATABASE r1; | ||
RESTORE cfs FROM 'nodelocal://1/foo' WITH into_db='r1'; | ||
---- | ||
|
||
query-sql | ||
SELECT max(length(start_key)) FROM [SHOW RANGES FROM TABLE orig.cfs]; | ||
---- | ||
2 | ||
|
||
# Regression test for #67488. | ||
# This can return up to 6 if RESTORE improperly splits the ranges in the middle | ||
# of a SQL row since column family keys are longer. E.g. Keys are expected to be | ||
# of the form '/1' (row with PK 1), and not '/3/1/1' (row with PK 3, and CF 1). | ||
query-sql | ||
SELECT max(length(start_key)) FROM [SHOW RANGES FROM TABLE r1.cfs]; | ||
---- | ||
2 |