Skip to content

Commit d456108

Browse files
committed
add more code
1 parent ce6cc6e commit d456108

4 files changed

Lines changed: 5 additions & 31 deletions

File tree

‎downstreamadapter/dispatchermanager/dispatcher_manager_test.go‎

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,16 @@ func newDispatcherManagerTestSink(t *testing.T, sinkType common.SinkType) sink.S
6363

6464
// createTestDispatcher creates a test dispatcher with given parameters
6565
func createTestDispatcher(t *testing.T, manager *DispatcherManager, id common.DispatcherID, tableID int64, startKey, endKey []byte) *dispatcher.EventDispatcher {
66+
t.Helper()
67+
6668
span := &heartbeatpb.TableSpan{
6769
TableID: tableID,
6870
StartKey: startKey,
6971
EndKey: endKey,
7072
}
7173
var redoTs atomic.Uint64
7274
redoTs.Store(math.MaxUint64)
73-
defaultAtomicity := config.DefaultAtomicityLevel()
74-
sharedInfo := dispatcher.NewSharedInfo(
75-
manager.changefeedID,
76-
"system",
77-
false,
78-
false,
79-
false,
80-
nil,
81-
nil,
82-
nil,
83-
&defaultAtomicity,
84-
false,
85-
routing.Router{},
86-
0,
87-
0,
88-
make(chan dispatcher.TableSpanStatusWithSeq, 1),
89-
make(chan *heartbeatpb.TableSpanBlockStatus, 1),
90-
make(chan error, 1),
91-
)
75+
require.NotNil(t, manager.sharedInfo)
9276
d := dispatcher.NewEventDispatcher(
9377
id,
9478
span,
@@ -99,7 +83,7 @@ func createTestDispatcher(t *testing.T, manager *DispatcherManager, id common.Di
9983
false, // skipDMLAsStartTs
10084
0, // currentPDTs
10185
manager.sink,
102-
sharedInfo,
86+
manager.sharedInfo,
10387
false,
10488
&redoTs,
10589
)
File renamed without changes.
File renamed without changes.

‎pkg/common/event/redo.go‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,8 @@ func (r *RedoDMLEvent) ToDMLEvent() *DMLEvent {
354354
indexInfo.Primary = isPrimary
355355
tidbTableInfo.Indices = append(tidbTableInfo.Indices, indexInfo)
356356
}
357-
tableInfo := common.NewTableInfo4Decoder(r.Row.Table.Schema, tidbTableInfo)
358-
// Restore routing info from redo log (TargetSchema/TargetTable for table routing).
359-
// We must use CloneWithRouting because NewTableInfo4Decoder already called InitPrivateFields()
360-
// which pre-computed SQL statements using the source schema/table. CloneWithRouting creates
361-
// a new TableInfo with routing applied and uninitialized preSQLs that will be computed
362-
// correctly when InitPrivateFields() is called.
363-
if r.Row.Table.TargetSchema != "" || r.Row.Table.TargetTable != "" {
364-
tableInfo = tableInfo.CloneWithRouting(r.Row.Table.TargetSchema, r.Row.Table.TargetTable)
365-
tableInfo.InitPrivateFields()
366-
}
367357
event := &DMLEvent{
368-
TableInfo: tableInfo,
358+
TableInfo: common.NewTableInfo4Decoder(r.Row.Table.Schema, tidbTableInfo),
369359
CommitTs: r.Row.CommitTs,
370360
StartTs: r.Row.StartTs,
371361
Length: 1,

0 commit comments

Comments
 (0)