From 5a5c0492dbe0c478c3ce5ef34b0dc73b42b91ab4 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Tue, 12 Mar 2019 13:04:20 -0700 Subject: [PATCH] ldb: set `total_order_seek` for scans (#5066) Summary: Without `total_order_seek=true`, using this command with `prefix_extractor` set skips over lots of keys. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5066 Differential Revision: D14425967 Pulled By: sagar0 fbshipit-source-id: f6f142733258d92604f920615be9266e1fe797f8 --- tools/ldb_cmd.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index a53768822..c82369777 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -1469,7 +1469,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_ = @@ -2325,7 +2327,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 {