Skip to content

Commit

Permalink
ldb: set total_order_seek for scans
Browse files Browse the repository at this point in the history
Without `total_order_seek=true`, using this command with
`prefix_extractor` set skips over lots of keys.

Test Plan: manually verified it returns all keys now
  • Loading branch information
ajkr committed Mar 12, 2019
1 parent 47e4f25 commit 67cd77a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/ldb_cmd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,9 @@ void DBDumperCommand::DoDumpCommand() {
}

// Setup key iterator
Iterator* iter = db_->NewIterator(ReadOptions(), GetCfHandle());
ReadOptions scan_read_opts;
scan_read_opts.total_order_seek = true;
Iterator* iter = db_->NewIterator(scan_read_opts, GetCfHandle());
Status st = iter->status();
if (!st.ok()) {
exec_state_ =
Expand Down Expand Up @@ -2318,7 +2320,9 @@ void ScanCommand::DoCommand() {
}

int num_keys_scanned = 0;
Iterator* it = db_->NewIterator(ReadOptions(), GetCfHandle());
ReadOptions scan_read_opts;
scan_read_opts.total_order_seek = true;
Iterator* it = db_->NewIterator(scan_read_opts, GetCfHandle());
if (start_key_specified_) {
it->Seek(start_key_);
} else {
Expand Down

0 comments on commit 67cd77a

Please sign in to comment.