mirror of https://gitee.com/bigwinds/arangodb
Bug fix/arangosearch lock issue (#6871)
* ensure no concurrent links midifications * another attempt to fix * reduce scope of the lock * Revert "reduce scope of the lock" This reverts commit 2eed8eb75c372c1723bcd46b05018843edcc51e0.
This commit is contained in:
parent
7cdfec2f7e
commit
b8dcf51631
|
@ -1116,9 +1116,22 @@ arangodb::Result IResearchView::dropImpl() {
|
|||
}
|
||||
|
||||
std::unordered_set<TRI_voc_cid_t> collections;
|
||||
auto res = IResearchLinkHelper::updateLinks(
|
||||
collections, vocbase(), *this, emptyObjectSlice(), stale
|
||||
);
|
||||
arangodb::Result res;
|
||||
|
||||
{
|
||||
if (!_updateLinksLock.try_lock()) {
|
||||
return arangodb::Result(
|
||||
TRI_ERROR_FAILED, // FIXME use specific error code
|
||||
std::string("failed to remove arangosearch view '") + name()
|
||||
);
|
||||
}
|
||||
|
||||
ADOPT_SCOPED_LOCK_NAMED(_updateLinksLock, lock);
|
||||
|
||||
res = IResearchLinkHelper::updateLinks(
|
||||
collections, vocbase(), *this, emptyObjectSlice(), stale
|
||||
);
|
||||
}
|
||||
|
||||
if (!res.ok()) {
|
||||
return arangodb::Result(
|
||||
|
@ -1922,6 +1935,8 @@ arangodb::Result IResearchView::updateProperties(
|
|||
if (partialUpdate) {
|
||||
mtx.unlock(); // release lock
|
||||
|
||||
SCOPED_LOCK(_updateLinksLock);
|
||||
|
||||
return IResearchLinkHelper::updateLinks(
|
||||
collections, vocbase(), *this, links
|
||||
);
|
||||
|
@ -1931,6 +1946,8 @@ arangodb::Result IResearchView::updateProperties(
|
|||
|
||||
mtx.unlock(); // release lock
|
||||
|
||||
SCOPED_LOCK(_updateLinksLock);
|
||||
|
||||
return IResearchLinkHelper::updateLinks(
|
||||
collections, vocbase(), *this, links, stale
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// DISCLAIMER
|
||||
///
|
||||
/// Copyright 2017 EMC Corporation
|
||||
|
@ -371,6 +371,7 @@ class IResearchView
|
|||
mutable irs::async_utils::read_write_mutex _mutex; // for use with member maps/sets and '_metaState'
|
||||
PersistedStore _storePersisted;
|
||||
std::mutex _readerLock; // prevents query cache double invalidation
|
||||
std::mutex _updateLinksLock; // prevents simultaneous 'updateLinks'
|
||||
FlushCallback _flushCallback; // responsible for flush callback unregistration
|
||||
std::function<void(arangodb::transaction::Methods& trx, arangodb::transaction::Status status)> _trxReadCallback; // for snapshot(...)
|
||||
std::function<void(arangodb::transaction::Methods& trx, arangodb::transaction::Status status)> _trxWriteCallback; // for insert(...)/remove(...)
|
||||
|
|
Loading…
Reference in New Issue