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
*: deny unknown fields when deserializing config TOML #5190
Conversation
Signed-off-by: kennytm <kennytm@gmail.com>
/run-integration-tests |
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.
Great!
LGTM
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
Does this PR need to be cherry picked to 3.0? |
@breeswish We could. WDYT |
@BusyJay @overvenus Do you have some ideas? |
@@ -75,6 +75,7 @@ fn memory_mb_for_cf(is_raft_db: bool, cf: &str) -> usize { | |||
|
|||
#[derive(Clone, Serialize, Deserialize, PartialEq, Debug)] | |||
#[serde(default)] | |||
#[serde(deny_unknown_fields)] |
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.
Seems we can no longer downgrade if there is a new config exist?
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.
You'd need to comment out that config manually. The error message will tell you the name of the offending field.
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.
seem TiDB has the same problem now. is it ok?
@shenli
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.
yes, I think so.
/run-all-tests |
Need cherry pick? @siddontang @BusyJay |
Signed-off-by: kennytm <kennytm@gmail.com>
)" This reverts commit 0343796.
)" This reverts commit 0343796. Signed-off-by: kennytm <kennytm@gmail.com>
)" This reverts commit 0343796. Signed-off-by: kennytm <kennytm@gmail.com>
#5350) Signed-off-by: kennytm <kennytm@gmail.com>
…tikv#5190)" (tikv#5350)" This reverts commit 83a2357.
)" This reverts commit 0343796.
Signed-off-by: kennytm <kennytm@gmail.com>
)" (tikv#5350) Signed-off-by: kennytm <kennytm@gmail.com>
What have you changed? (mandatory)
Add
#[serde(deny_unknown_fields)]
to all config structures, which will cause deserialization to fail if the source contains an unrecognized field. The rationale to catch typo or misplaced settings.What are the type of the changes? (mandatory)
How has this PR been tested? (mandatory)
cargo test --test integrations -- test_error_on_unrecognized_config
Does this PR affect documentation (docs) or release note? (mandatory)
Release note.
Does this PR affect tidb-ansible update? (mandatory)
Hopefully no 🙃.
Refer to a related PR or issue link (optional)
pingcap/tidb#9855
Benchmark result if necessary (optional)
Add a few positive/negative examples (optional)