]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: data/bilog trimming tracks min markers as strings
authorCasey Bodley <cbodley@redhat.com>
Thu, 25 Apr 2019 13:58:31 +0000 (09:58 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 18 Oct 2019 19:34:13 +0000 (15:34 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit f758f7c133135a14cd28a12f3860195ce58c1351)

Conflicts:
src/rgw/rgw_trim_datalog.cc moved from rgw_data_sync.cc

src/rgw/rgw_data_sync.cc

index 4c1cc9f68e53156649ec63a5a7e3c569093a60fa..bd6c4b50a47fea89cf743de434d531c32ef8b4a3 100644 (file)
@@ -3545,14 +3545,6 @@ const std::string& get_stable_marker(const rgw_data_sync_marker& m)
   return m.state == m.FullSync ? m.next_step_marker : m.marker;
 }
 
-/// comparison operator for take_min_markers()
-bool operator<(const rgw_data_sync_marker& lhs,
-               const rgw_data_sync_marker& rhs)
-{
-  // sort by stable marker
-  return get_stable_marker(lhs) < get_stable_marker(rhs);
-}
-
 /// populate the container starting with 'dest' with the minimum stable marker
 /// of each shard for all of the peers in [first, last)
 template <typename IterIn, typename IterOut>
@@ -3561,18 +3553,12 @@ void take_min_markers(IterIn first, IterIn last, IterOut dest)
   if (first == last) {
     return;
   }
-  // initialize markers with the first peer's
-  auto m = dest;
-  for (auto &shard : first->sync_markers) {
-    *m = std::move(shard.second);
-    ++m;
-  }
-  // for remaining peers, replace with smaller markers
-  for (auto p = first + 1; p != last; ++p) {
-    m = dest;
+  for (auto p = first; p != last; ++p) {
+    auto m = dest;
     for (auto &shard : p->sync_markers) {
-      if (shard.second < *m) {
-        *m = std::move(shard.second);
+      const auto& stable = get_stable_marker(shard.second);
+      if (*m > stable) {
+        *m = stable;
       }
       ++m;
     }
@@ -3587,7 +3573,7 @@ class DataLogTrimCR : public RGWCoroutine {
   const int num_shards;
   const std::string& zone_id; //< my zone id
   std::vector<rgw_data_sync_status> peer_status; //< sync status for each peer
-  std::vector<rgw_data_sync_marker> min_shard_markers; //< min marker per shard
+  std::vector<std::string> min_shard_markers; //< min marker per shard
   std::vector<std::string>& last_trim; //< last trimmed marker per shard
   int ret{0};
 
@@ -3651,16 +3637,15 @@ int DataLogTrimCR::operate()
 
       for (int i = 0; i < num_shards; i++) {
         const auto& m = min_shard_markers[i];
-        auto& stable = get_stable_marker(m);
-        if (stable <= last_trim[i]) {
+        if (m <= last_trim[i]) {
           continue;
         }
         ldout(cct, 10) << "trimming log shard " << i
-            << " at marker=" << stable
+            << " at marker=" << m
             << " last_trim=" << last_trim[i] << dendl;
         using TrimCR = RGWSyncLogTrimCR;
         spawn(new TrimCR(store, store->data_log->get_oid(i),
-                         stable, &last_trim[i]),
+                         m, &last_trim[i]),
               true);
       }
     }