mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
69afcc0501
|
@ -1238,6 +1238,10 @@ static void JS_PropertiesVocbaseCol(
|
||||||
collection->cid(),
|
collection->cid(),
|
||||||
isModification ? TRI_TRANSACTION_WRITE : TRI_TRANSACTION_READ);
|
isModification ? TRI_TRANSACTION_WRITE : TRI_TRANSACTION_READ);
|
||||||
|
|
||||||
|
if (!isModification) {
|
||||||
|
trx.addHint(TRI_TRANSACTION_HINT_NO_USAGE_LOCK, false);
|
||||||
|
}
|
||||||
|
|
||||||
int res = trx.begin();
|
int res = trx.begin();
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
|
|
@ -248,7 +248,6 @@ static void JS_SynchronizeReplication(
|
||||||
database = vocbase->name();
|
database = vocbase->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unordered_map<std::string, bool> restrictCollections;
|
std::unordered_map<std::string, bool> restrictCollections;
|
||||||
if (object->Has(TRI_V8_ASCII_STRING("restrictCollections")) &&
|
if (object->Has(TRI_V8_ASCII_STRING("restrictCollections")) &&
|
||||||
object->Get(TRI_V8_ASCII_STRING("restrictCollections"))->IsArray()) {
|
object->Get(TRI_V8_ASCII_STRING("restrictCollections"))->IsArray()) {
|
||||||
|
@ -371,7 +370,21 @@ static void JS_SynchronizeReplication(
|
||||||
}
|
}
|
||||||
|
|
||||||
result->Set(TRI_V8_ASCII_STRING("collections"), collections);
|
result->Set(TRI_V8_ASCII_STRING("collections"), collections);
|
||||||
|
} catch (arangodb::basics::Exception const& ex) {
|
||||||
|
res = ex.code();
|
||||||
|
if (errorMsg.empty()) {
|
||||||
|
errorMsg = std::string("caught exception: ") + ex.what();
|
||||||
|
}
|
||||||
|
} catch (std::exception const& ex) {
|
||||||
|
res = TRI_ERROR_INTERNAL;
|
||||||
|
if (errorMsg.empty()) {
|
||||||
|
errorMsg = std::string("caught exception: ") + ex.what();
|
||||||
|
}
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
res = TRI_ERROR_INTERNAL;
|
||||||
|
if (errorMsg.empty()) {
|
||||||
|
errorMsg = "caught unknown exception";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
|
|
@ -933,6 +933,8 @@ static void JS_GetIndexesVocbaseCol(
|
||||||
V8TransactionContext::Create(collection->vocbase(), true),
|
V8TransactionContext::Create(collection->vocbase(), true),
|
||||||
collection->cid(), TRI_TRANSACTION_READ);
|
collection->cid(), TRI_TRANSACTION_READ);
|
||||||
|
|
||||||
|
trx.addHint(TRI_TRANSACTION_HINT_NO_USAGE_LOCK, false);
|
||||||
|
|
||||||
int res = trx.begin();
|
int res = trx.begin();
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
|
@ -942,12 +944,11 @@ static void JS_GetIndexesVocbaseCol(
|
||||||
// READ-LOCK start
|
// READ-LOCK start
|
||||||
trx.lockRead();
|
trx.lockRead();
|
||||||
|
|
||||||
arangodb::LogicalCollection* col = trx.documentCollection();
|
std::string const collectionName(collection->name());
|
||||||
std::string const collectionName(col->name());
|
|
||||||
|
|
||||||
// get list of indexes
|
// get list of indexes
|
||||||
TransactionBuilderLeaser builder(&trx);
|
TransactionBuilderLeaser builder(&trx);
|
||||||
auto indexes = col->getIndexes();
|
auto indexes = collection->getIndexes();
|
||||||
|
|
||||||
trx.finish(res);
|
trx.finish(res);
|
||||||
// READ-LOCK end
|
// READ-LOCK end
|
||||||
|
|
|
@ -133,14 +133,20 @@ ChunkProtector ReadCache::insertAndLease(TRI_voc_rid_t revisionId, uint8_t const
|
||||||
TRI_ASSERT(p.version() != 0);
|
TRI_ASSERT(p.version() != 0);
|
||||||
memcpy(p.vpack(), vpack, size);
|
memcpy(p.vpack(), vpack, size);
|
||||||
|
|
||||||
RevisionCacheChunk* chunk = p.chunk();
|
|
||||||
chunk->unqueueWriter();
|
|
||||||
TRI_ASSERT(VPackSlice(p.vpack()).isObject());
|
TRI_ASSERT(VPackSlice(p.vpack()).isObject());
|
||||||
|
RevisionCacheChunk* chunk = p.chunk();
|
||||||
|
try {
|
||||||
if (result.hasSeenChunk(chunk)) {
|
if (result.hasSeenChunk(chunk)) {
|
||||||
result.addExisting(p, revisionId);
|
result.addExisting(p, revisionId);
|
||||||
} else {
|
} else {
|
||||||
result.add(p, revisionId);
|
result.add(p, revisionId);
|
||||||
}
|
}
|
||||||
|
chunk->unqueueWriter();
|
||||||
|
} catch (...) {
|
||||||
|
chunk->unqueueWriter();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -400,11 +400,21 @@ static int UseCollections(TRI_transaction_t* trx, int nestingLevel) {
|
||||||
} else {
|
} else {
|
||||||
// use without usage-lock (lock already set externally)
|
// use without usage-lock (lock already set externally)
|
||||||
trxCollection->_collection = trx->_vocbase->lookupCollection(trxCollection->_cid);
|
trxCollection->_collection = trx->_vocbase->lookupCollection(trxCollection->_cid);
|
||||||
|
|
||||||
|
if (trxCollection->_collection == nullptr) {
|
||||||
|
return TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trxCollection->_collection == nullptr) {
|
if (trxCollection->_collection == nullptr) {
|
||||||
// something went wrong
|
// something went wrong
|
||||||
return TRI_errno();
|
int res = TRI_errno();
|
||||||
|
|
||||||
|
if (res == TRI_ERROR_NO_ERROR) {
|
||||||
|
// must return an error
|
||||||
|
res = TRI_ERROR_INTERNAL;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trxCollection->_accessType == TRI_TRANSACTION_WRITE &&
|
if (trxCollection->_accessType == TRI_TRANSACTION_WRITE &&
|
||||||
|
|
|
@ -130,6 +130,9 @@ function cancelReadLockOnLeader (endpoint, database, lockJobId) {
|
||||||
// //////////////////////////////////////////////////////////////////////////////
|
// //////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
function cancelBarrier (endpoint, database, barrierId) {
|
function cancelBarrier (endpoint, database, barrierId) {
|
||||||
|
if (barrierId <= 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
var url = endpointToURL(endpoint) + '/_db/' + database +
|
var url = endpointToURL(endpoint) + '/_db/' + database +
|
||||||
'/_api/replication/barrier/' + barrierId;
|
'/_api/replication/barrier/' + barrierId;
|
||||||
var r = request({url, method: 'DELETE' });
|
var r = request({url, method: 'DELETE' });
|
||||||
|
|
Loading…
Reference in New Issue