-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cluster-ui, db-console: fix bug where store ids are treated as node ids #119260
Conversation
fb82441
to
b83f754
Compare
@@ -147,7 +160,7 @@ const deriveDatabaseTableDetails = ( | |||
const normalizedPrivileges = normalizePrivileges( | |||
[].concat(...grants.map(grant => grant.privileges)), | |||
); | |||
const nodes = results?.stats.replicaData.nodeIDs || []; | |||
const nodes: Nodes = { kind: "node", ids: results?.stats.replicaData.nodeIDs || [] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The table views appear to already be using node IDs. Please correct me if I'm reading this incorrectly.
// regionA(n1, n2), regionB(n2,n3), ... | ||
/** Store ids and node ids are both of type `number[]`. To disambiguate, a | ||
* `kind` field is included in the type. */ | ||
export type Stores = { kind: "store", ids: number[] }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expanding the type is the only way I could think to disambiguate the data of type number[]
... Open to alternatives here.
@@ -102,7 +142,7 @@ export function nodesByRegionMapToString( | |||
.join(", "); | |||
} | |||
|
|||
export function createNodesByRegionMap( | |||
function createNodesByRegionMap( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodesByRegionMapToString
and createNodesByRegionMap
are only used in this file, so I removed the exports.
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx
Outdated
Show resolved
Hide resolved
d74ad6f
to
07922e8
Compare
Looks like I need to stub an API response in |
300f898
to
f97384b
Compare
Rebased on changes from #118996 was merged. |
38b1347
to
68fe962
Compare
nit: I think this comment can be deleted now since the field was renamed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for taking this on (and taking the time to understand what's going on with db console as a whole :)), just some super small nits but otherwise all good 💯
Reviewed 3 of 7 files at r1, 7 of 9 files at r2, all commit messages.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @laurenbarker)
pkg/ui/workspaces/cluster-ui/src/databases/combiners.ts
line 163 at r1 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
The table views appear to already be using node IDs. Please correct me if I'm reading this incorrectly.
Yeah, I believe all the database page views assumed they were using node ids and store ids.
pkg/ui/workspaces/cluster-ui/src/databases/combiners.ts
line 180 at r1 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
I'm assuming this should be node ids and not store ids too.
yup! 👍
pkg/ui/workspaces/cluster-ui/src/databases/combiners.ts
line 241 at r2 (raw file):
/** List of store IDs for the current cluster. All of the values in the * `*replicas` columns correspond to store IDs. */
same here with the comment
pkg/ui/workspaces/cluster-ui/src/databases/util.tsx
line 145 at r1 (raw file):
Previously, laurenbarker (Lauren Barker) wrote…
nodesByRegionMapToString
andcreateNodesByRegionMap
are only used in this file, so I removed the exports.
thank you!
pkg/ui/workspaces/cluster-ui/src/databases/util.tsx
line 71 at r2 (raw file):
* @returns A list of node ids for the cluster. */ export function getNodeIdsFromStoreIds(
Can we just make this return the Nodes
type directly since all its use cases seem to be creating Nodes?
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx
line 112 at r2 (raw file):
nodes?: number[]; /** A list of node statuses so that store ids can be mapped to nodes. */ nodeStatuses: cockroach.server.status.statuspb.INodeStatus[];
I don't think we need to add this to the props.
Previously, xinhaoz (Xin Hao Zhang) wrote…
not store ids** |
9c24f4a
to
3b6f013
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR @xinhaoz! I think I need help with the last test -- "loads table data" in pkg/ui/workspaces/db-console/src/views/databases/databaseDetailsPage/redux.spec.ts
. nodeStatuses
is undefined
and I'm not sure how to get that information populated in the store and if I need to modify non-test code as well.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @xinhaoz)
pkg/ui/workspaces/cluster-ui/src/databases/combiners.ts
line 163 at r1 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
not store ids**
Oops, this was a comment from before you made your change. I wasn't sure if replicaData.nodeIDs
were node ids or store ids. Turns out they were store ids and you updated the name 😄
pkg/ui/workspaces/cluster-ui/src/databases/combiners.ts
line 181 at r2 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
nit: I think this comment can be deleted now since the field was renamed.
Good call. Done.
pkg/ui/workspaces/cluster-ui/src/databases/combiners.ts
line 241 at r2 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
same here with the comment
Done.
pkg/ui/workspaces/cluster-ui/src/databases/util.tsx
line 71 at r2 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
Can we just make this return the
Nodes
type directly since all its use cases seem to be creating Nodes?
Oh yeah, let's do that!
pkg/ui/workspaces/cluster-ui/src/databasesPage/databasesPage.tsx
line 112 at r2 (raw file):
Previously, xinhaoz (Xin Hao Zhang) wrote…
I don't think we need to add this to the props.
Oops, removed!
Previously, store ids were being treated as node ids on the databases view. This resulted in "Regions/Nodes" column showing inaccurate information in some cases. Now, store ids are mapped to node ids on the databases view which resolves the issue. Also, a log message is skipped during tests so that the output isn't polluted with expected warnings. Fixes: cockroachdb#118957 Release note (ui change): Resolves an issue where clusters with multiple stores per node may list inaccurate region/node information in the databases table.
@xinhaoz I think this is ready for another pass! (finally) |
TFTRs @xinhaoz! |
bors r+ |
blathers backport 23.2 23.1 |
Encountered an error creating backports. Some common things that can go wrong:
You might need to create your backport manually using the backport tool. error creating merge commit from e3c09d0 to blathers/backport-release-23.1-119260: POST https://api.github.com/repos/cockroachdb/cockroach/merges: 409 Merge conflict [] you may need to manually resolve merge conflicts with the backport tool. Backport to branch 23.1 failed. See errors above. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Build succeeded: |
Previously, store ids were being treated as node ids on the databases view. This resulted in "Regions/Nodes" column showing inaccurate information in some cases. Now, store ids are mapped to node ids on the databases view which resolves the issue.
Fixes: #118957
Release note (ui change): Resolves an issue where clusters with multiple stores per node may list inaccurate region/node information in the databases table.