Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

broker: persistence: downgrade unknown keys in state file from err to warn #63

Merged
merged 1 commit into from
Mar 13, 2024

Conversation

hnez
Copy link
Member

@hnez hnez commented Mar 11, 2024

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.

But that's a problem for future us.

Right now just make sure that the tacd does not crash after an update.

@hnez hnez added this to the second stable release milestone Mar 11, 2024
@hnez hnez requested review from jluebbe and SmithChart March 11, 2024 15:26
Copy link
Member

@SmithChart SmithChart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor finding. But LGTM

src/broker/persistence.rs Show resolved Hide resolved
Copy link
Member

@KarlK90 KarlK90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM, I'll approve - trusting that @SmithChart review comment is addressed 🙂.

@hnez hnez force-pushed the allow-state-downgrade branch 2 times, most recently from 42c013f to 7126c3a Compare March 13, 2024 06:25
… 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 <l.goehrs@pengutronix.de>
@hnez hnez force-pushed the allow-state-downgrade branch from 7126c3a to a4e2b96 Compare March 13, 2024 06:25
@hnez hnez merged commit 995d166 into linux-automation:main Mar 13, 2024
10 checks passed
@hnez hnez deleted the allow-state-downgrade branch March 13, 2024 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants