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

Combine inv_sled_omicron_zones with inv_sled_agent #6770

Open
sunshowers opened this issue Oct 4, 2024 · 0 comments
Open

Combine inv_sled_omicron_zones with inv_sled_agent #6770

sunshowers opened this issue Oct 4, 2024 · 0 comments

Comments

@sunshowers
Copy link
Contributor

Followup from #6739.

Previously, the collection process would gather Omicron zones and inventory from sled-agent in separate HTTP requests. Since they can fail independently, information about them was recorded separately in two tables.

Omicron zone information is recorded in inv_sled_omicron_zones:

omicron/schema/crdb/dbinit.sql

Lines 3331 to 3338 in 81b327d

CREATE TABLE IF NOT EXISTS omicron.public.inv_sled_omicron_zones (
-- where this observation came from
-- (foreign key into `inv_collection` table)
inv_collection_id UUID NOT NULL,
-- when this observation was made
time_collected TIMESTAMPTZ NOT NULL,
-- URL of the sled agent that reported this data
source TEXT NOT NULL,

And general inventory is recorded in inv_sled_agent:

omicron/schema/crdb/dbinit.sql

Lines 3199 to 3206 in 81b327d

CREATE TABLE IF NOT EXISTS omicron.public.inv_sled_agent (
-- where this observation came from
-- (foreign key into `inv_collection` table)
inv_collection_id UUID NOT NULL,
-- when this observation was made
time_collected TIMESTAMPTZ NOT NULL,
-- URL of the sled agent that reported this data
source TEXT NOT NULL,


In #6739, we merged the two into a single HTTP request, but for convenience reasons we still record them in separate tables.

This task tracks cleaning this up so that the two are in the same table.


The only important column to preserve from inv_sled_omicron_zones is generation. Ideally this would be added to inv_sled_agent as a non-null column.

The easiest way to do this would be to drop all old collections then add the generation column. But doing that across a version upgrade can leave us in a fragile state with no collections available. So it's probably better to do an inner join by collection ID, so most collections are preserved.

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

No branches or pull requests

1 participant