mirror of
https://github.com/ceph/ceph
synced 2025-04-01 23:02:17 +00:00
message, osd: add request/response messages for deletes during recovery
The existing BackfillRemove message has no reply, and PushOps have too much logic that would need changing to accomodate deletions. Signed-off-by: Josh Durgin <jdurgin@redhat.com>
This commit is contained in:
parent
dd61a7f737
commit
100a3d70e5
81
src/messages/MOSDPGRecoveryDelete.h
Normal file
81
src/messages/MOSDPGRecoveryDelete.h
Normal file
@ -0,0 +1,81 @@
|
||||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
|
||||
#ifndef CEPH_MOSDPGRECOVERYDELETE_H
|
||||
#define CEPH_MOSDPGRECOVERYDELETE_H
|
||||
|
||||
#include "MOSDFastDispatchOp.h"
|
||||
|
||||
/*
|
||||
* instruct non-primary to remove some objects during recovery
|
||||
*/
|
||||
|
||||
struct MOSDPGRecoveryDelete : public MOSDFastDispatchOp {
|
||||
|
||||
static const int HEAD_VERSION = 1;
|
||||
static const int COMPAT_VERSION = 1;
|
||||
|
||||
pg_shard_t from;
|
||||
spg_t pgid; ///< target spg_t
|
||||
epoch_t map_epoch;
|
||||
list<pair<hobject_t, eversion_t> > objects; ///< objects to remove
|
||||
|
||||
private:
|
||||
uint64_t cost;
|
||||
|
||||
public:
|
||||
int get_cost() const override {
|
||||
return cost;
|
||||
}
|
||||
|
||||
epoch_t get_map_epoch() const override {
|
||||
return map_epoch;
|
||||
}
|
||||
spg_t get_spg() const override {
|
||||
return pgid;
|
||||
}
|
||||
|
||||
void set_cost(uint64_t c) {
|
||||
cost = c;
|
||||
}
|
||||
|
||||
MOSDPGRecoveryDelete()
|
||||
: MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION,
|
||||
COMPAT_VERSION) {}
|
||||
|
||||
MOSDPGRecoveryDelete(pg_shard_t from, spg_t pgid, epoch_t map_epoch)
|
||||
: MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE, HEAD_VERSION,
|
||||
COMPAT_VERSION),
|
||||
from(from),
|
||||
pgid(pgid),
|
||||
map_epoch(map_epoch) {}
|
||||
|
||||
private:
|
||||
~MOSDPGRecoveryDelete() {}
|
||||
|
||||
public:
|
||||
const char *get_type_name() const { return "recovery_delete"; }
|
||||
void print(ostream& out) const {
|
||||
out << "MOSDPGRecoveryDelete(" << pgid << " e" << map_epoch << " " << objects << ")";
|
||||
}
|
||||
|
||||
void encode_payload(uint64_t features) {
|
||||
::encode(from, payload);
|
||||
::encode(pgid, payload);
|
||||
::encode(map_epoch, payload);
|
||||
::encode(cost, payload);
|
||||
::encode(objects, payload);
|
||||
}
|
||||
void decode_payload() {
|
||||
bufferlist::iterator p = payload.begin();
|
||||
::decode(from, p);
|
||||
::decode(pgid, p);
|
||||
::decode(map_epoch, p);
|
||||
::decode(cost, p);
|
||||
::decode(objects, p);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
54
src/messages/MOSDPGRecoveryDeleteReply.h
Normal file
54
src/messages/MOSDPGRecoveryDeleteReply.h
Normal file
@ -0,0 +1,54 @@
|
||||
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
|
||||
// vim: ts=8 sw=2 smarttab
|
||||
|
||||
#ifndef MOSDRECOVERYDELETEREPLY_H
|
||||
#define MOSDRECOVERYDELETEREPLY_H
|
||||
|
||||
#include "MOSDFastDispatchOp.h"
|
||||
|
||||
struct MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp {
|
||||
static const int HEAD_VERSION = 1;
|
||||
static const int COMPAT_VERSION = 1;
|
||||
|
||||
pg_shard_t from;
|
||||
spg_t pgid;
|
||||
epoch_t map_epoch;
|
||||
list<pair<hobject_t, eversion_t> > objects;
|
||||
|
||||
epoch_t get_map_epoch() const override {
|
||||
return map_epoch;
|
||||
}
|
||||
spg_t get_spg() const override {
|
||||
return pgid;
|
||||
}
|
||||
|
||||
MOSDPGRecoveryDeleteReply()
|
||||
: MOSDFastDispatchOp(MSG_OSD_PG_RECOVERY_DELETE_REPLY, HEAD_VERSION, COMPAT_VERSION)
|
||||
{}
|
||||
|
||||
void decode_payload() override {
|
||||
bufferlist::iterator p = payload.begin();
|
||||
::decode(pgid.pgid, p);
|
||||
::decode(map_epoch, p);
|
||||
::decode(objects, p);
|
||||
::decode(pgid.shard, p);
|
||||
::decode(from, p);
|
||||
}
|
||||
|
||||
void encode_payload(uint64_t features) override {
|
||||
::encode(pgid.pgid, payload);
|
||||
::encode(map_epoch, payload);
|
||||
::encode(objects, payload);
|
||||
::encode(pgid.shard, payload);
|
||||
::encode(from, payload);
|
||||
}
|
||||
|
||||
void print(ostream& out) const override {
|
||||
out << "MOSDPGRecoveryDeleteReply(" << pgid
|
||||
<< " e" << map_epoch << " " << objects << ")";
|
||||
}
|
||||
|
||||
const char *get_type_name() const override { return "recovery_delete_reply"; }
|
||||
};
|
||||
|
||||
#endif
|
@ -88,6 +88,8 @@ using namespace std;
|
||||
#include "messages/MOSDPGBackfill.h"
|
||||
#include "messages/MOSDBackoff.h"
|
||||
#include "messages/MOSDPGBackfillRemove.h"
|
||||
#include "messages/MOSDPGRecoveryDelete.h"
|
||||
#include "messages/MOSDPGRecoveryDeleteReply.h"
|
||||
|
||||
#include "messages/MRemoveSnaps.h"
|
||||
|
||||
@ -545,6 +547,12 @@ Message *decode_message(CephContext *cct, int crcflags,
|
||||
case MSG_OSD_PG_PUSH_REPLY:
|
||||
m = new MOSDPGPushReply;
|
||||
break;
|
||||
case MSG_OSD_PG_RECOVERY_DELETE:
|
||||
m = new MOSDPGRecoveryDelete;
|
||||
break;
|
||||
case MSG_OSD_PG_RECOVERY_DELETE_REPLY:
|
||||
m = new MOSDPGRecoveryDeleteReply;
|
||||
break;
|
||||
case MSG_OSD_EC_WRITE:
|
||||
m = new MOSDECSubOpWrite;
|
||||
break;
|
||||
|
@ -118,6 +118,8 @@
|
||||
|
||||
#define MSG_OSD_PG_CREATED 116
|
||||
#define MSG_OSD_REP_SCRUBMAP 117
|
||||
#define MSG_OSD_PG_RECOVERY_DELETE 118
|
||||
#define MSG_OSD_PG_RECOVERY_DELETE_REPLY 119
|
||||
|
||||
// *** MDS ***
|
||||
|
||||
|
@ -734,9 +734,16 @@ int ECBackend::recover_object(
|
||||
}
|
||||
|
||||
bool ECBackend::can_handle_while_inactive(
|
||||
OpRequestRef _op)
|
||||
OpRequestRef op)
|
||||
{
|
||||
return false;
|
||||
dout(10) << __func__ << ": " << op << dendl;
|
||||
switch (op->get_req()->get_type()) {
|
||||
case MSG_OSD_PG_RECOVERY_DELETE:
|
||||
case MSG_OSD_PG_RECOVERY_DELETE_REPLY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ECBackend::handle_message(
|
||||
|
@ -2300,6 +2300,8 @@ private:
|
||||
case MSG_OSD_REP_SCRUBMAP:
|
||||
case MSG_OSD_PG_UPDATE_LOG_MISSING:
|
||||
case MSG_OSD_PG_UPDATE_LOG_MISSING_REPLY:
|
||||
case MSG_OSD_PG_RECOVERY_DELETE:
|
||||
case MSG_OSD_PG_RECOVERY_DELETE_REPLY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -55,6 +55,8 @@
|
||||
#include "messages/MOSDSubOpReply.h"
|
||||
#include "messages/MOSDRepOpReply.h"
|
||||
#include "messages/MOSDRepScrubMap.h"
|
||||
#include "messages/MOSDPGRecoveryDelete.h"
|
||||
#include "messages/MOSDPGRecoveryDeleteReply.h"
|
||||
|
||||
#include "common/BackTrace.h"
|
||||
#include "common/EventTrace.h"
|
||||
@ -5689,6 +5691,11 @@ bool PG::can_discard_request(OpRequestRef& op)
|
||||
return can_discard_replica_op<MOSDSubOpReply, MSG_OSD_SUBOPREPLY>(op);
|
||||
case MSG_OSD_REPOPREPLY:
|
||||
return can_discard_replica_op<MOSDRepOpReply, MSG_OSD_REPOPREPLY>(op);
|
||||
case MSG_OSD_PG_RECOVERY_DELETE:
|
||||
return can_discard_replica_op<MOSDPGRecoveryDelete, MSG_OSD_PG_RECOVERY_DELETE>(op);
|
||||
|
||||
case MSG_OSD_PG_RECOVERY_DELETE_REPLY:
|
||||
return can_discard_replica_op<MOSDPGRecoveryDeleteReply, MSG_OSD_PG_RECOVERY_DELETE_REPLY>(op);
|
||||
|
||||
case MSG_OSD_EC_WRITE:
|
||||
return can_discard_replica_op<MOSDECSubOpWrite, MSG_OSD_EC_WRITE>(op);
|
||||
|
@ -185,6 +185,8 @@ bool ReplicatedBackend::can_handle_while_inactive(OpRequestRef op)
|
||||
dout(10) << __func__ << ": " << op << dendl;
|
||||
switch (op->get_req()->get_type()) {
|
||||
case MSG_OSD_PG_PULL:
|
||||
case MSG_OSD_PG_RECOVERY_DELETE:
|
||||
case MSG_OSD_PG_RECOVERY_DELETE_REPLY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -593,6 +593,10 @@ MESSAGE(MOSDPGNotify)
|
||||
MESSAGE(MOSDPGQuery)
|
||||
#include "messages/MOSDPGRemove.h"
|
||||
MESSAGE(MOSDPGRemove)
|
||||
#include "messages/MOSDPGRecoveryDelete.h"
|
||||
MESSAGE(MOSDPGRecoveryDelete)
|
||||
#include "messages/MOSDPGRecoveryDeleteReply.h"
|
||||
MESSAGE(MOSDPGRecoveryDeleteReply)
|
||||
#include "messages/MOSDPGScan.h"
|
||||
MESSAGE(MOSDPGScan)
|
||||
#include "messages/MOSDPGTemp.h"
|
||||
|
Loading…
Reference in New Issue
Block a user