Skip to content

Commit a4e2b96

Browse files
committed
broker: persistence: downgrade unknown keys in state file from err to warn
This makes it so that a tacd will not fail to start if it encounters a state file that was written by a newer tacd version. This means we actually have to use the versioning scheme we already have when a new persistence key e.g. has security implications that may not be lost in e.g. a new -> old -> new cycle. Once such a change occurs we have the option to: - Increment the `format_version` field in the state file and make older tacds fail to start that way. - Start writing changes to a new state file `/srv/tacd/state-v2.json` and also read from there if it exists, but fall back to the current path if it does not. This means old tacds keep reading the file they created and a new tacd will read from there and migrate. Signed-off-by: Leonard Göhrs <[email protected]>
1 parent 998b73c commit a4e2b96

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/broker/persistence.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use anyhow::{bail, Result};
2222
use async_std::channel::{unbounded, Receiver};
2323
use async_std::prelude::*;
2424
use async_std::sync::Arc;
25-
use log::{error, info};
25+
use log::{error, info, warn};
2626
use serde::{Deserialize, Serialize};
2727
use serde_json::{from_reader, to_writer_pretty, Map, Value};
2828

@@ -70,12 +70,10 @@ fn load(topics: &[Arc<dyn AnyTopic>]) -> Result<()> {
7070
}
7171

7272
if !content.is_empty() {
73-
error!("State file contained extra keys:");
73+
warn!("State file contained extra keys:");
7474
for topic_name in content.keys() {
75-
error!(" - {topic_name}");
75+
warn!(" - {topic_name}");
7676
}
77-
78-
bail!("Left over topics in state file");
7977
}
8078

8179
Ok(())

0 commit comments

Comments
 (0)