Fix snapshot only restore

This commit is contained in:
Ben Johnson
2021-01-15 13:12:15 -07:00
parent 743aeb83e1
commit b94ee366e5

5
db.go
View File

@@ -1327,7 +1327,10 @@ func (db *DB) Restore(ctx context.Context, opt RestoreOptions) error {
continue
}
if err := db.restoreWAL(ctx, r, generation, index, tmpPath); err != nil {
if err := db.restoreWAL(ctx, r, generation, index, tmpPath); os.IsNotExist(err) && index == minWALIndex && index == maxWALIndex {
logger.Printf("no wal available, snapshot only")
break // snapshot file only, ignore error
} else if err != nil {
return fmt.Errorf("cannot restore wal: %w", err)
}
}