From 2dc3b71a3997f9b72c66a90e99f8a29202a2d995 Mon Sep 17 00:00:00 2001 From: CharlesCheung Date: Thu, 18 May 2023 19:45:14 +0800 Subject: [PATCH] set default value of DateSeparator to day --- cdc/api/v2/model_test.go | 2 +- cdc/sink/dmlsink/cloudstorage/cloud_storage_dml_sink_test.go | 1 + cdc/sink/dmlsink/cloudstorage/dml_worker_test.go | 4 +++- pkg/cmd/util/helper_test.go | 2 +- pkg/config/replica_config.go | 2 +- pkg/sink/cloudstorage/config_test.go | 1 + pkg/sink/cloudstorage/path_test.go | 1 + tests/integration_tests/api_v2/cases.go | 2 +- 8 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cdc/api/v2/model_test.go b/cdc/api/v2/model_test.go index 0f133047423..6d03e57549c 100644 --- a/cdc/api/v2/model_test.go +++ b/cdc/api/v2/model_test.go @@ -49,7 +49,7 @@ var defaultAPIConfig = &ReplicaConfig{ }, EncoderConcurrency: 16, Terminator: config.CRLF, - DateSeparator: config.DateSeparatorNone.String(), + DateSeparator: config.DateSeparatorDay.String(), EnablePartitionSeparator: true, EnableKafkaSinkV2: false, }, diff --git a/cdc/sink/dmlsink/cloudstorage/cloud_storage_dml_sink_test.go b/cdc/sink/dmlsink/cloudstorage/cloud_storage_dml_sink_test.go index 847772f0220..9ef1fa8e42a 100644 --- a/cdc/sink/dmlsink/cloudstorage/cloud_storage_dml_sink_test.go +++ b/cdc/sink/dmlsink/cloudstorage/cloud_storage_dml_sink_test.go @@ -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) diff --git a/cdc/sink/dmlsink/cloudstorage/dml_worker_test.go b/cdc/sink/dmlsink/cloudstorage/dml_worker_test.go index 2c39c6f7353..2e8dd5620c5 100644 --- a/cdc/sink/dmlsink/cloudstorage/dml_worker_test.go +++ b/cdc/sink/dmlsink/cloudstorage/dml_worker_test.go @@ -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) diff --git a/pkg/cmd/util/helper_test.go b/pkg/cmd/util/helper_test.go index 026e319acfc..bcfd4afbdca 100644 --- a/pkg/cmd/util/helper_test.go +++ b/pkg/cmd/util/helper_test.go @@ -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) diff --git a/pkg/config/replica_config.go b/pkg/config/replica_config.go index 0429b1eca54..2dde2afe5dc 100644 --- a/pkg/config/replica_config.go +++ b/pkg/config/replica_config.go @@ -59,7 +59,7 @@ var defaultReplicaConfig = &ReplicaConfig{ }, EncoderConcurrency: 16, Terminator: CRLF, - DateSeparator: DateSeparatorNone.String(), + DateSeparator: DateSeparatorDay.String(), EnablePartitionSeparator: true, EnableKafkaSinkV2: false, TiDBSourceID: 1, diff --git a/pkg/sink/cloudstorage/config_test.go b/pkg/sink/cloudstorage/config_test.go index 27696bfae9a..1d319751457 100644 --- a/pkg/sink/cloudstorage/config_test.go +++ b/pkg/sink/cloudstorage/config_test.go @@ -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() diff --git a/pkg/sink/cloudstorage/path_test.go b/pkg/sink/cloudstorage/path_test.go index 2f0b2673ba5..6a0dbe56c4a 100644 --- a/pkg/sink/cloudstorage/path_test.go +++ b/pkg/sink/cloudstorage/path_test.go @@ -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() diff --git a/tests/integration_tests/api_v2/cases.go b/tests/integration_tests/api_v2/cases.go index 30acb4ce960..579fbd64d41 100644 --- a/tests/integration_tests/api_v2/cases.go +++ b/tests/integration_tests/api_v2/cases.go @@ -129,7 +129,7 @@ var defaultReplicaConfig = &ReplicaConfig{ }, EncoderConcurrency: 16, Terminator: "\r\n", - DateSeparator: "none", + DateSeparator: "day", EnablePartitionSeparator: true, }, Consistent: &ConsistentConfig{