Skip to content

Commit

Permalink
roachpb,sql.ui: remove Opt field from StatementStatisticsKey
Browse files Browse the repository at this point in the history
Resolves cockroachdb#68077

Release note: None

Release justification:
  • Loading branch information
Azhng committed Aug 30, 2021
1 parent b78f3fc commit 96c5c29
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 167 deletions.
216 changes: 93 additions & 123 deletions pkg/roachpb/app_stats.pb.go

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pkg/roachpb/app_stats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,13 @@ message StatementStatisticsKey {
optional string app = 2 [(gogoproto.nullable) = false];
optional bool distSQL = 3 [(gogoproto.nullable) = false];
optional bool failed = 4 [(gogoproto.nullable) = false];
optional bool opt = 5 [(gogoproto.nullable) = false];
optional bool implicit_txn = 6 [(gogoproto.nullable) = false];
optional bool vec = 7 [(gogoproto.nullable) = false];
optional bool full_scan = 8 [(gogoproto.nullable) = false];
optional string database = 9 [(gogoproto.nullable) = false];
optional uint64 plan_hash = 10 [(gogoproto.nullable) = false];

reserved 5;
}

// CollectedStatementStatistics wraps collected timings and metadata for some
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ func ExplainTreePlanNodeToJSON(node *roachpb.ExplainTreePlanNode) json.JSON {
// "db": { "type": "string" },
// "distsql": { "type": "boolean" },
// "failed": { "type": "boolean" },
// "opt": { "type": "boolean" },
// "implicitTxn": { "type": "boolean" },
// "vec": { "type": "boolean" },
// "fullScan": { "type": "boolean" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestSQLStatsJsonEncoding(t *testing.T) {
"db": "{{.String}}",
"distsql": {{.Bool}},
"failed": {{.Bool}},
"opt": {{.Bool}},
"implicitTxn": {{.Bool}},
"vec": {{.Bool}},
"fullScan": {{.Bool}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (s *stmtStatsMetadata) jsonFields() jsonFields {
{"db", (*jsonString)(&s.Key.Database)},
{"distsql", (*jsonBool)(&s.Key.DistSQL)},
{"failed", (*jsonBool)(&s.Key.Failed)},
{"opt", (*jsonBool)(&s.Key.Opt)},
{"implicitTxn", (*jsonBool)(&s.Key.ImplicitTxn)},
{"vec", (*jsonBool)(&s.Key.Vec)},
{"fullScan", (*jsonBool)(&s.Key.FullScan)},
Expand Down
3 changes: 0 additions & 3 deletions pkg/sql/sqlstats/persistedsqlstats/sqlstatsutil/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ func GetRandomizedCollectedStatementStatisticsForTest(
data := genRandomData()
fillObject(t, reflect.ValueOf(&result), &data)

// TODO(azhng): Gone after https://github.com/cockroachdb/cockroach/issues/68077.
result.Key.Opt = true

return result
}

Expand Down
1 change: 0 additions & 1 deletion pkg/sql/sqlstats/ssmemstorage/ss_mem_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func (s *StmtStatsIterator) Next() bool {
Key: roachpb.StatementStatisticsKey{
Query: stmtKey.anonymizedStmt,
DistSQL: distSQLUsed,
Opt: true,
Vec: vectorized,
ImplicitTxn: stmtKey.implicitTxn,
FullScan: fullScan,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ export const getStatementDetailsPropsFixture = (): StatementDetailsProps => ({
numerator: 36958,
denominator: 36958,
},
opt: {
numerator: 36958,
denominator: 36958,
},
implicit_txn: {
numerator: 36958,
denominator: 36958,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ export const selectStatement = createSelector(
database: getMatchParamByName(props.match, databaseAttr),
distSQL: fractionMatching(results, s => s.distSQL),
vec: fractionMatching(results, s => s.vec),
opt: fractionMatching(results, s => s.opt),
implicit_txn: fractionMatching(results, s => s.implicit_txn),
full_scan: fractionMatching(results, s => s.full_scan),
failed: fractionMatching(results, s => s.failed),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ interface SingleStatementStatistics {
database: string;
distSQL: Fraction;
vec: Fraction;
opt: Fraction;
implicit_txn: Fraction;
failed: Fraction;
node_id: number[];
Expand Down Expand Up @@ -435,7 +434,6 @@ export class StatementDetails extends React.Component<
app,
distSQL,
vec,
opt,
failed,
implicit_txn,
database,
Expand Down Expand Up @@ -638,10 +636,6 @@ export class StatementDetails extends React.Component<
<Text>Failed?</Text>
<Text>{renderBools(failed)}</Text>
</div>
<div className={summaryCardStylesCx("summary--card__item")}>
<Text>Used cost-based optimizer?</Text>
<Text>{renderBools(opt)}</Text>
</div>
<div className={summaryCardStylesCx("summary--card__item")}>
<Text>Distributed execution?</Text>
<Text>{renderBools(distSQL)}</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-update-session",
distSQL: false,
failed: false,
opt: true,
implicit_txn: false,
vec: false,
},
Expand Down Expand Up @@ -125,7 +124,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-fetch-single-session",
distSQL: false,
failed: false,
opt: true,
implicit_txn: false,
vec: false,
},
Expand Down Expand Up @@ -190,7 +188,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-read orphaned leases",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
},
Expand Down Expand Up @@ -246,7 +243,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
},
Expand Down Expand Up @@ -343,7 +339,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-insert-session",
distSQL: false,
failed: false,
opt: true,
implicit_txn: false,
vec: false,
},
Expand Down Expand Up @@ -393,7 +388,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-show-version",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
},
Expand Down Expand Up @@ -432,7 +426,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-read-setting",
distSQL: false,
failed: false,
opt: true,
implicit_txn: false,
vec: false,
},
Expand Down Expand Up @@ -482,7 +475,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-protectedts-GetMetadata",
distSQL: false,
failed: false,
opt: true,
implicit_txn: false,
vec: false,
},
Expand Down Expand Up @@ -570,7 +562,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-delete-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
},
Expand Down Expand Up @@ -682,7 +673,6 @@ export const data: cockroach.server.serverpb.IStatementsResponse = {
app: "$ internal-log-event",
distSQL: false,
failed: false,
opt: true,
implicit_txn: false,
vec: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -122,7 +121,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -230,7 +228,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -341,7 +338,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -446,7 +442,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -551,7 +546,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -662,7 +656,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -773,7 +766,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down Expand Up @@ -887,7 +879,6 @@ export const statementsWithSameIdButDifferentNodeId: CollectedStatementStatistic
app: "$ internal-expire-sessions",
distSQL: false,
failed: false,
opt: true,
implicit_txn: true,
vec: false,
full_scan: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ describe("flattenStatementStats", () => {
assert.equal(flattened[i].app, stats[i].key.key_data.app);
assert.equal(flattened[i].distSQL, stats[i].key.key_data.distSQL);
assert.equal(flattened[i].vec, stats[i].key.key_data.vec);
assert.equal(flattened[i].opt, stats[i].key.key_data.opt);
assert.equal(flattened[i].full_scan, stats[i].key.key_data.full_scan);
assert.equal(flattened[i].failed, stats[i].key.key_data.failed);
assert.equal(flattened[i].node_id, stats[i].key.node_id);
Expand Down
2 changes: 0 additions & 2 deletions pkg/ui/workspaces/cluster-ui/src/util/appStats/appStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ export interface ExecutionStatistics {
database: string;
distSQL: boolean;
vec: boolean;
opt: boolean;
implicit_txn: boolean;
full_scan: boolean;
failed: boolean;
Expand All @@ -213,7 +212,6 @@ export function flattenStatementStats(
database: stmt.key.key_data.database,
distSQL: stmt.key.key_data.distSQL,
vec: stmt.key.key_data.vec,
opt: stmt.key.key_data.opt,
implicit_txn: stmt.key.key_data.implicit_txn,
full_scan: stmt.key.key_data.full_scan,
failed: stmt.key.key_data.failed,
Expand Down
1 change: 0 additions & 1 deletion pkg/ui/workspaces/db-console/src/util/appStats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ describe("flattenStatementStats", () => {
assert.equal(flattened[i].app, stats[i].key.key_data.app);
assert.equal(flattened[i].distSQL, stats[i].key.key_data.distSQL);
assert.equal(flattened[i].vec, stats[i].key.key_data.vec);
assert.equal(flattened[i].opt, stats[i].key.key_data.opt);
assert.equal(flattened[i].full_scan, stats[i].key.key_data.full_scan);
assert.equal(flattened[i].failed, stats[i].key.key_data.failed);
assert.equal(flattened[i].node_id, stats[i].key.node_id);
Expand Down
2 changes: 0 additions & 2 deletions pkg/ui/workspaces/db-console/src/util/appStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ export interface ExecutionStatistics {
database: string;
distSQL: boolean;
vec: boolean;
opt: boolean;
implicit_txn: boolean;
full_scan: boolean;
failed: boolean;
Expand All @@ -202,7 +201,6 @@ export function flattenStatementStats(
database: stmt.key.key_data.database,
distSQL: stmt.key.key_data.distSQL,
vec: stmt.key.key_data.vec,
opt: stmt.key.key_data.opt,
implicit_txn: stmt.key.key_data.implicit_txn,
full_scan: stmt.key.key_data.full_scan,
failed: stmt.key.key_data.failed,
Expand Down

0 comments on commit 96c5c29

Please sign in to comment.