1
0
Fork 0

fixed compaction bug

This commit is contained in:
Kaveh Vahedipour 2016-08-03 13:59:40 +02:00
parent 2062e84ceb
commit 0221f2582c
3 changed files with 10 additions and 11 deletions

View File

@ -239,8 +239,6 @@ bool Agent::recvAppendEntriesRPC(term_t term,
MUTEX_LOCKER(mutexLocker, _ioLock);
// index_t lastPersistedIndex = _lastCommitIndex;
if (this->term() > term) {
LOG_TOPIC(WARN, Logger::AGENCY) << "I have a higher term than RPC caller.";
return false;
@ -258,11 +256,12 @@ bool Agent::recvAppendEntriesRPC(term_t term,
<< " entries to state machine.";
/* bool success = */
_state.log(queries, term, prevIndex, prevTerm);
_spearhead.apply(_state.slices(_lastCommitIndex + 1, leaderCommitIndex));
_readDB.apply(_state.slices(_lastCommitIndex + 1, leaderCommitIndex));
_lastCommitIndex = leaderCommitIndex;
}
_spearhead.apply(_state.slices(_lastCommitIndex + 1, leaderCommitIndex));
_readDB.apply(_state.slices(_lastCommitIndex + 1, leaderCommitIndex));
_lastCommitIndex = leaderCommitIndex;
if (_lastCommitIndex >= _nextCompationAfter) {
_state.compact(_lastCommitIndex);

View File

@ -185,7 +185,7 @@ void State::removeConflicts (query_t const& transactions) {
if (idx-_cur < _log.size()) {
LOG_TOPIC(DEBUG, Logger::AGENCY)
<< "Removing " << _log.size()-idx+_cur
<< " entries from log starting with " << idx;
<< " entries from log starting with " << idx << "=" << _log.at(idx-_cur).index;
// persisted logs
std::stringstream aql;
@ -203,7 +203,7 @@ void State::removeConflicts (query_t const& transactions) {
// volatile logs
{
MUTEX_LOCKER(mutexLocker, _logLock);
_log.erase(_log.begin()+idx-1);
_log.erase(_log.begin()+idx-_cur-1);
}
}

View File

@ -19,13 +19,13 @@ if [[ $(( $NRAGENTS % 2 )) == 0 ]]; then
exit 1
fi
MINP=1.0
MAXP=5.0
MINP=0.5
MAXP=2.0
SFRE=2.5
COMP=1000
COMP=10
BASE=4001
rm -rf agency
#rm -rf agency
mkdir -p agency
echo -n "Starting agency ... "
if [ $NRAGENTS -gt 1 ]; then