mirror of https://gitee.com/bigwinds/arangodb
fix some locking issues
This commit is contained in:
parent
75ecf79277
commit
8e58b8dfac
|
@ -299,12 +299,13 @@ void Agent::sendAppendEntriesRPC() {
|
|||
|
||||
term_t t(0);
|
||||
|
||||
index_t last_confirmed;
|
||||
{
|
||||
MUTEX_LOCKER(mutexLocker, _ioLock);
|
||||
t = this->term();
|
||||
last_confirmed = _confirmed[followerId];
|
||||
}
|
||||
|
||||
index_t last_confirmed = _confirmed[followerId];
|
||||
std::vector<log_t> unconfirmed = _state.get(last_confirmed);
|
||||
|
||||
if (unconfirmed.empty()) {
|
||||
|
|
|
@ -77,6 +77,9 @@ config_t::config_t(config_t&& other)
|
|||
_supervisionGracePeriod(std::move(other._supervisionGracePeriod)) {}
|
||||
|
||||
config_t& config_t::operator=(config_t const& other) {
|
||||
// must hold the lock of other to copy _pool, _minPing, _maxPing etc.
|
||||
READ_LOCKER(readLocker, other._lock);
|
||||
|
||||
_id = other._id;
|
||||
_agencySize = other._agencySize;
|
||||
_poolSize = other._poolSize;
|
||||
|
|
|
@ -178,7 +178,10 @@ std::vector<bool> Store::apply(query_t const& query, bool verbose) {
|
|||
}
|
||||
|
||||
// Wake up TTL processing
|
||||
_cv.signal();
|
||||
{
|
||||
CONDITION_LOCKER(guard, _cv);
|
||||
_cv.signal();
|
||||
}
|
||||
|
||||
} catch (std::exception const& e) { // Catch any erorrs
|
||||
LOG_TOPIC(ERR, Logger::AGENCY) << __FILE__ << ":" << __LINE__ << " "
|
||||
|
@ -503,7 +506,6 @@ bool Store::start() {
|
|||
|
||||
/// Work ttls and callbacks
|
||||
void Store::run() {
|
||||
CONDITION_LOCKER(guard, _cv);
|
||||
while (!this->isStopping()) { // Check timetable and remove overage entries
|
||||
|
||||
std::chrono::microseconds t{0};
|
||||
|
@ -517,10 +519,13 @@ void Store::run() {
|
|||
}
|
||||
}
|
||||
|
||||
if (t != std::chrono::microseconds{0}) {
|
||||
_cv.wait(t.count());
|
||||
} else {
|
||||
_cv.wait();
|
||||
{
|
||||
CONDITION_LOCKER(guard, _cv);
|
||||
if (t != std::chrono::microseconds{0}) {
|
||||
_cv.wait(t.count());
|
||||
} else {
|
||||
_cv.wait();
|
||||
}
|
||||
}
|
||||
|
||||
toClear = clearExpired();
|
||||
|
|
Loading…
Reference in New Issue