]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: MOSDPGCreate cleanup
authorMatan Breizman <mbreizma@redhat.com>
Mon, 20 Jun 2022 11:15:46 +0000 (11:15 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Mon, 27 Jun 2022 13:41:59 +0000 (13:41 +0000)
MOSDPGCreate message is not in use since Mimic.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/messages/MOSDPGCreate.h [deleted file]
src/mon/OSDMonitor.cc
src/msg/Message.cc
src/msg/MessageRef.h
src/osd/OSD.cc
src/osd/OSD.h
src/test/mon/test_mon_workloadgen.cc
src/tools/ceph-dencoder/common_types.h

diff --git a/src/messages/MOSDPGCreate.h b/src/messages/MOSDPGCreate.h
deleted file mode 100644 (file)
index 405135e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// -*- 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
index d9dcc872bdf7a7585d48b625e5d9eb7c9cfc76b5..c8774fdaa19de34e560d0462e084b0fc0a5b3cca 100644 (file)
@@ -47,7 +47,6 @@
 #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"
@@ -5042,11 +5041,8 @@ epoch_t OSDMonitor::send_pg_creates(int osd, Connection *con, epoch_t next) cons
     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) {
@@ -5060,34 +5056,23 @@ epoch_t OSDMonitor::send_pg_creates(int osd, Connection *con, epoch_t next) cons
       // 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;
index 266eb7676786b85ea7481855fa6d8bd94c600a56..9f57ddce3917e575af1e445c063ce56bd367f6f0 100644 (file)
@@ -85,7 +85,6 @@
 #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"
@@ -568,9 +567,6 @@ Message *decode_message(CephContext *cct,
   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;
index ef7a56a44d942cd1059348f9aed73ce15582a020..05c1a8e6987a6709ddf126bdfe4a15be7cb8846e 100644 (file)
@@ -143,7 +143,6 @@ class MOSDPGBackfill;
 class MOSDPGBackfillRemove;
 class MOSDPGCreate2;
 class MOSDPGCreated;
-class MOSDPGCreate;
 class MOSDPGInfo;
 class MOSDPGLog;
 class MOSDPGNotify;
index dc58cb438827df34872174453556b30b3ce9ec14..2483ce3817619c8334cc57bda0282aec19742ba7 100644 (file)
@@ -97,7 +97,6 @@
 #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"
@@ -5226,81 +5225,6 @@ void OSD::resume_creating_pg()
   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)
@@ -6087,8 +6011,6 @@ void OSD::tick()
     }
   }
 
-  do_waiters();
-
   // scrub purged_snaps every deep scrub interval
   {
     const utime_t last = superblock.last_purged_snaps_scrub;
@@ -7187,7 +7109,6 @@ bool OSD::ms_dispatch(Message *m)
     return true;
   }
 
-  do_waiters();
   _dispatch(m);
 
   osd_lock.unlock();
@@ -7414,29 +7335,6 @@ int OSD::ms_handle_authentication(Connection *con)
   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));
@@ -7461,26 +7359,6 @@ void OSD::_dispatch(Message *m)
   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);
-    }
   }
 }
 
@@ -9154,106 +9032,6 @@ void OSD::split_pgs(
   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
 
index 8aa5b8cfbd711127da8acf240e44d0d8b6b4a3fd..59628ee739cfedfcb892efeeb0f59de9bcb54960 100644 (file)
@@ -1130,7 +1130,6 @@ protected:
   void tick();
   void tick_without_osd_lock();
   void _dispatch(Message *m);
-  void dispatch_op(OpRequestRef op);
 
   void check_osdmap_features();
 
@@ -1552,7 +1551,6 @@ private:
     ceph_assert(ceph_mutex_is_locked(osd_lock));
     finished.splice(finished.end(), ls);
   }
-  void do_waiters();
 
   // -- op tracking --
   OpTracker op_tracker;
@@ -1807,18 +1805,8 @@ protected:
 
   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,
index e62c5627b404f868ffa256e8221910afa7387d6d..ca2eae0d42746603e3f16d0bc78e38cefe94c35c 100644 (file)
@@ -57,7 +57,6 @@
 
 #include "messages/MOSDBoot.h"
 #include "messages/MOSDAlive.h"
-#include "messages/MOSDPGCreate.h"
 #include "messages/MOSDPGRemove.h"
 #include "messages/MOSDMap.h"
 #include "messages/MPGStats.h"
@@ -743,33 +742,6 @@ class OSDStub : public TestStub
     }
   }
 
-  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()) {
@@ -872,9 +844,6 @@ class OSDStub : public TestStub
     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;
index 543336a7ef712900c2099e410a2e15da07e50b7f..22e3e9d35d2b15fe9b92fe9b09951538ee19d6ea 100644 (file)
@@ -366,9 +366,6 @@ MESSAGE(MOSDOpReply)
 #include "messages/MOSDPGBackfill.h"
 MESSAGE(MOSDPGBackfill)
 
-#include "messages/MOSDPGCreate.h"
-MESSAGE(MOSDPGCreate)
-
 #include "messages/MOSDPGCreate2.h"
 MESSAGE(MOSDPGCreate2)