mirror of https://gitee.com/bigwinds/arangodb
remove revision id from storage engine if write locker cannot be acquired
This commit is contained in:
parent
8d3f411cae
commit
9889e9f91f
|
@ -2064,30 +2064,20 @@ int LogicalCollection::insert(Transaction* trx, VPackSlice const slice,
|
||||||
|
|
||||||
try {
|
try {
|
||||||
insertRevision(revisionId, marker->vpack(), 0, true);
|
insertRevision(revisionId, marker->vpack(), 0, true);
|
||||||
|
// and go on with the insertion...
|
||||||
} catch (basics::Exception const& ex) {
|
} catch (basics::Exception const& ex) {
|
||||||
res = ex.code();
|
return ex.code();
|
||||||
} catch (std::bad_alloc const&) {
|
} catch (std::bad_alloc const&) {
|
||||||
res = TRI_ERROR_OUT_OF_MEMORY;
|
return TRI_ERROR_OUT_OF_MEMORY;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
res = TRI_ERROR_INTERNAL;
|
return TRI_ERROR_INTERNAL;
|
||||||
}
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
try {
|
|
||||||
removeRevision(revisionId, false);
|
|
||||||
} catch (basics::Exception const& ex) {
|
|
||||||
res = ex.code();
|
|
||||||
} catch (std::bad_alloc const&) {
|
|
||||||
res = TRI_ERROR_OUT_OF_MEMORY;
|
|
||||||
} catch (...) {
|
|
||||||
res = TRI_ERROR_INTERNAL;
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// use lock
|
// use lock?
|
||||||
bool const useDeadlockDetector =
|
bool const useDeadlockDetector =
|
||||||
(lock && !trx->isSingleOperationTransaction());
|
(lock && !trx->isSingleOperationTransaction());
|
||||||
|
try {
|
||||||
arangodb::CollectionWriteLocker collectionLocker(this, useDeadlockDetector,
|
arangodb::CollectionWriteLocker collectionLocker(this, useDeadlockDetector,
|
||||||
lock);
|
lock);
|
||||||
|
|
||||||
|
@ -2102,11 +2092,22 @@ int LogicalCollection::insert(Transaction* trx, VPackSlice const slice,
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
res = TRI_ERROR_INTERNAL;
|
res = TRI_ERROR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
} catch (...) {
|
||||||
|
// the collectionLocker may have thrown in its constructor...
|
||||||
|
// if it did, then we need to manually remove the revision id
|
||||||
|
// from the list of revisions
|
||||||
|
try {
|
||||||
|
removeRevision(revisionId, false);
|
||||||
|
} catch (...) {
|
||||||
|
}
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
if (res != TRI_ERROR_NO_ERROR) {
|
||||||
operation.revert(trx);
|
operation.revert(trx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == TRI_ERROR_NO_ERROR) {
|
if (res == TRI_ERROR_NO_ERROR) {
|
||||||
readRevision(trx, result, revisionId);
|
readRevision(trx, result, revisionId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue