forked from pingcap/tiflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an automated cherry-pick of pingcap#11224
Signed-off-by: ti-chi-bot <[email protected]>
- Loading branch information
1 parent
bcb2bd3
commit c7b4c65
Showing
4 changed files
with
318 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,11 @@ import ( | |
"github.com/pingcap/log" | ||
"github.com/pingcap/tiflow/cdc/entry" | ||
"github.com/pingcap/tiflow/cdc/model" | ||
<<<<<<< HEAD | ||
======= | ||
"github.com/pingcap/tiflow/cdc/processor/sinkmanager" | ||
"github.com/pingcap/tiflow/cdc/processor/sourcemanager" | ||
>>>>>>> f1d2ee62f8 (puller(ticdc): always split update kv entries in sink safe mode (#11224)) | ||
"github.com/pingcap/tiflow/cdc/processor/tablepb" | ||
"github.com/pingcap/tiflow/cdc/redo" | ||
"github.com/pingcap/tiflow/cdc/scheduler" | ||
|
@@ -35,6 +40,7 @@ import ( | |
"github.com/pingcap/tiflow/pkg/etcd" | ||
"github.com/pingcap/tiflow/pkg/orchestrator" | ||
"github.com/pingcap/tiflow/pkg/upstream" | ||
"github.com/pingcap/tiflow/pkg/util" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
|
@@ -627,3 +633,73 @@ func TestProcessorLiveness(t *testing.T) { | |
*p.agent.(*mockAgent).liveness = model.LivenessCaptureAlive | ||
require.Equal(t, model.LivenessCaptureAlive, p.liveness.Load()) | ||
} | ||
|
||
func TestGetPullerSplitUpdateMode(t *testing.T) { | ||
testCases := []struct { | ||
sinkURI string | ||
config *config.ReplicaConfig | ||
mode sourcemanager.PullerSplitUpdateMode | ||
}{ | ||
{ | ||
sinkURI: "kafka://127.0.0.1:9092/ticdc-test2", | ||
config: nil, | ||
mode: sourcemanager.PullerSplitUpdateModeNone, | ||
}, | ||
{ | ||
sinkURI: "mysql://root:[email protected]:3306/", | ||
config: nil, | ||
mode: sourcemanager.PullerSplitUpdateModeAtStart, | ||
}, | ||
{ | ||
sinkURI: "mysql://root:[email protected]:3306/?safe-mode=true", | ||
config: nil, | ||
mode: sourcemanager.PullerSplitUpdateModeAlways, | ||
}, | ||
{ | ||
sinkURI: "mysql://root:[email protected]:3306/?safe-mode=false", | ||
config: nil, | ||
mode: sourcemanager.PullerSplitUpdateModeAtStart, | ||
}, | ||
{ | ||
sinkURI: "mysql://root:[email protected]:3306/", | ||
config: &config.ReplicaConfig{ | ||
Sink: &config.SinkConfig{ | ||
SafeMode: util.AddressOf(true), | ||
}, | ||
}, | ||
mode: sourcemanager.PullerSplitUpdateModeAlways, | ||
}, | ||
{ | ||
sinkURI: "mysql://root:[email protected]:3306/", | ||
config: &config.ReplicaConfig{ | ||
Sink: &config.SinkConfig{ | ||
SafeMode: util.AddressOf(false), | ||
}, | ||
}, | ||
mode: sourcemanager.PullerSplitUpdateModeAtStart, | ||
}, | ||
{ | ||
sinkURI: "mysql://root:[email protected]:3306/?safe-mode=true", | ||
config: &config.ReplicaConfig{ | ||
Sink: &config.SinkConfig{ | ||
SafeMode: util.AddressOf(false), | ||
}, | ||
}, | ||
mode: sourcemanager.PullerSplitUpdateModeAlways, | ||
}, | ||
{ | ||
sinkURI: "mysql://root:[email protected]:3306/?safe-mode=false", | ||
config: &config.ReplicaConfig{ | ||
Sink: &config.SinkConfig{ | ||
SafeMode: util.AddressOf(true), | ||
}, | ||
}, | ||
mode: sourcemanager.PullerSplitUpdateModeAlways, | ||
}, | ||
} | ||
for _, tc := range testCases { | ||
mode, err := getPullerSplitUpdateMode(tc.sinkURI, tc.config) | ||
require.Nil(t, err) | ||
require.Equal(t, tc.mode, mode) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.