From: Samuel Just Date: Wed, 19 Nov 2014 01:27:36 +0000 (-0800) Subject: osd/: update peer_missing and local missing if we write a degraded object X-Git-Tag: v0.93~128^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c632fecb87e292eb73161f36d4e6df6f077fae77;p=ceph.git osd/: update peer_missing and local missing if we write a degraded object Signed-off-by: Samuel Just --- diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index a8c75c5de1c..b44bc2adecf 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -1540,6 +1540,13 @@ void ECBackend::start_write(Op *op) { trans.find(i->shard); assert(iter != trans.end()); bool should_send = get_parent()->should_send_op(*i, op->hoid); + if (should_send) { + dout(10) << __func__ << ": sending transaction for object " + << op->hoid << " to shard " << *i << dendl; + } else { + dout(10) << __func__ << ": NOT sending transaction for object " + << op->hoid << " to shard " << *i << dendl; + } pg_stat_t stats = should_send ? get_info().stats : diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 3325b4c6678..cddd94aeaa3 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -2881,6 +2881,30 @@ void PG::append_log( for (vector::const_iterator p = logv.begin(); p != logv.end(); ++p) { + // we might get log entries for missing objects since we can write to + // degraded objects + if (!transaction_applied) { + if (p->is_delete()) + t.remove(coll, p->soid); + + assert( + p->soid > info.last_backfill || + pg_log.get_missing().is_missing(p->soid) || + (p->is_clone() || p->is_promote() || + (p->is_modify() && (p->prior_version == eversion_t()))) + ); + + if (p->soid <= info.last_backfill) { + dout(10) << __func__ << ": transaction empty, adding event " + << *p << " to missing" + << dendl; + pg_log.missing_add_event(*p); + } else { + dout(10) << __func__ << ": transaction empty, backfill, " + << "not adding event " << *p << " to missing" + << dendl; + } + } add_log_entry(*p, keys[p->get_key_name()]); } diff --git a/src/osd/PG.h b/src/osd/PG.h index e269596855b..692ecba76b6 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -395,6 +395,44 @@ public: assert(needs_recovery(hoid)); needs_recovery_map[hoid].need = need; } + void rebuild_object_location( + const hobject_t &hoid, + const set &actingbackfill, + const map &all_missing, + const map &all_info) { + needs_recovery_map.erase(hoid); + missing_loc.erase(hoid); + eversion_t need; + for (set::const_iterator peer = actingbackfill.begin(); + peer != actingbackfill.end(); + ++peer) { + map::const_iterator pm = + all_missing.find(*peer); + assert(pm != all_missing.end()); + if (pm->second->is_missing(hoid)) { + need = pm->second->missing.find(hoid)->second.need; + break; + } + } + if (need == eversion_t()) + return; + + set have; + for (map::const_iterator pm = + all_missing.begin(); + pm != all_missing.end(); + ++pm) { + map::const_iterator pi = + all_info.find(pm->first); + assert(pi != all_info.end()); + if (pi->second->last_update >= need && + !pm->second->is_missing(hoid)) { + have.insert(pm->first); + } + } + missing_loc[hoid].swap(have); + add_missing(hoid, need, eversion_t()); + } /// Adds info about a possible recovery source bool add_source_info( diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 910a9557959..1278298ea23 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -7531,6 +7531,40 @@ void ReplicatedPG::issue_repop(RepGather *repop, utime_t now) repop->ctx->reqid, repop->ctx->op); repop->ctx->op_t = NULL; + + if (is_degraded_object(soid)) { + dout(10) << __func__ << ": " << soid + << " degraded, maintaining missing sets" + << dendl; + assert(!is_missing_object(soid)); + for (vector::iterator j = repop->ctx->log.begin(); + j != repop->ctx->log.end(); + ++j) { + for (set::const_iterator peer = actingbackfill.begin(); + peer != actingbackfill.end(); + ++peer) { + if (*peer == pg_whoami) { + assert(!is_missing_object(j->soid)); + continue; + } + map::iterator pm = peer_missing.find(*peer); + assert(pm != peer_missing.end()); + if (!pm->second.is_missing(soid)) { + assert(!pm->second.is_missing(j->soid)); + continue; + } + dout(10) << __func__ << ": " << soid << " missing on " + << *peer << ", adding event " << *j << " to missing" + << dendl; + pm->second.add_next_event(*j); + } + missing_loc.rebuild_object_location( + j->soid, + actingbackfill, + get_all_missing(), + get_all_info()); + } + } } template diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index a32e80d6bb3..e5a83af0443 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -368,6 +368,26 @@ public: const pg_pool_t &get_pool() const { return pool.info; } + map get_all_missing() const { + map all_missing; + all_missing[pg_whoami] = &(pg_log.get_missing()); + for (map::const_iterator i = peer_missing.begin(); + i != peer_missing.end(); + ++i) { + all_missing[i->first] = &(i->second); + } + return all_missing; + } + const map get_all_info() const { + map all_info; + all_info[pg_whoami] = &info; + for (map::const_iterator i = peer_info.begin(); + i != peer_info.end(); + ++i) { + all_info[i->first] = &(i->second); + } + return all_info; + } ObjectContextRef get_obc( const hobject_t &hoid, map &attrs) {