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

Detect and handle breaking changes in schemas #1195

Merged
merged 16 commits into from
Nov 30, 2020

Conversation

dominiklohmann
Copy link
Member

@dominiklohmann dominiklohmann commented Nov 23, 2020

📔 Description

When changing schemas such that types are no longer a superset of previous versions of the same type, VAST may end up in a state where it cannot import events of that type.

This change makes the type registry forget about incompatible versions of types automatically when a new and incompatible type is registered. warn when this happens and ensures that newly registered types get priority over older types when importing data.

📝 Checklist

  • All user-facing changes have changelog entries.
  • The changes are reflected on docs.tenzir.com/vast, if necessary.
  • The PR description contains instructions for the reviewer, if necessary.

🎯 Review Instructions

Commit-by-commit.

@dominiklohmann dominiklohmann added the bug Incorrect behavior label Nov 23, 2020
@dominiklohmann dominiklohmann requested a review from a team November 23, 2020 18:55
Copy link
Member

@mavam mavam left a comment

Choose a reason for hiding this comment

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

I wonder whether there's a good way to unit-test this?!

schema/test.schema Outdated Show resolved Hide resolved
libvast/src/system/type_registry.cpp Outdated Show resolved Hide resolved
libvast/src/system/type_registry.cpp Outdated Show resolved Hide resolved
@dominiklohmann
Copy link
Member Author

I wonder whether there's a good way to unit-test this?!

I've added a unit test as a separate commit. It isn't beautiful, but it works.

mavam
mavam previously requested changes Nov 24, 2020
Copy link
Member

@mavam mavam left a comment

Choose a reason for hiding this comment

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

The logic looks sounds to me. Just small stuff now before merging.

libvast/vast/type.hpp Outdated Show resolved Hide resolved
libvast/src/type.cpp Show resolved Hide resolved
libvast/src/type.cpp Outdated Show resolved Hide resolved
libvast/src/type.cpp Outdated Show resolved Hide resolved
libvast/src/type.cpp Outdated Show resolved Hide resolved
libvast/src/type.cpp Outdated Show resolved Hide resolved
libvast/src/system/type_registry.cpp Outdated Show resolved Hide resolved
@dominiklohmann dominiklohmann force-pushed the topic/schema-mismatch-detection branch 3 times, most recently from 3cf4080 to 55a0649 Compare November 24, 2020 10:08
@dominiklohmann dominiklohmann dismissed mavam’s stale review November 25, 2020 07:55

Addressed and outdated; further feedback discussed via Slack.

@dominiklohmann
Copy link
Member Author

This should be reviewed by @tobim after our Slack call yesterday on the matter. The last commit is the most important one here.

libvast/vast/system/source.hpp Outdated Show resolved Hide resolved
libvast/src/system/type_registry.cpp Outdated Show resolved Hide resolved
dominiklohmann and others added 10 commits November 26, 2020 15:55
When changing schemas such that types are no longer a superset of
previous versions of the same type, VAST may end up in a state where it
cannot import events of that type.

This change makes the type registry forget about incompatible versions
of types automatically when a new and incompatible type is registered.
The previous commit made this one really obvious.
Co-authored-by: Matthias Vallentin <matthias@tenzir.com>
Now it's truly recursive and unit-tested on its own.
Co-authored-by: Matthias Vallentin <matthias@tenzir.com>
Instead of erasing incompatible versions, move the most recent version
to the front so it is correctly used by all the readers.
libvast/src/system/type_registry.cpp Outdated Show resolved Hide resolved
libvast/vast/system/source.hpp Outdated Show resolved Hide resolved
@dominiklohmann dominiklohmann merged commit 2d9aa70 into master Nov 30, 2020
@dominiklohmann dominiklohmann deleted the topic/schema-mismatch-detection branch November 30, 2020 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants