cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.92k stars 3.78k forks source link

pkg/sql/schemachanger/schemachanger_test: TestSchemaChangeComparator_alter_table failed #113366

Open cockroach-teamcity opened 10 months ago

cockroach-teamcity commented 10 months ago

pkg/sql/schemachanger/schemachanger_test.TestSchemaChangeComparator_alter_table failed with artifacts on master @ 71aaf665b6348b9b6e40f38a669bb68f83ea97cd:

    comparator.go:94: Executing "ALTER TABLE privsview ADD COLUMN d INT8"
    comparator.go:94: Executing "ALTER TABLE privsview SPLIT AT VALUES (42)"
    comparator.go:94: Executing "ALTER TABLE privsview UNSPLIT AT VALUES (42)"
    comparator.go:94: Executing "ALTER TABLE privsview UNSPLIT ALL"
    comparator.go:94: Executing "CREATE TABLE impure (x INT8); INSERT INTO impure(x) VALUES (1), (2), (3)"
    comparator.go:94: Executing "ALTER TABLE impure ADD COLUMN a INT8 DEFAULT unique_rowid()"
    comparator.go:94: Executing "SELECT count(DISTINCT a) FROM impure"
    comparator.go:94: Executing "SELECT count(*) FROM crdb_internal.jobs WHERE ((job_type = 'SCHEMA CHANGE') AND (status = 'pending')) OR (status = 'started')"
    comparator.go:94: Executing "CREATE TABLE default_err_test (foo STRING)"
    comparator.go:94: Executing "INSERT INTO default_err_test VALUES ('foo'), ('bar'), ('baz')"
    comparator.go:94: Executing "ALTER TABLE default_err_test ADD COLUMN id INT8 DEFAULT crdb_internal.force_error('foo', 'some_msg')"
    comparator.go:94: Executing "SELECT * FROM default_err_test ORDER BY foo"
    comparator.go:94: Executing "CREATE TABLE decomputed_column (a INT8 PRIMARY KEY, b INT8 AS (a + 1) STORED, FAMILY \"primary\" (a, b))"
    comparator.go:94: Executing "INSERT INTO decomputed_column VALUES (1), (2)"
    comparator.go:94: Executing "INSERT INTO decomputed_column VALUES (3, NULL), (4, 99)"
    comparator.go:94: Executing "ALTER TABLE decomputed_column ALTER COLUMN b DROP STORED"
    comparator.go:94: Executing "ALTER TABLE decomputed_column ALTER COLUMN a DROP STORED"
    comparator.go:94: Executing "ALTER TABLE decomputed_column ALTER COLUMN b DROP STORED"
    comparator.go:94: Executing "INSERT INTO decomputed_column VALUES (3, NULL), (4, 99)"
    comparator.go:94: Executing "SELECT a, b FROM decomputed_column ORDER BY a"
    comparator.go:94: Executing "SHOW CREATE decomputed_column"
    comparator.go:94: Executing "CREATE TABLE b26483 ()"
    comparator.go:94: Executing "CREATE TABLE audit (x INT8); ALTER TABLE audit EXPERIMENTAL_AUDIT SET READ WRITE"
    comparator.go:94: Executing "SELECT feature_name FROM crdb_internal.feature_usage WHERE feature_name = 'sql.schema.set_audit_mode.read_write'"
    comparator.go:94: Executing "GRANT CREATE ON TABLE audit TO testuser"
    comparator.go:94: Executing "ALTER TABLE audit ADD COLUMN y INT8"
    comparator.go:94: Executing "ALTER TABLE audit EXPERIMENTAL_AUDIT SET OFF"
    comparator.go:94: Executing "ALTER TABLE audit EXPERIMENTAL_AUDIT SET OFF"
    comparator.go:94: Executing "SELECT feature_name FROM crdb_internal.feature_usage WHERE feature_name = 'sql.schema.set_audit_mode.off'"
    comparator.go:94: Executing "CREATE TABLE users (id INT8 NOT NULL, city STRING NOT NULL, name STRING NULL, CONSTRAINT \"primary\" PRIMARY KEY (city ASC, id ASC))"
    comparator.go:94: Executing "CREATE TABLE vehicles (id INT8 NOT NULL, city STRING NOT NULL, type STRING NULL, owner_id INT8 NULL, mycol STRING NULL, CONSTRAINT \"primary\" PRIMARY KEY (city ASC, id ASC), INDEX vehicles_auto_index_fk_city_ref_users (city ASC, owner_id ASC))"
    comparator.go:163: Comparator testing framework modifies line "CREATE TABLE rides (\nid INT NOT NULL,\ncity STRING NOT NULL,\nvehicle_city STRING NULL,\nrider_id INT NULL,\nvehicle_id INT NULL,\nCONSTRAINT \"primary\" PRIMARY KEY (city ASC, id ASC),\nINDEX rides_auto_index_fk_city_ref_users (city ASC, rider_id ASC),\nINDEX rides_auto_index_fk_vehicle_city_ref_vehicles (vehicle_city ASC, vehicle_id ASC),\nCONSTRAINT check_vehicle_city_city CHECK (vehicle_city = city)\n)\n" to "CREATE TABLE rides (id INT8 NOT NULL, city STRING NOT NULL, vehicle_city STRING NULL, rider_id INT8 NULL, vehicle_id INT8 NULL, CONSTRAINT \"primary\" PRIMARY KEY (city ASC, id ASC), INDEX rides_auto_index_fk_city_ref_users (city ASC, rider_id ASC), INDEX rides_auto_index_fk_vehicle_city_ref_vehicles (vehicle_city ASC, vehicle_id ASC), CONSTRAINT check_vehicle_city_city CHECK (vehicle_city = city))"
    comparator.go:94: Executing "CREATE TABLE rides (id INT8 NOT NULL, city STRING NOT NULL, vehicle_city STRING NULL, rider_id INT8 NULL, vehicle_id INT8 NULL, CONSTRAINT \"primary\" PRIMARY KEY (city ASC, id ASC), INDEX rides_auto_index_fk_city_ref_users (city ASC, rider_id ASC), INDEX rides_auto_index_fk_vehicle_city_ref_vehicles (vehicle_city ASC, vehicle_id ASC), CONSTRAINT check_vehicle_city_city CHECK (vehicle_city = city))"
    comparator.go:94: Executing "ALTER TABLE vehicles ADD CONSTRAINT fk_city_ref_users FOREIGN KEY (city, owner_id) REFERENCES users (city, id)"
    comparator.go:94: Executing "ALTER TABLE rides ADD CONSTRAINT fk_city_ref_users FOREIGN KEY (city, rider_id) REFERENCES users (city, id)"
    comparator.go:94: Executing "ALTER TABLE rides ADD CONSTRAINT fk_vehicle_city_ref_vehicles FOREIGN KEY (vehicle_city, vehicle_id) REFERENCES vehicles (city, id)"
    comparator.go:94: Executing "INSERT INTO users VALUES (10, 'lagos', 'chimamanda')"
    comparator.go:94: Executing "INSERT INTO vehicles VALUES (100, 'lagos', 'toyota', 10, 'mycol')"
    comparator.go:94: Executing "INSERT INTO rides VALUES (567, 'lagos', 'lagos', 10, 100)"
    comparator.go:94: Executing "ALTER TABLE vehicles DROP COLUMN mycol"
    comparator.go:94: Executing "CREATE TABLE t32917 (a INT8 PRIMARY KEY)"
    comparator.go:94: Executing "INSERT INTO t32917 VALUES (1), (2), (3)"
    comparator.go:94: Executing "CREATE TABLE t32917_2 (b INT8 PRIMARY KEY)"
    comparator.go:94: Executing "INSERT INTO t32917_2 VALUES (1), (2), (3)"
    comparator.go:94: Executing "CREATE TABLE t (a INT8)"
    comparator.go:94: Executing "INSERT INTO t VALUES (1), (NULL)"
    comparator.go:362: executing statement "ALTER TABLE t ALTER COLUMN a SET NOT NULL" results in different error code: legacy=23514, declarative=23502
    panic.go:523: -- test log scope end --
test logs left over in: /artifacts/tmp/_tmp/b8c66a7706bbaaf1e8c5fcd559a6e764/logTestSchemaChangeComparator_alter_table2417647796
--- FAIL: TestSchemaChangeComparator_alter_table (440.54s)
Help

See also: [How To Investigate a Go Test Failure \(internal\)](https://cockroachlabs.atlassian.net/l/c/HgfXfJgM)

/cc @cockroachdb/sql-foundations

This test on roachdash | Improve this report!

Jira issue: CRDB-32901

cockroach-teamcity commented 7 months ago

pkg/sql/schemachanger/schemachanger_test.TestSchemaChangeComparator_alter_table failed with artifacts on master @ f4f29428d592b5ee2335b0bc65960aecd8d3e47a:

    comparator.go:131: Executing "ALTER TABLE t_cannot_rename_constraint_over_index RENAME CONSTRAINT v_unique TO idx_v"
    comparator.go:131: Executing "ALTER TABLE t_cannot_rename_constraint_over_index RENAME CONSTRAINT t_cannot_rename_constraint_over_index_pkey TO idx_v"
    comparator.go:131: Executing "CREATE TABLE unique_without_index_error (a INT8)"
    comparator.go:131: Executing "SET experimental_enable_unique_without_index_constraints = true"
    comparator.go:131: Executing "CREATE TABLE unique_without_index (a INT8, b INT8 UNIQUE WITHOUT INDEX, c INT8 UNIQUE, d INT8 UNIQUE WITHOUT INDEX, e INT8, UNIQUE WITHOUT INDEX (b), UNIQUE WITHOUT INDEX (a, b), UNIQUE WITHOUT INDEX (c), UNIQUE WITHOUT INDEX (d, e))"
    comparator.go:131: Executing "CREATE TABLE uwi_child (d INT8 REFERENCES unique_without_index (d), e INT8, CONSTRAINT fk_d_e FOREIGN KEY (d, e) REFERENCES unique_without_index (d, e), CONSTRAINT fk_e_d FOREIGN KEY (e, d) REFERENCES unique_without_index (e, d))"
    comparator.go:131: Executing "ALTER TABLE unique_without_index ADD COLUMN f INT8; ALTER TABLE unique_without_index ADD CONSTRAINT my_unique_f UNIQUE WITHOUT INDEX (f); ALTER TABLE unique_without_index ADD CONSTRAINT my_partial_unique_f UNIQUE WITHOUT INDEX (f) WHERE f > 0"
    comparator.go:131: Executing "ALTER TABLE unique_without_index ADD CONSTRAINT bad_partial_unique UNIQUE WITHOUT INDEX (f) WHERE g > 0"
    comparator.go:131: Executing "INSERT INTO unique_without_index(f) VALUES (1), (1)"
    comparator.go:131: Executing "INSERT INTO unique_without_index(e, f) VALUES (1, 1), (1, 2)"
    comparator.go:131: Executing "ALTER TABLE unique_without_index ADD CONSTRAINT my_unique_e UNIQUE WITHOUT INDEX (e)"
    comparator.go:131: Executing "ALTER TABLE unique_without_index ADD CONSTRAINT my_unique_e UNIQUE WITHOUT INDEX (e) NOT VALID; ALTER TABLE unique_without_index ADD CONSTRAINT my_unique_e2 UNIQUE WITHOUT INDEX (e) NOT VALID"
    comparator.go:245: Comparator testing framework modifies line "ALTER TABLE unique_without_index VALIDATE CONSTRAINT my_unique_e" to "" (for legacy) and to "" (for declarative)
    comparator.go:133: Executing "ALTER TABLE unique_without_index VALIDATE CONSTRAINT my_unique_e" with modifications: "" for legacy; "" for declarative
    comparator.go:131: Executing "DELETE FROM unique_without_index WHERE (e = 1) AND (f = 1); ALTER TABLE unique_without_index VALIDATE CONSTRAINT my_unique_e"
    comparator.go:131: Executing "ALTER TABLE unique_without_index VALIDATE CONSTRAINT unique_b; ALTER TABLE unique_without_index VALIDATE CONSTRAINT unique_a_b; ALTER TABLE unique_without_index VALIDATE CONSTRAINT unique_without_index_c_key"
    comparator.go:131: Executing "CREATE TABLE unique_without_index_partial (a INT8, b INT8, c INT8); INSERT INTO unique_without_index_partial VALUES (1, 1, 1), (2, 2, 2), (1, 3, -3), (2, -2, -2), (NULL, 4, 4), (NULL, 5, 5)"
    comparator.go:131: Executing "ALTER TABLE unique_without_index_partial ADD CONSTRAINT uniq_a_1 UNIQUE WITHOUT INDEX (a) WHERE (b > 0) OR (c > 0)"
    comparator.go:131: Executing "SELECT usage_count > $constraint_violations_before\nFROM crdb_internal.feature_usage\nWHERE feature_name = 'sql.schema_changer.errors.constraint_violation';\n"
    comparator.go:131: Executing "SELECT count(usage_count) FROM crdb_internal.feature_usage WHERE (feature_name = 'sql.schema_changer.errors.uncategorized') AND (usage_count >= 1)"
    comparator.go:131: Executing "ALTER TABLE unique_without_index_partial ADD CONSTRAINT uniq_a_1 UNIQUE WITHOUT INDEX (a) WHERE (b > 0) OR (c > 0) NOT VALID"
    comparator.go:245: Comparator testing framework modifies line "ALTER TABLE unique_without_index_partial VALIDATE CONSTRAINT uniq_a_1" to "" (for legacy) and to "" (for declarative)
    comparator.go:133: Executing "ALTER TABLE unique_without_index_partial VALIDATE CONSTRAINT uniq_a_1" with modifications: "" for legacy; "" for declarative
    comparator.go:131: Executing "DELETE FROM unique_without_index_partial WHERE ((a = 1) AND (b = 3)) AND (c = -3); ALTER TABLE unique_without_index_partial VALIDATE CONSTRAINT uniq_a_1"
    comparator.go:131: Executing "ALTER TABLE unique_without_index_partial ADD CONSTRAINT uniq_a_2 UNIQUE WITHOUT INDEX (a) WHERE (b > 0) OR (c > 0)"
    comparator.go:131: Executing "SHOW CONSTRAINTS FROM unique_without_index"
    comparator.go:131: Executing "ALTER TABLE unique_without_index RENAME COLUMN a TO aa"
    comparator.go:131: Executing "ALTER TABLE unique_without_index RENAME CONSTRAINT unique_b_2 TO unique_b_3"
    comparator.go:131: Executing "ALTER TABLE unique_without_index RENAME CONSTRAINT unique_b TO unique_b_1"
    comparator.go:131: Executing "ALTER TABLE unique_without_index RENAME CONSTRAINT unique_b TO unique_b_2"
    comparator.go:131: Executing "SHOW CONSTRAINTS FROM unique_without_index"
    comparator.go:131: Executing "ALTER TABLE unique_without_index DROP CONSTRAINT unique_b"
    comparator.go:131: Executing "ALTER TABLE unique_without_index DROP CONSTRAINT unique_b_2"
    comparator.go:131: Executing "ALTER TABLE unique_without_index DROP CONSTRAINT my_unique_e2"
    comparator.go:131: Executing "SHOW CONSTRAINTS FROM unique_without_index"
    comparator.go:131: Executing "ALTER TABLE unique_without_index DROP COLUMN b"
    comparator.go:131: Executing "SHOW CONSTRAINTS FROM unique_without_index"
    comparator.go:131: Executing "SHOW CONSTRAINTS FROM uwi_child"
    comparator.go:131: Executing "ALTER TABLE unique_without_index DROP COLUMN d"
    comparator.go:131: Executing "ALTER TABLE unique_without_index DROP COLUMN d CASCADE"
    comparator.go:131: Executing "SHOW CONSTRAINTS FROM unique_without_index"
    comparator.go:131: Executing "SHOW CONSTRAINTS FROM uwi_child"
    comparator.go:131: Executing "CREATE TABLE t54629 (c INT8 NOT NULL, UNIQUE (c)); ALTER TABLE t54629 ADD CONSTRAINT pk PRIMARY KEY (c); INSERT INTO t54629 VALUES (1); DELETE FROM t54629 WHERE c = 1"
    comparator.go:131: Executing "BEGIN TRANSACTION; CREATE TABLE t45985 (a INT8); ALTER TABLE t45985 ADD COLUMN b INT8; COMMIT TRANSACTION"
    comparator.go:131: Executing "SELECT count(descriptor_id) FROM (SELECT json_array_elements_text(crdb_internal.pb_to_json('cockroach.sql.jobs.jobspb.Payload', value)->'descriptorIds')::INT8 AS descriptor_id FROM system.job_info WHERE info_key = 'legacy_payload') WHERE descriptor_id = ('test.public.t45985'::REGCLASS)::INT8"
    comparator.go:131: Executing "CREATE TABLE t_col_drop (a INT8)"
    comparator.go:592: statement "ROLLBACK TRANSACTION" failed with declarative schema changer (but succeeded with legacy schema changer): pq: there is no transaction in progress
    panic.go:523: -- test log scope end --
test logs left over in: /artifacts/tmp/_tmp/b8c66a7706bbaaf1e8c5fcd559a6e764/logTestSchemaChangeComparator_alter_table1292247436
--- FAIL: TestSchemaChangeComparator_alter_table (901.53s)
Help

See also: [How To Investigate a Go Test Failure \(internal\)](https://cockroachlabs.atlassian.net/l/c/HgfXfJgM)

This test on roachdash | Improve this report!