Skip to content

Commit

Permalink
paxos: Do not start more evict threads once we enter cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Nottale committed Sep 11, 2017
1 parent c551917 commit f5201f7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/memo/model/doughnut/consensus/Paxos.cc
Expand Up @@ -835,6 +835,8 @@ namespace memo
void
Paxos::LocalPeer::_cleanup()
{
ELLE_DEBUG_SCOPE("%s: cleanup", this);
this->_cleaning_up = true;
this->_rebalance_inspector.reset();
this->_rebalance_thread.terminate_now();
this->_evict_threads.clear();
Expand Down Expand Up @@ -1037,7 +1039,7 @@ namespace memo
it.first->second.async_wait(
[this, id] (const boost::system::error_code& error)
{
if (!error)
if (!error && !this->_cleaning_up)
this->_evict_threads.emplace_back(
new elle::reactor::Thread(
elle::sprintf("%s: evict %f", this, id),
Expand Down
1 change: 1 addition & 0 deletions src/memo/model/doughnut/consensus/Paxos.hh
Expand Up @@ -254,6 +254,7 @@ namespace memo
ELLE_ATTRIBUTE_R(std::chrono::system_clock::duration, node_timeout);
ELLE_ATTRIBUTE(std::vector<elle::reactor::Thread::unique_ptr>,
evict_threads);
ELLE_ATTRIBUTE_R(bool, cleaning_up);
protected:
void
_cleanup() override;
Expand Down
1 change: 1 addition & 0 deletions src/memo/model/doughnut/consensus/Paxos.hxx
Expand Up @@ -24,6 +24,7 @@ namespace memo
, _rebalance_auto_expand(rebalance_auto_expand)
, _rebalance_inspect(rebalance_inspect)
, _node_timeout(node_timeout)
, _cleaning_up(false)
, _max_addresses_size(elle::os::getenv("MEMO_PAXOS_CACHE_SIZE", 100))
, _rebalancable()
, _rebalanced()
Expand Down

0 comments on commit f5201f7

Please sign in to comment.