@@ -9965,108 +9965,6 @@ func TestUserfileNormalizationIncrementalShowBackup(t *testing.T) {
9965
9965
sqlDB .Exec (t , query )
9966
9966
}
9967
9967
9968
- // TestBackupRestoreSeparateExplicitIsDefault tests that a backup/restore round
9969
- // trip using the 'incremental_location' parameter restores the same db as a BR
9970
- // round trip without the parameter, even when that location is in fact the default.
9971
- func TestBackupRestoreSeparateExplicitIsDefault (t * testing.T ) {
9972
- defer leaktest .AfterTest (t )()
9973
- defer log .Scope (t ).Close (t )
9974
-
9975
- skip .UnderRace (t , "multinode cluster setup times out under race, likely due to resource starvation." )
9976
-
9977
- const numAccounts = 1
9978
- _ , sqlDB , _ , cleanupFn := backupRestoreTestSetup (t , multiNode , numAccounts , InitManualReplication )
9979
- defer cleanupFn ()
9980
-
9981
- const c1 , c2 , c3 = `nodelocal://1/full/` , `nodelocal://2/full/` , `nodelocal://3/full/`
9982
- const i1 , i2 , i3 = `nodelocal://1/full/incrementals` , `nodelocal://2/full/incrementals` , `nodelocal://3/full/incrementals`
9983
-
9984
- collections := []string {
9985
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , c1 , url .QueryEscape ("default" )),
9986
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , c2 , url .QueryEscape ("dc=dc1" )),
9987
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , c3 , url .QueryEscape ("dc=dc2" )),
9988
- }
9989
-
9990
- incrementals := []string {
9991
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , i1 , url .QueryEscape ("default" )),
9992
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , i2 , url .QueryEscape ("dc=dc1" )),
9993
- fmt .Sprintf ("'%s?COCKROACH_LOCALITY=%s'" , i3 , url .QueryEscape ("dc=dc2" )),
9994
- }
9995
- tests := []struct {
9996
- dest []string
9997
- inc []string
9998
- }{
9999
- {dest : []string {collections [0 ]}, inc : []string {incrementals [0 ]}},
10000
- {dest : collections , inc : incrementals },
10001
- }
10002
-
10003
- for _ , br := range tests {
10004
-
10005
- dest := strings .Join (br .dest , ", " )
10006
- inc := strings .Join (br .inc , ", " )
10007
-
10008
- if len (br .dest ) > 1 {
10009
- dest = "(" + dest + ")"
10010
- inc = "(" + inc + ")"
10011
- }
10012
- // create db
10013
- sqlDB .Exec (t , `CREATE DATABASE fkdb` )
10014
- sqlDB .Exec (t , `CREATE TABLE fkdb.fk (ind INT)` )
10015
-
10016
- for i := 0 ; i < 10 ; i ++ {
10017
- sqlDB .Exec (t , `INSERT INTO fkdb.fk (ind) VALUES ($1)` , i )
10018
- }
10019
- fb := fmt .Sprintf ("BACKUP DATABASE fkdb INTO %s" , dest )
10020
- sqlDB .Exec (t , fb )
10021
-
10022
- sqlDB .Exec (t , `INSERT INTO fkdb.fk (ind) VALUES ($1)` , 200 )
10023
-
10024
- sib := fmt .Sprintf ("BACKUP DATABASE fkdb INTO LATEST IN %s WITH incremental_location=%s" , dest , inc )
10025
- sqlDB .Exec (t , sib )
10026
- {
10027
- // Locality Aware Show Backup validation
10028
- // TODO (msbutler): move to data driven test after 22.1 backport
10029
-
10030
- // Assert the localities field populates correctly (not null if backup is locality aware).
10031
- localities := sqlDB .QueryStr (t ,
10032
- fmt .Sprintf ("SELECT locality FROM [SHOW BACKUP FILES FROM LATEST IN %s]" , dest ))
10033
- expectedLocalities := map [string ]bool {"default" : true , "dc=dc1" : true , "dc=dc2" : true }
10034
- for _ , locality := range localities {
10035
- if len (br .dest ) > 1 {
10036
- _ , ok := expectedLocalities [locality [0 ]]
10037
- require .Equal (t , true , ok )
10038
- } else {
10039
- require .Equal (t , "NULL" , locality [0 ])
10040
- }
10041
- }
10042
- // Assert show backup still works.
10043
- sqlDB .Exec (t , fmt .Sprintf ("SHOW BACKUPS IN %s" , dest ))
10044
- sqlDB .Exec (t , fmt .Sprintf ("SHOW BACKUP FROM LATEST IN %s" , dest ))
10045
-
10046
- // Locality aware show backups will eventually fail if not all localities are provided,
10047
- // but for now, they're ok.
10048
- if len (br .dest ) > 1 {
10049
- sqlDB .Exec (t , fmt .Sprintf ("SHOW BACKUP FROM LATEST IN %s" , br .dest [1 ]))
10050
- }
10051
-
10052
- sqlDB .Exec (t , fmt .Sprintf ("SHOW BACKUP FROM LATEST IN %s WITH incremental_location= %s" , dest , inc ))
10053
- }
10054
- sir := fmt .Sprintf ("RESTORE DATABASE fkdb FROM LATEST IN %s WITH new_db_name = 'inc_fkdb', incremental_location=%s" , dest , inc )
10055
- sqlDB .Exec (t , sir )
10056
-
10057
- ib := fmt .Sprintf ("BACKUP DATABASE fkdb INTO LATEST IN %s" , dest )
10058
- sqlDB .Exec (t , ib )
10059
- ir := fmt .Sprintf ("RESTORE DATABASE fkdb FROM LATEST IN %s WITH new_db_name = 'trad_fkdb'" , dest )
10060
- sqlDB .Exec (t , ir )
10061
-
10062
- sqlDB .CheckQueryResults (t , `SELECT * FROM trad_fkdb.fk` , sqlDB .QueryStr (t , `SELECT * FROM inc_fkdb.fk` ))
10063
-
10064
- sqlDB .Exec (t , "DROP DATABASE fkdb" )
10065
- sqlDB .Exec (t , "DROP DATABASE trad_fkdb;" )
10066
- sqlDB .Exec (t , "DROP DATABASE inc_fkdb;" )
10067
- }
10068
- }
10069
-
10070
9968
// TestRestoreOnFailOrCancelAfterPause is a regression test that ensures that we
10071
9969
// can cancel a paused restore job. Previously, this test would result in a nil
10072
9970
// pointer exception when accessing the `r.execCfg` since the resumer was not
0 commit comments