From: Josh Durgin Date: Thu, 20 Jul 2017 20:27:24 +0000 (-0400) Subject: osd/PGLog: force write of may_include_deletes after split X-Git-Tag: v12.1.2~185^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2effa0fbe341146a10c9813edc5aa306880ffb62;p=ceph.git osd/PGLog: force write of may_include_deletes after split When a collection is split this needs to be persisted again. Normally this is only persisted when the missing set is rebuilt during a new interval when it previous did not include deletes, but during split we keep the in-memory missing set may_include_deletes flag, but do not rebuild the missing set. Fixes: http://tracker.ceph.com/issues/20704 Signed-off-by: Josh Durgin --- diff --git a/src/osd/PGLog.h b/src/osd/PGLog.h index d910bc7f56ad..089d4454a894 100644 --- a/src/osd/PGLog.h +++ b/src/osd/PGLog.h @@ -526,6 +526,9 @@ public: mark_dirty_from(eversion_t()); touched_log = false; } + bool get_rebuilt_missing_with_deletes() const { + return rebuilt_missing_with_deletes; + } protected: /// DEBUG @@ -652,6 +655,8 @@ public: missing.split_into(child_pgid, split_bits, &(opg_log->missing)); opg_log->mark_dirty_to(eversion_t::max()); mark_dirty_to(eversion_t::max()); + if (missing.may_include_deletes) + opg_log->rebuilt_missing_with_deletes = true; } void recover_got(hobject_t oid, eversion_t v, pg_info_t &info) { diff --git a/src/test/osd/TestPGLog.cc b/src/test/osd/TestPGLog.cc index 1a527db5de50..182eb425492b 100644 --- a/src/test/osd/TestPGLog.cc +++ b/src/test/osd/TestPGLog.cc @@ -2244,6 +2244,30 @@ TEST_F(PGLogTest, ErrorNotIndexedByObject) { EXPECT_EQ(del.reqid, entry->reqid); } +TEST_F(PGLogTest, split_into_preserves_may_include_deletes) { + clear(); + + { + rebuilt_missing_with_deletes = false; + missing.may_include_deletes = true; + PGLog child_log(cct, prefix_provider); + pg_t child_pg; + split_into(child_pg, 6, &child_log); + ASSERT_TRUE(child_log.get_missing().may_include_deletes); + ASSERT_TRUE(child_log.get_rebuilt_missing_with_deletes()); + } + + { + rebuilt_missing_with_deletes = false; + missing.may_include_deletes = false; + PGLog child_log(cct, prefix_provider); + pg_t child_pg; + split_into(child_pg, 6, &child_log); + ASSERT_FALSE(child_log.get_missing().may_include_deletes); + ASSERT_FALSE(child_log.get_rebuilt_missing_with_deletes()); + } +} + class PGLogTestRebuildMissing : public PGLogTest, public StoreTestFixture { public: PGLogTestRebuildMissing() : PGLogTest(), StoreTestFixture("memstore") {} @@ -2323,8 +2347,6 @@ TEST_F(PGLogTestRebuildMissing, MissingNotInLog) { run_rebuild_missing_test(expected); } - - // Local Variables: // compile-command: "cd ../.. ; make unittest_pglog ; ./unittest_pglog --log-to-stderr=true --debug-osd=20 # --gtest_filter=*.* " // End: