.set_description("allow ephemeral random pinning of the loaded subtrees")
.set_long_description("probabilistically pin the loaded directory inode and the subtree beneath it to an MDS based on the consistent hash of the inode number. The higher this value the more likely the loaded subtrees get pinned"),
+ Option("mds_export_ephemeral_random_max", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
+ .set_default(0.01)
+ .set_flag(Option::FLAG_RUNTIME)
+ .set_description("the maximum percent permitted for random ephemeral pin policy")
+ .set_min_max(0.0, 1.0)
+ .add_see_also("mds_export_ephemeral_random"),
+
Option("mds_export_ephemeral_distributed", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
.set_default(false)
.set_flag(Option::FLAG_RUNTIME)
* have a parent yet.
*/
const CInode *in = this;
+ double max = mdcache->export_ephemeral_random_max;
while (true) {
if (in->is_system())
break;
break;
if (in->get_inode().export_ephemeral_random_pin > 0.0)
- return in->get_inode().export_ephemeral_random_pin;
+ return std::min(in->get_inode().export_ephemeral_random_pin, max);
/* An export_pin overrides only if no closer parent (incl. this one) has a
* random pin set.
export_ephemeral_distributed_config = g_conf().get_val<bool>("mds_export_ephemeral_distributed");
export_ephemeral_random_config = g_conf().get_val<bool>("mds_export_ephemeral_random");
+ export_ephemeral_random_max = g_conf().get_val<double>("mds_export_ephemeral_random_max");
lru.lru_set_midpoint(g_conf().get_val<double>("mds_cache_mid"));
}
mds->balancer->handle_export_pins();
}
+ if (changed.count("mds_export_ephemeral_random_max")) {
+ export_ephemeral_random_max = g_conf().get_val<double>("mds_export_ephemeral_random_max");
+ }
if (changed.count("mds_health_cache_threshold"))
cache_health_threshold = g_conf().get_val<double>("mds_health_cache_threshold");
if (changed.count("mds_cache_mid"))
OpenFileTable open_file_table;
+ double export_ephemeral_random_max = 0.0;
+
protected:
// track master requests whose slaves haven't acknowledged commit
struct umaster {
"mds_dump_cache_threshold_formatter",
"mds_enable_op_tracker",
"mds_export_ephemeral_random",
+ "mds_export_ephemeral_random_max",
"mds_export_ephemeral_distributed",
"mds_health_cache_threshold",
"mds_inject_migrator_session_race",
return;
}
+ if (val < 0.0 || 1.0 < val) {
+ respond_to_request(mdr, -EDOM);
+ return;
+ } else if (mdcache->export_ephemeral_random_max < val) {
+ respond_to_request(mdr, -EINVAL);
+ return;
+ }
+
if (!xlock_policylock(mdr, cur))
return;