Skip to content

Commit

Permalink
mds: remove inc array from mdsmap
Browse files Browse the repository at this point in the history
Instead, use the MDSMap epochs to provide the `inc` that
we populate into mds_info_t for use by the daemons.

It is not necessary to respect the current value of inc
in old maps, because the per-rank counters were necessarily
lower numbers than the overall map epoch (incrementing
the counters always corresponded to a map change).

Fixes: http://tracker.ceph.com/issues/15399
Signed-off-by: John Spray <john.spray@redhat.com>
  • Loading branch information
John Spray committed Apr 30, 2016
1 parent 3711782 commit 30a375e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/mds/FSMap.cc
Expand Up @@ -334,7 +334,8 @@ void FSMap::decode(bufferlist::iterator& p)
::decode(legacy_mds_map.modified, p);
::decode(legacy_mds_map.tableserver, p);
::decode(legacy_mds_map.in, p);
::decode(legacy_mds_map.inc, p);
std::map<mds_rank_t,int32_t> inc; // Legacy field, parse and drop
::decode(inc, p);
::decode(legacy_mds_map.up, p);
::decode(legacy_mds_map.failed, p);
::decode(legacy_mds_map.stopped, p);
Expand Down Expand Up @@ -663,7 +664,7 @@ void FSMap::promote(
mds_map.failed.erase(assigned_rank);
}
info.rank = assigned_rank;
info.inc = ++mds_map.inc[assigned_rank];
info.inc = epoch;
mds_roles[standby_gid] = filesystem->fscid;

// Update the rank state in Filesystem
Expand Down
9 changes: 9 additions & 0 deletions src/mds/MDSMap.cc
Expand Up @@ -469,6 +469,13 @@ void MDSMap::mds_info_t::decode(bufferlist::iterator& bl)

void MDSMap::encode(bufferlist& bl, uint64_t features) const
{
std::map<mds_rank_t,int32_t> inc; // Legacy field, fake it so that
// old-mon peers have something sane
// during upgrade
for (const auto rank : in) {
inc.insert(std::make_pair(rank, epoch));
}

if ((features & CEPH_FEATURE_PGID64) == 0) {
__u16 v = 2;
::encode(v, bl);
Expand Down Expand Up @@ -573,6 +580,8 @@ void MDSMap::encode(bufferlist& bl, uint64_t features) const

void MDSMap::decode(bufferlist::iterator& p)
{
std::map<mds_rank_t,int32_t> inc; // Legacy field, parse and drop

cached_up_features = 0;
DECODE_START_LEGACY_COMPAT_LEN_16(5, 4, 4, p);
::decode(epoch, p);
Expand Down
2 changes: 1 addition & 1 deletion src/mds/MDSMap.h
Expand Up @@ -203,7 +203,7 @@ class MDSMap {
mds_rank_t max_mds; /* The maximum number of active MDSes. Also, the maximum rank. */

std::set<mds_rank_t> in; // currently defined cluster
std::map<mds_rank_t,int32_t> inc; // most recent incarnation.

// which ranks are failed, stopped, damaged (i.e. not held by a daemon)
std::set<mds_rank_t> failed, stopped, damaged;
std::map<mds_rank_t, mds_gid_t> up; // who is in those roles
Expand Down
1 change: 0 additions & 1 deletion src/mon/MDSMonitor.cc
Expand Up @@ -1732,7 +1732,6 @@ int MDSMonitor::management_command(

// Carry forward what makes sense
new_fs->fscid = fs->fscid;
new_fs->mds_map.inc = fs->mds_map.inc;
new_fs->mds_map.inline_data_enabled = fs->mds_map.inline_data_enabled;
new_fs->mds_map.max_mds = g_conf->max_mds;
new_fs->mds_map.data_pools = fs->mds_map.data_pools;
Expand Down

0 comments on commit 30a375e

Please sign in to comment.