mirror of https://gitee.com/bigwinds/arangodb
re-added single-operation hints
This commit is contained in:
parent
ce31d754e4
commit
88b6828abb
|
@ -575,6 +575,7 @@ int ContinuousSyncer::processDocument(TRI_replication_operation_e type,
|
|||
// update the apply tick for all standalone operations
|
||||
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
|
||||
cid, TRI_TRANSACTION_WRITE);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
|
|
|
@ -125,10 +125,7 @@ bool RestDocumentHandler::createDocument() {
|
|||
// find and load collection given by name or identifier
|
||||
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
|
||||
collection, TRI_TRANSACTION_WRITE);
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
// .............................................................................
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
|
@ -147,10 +144,6 @@ bool RestDocumentHandler::createDocument() {
|
|||
// result stays valid!
|
||||
res = trx.finish(result.code);
|
||||
|
||||
// .............................................................................
|
||||
// outside write transaction
|
||||
// .............................................................................
|
||||
|
||||
if (result.failed()) {
|
||||
generateTransactionError(result);
|
||||
return false;
|
||||
|
@ -267,6 +260,7 @@ bool RestDocumentHandler::readSingleDocument(bool generateBody) {
|
|||
// find and load collection given by name or identifier
|
||||
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
|
||||
collection, TRI_TRANSACTION_READ);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
// .............................................................................
|
||||
// inside read transaction
|
||||
|
@ -571,6 +565,7 @@ bool RestDocumentHandler::modifyDocument(bool isPatch) {
|
|||
// find and load collection given by name or identifier
|
||||
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
|
||||
collectionName, TRI_TRANSACTION_WRITE);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
|
@ -709,6 +704,7 @@ bool RestDocumentHandler::deleteDocument() {
|
|||
|
||||
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
|
||||
collectionName, TRI_TRANSACTION_WRITE);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
|
|
|
@ -34,16 +34,6 @@ using namespace arangodb;
|
|||
using namespace arangodb::basics;
|
||||
using namespace arangodb::rest;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief free a string if defined, nop otherwise
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define FREE_STRING(zone, what) \
|
||||
if (what != 0) { \
|
||||
TRI_Free(zone, what); \
|
||||
what = 0; \
|
||||
}
|
||||
|
||||
RestEdgeHandler::RestEdgeHandler(HttpRequest* request)
|
||||
: RestDocumentHandler(request) {}
|
||||
|
||||
|
@ -129,10 +119,8 @@ bool RestEdgeHandler::createDocument() {
|
|||
// find and load collection given by name or identifier
|
||||
SingleCollectionTransaction trx(StandaloneTransactionContext::Create(_vocbase),
|
||||
collection, TRI_TRANSACTION_WRITE);
|
||||
|
||||
// .............................................................................
|
||||
// inside write transaction
|
||||
// .............................................................................
|
||||
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
int res = trx.begin();
|
||||
|
||||
|
@ -166,10 +154,6 @@ bool RestEdgeHandler::createDocument() {
|
|||
// result stays valid!
|
||||
res = trx.finish(result.code);
|
||||
|
||||
// .............................................................................
|
||||
// outside write transaction
|
||||
// .............................................................................
|
||||
|
||||
if (result.failed()) {
|
||||
// TODO correct errors for _from or _to invalid.
|
||||
/* wrongPart is either from or to
|
||||
|
|
|
@ -335,6 +335,7 @@ static void ExistsVocbaseVPack(
|
|||
TRI_ASSERT(search.isObject());
|
||||
|
||||
SingleCollectionTransaction trx(transactionContext, collectionName, TRI_TRANSACTION_READ);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
res = trx.begin();
|
||||
|
||||
|
@ -343,7 +344,7 @@ static void ExistsVocbaseVPack(
|
|||
}
|
||||
|
||||
OperationOptions options;
|
||||
options.silent = true; // We do not care for the result anyways
|
||||
options.silent = true; // We do not care for the result anyway
|
||||
OperationResult opResult = trx.document(collectionName, search, options);
|
||||
|
||||
res = trx.finish(opResult.code);
|
||||
|
@ -463,6 +464,7 @@ static void ReplaceVocbaseCol(bool useCollection,
|
|||
TRI_ASSERT(search.isObject());
|
||||
|
||||
SingleCollectionTransaction trx(transactionContext, collectionName, TRI_TRANSACTION_WRITE);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
res = trx.begin();
|
||||
|
||||
|
@ -566,6 +568,7 @@ static void DocumentVocbaseVPack(
|
|||
TRI_ASSERT(search.isObject());
|
||||
|
||||
SingleCollectionTransaction trx(transactionContext, collectionName, TRI_TRANSACTION_READ);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
res = trx.begin();
|
||||
|
||||
|
@ -704,6 +707,8 @@ static void UpdateVocbaseVPack(bool useCollection,
|
|||
TRI_ASSERT(search.isObject());
|
||||
|
||||
SingleCollectionTransaction trx(transactionContext, collectionName, TRI_TRANSACTION_WRITE);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
res = trx.begin();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
@ -825,6 +830,7 @@ static void RemoveVocbaseVPack(
|
|||
TRI_ASSERT(toRemove.isObject());
|
||||
|
||||
SingleCollectionTransaction trx(transactionContext, collectionName, TRI_TRANSACTION_WRITE);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
res = trx.begin();
|
||||
|
||||
|
@ -1809,6 +1815,8 @@ static void JS_SaveVocbase(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
|||
// load collection
|
||||
SingleCollectionTransaction trx(V8TransactionContext::Create(vocbase, true),
|
||||
collectionName, TRI_TRANSACTION_WRITE);
|
||||
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
|
||||
res = trx.begin();
|
||||
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
|
|
|
@ -342,10 +342,7 @@ int RecoverState::executeSingleOperation(
|
|||
try {
|
||||
trx = new SingleCollectionTransaction(arangodb::StandaloneTransactionContext::Create(vocbase), collectionId, TRI_TRANSACTION_WRITE);
|
||||
|
||||
if (trx == nullptr) {
|
||||
THROW_ARANGO_EXCEPTION(res);
|
||||
}
|
||||
|
||||
trx->addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||
trx->addHint(TRI_TRANSACTION_HINT_NO_BEGIN_MARKER, false);
|
||||
trx->addHint(TRI_TRANSACTION_HINT_NO_ABORT_MARKER, false);
|
||||
trx->addHint(TRI_TRANSACTION_HINT_NO_THROTTLING, false);
|
||||
|
|
Loading…
Reference in New Issue