You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
changefeedccl: fix incorrect previous values for dropped columns
Previously, when we adjusted when the backfill was emitted for the drop
column under the declarative schema changer when schema_locked was
active, we wound up emitting the previous values incorrectly. What this
meant was that in the Avro format the old and new values would be the
same when a column was being dropped. This was observed by the
cdc/schemareg test. To address this, this patch correctly resolves the
previous values in the drop column case from the last descriptor
version.
Fixes: #150540
Release note: None
Copy file name to clipboardExpand all lines: pkg/ccl/changefeedccl/cdcevent/event_test.go
+47-12Lines changed: 47 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ package cdcevent
8
8
import (
9
9
"context"
10
10
"fmt"
11
+
"slices"
11
12
"sync/atomic"
12
13
"testing"
13
14
@@ -173,7 +174,6 @@ CREATE TABLE foo (
173
174
FAMILY main (a, b, e),
174
175
FAMILY only_c (c)
175
176
)`)
176
-
177
177
for_, tc:=range []struct {
178
178
schemaChangestring
179
179
// Each new primary index generated during the test will pause at each stage
@@ -210,16 +210,21 @@ CREATE TABLE foo (
210
210
expectedUDTCols: [][]string{{"e"}, {"e"}, {"e"}},
211
211
},
212
212
{
213
-
// We are going to execute a mix of add, drop and alter primary key operations,
213
+
// We are going to execute a mix of add, drop and alter primary key operations;
214
214
// this will result in 3 primary indexes being swapped.
215
-
// 1) The first primary index key will be the same as previous test
215
+
// 1) The first primary index key will be the same as the previous test
216
216
// 2) The second primary key will use the column "a", without a hash
217
217
// sharding column since that needs to be created next.
218
-
// 3) The final primary key will "a" and have hash sharding on it.
218
+
// 3) The final primary key will "a" and have hash sharding on it (repeated
219
+
// for the column removal).
220
+
// The values stored will have the following transitions:
221
+
// 1) Existing columns in the table
222
+
// 2) New column j added (repeated for the final PK switch)
223
+
// 3) Old column b removed (final state)
219
224
schemaChange: "ALTER TABLE foo ADD COLUMN j INT DEFAULT 32, DROP COLUMN d, DROP COLUMN crdb_internal_a_b_shard_16, DROP COLUMN b, ALTER PRIMARY KEY USING COLUMNS(a) USING HASH",
0 commit comments