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:
2026-05-21 09:44:28 +03:00
parent 4a83eb6783
commit 1ff6fabaff
+4 -3
View File
@@ -407,11 +407,12 @@ proc incrementalBackupDataDir*(dataDir: string, output: string, verbose: bool =
let manifest = parseJson(readFile(manifestPath)) let manifest = parseJson(readFile(manifestPath))
for node in manifest{"sstables"}: for node in manifest{"sstables"}:
let sstPath = node{"path"}.getStr() let sstPath = node{"path"}.getStr()
if fileExists(sstPath): let absSstPath = if isAbsolute(sstPath): sstPath else: dataDir / sstPath
filesToInclude.add(sstPath) if fileExists(absSstPath):
filesToInclude.add(absSstPath)
else: else:
if verbose: if verbose:
echo "WARNING: SSTable missing: ", sstPath echo "WARNING: SSTable missing: ", absSstPath
except CatchableError as e: except CatchableError as e:
echo "ERROR: Failed to parse MANIFEST: ", e.msg echo "ERROR: Failed to parse MANIFEST: ", e.msg
return false return false