From: Sage Weil Date: Fri, 15 Aug 2008 00:36:46 +0000 (-0700) Subject: Merge commit 'origin/unstable' into snap X-Git-Tag: v0.4~244 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c09b277e1e524691893b15e72d780a2f946d4a86;p=ceph.git Merge commit 'origin/unstable' into snap Conflicts: src/client/SyntheticClient.cc src/osd/ReplicatedPG.cc src/vstartnew.sh --- c09b277e1e524691893b15e72d780a2f946d4a86 diff --cc src/client/SyntheticClient.cc index b732383e4130b,f11ff4fcc5eed..eaba4dac21ef4 --- a/src/client/SyntheticClient.cc +++ b/src/client/SyntheticClient.cc @@@ -57,18 -57,9 +57,18 @@@ void parse_syn_options(vectorget_poid(); - eversion_t nv = op->get_version(); - - const char *opname = MOSDOp::get_opname(op->get_op()); - - // check crev - objectrev_t crev = 0; - osd->store->getattr(info.pgid, poid, "crev", (char*)&crev, sizeof(crev)); - + pobject_t poid = op->poid; + const char *opname = MOSDOp::get_opname(op->op); + dout(10) << "sub_op_modify " << opname << " " << poid - << " v " << nv - << " " << op->get_offset() << "~" << op->get_length() - << dendl; + << " v " << op->version + << " " << op->offset << "~" << op->length + << dendl; + + // sanity checks - if (op->get_map_epoch() < info.history.same_primary_since) { ++ if (op->map_epoch < info.history.same_primary_since) { + dout(10) << "sub_op_modify discarding old sub_op from " - << op->get_map_epoch() << " < " << info.history.same_primary_since << dendl; ++ << op->map_epoch << " < " << info.history.same_primary_since << dendl; + delete op; + return; + } + if (!is_active()) { + dout(10) << "sub_op_modify not active" << dendl; + delete op; + return; + } + assert(is_replica()); // note peer's stat int fromosd = op->get_source().num(); @@@ -1549,39 -1491,22 +1564,22 @@@ void ReplicatedPG::sub_op_push_reply(MO */ void ReplicatedPG::sub_op_pull(MOSDSubOp *op) { - const pobject_t poid = op->get_poid(); - const eversion_t v = op->get_version(); + const pobject_t poid = op->poid; + const eversion_t v = op->version; - int from = op->get_source().num(); - dout(7) << "op_pull " << poid << " v " << op->get_version() + dout(7) << "op_pull " << poid << " v " << op->version << " from " << op->get_source() << dendl; - // is a replica asking? are they missing it? - if (is_primary()) { - // primary - assert(peer_missing.count(from)); // we had better know this, from the peering process. - if (op->get_map_epoch() < info.history.same_primary_since) { ++ if (op->map_epoch < info.history.same_primary_since) { + dout(10) << "sub_op_pull discarding old sub_op from " - << op->get_map_epoch() << " < " << info.history.same_primary_since << dendl; ++ << op->map_epoch << " < " << info.history.same_primary_since << dendl; + delete op; + return; + } - if (!peer_missing[from].is_missing(poid.oid)) { - dout(7) << "op_pull replica isn't actually missing it, we must have already pushed to them" << dendl; - delete op; - return; - } + assert(!is_primary()); // we should be a replica or stray. - // do we have it yet? - if (is_missing_object(poid.oid)) { - wait_for_missing_object(poid.oid, op); - return; - } - } else { - // non-primary - if (missing.is_missing(poid.oid)) { - dout(7) << "op_pull not primary, and missing " << poid << ", ignoring" << dendl; - delete op; - return; - } - } - // push it back! push(poid, op->get_source().num()); } @@@ -1592,22 -1517,43 +1590,43 @@@ */ void ReplicatedPG::sub_op_push(MOSDSubOp *op) { - pobject_t poid = op->get_poid(); - eversion_t v = op->get_version(); + pobject_t poid = op->poid; + eversion_t v = op->version; - if (!is_missing_object(poid.oid)) { - dout(7) << "sub_op_push not missing " << poid << dendl; - dout(15) << " but i AM missing " << missing.missing << dendl; - return; - } - dout(7) << "op_push " << poid << " v " << v - << " size " << op->get_length() << " " << op->get_data().length() + << " size " << op->length << " " << op->get_data().length() << dendl; + if (is_replica()) { + // replica should only accept pushes from the current primary. - if (op->get_map_epoch() < info.history.same_primary_since) { ++ if (op->map_epoch < info.history.same_primary_since) { + dout(10) << "sub_op_push discarding old sub_op from " - << op->get_map_epoch() << " < " << info.history.same_primary_since << dendl; ++ << op->map_epoch << " < " << info.history.same_primary_since << dendl; + delete op; + return; + } + // FIXME: actually, no, what i really want here is a personal "same_role_since" + if (!is_active()) { + dout(10) << "sub_op_push not active" << dendl; + delete op; + return; + } + } else { + // primary will accept pushes anytime. + } + + // are we missing (this specific version)? + // (if version is wrong, it is either old (we don't want it) or + // newer (peering is buggy)) + if (!missing.is_missing(poid.oid, v)) { + dout(7) << "sub_op_push not missing " << poid << " v" << v << dendl; + dout(15) << " but i AM missing " << missing.missing << dendl; + return; + } + - assert(op->get_data().length() == op->get_length()); + assert(op->get_data().length() == op->length); // write object and add it to the PG ObjectStore::Transaction t;