Skip to content

Commit

Permalink
Merge pull request #215 from jianhaiqing/add-osc-lockwait-timeout
Browse files Browse the repository at this point in the history
添加lock_wait_timeout 控制 pt-osc 等待meta lock 时间,默认3s
  • Loading branch information
hanchuanchuan authored May 19, 2020
2 parents 95c2e8f + 43a78be commit a638f7d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ type Osc struct {
// 对应参数pt-online-schema-change中的参数--[no]check-alter。默认值:ON
OscCheckAlter bool `toml:"osc_check_alter" json:"osc_check_alter"`

// 对应参数pt-online-schema-change中的参数 --set-vars lock_wait_timeout=60s
OscLockWaitTimeout int `toml:"osc_lock_wait_timeout" json:"osc_lock_wait_timeout"`

// 对应参数pt-online-schema-change中的参数--[no]check-replication-filters。默认值:ON
OscCheckReplicationFilters bool `toml:"osc_check_replication_filters" json:"osc_check_replication_filters"`
// 是否检查唯一索引,默认检查,如果是,则禁止
Expand Down Expand Up @@ -745,6 +748,7 @@ var defaultConf = Config{
OscRecursionMethod: "processlist",
OscMaxLag: 3,
OscMaxFlowCtl: -1,
OscLockWaitTimeout: 60,
OscCheckAlter: true,
OscCheckReplicationFilters: true,
OscCheckUniqueKeyChange: true,
Expand Down
3 changes: 3 additions & 0 deletions config/config.toml.default
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ osc_max_lag = 3
# 类似--max-lag,检查集群暂停流量控制所花费的平均时间(仅适用于PXC 5.6及以上版本,会自动检测)
osc_max_flow_ctl = -1

# 对应参数pt-online-schema-change中的参数 --set-vars lock_wait_timeout=?
osc_lock_wait_timeout = 60

# 对应参数pt-online-schema-change中的参数--[no]check-alter。默认值:ON
osc_check_alter = true

Expand Down
3 changes: 3 additions & 0 deletions config/config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ osc_max_lag = 3
# 类似--max-lag,检查集群暂停流量控制所花费的平均时间(仅适用于PXC 5.6及以上版本,会自动检测)
osc_max_flow_ctl = -1

# 对应参数pt-online-schema-change中的参数 --set-vars lock_wait_timeout=?
osc_lock_wait_timeout = 60

# 对应参数pt-online-schema-change中的参数--[no]check-alter。默认值:ON
osc_check_alter = true

Expand Down
1 change: 1 addition & 0 deletions session/osc.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func (s *session) mysqlExecuteAlterTableOsc(r *Record) {
if s.osc.OscPrintSql {
buf.WriteString(" --print ")
}
buf.WriteString(fmt.Sprintf(" --set-vars lock_wait_timeout=%d", s.osc.OscLockWaitTimeout))
buf.WriteString(" --charset=utf8 ")
buf.WriteString(" --chunk-time ")
buf.WriteString(fmt.Sprintf("%g ", s.osc.OscChunkTime))
Expand Down

0 comments on commit a638f7d

Please sign in to comment.