Skip to content

Commit

Permalink
roachpb,sql.ui: remove Opt field from StatementStatisticsKey
Browse files Browse the repository at this point in the history
This field is safe to delete because we have been filling this
field with hard coded values since few releases ago.

Resolves cockroachdb#68077

Release note: None

Release justification:
  • Loading branch information
Azhng committed Nov 18, 2021
1 parent 6f1252c commit f5015d9
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 188 deletions.
220 changes: 95 additions & 125 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 @@ -180,12 +180,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 @@ -95,7 +95,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 @@ -32,9 +32,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 @@ -192,10 +192,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 @@ -166,7 +166,6 @@ export const selectStatement = createSelector(
database: queryByName(props.location, 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 @@ -79,7 +79,6 @@ interface SingleStatementStatistics {
database: string;
distSQL: Fraction;
vec: Fraction;
opt: Fraction;
implicit_txn: Fraction;
failed: Fraction;
node_id: number[];
Expand Down Expand Up @@ -444,7 +443,6 @@ export class StatementDetails extends React.Component<
app,
distSQL,
vec,
opt,
failed,
implicit_txn,
database,
Expand Down Expand Up @@ -711,10 +709,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 @@ -57,7 +57,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 @@ -137,7 +136,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 @@ -204,7 +202,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 @@ -262,7 +259,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 @@ -364,7 +360,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 @@ -416,7 +411,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 @@ -457,7 +451,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 @@ -509,7 +502,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 @@ -599,7 +591,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 @@ -713,7 +704,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 @@ -123,7 +122,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 @@ -235,7 +233,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 @@ -350,7 +347,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 @@ -456,7 +452,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 @@ -562,7 +557,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 @@ -677,7 +671,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 @@ -792,7 +785,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 @@ -910,7 +902,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 @@ -203,7 +203,6 @@ export interface ExecutionStatistics {
database: string;
distSQL: boolean;
vec: boolean;
opt: boolean;
implicit_txn: boolean;
full_scan: boolean;
failed: boolean;
Expand All @@ -221,7 +220,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 @@ -193,7 +193,6 @@ export interface ExecutionStatistics {
database: string;
distSQL: boolean;
vec: boolean;
opt: boolean;
implicit_txn: boolean;
full_scan: boolean;
failed: boolean;
Expand All @@ -211,7 +210,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
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ export const selectStatement = createSelector(
database: queryByName(props.location, 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
Loading

0 comments on commit f5015d9

Please sign in to comment.