From: Josh Durgin Date: Mon, 6 Jun 2016 22:51:28 +0000 (-0700) Subject: PGLog: ignore error entries when constructing the missing set X-Git-Tag: ses5-milestone5~413^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ea66e5ca4d0335b439b4c2b37bc370131537613e;p=ceph.git PGLog: ignore error entries when constructing the missing set Errors should only be used for dup detection. Signed-off-by: Josh Durgin --- diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 9f4136f5666..e4eb1bcbead 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -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 snaps; bufferlist snapbl = i->snaps; diff --git a/src/osd/PGLog.cc b/src/osd/PGLog.cc index 551638d6135..140d19ea2ff 100644 --- a/src/osd/PGLog.cc +++ b/src/osd/PGLog.cc @@ -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); diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 02ce45b289a..90b46a3202f 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -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) diff --git a/src/test/osd/types.cc b/src/test/osd/types.cc index be39e57c8c6..e075592f516 100644 --- a/src/test/osd/types.cc +++ b/src/test/osd/types.cc @@ -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)