Skip to content

Commit

Permalink
Merge pull request #130 from m-lab/sandbox-delay-delete
Browse files Browse the repository at this point in the history
delay deleting dedup source
  • Loading branch information
gfr10598 authored Feb 11, 2019
2 parents 90573e6 + 1dd7f6f commit 7eeaa33
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions rex/rex.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,19 +372,7 @@ func (rex *ReprocessingExecutor) finish(ctx context.Context, t *state.Task, term
return err
}

// Delete dedup source table.

// Wait for JobID to complete, then delete the template table.
log.Println("Completed deduplication, deleting source", src.FullyQualifiedName())
// If deduplication was successful, we should delete the source table.
delCtx, cf := context.WithTimeout(ctx, time.Minute)
defer cf()
err = src.Delete(delCtx)
if err != nil {
log.Println(err)
t.SetError(ctx, err, "TableDelete")
return err
}
log.Println("Completed deduplication from", src.FullyQualifiedName())

// Sanity check and copy things to final DS.
// ==========================================================================
Expand Down Expand Up @@ -421,5 +409,18 @@ func (rex *ReprocessingExecutor) finish(ctx context.Context, t *state.Task, term
t.SetError(ctx, err, "SanityCheckAndCopy")
return err
}

// Delete templated dedup source table.
log.Println("Deleting dedup source", src.FullyQualifiedName())
// If deduplication was successful, we should delete the source table.
delCtx, cf := context.WithTimeout(ctx, time.Minute)
defer cf()
err = src.Delete(delCtx)
if err != nil {
log.Println(err)
t.SetError(ctx, err, "TableDelete")
return err
}

return nil
}

0 comments on commit 7eeaa33

Please sign in to comment.