-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
77504: cluster-ui: add active stmts and txns pages for CC r=jocrl a=xinhaoz This commit adds the active statements and active transactions pages required by cockroach cloud. The components created in this commit are intended for use in `managed-service`. Release note: None 78293: roachtest: sstable-corruption: collect manifests; additional logging r=jbowens a=nicktrav Add additional logging of the contents of the data directory and collect the Pebble manifests when the test fails to find tables to corrupt. This will aid in diagnosing the test failures. Touches #78121. Release note: None. 78616: opt: disable index recommendations with PARTITION ALL BY r=rytaft a=rytaft This commit disables index recommendations for tables with `PARTITION ALL BY` (including `REGIONAL BY ROW` tables) because the current recommendations are not valid. This is a backportable fix, but a future PR will fix these recommendations and reenable them. Release note (sql change): Disabled index recommendations in `EXPLAIN` output for `REGIONAL BY ROW` tables, as the previous recommendations were not valid. 78654: roachprod: do not send status report to slack r=rail a=rail Previously, the roachprod GC job posted cluster status on each run. This made the #roachprod-status channel very spammy and not actionable. This patch removes the status generation part. Release note: None Co-authored-by: Xin Hao Zhang <[email protected]> Co-authored-by: Nick Travers <[email protected]> Co-authored-by: Rebecca Taft <[email protected]> Co-authored-by: Rail Aliiev <[email protected]>
- Loading branch information
Showing
20 changed files
with
791 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2809,3 +2809,56 @@ SELECT * FROM [EXPLAIN SELECT * FROM regional_by_row_table_as1 LIMIT 3] OFFSET 2 | |
table: regional_by_row_table_as1@regional_by_row_table_as1_pkey | ||
spans: [/'ca-central-1' - /'us-east-1'] | ||
limit: 3 | ||
|
||
subtest index_recommendations | ||
|
||
# Enable vectorize so we get consistent EXPLAIN output. We cannot use the | ||
# OFFSET 2 strategy for these tests because that disables the index | ||
# recommendation (index recommendations are only used when EXPLAIN is the | ||
# root of the query tree). | ||
statement ok | ||
SET index_recommendations_enabled = true; | ||
SET vectorize=on | ||
|
||
statement ok | ||
CREATE TABLE users ( | ||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | ||
name STRING NOT NULL, | ||
email STRING NOT NULL UNIQUE, | ||
INDEX (name) | ||
) LOCALITY REGIONAL BY ROW | ||
|
||
# Check that we don't recommend indexes that already exist. | ||
query T | ||
EXPLAIN INSERT INTO users (name, email) | ||
VALUES ('Craig Roacher', '[email protected]') | ||
---- | ||
distribution: local | ||
vectorized: true | ||
· | ||
• root | ||
│ | ||
├── • insert | ||
│ │ into: users(id, name, email, crdb_region) | ||
│ │ | ||
│ └── • buffer | ||
│ │ label: buffer 1 | ||
│ │ | ||
│ └── • values | ||
│ size: 5 columns, 1 row | ||
│ | ||
└── • constraint-check | ||
│ | ||
└── • error if rows | ||
│ | ||
└── • lookup join (semi) | ||
│ table: users@users_email_key | ||
│ lookup condition: (column2 = email) AND (crdb_region IN ('ap-southeast-2', 'ca-central-1', 'us-east-1')) | ||
│ pred: (id_default != id) OR (crdb_region_default != crdb_region) | ||
│ | ||
└── • scan buffer | ||
label: buffer 1 | ||
|
||
statement ok | ||
SET index_recommendations_enabled = false; | ||
RESET vectorize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
pkg/ui/workspaces/cluster-ui/src/statementDetails/activeStatementDetails.selectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import { createSelector } from "reselect"; | ||
import { AppState } from "src"; | ||
import { match, RouteComponentProps } from "react-router-dom"; | ||
import { getMatchParamByName } from "src/util/query"; | ||
import { executionIdAttr } from "../util/constants"; | ||
import { getActiveStatementsFromSessions } from "../activeExecutions/activeStatementUtils"; | ||
|
||
export const selectActiveStatement = createSelector( | ||
(_: AppState, props: RouteComponentProps) => props.match, | ||
(state: AppState) => state.adminUI.sessions, | ||
(match: match, response) => { | ||
if (!response.data) return null; | ||
|
||
const executionID = getMatchParamByName(match, executionIdAttr); | ||
return getActiveStatementsFromSessions( | ||
response.data, | ||
response.lastUpdated, | ||
).find(stmt => stmt.executionID === executionID); | ||
}, | ||
); |
43 changes: 43 additions & 0 deletions
43
pkg/ui/workspaces/cluster-ui/src/statementDetails/activeStatementDetailsConnected.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import { RouteComponentProps, withRouter } from "react-router-dom"; | ||
import { connect } from "react-redux"; | ||
import { Dispatch } from "redux"; | ||
import { actions as sessionsActions } from "src/store/sessions"; | ||
import { AppState } from "../store"; | ||
import { | ||
ActiveStatementDetails, | ||
ActiveStatementDetailsDispatchProps, | ||
} from "./activeStatementDetails"; | ||
import { selectActiveStatement } from "./activeStatementDetails.selectors"; | ||
import { ActiveStatementDetailsStateProps } from "."; | ||
|
||
// For tenant cases, we don't show information about node, regions and | ||
// diagnostics. | ||
const mapStateToProps = ( | ||
state: AppState, | ||
props: RouteComponentProps, | ||
): ActiveStatementDetailsStateProps => { | ||
return { | ||
statement: selectActiveStatement(state, props), | ||
match: props.match, | ||
}; | ||
}; | ||
|
||
const mapDispatchToProps = ( | ||
dispatch: Dispatch, | ||
): ActiveStatementDetailsDispatchProps => ({ | ||
refreshSessions: () => dispatch(sessionsActions.refresh()), | ||
}); | ||
|
||
export const ActiveStatementDetailsPageConnected = withRouter( | ||
connect(mapStateToProps, mapDispatchToProps)(ActiveStatementDetails), | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
pkg/ui/workspaces/cluster-ui/src/statementsPage/activeStatementsPage.selectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// Copyright 2022 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
import { createSelector } from "reselect"; | ||
import { getActiveStatementsFromSessions } from "../activeExecutions/activeStatementUtils"; | ||
import { localStorageSelector } from "./statementsPage.selectors"; | ||
import { | ||
ActiveStatementFilters, | ||
ActiveStatementsViewDispatchProps, | ||
ActiveStatementsViewStateProps, | ||
AppState, | ||
SortSetting, | ||
} from "src"; | ||
import { actions as sessionsActions } from "src/store/sessions"; | ||
import { actions as localStorageActions } from "src/store/localStorage"; | ||
import { Dispatch } from "redux"; | ||
|
||
export const selectActiveStatements = createSelector( | ||
(state: AppState) => state.adminUI.sessions, | ||
response => { | ||
if (!response.data) return []; | ||
|
||
return getActiveStatementsFromSessions(response.data, response.lastUpdated); | ||
}, | ||
); | ||
|
||
export const selectSortSetting = (state: AppState): SortSetting => | ||
localStorageSelector(state)["sortSetting/ActiveStatementsPage"]; | ||
|
||
export const selectFilters = (state: AppState): ActiveStatementFilters => | ||
localStorageSelector(state)["filters/ActiveStatementsPage"]; | ||
|
||
const selectLocalStorageColumns = (state: AppState) => { | ||
const localStorage = localStorageSelector(state); | ||
return localStorage["showColumns/ActiveStatementsPage"]; | ||
}; | ||
|
||
export const selectColumns = createSelector( | ||
selectLocalStorageColumns, | ||
value => { | ||
if (value == null) return null; | ||
|
||
return value.split(",").map(col => col.trim()); | ||
}, | ||
); | ||
|
||
export const mapStateToActiveStatementsPageProps = ( | ||
state: AppState, | ||
): ActiveStatementsViewStateProps => ({ | ||
statements: selectActiveStatements(state), | ||
sessionsError: state.adminUI.sessions.lastError, | ||
selectedColumns: selectColumns(state), | ||
sortSetting: selectSortSetting(state), | ||
filters: selectFilters(state), | ||
}); | ||
|
||
export const mapDispatchToActiveStatementsPageProps = ( | ||
dispatch: Dispatch, | ||
): ActiveStatementsViewDispatchProps => ({ | ||
refreshSessions: () => dispatch(sessionsActions.refresh()), | ||
onColumnsSelect: columns => { | ||
dispatch( | ||
localStorageActions.update({ | ||
key: "showColumns/ActiveStatementsPage", | ||
value: columns.join(","), | ||
}), | ||
); | ||
}, | ||
onFiltersChange: (filters: ActiveStatementFilters) => | ||
dispatch( | ||
localStorageActions.update({ | ||
key: "filters/ActiveStatementsPage", | ||
value: filters, | ||
}), | ||
), | ||
onSortChange: (ss: SortSetting) => | ||
dispatch( | ||
localStorageActions.update({ | ||
key: "sortSetting/ActiveStatementsPage", | ||
value: ss, | ||
}), | ||
), | ||
}); |
Oops, something went wrong.