From: Samuel Just Date: Tue, 9 Sep 2014 19:35:52 +0000 (-0700) Subject: Revert "ReplicatedPG:start_flush send a second delete" X-Git-Tag: v0.86~110^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=937d2b0e487115f34265731d867eb6f47efdd746;p=ceph.git Revert "ReplicatedPG:start_flush send a second delete" This reverts commit a525bf3190a712fdceb018267a0aa08e90c44e62. Conflicts: src/osd/ReplicatedPG.cc --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 8ba1bdcaeef12..433f18705fec9 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -6398,19 +6398,7 @@ int ReplicatedPG::start_flush( cancel_flush(fop, false); } - /** - * In general, we need to send two deletes and a copyfrom. - * Consider snapc 10:[10, 9, 8, 4, 3, 2]:[10(10, 9), 4(4,3,2)] - * where 4 is marked as clean. To flush 10, we have to: - * 1) delete 4:[4,3,2] -- ensure head is created at cloneid 4 - * 2) delete (8-1):[4,3,2] -- ensure that the object does not exist at 8 - * 3) copyfrom 8:[8,4,3,2] -- flush object excluding snap 8 - * - * The second delete is required in case at some point in the past - * there had been a clone 7(7,6), which we had flushed. Without - * the second delete, the object would appear in the base pool to - * have existed. - */ + // construct a SnapContext appropriate for this clone/head SnapContext dsnapc; dsnapc.seq = 0; SnapContext snapc; @@ -6442,15 +6430,17 @@ int ReplicatedPG::start_flush( vector::iterator dnewest = p; // we may need to send a delete first - if (prev_snapc + 1 < *dnewest) { - while (p != snapset.snaps.end() && *p > prev_snapc) - ++p; - dsnapc.snaps = vector(p, snapset.snaps.end()); + while (p != snapset.snaps.end() && *p > prev_snapc) + ++p; + dsnapc.snaps = vector(p, snapset.snaps.end()); + if (p == dnewest) { + // no snaps between the oldest in this clone and prev_snapc + snapc.seq = prev_snapc; + } else { + // snaps between oldest in this clone and prev_snapc, send delete dsnapc.seq = prev_snapc; snapc.seq = oi.snaps.back() - 1; - } else { - snapc.seq = prev_snapc; } } @@ -6471,38 +6461,6 @@ int ReplicatedPG::start_flush( CEPH_OSD_FLAG_ENFORCE_SNAPC), NULL, NULL /* no callback, we'll rely on the ordering w.r.t the next op */); - - // do we need to send the second delete? - SnapContext dsnapc2; - vector::reverse_iterator rp = snapset.snaps.rbegin(); - - // advance rp to the smallest snap not contained by the last flushed clone - while (rp != snapset.snaps.rend() && *rp <= dsnapc.seq) - ++rp; - - // set dnsnapc2.seq to be the snap prior to that snap (the object did not - // exist at *rq, so it must have been deleted prior to that). - dsnapc2.seq = (rp == snapset.snaps.rend()) ? snapset.seq : *rp; - if (dsnapc2.seq > 0) - dsnapc2.seq.val -= 1; - - if (dsnapc2.seq != dsnapc.seq) { - dsnapc2.snaps = dsnapc.snaps; - - ObjectOperation o2; - o2.remove(); - osd->objecter->mutate( - soid.oid, - base_oloc, - o2, - dsnapc2, - oi.mtime, - (CEPH_OSD_FLAG_IGNORE_OVERLAY | - CEPH_OSD_FLAG_ORDERSNAP | - CEPH_OSD_FLAG_ENFORCE_SNAPC), - NULL, - NULL /* no callback, we'll rely on the ordering w.r.t the next op */); - } } FlushOpRef fop(new FlushOp);