]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add some const to MOSDPGLog handling; document non-constness of log
authorSage Weil <sage@redhat.com>
Mon, 20 Feb 2017 17:23:50 +0000 (12:23 -0500)
committerSage Weil <sage@redhat.com>
Mon, 20 Feb 2017 19:22:05 +0000 (14:22 -0500)
The PGLog (merge) code stills the pg_log_t entries, but operator<< (called
by the message printer) doesn't look at it.  Document.

Signed-off-by: Sage Weil <sage@redhat.com>
src/messages/MOSDPGLog.h
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PG.h
src/osd/PGLog.cc
src/osd/PGLog.h

index 66764256d2e3a6ce0a67f648a62ff35d6614542c..6dafb789cd3935c04da9050f495605804b874684 100644 (file)
@@ -38,9 +38,9 @@ public:
   pg_missing_t missing;
   pg_interval_map_t past_intervals;
 
-  epoch_t get_epoch() { return epoch; }
-  spg_t get_pgid() { return spg_t(info.pgid.pgid, to); }
-  epoch_t get_query_epoch() { return query_epoch; }
+  epoch_t get_epoch() const { return epoch; }
+  spg_t get_pgid() const { return spg_t(info.pgid.pgid, to); }
+  epoch_t get_query_epoch() const { return query_epoch; }
 
   MOSDPGLog() : Message(MSG_OSD_PG_LOG, HEAD_VERSION, COMPAT_VERSION) { 
     set_priority(CEPH_MSG_PRIO_HIGH); 
@@ -67,6 +67,8 @@ private:
 public:
   const char *get_type_name() const { return "PGlog"; }
   void print(ostream& out) const {
+    // NOTE: log is not const, but operator<< doesn't touch fields
+    // swapped out by OSD code.
     out << "pg_log(" << info.pgid << " epoch " << epoch
        << " log " << log
        << " query_epoch " << query_epoch << ")";
index fc756168567780d866438241e4fc8792187e5c87..b7cc4b1ddcd67c2fd31b6195af4c2410f6cf62d2 100644 (file)
@@ -8128,7 +8128,7 @@ void OSD::handle_pg_notify(OpRequestRef op)
 
 void OSD::handle_pg_log(OpRequestRef op)
 {
-  MOSDPGLog *m = (MOSDPGLog*) op->get_req();
+  MOSDPGLog *m = static_cast<MOSDPGLog*>(op->get_nonconst_req());
   assert(m->get_type() == MSG_OSD_PG_LOG);
   dout(7) << "handle_pg_log " << *m << " from " << m->get_source() << dendl;
 
index c70ad9f5d58cdea8faae51e5cb8653129a5e1c4d..06aecc370fcfa8a17d2141660bb994d3a832abbe 100644 (file)
@@ -341,7 +341,9 @@ void PG::proc_master_log(
     
 void PG::proc_replica_log(
   ObjectStore::Transaction& t,
-  pg_info_t &oinfo, pg_log_t &olog, pg_missing_t& omissing,
+  pg_info_t &oinfo,
+  const pg_log_t &olog,
+  pg_missing_t& omissing,
   pg_shard_t from)
 {
   dout(10) << "proc_replica_log for osd." << from << ": "
@@ -7112,7 +7114,7 @@ boost::statechart::result PG::RecoveryState::ReplicaActive::react(const MLogRec&
   PG *pg = context< RecoveryMachine >().pg;
   ldout(pg->cct, 10) << "received log from " << logevt.from << dendl;
   ObjectStore::Transaction* t = context<RecoveryMachine>().get_cur_transaction();
-  pg->merge_log(*t,logevt.msg->info, logevt.msg->log, logevt.from);
+  pg->merge_log(*t, logevt.msg->info, logevt.msg->log, logevt.from);
   assert(pg->pg_log.get_head() == pg->info.last_update);
 
   return discard_event();
index 74aa9631af1e875d3a9959dfde42a11c4f186abb..fc972d5be501c08964b9fddef4cf294e24c2a91c 100644 (file)
@@ -925,7 +925,8 @@ public:
 
   virtual void calc_trim_to() = 0;
 
-  void proc_replica_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog,
+  void proc_replica_log(ObjectStore::Transaction& t,
+                       pg_info_t &oinfo, const pg_log_t &olog,
                        pg_missing_t& omissing, pg_shard_t from);
   void proc_master_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog,
                       pg_missing_t& omissing, pg_shard_t from);
index 0b9d7b75f908c7a2770c70cc232922739f8c1359..239faee2412bac318d3a860284d038800fa87037 100644 (file)
@@ -131,7 +131,9 @@ void PGLog::trim(
 
 void PGLog::proc_replica_log(
   ObjectStore::Transaction& t,
-  pg_info_t &oinfo, const pg_log_t &olog, pg_missing_t& omissing,
+  pg_info_t &oinfo,
+  const pg_log_t &olog,
+  pg_missing_t& omissing,
   pg_shard_t from) const
 {
   dout(10) << "proc_replica_log for osd." << from << ": "
index d9ced79c3ba04bc01c37a645f9a4971d910d62a1..8cfaa484144e1fea0a8296883a222f9ece9f7edb 100644 (file)
@@ -703,7 +703,9 @@ public:
     log.last_requested = 0;
   }
 
-  void proc_replica_log(ObjectStore::Transaction& t, pg_info_t &oinfo, const pg_log_t &olog,
+  void proc_replica_log(ObjectStore::Transaction& t,
+                       pg_info_t &oinfo,
+                       const pg_log_t &olog,
                        pg_missing_t& omissing, pg_shard_t from) const;
 
 protected:
@@ -972,7 +974,9 @@ public:
                             pg_info_t &info, LogEntryHandler *rollbacker,
                             bool &dirty_info, bool &dirty_big_info);
 
-  void merge_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog,
+  void merge_log(ObjectStore::Transaction& t,
+                pg_info_t &oinfo,
+                pg_log_t &olog,
                 pg_shard_t from,
                 pg_info_t &info, LogEntryHandler *rollbacker,
                 bool &dirty_info, bool &dirty_big_info);