Skip to content

Commit

Permalink
messages: add MMDSBeacon::standby_replay
Browse files Browse the repository at this point in the history
So that daemons can explicitly say that they
want to be standby replay, instead of using
magic standby_for_rank values.

Because in some cases daemons would indicate this
with a beacon requesting STANDBY_REPLAY state, we
also munge these during decode to be normal STANDBY
requests with standby_replay=true.

Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit cdf8a29)
  • Loading branch information
John Spray authored and Abhishek Varshney committed May 6, 2016
1 parent 02e3edd commit ae3ce5b
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/messages/MMDSBeacon.h
Expand Up @@ -122,7 +122,7 @@ WRITE_CLASS_ENCODER(MDSHealth)

class MMDSBeacon : public PaxosServiceMessage {

static const int HEAD_VERSION = 6;
static const int HEAD_VERSION = 7;
static const int COMPAT_VERSION = 2;

uuid_d fsid;
Expand All @@ -135,6 +135,7 @@ class MMDSBeacon : public PaxosServiceMessage {
mds_rank_t standby_for_rank;
string standby_for_name;
fs_cluster_id_t standby_for_fscid;
bool standby_replay;

CompatSet compat;

Expand All @@ -150,7 +151,7 @@ class MMDSBeacon : public PaxosServiceMessage {
PaxosServiceMessage(MSG_MDS_BEACON, les, HEAD_VERSION, COMPAT_VERSION),
fsid(f), global_id(g), name(n), state(st), seq(se),
standby_for_rank(MDS_RANK_NONE), standby_for_fscid(FS_CLUSTER_ID_NONE),
mds_features(feat) {
standby_replay(false), mds_features(feat) {
}
private:
~MMDSBeacon() {}
Expand All @@ -166,6 +167,7 @@ class MMDSBeacon : public PaxosServiceMessage {
mds_rank_t get_standby_for_rank() { return standby_for_rank; }
const string& get_standby_for_name() { return standby_for_name; }
const fs_cluster_id_t& get_standby_for_fscid() { return standby_for_fscid; }
bool get_standby_replay() const { return standby_replay; }
uint64_t get_mds_features() const { return mds_features; }

CompatSet const& get_compat() const { return compat; }
Expand All @@ -178,6 +180,7 @@ class MMDSBeacon : public PaxosServiceMessage {
void set_standby_for_name(string& n) { standby_for_name = n; }
void set_standby_for_name(const char* c) { standby_for_name.assign(c); }
void set_standby_for_fscid(fs_cluster_id_t f) { standby_for_fscid = f; }
void set_standby_replay(bool r) { standby_replay = r; }

const map<string, string>& get_sys_info() const { return sys_info; }
void set_sys_info(const map<string, string>& i) { sys_info = i; }
Expand All @@ -203,6 +206,7 @@ class MMDSBeacon : public PaxosServiceMessage {
}
::encode(mds_features, payload);
::encode(standby_for_fscid, payload);
::encode(standby_replay, payload);
}
void decode_payload() {
bufferlist::iterator p = payload.begin();
Expand All @@ -229,6 +233,16 @@ class MMDSBeacon : public PaxosServiceMessage {
if (header.version >= 6) {
::decode(standby_for_fscid, p);
}
if (header.version >= 7) {
::decode(standby_replay, p);
}

if (header.version < 7 && state == MDSMap::STATE_STANDBY_REPLAY) {
// Old MDS daemons request the state, instead of explicitly
// advertising that they are configured as a replay daemon.
standby_replay = true;
state = MDSMap::STATE_STANDBY;
}
}
};

Expand Down

0 comments on commit ae3ce5b

Please sign in to comment.