mirror of https://gitee.com/bigwinds/arangodb
improve waitForSync performance for mmfiles
This commit is contained in:
parent
b60bda828d
commit
12132c60c7
|
@ -2778,8 +2778,6 @@ int MMFilesCollection::insert(transaction::Methods* trx, VPackSlice const slice,
|
|||
bool const useDeadlockDetector =
|
||||
(lock && !trx->isSingleOperationTransaction() && !trx->state()->hasHint(transaction::Hints::Hint::NO_DLD));
|
||||
try {
|
||||
// TODO Do we use the CollectionLocker on LogicalCollections
|
||||
// or do we use it on the SE specific one?
|
||||
arangodb::MMFilesCollectionWriteLocker collectionLocker(
|
||||
this, useDeadlockDetector, lock);
|
||||
|
||||
|
|
|
@ -282,7 +282,9 @@ int MMFilesTransactionState::addOperation(TRI_voc_rid_t revisionId,
|
|||
}
|
||||
if (localWaitForSync) {
|
||||
// also sync RocksDB WAL
|
||||
MMFilesPersistentIndexFeature::syncWal();
|
||||
if (collection->getPhysical()->hasIndexOfType(arangodb::Index::TRI_IDX_TYPE_PERSISTENT_INDEX)) {
|
||||
MMFilesPersistentIndexFeature::syncWal();
|
||||
}
|
||||
}
|
||||
operation.setTick(slotInfo.tick);
|
||||
fid = slotInfo.logfileId;
|
||||
|
|
|
@ -66,6 +66,16 @@ void PhysicalCollection::drop() {
|
|||
}
|
||||
}
|
||||
|
||||
bool PhysicalCollection::hasIndexOfType(arangodb::Index::IndexType type) const {
|
||||
READ_LOCKER(guard, _indexesLock);
|
||||
for (auto const& idx : _indexes) {
|
||||
if (idx->type() == type) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<Index> PhysicalCollection::lookupIndex(
|
||||
TRI_idx_iid_t idxId) const {
|
||||
READ_LOCKER(guard, _indexesLock);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "Basics/Common.h"
|
||||
#include "Basics/ReadWriteLock.h"
|
||||
#include "Indexes/Index.h"
|
||||
#include "VocBase/voc-types.h"
|
||||
|
||||
#include <velocypack/Builder.h>
|
||||
|
@ -94,6 +95,8 @@ class PhysicalCollection {
|
|||
///////////////////////////////////
|
||||
|
||||
virtual void prepareIndexes(arangodb::velocypack::Slice indexesSlice) = 0;
|
||||
|
||||
bool hasIndexOfType(arangodb::Index::IndexType type) const;
|
||||
|
||||
/// @brief Find index by definition
|
||||
virtual std::shared_ptr<Index> lookupIndex(
|
||||
|
|
Loading…
Reference in New Issue