]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/sync: add a BidManager to metadata sync
authorCasey Bodley <cbodley@redhat.com>
Mon, 5 Dec 2022 22:40:10 +0000 (17:40 -0500)
committerShilpa Jagannath <smanjara@redhat.com>
Wed, 10 May 2023 15:24:22 +0000 (11:24 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/driver/rados/rgw_sync.cc
src/rgw/driver/rados/rgw_sync.h

index d0ec90796d91920237313ae006738e2caee21ef2..9b1eb18a828bdd938a933976409eb92fc4de2fe4 100644 (file)
@@ -23,6 +23,8 @@ static string mdlog_sync_status_oid = "mdlog.sync-status";
 static string mdlog_sync_status_shard_prefix = "mdlog.sync-status.shard";
 static string mdlog_sync_full_sync_index_prefix = "meta.full-sync.index";
 
+static const string meta_sync_bids_oid = "meta-sync-bids";
+
 RGWContinuousLeaseCR::~RGWContinuousLeaseCR() {}
 
 RGWSyncErrorLogger::RGWSyncErrorLogger(rgw::sal::RadosStore* _store, const string &oid_prefix, int _num_shards) : store(_store), num_shards(_num_shards) {
@@ -2233,6 +2235,18 @@ int RGWRemoteMetaLog::run_sync(const DoutPrefixProvider *dpp, optional_yield y)
     return -EINVAL;
   }
 
+  // construct and start the bid manager for sync fairness
+  const auto& control_pool = store->svc()->zone->get_zone_params().control_pool;
+  auto control_obj = rgw_raw_obj{control_pool, meta_sync_bids_oid};
+
+  auto bid_manager = rgw::sync_fairness::create_rados_bid_manager(
+      store, control_obj, num_shards);
+  r = bid_manager->start();
+  if (r < 0) {
+    return r;
+  }
+  sync_env.bid_manager = bid_manager.get();
+
   RGWPeriodHistory::Cursor cursor;
   do {
     r = run(dpp, new RGWReadSyncStatusCoroutine(&sync_env, &sync_status));
index e6c255cc60145eabac23342094d7f15f90225503..f0ee28056afa73e902418f1bb82178a376c8e31c 100644 (file)
@@ -15,6 +15,7 @@
 #include "rgw_sal_rados.h"
 #include "rgw_sync_trace.h"
 #include "rgw_mdlog.h"
+#include "sync_fairness.h"
 
 #define ERROR_LOGGER_SHARDS 32
 #define RGW_SYNC_ERROR_LOG_SHARD_PREFIX "sync.error-log"
@@ -180,6 +181,7 @@ struct RGWMetaSyncEnv {
   RGWHTTPManager *http_manager{nullptr};
   RGWSyncErrorLogger *error_logger{nullptr};
   RGWSyncTraceManager *sync_tracer{nullptr};
+  rgw::sync_fairness::BidManager* bid_manager{nullptr};
 
   RGWMetaSyncEnv() {}
 
@@ -224,7 +226,7 @@ public:
       http_manager(store->ctx(), completion_mgr),
       status_manager(_sm) {}
 
-  virtual ~RGWRemoteMetaLog() override;
+  ~RGWRemoteMetaLog() override;
 
   int init();
   void finish();