]> git.proxmox.com Git - ceph.git/blob - ceph/src/mds/MDSMap.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / mds / MDSMap.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
3 /*
4 * Ceph - scalable distributed file system
5 *
6 * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
7 *
8 * This is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License version 2.1, as published by the Free Software
11 * Foundation. See file COPYING.
12 *
13 */
14
15 #ifndef CEPH_MDSMAP_H
16 #define CEPH_MDSMAP_H
17
18 #include <algorithm>
19 #include <map>
20 #include <set>
21 #include <string>
22 #include <string_view>
23
24 #include <errno.h>
25
26 #include "include/types.h"
27 #include "include/ceph_features.h"
28 #include "include/health.h"
29 #include "include/CompatSet.h"
30 #include "include/common_fwd.h"
31
32 #include "common/Clock.h"
33 #include "common/Formatter.h"
34 #include "common/ceph_releases.h"
35 #include "common/config.h"
36
37 #include "mds/mdstypes.h"
38
39 #define MDS_FEATURE_INCOMPAT_BASE CompatSet::Feature(1, "base v0.20")
40 #define MDS_FEATURE_INCOMPAT_CLIENTRANGES CompatSet::Feature(2, "client writeable ranges")
41 #define MDS_FEATURE_INCOMPAT_FILELAYOUT CompatSet::Feature(3, "default file layouts on dirs")
42 #define MDS_FEATURE_INCOMPAT_DIRINODE CompatSet::Feature(4, "dir inode in separate object")
43 #define MDS_FEATURE_INCOMPAT_ENCODING CompatSet::Feature(5, "mds uses versioned encoding")
44 #define MDS_FEATURE_INCOMPAT_OMAPDIRFRAG CompatSet::Feature(6, "dirfrag is stored in omap")
45 #define MDS_FEATURE_INCOMPAT_INLINE CompatSet::Feature(7, "mds uses inline data")
46 #define MDS_FEATURE_INCOMPAT_NOANCHOR CompatSet::Feature(8, "no anchor table")
47 #define MDS_FEATURE_INCOMPAT_FILE_LAYOUT_V2 CompatSet::Feature(9, "file layout v2")
48 #define MDS_FEATURE_INCOMPAT_SNAPREALM_V2 CompatSet::Feature(10, "snaprealm v2")
49
50 #define MDS_FS_NAME_DEFAULT "cephfs"
51
52 class health_check_map_t;
53
54 class MDSMap {
55 public:
56 /* These states are the union of the set of possible states of an MDS daemon,
57 * and the set of possible states of an MDS rank. See
58 * doc/cephfs/mds-states.rst for state descriptions,
59 * doc/cephfs/mds-state-diagram.svg for a visual state diagram, and
60 * doc/cephfs/mds-state-diagram.dot to update mds-state-diagram.svg.
61 */
62 typedef enum {
63 // States of an MDS daemon not currently holding a rank
64 // ====================================================
65 STATE_NULL = CEPH_MDS_STATE_NULL, // null value for fns returning this type.
66 STATE_BOOT = CEPH_MDS_STATE_BOOT, // up, boot announcement. destiny unknown.
67 STATE_STANDBY = CEPH_MDS_STATE_STANDBY, // up, idle. waiting for assignment by monitor.
68 STATE_STANDBY_REPLAY = CEPH_MDS_STATE_STANDBY_REPLAY, // up, replaying active node, ready to take over.
69
70 // States of an MDS rank, and of any MDS daemon holding that rank
71 // ==============================================================
72 STATE_STOPPED = CEPH_MDS_STATE_STOPPED, // down, once existed, but no subtrees. empty log. may not be held by a daemon.
73
74 STATE_CREATING = CEPH_MDS_STATE_CREATING, // up, creating MDS instance (new journal, idalloc..).
75 STATE_STARTING = CEPH_MDS_STATE_STARTING, // up, starting prior stopped MDS instance.
76
77 STATE_REPLAY = CEPH_MDS_STATE_REPLAY, // up, starting prior failed instance. scanning journal.
78 STATE_RESOLVE = CEPH_MDS_STATE_RESOLVE, // up, disambiguating distributed operations (import, rename, etc.)
79 STATE_RECONNECT = CEPH_MDS_STATE_RECONNECT, // up, reconnect to clients
80 STATE_REJOIN = CEPH_MDS_STATE_REJOIN, // up, replayed journal, rejoining distributed cache
81 STATE_CLIENTREPLAY = CEPH_MDS_STATE_CLIENTREPLAY, // up, active
82 STATE_ACTIVE = CEPH_MDS_STATE_ACTIVE, // up, active
83 STATE_STOPPING = CEPH_MDS_STATE_STOPPING, // up, exporting metadata (-> standby or out)
84 STATE_DNE = CEPH_MDS_STATE_DNE, // down, rank does not exist
85
86 // State which a daemon may send to MDSMonitor in its beacon
87 // to indicate that offline repair is required. Daemon must stop
88 // immediately after indicating this state.
89 STATE_DAMAGED = CEPH_MDS_STATE_DAMAGED
90
91 /*
92 * In addition to explicit states, an MDS rank implicitly in state:
93 * - STOPPED if it is not currently associated with an MDS daemon gid but it
94 * is in MDSMap::stopped
95 * - FAILED if it is not currently associated with an MDS daemon gid but it
96 * is in MDSMap::failed
97 * - DNE if it is not currently associated with an MDS daemon gid and it is
98 * missing from both MDSMap::failed and MDSMap::stopped
99 */
100 } DaemonState;
101
102 typedef enum
103 {
104 AVAILABLE = 0,
105 TRANSIENT_UNAVAILABLE = 1,
106 STUCK_UNAVAILABLE = 2
107
108 } availability_t;
109
110 struct mds_info_t {
111 mds_info_t() = default;
112
113 bool laggy() const { return !(laggy_since == utime_t()); }
114 void clear_laggy() { laggy_since = utime_t(); }
115
116 bool is_degraded() const {
117 return STATE_REPLAY <= state && state <= STATE_CLIENTREPLAY;
118 }
119
120 void freeze() { flags |= mds_flags::FROZEN; }
121 void unfreeze() { flags &= ~mds_flags::FROZEN; }
122 bool is_frozen() const { return flags&mds_flags::FROZEN; }
123
124 const entity_addrvec_t& get_addrs() const {
125 return addrs;
126 }
127
128 void encode(bufferlist& bl, uint64_t features) const {
129 if ((features & CEPH_FEATURE_MDSENC) == 0 ) encode_unversioned(bl);
130 else encode_versioned(bl, features);
131 }
132 void decode(bufferlist::const_iterator& p);
133 void dump(Formatter *f) const;
134 void dump(std::ostream&) const;
135
136 // The long form name for use in cluster log messages`
137 std::string human_name() const;
138
139 static void generate_test_instances(std::list<mds_info_t*>& ls);
140
141 mds_gid_t global_id = MDS_GID_NONE;
142 std::string name;
143 mds_rank_t rank = MDS_RANK_NONE;
144 int32_t inc = 0;
145 MDSMap::DaemonState state = STATE_STANDBY;
146 version_t state_seq = 0;
147 entity_addrvec_t addrs;
148 utime_t laggy_since;
149 std::set<mds_rank_t> export_targets;
150 fs_cluster_id_t join_fscid = FS_CLUSTER_ID_NONE;
151 uint64_t mds_features = 0;
152 uint64_t flags = 0;
153 enum mds_flags : uint64_t {
154 FROZEN = 1 << 0,
155 };
156 private:
157 void encode_versioned(bufferlist& bl, uint64_t features) const;
158 void encode_unversioned(bufferlist& bl) const;
159 };
160
161 friend class MDSMonitor;
162 friend class Filesystem;
163 friend class FSMap;
164
165 static CompatSet get_compat_set_all();
166 static CompatSet get_compat_set_default();
167 static CompatSet get_compat_set_base(); // pre v0.20
168
169 bool get_inline_data_enabled() const { return inline_data_enabled; }
170 void set_inline_data_enabled(bool enabled) { inline_data_enabled = enabled; }
171
172 utime_t get_session_timeout() const {
173 return utime_t(session_timeout,0);
174 }
175 void set_session_timeout(uint32_t t) {
176 session_timeout = t;
177 }
178
179 utime_t get_session_autoclose() const {
180 return utime_t(session_autoclose, 0);
181 }
182 void set_session_autoclose(uint32_t t) {
183 session_autoclose = t;
184 }
185
186 uint64_t get_max_filesize() const { return max_file_size; }
187 void set_max_filesize(uint64_t m) { max_file_size = m; }
188
189 ceph_release_t get_min_compat_client() const { return min_compat_client; }
190 void set_min_compat_client(ceph_release_t version) { min_compat_client = version; }
191
192 int get_flags() const { return flags; }
193 bool test_flag(int f) const { return flags & f; }
194 void set_flag(int f) { flags |= f; }
195 void clear_flag(int f) { flags &= ~f; }
196
197 std::string_view get_fs_name() const {return fs_name;}
198
199 void set_snaps_allowed() {
200 set_flag(CEPH_MDSMAP_ALLOW_SNAPS);
201 ever_allowed_features |= CEPH_MDSMAP_ALLOW_SNAPS;
202 explicitly_allowed_features |= CEPH_MDSMAP_ALLOW_SNAPS;
203 }
204 void clear_snaps_allowed() { clear_flag(CEPH_MDSMAP_ALLOW_SNAPS); }
205 bool allows_snaps() const { return test_flag(CEPH_MDSMAP_ALLOW_SNAPS); }
206 bool was_snaps_ever_allowed() const { return ever_allowed_features & CEPH_MDSMAP_ALLOW_SNAPS; }
207
208 void set_standby_replay_allowed() {
209 set_flag(CEPH_MDSMAP_ALLOW_STANDBY_REPLAY);
210 ever_allowed_features |= CEPH_MDSMAP_ALLOW_STANDBY_REPLAY;
211 explicitly_allowed_features |= CEPH_MDSMAP_ALLOW_STANDBY_REPLAY;
212 }
213 void clear_standby_replay_allowed() { clear_flag(CEPH_MDSMAP_ALLOW_STANDBY_REPLAY); }
214 bool allows_standby_replay() const { return test_flag(CEPH_MDSMAP_ALLOW_STANDBY_REPLAY); }
215 bool was_standby_replay_ever_allowed() const { return ever_allowed_features & CEPH_MDSMAP_ALLOW_STANDBY_REPLAY; }
216
217 void set_multimds_snaps_allowed() {
218 set_flag(CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS);
219 ever_allowed_features |= CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS;
220 explicitly_allowed_features |= CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS;
221 }
222 void clear_multimds_snaps_allowed() { clear_flag(CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS); }
223 bool allows_multimds_snaps() const { return test_flag(CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS); }
224
225 epoch_t get_epoch() const { return epoch; }
226 void inc_epoch() { epoch++; }
227
228 bool get_enabled() const { return enabled; }
229
230 const utime_t& get_created() const { return created; }
231 void set_created(utime_t ct) { modified = created = ct; }
232 const utime_t& get_modified() const { return modified; }
233 void set_modified(utime_t mt) { modified = mt; }
234
235 epoch_t get_last_failure() const { return last_failure; }
236 epoch_t get_last_failure_osd_epoch() const { return last_failure_osd_epoch; }
237
238 mds_rank_t get_max_mds() const { return max_mds; }
239 void set_max_mds(mds_rank_t m) { max_mds = m; }
240 void set_old_max_mds() { old_max_mds = max_mds; }
241 mds_rank_t get_old_max_mds() const { return old_max_mds; }
242
243 mds_rank_t get_standby_count_wanted(mds_rank_t standby_daemon_count) const {
244 ceph_assert(standby_daemon_count >= 0);
245 std::set<mds_rank_t> s;
246 get_standby_replay_mds_set(s);
247 mds_rank_t standbys_avail = (mds_rank_t)s.size()+standby_daemon_count;
248 mds_rank_t wanted = std::max(0, standby_count_wanted);
249 return wanted > standbys_avail ? wanted - standbys_avail : 0;
250 }
251 void set_standby_count_wanted(mds_rank_t n) { standby_count_wanted = n; }
252 bool check_health(mds_rank_t standby_daemon_count);
253
254 const std::string get_balancer() const { return balancer; }
255 void set_balancer(std::string val) { balancer.assign(val); }
256
257 mds_rank_t get_tableserver() const { return tableserver; }
258 mds_rank_t get_root() const { return root; }
259
260 const std::vector<int64_t> &get_data_pools() const { return data_pools; }
261 int64_t get_first_data_pool() const { return *data_pools.begin(); }
262 int64_t get_metadata_pool() const { return metadata_pool; }
263 bool is_data_pool(int64_t poolid) const {
264 auto p = std::find(data_pools.begin(), data_pools.end(), poolid);
265 if (p == data_pools.end())
266 return false;
267 return true;
268 }
269
270 bool pool_in_use(int64_t poolid) const {
271 return get_enabled() && (is_data_pool(poolid) || metadata_pool == poolid);
272 }
273
274 const auto& get_mds_info() const { return mds_info; }
275 const auto& get_mds_info_gid(mds_gid_t gid) const {
276 return mds_info.at(gid);
277 }
278 const mds_info_t& get_mds_info(mds_rank_t m) const {
279 ceph_assert(up.count(m) && mds_info.count(up.at(m)));
280 return mds_info.at(up.at(m));
281 }
282 mds_gid_t find_mds_gid_by_name(std::string_view s) const;
283
284 // counts
285 unsigned get_num_in_mds() const {
286 return in.size();
287 }
288 unsigned get_num_up_mds() const {
289 return up.size();
290 }
291 mds_rank_t get_last_in_mds() const {
292 auto p = in.rbegin();
293 return p == in.rend() ? MDS_RANK_NONE : *p;
294 }
295 int get_num_failed_mds() const {
296 return failed.size();
297 }
298 unsigned get_num_mds(int state) const;
299 // data pools
300 void add_data_pool(int64_t poolid) {
301 data_pools.push_back(poolid);
302 }
303 int remove_data_pool(int64_t poolid) {
304 std::vector<int64_t>::iterator p = std::find(data_pools.begin(), data_pools.end(), poolid);
305 if (p == data_pools.end())
306 return -ENOENT;
307 data_pools.erase(p);
308 return 0;
309 }
310
311 // sets
312 void get_mds_set(std::set<mds_rank_t>& s) const {
313 s = in;
314 }
315 void get_up_mds_set(std::set<mds_rank_t>& s) const;
316 void get_active_mds_set(std::set<mds_rank_t>& s) const {
317 get_mds_set(s, MDSMap::STATE_ACTIVE);
318 }
319 void get_standby_replay_mds_set(std::set<mds_rank_t>& s) const {
320 get_mds_set(s, MDSMap::STATE_STANDBY_REPLAY);
321 }
322 void get_failed_mds_set(std::set<mds_rank_t>& s) const {
323 s = failed;
324 }
325
326 // features
327 uint64_t get_up_features();
328
329 /**
330 * Get MDS ranks which are in but not up.
331 */
332 void get_down_mds_set(std::set<mds_rank_t> *s) const
333 {
334 ceph_assert(s != NULL);
335 s->insert(failed.begin(), failed.end());
336 s->insert(damaged.begin(), damaged.end());
337 }
338
339 int get_failed() const {
340 if (!failed.empty()) return *failed.begin();
341 return -1;
342 }
343 void get_stopped_mds_set(std::set<mds_rank_t>& s) const {
344 s = stopped;
345 }
346 void get_recovery_mds_set(std::set<mds_rank_t>& s) const;
347
348 void get_mds_set_lower_bound(std::set<mds_rank_t>& s, DaemonState first) const;
349 void get_mds_set(std::set<mds_rank_t>& s, DaemonState state) const;
350
351 void get_health(list<pair<health_status_t,std::string> >& summary,
352 list<pair<health_status_t,std::string> > *detail) const;
353
354 void get_health_checks(health_check_map_t *checks) const;
355
356 /**
357 * Return indication of whether cluster is available. This is a
358 * heuristic for clients to see if they should bother waiting to talk to
359 * MDSs, or whether they should error out at startup/mount.
360 *
361 * A TRANSIENT_UNAVAILABLE result indicates that the cluster is in a
362 * transition state like replaying, or is potentially about the fail over.
363 * Clients should wait for an updated map before making a final decision
364 * about whether the filesystem is mountable.
365 *
366 * A STUCK_UNAVAILABLE result indicates that we can't see a way that
367 * the cluster is about to recover on its own, so it'll probably require
368 * administrator intervention: clients should probably not bother trying
369 * to mount.
370 */
371 availability_t is_cluster_available() const;
372
373 /**
374 * Return whether this MDSMap is suitable for resizing based on the state
375 * of the ranks.
376 */
377 bool is_resizeable() const {
378 return !is_degraded() &&
379 get_num_mds(CEPH_MDS_STATE_CREATING) == 0 &&
380 get_num_mds(CEPH_MDS_STATE_STARTING) == 0 &&
381 get_num_mds(CEPH_MDS_STATE_STOPPING) == 0;
382 }
383
384 // mds states
385 bool is_down(mds_rank_t m) const { return up.count(m) == 0; }
386 bool is_up(mds_rank_t m) const { return up.count(m); }
387 bool is_in(mds_rank_t m) const { return up.count(m) || failed.count(m); }
388 bool is_out(mds_rank_t m) const { return !is_in(m); }
389
390 bool is_failed(mds_rank_t m) const { return failed.count(m); }
391 bool is_stopped(mds_rank_t m) const { return stopped.count(m); }
392
393 bool is_dne(mds_rank_t m) const { return in.count(m) == 0; }
394 bool is_dne_gid(mds_gid_t gid) const { return mds_info.count(gid) == 0; }
395
396 /**
397 * Get MDS daemon status by GID
398 */
399 auto get_state_gid(mds_gid_t gid) const {
400 auto it = mds_info.find(gid);
401 if (it == mds_info.end())
402 return STATE_NULL;
403 return it->second.state;
404 }
405
406 /**
407 * Get MDS rank state if the rank is up, else STATE_NULL
408 */
409 auto get_state(mds_rank_t m) const {
410 auto it = up.find(m);
411 if (it == up.end())
412 return STATE_NULL;
413 return get_state_gid(it->second);
414 }
415
416 const auto& get_info(mds_rank_t m) const {
417 return mds_info.at(up.at(m));
418 }
419 const auto& get_info_gid(mds_gid_t gid) const {
420 return mds_info.at(gid);
421 }
422
423 bool is_boot(mds_rank_t m) const { return get_state(m) == STATE_BOOT; }
424 bool is_creating(mds_rank_t m) const { return get_state(m) == STATE_CREATING; }
425 bool is_starting(mds_rank_t m) const { return get_state(m) == STATE_STARTING; }
426 bool is_replay(mds_rank_t m) const { return get_state(m) == STATE_REPLAY; }
427 bool is_resolve(mds_rank_t m) const { return get_state(m) == STATE_RESOLVE; }
428 bool is_reconnect(mds_rank_t m) const { return get_state(m) == STATE_RECONNECT; }
429 bool is_rejoin(mds_rank_t m) const { return get_state(m) == STATE_REJOIN; }
430 bool is_clientreplay(mds_rank_t m) const { return get_state(m) == STATE_CLIENTREPLAY; }
431 bool is_active(mds_rank_t m) const { return get_state(m) == STATE_ACTIVE; }
432 bool is_stopping(mds_rank_t m) const { return get_state(m) == STATE_STOPPING; }
433 bool is_active_or_stopping(mds_rank_t m) const {
434 return is_active(m) || is_stopping(m);
435 }
436 bool is_clientreplay_or_active_or_stopping(mds_rank_t m) const {
437 return is_clientreplay(m) || is_active(m) || is_stopping(m);
438 }
439
440 mds_gid_t get_standby_replay(mds_rank_t r) const;
441 bool has_standby_replay(mds_rank_t r) const {
442 return get_standby_replay(r) != MDS_GID_NONE;
443 }
444
445 bool is_followable(mds_rank_t r) const {
446 if (auto it1 = up.find(r); it1 != up.end()) {
447 if (auto it2 = mds_info.find(it1->second); it2 != mds_info.end()) {
448 auto& info = it2->second;
449 if (!info.is_degraded() && !has_standby_replay(r)) {
450 return true;
451 }
452 }
453 }
454 return false;
455 }
456
457 bool is_laggy_gid(mds_gid_t gid) const {
458 auto it = mds_info.find(gid);
459 return it == mds_info.end() ? false : it->second.laggy();
460 }
461
462 // degraded = some recovery in process. fixes active membership and
463 // recovery_set.
464 bool is_degraded() const;
465 bool is_any_failed() const {
466 return failed.size();
467 }
468 bool is_resolving() const {
469 return
470 get_num_mds(STATE_RESOLVE) > 0 &&
471 get_num_mds(STATE_REPLAY) == 0 &&
472 failed.empty() && damaged.empty();
473 }
474 bool is_rejoining() const {
475 // nodes are rejoining cache state
476 return
477 get_num_mds(STATE_REJOIN) > 0 &&
478 get_num_mds(STATE_REPLAY) == 0 &&
479 get_num_mds(STATE_RECONNECT) == 0 &&
480 get_num_mds(STATE_RESOLVE) == 0 &&
481 failed.empty() && damaged.empty();
482 }
483 bool is_stopped() const {
484 return up.empty();
485 }
486
487 /**
488 * Get whether a rank is 'up', i.e. has
489 * an MDS daemon's entity_inst_t associated
490 * with it.
491 */
492 bool have_inst(mds_rank_t m) const {
493 return up.count(m);
494 }
495
496 /**
497 * Get the MDS daemon entity_inst_t for a rank
498 * known to be up.
499 */
500 entity_addrvec_t get_addrs(mds_rank_t m) const {
501 return mds_info.at(up.at(m)).get_addrs();
502 }
503
504 mds_rank_t get_rank_gid(mds_gid_t gid) const {
505 if (mds_info.count(gid)) {
506 return mds_info.at(gid).rank;
507 } else {
508 return MDS_RANK_NONE;
509 }
510 }
511
512 /**
513 * Get MDS rank incarnation if the rank is up, else -1
514 */
515 mds_gid_t get_incarnation(mds_rank_t m) const {
516 std::map<mds_rank_t, mds_gid_t>::const_iterator u = up.find(m);
517 if (u == up.end())
518 return MDS_GID_NONE;
519 return (mds_gid_t)get_inc_gid(u->second);
520 }
521
522 int get_inc_gid(mds_gid_t gid) const {
523 auto mds_info_entry = mds_info.find(gid);
524 if (mds_info_entry != mds_info.end())
525 return mds_info_entry->second.inc;
526 return -1;
527 }
528 void encode(bufferlist& bl, uint64_t features) const;
529 void decode(bufferlist::const_iterator& p);
530 void decode(const bufferlist& bl) {
531 auto p = bl.cbegin();
532 decode(p);
533 }
534 void sanitize(const std::function<bool(int64_t pool)>& pool_exists);
535
536 void print(ostream& out) const;
537 void print_summary(Formatter *f, ostream *out) const;
538
539 void dump(Formatter *f) const;
540 static void generate_test_instances(std::list<MDSMap*>& ls);
541
542 static bool state_transition_valid(DaemonState prev, DaemonState next);
543
544 CompatSet compat;
545 protected:
546 // base map
547 epoch_t epoch = 0;
548 bool enabled = false;
549 std::string fs_name = MDS_FS_NAME_DEFAULT;
550 uint32_t flags = CEPH_MDSMAP_DEFAULTS; // flags
551 epoch_t last_failure = 0; // mds epoch of last failure
552 epoch_t last_failure_osd_epoch = 0; // osd epoch of last failure; any mds entering replay needs
553 // at least this osdmap to ensure the blacklist propagates.
554 utime_t created;
555 utime_t modified;
556
557 mds_rank_t tableserver = 0; // which MDS has snaptable
558 mds_rank_t root = 0; // which MDS has root directory
559
560 __u32 session_timeout = 60;
561 __u32 session_autoclose = 300;
562 uint64_t max_file_size = 1ULL<<40; /* 1TB */
563
564 ceph_release_t min_compat_client{ceph_release_t::unknown};
565
566 std::vector<int64_t> data_pools; // file data pools available to clients (via an ioctl). first is the default.
567 int64_t cas_pool = -1; // where CAS objects go
568 int64_t metadata_pool = -1; // where fs metadata objects go
569
570 /*
571 * in: the set of logical mds #'s that define the cluster. this is the set
572 * of mds's the metadata may be distributed over.
573 * up: map from logical mds #'s to the addrs filling those roles.
574 * failed: subset of @in that are failed.
575 * stopped: set of nodes that have been initialized, but are not active.
576 *
577 * @up + @failed = @in. @in * @stopped = {}.
578 */
579
580 mds_rank_t max_mds = 1; /* The maximum number of active MDSes. Also, the maximum rank. */
581 mds_rank_t old_max_mds = 0; /* Value to restore when MDS cluster is marked up */
582 mds_rank_t standby_count_wanted = -1;
583 string balancer; /* The name/version of the mantle balancer (i.e. the rados obj name) */
584
585 std::set<mds_rank_t> in; // currently defined cluster
586
587 // which ranks are failed, stopped, damaged (i.e. not held by a daemon)
588 std::set<mds_rank_t> failed, stopped, damaged;
589 std::map<mds_rank_t, mds_gid_t> up; // who is in those roles
590 std::map<mds_gid_t, mds_info_t> mds_info;
591
592 uint8_t ever_allowed_features = 0; //< bitmap of features the cluster has allowed
593 uint8_t explicitly_allowed_features = 0; //< bitmap of features explicitly enabled
594
595 bool inline_data_enabled = false;
596
597 uint64_t cached_up_features = 0;
598
599 };
600 WRITE_CLASS_ENCODER_FEATURES(MDSMap::mds_info_t)
601 WRITE_CLASS_ENCODER_FEATURES(MDSMap)
602
603 inline ostream& operator<<(ostream &out, const MDSMap &m) {
604 m.print_summary(NULL, &out);
605 return out;
606 }
607
608 inline std::ostream& operator<<(std::ostream& o, const MDSMap::mds_info_t& info) {
609 info.dump(o);
610 return o;
611 }
612 #endif