Skip to content

Commit 1b5481c

Browse files
1 parent 0ef8fe7 commit 1b5481c

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/mysql-util/src/desc.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ impl MySqlTableDesc {
101101
// If we do have full metadata, then we can match columns by name and just check that all
102102
// columns in `self.columns` are present and compatible with columns in `other.columns`.
103103
let mut other_columns = other.columns.iter();
104-
for self_column in &self.columns {
104+
for self_column in self.columns.iter().filter(|col| col.column_type.is_some()) {
105105
let other_column = if full_metadata {
106-
other_columns
107-
.by_ref()
106+
other
107+
.columns
108+
.iter()
108109
.find(|c| c.name == self_column.name)
109110
.ok_or_else(|| {
110111
anyhow::anyhow!(

test/mysql-cdc/upstream-schema-changes.td

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,18 @@ f fig
103103
# dropping an excluded column should have no effect
104104
$ mysql-execute name=mysql
105105
ALTER TABLE foo DROP COLUMN meta_col;
106+
INSERT INTO foo VALUES ('g', 'grape');
106107

108+
# The INSERT after the DROP COLUMN forces the binlog to advance past the ALTER
109+
# TABLE event, so the SELECT must succeed after the schema change is processed.
107110
> SELECT * FROM foo3;
108111
a apple
109112
b banana
110113
c cherry
111114
d date
112115
e elderberry
113116
f fig
117+
g grape
114118

115119
> DROP TABLE foo3;
116120

@@ -123,9 +127,10 @@ c cherry
123127
d date
124128
e elderberry
125129
f fig
130+
g grape
126131

127132
$ mysql-execute name=mysql
128-
INSERT INTO foo VALUES ('g', 'grape');
133+
INSERT INTO foo VALUES ('h', 'honeydew');
129134

130135
> SELECT * FROM foo4;
131136
a apple
@@ -158,16 +163,23 @@ b banana 7
158163

159164
$ mysql-execute name=mysql
160165
ALTER TABLE bar DROP COLUMN meta_col;
166+
INSERT INTO bar VALUES ('c', 'cherry', 9, 'grove');
161167

168+
# The INSERT after the DROP COLUMN forces the binlog to advance past the ALTER
169+
# TABLE event, so the SELECT must succeed after the schema change is processed.
162170
> SELECT * FROM bar1;
163171
a apple 5
164172
b banana 7
173+
c cherry 9
165174

166175
$ mysql-execute name=mysql
167176
ALTER TABLE bar ADD COLUMN lastname VARCHAR(16) AFTER `name`;
177+
INSERT INTO bar VALUES ('d', 'date_lastname', 'date', 10, 'oasis');
168178

169179
> SELECT * FROM bar1;
170180
a apple 5
171181
b banana 7
182+
c cherry 9
183+
d date 10
172184

173185
> DROP SOURCE mysql_src CASCADE;

0 commit comments

Comments
 (0)