|
|
@@ -340,6 +340,28 @@ DatabaseService::Config DatabaseService::loadConfig(const std::filesystem::path&
|
|
|
config.walSyncIntervalMs = persistence.value("wal_sync_interval_ms", config.walSyncIntervalMs);
|
|
|
config.snapshotIntervalSec = persistence.value("snapshot_interval_sec", config.snapshotIntervalSec);
|
|
|
config.compressionEnabled = persistence.value("compression", "lz4") != "none";
|
|
|
+
|
|
|
+ // Snapshot durability (NEW in v1.6.1)
|
|
|
+ if (persistence.contains("snapshots")) {
|
|
|
+ const auto& snap = persistence["snapshots"];
|
|
|
+ config.persistenceConfig.validateAfterWrite = snap.value("validate_after_write", config.persistenceConfig.validateAfterWrite);
|
|
|
+ config.persistenceConfig.cleanupOnlyIfVerified = snap.value("cleanup_only_if_verified", config.persistenceConfig.cleanupOnlyIfVerified);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Recovery (NEW in v1.6.1)
|
|
|
+ if (persistence.contains("recovery")) {
|
|
|
+ const auto& rec = persistence["recovery"];
|
|
|
+ std::string modeStr = rec.value("mode", std::string("normal"));
|
|
|
+ try {
|
|
|
+ config.persistenceConfig.recoveryMode = recoveryModeFromString(modeStr);
|
|
|
+ } catch (const std::exception& e) {
|
|
|
+ spdlog::warn("Invalid recovery.mode '{}', defaulting to 'normal': {}",
|
|
|
+ modeStr, e.what());
|
|
|
+ config.persistenceConfig.recoveryMode = RecoveryMode::Normal;
|
|
|
+ }
|
|
|
+ config.persistenceConfig.autoEscalate = rec.value("auto_escalate", config.persistenceConfig.autoEscalate);
|
|
|
+ config.persistenceConfig.allowEmptyOnFreshInstall = rec.value("allow_empty_on_fresh_install", config.persistenceConfig.allowEmptyOnFreshInstall);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// File settings
|