From: Sage Weil Date: Tue, 15 Sep 2015 00:09:50 +0000 (-0400) Subject: os: require Sequencer arg for apply_transaction() X-Git-Tag: v9.1.0~135^2~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=139b5d6235f055a1fb921b8c5087af712f8c86d9;p=ceph.git os: require Sequencer arg for apply_transaction() Signed-off-by: Sage Weil --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index c8a54268c970..ec14dcd766c4 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -1600,19 +1600,11 @@ public: }; // synchronous wrappers - unsigned apply_transaction(Transaction& t, Context *ondisk=0) { - list tls; - tls.push_back(&t); - return apply_transactions(NULL, tls, ondisk); - } unsigned apply_transaction(Sequencer *osr, Transaction& t, Context *ondisk=0) { list tls; tls.push_back(&t); return apply_transactions(osr, tls, ondisk); } - unsigned apply_transactions(list& tls, Context *ondisk=0) { - return apply_transactions(NULL, tls, ondisk); - } unsigned apply_transactions(Sequencer *osr, list& tls, Context *ondisk=0); int queue_transaction_and_cleanup(Sequencer *osr, Transaction* t, diff --git a/src/test/bench/small_io_bench_fs.cc b/src/test/bench/small_io_bench_fs.cc index 83b085ca53bb..4b273e410a89 100644 --- a/src/test/bench/small_io_bench_fs.cc +++ b/src/test/bench/small_io_bench_fs.cc @@ -134,6 +134,7 @@ int main(int argc, char **argv) FileStore fs(vm["filestore-path"].as(), vm["journal-path"].as()); + ObjectStore::Sequencer osr(__func__); if (fs.mkfs() < 0) { cout << "mkfs failed" << std::endl; @@ -172,12 +173,12 @@ int main(int argc, char **argv) std::cout << "collection " << pgid << std::endl; ObjectStore::Transaction t; t.create_collection(coll_t(pgid), 0); - fs.apply_transaction(t); + fs.apply_transaction(&osr, t); } { ObjectStore::Transaction t; t.create_collection(coll_t(), 0); - fs.apply_transaction(t); + fs.apply_transaction(&osr, t); } vector > benchers( diff --git a/src/test/objectstore/DeterministicOpSequence.cc b/src/test/objectstore/DeterministicOpSequence.cc index 03209a7900b8..c26173ffa397 100644 --- a/src/test/objectstore/DeterministicOpSequence.cc +++ b/src/test/objectstore/DeterministicOpSequence.cc @@ -452,7 +452,7 @@ void DeterministicOpSequence::_do_coll_create(coll_t cid, uint32_t pg_num, uint6 dout(0) << "Give collection: " << cid << " a hint, pg_num is: " << pg_num << ", num_objs is: " << num_objs << dendl; - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_touch(coll_t coll, hobject_t& obj) @@ -460,7 +460,7 @@ void DeterministicOpSequence::_do_touch(coll_t coll, hobject_t& obj) ObjectStore::Transaction t; note_txn(&t); t.touch(coll, ghobject_t(obj)); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_remove(coll_t coll, hobject_t& obj) @@ -468,7 +468,7 @@ void DeterministicOpSequence::_do_remove(coll_t coll, hobject_t& obj) ObjectStore::Transaction t; note_txn(&t); t.remove(coll, ghobject_t(obj)); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_set_attrs(coll_t coll, @@ -478,7 +478,7 @@ void DeterministicOpSequence::_do_set_attrs(coll_t coll, ObjectStore::Transaction t; note_txn(&t); t.omap_setkeys(coll, ghobject_t(obj), attrs); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_write(coll_t coll, hobject_t& obj, @@ -487,7 +487,7 @@ void DeterministicOpSequence::_do_write(coll_t coll, hobject_t& obj, ObjectStore::Transaction t; note_txn(&t); t.write(coll, ghobject_t(obj), off, len, data); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_clone(coll_t coll, hobject_t& orig_obj, @@ -496,7 +496,7 @@ void DeterministicOpSequence::_do_clone(coll_t coll, hobject_t& orig_obj, ObjectStore::Transaction t; note_txn(&t); t.clone(coll, ghobject_t(orig_obj), ghobject_t(new_obj)); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_clone_range(coll_t coll, @@ -507,7 +507,7 @@ void DeterministicOpSequence::_do_clone_range(coll_t coll, note_txn(&t); t.clone_range(coll, ghobject_t(orig_obj), ghobject_t(new_obj), srcoff, srclen, dstoff); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_write_and_clone_range(coll_t coll, @@ -523,7 +523,7 @@ void DeterministicOpSequence::_do_write_and_clone_range(coll_t coll, t.write(coll, ghobject_t(orig_obj), srcoff, bl.length(), bl); t.clone_range(coll, ghobject_t(orig_obj), ghobject_t(new_obj), srcoff, srclen, dstoff); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } void DeterministicOpSequence::_do_coll_move(coll_t orig_coll, coll_t new_coll, @@ -533,6 +533,6 @@ void DeterministicOpSequence::_do_coll_move(coll_t orig_coll, coll_t new_coll, note_txn(&t); t.remove(new_coll, ghobject_t(obj)); t.collection_move_rename(orig_coll, ghobject_t(obj), new_coll, ghobject_t(obj)); - m_store->apply_transaction(t); + m_store->apply_transaction(&m_osr, t); } diff --git a/src/test/objectstore/TestObjectStoreState.cc b/src/test/objectstore/TestObjectStoreState.cc index 7693fc7530d1..e4252ce7b24f 100644 --- a/src/test/objectstore/TestObjectStoreState.cc +++ b/src/test/objectstore/TestObjectStoreState.cc @@ -33,11 +33,12 @@ void TestObjectStoreState::init(int colls, int objs) { dout(5) << "init " << colls << " colls " << objs << " objs" << dendl; + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction *t; t = new ObjectStore::Transaction; t->create_collection(coll_t::meta(), 0); - m_store->apply_transaction(*t); + m_store->apply_transaction(&osr, *t); wait_for_ready(); diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 3a47d120f143..7f95a4f369fd 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -104,6 +104,7 @@ TEST_P(StoreTest, TrivialRemount) { } TEST_P(StoreTest, SimpleRemount) { + ObjectStore::Sequencer osr("test"); coll_t cid; ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP))); @@ -115,7 +116,7 @@ TEST_P(StoreTest, SimpleRemount) { ObjectStore::Transaction t; t.create_collection(cid, 0); t.write(cid, hoid, 0, bl.length(), bl); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } store->umount(); @@ -124,7 +125,7 @@ TEST_P(StoreTest, SimpleRemount) { { ObjectStore::Transaction t; t.write(cid, hoid2, 0, bl.length(), bl); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -133,12 +134,13 @@ TEST_P(StoreTest, SimpleRemount) { t.remove(cid, hoid2); t.remove_collection(cid); cerr << "remove collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, IORemount) { + ObjectStore::Sequencer osr("test"); coll_t cid; bufferlist bl; bl.append("1234512345"); @@ -151,7 +153,7 @@ TEST_P(StoreTest, IORemount) { ghobject_t hoid(hobject_t(sobject_t("Object " + stringify(n), CEPH_NOSNAP))); t.write(cid, hoid, 0, bl.length(), bl); } - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } // overwrites @@ -161,7 +163,7 @@ TEST_P(StoreTest, IORemount) { ObjectStore::Transaction t; ghobject_t hoid(hobject_t(sobject_t("Object " + stringify(n), CEPH_NOSNAP))); t.write(cid, hoid, 1, bl.length(), bl); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } @@ -175,78 +177,81 @@ TEST_P(StoreTest, IORemount) { t.remove(cid, hoid); } t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimpleMetaColTest) { + ObjectStore::Sequencer osr("test"); coll_t cid; int r = 0; { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "create collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.remove_collection(cid); cerr << "remove collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "add collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.remove_collection(cid); cerr << "remove collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimplePGColTest) { + ObjectStore::Sequencer osr("test"); coll_t cid(spg_t(pg_t(1,2), shard_id_t::NO_SHARD)); int r = 0; { ObjectStore::Transaction t; t.create_collection(cid, 4); cerr << "create collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.remove_collection(cid); cerr << "remove collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.create_collection(cid, 4); cerr << "add collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.remove_collection(cid); cerr << "remove collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimpleColPreHashTest) { + ObjectStore::Sequencer osr("test"); // Firstly we will need to revert the value making sure // collection hint actually works int merge_threshold = g_ceph_context->_conf->filestore_merge_threshold; @@ -278,7 +283,7 @@ TEST_P(StoreTest, SimpleColPreHashTest) { ::encode(expected_num_objs, hint); t.collection_hint(cid, ObjectStore::Transaction::COLL_HINT_EXPECTED_NUM_OBJECTS, hint); cerr << "collection hint" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -286,7 +291,7 @@ TEST_P(StoreTest, SimpleColPreHashTest) { ObjectStore::Transaction t; t.remove_collection(cid); cerr << "remove collection" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } // Revert the config change so that it does not affect the split/merge tests @@ -298,6 +303,7 @@ TEST_P(StoreTest, SimpleColPreHashTest) { } TEST_P(StoreTest, SimpleObjectTest) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid; ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); @@ -310,7 +316,7 @@ TEST_P(StoreTest, SimpleObjectTest) { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -320,7 +326,7 @@ TEST_P(StoreTest, SimpleObjectTest) { ObjectStore::Transaction t; t.touch(cid, hoid); cerr << "Creating object " << hoid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); exists = store->exists(cid, hoid); @@ -331,7 +337,7 @@ TEST_P(StoreTest, SimpleObjectTest) { t.remove(cid, hoid); t.touch(cid, hoid); cerr << "Remove then create" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -342,7 +348,7 @@ TEST_P(StoreTest, SimpleObjectTest) { t.remove(cid, hoid); t.write(cid, hoid, 0, 5, bl); cerr << "Remove then create" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); bufferlist in; @@ -358,7 +364,7 @@ TEST_P(StoreTest, SimpleObjectTest) { exp.append(bl); t.write(cid, hoid, 5, 5, bl); cerr << "Append" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); bufferlist in; @@ -373,7 +379,7 @@ TEST_P(StoreTest, SimpleObjectTest) { exp = bl; t.write(cid, hoid, 0, 10, bl); cerr << "Full overwrite" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); bufferlist in; @@ -387,7 +393,7 @@ TEST_P(StoreTest, SimpleObjectTest) { bl.append("abcde"); t.write(cid, hoid, 3, 5, bl); cerr << "Partial overwrite" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); bufferlist in, exp; @@ -403,7 +409,7 @@ TEST_P(StoreTest, SimpleObjectTest) { bl.append("abcde01234012340123401234abcde01234012340123401234abcde01234012340123401234abcde01234012340123401234"); t.write(cid, hoid, 0, bl.length(), bl); cerr << "larger overwrite" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); bufferlist in; @@ -417,12 +423,13 @@ TEST_P(StoreTest, SimpleObjectTest) { t.remove(cid, hoid); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, ManySmallWrite) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid; ghobject_t a(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); @@ -431,7 +438,7 @@ TEST_P(StoreTest, ManySmallWrite) { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } bufferlist bl; @@ -441,13 +448,13 @@ TEST_P(StoreTest, ManySmallWrite) { for (int i=0; i<100; ++i) { ObjectStore::Transaction t; t.write(cid, a, i*4096, 4096, bl, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } for (int i=0; i<100; ++i) { ObjectStore::Transaction t; t.write(cid, b, (rand() % 1024)*4096, 4096, bl, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -456,12 +463,13 @@ TEST_P(StoreTest, ManySmallWrite) { t.remove(cid, b); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimpleAttrTest) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid; ghobject_t hoid(hobject_t(sobject_t("attr object 1", CEPH_NOSNAP))); @@ -479,7 +487,7 @@ TEST_P(StoreTest, SimpleAttrTest) { { ObjectStore::Transaction t; t.create_collection(cid, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -496,7 +504,7 @@ TEST_P(StoreTest, SimpleAttrTest) { t.touch(cid, hoid); t.setattr(cid, hoid, "foo", val); t.setattr(cid, hoid, "bar", val2); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -523,19 +531,20 @@ TEST_P(StoreTest, SimpleAttrTest) { ObjectStore::Transaction t; t.remove(cid, hoid); t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimpleListTest) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid(spg_t(pg_t(0, 1), shard_id_t(1))); { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } set all; @@ -551,7 +560,7 @@ TEST_P(StoreTest, SimpleListTest) { t.touch(cid, hoid); cerr << "Creating object " << hoid << std::endl; } - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } for (int bitwise=0; bitwise<2; ++bitwise) { @@ -590,7 +599,7 @@ TEST_P(StoreTest, SimpleListTest) { t.remove(cid, *p); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } @@ -624,6 +633,7 @@ TEST_P(StoreTest, Sort) { } TEST_P(StoreTest, MultipoolListTest) { + ObjectStore::Sequencer osr("test"); int r; int poolid = 4373; coll_t cid = coll_t(spg_t(pg_t(0, poolid), shard_id_t::NO_SHARD)); @@ -631,7 +641,7 @@ TEST_P(StoreTest, MultipoolListTest) { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } set all, saw; @@ -649,7 +659,7 @@ TEST_P(StoreTest, MultipoolListTest) { t.touch(cid, hoid); cerr << "Creating object " << hoid << std::endl; } - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -676,19 +686,20 @@ TEST_P(StoreTest, MultipoolListTest) { t.remove(cid, *p); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimpleCloneTest) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid; { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); @@ -704,7 +715,7 @@ TEST_P(StoreTest, SimpleCloneTest) { t.setattr(cid, hoid, "attr3", xlarge); t.write(cid, hoid, 10, small.length(), small); cerr << "Creating object and set attr " << hoid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP))); @@ -717,7 +728,7 @@ TEST_P(StoreTest, SimpleCloneTest) { t.setattr(cid, hoid, "attr1", large); t.setattr(cid, hoid, "attr2", small); cerr << "Clone object and rm attr" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); r = store->read(cid, hoid, 10, 5, newdata); @@ -749,19 +760,20 @@ TEST_P(StoreTest, SimpleCloneTest) { t.remove(cid, hoid2); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, OmapCloneTest) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid; { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); @@ -778,7 +790,7 @@ TEST_P(StoreTest, OmapCloneTest) { t.omap_setkeys(cid, hoid, km); t.omap_setheader(cid, hoid, header); cerr << "Creating object and set omap " << hoid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP))); @@ -786,7 +798,7 @@ TEST_P(StoreTest, OmapCloneTest) { ObjectStore::Transaction t; t.clone(cid, hoid, hoid2); cerr << "Clone object" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -802,19 +814,20 @@ TEST_P(StoreTest, OmapCloneTest) { t.remove(cid, hoid2); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimpleCloneRangeTest) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid; { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP))); @@ -825,7 +838,7 @@ TEST_P(StoreTest, SimpleCloneRangeTest) { ObjectStore::Transaction t; t.write(cid, hoid, 10, 5, small); cerr << "Creating object and write bl " << hoid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP))); @@ -834,7 +847,7 @@ TEST_P(StoreTest, SimpleCloneRangeTest) { ObjectStore::Transaction t; t.clone_range(cid, hoid, hoid2, 10, 5, 0); cerr << "Clone range object" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); r = store->read(cid, hoid2, 0, 5, newdata); ASSERT_EQ(r, 5); @@ -845,7 +858,7 @@ TEST_P(StoreTest, SimpleCloneRangeTest) { t.truncate(cid, hoid, 1024*1024); t.clone_range(cid, hoid, hoid2, 0, 1024*1024, 0); cerr << "Clone range object" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); struct stat stat, stat2; r = store->stat(cid, hoid, &stat); @@ -859,20 +872,21 @@ TEST_P(StoreTest, SimpleCloneRangeTest) { t.remove(cid, hoid2); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SimpleObjectLongnameTest) { + ObjectStore::Sequencer osr("test"); int r; coll_t cid; { ObjectStore::Transaction t; t.create_collection(cid, 0); cerr << "Creating collection " << cid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ghobject_t hoid(hobject_t(sobject_t("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaObjectaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1", CEPH_NOSNAP))); @@ -880,7 +894,7 @@ TEST_P(StoreTest, SimpleObjectLongnameTest) { ObjectStore::Transaction t; t.touch(cid, hoid); cerr << "Creating object " << hoid << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -888,12 +902,13 @@ TEST_P(StoreTest, SimpleObjectLongnameTest) { t.remove(cid, hoid); t.remove_collection(cid); cerr << "Cleaning" << std::endl; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, ManyObjectTest) { + ObjectStore::Sequencer osr("test"); int NUM_OBJS = 2000; int r = 0; coll_t cid; @@ -903,7 +918,7 @@ TEST_P(StoreTest, ManyObjectTest) { { ObjectStore::Transaction t; t.create_collection(cid, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } for (int i = 0; i < NUM_OBJS; ++i) { @@ -916,7 +931,7 @@ TEST_P(StoreTest, ManyObjectTest) { ghobject_t hoid(hobject_t(sobject_t(string(buf) + base, CEPH_NOSNAP))); t.touch(cid, hoid); created.insert(hoid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -1006,14 +1021,14 @@ TEST_P(StoreTest, ManyObjectTest) { ++i) { ObjectStore::Transaction t; t.remove(cid, *i); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } cerr << "cleaning up" << std::endl; { ObjectStore::Transaction t; t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } @@ -1101,6 +1116,7 @@ public: SyntheticWorkloadState *state; ObjectStore::Transaction *t; ghobject_t oid, noid; + C_SyntheticOnClone(SyntheticWorkloadState *state, ObjectStore::Transaction *t, ghobject_t oid, ghobject_t noid) : state(state), t(t), oid(oid), noid(noid) {} @@ -1139,7 +1155,7 @@ public: bl.append(bp); } - + SyntheticWorkloadState(ObjectStore *store, ObjectGenerator *gen, gen_type *rng, @@ -1151,7 +1167,7 @@ public: int init() { ObjectStore::Transaction t; t.create_collection(cid, 0); - return store->apply_transaction(t); + return store->apply_transaction(osr, t); } ghobject_t get_uniform_random_object() { @@ -1679,13 +1695,14 @@ TEST_P(StoreTest, AttrSynthetic) { } TEST_P(StoreTest, HashCollisionTest) { + ObjectStore::Sequencer osr("test"); int64_t poolid = 11; coll_t cid(spg_t(pg_t(0,poolid),shard_id_t::NO_SHARD)); int r; { ObjectStore::Transaction t; t.create_collection(cid, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } string base = ""; @@ -1704,7 +1721,7 @@ TEST_P(StoreTest, HashCollisionTest) { { ObjectStore::Transaction t; t.touch(cid, hoid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } created.insert(hoid); @@ -1751,23 +1768,24 @@ TEST_P(StoreTest, HashCollisionTest) { ++i) { ObjectStore::Transaction t; t.remove(cid, *i); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ObjectStore::Transaction t; t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } TEST_P(StoreTest, ScrubTest) { + ObjectStore::Sequencer osr("test"); int64_t poolid = 111; coll_t cid(spg_t(pg_t(0, poolid),shard_id_t(1))); int r; { ObjectStore::Transaction t; t.create_collection(cid, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } string base = "aaaaa"; @@ -1784,7 +1802,7 @@ TEST_P(StoreTest, ScrubTest) { { ObjectStore::Transaction t; t.touch(cid, hoid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } created.insert(hoid); @@ -1800,7 +1818,7 @@ TEST_P(StoreTest, ScrubTest) { t.touch(cid, hoid1); t.touch(cid, hoid2); t.touch(cid, hoid3); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); created.insert(hoid1); created.insert(hoid2); created.insert(hoid3); @@ -1848,24 +1866,25 @@ TEST_P(StoreTest, ScrubTest) { ++i) { ObjectStore::Transaction t; t.remove(cid, *i); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ObjectStore::Transaction t; t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } TEST_P(StoreTest, OMapTest) { + ObjectStore::Sequencer osr("test"); coll_t cid; ghobject_t hoid(hobject_t("tesomap", "", CEPH_NOSNAP, 0, 0, "")); int r; { ObjectStore::Transaction t; t.create_collection(cid, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -1876,7 +1895,7 @@ TEST_P(StoreTest, OMapTest) { t.omap_clear(cid, hoid); map start_set; t.omap_setkeys(cid, hoid, start_set); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } for (int i = 0; i < 100; i++) { @@ -1911,7 +1930,7 @@ TEST_P(StoreTest, OMapTest) { to_add.insert(pair("key-" + string(buf), bl)); attrs.insert(pair("key-" + string(buf), bl)); t.omap_setkeys(cid, hoid, to_add); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } int i = 0; @@ -1941,7 +1960,7 @@ TEST_P(StoreTest, OMapTest) { set keys_to_remove; keys_to_remove.insert(to_remove); t.omap_rmkeys(cid, hoid, keys_to_remove); - store->apply_transaction(t); + store->apply_transaction(&osr, t); attrs.erase(to_remove); @@ -1953,14 +1972,14 @@ TEST_P(StoreTest, OMapTest) { bl1.append("omap_header"); ObjectStore::Transaction t; t.omap_setheader(cid, hoid, bl1); - store->apply_transaction(t); + store->apply_transaction(&osr, t); bufferlist bl2; bl2.append("value"); map to_add; to_add.insert(pair("key", bl2)); t.omap_setkeys(cid, hoid, to_add); - store->apply_transaction(t); + store->apply_transaction(&osr, t); bufferlist bl3; map cur_attrs; @@ -1989,12 +2008,12 @@ TEST_P(StoreTest, OMapTest) { t.touch(cid, hoid); t.omap_setheader(cid, hoid, h); t.omap_setkeys(cid, hoid, to_set); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } { ObjectStore::Transaction t; t.omap_rmkeyrange(cid, hoid, "3", "7"); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } { bufferlist hdr; @@ -2012,7 +2031,7 @@ TEST_P(StoreTest, OMapTest) { { ObjectStore::Transaction t; t.omap_clear(cid, hoid); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } { bufferlist hdr; @@ -2026,11 +2045,12 @@ TEST_P(StoreTest, OMapTest) { ObjectStore::Transaction t; t.remove(cid, hoid); t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } TEST_P(StoreTest, OMapIterator) { + ObjectStore::Sequencer osr("test"); coll_t cid; ghobject_t hoid(hobject_t("tesomap", "", CEPH_NOSNAP, 0, 0, "")); int count = 0; @@ -2038,7 +2058,7 @@ TEST_P(StoreTest, OMapIterator) { { ObjectStore::Transaction t; t.create_collection(cid, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2049,7 +2069,7 @@ TEST_P(StoreTest, OMapIterator) { t.omap_clear(cid, hoid); map start_set; t.omap_setkeys(cid, hoid, start_set); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } ObjectMap::ObjectMapIterator iter; bool correct; @@ -2092,7 +2112,7 @@ TEST_P(StoreTest, OMapIterator) { attrs.insert(pair("key-" + string(buf), bl)); ObjectStore::Transaction t; t.omap_setkeys(cid, hoid, to_add); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } iter = store->get_omap_iterator(cid, hoid); @@ -2118,12 +2138,13 @@ TEST_P(StoreTest, OMapIterator) { ObjectStore::Transaction t; t.remove(cid, hoid); t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, XattrTest) { + ObjectStore::Sequencer osr("test"); coll_t cid; ghobject_t hoid(hobject_t("tesomap", "", CEPH_NOSNAP, 0, 0, "")); bufferlist big; @@ -2139,7 +2160,7 @@ TEST_P(StoreTest, XattrTest) { ObjectStore::Transaction t; t.create_collection(cid, 0); t.touch(cid, hoid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2158,7 +2179,7 @@ TEST_P(StoreTest, XattrTest) { attrs["attr4"] = big; t.setattr(cid, hoid, "attr3", big); attrs["attr3"] = big; - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2177,7 +2198,7 @@ TEST_P(StoreTest, XattrTest) { ObjectStore::Transaction t; t.rmattr(cid, hoid, "attr2"); attrs.erase("attr2"); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2205,7 +2226,7 @@ TEST_P(StoreTest, XattrTest) { ObjectStore::Transaction t; t.remove(cid, hoid); t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2214,13 +2235,14 @@ void colsplittest( unsigned num_objects, unsigned common_suffix_size ) { + ObjectStore::Sequencer osr("test"); coll_t cid(spg_t(pg_t(0,52),shard_id_t::NO_SHARD)); coll_t tid(spg_t(pg_t(1<apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { @@ -2235,14 +2257,14 @@ void colsplittest( i<apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.create_collection(tid, common_suffix_size + 1); t.split_collection(cid, common_suffix_size+1, 1<apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2273,7 +2295,7 @@ void colsplittest( t.remove_collection(cid); t.remove_collection(tid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2298,12 +2320,13 @@ TEST_P(StoreTest, ColSplitTest3) { * stops at the common prefix subdir. See bug * #5273 */ TEST_P(StoreTest, TwoHash) { + ObjectStore::Sequencer osr("test"); coll_t cid; int r; { ObjectStore::Transaction t; t.create_collection(cid, 0); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } std::cout << "Making objects" << std::endl; @@ -2317,7 +2340,7 @@ TEST_P(StoreTest, TwoHash) { } o.hobj.set_hash((i << 16) | 0xB1); t.touch(cid, o); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } std::cout << "Removing half" << std::endl; @@ -2327,7 +2350,7 @@ TEST_P(StoreTest, TwoHash) { o.hobj.pool = -1; o.hobj.set_hash((i << 16) | 0xA1); t.remove(cid, o); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } std::cout << "Checking" << std::endl; @@ -2355,16 +2378,17 @@ TEST_P(StoreTest, TwoHash) { t.remove(cid, o); o.hobj.set_hash((i << 16) | 0xB1); t.remove(cid, o); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ObjectStore::Transaction t; t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } TEST_P(StoreTest, MoveRename) { + ObjectStore::Sequencer osr("test"); coll_t cid(spg_t(pg_t(0, 212),shard_id_t::NO_SHARD)); ghobject_t temp_oid(hobject_t("tmp_oid", "", CEPH_NOSNAP, 0, 0, "")); ghobject_t oid(hobject_t("dest_oid", "", CEPH_NOSNAP, 0, 0, "")); @@ -2373,7 +2397,7 @@ TEST_P(StoreTest, MoveRename) { ObjectStore::Transaction t; t.create_collection(cid, 0); t.touch(cid, oid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ASSERT_TRUE(store->exists(cid, oid)); @@ -2388,7 +2412,7 @@ TEST_P(StoreTest, MoveRename) { t.write(cid, temp_oid, 0, data.length(), data); t.setattr(cid, temp_oid, "attr", attr); t.omap_setkeys(cid, temp_oid, omap); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ASSERT_TRUE(store->exists(cid, temp_oid)); @@ -2396,7 +2420,7 @@ TEST_P(StoreTest, MoveRename) { ObjectStore::Transaction t; t.remove(cid, oid); t.collection_move_rename(cid, temp_oid, cid, oid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } ASSERT_TRUE(store->exists(cid, oid)); @@ -2423,12 +2447,13 @@ TEST_P(StoreTest, MoveRename) { ObjectStore::Transaction t; t.remove(cid, oid); t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, BigRGWObjectName) { + ObjectStore::Sequencer osr("test"); store->set_allow_sharded_objects(); coll_t cid(spg_t(pg_t(0,12),shard_id_t::NO_SHARD)); ghobject_t oid( @@ -2454,14 +2479,14 @@ TEST_P(StoreTest, BigRGWObjectName) { t.collection_move_rename(cid, oidhead, cid, oid); t.touch(cid, oidhead); t.collection_move_rename(cid, oidhead, cid, oid2); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.remove(cid, oid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } @@ -2480,13 +2505,14 @@ TEST_P(StoreTest, BigRGWObjectName) { ObjectStore::Transaction t; t.remove(cid, oid2); t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } TEST_P(StoreTest, SetAllocHint) { + ObjectStore::Sequencer osr("test"); coll_t cid; ghobject_t hoid(hobject_t("test_hint", "", CEPH_NOSNAP, 0, 0, "")); int r; @@ -2494,31 +2520,31 @@ TEST_P(StoreTest, SetAllocHint) { ObjectStore::Transaction t; t.create_collection(cid, 0); t.touch(cid, hoid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.remove(cid, hoid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } { ObjectStore::Transaction t; t.remove_collection(cid); - r = store->apply_transaction(t); + r = store->apply_transaction(&osr, t); ASSERT_EQ(r, 0); } } diff --git a/src/test/objectstore/test_idempotent.cc b/src/test/objectstore/test_idempotent.cc index dc685e09c966..098bc81c85f4 100644 --- a/src/test/objectstore/test_idempotent.cc +++ b/src/test/objectstore/test_idempotent.cc @@ -68,6 +68,7 @@ int main(int argc, char **argv) { boost::scoped_ptr db(_db); boost::scoped_ptr store(new FileStore(store_path, store_dev)); + ObjectStore::Sequencer osr(__func__); coll_t coll(spg_t(pg_t(0,12),shard_id_t::NO_SHARD)); if (start_new) { @@ -76,7 +77,7 @@ int main(int argc, char **argv) { ObjectStore::Transaction t; assert(!store->mount()); t.create_collection(coll, 0); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } else { assert(!store->mount()); } diff --git a/src/test/objectstore_bench.cc b/src/test/objectstore_bench.cc index ae1f79fc4a61..d5e9f98d7146 100644 --- a/src/test/objectstore_bench.cc +++ b/src/test/objectstore_bench.cc @@ -223,9 +223,10 @@ int main(int argc, const char *argv[]) spg_t pg; const coll_t cid(pg); { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; t.create_collection(cid, 0); - os->apply_transaction(t); + os->apply_transaction(&osr, t); } // create the objects @@ -237,17 +238,19 @@ int main(int argc, const char *argv[]) oss << "osbench-thread-" << i; oids.emplace_back(pg.make_temp_object(oss.str())); + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; t.touch(cid, oids[i]); - int r = os->apply_transaction(t); + int r = os->apply_transaction(&osr, t); assert(r == 0); } } else { oids.emplace_back(pg.make_temp_object("osbench")); + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; t.touch(cid, oids.back()); - int r = os->apply_transaction(t); + int r = os->apply_transaction(&osr, t); assert(r == 0); } @@ -276,10 +279,11 @@ int main(int argc, const char *argv[]) << iops << " iops" << dendl; // remove the objects + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; for (const auto &oid : oids) t.remove(cid, oid); - os->apply_transaction(t); + os->apply_transaction(&osr,t); os->umount(); return 0; diff --git a/src/test/streamtest.cc b/src/test/streamtest.cc index 775b087e8ecf..e19dbcea7be0 100644 --- a/src/test/streamtest.cc +++ b/src/test/streamtest.cc @@ -143,9 +143,10 @@ int main(int argc, const char **argv) return -1; } + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction ft; ft.create_collection(coll_t(), 0); - fs->apply_transaction(ft); + fs->apply_transaction(&osr, ft); utime_t now = ceph_clock_now(g_ceph_context); utime_t start = now; diff --git a/src/test/test_trans.cc b/src/test/test_trans.cc index d482a9a9604e..c374ed440a76 100644 --- a/src/test/test_trans.cc +++ b/src/test/test_trans.cc @@ -55,6 +55,7 @@ int main(int argc, const char **argv) return -1; } + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; char buf[1 << 20]; bufferlist bl; @@ -71,7 +72,7 @@ int main(int argc, const char **argv) dout(0) << "starting thread" << dendl; foo.create(); dout(0) << "starting op" << dendl; - fs->apply_transaction(t); + fs->apply_transaction(&osr, t); } diff --git a/src/test/xattr_bench.cc b/src/test/xattr_bench.cc index f2e89958415a..e26e32f9ee70 100644 --- a/src/test/xattr_bench.cc +++ b/src/test/xattr_bench.cc @@ -90,6 +90,7 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs, Mutex lock("lock"); Cond cond; int in_flight = 0; + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; map, ObjectStore::Sequencer*> > collections; for (int i = 0; i < 3*THREADS; ++i) { @@ -105,7 +106,7 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs, } collections[coll] = make_pair(objects, new ObjectStore::Sequencer(coll.to_str())); } - store->apply_transaction(t); + store->apply_transaction(&osr, t); bufferlist bl; for (int i = 0; i < attrsize; ++i) { diff --git a/src/tools/ceph_objectstore_tool.cc b/src/tools/ceph_objectstore_tool.cc index f00ca3da0681..78d218b89f21 100644 --- a/src/tools/ceph_objectstore_tool.cc +++ b/src/tools/ceph_objectstore_tool.cc @@ -396,6 +396,7 @@ void remove_coll(ObjectStore *store, const coll_t &coll) { spg_t pg; coll.is_pg_prefix(&pg); + ObjectStore::Sequencer osr(__func__); OSDriver driver( store, coll_t(), @@ -426,7 +427,7 @@ void remove_coll(ObjectStore *store, const coll_t &coll) t->remove(coll, *i); if (num >= 30) { - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); delete t; t = new ObjectStore::Transaction; num = 0; @@ -434,7 +435,7 @@ void remove_coll(ObjectStore *store, const coll_t &coll) } } t->remove_collection(coll); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); out: delete t; } @@ -505,12 +506,13 @@ int initiate_new_remove_pg(ObjectStore *store, spg_t r_pgid) if (dry_run) return 0; ObjectStore::Transaction *rmt = new ObjectStore::Transaction; + ObjectStore::Sequencer osr(__func__); int r = mark_pg_for_removal(store, r_pgid, rmt); if (r < 0) { delete rmt; return r; } - store->apply_transaction(*rmt); + store->apply_transaction(&osr, *rmt); finish_remove_pgs(store); return r; } @@ -724,9 +726,10 @@ int set_inc_osdmap(ObjectStore *store, epoch_t e, bufferlist& bl, bool force) { cout << "Creating a new epoch." << std::endl; } ObjectStore::Transaction t; + ObjectStore::Sequencer osr(__func__); t.write(coll_t::meta(), inc_oid, 0, bl.length(), bl); t.truncate(coll_t::meta(), inc_oid, bl.length()); - int ret = store->apply_transaction(t); + int ret = store->apply_transaction(&osr, t); if (ret) { cerr << "Failed to set inc-osdmap (" << inc_oid << "): " << ret << std::endl; } else { @@ -767,10 +770,11 @@ int set_osdmap(ObjectStore *store, epoch_t e, bufferlist& bl, bool force) { } cout << "Creating a new epoch." << std::endl; } + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; t.write(coll_t::meta(), full_oid, 0, bl.length(), bl); t.truncate(coll_t::meta(), full_oid, bl.length()); - int ret = store->apply_transaction(t); + int ret = store->apply_transaction(&osr, t); if (ret) { cerr << "Failed to set osdmap (" << full_oid << "): " << ret << std::endl; } else { @@ -928,6 +932,7 @@ int get_omap(ObjectStore *store, coll_t coll, ghobject_t hoid, int ObjectStoreTool::get_object(ObjectStore *store, coll_t coll, bufferlist &bl, OSDMap &curmap, bool *skipped_objects) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction tran; ObjectStore::Transaction *t = &tran; bufferlist::iterator ebliter = bl.begin(); @@ -1020,7 +1025,7 @@ int ObjectStoreTool::get_object(ObjectStore *store, coll_t coll, } } if (!dry_run) - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); return 0; } @@ -1323,6 +1328,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb, } if (!dry_run) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction *t = new ObjectStore::Transaction; PG::_create(*t, pgid, pgid.get_split_bits(curmap.get_pg_pool(pgid.pool())->get_pg_num())); @@ -1333,7 +1339,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb, ::encode((char)1, values["_remove"]); t->omap_setkeys(coll, pgid.make_pgmeta_oid(), values); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); delete t; } @@ -1380,6 +1386,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb, return -EFAULT; } + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction t; if (!dry_run) { pg_log_t newlog, reject; @@ -1430,7 +1437,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb, set remove; remove.insert("_remove"); t.omap_rmkeys(coll, pgid.make_pgmeta_oid(), remove); - store->apply_transaction(t); + store->apply_transaction(&osr, t); } return 0; @@ -1468,6 +1475,7 @@ int do_remove_object(ObjectStore *store, coll_t coll, ghobject_t &ghobj) { spg_t pg; coll.is_pg_prefix(&pg); + ObjectStore::Sequencer osr(__func__); OSDriver driver( store, coll_t(), @@ -1494,7 +1502,7 @@ int do_remove_object(ObjectStore *store, coll_t coll, ghobject_t &ghobj) t->remove(coll, ghobj); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); delete t; return 0; } @@ -1586,6 +1594,7 @@ int do_get_bytes(ObjectStore *store, coll_t coll, ghobject_t &ghobj, int fd) int do_set_bytes(ObjectStore *store, coll_t coll, ghobject_t &ghobj, int fd) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction tran; ObjectStore::Transaction *t = &tran; @@ -1620,7 +1629,7 @@ int do_set_bytes(ObjectStore *store, coll_t coll, ghobject_t &ghobj, int fd) } while(true); if (!dry_run) - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); return 0; } @@ -1646,6 +1655,7 @@ int do_get_attr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key) int do_set_attr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key, int fd) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction tran; ObjectStore::Transaction *t = &tran; bufferlist bl; @@ -1661,12 +1671,13 @@ int do_set_attr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key, t->setattr(coll, ghobj, key, bl); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); return 0; } int do_rm_attr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction tran; ObjectStore::Transaction *t = &tran; @@ -1675,7 +1686,7 @@ int do_rm_attr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key) t->rmattr(coll, ghobj, key); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); return 0; } @@ -1712,6 +1723,7 @@ int do_get_omap(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key) int do_set_omap(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key, int fd) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction tran; ObjectStore::Transaction *t = &tran; map attrset; @@ -1730,12 +1742,13 @@ int do_set_omap(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key, t->omap_setkeys(coll, ghobj, attrset); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); return 0; } int do_rm_omap(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction tran; ObjectStore::Transaction *t = &tran; set keys; @@ -1747,7 +1760,7 @@ int do_rm_omap(ObjectStore *store, coll_t coll, ghobject_t &ghobj, string key) t->omap_rmkeys(coll, ghobj, keys); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); return 0; } @@ -1773,6 +1786,7 @@ int do_get_omaphdr(ObjectStore *store, coll_t coll, ghobject_t &ghobj) int do_set_omaphdr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, int fd) { + ObjectStore::Sequencer osr(__func__); ObjectStore::Transaction tran; ObjectStore::Transaction *t = &tran; bufferlist hdrbl; @@ -1788,7 +1802,7 @@ int do_set_omaphdr(ObjectStore *store, coll_t coll, ghobject_t &ghobj, int fd) t->omap_setheader(coll, ghobj, hdrbl); - store->apply_transaction(*t); + store->apply_transaction(&osr, *t); return 0; } @@ -1804,9 +1818,10 @@ struct do_fix_lost : public action_on_object_t { oi.clear_flag(object_info_t::FLAG_LOST); bufferlist bl; ::encode(oi, bl); + ObjectStore::Sequencer osr("do_fix_lost"); ObjectStore::Transaction t; t.setattr(coll, ghobj, OI_ATTR, bl); - int r = store->apply_transaction(t); + int r = store->apply_transaction(&osr, t); if (r < 0) { cerr << "Error getting fixing attr on : " << make_pair(coll, ghobj) << ", " @@ -2149,6 +2164,8 @@ int main(int argc, char **argv) bool fs_sharded_objects = fs->get_allow_sharded_objects(); + ObjectStore::Sequencer osr(__func__); + vector ls; vector::iterator it; CompatSet supported; @@ -2356,7 +2373,7 @@ int main(int argc, char **argv) bl.clear(); ::encode(superblock, bl); t.write(coll_t::meta(), OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl); - ret = fs->apply_transaction(t); + ret = fs->apply_transaction(&osr, t); if (ret < 0) { cerr << "Error writing OSD superblock: " << cpp_strerror(ret) << std::endl; goto out; @@ -2826,7 +2843,7 @@ int main(int argc, char **argv) ret = write_info(*t, map_epoch, info, past_intervals); if (ret == 0) { - fs->apply_transaction(*t); + fs->apply_transaction(&osr, *t); cout << "Removal succeeded" << std::endl; } } else if (op == "mark-complete") { @@ -2852,7 +2869,7 @@ int main(int argc, char **argv) ret = write_info(*t, map_epoch, info, past_intervals); if (ret == 0) { - fs->apply_transaction(*t); + fs->apply_transaction(&osr, *t); cout << "Marking complete succeeded" << std::endl; } } else {