Skip to content

Commit

Permalink
update: 优化gh-ost的server_id根据会话ID自动变化,避免同一实例重复
Browse files Browse the repository at this point in the history
  • Loading branch information
hanchuanchuan committed Jul 26, 2019
1 parent 33725dd commit bd5200d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion session/osc.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ func (s *session) mysqlExecuteAlterTableGhost(r *Record) {
// flag.StringVar(&migrationContext.HooksHintOwner, "hooks-hint-owner", "", "arbitrary name of owner to be injected to hooks via GH_OST_HOOKS_HINT_OWNER, for your convenience")
// flag.StringVar(&migrationContext.HooksHintToken, "hooks-hint-token", "", "arbitrary token to be injected to hooks via GH_OST_HOOKS_HINT_TOKEN, for your convenience")

migrationContext.ReplicaServerId = 99999
migrationContext.ReplicaServerId = 2000100000 + uint(s.sessionVars.ConnectionID%10000)
// flag.UintVar(&migrationContext.ReplicaServerId, "replica-server-id", 99999, "server id used by gh-ost process. Default: 99999")
// maxLoad := s.Ghost.GhostMaxLoad
// maxLoad := flag.String("max-load", "", "Comma delimited status-name=threshold. e.g: 'Threads_running=100,Threads_connected=500'. When status exceeds threshold, app throttles writes")
Expand Down Expand Up @@ -556,6 +556,7 @@ func (s *session) mysqlExecuteAlterTableGhost(r *Record) {
log.Error(err)
done = true
s.AppendErrorMessage(err.Error())
// migrator.Teardown()
}

done = true
Expand Down

0 comments on commit bd5200d

Please sign in to comment.