fix(core): Make TRIGGER backup work while stores are in use

`TRIGGER backup` answered `ERR internal_error` in two common cases:

- a KV store was open in the pool (e.g. right after a `PUSH`): the backup
  opened the database a second time, which RocksDB refuses as its `LOCK`
  file is held. The pooled store is now backed up instead, after a flush.
- the KV or FST store directory did not exist yet (nothing ingested, or
  nothing consolidated yet): listing it failed. There is nothing to back up
  in that case.

Also enable the `trigger_backup` test, which covers both cases.

Fixes #274
This commit is contained in:
dualfroz committed 2026-10-03 14:05:56 +02:00
1 parent fdad02e264
commit 51a00dd099
3 files changed
+75 -9

No files matched your search

+6
View File
@@ -20,6 +20,12 @@ impl FstStorePool {
// Create backup directory (full path)
fs::create_dir_all(path)?;
// NOTE: The FST store directory gets created when the first FST is
// consolidated, so there is nothing to back up until then.
if !self.fst_store_config.path.exists() {
return Ok(());
}
// Proceed dump action (backup)
self.dump_action(
"backup",