-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
util/config: fix #1956 config error printing #1957
Conversation
src/util/config.rs
Outdated
"no" => Ok(DBCompressionType::DBNo), | ||
"snappy" => Ok(DBCompressionType::DBSnappy), | ||
"zlib" => Ok(DBCompressionType::DBZlib), | ||
"bzip2" => Ok(DBCompressionType::DBBz2), | ||
"lz4" => Ok(DBCompressionType::DBLz4), | ||
"lz4hc" => Ok(DBCompressionType::DBLz4hc), | ||
_ => Err(ConfigError::RocksDB), | ||
"zstd" => Ok(DBCompressionType::DBZstd), | ||
v => Err(ConfigError::Value(format!("cannot parse {:?} as a compression type", v))), |
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.
"invalid compression type {:?}"
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.
Rest LGTM
|
||
Ok(result) | ||
tp.split(':') | ||
.map(parse_rocksdb_compression) |
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.
It won't compile. And format is broken.
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 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 made a mistake, it should be fine here.
PTAL @BusyJay |
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.
rest LGTM
src/util/config.rs
Outdated
"no" => Ok(DBCompressionType::DBNo), | ||
"snappy" => Ok(DBCompressionType::DBSnappy), | ||
"zlib" => Ok(DBCompressionType::DBZlib), | ||
"bzip2" => Ok(DBCompressionType::DBBz2), | ||
"lz4" => Ok(DBCompressionType::DBLz4), | ||
"lz4hc" => Ok(DBCompressionType::DBLz4hc), | ||
_ => Err(ConfigError::RocksDB), | ||
"zstd" => Ok(DBCompressionType::DBZstd), | ||
v => Err(ConfigError::Value(format!("invalid compression type {:?}", v))), |
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.
Should use tp
instead of v
.
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.
reject.
won't fix and will wait all other v
s in codebase.
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.
v
is a temporary variable during processing, using tp
is more clear and straight forward for user. You can raise a pr to clean up all the other places. But since this pr is about to fix error printing, so it's fine to fix them all in this pr too.
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.
any update here?
Maybe we can keep it for now and use another PR to clean up all?
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.
Just checked out the diff, places need to be changed are L54 and L128, all are introduced in this pr.
Ping @andelf |
PTAL @BusyJay |
LGTM |
Fixes #1956
PTAL @zhangjinpeng1987 @siddontang