Skip to content

Commit

Permalink
allocwatcher: don't destroy local allocdir after migration
Browse files Browse the repository at this point in the history
When `ephemeral_disk.migrate=true`, we make a best-effort attempt to migrate the
allocation data between the old and new allocations. For previous allocations on other
clients (the "remote" workflow), we create a local allocdir and download the
data from the previous client into it. That data is then moved into the new
allocdir and we delete the allocdir of the previous alloc.

For "local" previous allocations we don't need to create an extra directory for
the previous allocation and instead move the files directly from one to the
other. But we still delete the old allocdir _entirely_, which includes all the
logs!

There doesn't seem to be any reason to destroy the local previous allocdir, as
the usual client garbage collection should destroy it later on when needed. By
not deleting it, the previous allocation's logs are still available for the user
to read.

Fixes: #18034
  • Loading branch information
tgross committed Jul 31, 2023
1 parent 511cb55 commit c03d830
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions client/allocwatcher/alloc_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,7 @@ func (p *localPrevAlloc) Migrate(ctx context.Context, dest *allocdir.AllocDir) e

p.logger.Debug("copying previous alloc")

moveErr := dest.Move(p.prevAllocDir, p.tasks)

// Always cleanup previous alloc
if err := p.prevAllocDir.Destroy(); err != nil {
p.logger.Error("error destroying alloc dir",
"error", err, "previous_alloc_dir", p.prevAllocDir.AllocDir)
}

return moveErr
return dest.Move(p.prevAllocDir, p.tasks)
}

// remotePrevAlloc is a prevAllocWatcher for previous allocations on remote
Expand Down

0 comments on commit c03d830

Please sign in to comment.