]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: handle trim() during backfill and async recovery
authorNeha Ojha <nojha@redhat.com>
Mon, 16 Jul 2018 23:31:22 +0000 (16:31 -0700)
committerNeha Ojha <nojha@redhat.com>
Mon, 16 Jul 2018 23:31:22 +0000 (16:31 -0700)
Signed-off-by: Neha Ojha <nojha@redhat.com>
src/osd/PG.cc
src/osd/PG.h
src/osd/PGLog.cc
src/osd/PGLog.h
src/osd/PrimaryLogPG.h

index c5de584a78ca2f0613b22c43a2f269957b223d61..d283f4ad66b23b98fdaced50cea4fd0d2178d558 100644 (file)
@@ -3626,7 +3626,8 @@ void PG::append_log(
   eversion_t trim_to,
   eversion_t roll_forward_to,
   ObjectStore::Transaction &t,
-  bool transaction_applied)
+  bool transaction_applied,
+  bool async)
 {
   if (transaction_applied)
     update_snap_map(logv, t);
@@ -3681,7 +3682,12 @@ void PG::append_log(
 
   dout(10) << __func__ << " approx pg log length =  "
            << pg_log.get_log().approx_size() << dendl;
-  pg_log.trim(trim_to, info);
+  dout(10) << __func__ << " transaction_applied = "
+           << transaction_applied << dendl;
+  if (!transaction_applied || async)
+    dout(10) << __func__ << " " << pg_whoami
+             << " is async_recovery or backfill target" << dendl;
+  pg_log.trim(trim_to, info, transaction_applied, async);
 
   // update the local pg, pg log
   dirty_info = true;
index c206e5a65c5952f8e4331cea0e174c4292428ff2..9a4ee13a9fba5aa853b606242d47bd4daec1ca5c 100644 (file)
@@ -2884,7 +2884,8 @@ protected:
     eversion_t trim_to,
     eversion_t roll_forward_to,
     ObjectStore::Transaction &t,
-    bool transaction_applied = true);
+    bool transaction_applied = true,
+    bool async = false);
   bool check_log_for_corruption(ObjectStore *store);
   void trim_log();
 
index d5557fc93657ab180ec2ba1abe8bc52552637356..ef9426613e660f582dabccc65d26bc91ce384f0b 100644 (file)
@@ -161,13 +161,16 @@ void PGLog::clear_info_log(
 
 void PGLog::trim(
   eversion_t trim_to,
-  pg_info_t &info)
+  pg_info_t &info,
+  bool transaction_applied,
+  bool async)
 {
   dout(10) << __func__ << " proposed trim_to = " << trim_to << dendl;
   // trim?
   if (trim_to > log.tail) {
-    // We shouldn't be trimming the log past last_complete
-    assert(trim_to <= info.last_complete);
+    // Don't assert for async_recovery_targets or backfill_targets
+    if (transaction_applied && !async)
+      assert(trim_to <= info.last_complete);
 
     dout(10) << "trim " << log << " to " << trim_to << dendl;
     log.trim(cct, trim_to, &trimmed, &trimmed_dups, &write_from_dups);
index a057814cc09669f4c849aa036c8fc91c3f6d055c..2373cdfac13896f4ff3d39e6dccdaa069c8fe965 100644 (file)
@@ -704,7 +704,9 @@ public:
 
   void trim(
     eversion_t trim_to,
-    pg_info_t &info);
+    pg_info_t &info,
+    bool transaction_applied = true,
+    bool async = false);
 
   void roll_forward_to(
     eversion_t roll_forward_to,
index 231b8b36649f77eed833810714ae10b742ad0ebc..ff09cfcd0fc7b61cb46cffce0d6f93a9b525a66a 100644 (file)
@@ -423,7 +423,7 @@ public:
     if (hset_history) {
       info.hit_set = *hset_history;
     }
-    append_log(logv, trim_to, roll_forward_to, t, transaction_applied);
+    append_log(logv, trim_to, roll_forward_to, t, transaction_applied, async);
   }
 
   void op_applied(const eversion_t &applied_version) override;