Skip to content
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

add --include-deleted switch to omdb db instances #4648

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

gjcolombo
Copy link
Contributor

By default omdb db instances includes all instances, including all deleted instances. Since deleted instances don't currently get garbage-collected, this adds a lot of visual clutter to the command output and more or less requires the use of the --fetch-limit switch to ensure that the instance of interest actually appears in the command output.

Assume that more often than not the instance of interest is one that hasn't yet been deleted, make OMDB default to filtering out soft-deleted instances, and add an --include-deleted switch to revert to the old behavior if it's desired.

Tested on the dogfood rack, verifying in particular that if I wanted to find all instances matching a specific name pattern, including deleted instances required me to add --fetch-limit 3750 to get them all, whereas excluding them (by running the command with no special arguments) returned all the instances of interest with the default fetch limit.

Fixes #4647.

@luqmana
Copy link
Contributor

luqmana commented Dec 26, 2023

Looks good but seems like this would be a useful flag & behaviour for all/most db subcommands? In which case it'd be worth dealing with it uniformly

Several `omdb db` commands directly query CRDB and need to decide whether to
filter out soft-deleted objects from their queries. Make this configurable on
the command line and default to hiding deleted objects. This markedly improves
the UX of `omdb db instances`, which previously included all deleted instances
by default. This doesn't apply in cases where it's important always to
include or exclude soft-deleted objects, e.g. when trying to reason about the
graph of references between regions, volumes, and snapshots in response to a
`validate` subcommand.

Also clean up a couple of callers of `check_limit` who weren't actually setting
a LIMIT clause in their queries. (The check is harmless in this case but will
print a spurious warning if the query returns exactly the right number of rows.)

Tested by running `omdb db` commands on the dogfood rack.
@gjcolombo gjcolombo force-pushed the gjcolombo/omdb-ignore-deleted branch from ae2582d to 3f3b7c6 Compare January 9, 2024 17:37
@gjcolombo
Copy link
Contributor Author

Looks good but seems like this would be a useful flag & behaviour for all/most db subcommands? In which case it'd be worth dealing with it uniformly

Good call. Fixed in 3f3b7c6 by making --include-deleted into a top-level fetch option (similar to the fetch limit) and applying it wherever it made sense and was straightforward to do so.

Copy link
Contributor

@luqmana luqmana left a comment

Choose a reason for hiding this comment

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

Thanks!

@gjcolombo gjcolombo merged commit 1416ee0 into main Jan 11, 2024
20 checks passed
@gjcolombo gjcolombo deleted the gjcolombo/omdb-ignore-deleted branch January 11, 2024 16:37
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.

want omdb db instances to exclude deleted instances by default
2 participants