]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add override in mon subsystem 13440/head
authorliuchang0812 <liuchang0812@gmail.com>
Wed, 15 Feb 2017 13:18:22 +0000 (21:18 +0800)
committerliuchang0812 <liuchang0812@gmail.com>
Wed, 15 Feb 2017 13:18:22 +0000 (21:18 +0800)
Fixes: http://tracker.ceph.com/issues/18922
Signed-off-by: liuchang0812 <liuchang0812@gmail.com>
13 files changed:
src/mon/Elector.cc
src/mon/LogMonitor.cc
src/mon/MDSMonitor.cc
src/mon/MgrMonitor.cc
src/mon/MonClient.cc
src/mon/Monitor.cc
src/mon/MonmapMonitor.cc
src/mon/OSDMonitor.cc
src/mon/PGMonitor.cc
src/mon/Paxos.cc
src/mon/PaxosService.cc
src/test/mon/test-mon-msg.cc
src/test/mon/test_mon_workloadgen.cc

index eb9885f98255ba3893eb53dd52b50c19b3664752..c3c8fd8845f43c7a2f2698f4ccf85611fe38c57d 100644 (file)
@@ -144,7 +144,7 @@ void Elector::reset_timer(double plus)
     Elector *elector;
   public:
     explicit C_ElectionExpire(Elector *e) : elector(e) { }
-    void finish(int r) {
+    void finish(int r) override {
       elector->expire();
     }
   };
index b8fd9c966414f81f1ed951048cf6110943dcce76..c8e746377ab048a5d95ec2ae5651e67316d3f578 100644 (file)
@@ -315,7 +315,7 @@ struct LogMonitor::C_Log : public C_MonOp {
   LogMonitor *logmon;
   C_Log(LogMonitor *p, MonOpRequestRef o) :
     C_MonOp(o), logmon(p) {}
-  void _finish(int r) {
+  void _finish(int r) override {
     if (r == -ECANCELED) {
       return;
     }
index 1fcc585468782fc2838a882d059de7c0d12495ce..4dbce27162c7d3bf23cee3d78f4da93e9e837618 100644 (file)
@@ -1515,7 +1515,7 @@ class FlagSetHandler : public FileSystemCommandHandler
       FSMap &fsmap,
       MonOpRequestRef op,
       map<string, cmd_vartype> &cmdmap,
-      std::stringstream &ss)
+      std::stringstream &ss) override
   {
     string flag_name;
     cmd_getval(g_ceph_context, cmdmap, "flag_name", flag_name);
@@ -1799,12 +1799,12 @@ public:
     : FileSystemCommandHandler("fs set")
   {}
 
-  virtual int handle(
+  int handle(
       Monitor *mon,
       FSMap &fsmap,
       MonOpRequestRef op,
       map<string, cmd_vartype> &cmdmap,
-      std::stringstream &ss)
+      std::stringstream &ss) override
   {
     std::string fs_name;
     if (!cmd_getval(g_ceph_context, cmdmap, "fs_name", fs_name) || fs_name.empty()) {
@@ -2046,7 +2046,7 @@ class AddDataPoolHandler : public FileSystemCommandHandler
       FSMap &fsmap,
       MonOpRequestRef op,
       map<string, cmd_vartype> &cmdmap,
-      std::stringstream &ss)
+      std::stringstream &ss) override
   {
     string poolname;
     cmd_getval(g_ceph_context, cmdmap, "pool", poolname);
@@ -2105,7 +2105,7 @@ class RemoveDataPoolHandler : public FileSystemCommandHandler
       FSMap &fsmap,
       MonOpRequestRef op,
       map<string, cmd_vartype> &cmdmap,
-      std::stringstream &ss)
+      std::stringstream &ss) override
   {
     string poolname;
     cmd_getval(g_ceph_context, cmdmap, "pool", poolname);
@@ -2185,14 +2185,14 @@ class LegacyHandler : public T
     legacy_prefix = new_prefix;
   }
 
-  virtual std::string const &get_prefix() {return legacy_prefix;}
+  std::string const &get_prefix() override {return legacy_prefix;}
 
   int handle(
       Monitor *mon,
       FSMap &fsmap,
       MonOpRequestRef op,
       map<string, cmd_vartype> &cmdmap,
-      std::stringstream &ss)
+      std::stringstream &ss) override
   {
     auto fs = fsmap.get_legacy_filesystem();
     if (fs == nullptr) {
index 5b681e861a80b46988a5169281074e70803b460c..d9cee80b463fc2ba15c026fe63c95d14066c5d04 100644 (file)
@@ -106,7 +106,7 @@ class C_Updated : public Context {
 public:
   C_Updated(MgrMonitor *a, MonOpRequestRef c) :
     mm(a), op(c) {}
-  void finish(int r) {
+  void finish(int r) override {
     if (r >= 0) {
       // Success 
     } else if (r == -ECANCELED) {
index 20abe28cd36df3c5d56f2c873fac596ae1246027..76d3e39a54e94c5852add4a67230c44add703db6 100644 (file)
@@ -748,7 +748,7 @@ void MonClient::schedule_tick()
   struct C_Tick : public Context {
     MonClient *monc;
     explicit C_Tick(MonClient *m) : monc(m) {}
-    void finish(int r) {
+    void finish(int r) override {
       monc->tick();
     }
   };
@@ -1025,7 +1025,7 @@ int MonClient::start_mon_command(const vector<string>& cmd,
       MonClient *monc;
       public:
       C_CancelMonCommand(uint64_t tid, MonClient *monc) : tid(tid), monc(monc) {}
-      void finish(int r) {
+      void finish(int r) override {
        monc->_cancel_mon_command(tid, -ETIMEDOUT);
       }
     };
index f441a69cf4d04d40e994fbeef0b070f7ca0aa897..f23f91a7b8b67cf43ee85f83dc7fd4f67730381c 100644 (file)
@@ -263,7 +263,7 @@ class AdminHook : public AdminSocketHook {
 public:
   explicit AdminHook(Monitor *m) : mon(m) {}
   bool call(std::string command, cmdmap_t& cmdmap, std::string format,
-           bufferlist& out) {
+           bufferlist& out) override {
     stringstream ss;
     mon->do_admin_command(command, cmdmap, format, ss);
     out.append(ss);
@@ -5009,7 +5009,7 @@ void Monitor::scrub_event_start()
   struct C_Scrub : public Context {
     Monitor *mon;
     explicit C_Scrub(Monitor *m) : mon(m) { }
-    void finish(int r) {
+    void finish(int r) override {
       mon->scrub_start();
     }
   };
@@ -5043,7 +5043,7 @@ void Monitor::scrub_reset_timeout()
   struct C_ScrubTimeout : public Context {
     Monitor *mon;
     explicit C_ScrubTimeout(Monitor *m) : mon(m) { }
-    void finish(int r) {
+    void finish(int r) override {
       mon->scrub_timeout();
     }
   };
@@ -5058,7 +5058,7 @@ class C_Mon_Tick : public Context {
   Monitor *mon;
 public:
   explicit C_Mon_Tick(Monitor *m) : mon(m) {}
-  void finish(int r) {
+  void finish(int r) override {
     mon->tick();
   }
 };
index fb86e8205495368c4fff3fc967a4fc6ee920ec63..8d9ef32f37a55c863073c84a281d80c82ecba768 100644 (file)
@@ -106,7 +106,7 @@ class C_ApplyFeatures : public Context {
   public:
   C_ApplyFeatures(MonmapMonitor *s, const mon_feature_t& f) :
     svc(s), features(f) { }
-  void finish(int r) {
+  void finish(int r) override {
     if (r >= 0) {
       svc->apply_mon_features(features);
     } else if (r == -EAGAIN || r == -ECANCELED) {
index 881a4611ec5a50c6a1f8caa1a9244c86dad66036..ee26e24c32dab3a1a08fc8e2ad814cb961062b80 100644 (file)
@@ -633,7 +633,7 @@ protected:
     }
   }
 
-  virtual void dump_item(const CrushTreeDumper::Item &qi, F *f) {
+  void dump_item(const CrushTreeDumper::Item &qi, F *f) override {
     if (!tree && qi.is_bucket())
       return;
 
@@ -784,7 +784,7 @@ protected:
   friend std::ostream &operator<<(ostream& out, const lowprecision_t& v);
 
   using OSDUtilizationDumper<TextTable>::dump_item;
-  virtual void dump_item(const CrushTreeDumper::Item &qi,
+  void dump_item(const CrushTreeDumper::Item &qi,
                         float &reweight,
                         int64_t kb,
                         int64_t kb_used,
@@ -792,7 +792,7 @@ protected:
                         double& util,
                         double& var,
                         const size_t num_pgs,
-                        TextTable *tbl) {
+                        TextTable *tbl) override {
     *tbl << qi.id
         << weightf_t(qi.weight)
         << weightf_t(reweight)
@@ -868,7 +868,7 @@ public:
 
 protected:
   using OSDUtilizationDumper<Formatter>::dump_item;
-  virtual void dump_item(const CrushTreeDumper::Item &qi,
+  void dump_item(const CrushTreeDumper::Item &qi,
                         float &reweight,
                         int64_t kb,
                         int64_t kb_used,
@@ -876,7 +876,7 @@ protected:
                         double& util,
                         double& var,
                         const size_t num_pgs,
-                        Formatter *f) {
+                        Formatter *f) override {
     f->open_object_section("item");
     CrushTreeDumper::dump_item_fields(crush, qi, f);
     f->dump_float("reweight", reweight);
@@ -1520,7 +1520,7 @@ public:
     MonOpRequestRef op)
     : C_MonOp(op), osdmon(osdmon) {}
 
-  void _finish(int) {
+  void _finish(int) override {
     MOSDMarkMeDown *m = static_cast<MOSDMarkMeDown*>(op->get_req());
     osdmon->mon->send_reply(
       op,
index b7c9870058c1aa285a5a5df516afd5a1258d1a60..286e5c70fe9e4ec4e95c411af9dab2f332c4f8ad 100644 (file)
@@ -708,7 +708,7 @@ struct PGMonitor::C_Stats : public C_MonOp {
           MonOpRequestRef op,
           MonOpRequestRef op_ack)
     : C_MonOp(op), pgmon(p), stats_op_ack(op_ack) {}
-  void _finish(int r) {
+  void _finish(int r) override {
     if (r >= 0) {
       pgmon->_updated_stats(op, stats_op_ack);
     } else if (r == -ECANCELED) {
@@ -830,7 +830,7 @@ struct RetryCheckOSDMap : public Context {
   epoch_t epoch;
   RetryCheckOSDMap(PGMonitor *p, epoch_t e) : pgmon(p), epoch(e) {
   }
-  void finish(int r) {
+  void finish(int r) override {
     if (r == -ECANCELED)
       return;
 
index 06f152142707350f9fc09068ce1038e4f41c853e..2e905ac8fb795dd2ec3f0b0b33bc395c6c2cac6d 100644 (file)
@@ -41,7 +41,7 @@ class Paxos::C_CollectTimeout : public Context {
   Paxos *paxos;
 public:
   explicit C_CollectTimeout(Paxos *p) : paxos(p) {}
-  void finish(int r) {
+  void finish(int r) override {
     if (r == -ECANCELED)
       return;
     paxos->collect_timeout();
@@ -52,7 +52,7 @@ class Paxos::C_AcceptTimeout : public Context {
   Paxos *paxos;
 public:
   explicit C_AcceptTimeout(Paxos *p) : paxos(p) {}
-  void finish(int r) {
+  void finish(int r) override {
     if (r == -ECANCELED)
       return;
     paxos->accept_timeout();
@@ -63,7 +63,7 @@ class Paxos::C_LeaseAckTimeout : public Context {
   Paxos *paxos;
 public:
   explicit C_LeaseAckTimeout(Paxos *p) : paxos(p) {}
-  void finish(int r) {
+  void finish(int r) override {
     if (r == -ECANCELED)
       return;
     paxos->lease_ack_timeout();
@@ -74,7 +74,7 @@ class Paxos::C_LeaseTimeout : public Context {
   Paxos *paxos;
 public:
   explicit C_LeaseTimeout(Paxos *p) : paxos(p) {}
-  void finish(int r) {
+  void finish(int r) override {
     if (r == -ECANCELED)
       return;
     paxos->lease_timeout();
@@ -85,7 +85,7 @@ class Paxos::C_LeaseRenew : public Context {
   Paxos *paxos;
 public:
   explicit C_LeaseRenew(Paxos *p) : paxos(p) {}
-  void finish(int r) {
+  void finish(int r) override {
     if (r == -ECANCELED)
       return;
     paxos->lease_renew_timeout();
@@ -96,7 +96,7 @@ class Paxos::C_Trimmed : public Context {
   Paxos *paxos;
 public:
   explicit C_Trimmed(Paxos *p) : paxos(p) { }
-  void finish(int r) {
+  void finish(int r) override {
     paxos->trimming = false;
   }
 };
@@ -860,7 +860,7 @@ void Paxos::accept_timeout()
 struct C_Committed : public Context {
   Paxos *paxos;
   explicit C_Committed(Paxos *p) : paxos(p) {}
-  void finish(int r) {
+  void finish(int r) override {
     assert(r >= 0);
     Mutex::Locker l(paxos->mon->lock);
     paxos->commit_finish();
index 09143e7c1250e2b880e3087238ea2306e84bc6d6..203be1c817c530398a42c5c78e19d4b57a99a6bd 100644 (file)
@@ -104,7 +104,7 @@ bool PaxosService::dispatch(MonOpRequestRef op)
            PaxosService *ps;
          public:
            explicit C_Propose(PaxosService *p) : ps(p) { }
-           void finish(int r) {
+           void finish(int r) override {
              ps->proposal_timer = 0;
              if (r >= 0)
                ps->propose_pending();
@@ -226,7 +226,7 @@ void PaxosService::propose_pending()
     PaxosService *ps;
   public:
     explicit C_Committed(PaxosService *p) : ps(p) { }
-    void finish(int r) {
+    void finish(int r) override {
       ps->proposing = false;
       if (r >= 0)
        ps->_active();
@@ -303,7 +303,7 @@ void PaxosService::_active()
       PaxosService *svc;
     public:
       explicit C_Active(PaxosService *s) : svc(s) {}
-      void finish(int r) {
+      void finish(int r) override {
        if (r >= 0)
          svc->_active();
       }
index ddf333d87a778a6e74aad228068d0d23116e6377..b4b7c0e8dc97e35d9fb574e26f7894dceb14f061 100644 (file)
@@ -183,13 +183,13 @@ fail:
     return true;
   }
 
-  bool ms_dispatch(Message *m) {
+  bool ms_dispatch(Message *m) override {
     return handle_message(m);  
   }
-  void ms_handle_connect(Connection *con) { }
-  void ms_handle_remote_reset(Connection *con) { }
-  bool ms_handle_reset(Connection *con) { return false; }
-  bool ms_handle_refused(Connection *con) { return false; }
+  void ms_handle_connect(Connection *con) override { }
+  void ms_handle_remote_reset(Connection *con) override { }
+  bool ms_handle_reset(Connection *con) override { return false; }
+  bool ms_handle_refused(Connection *con) override { return false; }
 
   bool is_wanted(Message *m) {
     dout(20) << __func__ << " " << *m << " type " << m->get_type() << dendl;
@@ -228,7 +228,7 @@ protected:
     lock("lock") { }
 
 public:
-  virtual void SetUp() {
+  void SetUp() override {
     reply_type = -1;
     if (reply_msg) {
       reply_msg->put();
@@ -237,7 +237,7 @@ public:
     ASSERT_EQ(init(), 0);
   }
 
-  virtual void TearDown() {
+  void TearDown() override {
     shutdown();
     if (reply_msg) {
       reply_msg->put();
@@ -245,7 +245,7 @@ public:
     }
   }
 
-  void handle_wanted(Message *m) {
+  void handle_wanted(Message *m) override {
     lock.Lock();
     // caller will put() after they call us, so hold on to a ref
     m->get();
index 1efc879d02143d5b7b3cf797c4bcf1482df5c5f0..309dcf636eff10bf98edc3994b34abe80cf04542 100644 (file)
@@ -92,7 +92,7 @@ class TestStub : public Dispatcher
   struct C_Tick : public Context {
     TestStub *s;
     explicit C_Tick(TestStub *stub) : s(stub) {}
-    void finish(int r) {
+    void finish(int r) override {
       generic_dout(20) << "C_Tick::" << __func__ << dendl;
       if (r == -ECANCELED) {
        generic_dout(20) << "C_Tick::" << __func__
@@ -103,9 +103,9 @@ class TestStub : public Dispatcher
     }
   };
 
-  virtual bool ms_dispatch(Message *m) = 0;
-  virtual void ms_handle_connect(Connection *con) = 0;
-  virtual void ms_handle_remote_reset(Connection *con) = 0;
+  bool ms_dispatch(Message *m) override = 0;
+  void ms_handle_connect(Connection *con) override = 0;
+  void ms_handle_remote_reset(Connection *con) override = 0;
   virtual int _shutdown() = 0;
   // courtesy method to be implemented by the stubs at their
   // own discretion
@@ -188,7 +188,7 @@ class ClientStub : public TestStub
   rngen_t gen;
 
  protected:
-  bool ms_dispatch(Message *m) {
+  bool ms_dispatch(Message *m) override {
     Mutex::Locker l(lock);
     dout(1) << "client::" << __func__ << " " << *m << dendl;
     switch (m->get_type()) {
@@ -200,34 +200,34 @@ class ClientStub : public TestStub
     return true;
   }
 
-  void ms_handle_connect(Connection *con) {
+  void ms_handle_connect(Connection *con) override {
     dout(1) << "client::" << __func__ << " " << con << dendl;
     Mutex::Locker l(lock);
     objecter->ms_handle_connect(con);
   }
 
-  void ms_handle_remote_reset(Connection *con) {
+  void ms_handle_remote_reset(Connection *con) override {
     dout(1) << "client::" << __func__ << " " << con << dendl;
     Mutex::Locker l(lock);
     objecter->ms_handle_remote_reset(con);
   }
 
-  bool ms_handle_reset(Connection *con) {
+  bool ms_handle_reset(Connection *con) override {
     dout(1) << "client::" << __func__ << dendl;
     Mutex::Locker l(lock);
     objecter->ms_handle_reset(con);
     return false;
   }
 
-  bool ms_handle_refused(Connection *con) {
+  bool ms_handle_refused(Connection *con) override {
     return false;
   }
 
-  const string get_name() {
+  const string get_name() override {
     return "client";
   }
 
-  virtual int _shutdown() {
+  int _shutdown() override {
     if (objecter) {
       objecter->shutdown();
     }
@@ -240,7 +240,7 @@ class ClientStub : public TestStub
       gen((int) time(NULL))
   { }
 
-  int init() {
+  int init() override {
     int err;
     err = monc.build_initial_monmap();
     if (err < 0) {
@@ -334,7 +334,7 @@ class OSDStub : public TestStub
   struct C_CreatePGs : public Context {
     OSDStub *s;
     explicit C_CreatePGs(OSDStub *stub) : s(stub) {}
-    void finish(int r) {
+    void finish(int r) override {
       if (r == -ECANCELED) {
        generic_dout(20) << "C_CreatePGs::" << __func__
                        << " shutdown" << dendl;
@@ -395,7 +395,7 @@ class OSDStub : public TestStub
     monc.set_messenger(messenger.get());
   }
 
-  int init() {
+  int init() override {
     dout(10) << __func__ << dendl;
     Mutex::Locker l(lock);
 
@@ -443,7 +443,7 @@ class OSDStub : public TestStub
     return 0;
   }
 
-  int _shutdown() {
+  int _shutdown() override {
 
     return 0;
   }
@@ -719,7 +719,7 @@ class OSDStub : public TestStub
     monc.send_mon_message(m);
   }
 
-  void _tick() {
+  void _tick() override {
     if (!osdmap.exists(whoami)) {
       std::cout << __func__ << " not in the cluster; boot!" << std::endl;
       boot();
@@ -874,7 +874,7 @@ class OSDStub : public TestStub
     m->put();
   }
 
-  bool ms_dispatch(Message *m) {
+  bool ms_dispatch(Message *m) override {
     dout(1) << __func__ << " " << *m << dendl;
 
     switch (m->get_type()) {
@@ -891,16 +891,16 @@ class OSDStub : public TestStub
     return true;
   }
 
-  void ms_handle_connect(Connection *con) {
+  void ms_handle_connect(Connection *con) override {
     dout(1) << __func__ << " " << con << dendl;
     if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
       dout(10) << __func__ << " on mon" << dendl;
     }
   }
 
-  void ms_handle_remote_reset(Connection *con) {}
+  void ms_handle_remote_reset(Connection *con) override {}
 
-  bool ms_handle_reset(Connection *con) {
+  bool ms_handle_reset(Connection *con) override {
     dout(1) << __func__ << dendl;
     Session *session = (Session *)con->get_priv();
     if (!session)
@@ -909,11 +909,11 @@ class OSDStub : public TestStub
     return true;
   }
 
-  bool ms_handle_refused(Connection *con) {
+  bool ms_handle_refused(Connection *con) override {
     return false;
   }
 
-  const string get_name() {
+  const string get_name() override {
     stringstream ss;
     ss << "osd." << whoami;
     return ss.str();
@@ -934,7 +934,7 @@ SafeTimer *shutdown_timer = NULL;
 
 struct C_Shutdown : public Context
 {
-  void finish(int r) {
+  void finish(int r) override {
     generic_dout(10) << "main::shutdown time has ran out" << dendl;
     shutdown_cond.Signal();
   }