MOSDPGCreate message is not in use since Mimic.
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
+++ /dev/null
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software
- * Foundation. See file COPYING.
- *
- */
-
-
-#ifndef CEPH_MOSDPGCREATE_H
-#define CEPH_MOSDPGCREATE_H
-
-#include "msg/Message.h"
-#include "osd/osd_types.h"
-
-/*
- * PGCreate - instruct an OSD to create a pg, if it doesn't already exist
- */
-
-class MOSDPGCreate final : public Message {
-public:
- static constexpr int HEAD_VERSION = 3;
- static constexpr int COMPAT_VERSION = 3;
-
- version_t epoch = 0;
- std::map<pg_t,pg_create_t> mkpg;
- std::map<pg_t,utime_t> ctimes;
-
- MOSDPGCreate()
- : MOSDPGCreate{0}
- {}
- MOSDPGCreate(epoch_t e)
- : Message{MSG_OSD_PG_CREATE, HEAD_VERSION, COMPAT_VERSION},
- epoch(e)
- {}
-private:
- ~MOSDPGCreate() final {}
-
-public:
- std::string_view get_type_name() const override { return "pg_create"; }
-
- void encode_payload(uint64_t features) override {
- using ceph::encode;
- encode(epoch, payload);
- encode(mkpg, payload);
- encode(ctimes, payload);
- }
- void decode_payload() override {
- using ceph::decode;
- auto p = payload.cbegin();
- decode(epoch, p);
- decode(mkpg, p);
- decode(ctimes, p);
- }
- void print(std::ostream& out) const override {
- out << "osd_pg_create(e" << epoch;
- for (auto i = mkpg.begin(); i != mkpg.end(); ++i) {
- out << " " << i->first << ":" << i->second.created;
- }
- out << ")";
- }
-private:
- template<class T, typename... Args>
- friend boost::intrusive_ptr<T> ceph::make_message(Args&&... args);
-};
-
-#endif
#include "messages/MOSDAlive.h"
#include "messages/MPoolOp.h"
#include "messages/MPoolOpReply.h"
-#include "messages/MOSDPGCreate.h"
#include "messages/MOSDPGCreate2.h"
#include "messages/MOSDPGCreated.h"
#include "messages/MOSDPGTemp.h"
return next;
ceph_assert(!creating_pgs_by_epoch->second.empty());
- MOSDPGCreate *oldm = nullptr; // for pre-mimic OSD compat
MOSDPGCreate2 *m = nullptr;
- bool old = osdmap.require_osd_release < ceph_release_t::nautilus;
-
epoch_t last = 0;
for (auto epoch_pgs = creating_pgs_by_epoch->second.lower_bound(next);
epoch_pgs != creating_pgs_by_epoch->second.end(); ++epoch_pgs) {
// last_scrub_stamp upon pg creation.
auto create = creating_pgs.pgs.find(pg.pgid);
ceph_assert(create != creating_pgs.pgs.end());
- if (old) {
- if (!oldm) {
- oldm = new MOSDPGCreate(creating_pgs_epoch);
- }
- oldm->mkpg.emplace(pg.pgid,
- pg_create_t{create->second.create_epoch, pg.pgid, 0});
- oldm->ctimes.emplace(pg.pgid, create->second.create_stamp);
- } else {
- if (!m) {
- m = new MOSDPGCreate2(creating_pgs_epoch);
- }
- m->pgs.emplace(pg, make_pair(create->second.create_epoch,
- create->second.create_stamp));
- if (create->second.history.epoch_created) {
- dout(20) << __func__ << " " << pg << " " << create->second.history
- << " " << create->second.past_intervals << dendl;
- m->pg_extra.emplace(pg, make_pair(create->second.history,
- create->second.past_intervals));
- }
+ if (!m) {
+ m = new MOSDPGCreate2(creating_pgs_epoch);
+ }
+ m->pgs.emplace(pg, make_pair(create->second.create_epoch,
+ create->second.create_stamp));
+ if (create->second.history.epoch_created) {
+ dout(20) << __func__ << " " << pg << " " << create->second.history
+ << " " << create->second.past_intervals << dendl;
+ m->pg_extra.emplace(pg, make_pair(create->second.history,
+ create->second.past_intervals));
}
dout(20) << __func__ << " will create " << pg
- << " at " << create->second.create_epoch << dendl;
+ << " at " << create->second.create_epoch << dendl;
}
}
if (m) {
con->send_message(m);
- } else if (oldm) {
- con->send_message(oldm);
} else {
dout(20) << __func__ << " osd." << osd << " from " << next
<< " has nothing to send" << dendl;
#include "messages/MOSDPGRemove.h"
#include "messages/MOSDPGInfo.h"
#include "messages/MOSDPGInfo2.h"
-#include "messages/MOSDPGCreate.h"
#include "messages/MOSDPGCreate2.h"
#include "messages/MOSDPGTrim.h"
#include "messages/MOSDPGLease.h"
case MSG_OSD_PG_INFO2:
m = make_message<MOSDPGInfo2>();
break;
- case MSG_OSD_PG_CREATE:
- m = make_message<MOSDPGCreate>();
- break;
case MSG_OSD_PG_CREATE2:
m = make_message<MOSDPGCreate2>();
break;
class MOSDPGBackfillRemove;
class MOSDPGCreate2;
class MOSDPGCreated;
-class MOSDPGCreate;
class MOSDPGInfo;
class MOSDPGLog;
class MOSDPGNotify;
#include "messages/MOSDPGRemove.h"
#include "messages/MOSDPGInfo.h"
#include "messages/MOSDPGInfo2.h"
-#include "messages/MOSDPGCreate.h"
#include "messages/MOSDPGCreate2.h"
#include "messages/MBackfillReserve.h"
#include "messages/MRecoveryReserve.h"
service.send_pg_temp();
}
-void OSD::build_initial_pg_history(
- spg_t pgid,
- epoch_t created,
- utime_t created_stamp,
- pg_history_t *h,
- PastIntervals *pi)
-{
- dout(10) << __func__ << " " << pgid << " created " << created << dendl;
- *h = pg_history_t(created, created_stamp);
-
- OSDMapRef lastmap = service.get_map(created);
- int up_primary, acting_primary;
- vector<int> up, acting;
- lastmap->pg_to_up_acting_osds(
- pgid.pgid, &up, &up_primary, &acting, &acting_primary);
-
- ostringstream debug;
- for (epoch_t e = created + 1; e <= get_osdmap_epoch(); ++e) {
- OSDMapRef osdmap = service.get_map(e);
- int new_up_primary, new_acting_primary;
- vector<int> new_up, new_acting;
- osdmap->pg_to_up_acting_osds(
- pgid.pgid, &new_up, &new_up_primary, &new_acting, &new_acting_primary);
-
- // this is a bit imprecise, but sufficient?
- struct min_size_predicate_t : public IsPGRecoverablePredicate {
- const pg_pool_t *pi;
- bool operator()(const set<pg_shard_t> &have) const {
- return have.size() >= pi->min_size;
- }
- explicit min_size_predicate_t(const pg_pool_t *i) : pi(i) {}
- } min_size_predicate(osdmap->get_pg_pool(pgid.pgid.pool()));
-
- bool new_interval = PastIntervals::check_new_interval(
- acting_primary,
- new_acting_primary,
- acting, new_acting,
- up_primary,
- new_up_primary,
- up, new_up,
- h->same_interval_since,
- h->last_epoch_clean,
- osdmap.get(),
- lastmap.get(),
- pgid.pgid,
- min_size_predicate,
- pi,
- &debug);
- if (new_interval) {
- h->same_interval_since = e;
- if (up != new_up) {
- h->same_up_since = e;
- }
- if (acting_primary != new_acting_primary) {
- h->same_primary_since = e;
- }
- if (pgid.pgid.is_split(lastmap->get_pg_num(pgid.pgid.pool()),
- osdmap->get_pg_num(pgid.pgid.pool()),
- nullptr)) {
- h->last_epoch_split = e;
- }
- up = new_up;
- acting = new_acting;
- up_primary = new_up_primary;
- acting_primary = new_acting_primary;
- }
- lastmap = osdmap;
- }
- dout(20) << __func__ << " " << debug.str() << dendl;
- dout(10) << __func__ << " " << *h << " " << *pi
- << " [" << (pi->empty() ? pair<epoch_t,epoch_t>(0,0) :
- pi->get_bounds()) << ")"
- << dendl;
-}
-
void OSD::_add_heartbeat_peer(int p)
{
if (p == whoami)
}
}
- do_waiters();
-
// scrub purged_snaps every deep scrub interval
{
const utime_t last = superblock.last_purged_snaps_scrub;
return true;
}
- do_waiters();
_dispatch(m);
osd_lock.unlock();
return ret;
}
-void OSD::do_waiters()
-{
- ceph_assert(ceph_mutex_is_locked(osd_lock));
-
- dout(10) << "do_waiters -- start" << dendl;
- while (!finished.empty()) {
- OpRequestRef next = finished.front();
- finished.pop_front();
- dispatch_op(next);
- }
- dout(10) << "do_waiters -- finish" << dendl;
-}
-
-void OSD::dispatch_op(OpRequestRef op)
-{
- switch (op->get_req()->get_type()) {
-
- case MSG_OSD_PG_CREATE:
- handle_pg_create(op);
- break;
- }
-}
-
void OSD::_dispatch(Message *m)
{
ceph_assert(ceph_mutex_is_locked(osd_lock));
case MSG_COMMAND:
handle_command(static_cast<MCommand*>(m));
return;
-
- // -- need OSDMap --
-
- case MSG_OSD_PG_CREATE:
- {
- OpRequestRef op = op_tracker.create_request<OpRequest, Message*>(m);
- if (m->trace)
- op->osd_trace.init("osd op", &trace_endpoint, &m->trace);
- // no map? starting up?
- if (!get_osdmap()) {
- dout(7) << "no OSDMap, not booted" << dendl;
- logger->inc(l_osd_waiting_for_map);
- waiting_for_osdmap.push_back(op);
- op->mark_delayed("no osdmap");
- break;
- }
-
- // need OSDMap
- dispatch_op(op);
- }
}
}
parent->finish_split_stats(*stat_iter, rctx.transaction);
}
-/*
- * holding osd_lock
- */
-void OSD::handle_pg_create(OpRequestRef op)
-{
- // NOTE: this can be removed in P release (mimic is the last version to
- // send MOSDPGCreate messages).
-
- auto m = op->get_req<MOSDPGCreate>();
- ceph_assert(m->get_type() == MSG_OSD_PG_CREATE);
-
- dout(10) << "handle_pg_create " << *m << dendl;
-
- if (!require_mon_peer(op->get_req())) {
- return;
- }
-
- if (!require_same_or_newer_map(op, m->epoch, false))
- return;
-
- op->mark_started();
-
- const auto osdmap = get_osdmap();
- map<pg_t,utime_t>::const_iterator ci = m->ctimes.begin();
- for (map<pg_t,pg_create_t>::const_iterator p = m->mkpg.begin();
- p != m->mkpg.end();
- ++p, ++ci) {
- ceph_assert(ci != m->ctimes.end() && ci->first == p->first);
- epoch_t created = p->second.created;
- if (p->second.split_bits) // Skip split pgs
- continue;
- pg_t on = p->first;
-
- if (!osdmap->have_pg_pool(on.pool())) {
- dout(20) << "ignoring pg on deleted pool " << on << dendl;
- continue;
- }
-
- dout(20) << "mkpg " << on << " e" << created << "@" << ci->second << dendl;
-
- spg_t pgid;
- bool mapped = osdmap->get_primary_shard(on, &pgid);
- ceph_assert(mapped);
-
- // is it still ours?
- vector<int> up, acting;
- int up_primary = -1;
- int acting_primary = -1;
- osdmap->pg_to_up_acting_osds(on, &up, &up_primary, &acting, &acting_primary);
- int role = osdmap->calc_pg_role(pg_shard_t(whoami, pgid.shard), acting);
-
- if (acting_primary != whoami) {
- dout(10) << "mkpg " << on << " not acting_primary (" << acting_primary
- << "), my role=" << role << ", skipping" << dendl;
- continue;
- }
-
-
- PastIntervals pi;
- pg_history_t history;
- build_initial_pg_history(pgid, created, ci->second, &history, &pi);
-
- // The mon won't resend unless the primary changed, so we ignore
- // same_interval_since. We'll pass this history with the current
- // epoch as the event.
- if (history.same_primary_since > m->epoch) {
- dout(10) << __func__ << ": got obsolete pg create on pgid "
- << pgid << " from epoch " << m->epoch
- << ", primary changed in " << history.same_primary_since
- << dendl;
- continue;
- }
- enqueue_peering_evt(
- pgid,
- PGPeeringEventRef(
- std::make_shared<PGPeeringEvent>(
- osdmap->get_epoch(),
- osdmap->get_epoch(),
- NullEvt(),
- true,
- new PGCreateInfo(
- pgid,
- osdmap->get_epoch(),
- history,
- pi,
- true)
- )));
- }
-
- {
- std::lock_guard l(pending_creates_lock);
- if (pending_creates_from_mon == 0) {
- last_pg_create_epoch = m->epoch;
- }
- }
-
- maybe_update_heartbeat_peers();
-}
-
-
// ----------------------------------------
// peering and recovery
void tick();
void tick_without_osd_lock();
void _dispatch(Message *m);
- void dispatch_op(OpRequestRef op);
void check_osdmap_features();
ceph_assert(ceph_mutex_is_locked(osd_lock));
finished.splice(finished.end(), ls);
}
- void do_waiters();
// -- op tracking --
OpTracker op_tracker;
void load_pgs();
- /// build initial pg history and intervals on create
- void build_initial_pg_history(
- spg_t pgid,
- epoch_t created,
- utime_t created_stamp,
- pg_history_t *h,
- PastIntervals *pi);
-
epoch_t last_pg_create_epoch;
- void handle_pg_create(OpRequestRef op);
-
void split_pgs(
PG *parent,
const std::set<spg_t> &childpgids, std::set<PGRef> *out_pgs,
#include "messages/MOSDBoot.h"
#include "messages/MOSDAlive.h"
-#include "messages/MOSDPGCreate.h"
#include "messages/MOSDPGRemove.h"
#include "messages/MOSDMap.h"
#include "messages/MPGStats.h"
}
}
- void handle_pg_create(MOSDPGCreate *m) {
- ceph_assert(m != NULL);
- if (m->epoch < osdmap.get_epoch()) {
- std::cout << __func__ << " epoch " << m->epoch << " < "
- << osdmap.get_epoch() << "; dropping" << std::endl;
- m->put();
- return;
- }
-
- for (map<pg_t,pg_create_t>::iterator it = m->mkpg.begin();
- it != m->mkpg.end(); ++it) {
- pg_create_t &c = it->second;
- std::cout << __func__ << " pg " << it->first
- << " created " << c.created
- << " parent " << c.parent << std::endl;
- if (pgs.count(it->first)) {
- std::cout << __func__ << " pg " << it->first
- << " exists; skipping" << std::endl;
- continue;
- }
-
- pg_t pgid = it->first;
- add_pg(pgid, c.created, c.parent);
- }
- send_pg_stats();
- }
-
void handle_osd_map(MOSDMap *m) {
dout(1) << __func__ << dendl;
if (m->fsid != monc.get_fsid()) {
dout(1) << __func__ << " " << *m << dendl;
switch (m->get_type()) {
- case MSG_OSD_PG_CREATE:
- handle_pg_create((MOSDPGCreate*)m);
- break;
case CEPH_MSG_OSD_MAP:
handle_osd_map((MOSDMap*)m);
break;
#include "messages/MOSDPGBackfill.h"
MESSAGE(MOSDPGBackfill)
-#include "messages/MOSDPGCreate.h"
-MESSAGE(MOSDPGCreate)
-
#include "messages/MOSDPGCreate2.h"
MESSAGE(MOSDPGCreate2)