mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
mon: handle MOSDPGCreated messages
MOSDPGCreated messages are used to prune the creating_pgs_by_osd_epoch and creating_pgs, by updating created_pools. as once a pool is created we will not send MOSDPGCreate to its acting_primary OSD anymore. Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
a2e39d91c9
commit
a316eb3078
@ -3748,6 +3748,7 @@ void Monitor::dispatch_op(MonOpRequestRef op)
|
||||
case MSG_OSD_BOOT:
|
||||
case MSG_OSD_ALIVE:
|
||||
case MSG_OSD_PGTEMP:
|
||||
case MSG_OSD_PG_CREATED:
|
||||
case MSG_REMOVE_SNAPS:
|
||||
paxos_service[PAXOS_OSDMAP]->dispatch(op);
|
||||
break;
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "messages/MPoolOp.h"
|
||||
#include "messages/MPoolOpReply.h"
|
||||
#include "messages/MOSDPGCreate.h"
|
||||
#include "messages/MOSDPGCreated.h"
|
||||
#include "messages/MOSDPGTemp.h"
|
||||
#include "messages/MMonCommand.h"
|
||||
#include "messages/MRemoveSnaps.h"
|
||||
@ -1524,6 +1525,8 @@ bool OSDMonitor::preprocess_query(MonOpRequestRef op)
|
||||
return preprocess_boot(op);
|
||||
case MSG_OSD_ALIVE:
|
||||
return preprocess_alive(op);
|
||||
case MSG_OSD_PG_CREATED:
|
||||
return preprocess_pg_created(op);
|
||||
case MSG_OSD_PGTEMP:
|
||||
return preprocess_pgtemp(op);
|
||||
case MSG_OSD_BEACON:
|
||||
@ -1559,6 +1562,8 @@ bool OSDMonitor::prepare_update(MonOpRequestRef op)
|
||||
return prepare_boot(op);
|
||||
case MSG_OSD_ALIVE:
|
||||
return prepare_alive(op);
|
||||
case MSG_OSD_PG_CREATED:
|
||||
return prepare_pg_created(op);
|
||||
case MSG_OSD_PGTEMP:
|
||||
return prepare_pgtemp(op);
|
||||
case MSG_OSD_BEACON:
|
||||
@ -2616,6 +2621,43 @@ void OSDMonitor::_reply_map(MonOpRequestRef op, epoch_t e)
|
||||
send_latest(op, e);
|
||||
}
|
||||
|
||||
// pg_created
|
||||
bool OSDMonitor::preprocess_pg_created(MonOpRequestRef op)
|
||||
{
|
||||
op->mark_osdmon_event(__func__);
|
||||
auto m = static_cast<MOSDPGCreated*>(op->get_req());
|
||||
dout(10) << __func__ << " " << *m << dendl;
|
||||
auto session = m->get_session();
|
||||
if (!session) {
|
||||
dout(10) << __func__ << ": no monitor session!" << dendl;
|
||||
return true;
|
||||
}
|
||||
if (!session->is_capable("osd", MON_CAP_X)) {
|
||||
derr << __func__ << " received from entity "
|
||||
<< "with insufficient privileges " << session->caps << dendl;
|
||||
return true;
|
||||
}
|
||||
// always forward the "created!" to the leader
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OSDMonitor::prepare_pg_created(MonOpRequestRef op)
|
||||
{
|
||||
op->mark_osdmon_event(__func__);
|
||||
auto m = static_cast<MOSDPGCreated*>(op->get_req());
|
||||
dout(10) << __func__ << " " << *m << dendl;
|
||||
auto src = m->get_orig_source();
|
||||
auto from = src.num();
|
||||
if (!src.is_osd() ||
|
||||
!mon->osdmon()->osdmap.is_up(from) ||
|
||||
m->get_orig_source_inst() != mon->osdmon()->osdmap.get_inst(from)) {
|
||||
dout(1) << __func__ << " ignoring stats from non-active osd." << dendl;
|
||||
return false;
|
||||
}
|
||||
pending_created_pgs.push_back(m->pgid);
|
||||
return true;
|
||||
}
|
||||
|
||||
// -------------
|
||||
// pg_temp changes
|
||||
|
||||
|
@ -280,6 +280,9 @@ private:
|
||||
bool preprocess_pgtemp(MonOpRequestRef op);
|
||||
bool prepare_pgtemp(MonOpRequestRef op);
|
||||
|
||||
bool preprocess_pg_created(MonOpRequestRef op);
|
||||
bool prepare_pg_created(MonOpRequestRef op);
|
||||
|
||||
int _check_remove_pool(int64_t pool, const pg_pool_t *pi, ostream *ss);
|
||||
bool _check_become_tier(
|
||||
int64_t tier_pool_id, const pg_pool_t *tier_pool,
|
||||
|
Loading…
Reference in New Issue
Block a user