Open askfongjojo opened 1 day ago
Thanks for catching this!!
Yeah it seems pretty likely that this table is missing from the inventory delete code. We can certainly fix that problem but it's a little harder to fix existing systems. We could try something like:
DELETE FROM inv_dataset WHERE inv_collection_id NOT IN (SELECT id FROM inv_collection);
But that's a potentially huge transaction and it'd be safer to do it in batches. It looks like you can do something like this but I haven't tested it:
DELETE FROM inv_dataset WHERE inv_collection_id NOT IN (SELECT id FROM inv_collection) LIMIT 1000;
and we could run that in a loop until it produces no results.
We could:
I'd probably lean towards the omdb command. There's a related question of: is this too urgent to wait for the next upgrade?
The issue doesn't seem to affect the system negatively at the moment AFAICT (I found it only by chance). We can do the cleanup at the next customer rack update after fixing the inventory delete code.
I see that there is an unusally large number of records in this table that has no time_deleted or state fields:
It may be worth confirming if this table is supposed to grow indefinitely. Other
inv_
table seems to be pruned and kept to reasonable sizes (maybe related to https://github.com/oxidecomputer/omicron/issues/5305).