Skip to content

Commit f1ddc3b

Browse files
committed
crosscluster/logical: check LDR is disallowed on tables with hash sharded index
Epic: none Release note: none
1 parent 77c11b1 commit f1ddc3b

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
@@ -2528,8 +2528,16 @@ func TestLogicalReplicationCreationChecks(t *testing.T) {
25282528
expectErr(t, "tab", "cannot create logical replication stream: table tab has a partial index partial_idx")
25292529
replicationtestutils.WaitForAllProducerJobsToFail(t, dbB)
25302530

2531-
// Check for virtual computed columns that are a key of a secondary index.
2531+
// Check for hash sharded indexes.
25322532
dbA.Exec(t, "DROP INDEX partial_idx")
2533+
dbA.Exec(t, "CREATE INDEX hash_idx ON tab(pk) USING HASH WITH (bucket_count = 4)")
2534+
dbB.Exec(t, "CREATE INDEX hash_idx ON b.tab(pk) USING HASH WITH (bucket_count = 4)")
2535+
expectErr(t, "tab", "tab has a virtual computed column crdb_internal_pk_shard_4 that is a key of index hash_idx")
2536+
replicationtestutils.WaitForAllProducerJobsToFail(t, dbB)
2537+
dbA.Exec(t, "DROP INDEX hash_idx")
2538+
dbB.Exec(t, "DROP INDEX hash_idx")
2539+
2540+
// Check for virtual computed columns that are a key of a secondary index.
25332541
dbA.Exec(t, "ALTER TABLE tab ADD COLUMN virtual_col INT NOT NULL AS (pk + 1) VIRTUAL")
25342542
dbB.Exec(t, "ALTER TABLE b.tab ADD COLUMN virtual_col INT NOT NULL AS (pk + 1) VIRTUAL")
25352543
dbA.Exec(t, "CREATE INDEX virtual_col_idx ON tab(virtual_col)")

0 commit comments

Comments
 (0)