1
0
Fork 0

minor patches

This commit is contained in:
Jan Steemann 2015-10-30 15:12:41 +01:00 committed by Frank Celler
parent c88ab6b49c
commit afdcc68e51
2 changed files with 24 additions and 19 deletions

View File

@ -2917,19 +2917,23 @@ AqlValue Functions::Edges (triagens::aql::Query* query,
if (exampleJson.isArray()) { if (exampleJson.isArray()) {
size_t exampleCount = exampleJson.size(); size_t exampleCount = exampleJson.size();
// We only support objects here so validate // We only support objects here so validate
for (size_t k = 0; k < exampleCount; ++k) { for (size_t k = 0; k < exampleCount; /* nothing */) {
if (! exampleJson.at(k).isObject()) { if (exampleJson.at(k).isObject()) {
++k;
continue;
}
RegisterWarning(query, "EDGES", TRI_ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH); RegisterWarning(query, "EDGES", TRI_ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
if (TRI_DeleteArrayJson(TRI_UNKNOWN_MEM_ZONE, exampleJson.json(), k)) { if (TRI_DeleteArrayJson(TRI_UNKNOWN_MEM_ZONE, exampleJson.json(), k)) {
--k; // don't modify count
--exampleCount; --exampleCount;
} }
else { else {
// Should never occur. // Should never occur.
// If it occurs in production it will simply fall through // If it occurs in production it will simply fall through
// it can only retern more results than expected and not do any harm. // it can only return more results than expected and not do any harm.
TRI_ASSERT(false); TRI_ASSERT(false);
} ++k;
} }
} }
if (exampleCount > 0) { if (exampleCount > 0) {
@ -2946,17 +2950,19 @@ AqlValue Functions::Edges (triagens::aql::Query* query,
if (buildMatcher) { if (buildMatcher) {
try { try {
triagens::arango::ExampleMatcher matcher(exampleJson.json(), shaper, resolver); triagens::arango::ExampleMatcher matcher(exampleJson.json(), shaper, resolver);
for (size_t i = 0; i < resultCount; ++i) { for (size_t i = 0; i < resultCount; /* nothing */) {
if (! matcher.matches(cid, &edges[i])) { if (! matcher.matches(cid, &edges[i])) {
edges.erase(edges.begin() + i); edges.erase(edges.begin() + i);
--i;
--resultCount; --resultCount;
} }
else {
++i;
} }
} }
catch (triagens::basics::Exception& e) { }
catch (triagens::basics::Exception const& e) {
if (e.code() != TRI_RESULT_ELEMENT_NOT_FOUND) { if (e.code() != TRI_RESULT_ELEMENT_NOT_FOUND) {
throw e; throw;
} }
// Illegal match, we cannot filter anything // Illegal match, we cannot filter anything
edges.clear(); edges.clear();

View File

@ -86,8 +86,6 @@ int Transaction::readIncremental (TRI_transaction_collection_t* trxCollection,
return TRI_ERROR_OUT_OF_MEMORY; return TRI_ERROR_OUT_OF_MEMORY;
} }
uint64_t count = 0;
try { try {
if (batchSize > 2048) { if (batchSize > 2048) {
docs.reserve(2048); docs.reserve(2048);
@ -97,6 +95,7 @@ int Transaction::readIncremental (TRI_transaction_collection_t* trxCollection,
} }
auto primaryIndex = document->primaryIndex(); auto primaryIndex = document->primaryIndex();
uint64_t count = 0;
while (count < batchSize || skip > 0) { while (count < batchSize || skip > 0) {
TRI_doc_mptr_t const* mptr = primaryIndex->lookupSequential(internalSkip, total); TRI_doc_mptr_t const* mptr = primaryIndex->lookupSequential(internalSkip, total);