#if GTEST_HAS_PARAM_TEST
+template <typename T>
+int apply_transaction(
+ T &store,
+ ObjectStore::Sequencer *osr,
+ ObjectStore::Transaction &&t) {
+ if (rand() % 2) {
+ ObjectStore::Transaction t2;
+ t2.append(t);
+ return store->apply_transaction(osr, std::move(t2));
+ } else {
+ return store->apply_transaction(osr, std::move(t));
+ }
+}
+
class StoreTest : public ::testing::TestWithParam<const char*> {
public:
boost::scoped_ptr<ObjectStore> store;
ObjectStore::Transaction t;
t.create_collection(cid, 0);
t.write(cid, hoid, 0, bl.length(), bl);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
store->umount();
{
ObjectStore::Transaction t;
t.write(cid, hoid2, 0, bl.length(), bl);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, hoid2);
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
store->umount();
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bool exists = store->exists(cid, hoid);
ASSERT_TRUE(!exists);
ObjectStore::Transaction t;
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ghobject_t hoid(hobject_t(sobject_t("Object " + stringify(n), CEPH_NOSNAP)));
t.write(cid, hoid, 0, bl.length(), bl);
}
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
// overwrites
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(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
t.remove(cid, hoid);
}
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
t.create_collection(cid, 0);
t.touch(cid, oid);
t.truncate(cid, oid, 100000);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, oid);
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
t.write(cid, oid, 0, 3, bl);
t.write(cid, oid, 1048576, 3, bl);
t.write(cid, oid, 4194304, 3, bl);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, oid);
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "create collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "add collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 4);
cerr << "create collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 4);
cerr << "add collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
::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(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove_collection(cid);
cerr << "remove collection" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
// Revert the config change so that it does not affect the split/merge tests
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.touch(cid, hoid);
cerr << "Creating object " << hoid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
exists = store->exists(cid, hoid);
t.remove(cid, hoid);
t.touch(cid, hoid);
cerr << "Remove then create" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, hoid);
t.write(cid, hoid, 0, 5, bl);
cerr << "Remove then create" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bufferlist in;
exp.append(bl);
t.write(cid, hoid, 5, 5, bl);
cerr << "Append" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bufferlist in;
exp = bl;
t.write(cid, hoid, 0, 10, bl);
cerr << "Full overwrite" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bufferlist in;
bl.append("abcde");
t.write(cid, hoid, 3, 5, bl);
cerr << "Partial overwrite" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bufferlist in, exp;
bl.append("abcde01234012340123401234abcde01234012340123401234abcde01234012340123401234abcde01234012340123401234");
t.write(cid, hoid, 0, bl.length(), bl);
cerr << "larger overwrite" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bufferlist in;
t.remove(cid, hoid);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
bufferlist bl;
for (int i=0; i<100; ++i) {
ObjectStore::Transaction t;
t.write(cid, a, i*4096, 4096, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(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(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, b);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.touch(cid, a);
t.truncate(cid, a, 3000);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
bl.append(bp);
ObjectStore::Transaction t;
t.write(cid, a, 4096, 4096, bl);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, a);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
bufferlist bl;
for (int i=0; i<1000; ++i) {
ObjectStore::Transaction t;
t.write(cid, a, i*len, len, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, a);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
bufferlist bl;
for (int i=0; i<10; ++i) {
ObjectStore::Transaction t;
t.write(cid, a, i*4*1048586, 4*1048576, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
// aligned
for (int i=0; i<10; ++i) {
ObjectStore::Transaction t;
t.write(cid, b, (rand() % 256)*4*1048576, 4*1048576, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
// unaligned
for (int i=0; i<10; ++i) {
ObjectStore::Transaction t;
t.write(cid, b, (rand() % (256*4096))*1024, 4*1048576, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
// do some zeros
for (int i=0; i<10; ++i) {
ObjectStore::Transaction t;
t.zero(cid, b, (rand() % (256*4096))*1024, 16*1048576);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, b);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
bufferlist bl;
{
ObjectStore::Transaction t;
t.write(cid, a, 0, 524288, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.write(cid, a, 1048576, 524288, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
{
ObjectStore::Transaction t;
t.write(cid, a, 1048576 - 4096, 524288, bl, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, a);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.touch(cid, hoid);
t.setattr(cid, hoid, "foo", val);
t.setattr(cid, hoid, "bar", val2);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
set<ghobject_t, ghobject_t::BitwiseComparator> all;
t.touch(cid, hoid);
cerr << "Creating object " << hoid << std::endl;
}
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
for (int bitwise=0; bitwise<2; ++bitwise) {
t.remove(cid, *p);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
set<ghobject_t, ghobject_t::BitwiseComparator> all, saw;
t.touch(cid, hoid);
cerr << "Creating object " << hoid << std::endl;
}
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, *p);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP),
t.write(cid, hoid, 0, small.length(), small);
t.write(cid, hoid, 10, small.length(), small);
cerr << "Creating object and set attr " << hoid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP),
t.setattr(cid, hoid, "attr1", large);
t.setattr(cid, hoid, "attr2", small);
cerr << "Clone object and rm attr" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
r = store->read(cid, hoid, 10, 5, newdata);
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove(cid, hoid2);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
}
{
bufferlist final;
al.append(a);
final.append(a);
t.write(cid, hoid, pl.length(), a.length(), al);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bufferlist rl;
ASSERT_EQ((int)final.length(),
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove(cid, hoid2);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
}
{
bufferlist final;
al.append(a);
final.append(a);
t.write(cid, hoid, pl.length() + z.length(), a.length(), al);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
bufferlist rl;
ASSERT_EQ((int)final.length(),
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove(cid, hoid2);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
}
{
bufferlist final;
al.append(a);
final.append(a);
t.write(cid, hoid, 17000, a.length(), al);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
bufferlist rl;
ASSERT_EQ((int)final.length(),
store->read(cid, hoid, 0, final.length(), rl));
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove(cid, hoid2);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
}
{
bufferptr p(1048576);
bufferlist al;
al.append(a);
t.write(cid, hoid, a.length(), a.length(), al);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
bufferlist rl;
bufferlist final;
final.substr_of(pl, 0, al.length());
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove(cid, hoid2);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
}
{
bufferptr p(65536);
bufferlist al;
al.append(a);
t.write(cid, hoid, 32768, a.length(), al);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
bufferlist rl;
bufferlist final;
final.substr_of(pl, 0, 32768);
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove(cid, hoid2);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
}
{
bufferptr p(65536);
bufferlist al;
al.append(a);
t.write(cid, hoid, 33768, a.length(), al);
- ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
+ ASSERT_EQ(0u, apply_transaction(store, &osr, std::move(t)));
bufferlist rl;
bufferlist final;
final.substr_of(pl, 0, 33768);
t.remove(cid, hoid2);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid(hobject_t(sobject_t("omap_obj", CEPH_NOSNAP),
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(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
// get header, keys
t.remove(cid, hoid);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP),
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(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP),
ObjectStore::Transaction t;
t.clone(cid, hoid, hoid2);
cerr << "Clone object" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, hoid2);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP)));
ObjectStore::Transaction t;
t.write(cid, hoid, 10, 5, small);
cerr << "Creating object and write bl " << hoid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP)));
ObjectStore::Transaction t;
t.clone_range(cid, hoid, hoid2, 10, 5, 0);
cerr << "Clone range object" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
r = store->read(cid, hoid2, 0, 5, newdata);
ASSERT_EQ(r, 5);
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(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
struct stat stat, stat2;
r = store->stat(cid, hoid, &stat);
t.remove(cid, hoid2);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ghobject_t hoid(hobject_t(sobject_t("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaObjectaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1", CEPH_NOSNAP)));
ObjectStore::Transaction t;
t.touch(cid, hoid);
cerr << "Creating object " << hoid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
t.remove(cid, hoid);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
cerr << "Creating collection " << cid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
for (unsigned i = 0; i < 320; ++i) {
ghobject_t hoid = generate_long_name(i);
t.touch(cid, hoid);
cerr << "Creating object " << hoid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
}
ghobject_t test_obj = generate_long_name(319);
t.collection_move_rename(
cid, test_obj,
cid, test_obj_2);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
}
for (unsigned i = 0; i < 319; ++i) {
ghobject_t hoid = generate_long_name(i);
t.remove(cid, hoid);
cerr << "Removing object " << hoid << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
}
{
ObjectStore::Transaction t;
t.remove(cid, test_obj_2);
t.remove_collection(cid);
cerr << "Cleaning" << std::endl;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
for (int i = 0; i < NUM_OBJS; ++i) {
ghobject_t hoid(hobject_t(sobject_t(string(buf) + base, CEPH_NOSNAP)));
t.touch(cid, hoid);
created.insert(hoid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
++i) {
ObjectStore::Transaction t;
t.remove(cid, *i);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
cerr << "cleaning up" << std::endl;
{
ObjectStore::Transaction t;
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
int init() {
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- return store->apply_transaction(osr, std::move(t));
+ return apply_transaction(store, osr, std::move(t));
}
void shutdown() {
while (1) {
p != objects.end(); ++p) {
t.remove(cid, *p);
}
- store->apply_transaction(osr, std::move(t));
+ apply_transaction(store, osr, std::move(t));
}
ObjectStore::Transaction t;
t.remove_collection(cid);
- store->apply_transaction(osr, std::move(t));
+ apply_transaction(store, osr, std::move(t));
}
ghobject_t get_uniform_random_object() {
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
string base = "";
{
ObjectStore::Transaction t;
t.touch(cid, hoid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
created.insert(hoid);
++i) {
ObjectStore::Transaction t;
t.remove(cid, *i);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
string base = "aaaaa";
{
ObjectStore::Transaction t;
t.touch(cid, hoid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
created.insert(hoid);
t.touch(cid, hoid1);
t.touch(cid, hoid2);
t.touch(cid, hoid3);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
created.insert(hoid1);
created.insert(hoid2);
created.insert(hoid3);
++i) {
ObjectStore::Transaction t;
t.remove(cid, *i);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
t.omap_clear(cid, hoid);
map<string, bufferlist> start_set;
t.omap_setkeys(cid, hoid, start_set);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
}
for (int i = 0; i < 100; i++) {
to_add.insert(pair<string, bufferlist>("key-" + string(buf), bl));
attrs.insert(pair<string, bufferlist>("key-" + string(buf), bl));
t.omap_setkeys(cid, hoid, to_add);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
}
int i = 0;
set<string> keys_to_remove;
keys_to_remove.insert(to_remove);
t.omap_rmkeys(cid, hoid, keys_to_remove);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
attrs.erase(to_remove);
bl1.append("omap_header");
ObjectStore::Transaction t;
t.omap_setheader(cid, hoid, bl1);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
t = ObjectStore::Transaction();
bufferlist bl2;
map<string, bufferlist> to_add;
to_add.insert(pair<string, bufferlist>("key", bl2));
t.omap_setkeys(cid, hoid, to_add);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
bufferlist bl3;
map<string, bufferlist> cur_attrs;
t.touch(cid, hoid);
t.omap_setheader(cid, hoid, h);
t.omap_setkeys(cid, hoid, to_set);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
}
{
ObjectStore::Transaction t;
t.omap_rmkeyrange(cid, hoid, "3", "7");
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
}
{
bufferlist hdr;
{
ObjectStore::Transaction t;
t.omap_clear(cid, hoid);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
}
{
bufferlist hdr;
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
t.omap_clear(cid, hoid);
map<string, bufferlist> start_set;
t.omap_setkeys(cid, hoid, start_set);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
}
ObjectMap::ObjectMapIterator iter;
bool correct;
attrs.insert(pair<string, bufferlist>("key-" + string(buf), bl));
ObjectStore::Transaction t;
t.omap_setkeys(cid, hoid, to_add);
- store->apply_transaction(&osr, std::move(t));
+ apply_transaction(store, &osr, std::move(t));
}
iter = store->get_omap_iterator(cid, hoid);
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
t.touch(cid, hoid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
attrs["attr4"] = big;
t.setattr(cid, hoid, "attr3", big);
attrs["attr3"] = big;
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.rmattr(cid, hoid, "attr2");
attrs.erase("attr2");
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.remove(cid, hoid);
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, common_suffix_size);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
i<<common_suffix_size,
52, "")));
}
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(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<<common_suffix_size, tid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
t.remove_collection(cid);
t.remove_collection(tid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
std::cout << "Making objects" << std::endl;
}
o.hobj.set_hash((i << 16) | 0xB1);
t.touch(cid, o);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
std::cout << "Removing half" << std::endl;
o.hobj.pool = -1;
o.hobj.set_hash((i << 16) | 0xA1);
t.remove(cid, o);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
std::cout << "Checking" << std::endl;
t.remove(cid, o);
o.hobj.set_hash((i << 16) | 0xB1);
t.remove(cid, o);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
t.write(cid, srcoid, 0, a.length(), a);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ASSERT_TRUE(store->exists(cid, srcoid));
t.remove(cid, srcoid);
t.write(cid, srcoid, 0, b.length(), b);
t.setattr(cid, srcoid, "attr", b);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ASSERT_TRUE(store->exists(cid, srcoid));
t.collection_move_rename(cid, srcoid, cid, dstoid);
t.remove(cid, srcoid);
t.setattr(cid, srcoid, "attr", a);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ASSERT_TRUE(store->exists(cid, dstoid));
t.remove(cid, dstoid);
t.remove(cid, srcoid);
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
t.touch(cid, oid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ASSERT_TRUE(store->exists(cid, oid));
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(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ASSERT_TRUE(store->exists(cid, temp_oid));
ObjectStore::Transaction t;
t.remove(cid, oid);
t.collection_move_rename(cid, temp_oid, cid, oid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ASSERT_TRUE(store->exists(cid, oid));
ObjectStore::Transaction t;
t.remove(cid, oid);
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
t.collection_move_rename(cid, oidhead, cid, oid);
t.touch(cid, oidhead);
t.collection_move_rename(cid, oidhead, cid, oid2);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove(cid, oid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.remove(cid, oid2);
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
ObjectStore::Transaction t;
t.create_collection(cid, 0);
t.touch(cid, hoid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove(cid, hoid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.set_alloc_hint(cid, hoid, 4*1024*1024, 1024*4);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.remove_collection(cid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
}
{
ObjectStore::Transaction t;
t.create_collection(cid, 0);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.try_rename(cid, hoid, hoid2);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.touch(cid, hoid);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
{
ObjectStore::Transaction t;
t.try_rename(cid, hoid, hoid2);
- r = store->apply_transaction(&osr, std::move(t));
+ r = apply_transaction(store, &osr, std::move(t));
ASSERT_EQ(r, 0);
}
struct stat st;