mirror of https://gitee.com/bigwinds/arangodb
Fixed bugs in SkiplistIndex2. Introduced by refactoring
This commit is contained in:
parent
dd20dc4c7f
commit
2aed925ddc
|
@ -365,7 +365,7 @@ bool SkiplistIterator::findHelperIntervalIntersectionValid (
|
||||||
|
|
||||||
void SkiplistIterator::findHelper (
|
void SkiplistIterator::findHelper (
|
||||||
TRI_index_operator_t const* indexOperator,
|
TRI_index_operator_t const* indexOperator,
|
||||||
std::vector<SkiplistIteratorInterval*> intervals
|
std::vector<SkiplistIteratorInterval*>& intervals
|
||||||
) {
|
) {
|
||||||
TRI_skiplist_index_key_t values;
|
TRI_skiplist_index_key_t values;
|
||||||
std::vector<SkiplistIteratorInterval*> leftResult;
|
std::vector<SkiplistIteratorInterval*> leftResult;
|
||||||
|
@ -523,7 +523,7 @@ bool SkiplistIterator::hasPrevIteration () {
|
||||||
// If the leftNode == left end point AND there are no more intervals
|
// If the leftNode == left end point AND there are no more intervals
|
||||||
// then we have no next.
|
// then we have no next.
|
||||||
// ...........................................................................
|
// ...........................................................................
|
||||||
return leftNode != _intervals[_currentInterval]->_leftEndPoint;
|
return leftNode != _intervals.at(_currentInterval)->_leftEndPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -551,7 +551,7 @@ bool SkiplistIterator::hasNextIteration () {
|
||||||
// If the left == right end point AND there are no more intervals then we have
|
// If the left == right end point AND there are no more intervals then we have
|
||||||
// no next.
|
// no next.
|
||||||
// ...........................................................................
|
// ...........................................................................
|
||||||
return leftNode != _intervals[_currentInterval]->_rightEndPoint;
|
return leftNode != _intervals.at(_currentInterval)->_rightEndPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -559,11 +559,10 @@ bool SkiplistIterator::hasNextIteration () {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TRI_index_element_t* SkiplistIterator::prevIteration () {
|
TRI_index_element_t* SkiplistIterator::prevIteration () {
|
||||||
SkiplistIteratorInterval* interval = _intervals[_currentInterval];
|
if (_currentInterval >= _intervals.size()) {
|
||||||
|
|
||||||
if (interval == nullptr) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
SkiplistIteratorInterval* interval = _intervals.at(_currentInterval);
|
||||||
|
|
||||||
// ...........................................................................
|
// ...........................................................................
|
||||||
// use the current cursor and move 1 backward
|
// use the current cursor and move 1 backward
|
||||||
|
@ -579,7 +578,7 @@ TRI_index_element_t* SkiplistIterator::prevIteration () {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
--_currentInterval;
|
--_currentInterval;
|
||||||
interval = _intervals[_currentInterval];
|
interval = _intervals.at(_currentInterval);
|
||||||
TRI_ASSERT(interval != nullptr);
|
TRI_ASSERT(interval != nullptr);
|
||||||
_cursor = interval->_rightEndPoint;
|
_cursor = interval->_rightEndPoint;
|
||||||
result = _index->_skiplistIndex->prevNode(_cursor);
|
result = _index->_skiplistIndex->prevNode(_cursor);
|
||||||
|
@ -601,11 +600,10 @@ TRI_index_element_t* SkiplistIterator::nextIteration () {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkiplistIteratorInterval* interval = _intervals[_currentInterval];
|
if (_currentInterval >= _intervals.size()) {
|
||||||
|
|
||||||
if (interval == nullptr) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
SkiplistIteratorInterval* interval = _intervals.at(_currentInterval);
|
||||||
|
|
||||||
while (true) { // will be left by break
|
while (true) { // will be left by break
|
||||||
_cursor = _cursor->nextNode();
|
_cursor = _cursor->nextNode();
|
||||||
|
@ -618,7 +616,7 @@ TRI_index_element_t* SkiplistIterator::nextIteration () {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
++_currentInterval;
|
++_currentInterval;
|
||||||
interval = _intervals[_currentInterval];
|
interval = _intervals.at(_currentInterval);
|
||||||
TRI_ASSERT(interval != nullptr);
|
TRI_ASSERT(interval != nullptr);
|
||||||
_cursor = interval->_leftEndPoint;
|
_cursor = interval->_leftEndPoint;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,8 @@ namespace triagens {
|
||||||
SkiplistIterator (
|
SkiplistIterator (
|
||||||
SkiplistIndex2* const idx,
|
SkiplistIndex2* const idx,
|
||||||
bool reverse
|
bool reverse
|
||||||
) : _index(idx) {
|
) : _index(idx) ,
|
||||||
|
_reverse(reverse) {
|
||||||
_currentInterval = 0;
|
_currentInterval = 0;
|
||||||
_cursor = nullptr;
|
_cursor = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -136,7 +137,7 @@ namespace triagens {
|
||||||
|
|
||||||
void findHelper (
|
void findHelper (
|
||||||
TRI_index_operator_t const* indexOperator,
|
TRI_index_operator_t const* indexOperator,
|
||||||
std::vector<SkiplistIteratorInterval*> intervals
|
std::vector<SkiplistIteratorInterval*>& intervals
|
||||||
);
|
);
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// --SECTION-- private methods
|
// --SECTION-- private methods
|
||||||
|
|
Loading…
Reference in New Issue