1
0
Fork 0

small changes

This commit is contained in:
jsteemann 2016-04-29 01:01:38 +02:00
parent 6ac4c809ee
commit 7974b2bc42
3 changed files with 13 additions and 14 deletions

View File

@ -89,8 +89,7 @@ VPackBuilder BindParameters::StripCollectionNames(VPackSlice const& keys,
if (element.isString()) {
VPackValueLength l;
char const* s = element.getString(l);
char search = '/';
auto p = static_cast<char const*>(memchr(s, search, l));
auto p = static_cast<char const*>(memchr(s, '/', l));
if (p != nullptr && strncmp(s, collectionName, p - s) == 0) {
// key begins with collection name + '/', now strip it in place for
// further comparisons

View File

@ -163,7 +163,7 @@ void AffinityFeature::prepare() {
void AffinityFeature::start() {
if (0 < _threadAffinity) {
LOG(INFO) << "the server has " << _n << " (hyper) cores, using " << _ns
<< " scheduler threads, " << _nd << " dispatcher threads";
<< " scheduler thread(s), " << _nd << " dispatcher thread(s)";
if (0 < _ns) {
LOG(DEBUG) << "scheduler cores: " << _ps;
@ -182,6 +182,6 @@ void AffinityFeature::start() {
size_t ns = (scheduler == nullptr ? 0 : scheduler->concurrency());
LOG(INFO) << "the server has " << _n << " (hyper) cores, using " << ns
<< " scheduler threads, " << nd << " dispatcher threads";
<< " scheduler thread(s), " << nd << " dispatcher thread(s)";
}
}

View File

@ -117,6 +117,11 @@ static void EdgesQuery(TRI_edge_direction_e direction,
if (collection == nullptr) {
TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection");
}
if (collection->_type != TRI_COL_TYPE_EDGE) {
TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_TYPE_INVALID);
}
auto addOne = [](v8::Isolate* isolate, VPackBuilder* builder, v8::Handle<v8::Value> const val) {
if (val->IsString() || val->IsStringObject()) {
@ -161,10 +166,6 @@ static void EdgesQuery(TRI_edge_direction_e direction,
filter = buildFilter(direction, "==");
}
if (collection->_type != TRI_COL_TYPE_EDGE) {
TRI_V8_THROW_EXCEPTION(TRI_ERROR_ARANGO_COLLECTION_TYPE_INVALID);
}
std::string const queryString = "FOR doc IN @@collection " + filter + " RETURN doc";
v8::Handle<v8::Value> result = AqlQuery(isolate, collection, queryString, bindVars).result;
@ -202,6 +203,8 @@ static void JS_AllQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
if (!args[1]->IsNull() && !args[1]->IsUndefined()) {
limit = TRI_ObjectToUInt64(args[1], false);
}
std::string collectionName(collection->_name);
SingleCollectionTransaction trx(V8TransactionContext::Create(collection->_vocbase, true),
collection->_cid, TRI_TRANSACTION_READ);
@ -212,8 +215,6 @@ static void JS_AllQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
TRI_V8_THROW_EXCEPTION(res);
}
std::string collectionName(collection->_name);
// We directly read the entire cursor. so batchsize == limit
std::shared_ptr<OperationCursor> opCursor =
trx.indexScan(collectionName, Transaction::CursorType::ALL,
@ -286,8 +287,8 @@ static void JS_AnyQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection");
}
TRI_doc_mptr_t document;
std::string collectionName(col->_name);
SingleCollectionTransaction trx(V8TransactionContext::Create(col->_vocbase, true),
col->_cid, TRI_TRANSACTION_READ);
@ -296,8 +297,7 @@ static void JS_AnyQuery(v8::FunctionCallbackInfo<v8::Value> const& args) {
if (res != TRI_ERROR_NO_ERROR) {
TRI_V8_THROW_EXCEPTION(res);
}
std::string collectionName(col->_name);
OperationResult cursor = trx.any(collectionName);
res = trx.finish(cursor.code);