Skip to content

Commit

Permalink
sink(ticdc): set default value of DateSeparator to day(#8998) (#9011)
Browse files Browse the repository at this point in the history
close #8997
  • Loading branch information
CharlesCheung96 authored May 22, 2023
1 parent 04c2964 commit 8db26e0
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cdc/api/v2/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var defaultAPIConfig = &ReplicaConfig{
},
EncoderConcurrency: 16,
Terminator: config.CRLF,
DateSeparator: config.DateSeparatorNone.String(),
DateSeparator: config.DateSeparatorDay.String(),
EnablePartitionSeparator: true,
EnableKafkaSinkV2: false,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ func TestCloudStorageWriteEventsWithoutDateSeparator(t *testing.T) {
require.Nil(t, err)

replicaConfig := config.GetDefaultReplicaConfig()
replicaConfig.Sink.DateSeparator = config.DateSeparatorNone.String()
replicaConfig.Sink.Protocol = config.ProtocolCsv.String()
replicaConfig.Sink.FileIndexWidth = 6
errCh := make(chan error, 5)
Expand Down
4 changes: 3 additions & 1 deletion cdc/sink/dmlsink/cloudstorage/dml_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ func testDMLWorker(ctx context.Context, t *testing.T, dir string) *dmlWorker {
sinkURI, err := url.Parse(uri)
require.Nil(t, err)
cfg := cloudstorage.NewConfig()
err = cfg.Apply(context.TODO(), sinkURI, config.GetDefaultReplicaConfig())
replicaConfig := config.GetDefaultReplicaConfig()
replicaConfig.Sink.DateSeparator = config.DateSeparatorNone.String()
err = cfg.Apply(context.TODO(), sinkURI, replicaConfig)
cfg.FileIndexWidth = 6
require.Nil(t, err)

Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/util/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func TestAndWriteExampleReplicaTOML(t *testing.T) {
NullString: config.NULL,
},
Terminator: "\r\n",
DateSeparator: config.DateSeparatorNone.String(),
DateSeparator: config.DateSeparatorDay.String(),
EnablePartitionSeparator: true,
Protocol: "open-protocol",
}, cfg.Sink)
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/replica_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var defaultReplicaConfig = &ReplicaConfig{
},
EncoderConcurrency: 16,
Terminator: CRLF,
DateSeparator: DateSeparatorNone.String(),
DateSeparator: DateSeparatorDay.String(),
EnablePartitionSeparator: true,
EnableKafkaSinkV2: false,
TiDBSourceID: 1,
Expand Down
1 change: 1 addition & 0 deletions pkg/sink/cloudstorage/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func TestConfigApply(t *testing.T) {
require.Nil(t, err)

replicaConfig := config.GetDefaultReplicaConfig()
replicaConfig.Sink.DateSeparator = config.DateSeparatorNone.String()
err = replicaConfig.ValidateAndAdjust(sinkURI)
require.NoError(t, err)
cfg := NewConfig()
Expand Down
1 change: 1 addition & 0 deletions pkg/sink/cloudstorage/path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func testFilePathGenerator(ctx context.Context, t *testing.T, dir string) *FileP
sinkURI, err := url.Parse(uri)
require.NoError(t, err)
replicaConfig := config.GetDefaultReplicaConfig()
replicaConfig.Sink.DateSeparator = config.DateSeparatorNone.String()
replicaConfig.Sink.Protocol = config.ProtocolOpen.String()
replicaConfig.Sink.FileIndexWidth = 6
cfg := NewConfig()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/api_v2/cases.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var defaultReplicaConfig = &ReplicaConfig{
},
EncoderConcurrency: 16,
Terminator: "\r\n",
DateSeparator: "none",
DateSeparator: "day",
EnablePartitionSeparator: true,
},
Consistent: &ConsistentConfig{
Expand Down

0 comments on commit 8db26e0

Please sign in to comment.