Add `GH_OST_INSTANT_DDL` for gh-ost-on-success hook (#1658) · github/gh-ost@0270a28 · GitHub
Skip to content

Commit 0270a28

Browse files
authored
Add GH_OST_INSTANT_DDL for gh-ost-on-success hook (#1658)
* Add GH_OST_INSTANT_DDL env var for hook
1 parent 8bc63f0 commit 0270a28

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎doc/hooks.md‎

Lines changed: 1 addition & 0 deletions

‎go/logic/hooks.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,9 @@ func (this *HooksExecutor) onInteractiveCommand(command string) error {
148148
return this.executeHooks(onInteractiveCommand, v)
149149
}
150150

151-
func (this *HooksExecutor) onSuccess() error {
152-
return this.executeHooks(onSuccess)
151+
func (this *HooksExecutor) onSuccess(instantDDL bool) error {
152+
v := fmt.Sprintf("GH_OST_INSTANT_DDL=%t", instantDDL)
153+
return this.executeHooks(onSuccess, v)
153154
}
154155

155156
func (this *HooksExecutor) onFailure() error {

‎go/logic/hooks_test.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ func TestHooksExecutorExecuteHooks(t *testing.T) {
105105
require.Equal(t, 50.0, progress)
106106
case "GH_OST_TABLE_NAME":
107107
require.Equal(t, migrationContext.OriginalTableName, split[1])
108+
case "GH_OST_INSTANT_DDL":
109+
require.Equal(t, "false", split[1])
108110
case "TEST":
109111
require.Equal(t, t.Name(), split[1])
110112
}

‎go/logic/migrator.go‎

Lines changed: 3 additions & 3 deletions

0 commit comments

Comments
 (0)