forked from oxidecomputer/omicron
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nullable lldp_link_config_id column (oxidecomputer#6436)
oxidecomputer#6185 introduced a schema change which added a non-nullable column `lldp_link_config_id` to the `switch_port_settings_link_config` table. However, on systems where `switch_port_settings_link_config` had rows, there was no "default" value, and the schema update appears to fail. This is currently the case on our dogfood system. To mitigate: this PR makes the `lldp_link_config_id` column nullable, by updating the existing schema change (for cases where it could not complete previously) and by adding a new schema change (for cases where the `switch_port_settings_link_config` table was empty, and the schema change **did** previously complete). Fixes oxidecomputer#6433
- Loading branch information
Showing
9 changed files
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/* | ||
* Add a pointer to this link's LLDP config settings. | ||
*/ | ||
ALTER TABLE omicron.public.switch_port_settings_link_config ADD COLUMN IF NOT EXISTS lldp_link_config_id UUID NOT NULL; | ||
ALTER TABLE omicron.public.switch_port_settings_link_config ADD COLUMN IF NOT EXISTS lldp_link_config_id UUID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- Refer to https://github.com/oxidecomputer/omicron/issues/6433 for the justificaiton | ||
-- behind this schema change. | ||
-- | ||
-- In short: the "collapse_lldp_settings" schema change was edited after | ||
-- merging. That change included a schema change which added a non-null column | ||
-- to an existing table. Such a data-modifying statement is only valid for | ||
-- tables with no rows - however, in our test systems, we observed rows, which | ||
-- prevented this schema change from progressing. | ||
-- | ||
-- To resolve: | ||
-- 1. Within the old "collapse_lldp_settings" change, we retroactively dropped the | ||
-- non-null constraint. For systems with populated | ||
-- "switch_port_settings_link_config" tables, this allows the schema update to | ||
-- complete without an error. | ||
-- 2. Within this new "lldp-link-config-nullable" change, we ALSO dropped the | ||
-- non-null constraint. For systems without populated | ||
-- "switch_port_settings_link_config" tables -- which may have been able to | ||
-- apply the "collapse_lldp_settings" change successfully -- this converges the state | ||
-- of the database to the same outcome, where the columns is nullable. | ||
ALTER TABLE omicron.public.switch_port_settings_link_config ALTER COLUMN lldp_link_config_id DROP NOT NULL; |