added onRowCountComplete(); supporting elapsedSeconds in on-status
This commit is contained in:
parent
fad6743150
commit
ecd33969bf
@ -18,6 +18,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
onStartup = "gh-ost-on-startup"
|
onStartup = "gh-ost-on-startup"
|
||||||
onValidated = "gh-ost-on-validated"
|
onValidated = "gh-ost-on-validated"
|
||||||
|
onRowCountComplete = "gh-ost-on-rowcount-complete"
|
||||||
onBeforeRowCopy = "gh-ost-on-before-row-copy"
|
onBeforeRowCopy = "gh-ost-on-before-row-copy"
|
||||||
onRowCopyComplete = "gh-ost-on-row-copy-complete"
|
onRowCopyComplete = "gh-ost-on-row-copy-complete"
|
||||||
onBeginPostponed = "gh-ost-on-begin-postponed"
|
onBeginPostponed = "gh-ost-on-begin-postponed"
|
||||||
@ -54,6 +55,7 @@ func (this *HooksExecutor) applyEnvironmentVairables(extraVariables ...string) [
|
|||||||
env = append(env, fmt.Sprintf("GH_OST_MIGRATED_HOST=%s", this.migrationContext.ApplierConnectionConfig.ImpliedKey.Hostname))
|
env = append(env, fmt.Sprintf("GH_OST_MIGRATED_HOST=%s", this.migrationContext.ApplierConnectionConfig.ImpliedKey.Hostname))
|
||||||
env = append(env, fmt.Sprintf("GH_OST_INSPECTED_HOST=%s", this.migrationContext.InspectorConnectionConfig.ImpliedKey.Hostname))
|
env = append(env, fmt.Sprintf("GH_OST_INSPECTED_HOST=%s", this.migrationContext.InspectorConnectionConfig.ImpliedKey.Hostname))
|
||||||
env = append(env, fmt.Sprintf("GH_OST_EXECUTING_HOST=%s", this.migrationContext.Hostname))
|
env = append(env, fmt.Sprintf("GH_OST_EXECUTING_HOST=%s", this.migrationContext.Hostname))
|
||||||
|
env = append(env, fmt.Sprintf("GH_OST_HOOKS_HINT=%s", this.migrationContext.HooksHintMessage))
|
||||||
|
|
||||||
for _, variable := range extraVariables {
|
for _, variable := range extraVariables {
|
||||||
env = append(env, variable)
|
env = append(env, variable)
|
||||||
@ -102,6 +104,9 @@ func (this *HooksExecutor) onValidated() error {
|
|||||||
return this.executeHooks(onValidated)
|
return this.executeHooks(onValidated)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *HooksExecutor) onRowCountComplete() error {
|
||||||
|
return this.executeHooks(onRowCountComplete)
|
||||||
|
}
|
||||||
func (this *HooksExecutor) onBeforeRowCopy() error {
|
func (this *HooksExecutor) onBeforeRowCopy() error {
|
||||||
return this.executeHooks(onBeforeRowCopy)
|
return this.executeHooks(onBeforeRowCopy)
|
||||||
}
|
}
|
||||||
@ -131,9 +136,10 @@ func (this *HooksExecutor) onFailure() error {
|
|||||||
return this.executeHooks(onFailure)
|
return this.executeHooks(onFailure)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HooksExecutor) onStatus(statusMessage string) error {
|
func (this *HooksExecutor) onStatus(statusMessage string, elapsedSeconds int64) error {
|
||||||
v := fmt.Sprintf("GH_OST_STATUS='%s'", statusMessage)
|
v0 := fmt.Sprintf("GH_OST_STATUS='%s'", statusMessage)
|
||||||
return this.executeHooks(onStatus, v)
|
v1 := fmt.Sprintf("GH_OST_ELAPSED_SECONDS='%d'", elapsedSeconds)
|
||||||
|
return this.executeHooks(onStatus, v0, v1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *HooksExecutor) onStopReplication() error {
|
func (this *HooksExecutor) onStopReplication() error {
|
||||||
|
Loading…
Reference in New Issue
Block a user