If mds_forward_all_requests_to_auth is set to true. MDS will been forbidden to load noauth inode, and the auth MDS will not send other info of rep. MDS through func named set_trace_dist. so the client will only send req to auth mds of inode.
(cherry picked from commit
7d42df0)
Signed-off-by: simon gao <simon29rock@gmail.com>
Conflicts:
src/mds/MDCache.h
- There were conflicts involving definitions in master between the added
lines. The master only code was removed and the PR's changes were kept.
bool forward_all_requests_to_auth was moved to the appropriate position,
the surrounding code block in the "theirs" section was already repeated
in the file at another place.
.set_default(5)
.set_description("maximum number of scrub operations performed in parallel"),
+ Option("mds_forward_all_requests_to_auth", Option::TYPE_BOOL, Option::LEVEL_ADVANCED)
+ .set_default(false)
+ .set_flag(Option::FLAG_RUNTIME)
+ .set_description("always process op on auth mds"),
+
Option("mds_damage_table_max_entries", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(10000)
.set_description("maximum number of damage table entries"),
cache_memory_limit = g_conf().get_val<Option::size_t>("mds_cache_memory_limit");
cache_reservation = g_conf().get_val<double>("mds_cache_reservation");
cache_health_threshold = g_conf().get_val<double>("mds_health_cache_threshold");
+ forward_all_requests_to_auth = g_conf().get_val<bool>("mds_forward_all_requests_to_auth");
lru.lru_set_midpoint(g_conf().get_val<double>("mds_cache_mid"));
if (changed.count("mds_cache_trim_decay_rate")) {
trim_counter = DecayCounter(g_conf().get_val<double>("mds_cache_trim_decay_rate"));
}
+ if (changed.count("mds_forward_all_requests_to_auth")){
+ forward_all_requests_to_auth = g_conf().get_val<bool>("mds_forward_all_requests_to_auth");
+ }
migrator->handle_conf_change(changed, mdsmap);
mds->balancer->handle_conf_change(changed, mdsmap);
// dirfrag/dentry is not mine.
mds_authority_t dauth = curdir->authority();
- if (forward &&
+ if (!forward_all_requests_to_auth &&
+ forward &&
mdr && mdr->client_request &&
- (int)depth < mdr->client_request->get_num_fwd()) {
+ (int)depth < mdr->client_request->get_num_fwd()){
dout(7) << "traverse: snap " << snapid << " and depth " << depth
<< " < fwd " << mdr->client_request->get_num_fwd()
<< ", discovering instead of forwarding" << dendl;
uint64_t cache_memory_limit;
double cache_reservation;
double cache_health_threshold;
+ bool forward_all_requests_to_auth;
public:
uint64_t cache_limit_inodes(void) {
return cache_inode_limit;
}
+ bool forward_all_reqs_to_auth() const {
+ return forward_all_requests_to_auth;
+ }
uint64_t cache_limit_memory(void) {
return cache_memory_limit;
}
"mds_log_pause",
"mds_max_export_size",
"mds_max_purge_files",
+ "mds_forward_all_requests_to_auth",
"mds_max_purge_ops",
"mds_max_purge_ops_per_pg",
"mds_max_snaps_per_dir",
DirStat ds;
ds.frag = dir->get_frag();
ds.auth = dir->get_dir_auth().first;
- if (dir->is_auth())
+ if (dir->is_auth() && !mdcache->forward_all_reqs_to_auth())
dir->get_dist_spec(ds.dist, whoami);
dir->encode_dirstat(bl, session->info, ds);
DirStat ds;
ds.frag = dir->get_frag();
ds.auth = dir->get_dir_auth().first;
- if (dir->is_auth())
+ if (dir->is_auth() && !mdcache->forward_all_reqs_to_auth())
dir->get_dist_spec(ds.dist, mds->get_nodeid());
dir->encode_dirstat(dirbl, mdr->session->info, ds);