-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
puller(ticdc): always split update kv entries in sink safe mode (#11224…
- Loading branch information
1 parent
92c1bbd
commit c6bfe85
Showing
4 changed files
with
185 additions
and
28 deletions.
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 |
---|---|---|
|
@@ -29,6 +29,7 @@ import ( | |
"github.com/pingcap/tiflow/cdc/entry/schema" | ||
"github.com/pingcap/tiflow/cdc/model" | ||
"github.com/pingcap/tiflow/cdc/processor/sinkmanager" | ||
"github.com/pingcap/tiflow/cdc/processor/sourcemanager" | ||
"github.com/pingcap/tiflow/cdc/processor/tablepb" | ||
"github.com/pingcap/tiflow/cdc/redo" | ||
"github.com/pingcap/tiflow/cdc/scheduler" | ||
|
@@ -41,6 +42,7 @@ import ( | |
redoPkg "github.com/pingcap/tiflow/pkg/redo" | ||
"github.com/pingcap/tiflow/pkg/spanz" | ||
"github.com/pingcap/tiflow/pkg/upstream" | ||
"github.com/pingcap/tiflow/pkg/util" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
|
@@ -803,3 +805,73 @@ func TestProcessorNotInitialized(t *testing.T) { | |
p, _, _ := initProcessor4Test(t, &liveness, false, globalVars, changefeedVars) | ||
require.Nil(t, p.WriteDebugInfo(os.Stdout)) | ||
} | ||
|
||
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
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