Fix a Windows build error (#10897)

Summary:
The for loop is marked as unreachable code because it will never call the increment. Switch it to `if`.

```
\table\merging_iterator.cc(823): error C2220: the following warning is treated as an error
\table\merging_iterator.cc(823): warning C4702: unreachable code
\table\merging_iterator.cc(1030): error C2220: the following warning is treated as an error
\table\merging_iterator.cc(1030): warning C4702: unreachable code
```

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10897

Reviewed By: cbi42

Differential Revision: D40811790

Pulled By: jay-zhuang

fbshipit-source-id: fe8fd3e7cf3d6f710360c402b79763854d5120df
main
Jay Zhuang 2 years ago committed by Facebook GitHub Bot
parent 900f79126d
commit 36f5e19e33
  1. 7
      table/merging_iterator.cc

@ -820,7 +820,8 @@ bool MergingIterator::SkipNextDeleted() {
// Point key case: check active_ for range tombstone coverage. // Point key case: check active_ for range tombstone coverage.
ParsedInternalKey pik; ParsedInternalKey pik;
ParseInternalKey(current->iter.key(), &pik, false).PermitUncheckedError(); ParseInternalKey(current->iter.key(), &pik, false).PermitUncheckedError();
for (auto& i : active_) { if (!active_.empty()) {
auto i = *active_.begin();
if (i < current->level) { if (i < current->level) {
// range tombstone is from a newer level, definitely covers // range tombstone is from a newer level, definitely covers
assert(comparator_->Compare(range_tombstone_iters_[i]->start_key(), assert(comparator_->Compare(range_tombstone_iters_[i]->start_key(),
@ -1027,7 +1028,8 @@ bool MergingIterator::SkipPrevDeleted() {
// Point key case: check active_ for range tombstone coverage. // Point key case: check active_ for range tombstone coverage.
ParsedInternalKey pik; ParsedInternalKey pik;
ParseInternalKey(current->iter.key(), &pik, false).PermitUncheckedError(); ParseInternalKey(current->iter.key(), &pik, false).PermitUncheckedError();
for (auto& i : active_) { if (!active_.empty()) {
auto i = *active_.begin();
if (i < current->level) { if (i < current->level) {
// range tombstone is from a newer level, definitely covers // range tombstone is from a newer level, definitely covers
assert(comparator_->Compare(range_tombstone_iters_[i]->start_key(), assert(comparator_->Compare(range_tombstone_iters_[i]->start_key(),
@ -1066,6 +1068,7 @@ bool MergingIterator::SkipPrevDeleted() {
return false /* current key not deleted */; return false /* current key not deleted */;
} }
} }
assert(active_.empty()); assert(active_.empty());
assert(maxHeap_->top()->type == HeapItem::ITERATOR); assert(maxHeap_->top()->type == HeapItem::ITERATOR);
return false /* current key not deleted */; return false /* current key not deleted */;

Loading…
Cancel
Save