mkabilov/logical_backup

"File is already closed" error on a delta

Closed this issue · 2 comments

Saw this at least once, trying to reproduce again: backup stops, complaining "could not save delta: file has already closed" on a temporary delta file belonging to a rather lightweight table (20MB total) that receives just 10-20 updates a day with an interval from 1 to 5 hours between updates.

I will provide more details if I manage to reproduce that. I suspect that CloseOldFiles closed the file that receives active writes (since the time between updates can be 5h and the timeout is set to 3). I am running with some extra debug messages to reproduce.

diff --git a/pkg/tablebackup/tablebackup.go b/pkg/tablebackup/tablebackup.go
index a7fbbc1..07080ec 100644
--- a/pkg/tablebackup/tablebackup.go
+++ b/pkg/tablebackup/tablebackup.go
@@ -300,6 +300,8 @@ func (t *TableBackup) CloseOldFiles() error {
                return nil
        }

+       log.Printf("closing old file %s for table %s", t.currentDeltaFilename, t);
+
        return t.currentDeltaFp.Close()
 }

Tentative attempt to fix the issue (still hasn't reproduced) #6