1
0
Fork 0

improve waitForSync performance for mmfiles

This commit is contained in:
jsteemann 2017-06-06 12:44:39 +02:00
parent b60bda828d
commit 12132c60c7
4 changed files with 16 additions and 3 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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(