@@ -9,19 +9,16 @@ import (
99 "context"
1010 "fmt"
1111 "testing"
12- "time"
1312
1413 "github.com/cockroachdb/cockroach/pkg/base"
1514 "github.com/cockroachdb/cockroach/pkg/ccl/multiregionccl/multiregionccltestutils"
1615 _ "github.com/cockroachdb/cockroach/pkg/cloud/impl" // register cloud storage providers
1716 "github.com/cockroachdb/cockroach/pkg/jobs"
1817 "github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
19- "github.com/cockroachdb/cockroach/pkg/multitenant/tenantcapabilitiespb"
2018 "github.com/cockroachdb/cockroach/pkg/roachpb"
2119 "github.com/cockroachdb/cockroach/pkg/sql"
2220 _ "github.com/cockroachdb/cockroach/pkg/sql/importer"
2321 "github.com/cockroachdb/cockroach/pkg/sql/sqlclustersettings"
24- "github.com/cockroachdb/cockroach/pkg/sql/sqlliveness/slbase"
2522 "github.com/cockroachdb/cockroach/pkg/testutils"
2623 "github.com/cockroachdb/cockroach/pkg/testutils/jobutils"
2724 "github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
@@ -30,78 +27,10 @@ import (
3027 "github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
3128 "github.com/cockroachdb/cockroach/pkg/util/leaktest"
3229 "github.com/cockroachdb/cockroach/pkg/util/log"
33- "github.com/cockroachdb/cockroach/pkg/util/timeutil"
3430 "github.com/cockroachdb/errors"
3531 "github.com/stretchr/testify/require"
3632)
3733
38- func TestBackupSharedProcessTenantNodeDown (t * testing.T ) {
39- defer leaktest .AfterTest (t )()
40- defer log .Scope (t ).Close (t )
41-
42- ctx := context .Background ()
43-
44- skip .UnderRace (t , "multi-node, multi-tenant test too slow under race" )
45- skip .UnderDeadlock (t , "too slow under deadlock detector" )
46- params := base.TestClusterArgs {
47- ServerArgs : base.TestServerArgs {
48- DefaultTestTenant : base .TestControlsTenantsExplicitly ,
49- },
50- }
51- params .ServerArgs .Knobs .JobsTestingKnobs = jobs .NewTestingKnobsWithShortIntervals ()
52- tc , hostDB , _ , cleanup := backupRestoreTestSetupWithParams (t , multiNode , 0 , /* numAccounts */
53- InitManualReplication , params )
54- defer cleanup ()
55-
56- hostDB .Exec (t , "ALTER TENANT ALL SET CLUSTER SETTING server.sqlliveness.ttl='2s'" )
57- hostDB .Exec (t , "ALTER TENANT ALL SET CLUSTER SETTING server.sqlliveness.heartbeat='250ms'" )
58-
59- testTenantID := roachpb .MustMakeTenantID (11 )
60- tenantApp , tenantDB , err := tc .Server (0 ).TenantController ().StartSharedProcessTenant (ctx ,
61- base.TestSharedProcessTenantArgs {
62- TenantID : testTenantID ,
63- TenantName : "test" ,
64- })
65- require .NoError (t , err )
66-
67- tc .GrantTenantCapabilities (
68- ctx , t , testTenantID ,
69- map [tenantcapabilitiespb.ID ]string {tenantcapabilitiespb .CanUseNodelocalStorage : "true" })
70-
71- tenantSQL := sqlutils .MakeSQLRunner (tenantDB )
72- tenantSQL .Exec (t , "CREATE TABLE foo AS SELECT generate_series(1, 4000)" )
73- tenantSQL .Exec (t , "ALTER TABLE foo SPLIT AT VALUES (500), (1000), (1500), (2000), (2500), (3000)" )
74- tenantSQL .Exec (t , "ALTER TABLE foo SCATTER" )
75-
76- t .Log ("waiting for SQL instances" )
77- waitStart := timeutil .Now ()
78- for i := 1 ; i < multiNode ; i ++ {
79- testutils .SucceedsSoon (t , func () error {
80- t .Logf ("waiting for server %d" , i )
81- db , err := tc .Server (i ).SystemLayer ().SQLConnE (serverutils .DBName ("cluster:test/defaultdb" ))
82- if err != nil {
83- return err
84- }
85- return db .Ping ()
86- })
87- }
88- t .Logf ("all SQL instances (took %s)" , timeutil .Since (waitStart ))
89-
90- // Shut down a node.
91- t .Log ("shutting down server 2 (n3)" )
92- tc .StopServer (2 )
93-
94- // We use succeeds soon here since it still takes some time
95- // for instance-based planning to recognize the downed node.
96- sv := & tenantApp .ClusterSettings ().SV
97- padding := 10 * time .Second
98- timeout := slbase .DefaultTTL .Get (sv ) + slbase .DefaultHeartBeat .Get (sv ) + padding
99- testutils .SucceedsWithin (t , func () error {
100- _ , err := tenantDB .Exec ("BACKUP INTO 'nodelocal://1/worker-failure'" )
101- return err
102- }, timeout )
103- }
104-
10534func TestBackupTenantImportingTable (t * testing.T ) {
10635 defer leaktest .AfterTest (t )()
10736 defer log .Scope (t ).Close (t )
0 commit comments