fix(backup): resolve relative SSTable paths in incremental backup
MANIFEST stores relative paths like 'sstables/1.sst'. The old code checked fileExists against CWD instead of dataDir, silently omitting SSTables when run from another directory. Now resolves paths relative to dataDir.
This commit is contained in:
@@ -407,11 +407,12 @@ proc incrementalBackupDataDir*(dataDir: string, output: string, verbose: bool =
|
||||
let manifest = parseJson(readFile(manifestPath))
|
||||
for node in manifest{"sstables"}:
|
||||
let sstPath = node{"path"}.getStr()
|
||||
if fileExists(sstPath):
|
||||
filesToInclude.add(sstPath)
|
||||
let absSstPath = if isAbsolute(sstPath): sstPath else: dataDir / sstPath
|
||||
if fileExists(absSstPath):
|
||||
filesToInclude.add(absSstPath)
|
||||
else:
|
||||
if verbose:
|
||||
echo "WARNING: SSTable missing: ", sstPath
|
||||
echo "WARNING: SSTable missing: ", absSstPath
|
||||
except CatchableError as e:
|
||||
echo "ERROR: Failed to parse MANIFEST: ", e.msg
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user