]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: move all reshard config options out of legacy_config_options
authorJ. Eric Ivancich <ivancich@redhat.com>
Fri, 30 Nov 2018 19:35:28 +0000 (14:35 -0500)
committerJ. Eric Ivancich <ivancich@redhat.com>
Mon, 3 Dec 2018 19:23:34 +0000 (14:23 -0500)
With commit b713bb77a1d some rgw reshard config options were updated,
but corresponding changes were not made to
legacy_config_options. Since accesses to these config options were
mixed (both modern and legacy) it led to some inconsistencies. So we
remove the legacy options and made sure all accesses uses the modern
convention/coding.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
src/common/legacy_config_opts.h
src/common/options.cc
src/rgw/librgw.cc
src/rgw/rgw_admin.cc
src/rgw/rgw_main.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_realm_reloader.cc
src/rgw/rgw_reshard.cc

index 2ee8f85936c8d76e1530d4e13b4c25664f572eee..27f831882dff1dd262c42723385be29c980eed5d 100644 (file)
@@ -1537,13 +1537,6 @@ OPTION(rgw_swift_custom_header, OPT_STR) // option to enable swift custom header
 
 OPTION(rgw_swift_need_stats, OPT_BOOL) // option to enable stats on bucket listing for swift
 
-/* resharding tunables */
-OPTION(rgw_reshard_num_logs, OPT_INT)
-OPTION(rgw_reshard_bucket_lock_duration, OPT_INT) // duration of lock on bucket obj during resharding
-OPTION(rgw_dynamic_resharding, OPT_BOOL)
-OPTION(rgw_max_objs_per_shard, OPT_INT)
-OPTION(rgw_reshard_thread_interval, OPT_U32) // maximum time between rounds of reshard thread processing
-
 OPTION(rgw_acl_grants_max_num, OPT_INT) // According to AWS S3(http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html), An ACL can have up to 100 grants.
 OPTION(rgw_cors_rules_max_num, OPT_INT) // According to AWS S3(http://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html), An cors can have up to 100 rules.
 OPTION(rgw_delete_multi_obj_max_num, OPT_INT) // According to AWS S3(https://docs.aws.amazon.com/AmazonS3/latest/dev/DeletingObjects.html), Amazon S3 also provides the Multi-Object Delete API that you can use to delete up to 1000 objects in a single HTTP request.
index 2ed6e83f71b0ffcdd252b960ca4cbdc581ed473b..f6aed53705fa8808d60036d337572d07452eebd6 100644 (file)
@@ -6375,7 +6375,7 @@ std::vector<Option> get_rgw_options() {
         "a high number of objects per shard.")
     .add_see_also("rgw_max_objs_per_shard"),
 
-    Option("rgw_max_objs_per_shard", Option::TYPE_INT, Option::LEVEL_BASIC)
+    Option("rgw_max_objs_per_shard", Option::TYPE_UINT, Option::LEVEL_BASIC)
     .set_default(100000)
     .set_description("Max objects per shard for dynamic resharding")
     .set_long_description(
index dc01a91c38c1b90f4c07a24a93cbf26cf7f98c8e..6181893bffcab6768f4f3b306b5915f9075c1408 100644 (file)
@@ -499,7 +499,7 @@ namespace rgw {
                                         g_conf()->rgw_enable_lc_threads,
                                         g_conf()->rgw_enable_quota_threads,
                                         g_conf()->rgw_run_sync_thread,
-                                        g_conf()->rgw_dynamic_resharding);
+                                        g_conf().get_val<bool>("rgw_dynamic_resharding"));
 
     if (!store) {
       mutex.Lock();
index 80ec4908bf43d550afbca1554381d20479857324..5859168ff9529a98a16a1d6900d3b11dfa1de2e5 100644 (file)
@@ -6106,7 +6106,8 @@ next:
       max_entries = 1000;
     }
 
-    int num_logshards = store->ctx()->_conf->rgw_reshard_num_logs;
+    int num_logshards =
+      store->ctx()->_conf.get_val<uint64_t>("rgw_reshard_num_logs");
 
     RGWReshard reshard(store);
 
@@ -6196,11 +6197,13 @@ next:
     int ret = br.cancel();
     if (ret < 0) {
       if (ret == -EBUSY) {
-       cerr << "There is ongoing resharding, please retry after " << g_conf()->rgw_reshard_bucket_lock_duration <<
-            " seconds " << std::endl;
+       cerr << "There is ongoing resharding, please retry after " <<
+         store->ctx()->_conf.get_val<uint64_t>(
+           "rgw_reshard_bucket_lock_duration") <<
+         " seconds " << std::endl;
       } else {
-       cerr << "Error canceling bucket " << bucket_name << " resharding: " << cpp_strerror(-ret) <<
-         std::endl;
+       cerr << "Error canceling bucket " << bucket_name <<
+         " resharding: " << cpp_strerror(-ret) << std::endl;
       }
       return ret;
     }
index 3aa9cd8bf3c50e3c7e01a6010304de13c541e907..9b5cd73d3ce0ff49292a83f4b66bc76392ade3be 100644 (file)
@@ -298,9 +298,14 @@ int main(int argc, const char **argv)
   FCGX_Init();
 #endif
 
-  RGWRados *store = RGWStoreManager::get_storage(g_ceph_context,
-      g_conf()->rgw_enable_gc_threads, g_conf()->rgw_enable_lc_threads, g_conf()->rgw_enable_quota_threads,
-      g_conf()->rgw_run_sync_thread, g_conf()->rgw_dynamic_resharding, g_conf()->rgw_cache_enabled);
+  RGWRados *store =
+    RGWStoreManager::get_storage(g_ceph_context,
+                                g_conf()->rgw_enable_gc_threads,
+                                g_conf()->rgw_enable_lc_threads,
+                                g_conf()->rgw_enable_quota_threads,
+                                g_conf()->rgw_run_sync_thread,
+                                g_conf().get_val<bool>("rgw_dynamic_resharding"),
+                                g_conf()->rgw_cache_enabled);
   if (!store) {
     mutex.Lock();
     init_timer.cancel_all_events();
index 93ce2247ee4358b668d3a87d413c5cc8b270df05..4492f80e9ec49490a63b6e57060e31a60c22238c 100644 (file)
@@ -9637,7 +9637,7 @@ int RGWRados::cls_user_remove_bucket(rgw_raw_obj& obj, const cls_user_bucket& bu
 int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info, const rgw_bucket& bucket,
                                  RGWQuotaInfo& bucket_quota)
 {
-  if (!cct->_conf->rgw_dynamic_resharding) {
+  if (! cct->_conf.get_val<bool>("rgw_dynamic_resharding")) {
       return 0;
   }
 
@@ -9645,9 +9645,12 @@ int RGWRados::check_bucket_shards(const RGWBucketInfo& bucket_info, const rgw_bu
   int num_source_shards = (bucket_info.num_shards > 0 ? bucket_info.num_shards : 1);
   uint32_t suggested_num_shards;
 
-  int ret =  quota_handler->check_bucket_shards((uint64_t)cct->_conf->rgw_max_objs_per_shard,
-                                               num_source_shards,  bucket_info.owner, bucket, bucket_quota,
-                                               1, need_resharding, &suggested_num_shards);
+  const uint64_t max_objs_per_shard =
+    cct->_conf.get_val<uint64_t>("rgw_max_objs_per_shard");
+  int ret =
+    quota_handler->check_bucket_shards(max_objs_per_shard, num_source_shards,
+                                      bucket_info.owner, bucket, bucket_quota,
+                                      1, need_resharding, &suggested_num_shards);
   if (ret < 0) {
     return ret;
   }
index e269ba138b12f0350ca2b0b537e5b00770c5f214..1fd48db0a53f2b92b8fb53d71762e3ade899da67 100644 (file)
@@ -102,14 +102,14 @@ void RGWRealmReloader::reload()
 
   while (!store) {
     // recreate and initialize a new store
-    store = RGWStoreManager::get_storage(cct,
-                                         cct->_conf->rgw_enable_gc_threads,
-                                         cct->_conf->rgw_enable_lc_threads,
-                                         cct->_conf->rgw_enable_quota_threads,
-                                         cct->_conf->rgw_run_sync_thread,
-                                         cct->_conf->rgw_dynamic_resharding,
-                                        cct->_conf->rgw_cache_enabled
-      );
+    store =
+      RGWStoreManager::get_storage(cct,
+                                  cct->_conf->rgw_enable_gc_threads,
+                                  cct->_conf->rgw_enable_lc_threads,
+                                  cct->_conf->rgw_enable_quota_threads,
+                                  cct->_conf->rgw_run_sync_thread,
+                                  cct->_conf.get_val<bool>("rgw_dynamic_resharding"),
+                                  cct->_conf->rgw_cache_enabled);
 
     ldout(cct, 1) << "Creating new store" << dendl;
 
index 955ee536d3c239c7138579ea488c07f96d5e09c9..23df3d796d206e6f110df3206fc13874b04c4480 100644 (file)
@@ -725,10 +725,11 @@ RGWReshard::RGWReshard(RGWRados* _store, bool _verbose, ostream *_out,
   store(_store), instance_lock(bucket_instance_lock_name),
   verbose(_verbose), out(_out), formatter(_formatter)
 {
-  num_logshards = store->ctx()->_conf->rgw_reshard_num_logs;
+  num_logshards = store->ctx()->_conf.get_val<uint64_t>("rgw_reshard_num_logs");
 }
 
-string RGWReshard::get_logshard_key(const string& tenant, const string& bucket_name)
+string RGWReshard::get_logshard_key(const string& tenant,
+                                   const string& bucket_name)
 {
   return tenant + ":" + bucket_name;
 }