-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(schema validation): implement backup restore #13048
feat(schema validation): implement backup restore #13048
Conversation
307ffa8
to
c699724
Compare
c699724
to
fd94924
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i wonder if there are some inconsistent behaviour for config import comparing to config load API (which has a mode
option supporting replace
or merge
)
Result = emqx_utils:foldl_while( | ||
fun | ||
({validation, RawValidation}, Acc) -> | ||
case insert(RawValidation) of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this generates small config changes,
would it make sense to merge all configs and reload all at once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✔️
There is maybe a missing support for config load API (and CLI) ? |
ok; | ||
post_config_update([?CONF_ROOT], {merge, Input}, ResultingConfig, Old, _AppEnvs) -> | ||
#{validations := ResultingValidations} = ResultingConfig, | ||
#{new_validations := NewValidations0} = prepare_config_merge(Input, Old), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Old
map of prepare_config_merge/2
has atom as key in pre_config_update, but in post_config_update it is binary. This was not considered in the implementation.
By the way, why is there a need to do merge again in post after it has been done in pre_config_update?
It seems to be some kind of conflict. Maybe, we could handle nothing in pre_config_update and deal with it directly in post_config_update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Old map of prepare_config_merge/2 has atom as key in pre_config_update, but in post_config_update it is binary. This was not considered in the implementation.
Good catch.
By the way, why is there a need to do merge again in post after it has been done in pre_config_update?
It seems to be some kind of conflict. Maybe, we could handle nothing in pre_config_update and deal with it directly in post_config_update.
Indeed, there's no work needed in pre_config_update. Thanks! 🍻
Actually, we do need to repeat the work: when "merging", we only add new validations.
f560813
to
34a29e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I merge this first, Let QA team help to verify this.
Fixes https://emqx.atlassian.net/browse/EMQX-12346
Release version: e5.7
Summary
From discussions with Product, when importing a schema validation backup:
PR Checklist
Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:
changes/(ce|ee)/(feat|perf|fix|breaking)-<PR-id>.en.md
filesChecklist for CI (.github/workflows) changes
changes/
dir for user-facing artifacts update