]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
PGLog: ignore error entries when constructing the missing set
authorJosh Durgin <jdurgin@redhat.com>
Mon, 6 Jun 2016 22:51:28 +0000 (15:51 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Sat, 9 Jul 2016 01:33:13 +0000 (18:33 -0700)
Errors should only be used for dup detection.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/osd/PG.cc
src/osd/PGLog.cc
src/osd/osd_types.cc
src/test/osd/types.cc

index 9f4136f56667f00b7a40bd04a218153ef77b6a3a..e4eb1bcbead451b2b6aff6be55c08618eb6e57d2 100644 (file)
@@ -3180,7 +3180,7 @@ void PG::update_snap_map(
          i->soid,
          &_t);
        assert(r == 0);
-      } else {
+      } else if (i->is_update()) {
        assert(i->snaps.length() > 0);
        vector<snapid_t> snaps;
        bufferlist snapbl = i->snaps;
index 551638d6135cc8c92c2b296adf65be94f9c7aadf..140d19ea2fff12c3e5188eaa9acbe3ab66aaa474 100644 (file)
@@ -589,7 +589,8 @@ void PGLog::append_log_entries_update_missing(
       ldpp_dout(dpp, 20) << "update missing, append " << ne << dendl;
       log->index(ne);
     }
-    if (cmp(p->soid, last_backfill, last_backfill_bitwise) <= 0) {
+    if (cmp(p->soid, last_backfill, last_backfill_bitwise) <= 0 &&
+       !p->is_error()) {
       missing.add_next_event(*p);
       if (rollbacker) {
        // hack to match PG::mark_all_unfound_lost
@@ -992,6 +993,8 @@ void PGLog::read_log(ObjectStore *store, coll_t pg_coll,
       if (i->version <= info.last_complete) break;
       if (cmp(i->soid, info.last_backfill, info.last_backfill_bitwise) > 0)
        continue;
+      if (i->is_error())
+       continue;
       if (did.count(i->soid)) continue;
       did.insert(i->soid);
       
index 02ce45b289a4923aab1d4ad9f1327e6f533a8d97..90b46a3202fd51315530d9a7107a39dd73247ccf 100644 (file)
@@ -3921,8 +3921,9 @@ void pg_missing_t::add_next_event(const pg_log_entry_t& e)
       missing[e.soid] = item(e.version, e.prior_version);
     }
     rmissing[e.version.version] = e.soid;
-  } else
+  } else if (e.is_delete()) {
     rm(e.soid, e.version);
+  }
 }
 
 void pg_missing_t::revise_need(hobject_t oid, eversion_t need)
index be39e57c8c6000605d1345a033871ecfec189f0c..e075592f516df32b77527f6dc2cba23586713204 100644 (file)
@@ -940,6 +940,26 @@ TEST(pg_missing_t, add_next_event)
     EXPECT_FALSE(missing.is_missing(oid));
     EXPECT_TRUE(e.reqid_is_indexed());
   }
+
+  // ERROR op should not affect previous entries
+  {
+    pg_missing_t missing;
+    pg_log_entry_t modify = sample_e;
+
+    modify.op = pg_log_entry_t::MODIFY;
+    EXPECT_FALSE(missing.is_missing(oid));
+    missing.add_next_event(modify);
+    EXPECT_TRUE(missing.is_missing(oid));
+    EXPECT_EQ(missing.missing[oid].need, version);
+
+    pg_log_entry_t error = sample_e;
+    error.op = pg_log_entry_t::ERROR;
+    error.return_code = -ENOENT;
+    error.version = eversion_t(11, 5);
+    missing.add_next_event(error);
+    EXPECT_TRUE(missing.is_missing(oid));
+    EXPECT_EQ(missing.missing[oid].need, version);
+  }
 }
 
 TEST(pg_missing_t, revise_need)