Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 12886dd

Browse filesBrowse files
committed
Merge branch '313-delete-conflict-dump-files' into 'master'
feat: clean up only files or directories that are specified to be restored (#313) Closes #313 See merge request postgres-ai/database-lab!410
2 parents e09f72b + b78397d commit 12886dd
Copy full SHA for 12886dd

File tree

1 file changed

+4
-9
lines changed
Filter options
  • internal/retrieval/engine/postgres/logical

1 file changed

+4
-9
lines changed

‎internal/retrieval/engine/postgres/logical/dump.go

Copy file name to clipboardExpand all lines: internal/retrieval/engine/postgres/logical/dump.go
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ func (d *DumpJob) Run(ctx context.Context) (err error) {
335335
}
336336
}
337337

338-
if err := d.cleanupDumpLocation(ctx, dumpCont.ID); err != nil {
338+
if err := d.cleanupDumpLocation(ctx, dumpCont.ID, dbList); err != nil {
339339
return err
340340
}
341341

@@ -406,23 +406,18 @@ func (d *DumpJob) getPassword() string {
406406
return pwd
407407
}
408408

409-
func (d *DumpJob) cleanupDumpLocation(ctx context.Context, dumpContID string) error {
409+
func (d *DumpJob) cleanupDumpLocation(ctx context.Context, dumpContID string, dbList map[string]DumpDefinition) error {
410410
if d.DumpOptions.DumpLocation == "" || d.DumpOptions.Restore.Enabled {
411411
return nil
412412
}
413413

414-
ls, err := tools.LsContainerDirectory(ctx, d.dockerClient, dumpContID, d.DumpOptions.DumpLocation)
415-
if err != nil {
416-
return errors.Wrap(err, "failed to clean up dump location")
417-
}
418-
419-
if len(ls) == 0 {
414+
if len(dbList) == 0 {
420415
return nil
421416
}
422417

423418
cleanupCmd := []string{"rm", "-rf"}
424419

425-
for _, dbName := range ls {
420+
for dbName := range dbList {
426421
cleanupCmd = append(cleanupCmd, path.Join(d.DumpOptions.DumpLocation, dbName))
427422
}
428423

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.