@@ -9958,118 +9958,6 @@ func TestUserfileNormalizationIncrementalShowBackup(t *testing.T) {
9958
9958
sqlDB .Exec (t , query )
9959
9959
}
9960
9960
9961
- // TestBackupRestoreOldIncrementalDefaults tests that a call to restore
9962
- // will correctly load an incremental backup in the old "default" directory.
9963
- // That old default is literally just "the same directory as the full backup",
9964
- // so write that manually with the `incremental_location` option then check that
9965
- // a read without that option contains the same data.
9966
- func TestBackupRestoreOldIncrementalDefault (t * testing.T ) {
9967
- defer leaktest .AfterTest (t )()
9968
- defer log .Scope (t ).Close (t )
9969
-
9970
- skip .UnderRace (t , "multinode cluster setup times out under race, likely due to resource starvation." )
9971
-
9972
- const numAccounts = 1
9973
- _ , sqlDB , _ , cleanupFn := backupRestoreTestSetup (t , multiNode , numAccounts , InitManualReplication )
9974
- defer cleanupFn ()
9975
-
9976
- const c1 , c2 , c3 = `nodelocal://1/full/` , `nodelocal://1/full/` , `nodelocal://2/full/`
9977
-
9978
- // Deliberately the same. We're simulating an incremental backup in the old
9979
- // default directory, i.e. the top-level collection directory.
9980
- const i1 , i2 , i3 = `nodelocal://1/full/` , `nodelocal://1/full/` , `nodelocal://2/full/`
9981
-
9982
- collections := []string {
9983
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , c1 , url .QueryEscape ("default" )),
9984
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , c2 , url .QueryEscape ("dc=dc1" )),
9985
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , c3 , url .QueryEscape ("dc=dc2" )),
9986
- }
9987
-
9988
- incrementals := []string {
9989
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , i1 , url .QueryEscape ("default" )),
9990
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , i2 , url .QueryEscape ("dc=dc1" )),
9991
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , i3 , url .QueryEscape ("dc=dc2" )),
9992
- }
9993
- tests := []struct {
9994
- dest []string
9995
- inc []string
9996
- }{{dest : []string {collections [0 ]}, inc : []string {incrementals [0 ]}},
9997
- {dest : collections , inc : incrementals }}
9998
-
9999
- for _ , br := range tests {
10000
- dest := strings .Join (br .dest , ", " )
10001
- inc := strings .Join (br .inc , ", " )
10002
-
10003
- if len (br .dest ) > 1 {
10004
- dest = "(" + dest + ")"
10005
- inc = "(" + inc + ")"
10006
- }
10007
- // create db
10008
- sqlDB .Exec (t , `CREATE DATABASE fkdb` )
10009
- sqlDB .Exec (t , `CREATE TABLE fkdb.fk (ind INT)` )
10010
-
10011
- for i := 0 ; i < 10 ; i ++ {
10012
- sqlDB .Exec (t , `INSERT INTO fkdb.fk (ind) VALUES ($1)` , i )
10013
- }
10014
- fb := fmt .Sprintf ("BACKUP DATABASE fkdb INTO %s" , dest )
10015
- sqlDB .Exec (t , fb )
10016
-
10017
- sqlDB .Exec (t , `INSERT INTO fkdb.fk (ind) VALUES ($1)` , 200 )
10018
-
10019
- sib := fmt .Sprintf ("BACKUP DATABASE fkdb INTO LATEST IN %s WITH incremental_location=%s" , dest , inc )
10020
- sqlDB .Exec (t , sib )
10021
-
10022
- sir := fmt .Sprintf ("RESTORE DATABASE fkdb FROM LATEST IN %s WITH new_db_name = 'inc_fkdb'" , dest )
10023
- sqlDB .Exec (t , sir )
10024
-
10025
- sqlDB .CheckQueryResults (t , `SELECT * FROM inc_fkdb.fk` , sqlDB .QueryStr (t , `SELECT * FROM fkdb.fk` ))
10026
-
10027
- sqlDB .Exec (t , "DROP DATABASE fkdb" )
10028
- sqlDB .Exec (t , "DROP DATABASE inc_fkdb;" )
10029
- }
10030
- }
10031
-
10032
- func TestBackupRestoreErrorsOnBothDefaultsPopulated (t * testing.T ) {
10033
- defer leaktest .AfterTest (t )()
10034
- defer log .Scope (t ).Close (t )
10035
-
10036
- const numAccounts = 1
10037
- _ , sqlDB , _ , cleanupFn := backupRestoreTestSetup (t , singleNode , numAccounts , InitManualReplication )
10038
- defer cleanupFn ()
10039
-
10040
- base := `'nodelocal://1/full/'`
10041
- oldInc := base
10042
- newInc := `'nodelocal://1/full/incrementals'`
10043
-
10044
- // create db
10045
- sqlDB .Exec (t , `CREATE DATABASE fkdb` )
10046
- sqlDB .Exec (t , `CREATE TABLE fkdb.fk (ind INT)` )
10047
-
10048
- for i := 0 ; i < 10 ; i ++ {
10049
- sqlDB .Exec (t , `INSERT INTO fkdb.fk (ind) VALUES ($1)` , i )
10050
- }
10051
- fb := fmt .Sprintf ("BACKUP DATABASE fkdb INTO %s" , base )
10052
- sqlDB .Exec (t , fb )
10053
-
10054
- sibOld := fmt .Sprintf ("BACKUP DATABASE fkdb INTO LATEST IN %s WITH incremental_location=%s" , base , oldInc )
10055
- sqlDB .Exec (t , sibOld )
10056
-
10057
- sibNew := fmt .Sprintf ("BACKUP DATABASE fkdb INTO LATEST IN %s WITH incremental_location=%s" , base , newInc )
10058
- sqlDB .Exec (t , sibNew )
10059
-
10060
- irDefault := fmt .Sprintf ("RESTORE DATABASE fkdb FROM LATEST IN %s WITH new_db_name = 'trad_fkdb'" , base )
10061
- sqlDB .ExpectErr (t , "pq: Incremental layers found in both old and new default locations. " +
10062
- "Please choose a location manually with the `incremental_location` parameter." , irDefault )
10063
-
10064
- irOld := fmt .Sprintf ("RESTORE DATABASE fkdb FROM LATEST IN %s WITH new_db_name = 'trad_fkdb_old_default', " +
10065
- "incremental_location=%s" , base , base )
10066
- sqlDB .Exec (t , irOld )
10067
-
10068
- irNew := fmt .Sprintf ("RESTORE DATABASE fkdb FROM LATEST IN %s WITH new_db_name = 'trad_fkdb_new_default', " +
10069
- "incremental_location=%s" , base , newInc )
10070
- sqlDB .Exec (t , irNew )
10071
- }
10072
-
10073
9961
// TestBackupRestoreSeparateExplicitIsDefault tests that a backup/restore round
10074
9962
// trip using the 'incremental_location' parameter restores the same db as a BR
10075
9963
// round trip without the parameter, even when that location is in fact the default.
0 commit comments