From d783af1857fe157b401ec4fb0e8d07faa0ed31d1 Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 1 Oct 2019 19:25:12 -0700 Subject: [PATCH] Fix a timer bug in MergingIterator::Seek() caused by #5871 (#5874) Summary: Conflict resolving in 846e05005d78dfd4276cce6753967cb16930aabb ("Revert "Merging iterator to avoid child iterator reseek for some cases") caused some timer misplaced. Fix it. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5874 Test Plan: See it build. Differential Revision: D17705073 fbshipit-source-id: 9bd3a8dc4901ac33c2c6fc5b1091ffbc56a8529f --- table/merging_iterator.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/table/merging_iterator.cc b/table/merging_iterator.cc index 189850887..2ee379b05 100644 --- a/table/merging_iterator.cc +++ b/table/merging_iterator.cc @@ -112,15 +112,18 @@ class MergingIterator : public InternalIterator { ClearHeaps(); status_ = Status::OK(); for (auto& child : children_) { - PERF_TIMER_GUARD(seek_child_seek_time); - - child.Seek(target); + { + PERF_TIMER_GUARD(seek_child_seek_time); + child.Seek(target); + } PERF_COUNTER_ADD(seek_child_seek_count, 1); - // Strictly, we timed slightly more than min heap operation, - // but these operations are very cheap. - PERF_TIMER_GUARD(seek_min_heap_time); - AddToMinHeapOrCheckStatus(&child); + { + // Strictly, we timed slightly more than min heap operation, + // but these operations are very cheap. + PERF_TIMER_GUARD(seek_min_heap_time); + AddToMinHeapOrCheckStatus(&child); + } } direction_ = kForward; {