mirror of https://github.com/facebook/rocksdb.git
Add helpful message for ldb when unknown option found (#11907)
Summary: Users may run into an issue when running ldb on db that's in a different version and they have different set of options: `Failed: Invalid argument: Could not find option: <MISSING_OPTION>` They can work around this by setting `--ignore_unknown_options`, but the error message is not clear for users to find why the option is missing. It's also hard for the users to find the `ignore_unknown_options` option especially if they are not familiar with the codebase or `ldb` tool. This PR changes the error message to help users to find out what's wrong and possible workaround for the issue Pull Request resolved: https://github.com/facebook/rocksdb/pull/11907 Test Plan: Testing by reproducing the issue locally ``` ❯./ldb --db=/data/users/jewoongh/db_crash_whitebox_T164195541/ get a Failed: Invalid argument: Could not find option: : unknown_option_test This tool was built with version 8.8.0. If your db is in a different version, please try again with option --ignore_unknown_options. ``` Reviewed By: jowlyzhang Differential Revision: D49762291 Pulled By: jaykorean fbshipit-source-id: 895570150fde886d5ec524908c4b2664c9230ac9
This commit is contained in:
parent
01e2d33565
commit
2cfe53ec05
|
@ -932,7 +932,15 @@ void LDBCommand::PrepareOptions() {
|
|||
&column_families_);
|
||||
if (!s.ok() && !s.IsNotFound()) {
|
||||
// Option file exists but load option file error.
|
||||
std::string msg = s.ToString();
|
||||
std::string current_version = std::to_string(ROCKSDB_MAJOR) + "." +
|
||||
std::to_string(ROCKSDB_MINOR) + "." +
|
||||
std::to_string(ROCKSDB_PATCH);
|
||||
std::string msg =
|
||||
s.ToString() + "\nThis tool was built with version " +
|
||||
current_version +
|
||||
". If your db is in a different version, please try again "
|
||||
"with option --" +
|
||||
LDBCommand::ARG_IGNORE_UNKNOWN_OPTIONS + ".";
|
||||
exec_state_ = LDBCommandExecuteResult::Failed(msg);
|
||||
db_ = nullptr;
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue