1
0
Fork 0

fixed too eager iteration over skiplists

This commit is contained in:
Jan Steemann 2014-05-28 15:19:57 +02:00
parent 9c4188e42b
commit bd9e8b0478
1 changed files with 11 additions and 4 deletions

View File

@ -1128,7 +1128,8 @@ static v8::Handle<v8::Value> ExecuteSkiplistQuery (v8::Arguments const& argv,
bool error = false;
bool usedBarrier = false;
while (true) {
while (limit > 0) {
TRI_skiplist_index_element_t* indexElement = skiplistIterator->_next(skiplistIterator);
if (indexElement == NULL) {
@ -1152,13 +1153,17 @@ static v8::Handle<v8::Value> ExecuteSkiplistQuery (v8::Arguments const& argv,
barrier,
usedBarrier);
if (doc.IsEmpty()) {
error = true;
break;
}
else {
documents->Set(count, doc);
++count;
if (++count >= limit) {
break;
}
}
}
@ -1344,7 +1349,7 @@ static v8::Handle<v8::Value> ExecuteBitarrayQuery (v8::Arguments const& argv,
bool usedBarrier = false;
if (indexIterator != NULL) {
while (true) {
while (limit > 0) {
TRI_doc_mptr_t* data = (TRI_doc_mptr_t*) indexIterator->_next(indexIterator);
if (data == NULL) {
@ -1371,7 +1376,9 @@ static v8::Handle<v8::Value> ExecuteBitarrayQuery (v8::Arguments const& argv,
}
else {
documents->Set(count, doc);
++count;
if (++count >= limit) {
break;
}
}
}
}