From: Samuel Just Date: Thu, 9 Apr 2015 23:29:45 +0000 (-0700) Subject: TestPGLog: fix invalid proc_replica_log test caes X-Git-Tag: v0.94.4~62^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8a2ad0540994efe530a1775ebd949aeaf6609e57;p=ceph.git TestPGLog: fix invalid proc_replica_log test caes If 1'3 is non-divergent, no osd could correctly have created 2'3. Also, proc_replica_log does not add the extra entries from the auth log to the missing set, that happens later on in activate. Signed-off-by: Samuel Just (cherry picked from commit 1333b676dba4ed4b5db854fe935bdadbf9f21d08) --- diff --git a/src/test/osd/TestPGLog.cc b/src/test/osd/TestPGLog.cc index 92128434726a..cc9733ac28f1 100644 --- a/src/test/osd/TestPGLog.cc +++ b/src/test/osd/TestPGLog.cc @@ -1481,12 +1481,12 @@ TEST_F(PGLogTest, proc_replica_log) { } /* +--------------------------+ - | log olog | + | olog log | +--------+-------+---------+ | |object | | |version | hash | version | | | | | - tail > (1,1) | x5 | (1,1) < tail + tail > (1,1) | x9 | (1,1) < tail | | | | | | | | | (1,2) | x3 | (1,2) | @@ -1514,34 +1514,38 @@ TEST_F(PGLogTest, proc_replica_log) { pg_shard_t from; eversion_t last_update(1, 2); + hobject_t divergent_object; + divergent_object.set_hash(0x9); { pg_log_entry_t e; e.mod_desc.mark_unrollbackable(); e.version = eversion_t(1, 1); - e.soid.set_hash(0x5); + e.soid = divergent_object; log.tail = e.version; log.log.push_back(e); e.version = last_update; e.soid.set_hash(0x3); log.log.push_back(e); - e.version = eversion_t(1,3); - e.soid.set_hash(0x9); + e.version = eversion_t(2, 3); + e.prior_version = eversion_t(1, 1); + e.soid = divergent_object; e.op = pg_log_entry_t::DELETE; log.log.push_back(e); log.head = e.version; log.index(); e.version = eversion_t(1, 1); - e.soid.set_hash(0x5); + e.soid = divergent_object; olog.tail = e.version; olog.log.push_back(e); e.version = last_update; e.soid.set_hash(0x3); olog.log.push_back(e); - e.version = eversion_t(2, 3); - e.soid.set_hash(0x9); + e.version = eversion_t(1, 3); + e.prior_version = eversion_t(1, 1); + e.soid = divergent_object; e.op = pg_log_entry_t::DELETE; olog.log.push_back(e); olog.head = e.version; @@ -1558,28 +1562,30 @@ TEST_F(PGLogTest, proc_replica_log) { proc_replica_log(t, oinfo, olog, omissing, from); EXPECT_TRUE(t.empty()); - EXPECT_FALSE(omissing.have_missing()); + EXPECT_TRUE(omissing.have_missing()); + EXPECT_TRUE(omissing.is_missing(divergent_object)); + EXPECT_EQ(omissing.missing[divergent_object].have, eversion_t(0, 0)); + EXPECT_EQ(omissing.missing[divergent_object].need, eversion_t(1, 1)); EXPECT_EQ(last_update, oinfo.last_update); - EXPECT_EQ(last_update, oinfo.last_complete); } /* +--------------------------+ - | log olog | + | olog log | +--------+-------+---------+ | |object | | |version | hash | version | | | | | - tail > (1,1) | x5 | (1,1) < tail + tail > (1,1) | x9 | (1,1) < tail | | | | | | | | | (1,2) | x3 | (1,2) | | | | | | | | | head > (1,3) | x9 | | - | DELETE | | | + | MODIFY | | | | | | | | | x9 | (2,3) < head - | | | MODIFY | + | | | DELETE | | | | | +--------+-------+---------+ @@ -1604,28 +1610,30 @@ TEST_F(PGLogTest, proc_replica_log) { e.mod_desc.mark_unrollbackable(); e.version = eversion_t(1, 1); - e.soid.set_hash(0x5); + e.soid = divergent_object; log.tail = e.version; log.log.push_back(e); e.version = last_update; e.soid.set_hash(0x3); log.log.push_back(e); - e.version = eversion_t(1, 3); - e.soid.set_hash(0x9); + e.version = eversion_t(2, 3); + e.prior_version = eversion_t(1, 1); + e.soid = divergent_object; e.op = pg_log_entry_t::DELETE; log.log.push_back(e); log.head = e.version; log.index(); e.version = eversion_t(1, 1); - e.soid.set_hash(0x5); + e.soid = divergent_object; olog.tail = e.version; olog.log.push_back(e); e.version = last_update; e.soid.set_hash(0x3); olog.log.push_back(e); - e.version = eversion_t(2, 3); - e.soid.set_hash(0x9); + e.version = eversion_t(1, 3); + e.prior_version = eversion_t(1, 1); + e.soid = divergent_object; divergent_object = e.soid; omissing.add(divergent_object, e.version, eversion_t()); e.op = pg_log_entry_t::MODIFY; @@ -1639,16 +1647,18 @@ TEST_F(PGLogTest, proc_replica_log) { EXPECT_TRUE(t.empty()); EXPECT_TRUE(omissing.have_missing()); EXPECT_TRUE(omissing.is_missing(divergent_object)); - EXPECT_EQ(eversion_t(2, 3), omissing.missing[divergent_object].need); + EXPECT_EQ(eversion_t(1, 3), omissing.missing[divergent_object].need); EXPECT_EQ(olog.head, oinfo.last_update); EXPECT_EQ(olog.head, oinfo.last_complete); proc_replica_log(t, oinfo, olog, omissing, from); EXPECT_TRUE(t.empty()); - EXPECT_FALSE(omissing.have_missing()); + EXPECT_TRUE(omissing.have_missing()); + EXPECT_TRUE(omissing.is_missing(divergent_object)); + EXPECT_EQ(omissing.missing[divergent_object].have, eversion_t(0, 0)); + EXPECT_EQ(omissing.missing[divergent_object].need, eversion_t(1, 1)); EXPECT_EQ(last_update, oinfo.last_update); - EXPECT_EQ(last_update, oinfo.last_complete); } /* +--------------------------+