diff --git a/pkg/ccl/streamingccl/streamingest/replication_stream_e2e_test.go b/pkg/ccl/streamingccl/streamingest/replication_stream_e2e_test.go index 63c8b880d1a5..8fbd8272809a 100644 --- a/pkg/ccl/streamingccl/streamingest/replication_stream_e2e_test.go +++ b/pkg/ccl/streamingccl/streamingest/replication_stream_e2e_test.go @@ -909,7 +909,7 @@ func TestTenantStreamingShowTenant(t *testing.T) { require.Equal(t, "destination", rowStr[0][1]) if rowStr[0][3] == "NULL" { // There is no source yet, therefore the replication is not fully initialized. - require.Equal(t, "INITIALIZING REPLICATION", rowStr[0][2]) + require.Equal(t, "initializing replication", rowStr[0][2]) } jobutils.WaitForJobToRun(c.T, c.SrcSysSQL, jobspb.JobID(producerJobID)) @@ -937,8 +937,8 @@ func TestTenantStreamingShowTenant(t *testing.T) { row.Scan(&id, &dest, &status, &serviceMode, &source, &sourceUri, &jobId, &maxReplTime, &protectedTime, &cutoverTime) require.Equal(t, 2, id) require.Equal(t, "destination", dest) - require.Equal(t, "REPLICATING", status) - require.Equal(t, "NONE", serviceMode) + require.Equal(t, "replicating", status) + require.Equal(t, "none", serviceMode) require.Equal(t, "source", source) require.Equal(t, c.SrcURL.String(), sourceUri) require.Equal(t, ingestionJobID, jobId) diff --git a/pkg/ccl/streamingccl/streamingest/testdata/simple b/pkg/ccl/streamingccl/streamingest/testdata/simple index 0f0eed88197e..c119766f5284 100644 --- a/pkg/ccl/streamingccl/streamingest/testdata/simple +++ b/pkg/ccl/streamingccl/streamingest/testdata/simple @@ -28,14 +28,14 @@ IMPORT INTO d.x CSV DATA ('userfile:///dx/export*-n*.0.csv'); query-sql as=source-system SHOW TENANTS ---- -1 system READY EXTERNAL -10 source READY NONE +1 system ready external +10 source ready none query-sql as=destination-system SHOW TENANTS ---- -1 system READY EXTERNAL -2 destination REPLICATING NONE +1 system ready external +2 destination replicating none let $ts as=source-system SELECT clock_timestamp()::timestamp::string diff --git a/pkg/sql/logictest/testdata/logic_test/tenant b/pkg/sql/logictest/testdata/logic_test/tenant index 28a2095c2490..0a4e9f4a28f2 100644 --- a/pkg/sql/logictest/testdata/logic_test/tenant +++ b/pkg/sql/logictest/testdata/logic_test/tenant @@ -47,40 +47,40 @@ query ITTT colnames SHOW TENANT system ---- id name data_status service_mode -1 system READY EXTERNAL +1 system ready external query ITTT colnames SHOW TENANT "tenant-one" ---- id name data_status service_mode -2 tenant-one READY NONE +2 tenant-one ready none query ITTT colnames SHOW TENANT "two" ---- id name data_status service_mode -3 two READY NONE +3 two ready none query ITTT colnames SHOW TENANT two ---- id name data_status service_mode -3 two READY NONE +3 two ready none query ITTT colnames SHOW TENANT three ---- id name data_status service_mode -4 three READY NONE +4 three ready none query ITTT colnames SHOW TENANTS ---- id name data_status service_mode -1 system READY EXTERNAL -2 tenant-one READY NONE -3 two READY NONE -4 three READY NONE +1 system ready external +2 tenant-one ready none +3 two ready none +4 three ready none statement error tenant name cannot be empty ALTER TENANT [4] RENAME TO "" @@ -101,7 +101,7 @@ query ITTT colnames SELECT * FROM [SHOW TENANTS] WHERE id = 4 ---- id name data_status service_mode -4 blix READY NONE +4 blix ready none statement ok ALTER TENANT blix RENAME TO three @@ -110,7 +110,7 @@ query ITTT colnames SELECT * FROM [SHOW TENANTS] WHERE id = 4 ---- id name data_status service_mode -4 three READY NONE +4 three ready none statement error tenant "seven" does not exist SHOW TENANT seven @@ -251,11 +251,11 @@ query ITTT colnames SHOW TENANTS ---- id name data_status service_mode -1 system READY EXTERNAL -2 tenant-one READY NONE -3 two READY NONE -4 three READY NONE -8 to-be-reclaimed READY NONE -9 1 READY NONE -10 a-b READY NONE -11 hello-100 READY NONE +1 system ready external +2 tenant-one ready none +3 two ready none +4 three ready none +8 to-be-reclaimed ready none +9 1 ready none +10 a-b ready none +11 hello-100 ready none diff --git a/pkg/sql/show_tenant.go b/pkg/sql/show_tenant.go index 6df8d2a423ae..c36be19a172a 100644 --- a/pkg/sql/show_tenant.go +++ b/pkg/sql/show_tenant.go @@ -13,6 +13,7 @@ package sql import ( "context" "fmt" + "strings" "time" "github.com/cockroachdb/cockroach/pkg/jobs" @@ -31,12 +32,12 @@ import ( type tenantStatus string const ( - initReplication tenantStatus = "INITIALIZING REPLICATION" - replicating tenantStatus = "REPLICATING" - replicationPaused tenantStatus = "REPLICATION PAUSED" - cuttingOver tenantStatus = "REPLICATION CUTTING OVER" + initReplication tenantStatus = "initializing replication" + replicating tenantStatus = "replicating" + replicationPaused tenantStatus = "replication paused" + cuttingOver tenantStatus = "replication cutting over" // Users should not see this status normally. - replicationUnknownFormat tenantStatus = "REPLICATION UNKNOWN (%s)" + replicationUnknownFormat tenantStatus = "replication unknown (%s)" ) type tenantValues struct { @@ -176,7 +177,8 @@ func (n *showTenantNode) getTenantValues( if n.withReplication { return nil, errors.Newf("tenant %q does not have an active replication job", tenantInfo.Name) } - values.tenantStatus = tenantStatus(values.tenantInfo.DataState.String()) + dataState := strings.ToLower(values.tenantInfo.DataState.String()) + values.tenantStatus = tenantStatus(dataState) return &values, nil } @@ -206,9 +208,10 @@ func (n *showTenantNode) getTenantValues( values.tenantStatus = getTenantStatus(job.Status(), values.replicationInfo) case descpb.TenantInfo_READY, descpb.TenantInfo_DROP: - values.tenantStatus = tenantStatus(values.tenantInfo.DataState.String()) + dataState := strings.ToLower(values.tenantInfo.DataState.String()) + values.tenantStatus = tenantStatus(dataState) default: - return nil, errors.Newf("tenant %q state is unknown: %s", tenantInfo.Name, values.tenantInfo.DataState.String()) + return nil, errors.Newf("tenant %q state is unknown: %s", tenantInfo.Name, values.tenantInfo.DataState) } return &values, nil } @@ -239,7 +242,7 @@ func (n *showTenantNode) Values() tree.Datums { tree.NewDInt(tree.DInt(tenantInfo.ID)), tree.NewDString(string(tenantInfo.Name)), tree.NewDString(string(v.tenantStatus)), - tree.NewDString(tenantInfo.ServiceMode.String()), + tree.NewDString(strings.ToLower(tenantInfo.ServiceMode.String())), } if n.withReplication {