forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: degrade gracefully when regions aren't known
Part of cockroachdb#89949 Previously, when a tenant SQL instance had spun down (leaving us no way to remember which region it had been in), the SQL Activity pages would claim that statements and transactions had occurred in an "undefined" region. This change moves from saying "undefined" to saying nothing at all, a slightly nicer user experience. This broader problem of losing the region mapping has been described in cockroachdb#93268; we'll begin addressing it shortly. Release note: None
- Loading branch information
1 parent
2f6b015
commit fefd360
Showing
6 changed files
with
120 additions
and
8 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
60 changes: 60 additions & 0 deletions
60
pkg/ui/workspaces/cluster-ui/src/statementsTable/statementsTable.spec.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,60 @@ | ||
// 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 { assert } from "chai"; | ||
import Long from "long"; | ||
import { | ||
AggregateStatistics, | ||
populateRegionNodeForStatements, | ||
} from "./statementsTable"; | ||
|
||
describe("populateRegionNodeForStatements", () => { | ||
function statementWithNodeIDs(...nodeIDs: number[]): AggregateStatistics { | ||
return { | ||
aggregatedFingerprintID: "", | ||
aggregatedFingerprintHexID: "", | ||
label: "", | ||
summary: "", | ||
aggregatedTs: 0, | ||
aggregationInterval: 0, | ||
implicitTxn: false, | ||
fullScan: false, | ||
database: "", | ||
applicationName: "", | ||
stats: { nodes: nodeIDs.map(id => Long.fromInt(id)) }, | ||
}; | ||
} | ||
|
||
it("maps nodes to regions, sorted", () => { | ||
const statement = statementWithNodeIDs(1, 2); | ||
populateRegionNodeForStatements([statement], { | ||
"1": "gcp-us-west1", | ||
"2": "gcp-us-east1", | ||
}); | ||
assert.deepEqual(["gcp-us-east1", "gcp-us-west1"], statement.regions); | ||
}); | ||
|
||
it("handles statements without nodes", () => { | ||
const statement = statementWithNodeIDs(); | ||
populateRegionNodeForStatements([statement], { | ||
"1": "gcp-us-west1", | ||
"2": "gcp-us-east1", | ||
}); | ||
assert.deepEqual(statement.regions, []); | ||
}); | ||
|
||
it("excludes nodes whose region we don't know", () => { | ||
const statement = statementWithNodeIDs(1, 2); | ||
populateRegionNodeForStatements([statement], { | ||
"1": "gcp-us-west1", | ||
}); | ||
assert.deepEqual(statement.regions, ["gcp-us-west1"]); | ||
}); | ||
}); |
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