Skip to content

Commit

Permalink
config(ticdc): do not return error when enable-tidb-extension is not …
Browse files Browse the repository at this point in the history
…supported (#8717)

close #8719
  • Loading branch information
CharlesCheung96 authored Apr 4, 2023
1 parent ecc7ab6 commit 3554e47
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions pkg/sink/codec/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import (
"strconv"

"github.com/pingcap/errors"
"github.com/pingcap/log"
"github.com/pingcap/tiflow/pkg/config"
cerror "github.com/pingcap/tiflow/pkg/errors"
"go.uber.org/zap"
)

// defaultMaxBatchSize sets the default value for max-batch-size
Expand Down Expand Up @@ -146,9 +148,10 @@ func (c *Config) WithMaxMessageBytes(bytes int) *Config {
func (c *Config) Validate() error {
if c.EnableTiDBExtension &&
!(c.Protocol == config.ProtocolCanalJSON || c.Protocol == config.ProtocolAvro) {
return cerror.ErrCodecInvalidConfig.GenWithStack(
`enable-tidb-extension only supports canal-json/avro protocol`,
)
log.Warn("ignore invalid config, enable-tidb-extension"+
"only supports canal-json/avro protocol",
zap.Bool("enableTidbExtension", c.EnableTiDBExtension),
zap.String("protocol", c.Protocol.String()))
}

if c.Protocol == config.ProtocolAvro {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sink/codec/common/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func TestConfigApplyValidate(t *testing.T) {
require.True(t, c.EnableTiDBExtension)

err = c.Validate()
require.ErrorContains(t, err, "enable-tidb-extension only supports canal-json/avro protocol")
require.NoError(t, err)

// avro
uri = "kafka://127.0.0.1:9092/abc?protocol=avro"
Expand Down

0 comments on commit 3554e47

Please sign in to comment.