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))
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user