Skip to content

Commit 847d91d

Browse files
craig[bot]msbutler
andcommitted
Merge #144322
144322: crosscluster/logical: check LDR is disallowed on tables with hash sharded index r=jeffswenson a=msbutler Epic: none Release note: none Co-authored-by: Michael Butler <[email protected]>
2 parents 8de0ae6 + f1ddc3b commit 847d91d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/crosscluster/logical/logical_replication_job_test.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2550,8 +2550,16 @@ func TestLogicalReplicationCreationChecks(t *testing.T) {
25502550
expectErr(t, "tab", "cannot create logical replication stream: table tab has a partial index partial_idx")
25512551
replicationtestutils.WaitForAllProducerJobsToFail(t, dbB)
25522552

2553-
// Check for virtual computed columns that are a key of a secondary index.
2553+
// Check for hash sharded indexes.
25542554
dbA.Exec(t, "DROP INDEX partial_idx")
2555+
dbA.Exec(t, "CREATE INDEX hash_idx ON tab(pk) USING HASH WITH (bucket_count = 4)")
2556+
dbB.Exec(t, "CREATE INDEX hash_idx ON b.tab(pk) USING HASH WITH (bucket_count = 4)")
2557+
expectErr(t, "tab", "tab has a virtual computed column crdb_internal_pk_shard_4 that is a key of index hash_idx")
2558+
replicationtestutils.WaitForAllProducerJobsToFail(t, dbB)
2559+
dbA.Exec(t, "DROP INDEX hash_idx")
2560+
dbB.Exec(t, "DROP INDEX hash_idx")
2561+
2562+
// Check for virtual computed columns that are a key of a secondary index.
25552563
dbA.Exec(t, "ALTER TABLE tab ADD COLUMN virtual_col INT NOT NULL AS (pk + 1) VIRTUAL")
25562564
dbB.Exec(t, "ALTER TABLE b.tab ADD COLUMN virtual_col INT NOT NULL AS (pk + 1) VIRTUAL")
25572565
dbA.Exec(t, "CREATE INDEX virtual_col_idx ON tab(virtual_col)")

0 commit comments

Comments
 (0)