]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fixed endless loop in DBIter::FindPrevUserKey()
authorYueh-Hsuan Chiang <yhchiang@fb.com>
Thu, 2 Jul 2015 23:10:31 +0000 (16:10 -0700)
committeragiardullo <agiardullo@fb.com>
Tue, 7 Jul 2015 19:33:29 +0000 (12:33 -0700)
Summary: Fixed endless loop in DBIter::FindPrevUserKey()

Test Plan: ./db_stress --test_batches_snapshots=1 --threads=32 --write_buffer_size=4194304 --destroy_db_initially=0 --reopen=20 --readpercent=45 --prefixpercent=5 --writepercent=35 --delpercent=5 --iterpercent=10 --db=/tmp/rocksdb_crashtest_KdCI5F --max_key=100000000 --mmap_read=0 --block_size=16384 --cache_size=1048576 --open_files=500000 --verify_checksum=1 --sync=0 --progress_reports=0 --disable_wal=0 --disable_data_sync=1 --target_file_size_base=2097152 --target_file_size_multiplier=2 --max_write_buffer_number=3 --max_background_compactions=20 --max_bytes_for_level_base=10485760 --filter_deletes=0 --memtablerep=prefix_hash --prefix_size=7 --ops_per_thread=200 --kill_random_test=97

Reviewers: tnovak, igor, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D41085
(cherry picked from commit acee2b08a2d37154b8f9e2dc74b1966202c15ec5)

table/merger.cc

index b418b88a406c0edca5e48b7a52827f50409f1ce4..9781d0dcaf44d62b2074df8f0ea0f4e54f1db3d9 100644 (file)
@@ -208,6 +208,19 @@ class MergingIterator : public Iterator {
           } else {
             // Child has no entries >= key().  Position at last entry.
             child.SeekToLast();
+            if (child.Valid() && comparator_->Compare(child.key(), key()) > 0) {
+              // Prefix bloom or prefix hash may return !Valid() if one of the
+              // following condition happens:  1. when prefix doesn't match.
+              // 2. Does not exist any row larger than the key within the prefix
+              // while SeekToLast() may return larger keys.
+              //
+              // Temporarily remove this child to avoid Prev() to return a key
+              // larger than the original keys. However, this can cause missing
+              // rows.
+              //
+              // TODO(3.13): need to fix.
+              continue;
+            }
           }
           if (child.Valid()) {
             maxHeap_.push(&child);