From 6e1f9a83fbad0469464cd01d31a94741582a2f3e Mon Sep 17 00:00:00 2001
From: Kyle Wong <37189875+kyle-a-wong@users.noreply.github.com>
Date: Tue, 22 Oct 2024 14:17:21 -0400
Subject: [PATCH 1/2] ui: remove "Range Count" column from db page
The legacy databases page calculates the "Range Count"
column by summing the range counts of every table in said
database. This is not an accurate value because multiple
tables can share a range, resulting in potential double
counting when doing a sum at the database level. As a
result, there are discrepancies between the "Range Count"
on the "Databases" page and the results of a `SHOW RANGES`
query.
Since getting unique ranges, as per the `SHOW RANGES` query,
is a relatively expensive operation, we are opting to
remove this column from the "Databases" page.
Epic: CRDB-37558
Resolves: #116691
Release note (ui change): Due to the inaccuracy of the "Range
Count" column on the "Databases" page and the cost incurred
to fetch the correct range count for every database in a
cluster, this data will no longer be visible. This data is
still available via a `SHOW RANGES` query.
---
.../cluster-ui/src/api/databaseDetailsApi.ts | 4 ----
.../src/databasesPage/databasesPage.tsx | 23 -------------------
.../databaseDetailsSpanStats.saga.spec.ts | 1 -
.../db-console/src/util/api.spec.ts | 2 --
4 files changed, 30 deletions(-)
diff --git a/pkg/ui/workspaces/cluster-ui/src/api/databaseDetailsApi.ts b/pkg/ui/workspaces/cluster-ui/src/api/databaseDetailsApi.ts
index 704b4c55fc2a..ec78e97d5a7e 100644
--- a/pkg/ui/workspaces/cluster-ui/src/api/databaseDetailsApi.ts
+++ b/pkg/ui/workspaces/cluster-ui/src/api/databaseDetailsApi.ts
@@ -83,7 +83,6 @@ function newDatabaseDetailsSpanStatsResponse(): DatabaseDetailsSpanStatsResponse
approximate_disk_bytes: 0,
live_bytes: 0,
total_bytes: 0,
- range_count: 0,
},
error: undefined,
};
@@ -332,7 +331,6 @@ export type DatabaseSpanStatsRow = {
approximate_disk_bytes: number;
live_bytes: number;
total_bytes: number;
- range_count: number;
};
function formatSpanStatsExecutionResult(
@@ -357,7 +355,6 @@ function formatSpanStatsExecutionResult(
if (txnResult.rows.length === 1) {
const row = txnResult.rows[0];
out.spanStats.approximate_disk_bytes = row.approximate_disk_bytes;
- out.spanStats.range_count = row.range_count;
out.spanStats.live_bytes = row.live_bytes;
out.spanStats.total_bytes = row.total_bytes;
} else {
@@ -511,7 +508,6 @@ export function createDatabaseDetailsSpanStatsReq(
): SqlExecutionRequest {
const statement = {
sql: `SELECT
- sum(range_count) as range_count,
sum(approximate_disk_bytes) as approximate_disk_bytes,
sum(live_bytes) as live_bytes,
sum(total_bytes) as total_bytes
diff --git a/pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx b/pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx
index b94b620c62cd..7577ebccf372 100644
--- a/pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx
+++ b/pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx
@@ -571,29 +571,6 @@ export class DatabasesPage extends React.Component<
className: cx("databases-table__col-table-count"),
name: "tableCount",
},
- {
- title: (
-
- Range Count
-
- ),
- cell: database => (
-
- {database.spanStats?.range_count}
-
- ),
- sort: database => database.spanStats?.range_count,
- className: cx("databases-table__col-range-count"),
- name: "rangeCount",
- },
{
title: (
{
spanStats: {
approximate_disk_bytes: 100,
live_bytes: 200,
- range_count: 300,
total_bytes: 400,
error: undefined,
},
diff --git a/pkg/ui/workspaces/db-console/src/util/api.spec.ts b/pkg/ui/workspaces/db-console/src/util/api.spec.ts
index 7f9689d59cea..5eeb0866dae9 100644
--- a/pkg/ui/workspaces/db-console/src/util/api.spec.ts
+++ b/pkg/ui/workspaces/db-console/src/util/api.spec.ts
@@ -119,7 +119,6 @@ describe("rest api", function () {
approximate_disk_bytes: 100,
live_bytes: 200,
total_bytes: 300,
- range_count: 400,
},
],
},
@@ -130,7 +129,6 @@ describe("rest api", function () {
expect(res.results.spanStats.approximate_disk_bytes).toEqual(100);
expect(res.results.spanStats.live_bytes).toEqual(200);
expect(res.results.spanStats.total_bytes).toEqual(300);
- expect(res.results.spanStats.range_count).toEqual(400);
});
});
});
From 3aed352c98d86020afa54674e4f74ae0ec1bccc1 Mon Sep 17 00:00:00 2001
From: Kyle Wong <37189875+kyle-a-wong@users.noreply.github.com>
Date: Wed, 23 Oct 2024 12:47:55 -0400
Subject: [PATCH 2/2] ui: bump cluster-ui version
bumps cluster-ui version to 24.2.2
Epic: CRDB-37558
Release note: None
---
pkg/ui/workspaces/cluster-ui/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/ui/workspaces/cluster-ui/package.json b/pkg/ui/workspaces/cluster-ui/package.json
index 5ee910cbb393..67c6ab8d8e15 100644
--- a/pkg/ui/workspaces/cluster-ui/package.json
+++ b/pkg/ui/workspaces/cluster-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "@cockroachlabs/cluster-ui",
- "version": "24.2.1",
+ "version": "24.2.2",
"description": "Cluster UI is a library of large features shared between CockroachDB and CockroachCloud",
"repository": {
"type": "git",