]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: make per-OSD no{out,down,in,out} flags prior to CRUSH nodes
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 Apr 2019 03:03:04 +0000 (11:03 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 24 Apr 2019 01:08:27 +0000 (09:08 +0800)
This way we 'll be more compatible with older versions, and can effectively
reduce the map size for large clusters.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
(cherry picked from commit 01916b99c3a8cb58686963e6167bd46c0d24f218)

src/mon/OSDMonitor.cc

index 74e27a8bbdc7d2c88a5fe7c35fca21d6508615fb..88693b09ad2f067d720c7b7a186da6b2bfcc7cb4 100644 (file)
@@ -10560,11 +10560,11 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
         osdmap.get_all_osds(osds);
         stop = true;
       } else {
-       if (osdmap.crush->name_exists(idvec[j])) {
+        if (long osd = parse_osd_id(idvec[j].c_str(), &ss); osd >= 0) {
+          osds.insert(osd);
+       } else if (osdmap.crush->name_exists(idvec[j])) {
+          std::stringstream().swap(ss);
          crush_nodes.insert(osdmap.crush->get_item_id(idvec[j]));
-       } else if (long osd = parse_osd_id(idvec[j].c_str(), &ss);
-                  osd >= 0) {
-         osds.insert(osd);
        } else {
          // ss has reason for failure
          ss << ", unable to parse osd id or crush node:\"" << idvec[j]
@@ -10754,11 +10754,11 @@ bool OSDMonitor::prepare_command_impl(MonOpRequestRef op,
 
         stop = true;
       } else {
-       if (osdmap.crush->name_exists(idvec[j])) {
-         crush_nodes.insert(osdmap.crush->get_item_id(idvec[j]));
-       } else if (long osd = parse_osd_id(idvec[j].c_str(), &ss);
-                  osd >= 0) {
+       if (long osd = parse_osd_id(idvec[j].c_str(), &ss); osd >= 0) {
          osds.push_back(osd);
+        } else if (osdmap.crush->name_exists(idvec[j])) {
+          std::stringstream().swap(ss);
+          crush_nodes.insert(osdmap.crush->get_item_id(idvec[j]));
        } else {
          // ss has reason for failure
          ss << ", unable to parse osd id or crush node:\"" << idvec[j]