mirror of https://gitee.com/bigwinds/arangodb
simplifications
This commit is contained in:
parent
88bfe4d0ff
commit
82bbc28963
|
@ -335,50 +335,40 @@ int RecoverState::executeSingleOperation(
|
||||||
return TRI_ERROR_NO_ERROR;
|
return TRI_ERROR_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
SingleCollectionTransaction* trx = nullptr;
|
|
||||||
EnvelopeMarker* envelope = nullptr;
|
|
||||||
res = TRI_ERROR_INTERNAL;
|
res = TRI_ERROR_INTERNAL;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
trx = new SingleCollectionTransaction(arangodb::StandaloneTransactionContext::Create(vocbase), collectionId, TRI_TRANSACTION_WRITE);
|
SingleCollectionTransaction trx(arangodb::StandaloneTransactionContext::Create(vocbase), collectionId, TRI_TRANSACTION_WRITE);
|
||||||
|
|
||||||
trx->addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false);
|
||||||
trx->addHint(TRI_TRANSACTION_HINT_NO_BEGIN_MARKER, 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_ABORT_MARKER, false);
|
||||||
trx->addHint(TRI_TRANSACTION_HINT_NO_THROTTLING, false);
|
trx.addHint(TRI_TRANSACTION_HINT_NO_THROTTLING, false);
|
||||||
trx->addHint(TRI_TRANSACTION_HINT_LOCK_NEVER, false);
|
trx.addHint(TRI_TRANSACTION_HINT_LOCK_NEVER, false);
|
||||||
|
|
||||||
res = trx->begin();
|
res = trx.begin();
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
THROW_ARANGO_EXCEPTION(res);
|
THROW_ARANGO_EXCEPTION(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
envelope = new EnvelopeMarker(marker, fid);
|
auto envelope = std::make_unique<EnvelopeMarker>(marker, fid);
|
||||||
|
|
||||||
// execute the operation
|
// execute the operation
|
||||||
res = func(trx, envelope);
|
res = func(&trx, envelope.get());
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
THROW_ARANGO_EXCEPTION(res);
|
THROW_ARANGO_EXCEPTION(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// commit the operation
|
// commit the operation
|
||||||
res = trx->commit();
|
res = trx.commit();
|
||||||
} catch (arangodb::basics::Exception const& ex) {
|
} catch (arangodb::basics::Exception const& ex) {
|
||||||
res = ex.code();
|
res = ex.code();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
res = TRI_ERROR_INTERNAL;
|
res = TRI_ERROR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (envelope != nullptr) {
|
|
||||||
delete envelope;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (trx != nullptr) {
|
|
||||||
delete trx;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue