Fix snapshot only restore
This commit is contained in:
5
db.go
5
db.go
@@ -1327,7 +1327,10 @@ func (db *DB) Restore(ctx context.Context, opt RestoreOptions) error {
|
|||||||
continue
|
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)
|
return fmt.Errorf("cannot restore wal: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user