diff --git a/go/vt/vttablet/onlineddl/executor.go b/go/vt/vttablet/onlineddl/executor.go index 5ac7f98e8f6..38d5981e7c9 100644 --- a/go/vt/vttablet/onlineddl/executor.go +++ b/go/vt/vttablet/onlineddl/executor.go @@ -863,7 +863,6 @@ func (e *Executor) cutOverVReplMigration(ctx context.Context, s *VReplStream) er defer lockConn.Exec(ctx, sqlUnlockTables, 1, false) renameCompleteChan := make(chan error) - defer close(renameCompleteChan) renameWasSuccessful := false renameConn, err := e.pool.Get(ctx, nil) if err != nil { @@ -972,6 +971,7 @@ func (e *Executor) cutOverVReplMigration(ctx context.Context, s *VReplStream) er e.updateMigrationStage(ctx, onlineDDL.UUID, "renaming tables") go func() { + defer close(renameCompleteChan) _, err := renameConn.Exec(ctx, renameQuery.Query, 1, false) renameCompleteChan <- err }()