ldb sometimes specify a string-append merge operator (#5607)
Summary: Right now, ldb cannot scan a DB with merge operands with default ldb. There is no hard to give a general merge operator so that it can at least print out something Pull Request resolved: https://github.com/facebook/rocksdb/pull/5607 Test Plan: Run ldb against a DB with merge operands and see the outputs. Differential Revision: D16442634 fbshipit-source-id: c66c414ec07f219cfc6e6ec2cc14c783ee95df54
This commit is contained in:
parent
112702ac6c
commit
3782accf7d
@ -18,6 +18,7 @@
|
|||||||
* Rate limited deletion of WALs is only enabled if DBOptions::wal_dir is not set, or explicitly set to db_name passed to DB::Open and DBOptions::db_paths is empty, or same as db_paths[0].path
|
* Rate limited deletion of WALs is only enabled if DBOptions::wal_dir is not set, or explicitly set to db_name passed to DB::Open and DBOptions::db_paths is empty, or same as db_paths[0].path
|
||||||
* Overload GetAllKeyVersions() to support non-default column family.
|
* Overload GetAllKeyVersions() to support non-default column family.
|
||||||
* Added new APIs ExportColumnFamily() and CreateColumnFamilyWithImport() to support export and import of a Column Family. https://github.com/facebook/rocksdb/issues/3469
|
* Added new APIs ExportColumnFamily() and CreateColumnFamilyWithImport() to support export and import of a Column Family. https://github.com/facebook/rocksdb/issues/3469
|
||||||
|
* ldb sometimes uses a string-append merge operator if no merge operator is passed in. This is to allow users to print keys from a DB with a merge operator.
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
* Add an option `snap_refresh_nanos` (default to 0) to periodically refresh the snapshot list in compaction jobs. Assign to 0 to disable the feature.
|
* Add an option `snap_refresh_nanos` (default to 0) to periodically refresh the snapshot list in compaction jobs. Assign to 0 to disable the feature.
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "util/coding.h"
|
#include "util/coding.h"
|
||||||
#include "util/stderr_logger.h"
|
#include "util/stderr_logger.h"
|
||||||
#include "util/string_util.h"
|
#include "util/string_util.h"
|
||||||
|
#include "utilities/merge_operators.h"
|
||||||
#include "utilities/ttl/db_ttl_impl.h"
|
#include "utilities/ttl/db_ttl_impl.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -353,11 +354,24 @@ void LDBCommand::OpenDB() {
|
|||||||
stderr,
|
stderr,
|
||||||
"wal_dir loaded from the option file doesn't exist. Ignore it.\n");
|
"wal_dir loaded from the option file doesn't exist. Ignore it.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If merge operator is not set, set a string append operator. There is
|
||||||
|
// no harm doing it.
|
||||||
|
for (auto& cf_entry : column_families_) {
|
||||||
|
if (!cf_entry.options.merge_operator) {
|
||||||
|
cf_entry.options.merge_operator =
|
||||||
|
MergeOperators::CreateStringAppendOperator(':');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
options_ = PrepareOptionsForOpenDB();
|
options_ = PrepareOptionsForOpenDB();
|
||||||
if (!exec_state_.IsNotStarted()) {
|
if (!exec_state_.IsNotStarted()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (column_families_.empty() && !options_.merge_operator) {
|
||||||
|
// No harm to add a general merge operator if it is not specified.
|
||||||
|
options_.merge_operator = MergeOperators::CreateStringAppendOperator(':');
|
||||||
|
}
|
||||||
// Open the DB.
|
// Open the DB.
|
||||||
Status st;
|
Status st;
|
||||||
std::vector<ColumnFamilyHandle*> handles_opened;
|
std::vector<ColumnFamilyHandle*> handles_opened;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user