]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/kv/rocksdb: Fixed merging regions for async compations that could cut compatio... 26786/head
authorAdam Kupczyk <akupczyk@redhat.com>
Wed, 6 Mar 2019 11:57:51 +0000 (12:57 +0100)
committerAdam Kupczyk <akupczyk@redhat.com>
Wed, 6 Mar 2019 11:57:51 +0000 (12:57 +0100)
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
src/kv/RocksDBStore.cc

index 2f47cb5358f80def84e3b5dccc6d7dd82b32df8e..7cc83a012666ab5e904e9b62a3c2793a32a8309b 100644 (file)
@@ -1224,15 +1224,18 @@ void RocksDBStore::compact_range_async(const string& start, const string& end)
       // dup; no-op
       return;
     }
-    if (p->first <= end && p->first > start) {
-      // merge with existing range to the right
-      compact_queue.push_back(make_pair(start, p->second));
+    if (start <= p->first && p->first <= end) {
+      // new region crosses start of existing range
+      // select right bound that is bigger
+      compact_queue.push_back(make_pair(start, end > p->second ? end : p->second));
       compact_queue.erase(p);
       logger->inc(l_rocksdb_compact_queue_merge);
       break;
     }
-    if (p->second >= start && p->second < end) {
-      // merge with existing range to the left
+    if (start <= p->second && p->second <= end) {
+      // new region crosses end of existing range
+      //p->first < p->second and p->second <= end, so p->first <= end.
+      //But we break if previous condition, so start > p->first.
       compact_queue.push_back(make_pair(p->first, end));
       compact_queue.erase(p);
       logger->inc(l_rocksdb_compact_queue_merge);