1
0
Fork 0

Fixed a bug in primaryindex. In some cases it reported that it could not find more documents although there were more.

This commit is contained in:
Michael Hackstein 2017-02-03 16:15:41 +01:00
parent eab6907678
commit 63f0e52e49
4 changed files with 40 additions and 8 deletions

View File

@ -119,12 +119,9 @@ bool MMFilesPrimaryIndexIterator::next(TokenCallback const& cb, size_t limit) {
if (result) {
cb(MMFilesToken{result.revisionId()});
--limit;
} else {
// We are done
return false;
}
}
return true;
return _iterator.valid();
}
void MMFilesPrimaryIndexIterator::reset() { _iterator.reset(); }

View File

@ -75,10 +75,9 @@ bool SingleServerEdgeCursor::next(std::vector<VPackSlice>& result,
if (_currentCursor == _cursors.size()) {
return false;
}
_cachePos++;
if (_cachePos < _cache.size()) {
LogicalCollection* collection = _cursors[_currentCursor][_currentSubCursor]->collection();
if (collection->readDocument(_trx, *_mmdr, _cache[_cachePos])) {
if (collection->readDocument(_trx, *_mmdr, _cache[_cachePos++])) {
result.emplace_back(_mmdr->vpack());
}
if (_internalCursorMapping != nullptr) {
@ -132,7 +131,7 @@ bool SingleServerEdgeCursor::next(std::vector<VPackSlice>& result,
TRI_ASSERT(_cachePos < _cache.size());
LogicalCollection* collection = cursor->collection();
if (collection->readDocument(_trx, *_mmdr, _cache[_cachePos])) {
if (collection->readDocument(_trx, *_mmdr, _cache[_cachePos++])) {
result.emplace_back(_mmdr->vpack());
}
if (_internalCursorMapping != nullptr) {

View File

@ -171,6 +171,25 @@ function explainSuite () {
]
};
assertEqual([ 1, 2, 3], AQL_EXECUTE(query, bindParams).json);
},
testInvalidValuesInINFilter : function () {
var query = "FOR i IN " + cn + " FILTER i._id IN @idList SORT i.value RETURN i.value";
var bindParams = {
idList: [
null,
cn + "/testkey1", // Find this
"blub/bla",
"noKey",
cn + "/testkey2", // And this
123456,
{ "the": "foxx", "is": "wrapped", "in":"objects"},
[15, "man", "on", "the", "dead", "mans", "chest"],
cn + "/testkey3" // And this
]
};
require("internal").db._explain(query, bindParams);
assertEqual([ 1, 2, 3], AQL_EXECUTE(query, bindParams).json);
}
};
}

View File

@ -171,8 +171,25 @@ function explainSuite () {
]
};
assertEqual([ 1, 2, 3], AQL_EXECUTE(query, bindParams).json);
}
},
testInvalidValuesInCondition : function () {
var query = "FOR i IN " + cn + " FILTER i._id IN @idList SORT i.value RETURN i.value";
var bindParams = {
idList: [
null,
cn + "/testkey1", // Find this
"blub/bla",
"noKey",
cn + "/testkey2", // And this
123456,
{ "the": "foxx", "is": "wrapped", "in":"objects"},
[15, "man", "on", "the", "dead", "mans", "chest"],
cn + "/testkey3" // And this
]
};
assertEqual([ 1, 2, 3], AQL_EXECUTE(query, bindParams).json);
}
};
}