Merge remote-tracking branch 'gh/next' into next

This commit is contained in:
Sage Weil 2013-07-23 11:23:24 -07:00
commit e0709ef5ed
3 changed files with 43 additions and 12 deletions

View File

@ -6,3 +6,6 @@ wget http://ceph.com/qa/fsync-tester.c
gcc fsync-tester.c -o fsync-tester
./fsync-tester
lsof

View File

@ -125,6 +125,40 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
version_t latest_full = get_version_latest_full();
if (latest_full == 0 && get_first_committed() > 1)
latest_full = get_first_committed();
if (latest_full < get_first_committed()) {
/* a bug introduced in 7fb3804fb860dcd0340dd3f7c39eec4315f8e4b6 would lead
* us to not update the on-disk latest_full key. Upon trim, the actual
* version would cease to exist but we would still point to it. This
* makes sure we get it pointing to a proper version.
*/
version_t lc = get_last_committed();
version_t fc = get_first_committed();
dout(10) << __func__ << " looking for valid full map in interval"
<< " [" << fc << ", " << lc << "]" << dendl;
latest_full = 0;
for (version_t v = lc; v >= fc; v--) {
string full_key = "full_" + stringify(latest_full);
if (mon->store->exists(get_service_name(), full_key)) {
dout(10) << __func__ << " found latest full map v " << v << dendl;
latest_full = v;
break;
}
}
// if we trigger this, then there's something else going with the store
// state, and we shouldn't want to work around it without knowing what
// exactly happened.
assert(latest_full > 0);
MonitorDBStore::Transaction t;
put_version_latest_full(&t, latest_full);
mon->store->apply_transaction(t);
dout(10) << __func__ << " updated the on-disk full map version to "
<< latest_full << dendl;
}
if ((latest_full > 0) && (latest_full > osdmap.epoch)) {
bufferlist latest_bl;
get_version_full(latest_full, latest_bl);
@ -526,17 +560,6 @@ void OSDMonitor::encode_pending(MonitorDBStore::Transaction *t)
put_last_committed(t, pending_inc.epoch);
}
void OSDMonitor::encode_full(MonitorDBStore::Transaction *t)
{
dout(10) << __func__ << " osdmap e " << osdmap.epoch << dendl;
assert(get_last_committed() == osdmap.epoch);
bufferlist osdmap_bl;
osdmap.encode(osdmap_bl);
put_version_full(t, osdmap.epoch, osdmap_bl);
put_version_latest_full(t, osdmap.epoch);
}
void OSDMonitor::share_map_with_random_osd()
{
if (osdmap.get_num_up_osds() == 0) {
@ -586,6 +609,7 @@ void OSDMonitor::encode_trim_extra(MonitorDBStore::Transaction *tx, version_t fi
bufferlist bl;
get_version_full(first, bl);
put_version_full(tx, first, bl);
put_version_latest_full(tx, first);
}
// -------------

View File

@ -150,10 +150,14 @@ private:
void update_from_paxos(bool *need_bootstrap);
void create_pending(); // prepare a new pending
void encode_pending(MonitorDBStore::Transaction *t);
virtual void encode_full(MonitorDBStore::Transaction *t);
void on_active();
void on_shutdown();
/**
* we haven't delegated full version stashing to paxosservice for some time
* now, making this function useless in current context.
*/
virtual void encode_full(MonitorDBStore::Transaction *t) { }
/**
* do not let paxosservice periodically stash full osdmaps, or we will break our
* locally-managed full maps. (update_from_paxos loads the latest and writes them