@@ -61,7 +61,6 @@ use serde_with::with_prefix;
6161use serfig:: collectors:: from_env;
6262use serfig:: collectors:: from_file;
6363use serfig:: collectors:: from_self;
64- use serfig:: parsers:: Toml ;
6564
6665use super :: inner;
6766use super :: inner:: CatalogConfig as InnerCatalogConfig ;
@@ -73,6 +72,7 @@ use super::inner::QueryConfig as InnerQueryConfig;
7372use crate :: builtin:: BuiltInConfig ;
7473use crate :: builtin:: UDFConfig ;
7574use crate :: builtin:: UserConfig ;
75+ use crate :: toml:: TomlIgnored ;
7676use crate :: DATABEND_COMMIT_VERSION ;
7777
7878const CATALOG_HIVE : & str = "hive" ;
@@ -200,7 +200,7 @@ impl Config {
200200
201201 // Load from config file first.
202202 {
203- let config_file = if !arg_conf. config_file . is_empty ( ) {
203+ let final_config_file = if !arg_conf. config_file . is_empty ( ) {
204204 // TODO: remove this `allow(clippy::redundant_clone)`
205205 // as soon as this issue is fixed:
206206 // https://github.com/rust-lang/rust-clippy/issues/10940
@@ -212,8 +212,11 @@ impl Config {
212212 "" . to_string ( )
213213 } ;
214214
215- if !config_file. is_empty ( ) {
216- builder = builder. collect ( from_file ( Toml , & config_file) ) ;
215+ if !final_config_file. is_empty ( ) {
216+ let toml = TomlIgnored :: new ( Box :: new ( |path| {
217+ log:: warn!( "unknown field in config: {}" , & path) ;
218+ } ) ) ;
219+ builder = builder. collect ( from_file ( toml, & final_config_file) ) ;
217220 }
218221 }
219222
@@ -246,7 +249,10 @@ impl Config {
246249 } ;
247250
248251 if !config_file. is_empty ( ) {
249- builder = builder. collect ( from_file ( Toml , & config_file) ) ;
252+ let toml = TomlIgnored :: new ( Box :: new ( |path| {
253+ log:: warn!( "unknown field in config: {}" , & path) ;
254+ } ) ) ;
255+ builder = builder. collect ( from_file ( toml, & config_file) ) ;
250256 }
251257 }
252258
@@ -1418,7 +1424,7 @@ impl serde::de::Visitor<'_> for SettingVisitor {
14181424
14191425/// Query config group.
14201426#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize , Args ) ]
1421- #[ serde( default , deny_unknown_fields ) ]
1427+ #[ serde( default ) ]
14221428pub struct QueryConfig {
14231429 /// Tenant id for get the information from the MetaSrv.
14241430 #[ clap( long, value_name = "VALUE" , default_value = "admin" ) ]
@@ -2650,10 +2656,9 @@ impl From<InnerOTLPEndpointConfig> for OTLPEndpointConfig {
26502656}
26512657
26522658/// Meta config group.
2653- /// deny_unknown_fields to check unknown field, like the deprecated `address`.
26542659/// TODO(xuanwo): All meta_xxx should be rename to xxx.
26552660#[ derive( Clone , PartialEq , Eq , Serialize , Deserialize , Args ) ]
2656- #[ serde( default , deny_unknown_fields ) ]
2661+ #[ serde( default ) ]
26572662pub struct MetaConfig {
26582663 /// The dir to store persisted meta state for a embedded meta store
26592664 #[ clap( long = "meta-embedded-dir" , value_name = "VALUE" , default_value_t) ]
@@ -2859,7 +2864,7 @@ impl TryInto<InnerLocalConfig> for LocalConfig {
28592864}
28602865
28612866#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize , Args ) ]
2862- #[ serde( default , deny_unknown_fields ) ]
2867+ #[ serde( default ) ]
28632868pub struct CacheConfig {
28642869 /// Enable table meta cache. Default is enabled. Set it to false to disable all the table meta caches
28652870 #[ clap( long = "cache-enable-table-meta-cache" , default_value = "true" ) ]
@@ -3097,7 +3102,7 @@ impl Default for DiskCacheKeyReloadPolicy {
30973102}
30983103
30993104#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize , Args ) ]
3100- #[ serde( default , deny_unknown_fields ) ]
3105+ #[ serde( default ) ]
31013106pub struct DiskCacheConfig {
31023107 /// Max bytes of cached raw table data. Default 20GB, set it to 0 to disable it.
31033108 #[ clap(
@@ -3135,7 +3140,7 @@ impl Default for DiskCacheConfig {
31353140}
31363141
31373142#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize , Args ) ]
3138- #[ serde( default , deny_unknown_fields ) ]
3143+ #[ serde( default ) ]
31393144pub struct SpillConfig {
31403145 /// Path of spill to local disk. disable if it's empty.
31413146 #[ clap( long, value_name = "VALUE" , default_value = "" ) ]
@@ -3161,7 +3166,7 @@ impl Default for SpillConfig {
31613166}
31623167
31633168#[ derive( Clone , Debug , PartialEq , Eq , Serialize , Deserialize , Args , Default ) ]
3164- #[ serde( default , deny_unknown_fields ) ]
3169+ #[ serde( default ) ]
31653170pub struct ResourcesManagementConfig {
31663171 #[ clap( long = "type" , value_name = "VALUE" , default_value = "self_managed" ) ]
31673172 #[ serde( rename = "type" ) ]
0 commit comments