added on-resurrecting hook

This commit is contained in:
Shlomi Noach 2016-12-25 08:53:24 +02:00
parent 7dfb740519
commit 0e8e5de7aa
4 changed files with 15 additions and 0 deletions

View File

@ -38,6 +38,7 @@ The full list of supported hooks is best found in code: [hooks.go](https://githu
- `gh-ost-on-startup`
- `gh-ost-on-validated`
- `gh-ost-on-resurrecting`
- `gh-ost-on-rowcount-complete`
- `gh-ost-on-before-row-copy`
- `gh-ost-on-status`

View File

@ -20,6 +20,7 @@ import (
const (
onStartup = "gh-ost-on-startup"
onValidated = "gh-ost-on-validated"
onResurrecting = "gh-ost-on-resurrecting"
onRowCountComplete = "gh-ost-on-rowcount-complete"
onBeforeRowCopy = "gh-ost-on-before-row-copy"
onRowCopyComplete = "gh-ost-on-row-copy-complete"
@ -112,6 +113,10 @@ func (this *HooksExecutor) onValidated() error {
return this.executeHooks(onValidated)
}
func (this *HooksExecutor) onResurrecting() error {
return this.executeHooks(onResurrecting)
}
func (this *HooksExecutor) onRowCountComplete() error {
return this.executeHooks(onRowCountComplete)
}

View File

@ -303,6 +303,10 @@ func (this *Migrator) applyResurrectedContext() error {
this.migrationContext.ApplyResurrectedContext(this.resurrectedContext)
atomic.StoreInt64(&this.migrationContext.IsResurrected, 1)
if err := this.hooksExecutor.onResurrecting(); err != nil {
return err
}
return nil
}

View File

@ -0,0 +1,5 @@
#!/bin/bash
# Sample hook file for gh-ost-on-resurrecting
echo "$(date) gh-ost-on-resurrecting: beginning resurrection on $GH_OST_DATABASE_NAME.$GH_OST_TABLE_NAME" >> /tmp/gh-ost.log