Skip to content

Commit

Permalink
mds: go back to compact_map for replicas
Browse files Browse the repository at this point in the history
Zheng observed that an alloc_ptr doesn't really work in this case since any
call to get_replicas() will cause the map to be allocated, nullifying the
benefit. Use a compact_map until a better solution can be written. (This means
that the map will be allocated outside the mempool.)

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
  • Loading branch information
batrick committed Sep 12, 2017
1 parent e035b64 commit 5d67b5c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/mds/MDSCacheObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class MDSCacheObject {
// replication (across mds cluster)
protected:
unsigned replica_nonce; // [replica] defined on replica
typedef mempool::mds_co::map<mds_rank_t,unsigned> replica_map_type;
alloc_ptr<replica_map_type> replica_map; // [auth] mds -> nonce
typedef compact_map<mds_rank_t,unsigned> replica_map_type;
replica_map_type replica_map; // [auth] mds -> nonce

public:
bool is_replicated() const { return !get_replicas().empty(); }
Expand All @@ -281,16 +281,14 @@ class MDSCacheObject {
get_replicas().erase(mds);
if (get_replicas().empty()) {
put(PIN_REPLICATED);
replica_map.reset();
}
}
void clear_replica_map() {
if (!get_replicas().empty())
put(PIN_REPLICATED);
replica_map.reset();
}
replica_map_type& get_replicas() { return *replica_map; }
const replica_map_type& get_replicas() const { return *replica_map; }
replica_map_type& get_replicas() { return replica_map; }
const replica_map_type& get_replicas() const { return replica_map; }
void list_replicas(std::set<mds_rank_t>& ls) const {
for (const auto &p : get_replicas()) {
ls.insert(p.first);
Expand Down

0 comments on commit 5d67b5c

Please sign in to comment.