mirror of
https://github.com/ceph/ceph
synced 2024-12-29 23:12:27 +00:00
Elector: use monitor's encoded command sets instead of our own
Signed-off-by: Greg Farnum <greg@inktank.com>
This commit is contained in:
parent
e223e5348d
commit
ec609cacde
@ -106,18 +106,11 @@ void Elector::defer(int who)
|
|||||||
electing_me = false;
|
electing_me = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// encode my commands for transmission
|
|
||||||
if(!my_supported_commands.length()) {
|
|
||||||
const MonCommand *cmds;
|
|
||||||
int cmdsize;
|
|
||||||
get_locally_supported_monitor_commands(&cmds, &cmdsize);
|
|
||||||
MonCommand::encode_array(cmds, cmdsize, my_supported_commands);
|
|
||||||
}
|
|
||||||
// ack them
|
// ack them
|
||||||
leader_acked = who;
|
leader_acked = who;
|
||||||
ack_stamp = ceph_clock_now(g_ceph_context);
|
ack_stamp = ceph_clock_now(g_ceph_context);
|
||||||
MMonElection *m = new MMonElection(MMonElection::OP_ACK, epoch, mon->monmap);
|
MMonElection *m = new MMonElection(MMonElection::OP_ACK, epoch, mon->monmap);
|
||||||
m->commands = my_supported_commands;
|
m->commands = mon->get_supported_commands_bl();
|
||||||
mon->messenger->send_message(m, mon->monmap->get_inst(who));
|
mon->messenger->send_message(m, mon->monmap->get_inst(who));
|
||||||
|
|
||||||
// set a timer
|
// set a timer
|
||||||
@ -180,22 +173,16 @@ void Elector::victory()
|
|||||||
assert(epoch % 2 == 1); // election
|
assert(epoch % 2 == 1); // election
|
||||||
bump_epoch(epoch+1); // is over!
|
bump_epoch(epoch+1); // is over!
|
||||||
|
|
||||||
// calculate my supported commands for peons to advertise
|
// decide my supported commands for peons to advertise
|
||||||
bufferlist *cmds_bl = NULL;
|
const bufferlist *cmds_bl = NULL;
|
||||||
const MonCommand *cmds;
|
const MonCommand *cmds;
|
||||||
int cmdsize;
|
int cmdsize;
|
||||||
if (!use_classic_commands) {
|
if (use_classic_commands) {
|
||||||
get_locally_supported_monitor_commands(&cmds, &cmdsize);
|
|
||||||
if(!my_supported_commands.length()) {
|
|
||||||
MonCommand::encode_array(cmds, cmdsize, my_supported_commands);
|
|
||||||
}
|
|
||||||
cmds_bl = &my_supported_commands;
|
|
||||||
} else {
|
|
||||||
get_classic_monitor_commands(&cmds, &cmdsize);
|
get_classic_monitor_commands(&cmds, &cmdsize);
|
||||||
if (!classic_commands.length()){
|
cmds_bl = &mon->get_classic_commands_bl();
|
||||||
MonCommand::encode_array(cmds, cmdsize, classic_commands);
|
} else {
|
||||||
}
|
get_locally_supported_monitor_commands(&cmds, &cmdsize);
|
||||||
cmds_bl = &classic_commands;
|
cmds_bl = &mon->get_supported_commands_bl();
|
||||||
}
|
}
|
||||||
|
|
||||||
// tell everyone!
|
// tell everyone!
|
||||||
|
@ -115,8 +115,6 @@ class Elector {
|
|||||||
*/
|
*/
|
||||||
map<int, uint64_t> acked_me;
|
map<int, uint64_t> acked_me;
|
||||||
set<int> classic_mons;
|
set<int> classic_mons;
|
||||||
bufferlist my_supported_commands;
|
|
||||||
bufferlist classic_commands;
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user