Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release-24.3: sqlccl: deflake TestExplainGist when run with concurrent ALTER PK #133342

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/ccl/testccl/sqlccl/explain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ func TestExplainGist(t *testing.T) {
for _, knownErr := range []string{
"invalid datum type given: RECORD, expected RECORD", // #117101
"expected equivalence dependants to be its closure", // #119045
"not in index", // #133129
} {
if strings.Contains(err.Error(), knownErr) {
// Don't fail the test on a set of known errors.
Expand Down
20 changes: 20 additions & 0 deletions pkg/sql/schemachanger/dml_injection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ type testCase struct {
schemaChange string
expectedErr string
skipIssue int
// Optional: If you want a query to run at each stage, you can include it here.
// We don't evaluate the results; we simply assert that the query executes without errors.
query string
}

// Captures testCase before t.Parallel is called.
Expand Down Expand Up @@ -299,6 +302,17 @@ func TestAlterTableDMLInjection(t *testing.T) {
},
schemaChange: "ALTER TABLE tbl ALTER PRIMARY KEY USING COLUMNS (insert_phase_ordinal, operation_phase_ordinal, operation)",
},
{
desc: "alter primary key and replace rowid in PK",
createTable: createTableNoPK,
setup: []string{
"CREATE INDEX i1 ON tbl (val)",
},
// Run a query against the secondary index at each stage.
query: "SELECT operation FROM tbl@i1",
schemaChange: "ALTER TABLE tbl ALTER PRIMARY KEY USING COLUMNS (insert_phase_ordinal, operation_phase_ordinal, operation)",
skipIssue: 133129,
},
{
desc: "alter primary key using columns using hash",
createTable: createTableNoPK,
Expand Down Expand Up @@ -523,6 +537,12 @@ func TestAlterTableDMLInjection(t *testing.T) {
require.Subset(t, expectedResults, actualResults, errorMessage)
require.Subset(t, actualResults, expectedResults, errorMessage)

// If a query is provided, run it without checking the results—just
// ensure it doesn't fail.
if tc.query != "" {
sqlDB.Exec(t, tc.query)
}

for i := 0; i < poIdx; i++ {
insertPO := poSlice[i]
// Verify 1 row is correctly deleted.
Expand Down