{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/54373225","id":54373225,"diff_hunk":"@@ -234,4 +236,180 @@ struct C_MonOp : public Context\n   virtual void _finish(int r) = 0;\n };\n \n+namespace ceph {\n+  namespace features {\n+    namespace mon {\n+      static inline const char *get_feature_name(uint64_t b);\n+    }\n+  }\n+}\n+\n+\n+inline const char *ceph_mon_feature_name(uint64_t b)\n+{\n+  return ceph::features::mon::get_feature_name(b);\n+};\n+\n+class mon_feature_t {\n+\n+  static const int HEAD_VERSION = 1;\n+  static const int COMPAT_VERSION = 1;\n+\n+  // mon-specific features\n+  uint64_t features;\n+\n+public:\n+\n+  explicit constexpr\n+  mon_feature_t(const uint64_t f) : features(f) { }\n+\n+  mon_feature_t() :\n+    features(0) { }\n+\n+  constexpr\n+  mon_feature_t(const mon_feature_t &o) :\n+    features(o.features) { }\n+\n+  mon_feature_t& operator&=(const mon_feature_t other) {\n+    features &= other.features;\n+    return (*this);\n+  }\n+\n+  constexpr\n+  friend mon_feature_t operator&(const mon_feature_t a,\n+                                 const mon_feature_t b) {\n+    return mon_feature_t(a.features & b.features);\n+  }\n+\n+  mon_feature_t& operator|=(const mon_feature_t other) {\n+    features |= other.features;\n+    return (*this);\n+  }\n+\n+  constexpr\n+  friend mon_feature_t operator|(const mon_feature_t a,\n+                                 const mon_feature_t b) {\n+    return mon_feature_t(a.features | b.features);\n+  }\n+\n+  constexpr\n+  friend mon_feature_t operator^(const mon_feature_t a,\n+                                 const mon_feature_t b) {\n+    return mon_feature_t(a.features ^ b.features);\n+  }\n+\n+  mon_feature_t& operator^=(const mon_feature_t other) {\n+    features ^= other.features;\n+    return (*this);\n+  }\n+\n+  bool operator==(const mon_feature_t other) const {\n+    return (features == other.features);\n+  }\n+\n+  bool operator!=(const mon_feature_t other) const {\n+    return (features != other.features);\n+  }\n+\n+  mon_feature_t diff(const mon_feature_t other) const {\n+    return mon_feature_t((other.features ^ features) & other.features);\n+  }\n+\n+  bool contains_all(const mon_feature_t other) const {\n+    return !((other.features ^ features) & other.features);\n+  }\n+\n+  bool contains_any(const mon_feature_t f) const {\n+    return (features & f.features);\n+  }\n+\n+  void set_feature(const mon_feature_t f) {\n+    features |= f.features;\n+  }\n+\n+  void print(ostream& out) const {\n+    out << \"[\";\n+    print_bit_str(features, out, ceph::features::mon::get_feature_name);\n+    out << \"]\";\n+  }\n+\n+  void dump(Formatter *f, const char *sec_name = NULL) const {\n+    f->open_array_section((sec_name ? sec_name : \"features\"));\n+    dump_bit_str(features, f, ceph::features::mon::get_feature_name);\n+    f->close_section();\n+  }\n+\n+  void encode(bufferlist& bl) const {\n+    ENCODE_START(HEAD_VERSION, COMPAT_VERSION, bl);\n+    ::encode(features, bl);\n+    ENCODE_FINISH(bl);\n+  }\n+  void decode(bufferlist::iterator& p) {\n+    DECODE_START(COMPAT_VERSION, p);\n+    ::decode(features, p);\n+    DECODE_FINISH(p);\n+  }\n+};\n+WRITE_CLASS_ENCODER(mon_feature_t)\n+\n+namespace ceph {\n+  namespace features {\n+    namespace mon {\n+      constexpr mon_feature_t FEATURE_JEWEL(      (1ULL << 0));\n+      constexpr mon_feature_t FEATURE_RESERVED(   (1ULL << 63));\n+      constexpr mon_feature_t FEATURE_NONE(       (0ULL));\n+\n+      /**\n+       * All the features this monitor supports\n+       *\n+       * If there's a feature above, it should be OR'ed to this list.\n+       */\n+      constexpr mon_feature_t get_supported() {\n+        return (\n+            FEATURE_JEWEL |\n+            FEATURE_NONE\n+            );\n+      }\n+      /**\n+       * All the features that, once set, cannot be removed.\n+       *\n+       * Features should only be added to this list if you want to make\n+       * sure downgrades are not possible after a quorum supporting all\n+       * these features has been formed.\n+       *\n+       * Any feature in this list will be automatically set on the monmap's\n+       * features once all the monitors in the quorum support it.\n+       */\n+      constexpr mon_feature_t get_persistent() {\n+        return (\n+            FEATURE_JEWEL |\n+            FEATURE_NONE\n+            );\n+      }\n+\n+      constexpr mon_feature_t FLAG_NONE(          (0ULL));","path":"src/mon/mon_types.h","position":165,"original_position":165,"commit_id":"552b1876f0fdb13187a15b59af930bf5e87ff409","original_commit_id":"552b1876f0fdb13187a15b59af930bf5e87ff409","user":{"login":"tchaikov","id":59071,"avatar_url":"https://avatars.githubusercontent.com/u/59071?v=3","gravatar_id":"","url":"https://api.github.com/users/tchaikov","html_url":"https://github.com/tchaikov","followers_url":"https://api.github.com/users/tchaikov/followers","following_url":"https://api.github.com/users/tchaikov/following{/other_user}","gists_url":"https://api.github.com/users/tchaikov/gists{/gist_id}","starred_url":"https://api.github.com/users/tchaikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchaikov/subscriptions","organizations_url":"https://api.github.com/users/tchaikov/orgs","repos_url":"https://api.github.com/users/tchaikov/repos","events_url":"https://api.github.com/users/tchaikov/events{/privacy}","received_events_url":"https://api.github.com/users/tchaikov/received_events","type":"User","site_admin":false},"body":"can we remove `FLAG_NONE`, i think this is a leftover of `flags` before you change it to `optional_features`?","created_at":"2016-02-29T06:31:20Z","updated_at":"2016-02-29T06:31:20Z","html_url":"https://github.com/ceph/ceph/pull/7556#discussion_r54373225","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/7556","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/54373225"},"html":{"href":"https://github.com/ceph/ceph/pull/7556#discussion_r54373225"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7556"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/7556","id":58554336,"html_url":"https://github.com/ceph/ceph/pull/7556","diff_url":"https://github.com/ceph/ceph/pull/7556.diff","patch_url":"https://github.com/ceph/ceph/pull/7556.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/7556","number":7556,"state":"open","locked":false,"title":"mon: have mon-specific features","user":{"login":"jecluis","id":506918,"avatar_url":"https://avatars.githubusercontent.com/u/506918?v=3","gravatar_id":"","url":"https://api.github.com/users/jecluis","html_url":"https://github.com/jecluis","followers_url":"https://api.github.com/users/jecluis/followers","following_url":"https://api.github.com/users/jecluis/following{/other_user}","gists_url":"https://api.github.com/users/jecluis/gists{/gist_id}","starred_url":"https://api.github.com/users/jecluis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jecluis/subscriptions","organizations_url":"https://api.github.com/users/jecluis/orgs","repos_url":"https://api.github.com/users/jecluis/repos","events_url":"https://api.github.com/users/jecluis/events{/privacy}","received_events_url":"https://api.github.com/users/jecluis/received_events","type":"User","site_admin":false},"body":"UPDATE: fixed patch set according to @liewegas review. See below for highlights.\r\n\r\nThis patch set adds the following functionality to the monitors:\r\n\r\n1. have a 'features' field in the MonMap, holding the bare minimum features required\r\nby ALL the monitors in the cluster.\r\n\r\n2. we now have 'sticky' features, which will be automatically activated - and set on\r\nmonmap - once all the quorum members support them. These can not be disabled\r\nor reverted. To be used sparingly.\r\n\r\n3. have a 'flags' field in the MonMap, holding (possibly) transient features that are\r\nrequired by all monitors in the quorum.\r\n\r\n4. monitors require a given set of features to join a quorum; these will be assessed\r\nrelying on `monmap.features` and `monmap.flags`.\r\n\r\n5. any given flag can be set in `monmap.flags` once all the monitors in a quorum\r\nare able to understand said flag. These can also be unset. Setting/unsetting flags\r\nwill likely require user intervention (or some action that triggers a flag to be set/unset).\r\n\r\n`Signed-off-by: Joao Eduardo Luis <joao@suse.de>`","created_at":"2016-02-07T19:18:17Z","updated_at":"2016-02-29T06:31:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ba1c20fac079982778ef1c69a1cb787787c320cd","assignee":{"login":"liewegas","id":433031,"avatar_url":"https://avatars.githubusercontent.com/u/433031?v=3","gravatar_id":"","url":"https://api.github.com/users/liewegas","html_url":"https://github.com/liewegas","followers_url":"https://api.github.com/users/liewegas/followers","following_url":"https://api.github.com/users/liewegas/following{/other_user}","gists_url":"https://api.github.com/users/liewegas/gists{/gist_id}","starred_url":"https://api.github.com/users/liewegas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liewegas/subscriptions","organizations_url":"https://api.github.com/users/liewegas/orgs","repos_url":"https://api.github.com/users/liewegas/repos","events_url":"https://api.github.com/users/liewegas/events{/privacy}","received_events_url":"https://api.github.com/users/liewegas/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/ceph/ceph/milestones/8","html_url":"https://github.com/ceph/ceph/milestones/jewel","labels_url":"https://api.github.com/repos/ceph/ceph/milestones/8/labels","id":1403256,"number":8,"title":"jewel","description":"","creator":{"login":"dillaman","id":4739042,"avatar_url":"https://avatars.githubusercontent.com/u/4739042?v=3","gravatar_id":"","url":"https://api.github.com/users/dillaman","html_url":"https://github.com/dillaman","followers_url":"https://api.github.com/users/dillaman/followers","following_url":"https://api.github.com/users/dillaman/following{/other_user}","gists_url":"https://api.github.com/users/dillaman/gists{/gist_id}","starred_url":"https://api.github.com/users/dillaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dillaman/subscriptions","organizations_url":"https://api.github.com/users/dillaman/orgs","repos_url":"https://api.github.com/users/dillaman/repos","events_url":"https://api.github.com/users/dillaman/events{/privacy}","received_events_url":"https://api.github.com/users/dillaman/received_events","type":"User","site_admin":false},"open_issues":32,"closed_issues":23,"state":"open","created_at":"2015-11-09T22:29:48Z","updated_at":"2016-02-27T14:41:07Z","due_on":"2016-03-20T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/7556/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/7556/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/7556/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/552b1876f0fdb13187a15b59af930bf5e87ff409","head":{"label":"jecluis:wip-mon-features","ref":"wip-mon-features","sha":"552b1876f0fdb13187a15b59af930bf5e87ff409","user":{"login":"jecluis","id":506918,"avatar_url":"https://avatars.githubusercontent.com/u/506918?v=3","gravatar_id":"","url":"https://api.github.com/users/jecluis","html_url":"https://github.com/jecluis","followers_url":"https://api.github.com/users/jecluis/followers","following_url":"https://api.github.com/users/jecluis/following{/other_user}","gists_url":"https://api.github.com/users/jecluis/gists{/gist_id}","starred_url":"https://api.github.com/users/jecluis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jecluis/subscriptions","organizations_url":"https://api.github.com/users/jecluis/orgs","repos_url":"https://api.github.com/users/jecluis/repos","events_url":"https://api.github.com/users/jecluis/events{/privacy}","received_events_url":"https://api.github.com/users/jecluis/received_events","type":"User","site_admin":false},"repo":{"id":3147781,"name":"ceph","full_name":"jecluis/ceph","owner":{"login":"jecluis","id":506918,"avatar_url":"https://avatars.githubusercontent.com/u/506918?v=3","gravatar_id":"","url":"https://api.github.com/users/jecluis","html_url":"https://github.com/jecluis","followers_url":"https://api.github.com/users/jecluis/followers","following_url":"https://api.github.com/users/jecluis/following{/other_user}","gists_url":"https://api.github.com/users/jecluis/gists{/gist_id}","starred_url":"https://api.github.com/users/jecluis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jecluis/subscriptions","organizations_url":"https://api.github.com/users/jecluis/orgs","repos_url":"https://api.github.com/users/jecluis/repos","events_url":"https://api.github.com/users/jecluis/events{/privacy}","received_events_url":"https://api.github.com/users/jecluis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jecluis/ceph","description":"Ceph distributed file system","fork":true,"url":"https://api.github.com/repos/jecluis/ceph","forks_url":"https://api.github.com/repos/jecluis/ceph/forks","keys_url":"https://api.github.com/repos/jecluis/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jecluis/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jecluis/ceph/teams","hooks_url":"https://api.github.com/repos/jecluis/ceph/hooks","issue_events_url":"https://api.github.com/repos/jecluis/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/jecluis/ceph/events","assignees_url":"https://api.github.com/repos/jecluis/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/jecluis/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/jecluis/ceph/tags","blobs_url":"https://api.github.com/repos/jecluis/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jecluis/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jecluis/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/jecluis/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jecluis/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/jecluis/ceph/languages","stargazers_url":"https://api.github.com/repos/jecluis/ceph/stargazers","contributors_url":"https://api.github.com/repos/jecluis/ceph/contributors","subscribers_url":"https://api.github.com/repos/jecluis/ceph/subscribers","subscription_url":"https://api.github.com/repos/jecluis/ceph/subscription","commits_url":"https://api.github.com/repos/jecluis/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/jecluis/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/jecluis/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/jecluis/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/jecluis/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/jecluis/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jecluis/ceph/merges","archive_url":"https://api.github.com/repos/jecluis/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jecluis/ceph/downloads","issues_url":"https://api.github.com/repos/jecluis/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/jecluis/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/jecluis/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/jecluis/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jecluis/ceph/labels{/name}","releases_url":"https://api.github.com/repos/jecluis/ceph/releases{/id}","deployments_url":"https://api.github.com/repos/jecluis/ceph/deployments","created_at":"2012-01-10T19:15:04Z","updated_at":"2015-09-09T17:42:07Z","pushed_at":"2016-02-15T22:21:25Z","git_url":"git://github.com/jecluis/ceph.git","ssh_url":"git@github.com:jecluis/ceph.git","clone_url":"https://github.com/jecluis/ceph.git","svn_url":"https://github.com/jecluis/ceph","homepage":"http://ceph.newdream.net/","size":134819,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"ceph:master","ref":"master","sha":"bdb035ceff866497c56b71c9f61a7ac13264954f","user":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"repo":{"id":2310495,"name":"ceph","full_name":"ceph/ceph","owner":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ceph/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":false,"url":"https://api.github.com/repos/ceph/ceph","forks_url":"https://api.github.com/repos/ceph/ceph/forks","keys_url":"https://api.github.com/repos/ceph/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceph/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceph/ceph/teams","hooks_url":"https://api.github.com/repos/ceph/ceph/hooks","issue_events_url":"https://api.github.com/repos/ceph/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/ceph/ceph/events","assignees_url":"https://api.github.com/repos/ceph/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/ceph/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/ceph/ceph/tags","blobs_url":"https://api.github.com/repos/ceph/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceph/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceph/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceph/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/ceph/ceph/languages","stargazers_url":"https://api.github.com/repos/ceph/ceph/stargazers","contributors_url":"https://api.github.com/repos/ceph/ceph/contributors","subscribers_url":"https://api.github.com/repos/ceph/ceph/subscribers","subscription_url":"https://api.github.com/repos/ceph/ceph/subscription","commits_url":"https://api.github.com/repos/ceph/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceph/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceph/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceph/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceph/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/ceph/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceph/ceph/merges","archive_url":"https://api.github.com/repos/ceph/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceph/ceph/downloads","issues_url":"https://api.github.com/repos/ceph/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/ceph/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/ceph/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/ceph/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceph/ceph/labels{/name}","releases_url":"https://api.github.com/repos/ceph/ceph/releases{/id}","deployments_url":"https://api.github.com/repos/ceph/ceph/deployments","created_at":"2011-09-01T21:41:26Z","updated_at":"2016-02-29T05:33:24Z","pushed_at":"2016-02-29T06:05:11Z","git_url":"git://github.com/ceph/ceph.git","ssh_url":"git@github.com:ceph/ceph.git","clone_url":"https://github.com/ceph/ceph.git","svn_url":"https://github.com/ceph/ceph","homepage":"http://ceph.com","size":186540,"stargazers_count":1908,"watchers_count":1908,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1152,"mirror_url":null,"open_issues_count":252,"forks":1152,"open_issues":252,"watchers":1908,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7556"},"html":{"href":"https://github.com/ceph/ceph/pull/7556"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/7556"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/7556/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7556/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/7556/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/552b1876f0fdb13187a15b59af930bf5e87ff409"}}}}