mirror of
https://github.com/ceph/ceph
synced 2025-03-31 07:53:23 +00:00
PG: added replica_scrub
Adds handler in PG for MOSDRepScrub messages. replica_scrub will replace sub_op_scrub. Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
This commit is contained in:
parent
cb4fcfe316
commit
aed279e68f
@ -3127,6 +3127,55 @@ void PG::repair_object(const sobject_t& soid, ScrubMap::object *po, int bad_peer
|
||||
osd->queue_for_recovery(this);
|
||||
}
|
||||
|
||||
void PG::replica_scrub(MOSDRepScrub *msg)
|
||||
{
|
||||
dout(7) << "replica_scrub" << dendl;
|
||||
|
||||
if (msg->map_epoch < info.history.same_acting_since) {
|
||||
dout(10) << "replica_scrub discarding old replica_scrub from "
|
||||
<< msg->map_epoch << " < " << info.history.same_acting_since << dendl;
|
||||
msg->put();
|
||||
return;
|
||||
}
|
||||
|
||||
ScrubMap map;
|
||||
if (msg->scrub_from > eversion_t()) {
|
||||
epoch_t epoch = info.history.same_acting_since;
|
||||
finalizing_scrub = 1;
|
||||
while (last_update_applied != info.last_update) {
|
||||
wait();
|
||||
if (epoch != info.history.same_acting_since ||
|
||||
osd->is_stopping()) {
|
||||
dout(10) << "scrub pg changed, aborting" << dendl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
build_inc_scrub_map(map, msg->scrub_from);
|
||||
finalizing_scrub = 0;
|
||||
} else {
|
||||
build_scrub_map(map);
|
||||
}
|
||||
|
||||
vector<OSDOp> scrub(1);
|
||||
scrub[0].op.op = CEPH_OSD_OP_SCRUB_MAP;
|
||||
sobject_t poid;
|
||||
eversion_t v;
|
||||
osd_reqid_t reqid;
|
||||
MOSDSubOp *subop = new MOSDSubOp(reqid, info.pgid, poid, false, 0,
|
||||
osd->osdmap->get_epoch(), osd->get_tid(), v);
|
||||
::encode(map, subop->get_data());
|
||||
subop->ops = scrub;
|
||||
|
||||
unlock();
|
||||
osd->map_lock.get_read();
|
||||
lock();
|
||||
|
||||
osd->cluster_messenger->send_message(subop, osd->osdmap->get_cluster_inst(acting[0]));
|
||||
|
||||
osd->map_lock.put_read();
|
||||
msg->put();
|
||||
}
|
||||
|
||||
void PG::scrub()
|
||||
{
|
||||
stringstream ss;
|
||||
|
@ -910,6 +910,7 @@ public:
|
||||
bool scrub_all_replicas_reserved() const;
|
||||
bool sched_scrub();
|
||||
|
||||
void replica_scrub(class MOSDRepScrub *op);
|
||||
void sub_op_scrub(class MOSDSubOp *op);
|
||||
void sub_op_scrub_reply(class MOSDSubOpReply *op);
|
||||
void sub_op_scrub_reserve(class MOSDSubOp *op);
|
||||
|
Loading…
Reference in New Issue
Block a user