-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
online DDL affect Binlog #9304
Comments
Why do we have to populate the value of the new column in tidb? Version compatibility decide it. think
Unless we can guarantee that they are exactly the same |
TiDB will fill the column default value if the column is write_only or not specify by user. So I think after binlog syncer, binlog server no need (and shouldn't) to fill the default value. |
nice, what about |
TiDB will fill default value if column in public or write_only, otherwise(in delete only or none), TiDB won't fill default value. So in |
so we don't need change anything, and do you have any problem with alove solution |
see issue pingcap/tidb#9304
how about now? @crazycs520 |
I have considered all conceivable DDL that I can think of. I think there is no problem in the issue described.
|
According to my test, there's two problem if we get data from DML Binlog and use the newest Schema receive by DDL Binlog
if the column's default value is null, and the value equals to that, this column will not be be write into Binlog;https://github.com/pingcap/tidb/blob/master/table/tables/tables.go#L1015
this issue exist even before change the way to write DDL Binlog at #9207 as a example, for drop column c1
it's tricky for DML0 before the DDL, for table with primary key or unique index, it's ok to use default value as the column value, because the column will be dropped later, and we will not use the column as For simpleness, we decide to fill the column value in such way.
|
see issue pingcap/tidb#9304 we drop the truncated table dml data.
see issue pingcap/tidb#9304 skip the truncated table DML data. refactor some translator code in ./drainer add some ddl test case change tests/run.sh to be easy start multi instance TiDB for test
see issue pingcap/tidb#9304 skip the truncated table DML data. refactor some translator code in ./drainer add some ddl test case change tests/run.sh to be easy start multi instance TiDB for test
see issue pingcap/tidb#9304 skip the truncated table DML data. refactor some translator code in ./drainer add some ddl test case change tests/run.sh to be easy start multi instance TiDB for test
see issue pingcap/tidb#9304 skip the truncated table DML data. refactor some translator code in ./drainer add some ddl test case change tests/run.sh to be easy start multi instance TiDB for test
@zimulala @crazycs520 Does #9207 fix this issue? if yes, close this issue, Pls. |
About the issue
this pr #9207 fix the issue TOOL-881 (internel only)
the issue is like we may get the following sequence Binlog after sorting by commit TS
the insert into test1.test will fail to execute at downstream, because we having not execute the create table DDL at downstream yet.
New issue introduced
#9207
fix this issue, but introduce another problem. That is we may receive the old SchemaVersion DML after we have execute the DDL at downstream(with multi TiDB instances).
like:
this means we must handle the case with one older SchemaVersion DML
for different DDL.
How to handle for different DDL
drop table/db
public -> write-only -> delete-only - None
ok - will not get old SchemaVersion DML (the table/db is not visible at delete-only schema state
create table/db
None -> Public
ok - will not get old SchemaVersion DML (having not this table/db yet)
add index/column (index take no effect, just consider column)
None -> delete-only -> write-only -> public
TiDB should make sure the old schema version DML will write the added column value at write-only(or should be write-reorganization) schema state, so we can get this column value while syncing to downstream.
drop index/column (index take no effect, just consider column)
public -> write-only -> delete-only -> None
ok - the old SchemaVersion at delete-only can or can not write the drop column to Binlog, if it writes to Binlog, we can just ignore this column.
modify column
currently no intermediate schema state, just change meta info.
the older schema version DML can always write to the table with new schema version
(may be change if we support change column type later)
truncate table
no intermediate schema state,TiDB will use a new table id and GC the old table id data after DDL job is synced。
After truncate table at downstream we may receive the old schema version DML(with old table id), we must discard this DML.
rename table
no intermediate schema state
For example: RENAME TABLE a TO b, we must change name from a to b before sync to downstream.
…
conclusion
The text was updated successfully, but these errors were encountered: