Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/common/event/ddl_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ type DDLEvent struct {
// to ensure the new truncated table can be handled correctly.
// If the DDL involves multiple tables, this field is not effective.
// The multiple table DDL event will be handled by filtering querys and table infos.
// NOTE: The `msg` tag is a legacy tag kept for backward compatibility.
// DDLEventVersion1 still marshals the struct with encoding/json, so changing this
// field to `json:"not_sync"` would change the wire key from `NotSync` to
// `not_sync` and break mixed-version DDLEvent interoperability.
NotSync bool `msg:"not_sync"`
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/common/event/ddl_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func TestDDLEvent(t *testing.T) {
Query: ddlJob.Query,
TableInfo: common.WrapTableInfo(ddlJob.SchemaName, ddlJob.BinlogInfo.TableInfo),
FinishedTs: ddlJob.BinlogInfo.FinishedTS,
// NotSync must survive Marshal/Unmarshal because it controls whether dispatchers
// should forward this DDL to downstream sinks.
NotSync: true,
BlockedTableNames: []SchemaTableName{
{SchemaName: ddlJob.SchemaName, TableName: ddlJob.TableName},
},
Expand Down Expand Up @@ -78,6 +81,7 @@ func TestDDLEvent(t *testing.T) {
require.Equal(t, ddlEvent.FinishedTs, reverseEvent.FinishedTs)
require.Equal(t, ddlEvent.Err, reverseEvent.Err)
require.Equal(t, ddlEvent.BlockedTableNames, reverseEvent.BlockedTableNames)
require.Equal(t, ddlEvent.NotSync, reverseEvent.NotSync)

// Test unsupported version in Marshal
mockDDLVersion1 := 99
Expand Down
Loading