Merge pull request #16944 from liewegas/wip-kraken-x

mon/Elector: force election epoch bump on start

Reviewed-by: Greg Farnum <gfarnum@redhat.com>
This commit is contained in:
Sage Weil 2017-08-10 11:12:43 -05:00 committed by GitHub
commit dd2fb6c40b
2 changed files with 16 additions and 2 deletions

View File

@ -6,6 +6,10 @@ meta:
overrides:
ceph:
fs: xfs
log-whitelist:
- overall HEALTH_
- \(MON_DOWN\)
- \(MGR_DOWN\)
conf:
global:
enable experimental unrecoverable data corrupting features: "*"

View File

@ -35,9 +35,19 @@ static ostream& _prefix(std::ostream *_dout, Monitor *mon, epoch_t epoch) {
void Elector::init()
{
epoch = mon->store->get(Monitor::MONITOR_NAME, "election_epoch");
if (!epoch)
if (!epoch) {
dout(1) << "init, first boot, initializing epoch at 1 " << dendl;
epoch = 1;
dout(1) << "init, last seen epoch " << epoch << dendl;
} else if (epoch % 2) {
dout(1) << "init, last seen epoch " << epoch
<< ", mid-election, bumping" << dendl;
++epoch;
auto t(std::make_shared<MonitorDBStore::Transaction>());
t->put(Monitor::MONITOR_NAME, "election_epoch", epoch);
mon->store->apply_transaction(t);
} else {
dout(1) << "init, last seen epoch " << epoch << dendl;
}
}
void Elector::shutdown()