]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: set hit_set fields
authorSage Weil <sage@inktank.com>
Thu, 10 Oct 2013 22:40:29 +0000 (15:40 -0700)
committerSage Weil <sage@inktank.com>
Fri, 6 Dec 2013 22:37:27 +0000 (14:37 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
qa/workunits/cephtool/test.sh
src/mon/MonCommands.h
src/mon/OSDMonitor.cc

index f0fa37893b1b55deb937712423158eb2b5a507b1..cfa58f1e88f8ae24e53d7bb8f64015097e57ac8a 100755 (executable)
@@ -330,6 +330,14 @@ ceph osd pool set data size 2
 ceph osd pool set data hashpspool true
 ceph osd pool set data hashpspool false
 
+ceph osd pool set rbd hit_set_type explicit_hash
+ceph osd pool set rbd hit_set_type explicit_object
+ceph osd pool set rbd hit_set_type bloom
+expect_false ceph osd pool set rbd hit_set_type i_dont_exist
+ceph osd pool set rbd hit_set_period 123
+ceph osd pool set rbd hit_set_count 12
+ceph osd pool set rbd hit_set_fpp .01
+
 ceph osd pool get rbd crush_ruleset | grep 'crush_ruleset: 2'
 
 ceph osd thrash 10
index 5a6ca6a471d265dcaba4ca5f621c8990e37f2fe8..5de8810a7232b796a075d69eb93aae9acf32e953 100644 (file)
@@ -507,7 +507,7 @@ COMMAND("osd pool get " \
        "get pool parameter <var>", "osd", "r", "cli,rest")
 COMMAND("osd pool set " \
        "name=pool,type=CephPoolname " \
-       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool " \
+       "name=var,type=CephChoices,strings=size|min_size|crash_replay_interval|pg_num|pgp_num|crush_ruleset|hashpspool|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp " \
        "name=val,type=CephString", \
        "set pool parameter <var> to <val>", "osd", "rw", "cli,rest")
 // 'val' is a CephString because it can include a unit.  Perhaps
index 07775fce2bf9a58d24c66770dbbb42931418dca3..43d3acffc5aab6d1f5dc4d01825f68b4f7cb6e0e 100644 (file)
@@ -2838,6 +2838,46 @@ int OSDMonitor::prepare_command_pool_set(map<string,cmd_vartype> &cmdmap,
       return -EINVAL;
     }
     ss << " pool " << pool << " flag hashpspool";
+  } else if (var == "hit_set_type") {
+    if (val == "none")
+      p.hit_set_params = HitSet::Params();
+    else if (val == "bloom")
+      p.hit_set_params = HitSet::Params(new BloomHitSet::Params);
+    else if (val == "explicit_hash")
+      p.hit_set_params = HitSet::Params(new ExplicitHashHitSet::Params);
+    else if (val == "explicit_object")
+      p.hit_set_params = HitSet::Params(new ExplicitObjectHitSet::Params);
+    else {
+      ss << "unrecognized hit_set type '" << val << "'";
+      return -EINVAL;
+    }
+    ss << "set hit_set_type to " << p.hit_set_params;
+  } else if (var == "hit_set_period") {
+    if (interr.length()) {
+      ss << "error parsing integer value '" << val << "': " << interr;
+      return -EINVAL;
+    }
+    p.hit_set_period = n;
+    ss << "set hit_set_period to " << n;
+  } else if (var == "hit_set_count") {
+    if (interr.length()) {
+      ss << "error parsing integer value '" << val << "': " << interr;
+      return -EINVAL;
+    }
+    p.hit_set_count = n;
+    ss << "set hit_set_count to " << n;
+  } else if (var == "hit_set_fpp") {
+    if (floaterr.length()) {
+      ss << "error parsing floating point value '" << val << "': " << floaterr;
+      return -EINVAL;
+    }
+    if (p.hit_set_params.get_type() != HitSet::TYPE_BLOOM) {
+      ss << "hit set is not of type Bloom; invalid to set a false positive rate!";
+      return -EINVAL;
+    }
+    BloomHitSet::Params *bloomp = static_cast<BloomHitSet::Params*>(p.hit_set_params.impl.get());
+    bloomp->false_positive = f;
+    ss << "set hit_set_fpp to " << bloomp->false_positive;
   } else {
     ss << "unrecognized variable '" << var << "'";
     return -EINVAL;