diff --git a/pkg/ccl/changefeedccl/changefeed_test.go b/pkg/ccl/changefeedccl/changefeed_test.go index 21478d7b3d6f..587f0b6b443d 100644 --- a/pkg/ccl/changefeedccl/changefeed_test.go +++ b/pkg/ccl/changefeedccl/changefeed_test.go @@ -5972,7 +5972,7 @@ func TestChangefeedHandlesDrainingNodes(t *testing.T) { sqlDB.Exec(t, "ALTER TABLE test.foo SCATTER") // Create a factory which executes the CREATE CHANGEFEED statement on server 0. - // This statement should fail, but the job itself ought to be creaated. + // This statement should fail, but the job itself ought to be created. // After some time, that job should be adopted by another node, and executed successfully. f, closeSink := makeFeedFactory(t, randomSinkType(feedTestEnterpriseSinks), tc.Server(1), tc.ServerConn(0)) defer closeSink() @@ -5981,22 +5981,21 @@ func TestChangefeedHandlesDrainingNodes(t *testing.T) { feed := feed(t, f, "CREATE CHANGEFEED FOR foo") defer closeFeed(t, feed) - // At this point, the job created by feed will fail to start running on node 0 due to draining - // registry. However, this job will be retried, and it should succeed. - // Note: This test is a bit unrealistic in that if the registry is draining, that - // means that the server is draining (i.e. being shut down). We don't do a full shutdown - // here, but we are simulating a restart by failing to start a flow the first time around. - assertPayloads(t, feed, []string{ - `foo: [1]->{"after": {"k": 1, "v": 1}}`, - `foo: [2]->{"after": {"k": 2, "v": 0}}`, - `foo: [3]->{"after": {"k": 3, "v": 1}}`, - `foo: [4]->{"after": {"k": 4, "v": 0}}`, - `foo: [5]->{"after": {"k": 5, "v": 1}}`, - `foo: [6]->{"after": {"k": 6, "v": 0}}`, - `foo: [7]->{"after": {"k": 7, "v": 1}}`, - `foo: [8]->{"after": {"k": 8, "v": 0}}`, - `foo: [9]->{"after": {"k": 9, "v": 1}}`, - `foo: [10]->{"after": {"k": 10, "v": 0}}`, + jobID := feed.(cdctest.EnterpriseTestFeed).JobID() + registry := tc.Server(1).JobRegistry().(*jobs.Registry) + loadProgress := func() jobspb.Progress { + job, err := registry.LoadJob(context.Background(), jobID) + require.NoError(t, err) + return job.Progress() + } + + // Wait until highwater advances. + testutils.SucceedsSoon(t, func() error { + progress := loadProgress() + if hw := progress.GetHighWater(); hw == nil || hw.IsEmpty() { + return errors.New("waiting for highwater") + } + return nil }) } diff --git a/pkg/cmd/roachtest/tests/tpcc.go b/pkg/cmd/roachtest/tests/tpcc.go index 6918b69d8ee5..39b1ed6fafb7 100644 --- a/pkg/cmd/roachtest/tests/tpcc.go +++ b/pkg/cmd/roachtest/tests/tpcc.go @@ -979,8 +979,6 @@ type tpccBenchSpec struct { // change (i.e. CockroachDB gets faster!). EstimatedMax int - // MinVersion to pass to testRegistryImpl.Add. - MinVersion string // Tags to pass to testRegistryImpl.Add. Tags map[string]struct{} // EncryptionEnabled determines if the benchmark uses encrypted stores (i.e. @@ -1068,16 +1066,11 @@ func registerTPCCBenchSpec(r registry.Registry, b tpccBenchSpec) { numNodes := b.Nodes + b.LoadConfig.numLoadNodes(b.Distribution) nodes := r.MakeClusterSpec(numNodes, opts...) - minVersion := b.MinVersion - if minVersion == "" { - minVersion = "v19.1.0" // needed for import - } - r.Add(registry.TestSpec{ Name: name, Owner: owner, Cluster: nodes, - Timeout: 5 * time.Hour, + Timeout: 7 * time.Hour, Tags: b.Tags, EncryptionSupport: encryptionSupport, Run: func(ctx context.Context, t test.Test, c cluster.Cluster) { diff --git a/pkg/server/server.go b/pkg/server/server.go index 4a3a78d152dd..c4892a820042 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -1798,6 +1798,13 @@ func (s *Server) PreStart(ctx context.Context) error { // to bypass admission control. s.storeGrantCoords.SetPebbleMetricsProvider(ctx, s.node, s.node) + // Connect the engines to the disk stats map constructor. + // This also needs to wait until after `waitForAdditionalStoreInit` returns, + // as the store IDs may not be known until then. + if err := s.node.registerEnginesForDiskStatsMap(s.cfg.Stores.Specs, s.engines); err != nil { + return errors.Wrapf(err, "failed to register engines for the disk stats map") + } + // Once all stores are initialized, check if offline storage recovery // was done prior to start and record any actions appropriately. logPendingLossOfQuorumRecoveryEvents(workersCtx, s.node.stores) @@ -1938,11 +1945,6 @@ func (s *Server) PreStart(ctx context.Context) error { } } - // Connect the engines to the disk stats map constructor. - if err := s.node.registerEnginesForDiskStatsMap(s.cfg.Stores.Specs, s.engines); err != nil { - return errors.Wrapf(err, "failed to register engines for the disk stats map") - } - if storage.WorkloadCollectorEnabled { if err := s.debug.RegisterWorkloadCollector(s.node.stores); err != nil { return errors.Wrapf(err, "failed to register workload collector with debug server") diff --git a/pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.tsx b/pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.tsx index f408db14884d..09a61a9182d0 100644 --- a/pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/statementsPage/statementsPage.tsx @@ -308,7 +308,7 @@ export class StatementsPage extends React.Component< this.props.onApplySearchCriteria( this.state.timeScale, this.state.limit, - getSortLabel(this.state.reqSortSetting), + getSortLabel(this.state.reqSortSetting, "Statement"), ); } this.refreshStatements(); @@ -594,7 +594,10 @@ export class StatementsPage extends React.Component< ); const period = timeScaleToString(this.props.timeScale); - const sortSettingLabel = getSortLabel(this.props.reqSortSetting); + const sortSettingLabel = getSortLabel( + this.props.reqSortSetting, + "Statement", + ); return ( <> diff --git a/pkg/ui/workspaces/cluster-ui/src/transactionsPage/transactionsPage.tsx b/pkg/ui/workspaces/cluster-ui/src/transactionsPage/transactionsPage.tsx index 872fbb7b9274..ef2b43a165d3 100644 --- a/pkg/ui/workspaces/cluster-ui/src/transactionsPage/transactionsPage.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/transactionsPage/transactionsPage.tsx @@ -417,7 +417,7 @@ export class TransactionsPage extends React.Component< this.props.onApplySearchCriteria( this.state.timeScale, this.state.limit, - getSortLabel(this.state.reqSortSetting), + getSortLabel(this.state.reqSortSetting, "Transaction"), ); } this.refreshData(); @@ -528,7 +528,10 @@ export class TransactionsPage extends React.Component< ); const period = timeScaleToString(this.props.timeScale); - const sortSettingLabel = getSortLabel(this.props.reqSortSetting); + const sortSettingLabel = getSortLabel( + this.props.reqSortSetting, + "Transaction", + ); return ( <> diff --git a/pkg/ui/workspaces/cluster-ui/src/util/sqlActivityConstants.ts b/pkg/ui/workspaces/cluster-ui/src/util/sqlActivityConstants.ts index 1352039eaab5..ee9a52a30f9d 100644 --- a/pkg/ui/workspaces/cluster-ui/src/util/sqlActivityConstants.ts +++ b/pkg/ui/workspaces/cluster-ui/src/util/sqlActivityConstants.ts @@ -22,20 +22,23 @@ export const limitOptions = [ { value: 500, label: "500" }, ]; -export function getSortLabel(sort: SqlStatsSortType): string { +export function getSortLabel( + sort: SqlStatsSortType, + type: "Statement" | "Transaction", +): string { switch (sort) { case SqlStatsSortOptions.SERVICE_LAT: - return "Service Latency"; + return `${type} Time`; case SqlStatsSortOptions.EXECUTION_COUNT: return "Execution Count"; case SqlStatsSortOptions.CPU_TIME: return "CPU Time"; case SqlStatsSortOptions.P99_STMTS_ONLY: - return "P99"; + return "P99 Latency"; case SqlStatsSortOptions.CONTENTION_TIME: return "Contention Time"; case SqlStatsSortOptions.PCT_RUNTIME: - return "% Of All Runtime"; + return "% of All Runtime"; default: return ""; } @@ -63,7 +66,7 @@ export function getSortColumn(sort: SqlStatsSortType): string { export const stmtRequestSortOptions = Object.values(SqlStatsSortOptions) .map(sortVal => ({ value: sortVal as SqlStatsSortType, - label: getSortLabel(sortVal as SqlStatsSortType), + label: getSortLabel(sortVal as SqlStatsSortType, "Statement"), })) .sort((a, b) => { if (a.label < b.label) return -1; @@ -71,11 +74,21 @@ export const stmtRequestSortOptions = Object.values(SqlStatsSortOptions) return 0; }); -export const txnRequestSortOptions = stmtRequestSortOptions.filter( - option => - option.value !== SqlStatsSortOptions.P99_STMTS_ONLY && - option.value !== SqlStatsSortOptions.PCT_RUNTIME, -); +export const txnRequestSortOptions = Object.values(SqlStatsSortOptions) + .map(sortVal => ({ + value: sortVal as SqlStatsSortType, + label: getSortLabel(sortVal as SqlStatsSortType, "Transaction"), + })) + .sort((a, b) => { + if (a.label < b.label) return -1; + if (a.label > b.label) return 1; + return 0; + }) + .filter( + option => + option.value !== SqlStatsSortOptions.P99_STMTS_ONLY && + option.value !== SqlStatsSortOptions.PCT_RUNTIME, + ); export const STATS_LONG_LOADING_DURATION = duration(2, "s");