diff --git a/cdc/server.go b/cdc/server.go index d9faec79348..85846aefdb6 100644 --- a/cdc/server.go +++ b/cdc/server.go @@ -376,8 +376,8 @@ func (s *Server) initDataDir(ctx context.Context) error { return errors.Trace(err) } - log.Info(fmt.Sprintf("%s is set as data-dir (%dGB available), ticdc recommend disk for data-dir "+ - "at least have %dGB available space", conf.DataDir, diskInfo.Avail, dataDirThreshold)) + log.Info(fmt.Sprintf("%s is set as data-dir (%dGB available), sort-dir=%s. "+ + "It is recommended that the disk for data-dir at least have %dGB available space", conf.DataDir, diskInfo.Avail, conf.Sorter.SortDir, dataDirThreshold)) return nil } diff --git a/cmd/server.go b/cmd/server.go index 768782a48f8..97eb2d3ef24 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -147,6 +147,14 @@ func loadAndVerifyServerConfig(cmd *cobra.Command) (*config.ServerConfig, error) if err := strictDecodeFile(serverConfigFilePath, "TiCDC server", conf); err != nil { return nil, err } + // user specified sort-dir should not take effect, it's always `/tmp/sorter` + // if user try to set sort-dir by config file, warn it. + if conf.Sorter.SortDir != config.DefaultSortDir { + cmd.Printf(color.HiYellowString("[WARN] --sort-dir is deprecated in server settings. " + + "sort-dir will be set to `{data-dir}/tmp/sorter`. The sort-dir here will be no-op\n")) + + conf.Sorter.SortDir = config.DefaultSortDir + } } cmd.Flags().Visit(func(flag *pflag.Flag) { switch flag.Name { @@ -187,18 +195,23 @@ func loadAndVerifyServerConfig(cmd *cobra.Command) (*config.ServerConfig, error) case "cert-allowed-cn": conf.Security.CertAllowedCN = serverConfig.Security.CertAllowedCN case "sort-dir": - // user specified sorter dir should not take effect - if serverConfig.Sorter.SortDir != config.DefaultSortDir { - cmd.Printf(color.HiYellowString("[WARN] --sort-dir is deprecated in server settings. " + - "sort-dir will be set to `{data-dir}/tmp/sorter`. The sort-dir here will be no-op\n")) - } - conf.Sorter.SortDir = config.DefaultSortDir + conf.Sorter.SortDir = serverConfig.Sorter.SortDir case "pd", "config": // do nothing default: log.Panic("unknown flag, please report a bug", zap.String("flagName", flag.Name)) } }) + + // user specified sorter dir should not take effect, it's always `/tmp/sorter` + // if user try to set sort-dir by flag, warn it. + if conf.Sorter.SortDir != config.DefaultSortDir { + cmd.Printf(color.HiYellowString("[WARN] --sort-dir is deprecated in server settings. " + + "sort-dir will be set to `{data-dir}/tmp/sorter`. The sort-dir here will be no-op\n")) + + conf.Sorter.SortDir = config.DefaultSortDir + } + if err := conf.ValidateAndAdjust(); err != nil { return nil, errors.Trace(err) }