Skip to content

Add omdb command to display db_metadata_nexus_state#9034

Merged
smklein merged 4 commits into
mainfrom
omdb_nexus_gen
Sep 19, 2025
Merged

Add omdb command to display db_metadata_nexus_state#9034
smklein merged 4 commits into
mainfrom
omdb_nexus_gen

Conversation

@smklein

@smklein smklein commented Sep 16, 2025

Copy link
Copy Markdown
Collaborator

The viewing part of #9008

@jgallagher jgallagher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a handful of nitpicks

Comment thread dev-tools/omdb/src/bin/omdb/db.rs Outdated
.with_context(|| format!("loading project {project_id}"))
}

// DB Metadata

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit - I think we've started to create submodules of db.rs for new functionality, since this file has gotten pretty beefy. Might be worth moving this into its own module?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2f19f09

Comment thread dev-tools/omdb/src/bin/omdb/db.rs Outdated
get_db_metadata_nexus_rows(opctx, datastore, &current_target_blueprint)
.await?;
let table = tabled::Table::new(rows)
.with(tabled::settings::Style::psql())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we mostly use Style::empty(), with just a handful of psql()s. Should we stick with one? (Maybe we should have a helper for "an omdb Table" that handles both style and padding?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 $ rg "Style::psql" | wc -l
16
 $ rg "Style::empty" | wc -l
85

I think there's a pretty sizeable gap here, independent of this PR. I really don't care which we pick (though you're right, empty seems more popular), I just happened to copy the format of something nearby.

Maybe we converge on one style outside this PR, to migrate everything at once?

Comment thread dev-tools/omdb/tests/successes.out Outdated
Target Blueprint ......<REDACTED_BLUEPRINT_ID>....... @ nexus_generation: 1
ID |LAST_DRAINED_BLUEPRINT |STATE |TRANSITIONING_TO
-------------------------------------+-----------------------+-------+-----------------
..........<REDACTED_UUID>........... |n/a |active |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little weird to have n/a in one column and a blank in the other. Would a "transitioning to" of either n/a or even repeat active be clearer, maybe?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just make both "blank" if nullable. I really want the "Some" values here to be highly visible, which is IMO more obvious if they're blank otherwise.

pub async fn get_db_metadata_nexus_in_state(
&self,
opctx: &OpContext,
states: &[DbMetadataNexusState],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny perf nit - since this function really wants an owned Vec<DbMetadataNexusState>, I think I'd take that as an argument. As written, this method always allocates a new vec. If we change it to accept one, the caller might have to allocate one (e.g., if they themselves only have a slice), but there may also be cases where the caller already has a Vec that they can move here, which would save an allocation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 2f19f09

}

/// Iterate over all Nexus zones that match the provided filter.
pub fn all_nexus_zones<F>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this already landed on main?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this got cleared in the merge: be07778

@smklein smklein enabled auto-merge (squash) September 18, 2025 23:08
@smklein smklein merged commit c908ac8 into main Sep 19, 2025
16 checks passed
@smklein smklein deleted the omdb_nexus_gen branch September 19, 2025 00:58
charliepark pushed a commit that referenced this pull request Sep 19, 2025
smklein added a commit that referenced this pull request Sep 30, 2025
Builds on #9034

Adds a command to handle permanent Nexus failure during handoff.

Fixes #9008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants