fix(enrichment tables): preserve memory enrichment table state on reload#25547
fix(enrichment tables): preserve memory enrichment table state on reload#25547esensar wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6583fd70e4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Thanks @esensar! Per our new policy I will come back to this once codex comments are resolved. |
|
While resolving this I found that there were quite a few typos and missed cases for reload in enrichment tables that have source/sink. I think I covered them all now. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0044cc7f03
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
pront
left a comment
There was a problem hiding this comment.
Thank you for this contribution. Can please add a couple of test cases, e.g. take_state_preserves_data and reload_preserves_state?
| #[snafu(display("Table {table} not loaded"))] | ||
| TableNotLoaded { table: String }, | ||
| #[snafu(display("Table configuration is not compatible for reload"))] | ||
| IncompatibleTableConfig, |
| fn needs_reload(&self) -> bool; | ||
|
|
||
| /// Returns true if this table holds state that needs to be moved in case of reload. | ||
| fn stateful(&self) -> bool; |
There was a problem hiding this comment.
The caller must check stateful() before calling take_state(), but nothing prevents calling take_state() on a non-stateful table.
I was thinking of a different design (but didn't validate fully). Specifically:
fn extract_state(&self) -> Option<Box<dyn std::any::Any + Send + Sync>> { None }
In combination with the comment below.
| fn into_any(self: Box<Self>) -> Box<dyn Any>; | ||
|
|
||
| fn as_any(&self) -> &dyn Any; |
There was a problem hiding this comment.
Same as above, can we avoid all these new trait methods if we pass prev_state: Option<Box<dyn std::any::Any + Send + Sync>> in build?
Summary
While working on #25143, it was brought to my attention that reload was not handled for memory tables (#25143 (comment)) - that is, new components were generated, that were not attached to the tables that were queried. This PR resolves that by making these tables take over the state of previous components.
Vector configuration
How did you test this PR?
Ran vector with the above configuration and the
--watch-configflag. Changed TTL a couple of times and Vector properly reloaded and kept state, observed by seeing cached output data, instead of newly generated.Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details on the dd-rust-license-tool.