Skip to content

Commit

Permalink
Merge pull request #11558 from ifed01/wip-rmcoll-more-fixes
Browse files Browse the repository at this point in the history
os/memstore, os/filestore: fix store_test's to satisfy rm_coll behavi…

Reviewed-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Oct 19, 2016
2 parents e362f13 + b57c9da commit d782d71
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/os/filestore/FileStore.cc
Expand Up @@ -3003,8 +3003,8 @@ void FileStore::_do_transaction(
msg = "ENOTEMPTY suggests garbage data in osd data dir";
}

dout(0) << " error " << cpp_strerror(r) << " not handled on operation " << op
<< " (" << spos << ", or op " << spos.op << ", counting from 0)" << dendl;
derr << " error " << cpp_strerror(r) << " not handled on operation " << op
<< " (" << spos << ", or op " << spos.op << ", counting from 0)" << dendl;
dout(0) << msg << dendl;
dout(0) << " transaction dump:\n";
JSONFormatter f(true);
Expand Down
2 changes: 1 addition & 1 deletion src/os/memstore/MemStore.cc
Expand Up @@ -1045,7 +1045,7 @@ void MemStore::_do_transaction(Transaction& t)
dump_all();
}

dout(0) << " error " << cpp_strerror(r) << " not handled on operation " << op->op
derr << " error " << cpp_strerror(r) << " not handled on operation " << op->op
<< " (op " << pos << ", counting from 0)" << dendl;
dout(0) << msg << dendl;
dout(0) << " transaction dump:\n";
Expand Down
25 changes: 18 additions & 7 deletions src/test/objectstore/store_test.cc
Expand Up @@ -2725,7 +2725,14 @@ TEST_P(StoreTest, SimpleCloneTest) {
rl.hexdump(cout);*/
ASSERT_TRUE(bl_eq(rl, final));
}
{

//Unfortunately we need a workaround for filestore since EXPECT_DEATH
// macro has potential issues when using /in multithread environments.
//It works well for all stores but filestore for now.
//A fix setting gtest_death_test_style = "threadsafe" doesn't help as well -
// test app clone asserts on store folder presence.
//
if (string(GetParam()) != "filestore") {
//verify if non-empty collection is properly handled after store reload
r = store->umount();
ASSERT_EQ(r, 0);
Expand All @@ -2739,26 +2746,30 @@ TEST_P(StoreTest, SimpleCloneTest) {

}
{
//verify if non-empty collection is properly handled when there are some pending removes and live records in db
cerr << "Invalid rm coll again" << std::endl;

ObjectStore::Transaction t;
t.touch(cid, hoid3); //new record in db
t.remove(cid, hoid);
t.remove(cid, hoid2);
r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);

}
//See comment above for "filestore" check explanation.
if (string(GetParam()) != "filestore") {
ObjectStore::Transaction t;
//verify if non-empty collection is properly handled when there are some pending removes and live records in db
cerr << "Invalid rm coll again" << std::endl;
r = store->umount();
ASSERT_EQ(r, 0);
r = store->mount();
ASSERT_EQ(r, 0);

t.remove(cid, hoid);
t.remove(cid, hoid2);
t.remove_collection(cid);
EXPECT_DEATH(apply_transaction(store, &osr, std::move(t)), ".*Directory not empty.*");
}
{
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove(cid, hoid2);
t.remove(cid, hoid3);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
Expand Down

0 comments on commit d782d71

Please sign in to comment.