Skip to content

Commit

Permalink
mon: add override in mon subsystem
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/18922

Signed-off-by: liuchang0812 <[email protected]>
  • Loading branch information
liuchang0812 committed Feb 15, 2017
1 parent 05f1a19 commit 1effdfe
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion src/mon/Elector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/mon/LogMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions src/mon/MDSMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -1799,12 +1799,12 @@ class SetHandler : public FileSystemCommandHandler
: 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()) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/mon/MgrMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/mon/MonClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};
Expand Down Expand Up @@ -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);
}
};
Expand Down
8 changes: 4 additions & 4 deletions src/mon/Monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
};
Expand Down Expand Up @@ -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();
}
};
Expand All @@ -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();
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/mon/MonmapMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ class OSDUtilizationDumper : public CrushTreeDumper::Dumper<F> {
}
}

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;

Expand Down Expand Up @@ -784,15 +784,15 @@ class OSDUtilizationPlainDumper : public OSDUtilizationDumper<TextTable> {
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,
int64_t kb_avail,
double& util,
double& var,
const size_t num_pgs,
TextTable *tbl) {
TextTable *tbl) override {
*tbl << qi.id
<< weightf_t(qi.weight)
<< weightf_t(reweight)
Expand Down Expand Up @@ -868,15 +868,15 @@ class OSDUtilizationFormatDumper : public OSDUtilizationDumper<Formatter> {

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,
int64_t kb_avail,
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);
Expand Down Expand Up @@ -1520,7 +1520,7 @@ class C_AckMarkedDown : public C_MonOp {
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,
Expand Down
4 changes: 2 additions & 2 deletions src/mon/PGMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down
14 changes: 7 additions & 7 deletions src/mon/Paxos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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;
}
};
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/mon/PaxosService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand Down
16 changes: 8 additions & 8 deletions src/test/mon/test-mon-msg.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,13 @@ class MonClientHelper : public Dispatcher
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;
Expand Down Expand Up @@ -228,7 +228,7 @@ class MonMsgTest : public MonClientHelper,
lock("lock") { }

public:
virtual void SetUp() {
void SetUp() override {
reply_type = -1;
if (reply_msg) {
reply_msg->put();
Expand All @@ -237,15 +237,15 @@ class MonMsgTest : public MonClientHelper,
ASSERT_EQ(init(), 0);
}

virtual void TearDown() {
void TearDown() override {
shutdown();
if (reply_msg) {
reply_msg->put();
reply_msg = NULL;
}
}

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();
Expand Down
Loading

0 comments on commit 1effdfe

Please sign in to comment.