// copyConfigFromSource copies config items from source config and worker's relayEnabled to sub task.
copyConfigFromSource copies config items from source config and worker's relayEnabled to sub task.
// copyConfigFromSource copies config items from source config and worker ' s relayEnabled to sub task .
func copyConfigFromSource(cfg *config.SubTaskConfig, sourceCfg *config.SourceConfig, enableRelay bool) error {
	cfg.From = sourceCfg.From
	cfg.Flavor = sourceCfg.Flavor
	cfg.ServerID = sourceCfg.ServerID
	cfg.RelayDir = sourceCfg.RelayDir
	cfg.EnableGTID = sourceCfg.EnableGTID
	cfg.UseRelay = enableRelay
	cfg.AutoFixGTID = sourceCfg.AutoFixGTID
	if cfg.CaseSensitive != sourceCfg.CaseSensitive {
		log.L().Warn("different case-sensitive config between task config and source config, use `true` for it.")
	}
	cfg.CaseSensitive = cfg.CaseSensitive || sourceCfg.CaseSensitive
	filter, err := bf.NewBinlogEvent(cfg.CaseSensitive, cfg.FilterRules)
	if err != nil {
		return err
	}
	for _, filterRule := range sourceCfg.Filters {
		if err = filter.AddRule(filterRule); err != nil {
			if errors.IsAlreadyExists(errors.Cause(err)) {
				log.L().Warn("filter config already exist in source config, overwrite it", log.ShortError(err))
				continue
			}
			return err
		}
		cfg.FilterRules = append(cfg.FilterRules, filterRule)
	}
	return nil
}
func copyConfigFromSource ( cfg * config . SubTaskConfig , sourceCfg * config . SourceConfig , enableRelay bool ) error { cfg . From = sourceCfg . From cfg . Flavor = sourceCfg . Flavor cfg . ServerID = sourceCfg . ServerID cfg . RelayDir = sourceCfg . RelayDir cfg . EnableGTID = sourceCfg . EnableGTID cfg . UseRelay = enableRelay cfg . AutoFixGTID = sourceCfg . AutoFixGTID if cfg . CaseSensitive != sourceCfg . CaseSensitive { log . L ( ) . Warn ( " " ) } cfg . CaseSensitive = cfg . CaseSensitive || sourceCfg . CaseSensitive filter , err := bf . NewBinlogEvent ( cfg . CaseSensitive , cfg . FilterRules ) if err != nil { return err } for _ , filterRule := range sourceCfg . Filters { if err = filter . AddRule ( filterRule ) ; err != nil { if errors . IsAlreadyExists ( errors . Cause ( err ) ) { log . L ( ) . Warn ( " " , log . ShortError ( err ) ) continue } return err } cfg . FilterRules = append ( cfg . FilterRules , filterRule ) } return nil }
copyConfigFromSource copies config items from source config and worker's relayEnabled to sub task.
copyConfigFromSource copies config items from source config and worker ' s relayEnabled to sub task .
// we can remove this from SubTaskConfig later, because syncer will always read from relay // task level config has higher priority