Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
*: remove deprecated heartbeat code (#2121) (#2151)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Sep 18, 2021
1 parent bcb3af1 commit 41f173e
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 536 deletions.
21 changes: 13 additions & 8 deletions dm/config/subtask.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,21 @@ type SubTaskConfig struct {
// treat it as hidden configuration
IgnoreCheckingItems []string `toml:"ignore-checking-items" json:"ignore-checking-items"`
// it represents a MySQL/MariaDB instance or a replica group
SourceID string `toml:"source-id" json:"source-id"`
ServerID uint32 `toml:"server-id" json:"server-id"`
Flavor string `toml:"flavor" json:"flavor"`
MetaSchema string `toml:"meta-schema" json:"meta-schema"`
HeartbeatUpdateInterval int `toml:"heartbeat-update-interval" json:"heartbeat-update-interval"`
HeartbeatReportInterval int `toml:"heartbeat-report-interval" json:"heartbeat-report-interval"`
EnableHeartbeat bool `toml:"enable-heartbeat" json:"enable-heartbeat"`
Meta *Meta `toml:"meta" json:"meta"`
SourceID string `toml:"source-id" json:"source-id"`
ServerID uint32 `toml:"server-id" json:"server-id"`
Flavor string `toml:"flavor" json:"flavor"`
MetaSchema string `toml:"meta-schema" json:"meta-schema"`
// deprecated
HeartbeatUpdateInterval int `toml:"heartbeat-update-interval" json:"heartbeat-update-interval"`
// deprecated
HeartbeatReportInterval int `toml:"heartbeat-report-interval" json:"heartbeat-report-interval"`
// deprecated
EnableHeartbeat bool `toml:"enable-heartbeat" json:"enable-heartbeat"`
// deprecated
Timezone string `toml:"timezone" json:"timezone"`

Meta *Meta `toml:"meta" json:"meta"`

// RelayDir get value from dm-worker config
RelayDir string `toml:"relay-dir" json:"relay-dir"`

Expand Down
15 changes: 11 additions & 4 deletions dm/config/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,12 @@ type TaskConfig struct {
// we store detail status in meta
// don't save configuration into it
MetaSchema string `yaml:"meta-schema" toml:"meta-schema" json:"meta-schema"`

EnableHeartbeat bool `yaml:"enable-heartbeat" toml:"enable-heartbeat" json:"enable-heartbeat"`
HeartbeatUpdateInterval int `yaml:"heartbeat-update-interval" toml:"heartbeat-update-interval" json:"heartbeat-update-interval"`
HeartbeatReportInterval int `yaml:"heartbeat-report-interval" toml:"heartbeat-report-interval" json:"heartbeat-report-interval"`
// deprecated
EnableHeartbeat bool `yaml:"enable-heartbeat" toml:"enable-heartbeat" json:"enable-heartbeat"`
// deprecated
HeartbeatUpdateInterval int `yaml:"heartbeat-update-interval" toml:"heartbeat-update-interval" json:"heartbeat-update-interval"`
// deprecated
HeartbeatReportInterval int `yaml:"heartbeat-report-interval" toml:"heartbeat-report-interval" json:"heartbeat-report-interval"`
// deprecated
Timezone string `yaml:"timezone" toml:"timezone" json:"timezone"`

Expand Down Expand Up @@ -685,6 +687,11 @@ func (c *TaskConfig) adjust() error {
log.L().Warn("`remove-meta` in task config is deprecated, please use `start-task ... --remove-meta` instead")
}

if c.EnableHeartbeat || c.HeartbeatUpdateInterval != defaultUpdateInterval ||
c.HeartbeatReportInterval != defaultReportInterval {
c.EnableHeartbeat = false
log.L().Warn("heartbeat is deprecated, needn't set it anymore.")
}
return nil
}

Expand Down
4 changes: 4 additions & 0 deletions relay/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,8 @@ func (r *Relay) SaveMeta(pos mysql.Position, gset gtid.Set) error {

// ResetMeta reset relay meta.
func (r *Relay) ResetMeta() {
r.Lock()
defer r.Unlock()
r.meta = NewLocalMeta(r.cfg.Flavor, r.cfg.RelayDir)
}

Expand Down Expand Up @@ -897,6 +899,8 @@ func (r *Relay) Close() {

// Status implements the dm.Unit interface.
func (r *Relay) Status(sourceStatus *binlog.SourceStatus) interface{} {
r.RLock()
defer r.RUnlock()
uuid, relayPos := r.meta.Pos()

rs := &pb.RelayStatus{
Expand Down
Loading

0 comments on commit 41f173e

Please # to comment.