From 2a6e8de6f5982eee71c5fde727ea605118ef24c5 Mon Sep 17 00:00:00 2001 From: CharlesCheung <61726649+CharlesCheung96@users.noreply.github.com> Date: Tue, 30 May 2023 18:16:42 +0800 Subject: [PATCH] This is an automated cherry-pick of #9090 Signed-off-by: ti-chi-bot --- cdc/api/v2/model_test.go | 9 +++++++++ pkg/cmd/util/helper_test.go | 9 +++++++++ pkg/config/config_test_data.go | 4 ++++ pkg/config/replica_config.go | 9 +++++++++ pkg/sink/cloudstorage/config_test.go | 5 ++++- 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/cdc/api/v2/model_test.go b/cdc/api/v2/model_test.go index 8d74c9e7e8c..a56cac5557c 100644 --- a/cdc/api/v2/model_test.go +++ b/cdc/api/v2/model_test.go @@ -47,10 +47,19 @@ var defaultAPIConfig = &ReplicaConfig{ Delimiter: config.Comma, NullString: config.NULL, }, +<<<<<<< HEAD EncoderConcurrency: 16, Terminator: config.CRLF, DateSeparator: config.DateSeparatorDay.String(), EnablePartitionSeparator: true, +======= + EncoderConcurrency: util.AddressOf(16), + Terminator: util.AddressOf(config.CRLF), + DateSeparator: util.AddressOf(config.DateSeparatorDay.String()), + EnablePartitionSeparator: util.AddressOf(true), + EnableKafkaSinkV2: util.AddressOf(false), + OnlyOutputUpdatedColumns: util.AddressOf(false), +>>>>>>> edda949d87 (config(ticdc): fix deafult setting of DateSeparator (#9090)) }, Consistent: &ConsistentConfig{ Level: "none", diff --git a/pkg/cmd/util/helper_test.go b/pkg/cmd/util/helper_test.go index d96ebe9b278..4bf09920703 100644 --- a/pkg/cmd/util/helper_test.go +++ b/pkg/cmd/util/helper_test.go @@ -200,10 +200,19 @@ func TestAndWriteExampleReplicaTOML(t *testing.T) { Delimiter: string(config.Comma), NullString: config.NULL, }, +<<<<<<< HEAD Terminator: "\r\n", DateSeparator: config.DateSeparatorDay.String(), EnablePartitionSeparator: true, Protocol: "open-protocol", +======= + Terminator: util.AddressOf("\r\n"), + DateSeparator: util.AddressOf(config.DateSeparatorDay.String()), + EnablePartitionSeparator: util.AddressOf(true), + EnableKafkaSinkV2: util.AddressOf(false), + OnlyOutputUpdatedColumns: util.AddressOf(false), + Protocol: util.AddressOf("open-protocol"), +>>>>>>> edda949d87 (config(ticdc): fix deafult setting of DateSeparator (#9090)) }, cfg.Sink) } diff --git a/pkg/config/config_test_data.go b/pkg/config/config_test_data.go index 029a6984279..02deed80c63 100644 --- a/pkg/config/config_test_data.go +++ b/pkg/config/config_test_data.go @@ -35,6 +35,10 @@ const ( "sink": { "encoder-concurrency": 16, "terminator": "\r\n", +<<<<<<< HEAD +======= + "date-separator": "day", +>>>>>>> edda949d87 (config(ticdc): fix deafult setting of DateSeparator (#9090)) "dispatch-rules": [ { "db-name": "a", diff --git a/pkg/config/replica_config.go b/pkg/config/replica_config.go index bc65ce26496..5efe0d6c7e9 100644 --- a/pkg/config/replica_config.go +++ b/pkg/config/replica_config.go @@ -54,10 +54,19 @@ var defaultReplicaConfig = &ReplicaConfig{ Delimiter: Comma, NullString: NULL, }, +<<<<<<< HEAD EncoderConcurrency: 16, Terminator: CRLF, DateSeparator: DateSeparatorDay.String(), EnablePartitionSeparator: true, +======= + EncoderConcurrency: util.AddressOf(16), + Terminator: util.AddressOf(CRLF), + DateSeparator: util.AddressOf(DateSeparatorDay.String()), + EnablePartitionSeparator: util.AddressOf(true), + EnableKafkaSinkV2: util.AddressOf(false), + OnlyOutputUpdatedColumns: util.AddressOf(false), +>>>>>>> edda949d87 (config(ticdc): fix deafult setting of DateSeparator (#9090)) TiDBSourceID: 1, }, Consistent: &ConsistentConfig{ diff --git a/pkg/sink/cloudstorage/config_test.go b/pkg/sink/cloudstorage/config_test.go index 994219c74b5..5120a28738a 100644 --- a/pkg/sink/cloudstorage/config_test.go +++ b/pkg/sink/cloudstorage/config_test.go @@ -29,14 +29,17 @@ func TestConfigApply(t *testing.T) { expected.FlushInterval = 10 * time.Second expected.FileSize = 16 * 1024 * 1024 expected.FileIndexWidth = config.DefaultFileIndexWidth - expected.DateSeparator = config.DateSeparatorNone.String() + expected.DateSeparator = config.DateSeparatorDay.String() expected.EnablePartitionSeparator = true uri := "s3://bucket/prefix?worker-count=32&flush-interval=10s&file-size=16777216&protocol=csv" sinkURI, err := url.Parse(uri) require.Nil(t, err) replicaConfig := config.GetDefaultReplicaConfig() +<<<<<<< HEAD replicaConfig.Sink.DateSeparator = config.DateSeparatorNone.String() +======= +>>>>>>> edda949d87 (config(ticdc): fix deafult setting of DateSeparator (#9090)) err = replicaConfig.ValidateAndAdjust(sinkURI) require.NoError(t, err) cfg := NewConfig()