Skip to content

Commit 5aeb08d

Browse files
craig[bot]kev-caodhartunianfqazi
committed
151871: backup: teach ResolveBackupManifests to use the backup index r=msbutler a=kev-cao This commit teaches `ResolveBackupManifests` to use the backup index, which prevents unnecessarily reads of backup manifests that are elided during restore. Since backups that are not indexed are still considered restorable in this version, the legacy path of loading all manifests is still preserved and can be removed in 26.2. Epic: CRDB-47942 Fixes: #150330, #150331, #150332 Release note: None 152861: sql: add transaction diagnostic bundle tables r=dhartunian a=dhartunian This commit contains a schema change and an upgrade migration to begin adding support for transaction diagnostic bundles. The new functionality will maintain diagnostic bundle requests and record completed diagnostics very similar to statement diagnostics. We have a `transaction_diagnostic_requests` table which holds pending requests and marks them as completed. Future PRs will poll this table to update the in-memory registry of pending requests to match against incoming SQL. We also have a `transaction_diagnostics` table which holds rows for completed diagnostics requests. Notable details: - Transaction diagnostic requests store a string array of all the fingerprints in the transaction to match incoming statements. - Completed transaction diagnostics store pointers to the statement diagnostic bundles within, and chunks that contain the trace for the entire transaction. - Statement diagnostic bundles will now potentially point to a "parent" transaction diagnostic bundle Resolves: CRDB-53545 Epic: CRDB-53541 Release note: None 152932: sql: enforce schema_locked for TRUNCATE r=fqazi a=fqazi Previously, we were completely ignoring schema_locked for the TRUNCATE command, which could changefeeds to break. To address this, this patch blocks TRUNCATE on schema_locked tables. Fixes: #151941 Release note (bug fix): schema_locked was not enforced on the TRUNCATE command, which could cause changefeed jobs to fail. 153189: roachtest: deflake online restore recovery roachtest r=msbutler a=kev-cao The online restore recovery roachtest would very occasionally flake due to it detecting the download job having succeeded. It turns out that the download job was not succeeding, but to find the job, we match on the description containing "Background Data Download", which the GC job that runs to cleanup after download contains. So if the download job failed fast enough, the query to find the download job would match on the GC job instead. This patch updates the query to only look for restore jobs instead. Fixes: #151973 Release note: None Co-authored-by: Kevin Cao <[email protected]> Co-authored-by: David Hartunian <[email protected]> Co-authored-by: Faizan Qazi <[email protected]> Co-authored-by: Kevin Cao <[email protected]>
5 parents 45c224a + 6389dc3 + ce8e441 + 2b3a170 + 36442e9 commit 5aeb08d

File tree

166 files changed

+2539
-613
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+2539
-613
lines changed

docs/generated/settings/settings-for-tenants.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,4 +421,4 @@ trace.zipkin.collector string the address of a Zipkin instance to receive trace
421421
ui.database_locality_metadata.enabled boolean true if enabled shows extended locality data about databases and tables in DB Console which can be expensive to compute application
422422
ui.default_timezone string the default timezone used to format timestamps in the ui application
423423
ui.display_timezone enumeration etc/utc the timezone used to format timestamps in the ui. This setting is deprecatedand will be removed in a future version. Use the 'ui.default_timezone' setting instead. 'ui.default_timezone' takes precedence over this setting. [etc/utc = 0, america/new_york = 1] application
424-
version version 1000025.3-upgrading-to-1000025.4-step-008 set the active cluster version in the format '<major>.<minor>' application
424+
version version 1000025.3-upgrading-to-1000025.4-step-010 set the active cluster version in the format '<major>.<minor>' application

docs/generated/settings/settings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,6 @@
379379
<tr><td><div id="setting-ui-database-locality-metadata-enabled" class="anchored"><code>ui.database_locality_metadata.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if enabled shows extended locality data about databases and tables in DB Console which can be expensive to compute</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
380380
<tr><td><div id="setting-ui-default-timezone" class="anchored"><code>ui.default_timezone</code></div></td><td>string</td><td><code></code></td><td>the default timezone used to format timestamps in the ui</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
381381
<tr><td><div id="setting-ui-display-timezone" class="anchored"><code>ui.display_timezone</code></div></td><td>enumeration</td><td><code>etc/utc</code></td><td>the timezone used to format timestamps in the ui. This setting is deprecatedand will be removed in a future version. Use the &#39;ui.default_timezone&#39; setting instead. &#39;ui.default_timezone&#39; takes precedence over this setting. [etc/utc = 0, america/new_york = 1]</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
382-
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000025.3-upgrading-to-1000025.4-step-008</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
382+
<tr><td><div id="setting-version" class="anchored"><code>version</code></div></td><td>version</td><td><code>1000025.3-upgrading-to-1000025.4-step-010</code></td><td>set the active cluster version in the format &#39;&lt;major&gt;.&lt;minor&gt;&#39;</td><td>Basic/Standard/Advanced/Self-Hosted</td></tr>
383383
</tbody>
384384
</table>

pkg/backup/backup_job.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ func backup(
458458
execCtx.User(),
459459
execCtx.ExecCfg().DistSQLSrv.ExternalStorageFromURI,
460460
details,
461+
backupManifest.RevisionStartTime,
461462
); err != nil {
462463
return roachpb.RowCount{}, 0, errors.Wrapf(err, "writing backup index metadata")
463464
}

pkg/backup/backup_test.go

Lines changed: 47 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3607,17 +3607,21 @@ func TestRestoreAsOfSystemTime(t *testing.T) {
36073607
sqlDB.Exec(t, `ALTER TABLE data.bank ADD COLUMN points_balance INT DEFAULT 50`)
36083608
sqlDB.QueryRow(t, `SELECT cluster_logical_timestamp()`).Scan(&ts[5])
36093609

3610+
sqlDB.Exec(t, "ALTER TABLE data.bank SET (schema_locked=false)")
36103611
sqlDB.Exec(t, `TRUNCATE TABLE data.bank`)
36113612
sqlDB.Exec(t, `TRUNCATE TABLE data.bank`)
36123613
sqlDB.Exec(t, `TRUNCATE TABLE data.bank`)
3614+
sqlDB.Exec(t, "ALTER TABLE data.bank SET (schema_locked=true)")
36133615
sqlDB.Exec(t, `CREATE TABLE other.sometable AS SELECT * FROM data.sometable`)
36143616
sqlDB.Exec(t, `DROP TABLE data.sometable`)
36153617
sqlDB.Exec(t, `CREATE INDEX ON data.teller (name)`)
36163618
sqlDB.Exec(t, `INSERT INTO data.bank VALUES (2, 2), (4, 4)`)
36173619
sqlDB.Exec(t, `INSERT INTO data.teller VALUES (2, 'craig')`)
36183620
sqlDB.QueryRow(t, `SELECT cluster_logical_timestamp()`).Scan(&ts[6])
36193621

3622+
sqlDB.Exec(t, "ALTER TABLE data.bank SET (schema_locked=false)")
36203623
sqlDB.Exec(t, `TRUNCATE TABLE data.bank`)
3624+
sqlDB.Exec(t, "ALTER TABLE data.bank SET (schema_locked=true)")
36213625
sqlDB.Exec(t, `INSERT INTO data.bank VALUES (2, 2), (4, 4)`)
36223626
sqlDB.Exec(t, `DROP TABLE other.sometable`)
36233627
sqlDB.QueryRow(t, `SELECT cluster_logical_timestamp()`).Scan(&ts[7])
@@ -4057,6 +4061,10 @@ func TestNonLinearChain(t *testing.T) {
40574061

40584062
sqlDB := sqlutils.MakeSQLRunner(tc.Conns[0])
40594063

4064+
// This ensures a determenistic behavior to the relative number of files we
4065+
// open during a restore when skipping a backup.
4066+
sqlDB.Exec(t, `SET CLUSTER SETTING backup.index.read.enabled = true`)
4067+
40604068
// Make a table with a row in it and make a full backup of it.
40614069
sqlDB.Exec(t, `CREATE TABLE t (a INT PRIMARY KEY)`)
40624070
sqlDB.Exec(t, `INSERT INTO t VALUES (0)`)
@@ -4110,15 +4118,14 @@ func TestNonLinearChain(t *testing.T) {
41104118

41114119
// Restore the same thing -- t2 -- we did before but now with the extra inc
41124120
// spur hanging out in the chain. This should produce the same result, and we
4113-
// would like it to only open two extra file2 to do so -- the manifest that
4114-
// includes the timestamps that then show it is not needed by the restore, and
4115-
// the checksum for said manifest.
4121+
// would like it to only open one extra file to do so, just the index of the
4122+
// incremental to show that it is not needed by the restore.
41164123
sqlDB.Exec(t, `DROP TABLE t`)
41174124
openedBefore = tc.Servers[0].MustGetSQLCounter("cloud.readers_opened")
41184125
sqlDB.Exec(t, `RESTORE TABLE defaultdb.t FROM LATEST IN $1`, localFoo)
41194126
sqlDB.CheckQueryResults(t, `SELECT * FROM t`, [][]string{{"0"}, {"1"}, {"2"}})
41204127
openedB := tc.Servers[0].MustGetSQLCounter("cloud.readers_opened") - openedBefore
4121-
require.Equal(t, openedA+2, openedB)
4128+
require.Equal(t, openedA+1, openedB)
41224129

41234130
// Finally, make sure we can restore from the tip of the spur, not just the
41244131
// tip of the chain.
@@ -5041,7 +5048,9 @@ func TestBackupRestoreIncrementalTruncateTable(t *testing.T) {
50415048
sqlDB.Exec(t, `INSERT INTO data.t VALUES ('before')`)
50425049
sqlDB.Exec(t, `BACKUP DATABASE data INTO $1`, full)
50435050
sqlDB.Exec(t, `UPDATE data.t SET s = 'after'`)
5051+
sqlDB.Exec(t, "ALTER TABLE data.t SET (schema_locked=false)")
50445052
sqlDB.Exec(t, `TRUNCATE data.t`)
5053+
sqlDB.Exec(t, "ALTER TABLE data.t SET (schema_locked=true)")
50455054

50465055
sqlDB.Exec(t, "BACKUP DATABASE data INTO $1", full)
50475056
}
@@ -6676,6 +6685,9 @@ INSERT INTO baz.bar VALUES (110, 'a'), (210, 'b'), (310, 'c'), (410, 'd'), (510,
66766685
func TestBackupRestoreInsideTenant(t *testing.T) {
66776686
defer leaktest.AfterTest(t)()
66786687
defer log.Scope(t).Close(t)
6688+
6689+
skip.UnderRace(t, "runs slow under race, ~10+ mins")
6690+
66796691
const numAccounts = 1
66806692

66816693
makeTenant := func(srv serverutils.TestServerInterface, tenant uint64) (*sqlutils.SQLRunner, func()) {
@@ -6718,61 +6730,56 @@ func TestBackupRestoreInsideTenant(t *testing.T) {
67186730
defer cleanupT11C2()
67196731

67206732
t.Run("tenant-backup", func(t *testing.T) {
6721-
// This test uses this mock HTTP server to pass the backup files between tenants.
6722-
httpAddr, httpServerCleanup := makeInsecureHTTPServer(t)
6723-
defer httpServerCleanup()
6733+
const collectionURI = "nodelocal://1/tenant-backup"
67246734

6725-
tenant10.Exec(t, `BACKUP INTO $1`, httpAddr)
6735+
tenant10.Exec(t, `BACKUP INTO $1`, collectionURI)
67266736

67276737
t.Run("cluster-restore", func(t *testing.T) {
67286738
t.Run("into-same-tenant-id", func(t *testing.T) {
6729-
tenant10C2.Exec(t, `RESTORE FROM LATEST IN $1`, httpAddr)
6739+
tenant10C2.Exec(t, `RESTORE FROM LATEST IN $1`, collectionURI)
67306740
tenant10C2.CheckQueryResults(t, `SELECT * FROM foo.bar`, tenant10.QueryStr(t, `SELECT * FROM foo.bar`))
67316741
})
67326742
t.Run("into-different-tenant-id", func(t *testing.T) {
6733-
tenant11C2.Exec(t, `RESTORE FROM LATEST IN $1`, httpAddr)
6743+
tenant11C2.Exec(t, `RESTORE FROM LATEST IN $1`, collectionURI)
67346744
tenant11C2.CheckQueryResults(t, `SELECT * FROM foo.bar`, tenant10.QueryStr(t, `SELECT * FROM foo.bar`))
67356745
})
67366746
t.Run("into-system-tenant-id", func(t *testing.T) {
6737-
systemDB2.Exec(t, `RESTORE FROM LATEST IN $1`, httpAddr)
6747+
systemDB2.Exec(t, `RESTORE FROM LATEST IN $1`, collectionURI)
67386748
systemDB2.CheckQueryResults(t, `SELECT * FROM foo.bar`, tenant10.QueryStr(t, `SELECT * FROM foo.bar`))
67396749
})
67406750
})
67416751

67426752
t.Run("database-restore", func(t *testing.T) {
67436753
t.Run("into-same-tenant-id", func(t *testing.T) {
67446754
tenant10.Exec(t, `CREATE DATABASE foo2`)
6745-
tenant10.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, httpAddr)
6755+
tenant10.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, collectionURI)
67466756
tenant10.CheckQueryResults(t, `SELECT * FROM foo2.bar`, tenant10.QueryStr(t, `SELECT * FROM foo.bar`))
67476757
})
67486758
t.Run("into-different-tenant-id", func(t *testing.T) {
67496759
tenant11.Exec(t, `CREATE DATABASE foo`)
6750-
tenant11.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1`, httpAddr)
6760+
tenant11.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1`, collectionURI)
67516761
tenant11.CheckQueryResults(t, `SELECT * FROM foo.bar`, tenant10.QueryStr(t, `SELECT * FROM foo.bar`))
67526762
})
67536763
t.Run("into-system-tenant-id", func(t *testing.T) {
67546764
systemDB.Exec(t, `CREATE DATABASE foo2`)
6755-
systemDB.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, httpAddr)
6765+
systemDB.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, collectionURI)
67566766
systemDB.CheckQueryResults(t, `SELECT * FROM foo2.bar`, tenant10.QueryStr(t, `SELECT * FROM foo.bar`))
67576767
})
67586768
})
67596769
})
67606770

67616771
t.Run("system-backup", func(t *testing.T) {
6762-
// This test uses this mock HTTP server to pass the backup files between tenants.
6763-
httpAddr, httpServerCleanup := makeInsecureHTTPServer(t)
6764-
defer httpServerCleanup()
6772+
const collectionURI = "nodelocal://1/system-backup"
67656773

6766-
systemDB.Exec(t, `BACKUP INTO $1 WITH include_all_virtual_clusters`, httpAddr)
6774+
systemDB.Exec(t, `BACKUP INTO $1 WITH include_all_virtual_clusters`, collectionURI)
67676775

67686776
tenant20C2, cleanupT20C2 := makeTenant(srv2, 20)
67696777
defer cleanupT20C2()
67706778

67716779
t.Run("cluster-restore", func(t *testing.T) {
67726780
// Now restore a cluster backup taken from a system tenant that
67736781
// hasn't created any tenants.
6774-
httpAddrEmpty, cleanupEmptyHTTPServer := makeInsecureHTTPServer(t)
6775-
defer cleanupEmptyHTTPServer()
6782+
const emptyCollectionURI = "nodelocal://1/empty-system-backup"
67766783

67776784
_, emptySystemDB, cleanupEmptyCluster := backupRestoreTestSetupEmpty(t, singleNode,
67786785
dir, InitManualReplication, base.TestClusterArgs{
@@ -6782,13 +6789,13 @@ func TestBackupRestoreInsideTenant(t *testing.T) {
67826789
})
67836790
defer cleanupEmptyCluster()
67846791

6785-
emptySystemDB.Exec(t, `BACKUP INTO $1`, httpAddrEmpty)
6786-
tenant20C2.Exec(t, `RESTORE FROM LATEST IN $1`, httpAddrEmpty)
6792+
emptySystemDB.Exec(t, `BACKUP INTO $1`, emptyCollectionURI)
6793+
tenant20C2.Exec(t, `RESTORE FROM LATEST IN $1`, emptyCollectionURI)
67876794
})
67886795

67896796
t.Run("database-restore-into-tenant", func(t *testing.T) {
67906797
tenant10.Exec(t, `CREATE DATABASE data`)
6791-
tenant10.Exec(t, `RESTORE TABLE data.bank FROM LATEST IN $1`, httpAddr)
6798+
tenant10.Exec(t, `RESTORE TABLE data.bank FROM LATEST IN $1`, collectionURI)
67926799
systemDB.CheckQueryResults(t, `SELECT * FROM data.bank`, tenant10.QueryStr(t, `SELECT * FROM data.bank`))
67936800
})
67946801

@@ -6814,9 +6821,8 @@ func TestBackupRestoreTenantSettings(t *testing.T) {
68146821
_ = securitytest.EmbeddedTenantIDs()
68156822

68166823
systemDB.Exec(t, `ALTER TENANT ALL SET CLUSTER SETTING sql.notices.enabled = false`)
6817-
backup2HttpAddr, backup2Cleanup := makeInsecureHTTPServer(t)
6818-
defer backup2Cleanup()
6819-
systemDB.Exec(t, `BACKUP INTO $1`, backup2HttpAddr)
6824+
const collectionURI = "nodelocal://1/backup"
6825+
systemDB.Exec(t, `BACKUP INTO $1`, collectionURI)
68206826

68216827
_, systemDB2, cleanupDB2 := backupRestoreTestSetupEmpty(t, singleNode, dir, InitManualReplication, base.TestClusterArgs{
68226828
ServerArgs: base.TestServerArgs{
@@ -6825,7 +6831,7 @@ func TestBackupRestoreTenantSettings(t *testing.T) {
68256831
})
68266832
defer cleanupDB2()
68276833
t.Run("cluster-restore-into-cluster-with-tenant-settings-succeeds", func(t *testing.T) {
6828-
systemDB2.Exec(t, `RESTORE FROM LATEST IN $1`, backup2HttpAddr)
6834+
systemDB2.Exec(t, `RESTORE FROM LATEST IN $1`, collectionURI)
68296835
systemDB2.CheckQueryResults(t, `SELECT * FROM system.tenant_settings`, systemDB.QueryStr(t, `SELECT * FROM system.tenant_settings`))
68306836
})
68316837
}
@@ -6892,60 +6898,55 @@ func TestBackupRestoreInsideMultiPodTenant(t *testing.T) {
68926898
tenant10[0].Exec(t, `CREATE DATABASE foo; CREATE TABLE foo.bar(i int primary key); INSERT INTO foo.bar VALUES (110), (210), (310)`)
68936899

68946900
t.Run("tenant-backup", func(t *testing.T) {
6895-
// This test uses this mock HTTP server to pass the backup files between tenants.
6896-
httpAddr, httpServerCleanup := makeInsecureHTTPServer(t)
6897-
defer httpServerCleanup()
6901+
const collectionURI = "nodelocal://1/tenant-backup"
68986902

6899-
tenant10[0].Exec(t, `BACKUP INTO $1`, httpAddr)
6903+
tenant10[0].Exec(t, `BACKUP INTO $1`, collectionURI)
69006904

69016905
t.Run("cluster-restore", func(t *testing.T) {
69026906
t.Run("into-same-tenant-id", func(t *testing.T) {
6903-
tenant10C2[0].Exec(t, `RESTORE FROM LATEST IN $1`, httpAddr)
6907+
tenant10C2[0].Exec(t, `RESTORE FROM LATEST IN $1`, collectionURI)
69046908
tenant10C2[0].CheckQueryResults(t, `SELECT * FROM foo.bar`, tenant10[0].QueryStr(t, `SELECT * FROM foo.bar`))
69056909
})
69066910
t.Run("into-different-tenant-id", func(t *testing.T) {
6907-
tenant11C2.Exec(t, `RESTORE FROM LATEST IN $1`, httpAddr)
6911+
tenant11C2.Exec(t, `RESTORE FROM LATEST IN $1`, collectionURI)
69086912
tenant11C2.CheckQueryResults(t, `SELECT * FROM foo.bar`, tenant10[0].QueryStr(t, `SELECT * FROM foo.bar`))
69096913
})
69106914
t.Run("into-system-tenant-id", func(t *testing.T) {
6911-
systemDB2.Exec(t, `RESTORE FROM LATEST IN $1`, httpAddr)
6915+
systemDB2.Exec(t, `RESTORE FROM LATEST IN $1`, collectionURI)
69126916
})
69136917
})
69146918

69156919
t.Run("database-restore", func(t *testing.T) {
69166920
t.Run("into-same-tenant-id", func(t *testing.T) {
69176921
tenant10[0].Exec(t, `CREATE DATABASE foo2`)
6918-
tenant10[0].Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, httpAddr)
6922+
tenant10[0].Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, collectionURI)
69196923
tenant10[0].CheckQueryResults(t, `SELECT * FROM foo2.bar`, tenant10[0].QueryStr(t, `SELECT * FROM foo.bar`))
69206924
})
69216925
t.Run("into-different-tenant-id", func(t *testing.T) {
69226926
tenant11[0].Exec(t, `CREATE DATABASE foo`)
6923-
tenant11[0].Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1`, httpAddr)
6927+
tenant11[0].Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1`, collectionURI)
69246928
tenant11[0].CheckQueryResults(t, `SELECT * FROM foo.bar`, tenant10[0].QueryStr(t, `SELECT * FROM foo.bar`))
69256929
})
69266930
t.Run("into-system-tenant-id", func(t *testing.T) {
69276931
systemDB.Exec(t, `CREATE DATABASE foo2`)
6928-
systemDB.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, httpAddr)
6932+
systemDB.Exec(t, `RESTORE TABLE foo.bar FROM LATEST IN $1 WITH into_db='foo2'`, collectionURI)
69296933
systemDB.CheckQueryResults(t, `SELECT * FROM foo2.bar`, tenant10[0].QueryStr(t, `SELECT * FROM foo.bar`))
69306934
})
69316935
})
69326936
})
69336937

69346938
t.Run("system-backup", func(t *testing.T) {
6935-
// This test uses this mock HTTP server to pass the backup files between tenants.
6936-
httpAddr, httpServerCleanup := makeInsecureHTTPServer(t)
6937-
defer httpServerCleanup()
6939+
const collectionURI = "nodelocal://1/system-backup"
69386940

6939-
systemDB.Exec(t, `BACKUP INTO $1 WITH include_all_virtual_clusters`, httpAddr)
6941+
systemDB.Exec(t, `BACKUP INTO $1 WITH include_all_virtual_clusters`, collectionURI)
69406942

69416943
tenant20C2, cleanupT20C2 := makeTenant(srv2, 20, false)
69426944
defer cleanupT20C2()
69436945

69446946
t.Run("cluster-restore", func(t *testing.T) {
69456947
// Now restore a cluster backup taken from a system tenant that
69466948
// hasn't created any tenants.
6947-
httpAddrEmpty, cleanupEmptyHTTPServer := makeInsecureHTTPServer(t)
6948-
defer cleanupEmptyHTTPServer()
6949+
const emptyCollectionURI = "nodelocal://1/empty-system-backup"
69496950

69506951
_, emptySystemDB, cleanupEmptyCluster := backupRestoreTestSetupEmpty(t, singleNode,
69516952
dir, InitManualReplication, base.TestClusterArgs{
@@ -6955,13 +6956,13 @@ func TestBackupRestoreInsideMultiPodTenant(t *testing.T) {
69556956
})
69566957
defer cleanupEmptyCluster()
69576958

6958-
emptySystemDB.Exec(t, `BACKUP INTO $1`, httpAddrEmpty)
6959-
tenant20C2.Exec(t, `RESTORE FROM LATEST IN $1`, httpAddrEmpty)
6959+
emptySystemDB.Exec(t, `BACKUP INTO $1`, emptyCollectionURI)
6960+
tenant20C2.Exec(t, `RESTORE FROM LATEST IN $1`, emptyCollectionURI)
69606961
})
69616962

69626963
t.Run("database-restore-into-tenant", func(t *testing.T) {
69636964
tenant10[0].Exec(t, `CREATE DATABASE data`)
6964-
tenant10[0].Exec(t, `RESTORE TABLE data.bank FROM LATEST IN $1`, httpAddr)
6965+
tenant10[0].Exec(t, `RESTORE TABLE data.bank FROM LATEST IN $1`, collectionURI)
69656966
systemDB.CheckQueryResults(t, `SELECT * FROM data.bank`, tenant10[0].QueryStr(t, `SELECT * FROM data.bank`))
69666967
})
69676968
})

pkg/backup/backupdest/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ go_library(
3131
"//pkg/util/encoding",
3232
"//pkg/util/hlc",
3333
"//pkg/util/ioctx",
34+
"//pkg/util/log",
3435
"//pkg/util/metamorphic",
3536
"//pkg/util/mon",
3637
"//pkg/util/protoutil",
3738
"//pkg/util/timeutil",
3839
"//pkg/util/tracing",
3940
"@com_github_cockroachdb_errors//:errors",
41+
"@org_golang_x_sync//errgroup",
4042
],
4143
)
4244

@@ -73,6 +75,7 @@ go_test(
7375
"//pkg/settings/cluster",
7476
"//pkg/sql",
7577
"//pkg/testutils",
78+
"//pkg/testutils/jobutils",
7679
"//pkg/testutils/serverutils",
7780
"//pkg/testutils/testcluster",
7881
"//pkg/util",

0 commit comments

Comments
 (0)