mirror of https://gitee.com/bigwinds/arangodb
turn off deadlock detector in obvious cases in which it is not necessary
This commit is contained in:
parent
22028f14b7
commit
66ec078bd5
|
@ -54,6 +54,7 @@
|
||||||
#include "StorageEngine/EngineSelectorFeature.h"
|
#include "StorageEngine/EngineSelectorFeature.h"
|
||||||
#include "StorageEngine/StorageEngine.h"
|
#include "StorageEngine/StorageEngine.h"
|
||||||
#include "Transaction/Helpers.h"
|
#include "Transaction/Helpers.h"
|
||||||
|
#include "Transaction/Hints.h"
|
||||||
#include "Transaction/Methods.h"
|
#include "Transaction/Methods.h"
|
||||||
#include "Transaction/StandaloneContext.h"
|
#include "Transaction/StandaloneContext.h"
|
||||||
#include "Utils/CollectionNameResolver.h"
|
#include "Utils/CollectionNameResolver.h"
|
||||||
|
@ -1889,7 +1890,7 @@ int MMFilesCollection::read(transaction::Methods* trx, VPackSlice const key,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool const useDeadlockDetector =
|
bool const useDeadlockDetector =
|
||||||
(lock && !trx->isSingleOperationTransaction());
|
(lock && !trx->isSingleOperationTransaction() && !trx->state()->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||||
MMFilesCollectionReadLocker collectionLocker(this, useDeadlockDetector, lock);
|
MMFilesCollectionReadLocker collectionLocker(this, useDeadlockDetector, lock);
|
||||||
|
|
||||||
int res = lookupDocument(trx, key, result);
|
int res = lookupDocument(trx, key, result);
|
||||||
|
@ -2772,7 +2773,7 @@ int MMFilesCollection::insert(transaction::Methods* trx, VPackSlice const slice,
|
||||||
{
|
{
|
||||||
// use lock?
|
// use lock?
|
||||||
bool const useDeadlockDetector =
|
bool const useDeadlockDetector =
|
||||||
(lock && !trx->isSingleOperationTransaction());
|
(lock && !trx->isSingleOperationTransaction() && !trx->state()->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||||
try {
|
try {
|
||||||
// TODO Do we use the CollectionLocker on LogicalCollections
|
// TODO Do we use the CollectionLocker on LogicalCollections
|
||||||
// or do we use it on the SE specific one?
|
// or do we use it on the SE specific one?
|
||||||
|
@ -3115,7 +3116,7 @@ int MMFilesCollection::update(
|
||||||
TRI_IF_FAILURE("UpdateDocumentNoLock") { return TRI_ERROR_DEBUG; }
|
TRI_IF_FAILURE("UpdateDocumentNoLock") { return TRI_ERROR_DEBUG; }
|
||||||
|
|
||||||
bool const useDeadlockDetector =
|
bool const useDeadlockDetector =
|
||||||
(lock && !trx->isSingleOperationTransaction());
|
(lock && !trx->isSingleOperationTransaction() && !trx->state()->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||||
arangodb::MMFilesCollectionWriteLocker collectionLocker(
|
arangodb::MMFilesCollectionWriteLocker collectionLocker(
|
||||||
this, useDeadlockDetector, lock);
|
this, useDeadlockDetector, lock);
|
||||||
|
|
||||||
|
@ -3253,7 +3254,7 @@ int MMFilesCollection::replace(
|
||||||
}
|
}
|
||||||
|
|
||||||
bool const useDeadlockDetector =
|
bool const useDeadlockDetector =
|
||||||
(lock && !trx->isSingleOperationTransaction());
|
(lock && !trx->isSingleOperationTransaction() && !trx->state()->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||||
arangodb::MMFilesCollectionWriteLocker collectionLocker(
|
arangodb::MMFilesCollectionWriteLocker collectionLocker(
|
||||||
this, useDeadlockDetector, lock);
|
this, useDeadlockDetector, lock);
|
||||||
|
|
||||||
|
@ -3420,7 +3421,7 @@ int MMFilesCollection::remove(arangodb::transaction::Methods* trx,
|
||||||
TRI_VOC_DOCUMENT_OPERATION_REMOVE);
|
TRI_VOC_DOCUMENT_OPERATION_REMOVE);
|
||||||
|
|
||||||
bool const useDeadlockDetector =
|
bool const useDeadlockDetector =
|
||||||
(lock && !trx->isSingleOperationTransaction());
|
(lock && !trx->isSingleOperationTransaction() && !trx->state()->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||||
arangodb::MMFilesCollectionWriteLocker collectionLocker(
|
arangodb::MMFilesCollectionWriteLocker collectionLocker(
|
||||||
this, useDeadlockDetector, lock);
|
this, useDeadlockDetector, lock);
|
||||||
|
|
||||||
|
|
|
@ -343,7 +343,8 @@ int MMFilesTransactionCollection::doLock(AccessMode::Type type, int nestingLevel
|
||||||
timeout = 0.00000001;
|
timeout = 0.00000001;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool const useDeadlockDetector = !_transaction->hasHint(transaction::Hints::Hint::SINGLE_OPERATION);
|
bool const useDeadlockDetector = (!_transaction->hasHint(transaction::Hints::Hint::SINGLE_OPERATION) &&
|
||||||
|
!_transaction->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||||
|
|
||||||
int res;
|
int res;
|
||||||
if (!AccessMode::isWriteOrExclusive(type)) {
|
if (!AccessMode::isWriteOrExclusive(type)) {
|
||||||
|
@ -404,7 +405,8 @@ int MMFilesTransactionCollection::doUnlock(AccessMode::Type type, int nestingLev
|
||||||
return TRI_ERROR_INTERNAL;
|
return TRI_ERROR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool const useDeadlockDetector = !_transaction->hasHint(transaction::Hints::Hint::SINGLE_OPERATION);
|
bool const useDeadlockDetector = (!_transaction->hasHint(transaction::Hints::Hint::SINGLE_OPERATION) &&
|
||||||
|
!_transaction->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||||
|
|
||||||
LogicalCollection* collection = _collection;
|
LogicalCollection* collection = _collection;
|
||||||
TRI_ASSERT(collection != nullptr);
|
TRI_ASSERT(collection != nullptr);
|
||||||
|
|
|
@ -45,7 +45,8 @@ class Hints {
|
||||||
TRY_LOCK = 64,
|
TRY_LOCK = 64,
|
||||||
NO_COMPACTION_LOCK = 128,
|
NO_COMPACTION_LOCK = 128,
|
||||||
NO_USAGE_LOCK = 256,
|
NO_USAGE_LOCK = 256,
|
||||||
RECOVERY = 512
|
RECOVERY = 512,
|
||||||
|
NO_DLD = 1024 // disable deadlock detection
|
||||||
};
|
};
|
||||||
|
|
||||||
Hints() : _value(0) {}
|
Hints() : _value(0) {}
|
||||||
|
|
|
@ -44,6 +44,7 @@ SingleCollectionTransaction::SingleCollectionTransaction(
|
||||||
|
|
||||||
// add the (sole) collection
|
// add the (sole) collection
|
||||||
addCollection(cid, _accessType);
|
addCollection(cid, _accessType);
|
||||||
|
addHint(transaction::Hints::Hint::NO_DLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief create the transaction, using a collection name
|
/// @brief create the transaction, using a collection name
|
||||||
|
@ -58,6 +59,7 @@ SingleCollectionTransaction::SingleCollectionTransaction(
|
||||||
// add the (sole) collection
|
// add the (sole) collection
|
||||||
_cid = resolver()->getCollectionId(name);
|
_cid = resolver()->getCollectionId(name);
|
||||||
addCollection(_cid, name.c_str(), _accessType);
|
addCollection(_cid, name.c_str(), _accessType);
|
||||||
|
addHint(transaction::Hints::Hint::NO_DLD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief get the underlying transaction collection
|
/// @brief get the underlying transaction collection
|
||||||
|
|
Loading…
Reference in New Issue