Skip to content

Commit 026f98a

Browse files
craig[bot]andyyang890
andcommitted
Merge #150215
150215: changefeedccl: fix TestNoBackfillAfterNonTargetColumnDrop r=aerfrei,asg0451 a=andyyang890 This patch fixes `TestNoBackfillAfterNonTargetColumnDrop` so that it actually checks that no backfills occur after a non-target column drop. Fixes #150214 Release note: None Co-authored-by: Andy Yang <[email protected]>
2 parents ab6ffc2 + c9343f7 commit 026f98a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

pkg/ccl/changefeedccl/changefeed_test.go

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,9 +1905,9 @@ func TestNoStopAfterNonTargetColumnDrop(t *testing.T) {
19051905

19061906
// Check that dropping a watched column still stops the changefeed.
19071907
sqlDB.Exec(t, `ALTER TABLE hasfams DROP COLUMN b`)
1908-
if _, err := cf.Next(); !testutils.IsError(err, `schema change occurred at`) {
1909-
require.Regexp(t, `expected "schema change occurred at ..." got: %+v`, err)
1910-
}
1908+
msg, err := cf.Next()
1909+
require.True(t, testutils.IsError(err, `schema change occurred at`),
1910+
`expected "schema change occurred at ..." got: msg=%s, err=%+v`, msg, err)
19111911
}
19121912

19131913
runWithAndWithoutRegression141453(t, testFn, func(t *testing.T, testFn cdcTestFn) {
@@ -2003,27 +2003,32 @@ func TestNoBackfillAfterNonTargetColumnDrop(t *testing.T) {
20032003
}
20042004

20052005
// Open up the changefeed.
2006-
cf := feed(t, f, `CREATE CHANGEFEED FOR TABLE hasfams FAMILY b_and_c`, args...)
2006+
// We specify `updated` so that identical messages with different timestamps
2007+
// aren't filtered out as duplicates. The appearance of such messages would
2008+
// indicate that a backfill did happen even though it should not have.
2009+
cf := feed(t, f, `CREATE CHANGEFEED FOR TABLE hasfams FAMILY b_and_c WITH updated`, args...)
20072010
defer closeFeed(t, cf)
2008-
assertPayloads(t, cf, []string{
2011+
assertPayloadsStripTs(t, cf, []string{
20092012
`hasfams.b_and_c: [0]->{"after": {"b": "b", "c": "c"}}`,
20102013
})
20112014

20122015
sqlDB.Exec(t, `ALTER TABLE hasfams DROP COLUMN a`)
20132016
sqlDB.Exec(t, `INSERT INTO hasfams VALUES (1, 'b1', 'c1')`)
2014-
assertPayloads(t, cf, []string{
2017+
assertPayloadsStripTs(t, cf, []string{
20152018
`hasfams.b_and_c: [1]->{"after": {"b": "b1", "c": "c1"}}`,
20162019
})
20172020

20182021
// Check that dropping a watched column still backfills.
20192022
sqlDB.Exec(t, `ALTER TABLE hasfams DROP COLUMN c`)
2020-
assertPayloads(t, cf, []string{
2023+
assertPayloadsStripTs(t, cf, []string{
20212024
`hasfams.b_and_c: [0]->{"after": {"b": "b"}}`,
20222025
`hasfams.b_and_c: [1]->{"after": {"b": "b1"}}`,
20232026
})
20242027
}
20252028

2026-
cdcTest(t, testFn)
2029+
runWithAndWithoutRegression141453(t, testFn, func(t *testing.T, testFn cdcTestFn) {
2030+
cdcTest(t, testFn)
2031+
})
20272032
}
20282033

20292034
func TestChangefeedColumnDropsWithFamilyAndNonFamilyTargets(t *testing.T) {

0 commit comments

Comments
 (0)