@@ -33,8 +33,8 @@ func TestOneBlockEvent(t *testing.T) {
33
33
controller := NewController ("test" , 1 , nil , nil , nil , nil , 1000 , 0 )
34
34
controller .AddNewTable (commonEvent.Table {SchemaID : 1 , TableID : 1 }, 0 )
35
35
stm := controller .GetTasksByTableIDs (1 )[0 ]
36
- controller .db .BindSpanToNode ("" , "node1" , stm )
37
- controller .db .MarkSpanReplicating (stm )
36
+ controller .replicationDB .BindSpanToNode ("" , "node1" , stm )
37
+ controller .replicationDB .MarkSpanReplicating (stm )
38
38
barrier := NewBarrier (controller )
39
39
msg := barrier .HandleStatus ("node1" , & heartbeatpb.BlockStatusRequest {
40
40
ChangefeedID : "test" ,
@@ -101,14 +101,14 @@ func TestNormalBlock(t *testing.T) {
101
101
controller .AddNewTable (commonEvent.Table {SchemaID : 1 , TableID : int64 (id )}, 0 )
102
102
stm := controller .GetTasksByTableIDs (int64 (id ))[0 ]
103
103
blockedDispatcherIDS = append (blockedDispatcherIDS , stm .ID .ToPB ())
104
- controller .db .BindSpanToNode ("" , "node1" , stm )
105
- controller .db .MarkSpanReplicating (stm )
104
+ controller .replicationDB .BindSpanToNode ("" , "node1" , stm )
105
+ controller .replicationDB .MarkSpanReplicating (stm )
106
106
}
107
107
108
108
// the last one is the writer
109
109
var selectDispatcherID = common .NewDispatcherIDFromPB (blockedDispatcherIDS [2 ])
110
110
selectedRep := controller .GetTask (selectDispatcherID )
111
- controller .db .BindSpanToNode ("node1" , "node2" , selectedRep )
111
+ controller .replicationDB .BindSpanToNode ("node1" , "node2" , selectedRep )
112
112
dropID := selectedRep .Span .TableID
113
113
114
114
newSpan := & heartbeatpb.Table {TableID : 10 , SchemaID : 1 }
@@ -284,13 +284,13 @@ func TestSchemaBlock(t *testing.T) {
284
284
controller .AddNewTable (commonEvent.Table {SchemaID : 2 , TableID : 3 }, 1 )
285
285
var dispatcherIDs []* heartbeatpb.DispatcherID
286
286
var dropTables = []int64 {1 , 2 }
287
- absents , _ := controller .db .GetScheduleSate (make ([]* replica.SpanReplication , 0 ), 100 )
287
+ absents , _ := controller .replicationDB .GetScheduleSate (make ([]* replica.SpanReplication , 0 ), 100 )
288
288
for _ , stm := range absents {
289
- if stm .SchemaID == 1 {
289
+ if stm .GetSchemaID () == 1 {
290
290
dispatcherIDs = append (dispatcherIDs , stm .ID .ToPB ())
291
291
}
292
- controller .db .BindSpanToNode ("" , "node1" , stm )
293
- controller .db .MarkSpanReplicating (stm )
292
+ controller .replicationDB .BindSpanToNode ("" , "node1" , stm )
293
+ controller .replicationDB .MarkSpanReplicating (stm )
294
294
}
295
295
296
296
newTable := & heartbeatpb.Table {TableID : 10 , SchemaID : 2 }
@@ -412,17 +412,17 @@ func TestSchemaBlock(t *testing.T) {
412
412
require .Len (t , barrier .blockedTs , 1 )
413
413
// the writer already advanced
414
414
require .Len (t , event .reportedDispatchers , 1 )
415
- require .Equal (t , 1 , controller .db .GetAbsentSize ())
416
- require .Equal (t , 2 , controller .oc .OperatorSize ())
415
+ require .Equal (t , 1 , controller .replicationDB .GetAbsentSize ())
416
+ require .Equal (t , 2 , controller .operatorController .OperatorSize ())
417
417
// two dispatcher and moved to operator queue, operator will be removed after ack
418
- require .Equal (t , 3 , controller .db .GetReplicatingSize ())
419
- for _ , task := range controller .db .GetReplicating () {
420
- op := controller .oc .GetOperator (task .ID )
418
+ require .Equal (t , 3 , controller .replicationDB .GetReplicatingSize ())
419
+ for _ , task := range controller .replicationDB .GetReplicating () {
420
+ op := controller .operatorController .GetOperator (task .ID )
421
421
if op != nil {
422
422
op .PostFinish ()
423
423
}
424
424
}
425
- require .Equal (t , 1 , controller .db .GetReplicatingSize ())
425
+ require .Equal (t , 1 , controller .replicationDB .GetReplicatingSize ())
426
426
427
427
// other dispatcher advanced checkpoint ts
428
428
msg = barrier .HandleStatus ("node1" , & heartbeatpb.BlockStatusRequest {
@@ -455,15 +455,15 @@ func TestSyncPointBlock(t *testing.T) {
455
455
controller .AddNewTable (commonEvent.Table {SchemaID : 2 , TableID : 3 }, 1 )
456
456
var dispatcherIDs []* heartbeatpb.DispatcherID
457
457
var dropTables = []int64 {1 , 2 , 3 }
458
- absents , _ := controller .db .GetScheduleSate (make ([]* replica.SpanReplication , 0 ), 10000 )
458
+ absents , _ := controller .replicationDB .GetScheduleSate (make ([]* replica.SpanReplication , 0 ), 10000 )
459
459
for _ , stm := range absents {
460
460
dispatcherIDs = append (dispatcherIDs , stm .ID .ToPB ())
461
- controller .db .BindSpanToNode ("" , "node1" , stm )
462
- controller .db .MarkSpanReplicating (stm )
461
+ controller .replicationDB .BindSpanToNode ("" , "node1" , stm )
462
+ controller .replicationDB .MarkSpanReplicating (stm )
463
463
}
464
464
var selectDispatcherID = common .NewDispatcherIDFromPB (dispatcherIDs [2 ])
465
465
selectedRep := controller .GetTask (selectDispatcherID )
466
- controller .db .BindSpanToNode ("node1" , "node2" , selectedRep )
466
+ controller .replicationDB .BindSpanToNode ("node1" , "node2" , selectedRep )
467
467
468
468
newSpan := & heartbeatpb.Table {TableID : 10 , SchemaID : 2 }
469
469
barrier := NewBarrier (controller )
@@ -631,7 +631,7 @@ func TestNonBlocked(t *testing.T) {
631
631
require .True (t , heartbeatpb .InfluenceType_Normal == resp .DispatcherStatuses [0 ].InfluencedDispatchers .InfluenceType )
632
632
require .Equal (t , resp .DispatcherStatuses [0 ].InfluencedDispatchers .DispatcherIDs [0 ], blockedDispatcherIDS [0 ])
633
633
require .Len (t , barrier .blockedTs , 0 )
634
- require .Equal (t , 2 , barrier .controller .db .GetAbsentSize (), 2 )
634
+ require .Equal (t , 2 , barrier .controller .replicationDB .GetAbsentSize (), 2 )
635
635
}
636
636
637
637
func TestSyncPointBlockPerf (t * testing.T ) {
@@ -642,10 +642,10 @@ func TestSyncPointBlockPerf(t *testing.T) {
642
642
controller .AddNewTable (commonEvent.Table {SchemaID : 1 , TableID : int64 (id )}, 1 )
643
643
}
644
644
var dispatcherIDs []* heartbeatpb.DispatcherID
645
- absent , _ := controller .db .GetScheduleSate (make ([]* replica.SpanReplication , 0 ), 10000 )
645
+ absent , _ := controller .replicationDB .GetScheduleSate (make ([]* replica.SpanReplication , 0 ), 10000 )
646
646
for _ , stm := range absent {
647
- controller .db .BindSpanToNode ("" , "node1" , stm )
648
- controller .db .MarkSpanReplicating (stm )
647
+ controller .replicationDB .BindSpanToNode ("" , "node1" , stm )
648
+ controller .replicationDB .MarkSpanReplicating (stm )
649
649
dispatcherIDs = append (dispatcherIDs , stm .ID .ToPB ())
650
650
}
651
651
var blockStatus []* heartbeatpb.TableSpanBlockStatus
0 commit comments