Skip to content

dbinit is getting too order dependent #4286

@smklein

Description

@smklein

Following up from some issues observed by @internet-diglett -- we're observing that the dbinit_equals_sum_of_all_up test is failing more frequently (not flake, just with new PRs) for schema changes which cause constraint changes.

This was referenced by @gjcolombo in https://github.com/oxidecomputer/omicron/tree/main/schema/crdb#adding-tables-and-views , but it's reproducible in some surprising cases.

For example, right now, with main at ee8d93b , if I add the following:

CREATE TABLE IF NOT EXISTS omicron.public.foo (
    id UUID CONSTRAINT pk PRIMARY KEY
);

To both 8.0.0/up.sql, and also to the end of dbinit.sql, I see test failures comparing table constraints.

thread 'integration_tests::schema::dbinit_equals_sum_of_all_up' panicked at 'assertion failed: `(left == right)`'
  left: `"[Row { values: [NamedSqlValue { column: \"constraint_catalog\", value: Some(String(\"omicron\")) }, NamedSqlValue { column: \"constraint_schema\", value: Some(String(\"public\")) }, NamedSqlValue { column: \"c..."` (truncated)
 right: `"[Row { values: [NamedSqlValue { column: \"constraint_catalog\", value: Some(String(\"omicron\")) }, NamedSqlValue { column: \"constraint_schema\", value: Some(String(\"public\")) }, NamedSqlValue { column: \"c..."` (truncated)

Differences (-left|+right):
             NamedSqlValue {
                 column: "constraint_name",
                 value: Some(
                     String(
-                        "4101115737_243_1_not_null",
+                        "4101115737_242_1_not_null",
                     ),
                 ),
             },
             NamedSqlValue {

', nexus/tests/integration_tests/schema.rs:579:9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Update SystemReplacing old bits with newer, cooler bitsdatabaseRelated to database access

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions