Skip to content

Commit

Permalink
[#23094] YSQL: Fix flaky test TestPgRegressFeaturePartition
Browse files Browse the repository at this point in the history
Summary:
The test became flaky after commit 7c8343d fixed the logic for cascaded drops on columns.

The test yb_feature_hash_types creates a domain and creates a table with a key column that has the domain as its type. However, since we currently don't support key column drops (#22902), the test fails when the cleanUpCustomEntities() function in BasePgSQLTest.java attempts to drop the domain (that has the key column as a dependant object) during cleanup.
Moreover, the test is flaky because sometimes the table may be dropped before the domain, as the order of the drops depends on the pg_depend scan output, which isn't deterministic because pg_depend doesn't have a primary key and internally uses ybctid.

Fix the test flakiness by dropping the table in yb_feature_hash_types before the test clean up logic.
Jira: DB-12029

Test Plan: ./yb_build.sh --java-test 'org.yb.pgsql.TestPgRegressFeaturePartition' -n 20

Reviewers: myang

Reviewed By: myang

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D36329
  • Loading branch information
fizaaluthra committed Jul 4, 2024
1 parent 9d54ca0 commit b81dbaa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ ERROR: PRIMARY KEY containing column of type 'user_defined_type' not yet suppor
-- Domain Types
CREATE DOMAIN feature_h_domain AS INTEGER CHECK (VALUE > 0);
CREATE TABLE ft_h_tab_domain (feature_col feature_h_domain PRIMARY KEY);
-- YB(fizaa): Work-around for the test cleanup code that drops the domain.
-- Dropping the domain will cause an error because a key column depends on it (GH #22902).
-- By dropping the table now, the clean up code will succeed.
DROP TABLE ft_h_tab_domain;
--
-- Object Identifier Types
CREATE TABLE ft_h_tab_oid (feature_col OID PRIMARY KEY);
Expand Down
4 changes: 4 additions & 0 deletions src/postgres/src/test/regress/sql/yb_feature_hash_types.sql
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ CREATE TABLE ft_h_tab_range (feature_col feature_h_range PRIMARY KEY);
-- Domain Types
CREATE DOMAIN feature_h_domain AS INTEGER CHECK (VALUE > 0);
CREATE TABLE ft_h_tab_domain (feature_col feature_h_domain PRIMARY KEY);
-- YB(fizaa): Work-around for the test cleanup code that drops the domain.
-- Dropping the domain will cause an error because a key column depends on it (GH #22902).
-- By dropping the table now, the clean up code will succeed.
DROP TABLE ft_h_tab_domain;
--
-- Object Identifier Types
CREATE TABLE ft_h_tab_oid (feature_col OID PRIMARY KEY);
Expand Down

0 comments on commit b81dbaa

Please sign in to comment.