]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: Deleting transaction object right after applying transaction 7271/head
authorSomnath Roy <somnath.roy@sandisk.com>
Mon, 18 Jan 2016 19:48:24 +0000 (14:48 -0500)
committerSomnath Roy <somnath.roy@sandisk.com>
Wed, 27 Jan 2016 22:43:37 +0000 (17:43 -0500)
Presently, the transaction object is been deleted by the Finisher
thread asynchronously. In heavy load scenario specially if we
unleash journal throttle more, we are seeing high memory usage by
the OSDs because of this. In this new scheme, with the help of
move semantics transaction objects will be deleted synchronously
from the filestore worker threads. We are seeing very much
controllable memory growth now as well as ~3 to 4% cpu usage
benefit because of some reduction of 'new' , 'delete' calls.

Signed-off-by: Somnath Roy <somnath.roy@sandisk.com>
38 files changed:
src/os/FuseStore.cc
src/os/ObjectStore.cc
src/os/ObjectStore.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/filestore/FileJournal.cc
src/os/filestore/FileJournal.h
src/os/filestore/FileStore.cc
src/os/filestore/FileStore.h
src/os/filestore/Journal.h
src/os/filestore/JournalingObjectStore.cc
src/os/filestore/JournalingObjectStore.h
src/os/kstore/KStore.cc
src/os/kstore/KStore.h
src/os/memstore/MemStore.cc
src/os/memstore/MemStore.h
src/osd/ECBackend.cc
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PGBackend.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h
src/test/bench/small_io_bench_fs.cc
src/test/bench/testfilestore_backend.cc
src/test/objectstore/DeterministicOpSequence.cc
src/test/objectstore/FileStoreTracker.cc
src/test/objectstore/TestObjectStoreState.cc
src/test/objectstore/TestObjectStoreState.h
src/test/objectstore/store_test.cc
src/test/objectstore/test_idempotent.cc
src/test/objectstore/workload_generator.cc
src/test/objectstore/workload_generator.h
src/test/objectstore_bench.cc
src/test/test_filejournal.cc
src/test/test_trans.cc
src/test/xattr_bench.cc
src/tools/ceph_objectstore_tool.cc

index 4d5d7e42b39fa1909eb714fd19348cbe86479d62..b9c23a64f8849db9325cf9ef56748166a0da84fe 100644 (file)
@@ -676,7 +676,7 @@ static int os_mkdir(const char *path, mode_t mode)
   if (!t.empty()) {
     ceph::shared_ptr<ObjectStore::Sequencer> osr(
       new ObjectStore::Sequencer("fuse"));
-    fs->store->apply_transaction(&*osr, t);
+    fs->store->apply_transaction(&*osr, std::move(t));
     C_SaferCond waiter;
     if (!osr->flush_commit(&waiter))
       waiter.wait();
@@ -747,7 +747,7 @@ static int os_create(const char *path, mode_t mode, struct fuse_file_info *fi)
   if (!t.empty()) {
     ceph::shared_ptr<ObjectStore::Sequencer> osr(
       new ObjectStore::Sequencer("fuse"));
-    fs->store->apply_transaction(&*osr, t);
+    fs->store->apply_transaction(&*osr, std::move(t));
     C_SaferCond waiter;
     if (!osr->flush_commit(&waiter))
       waiter.wait();
@@ -857,7 +857,7 @@ int os_flush(const char *path, struct fuse_file_info *fi)
 
   ceph::shared_ptr<ObjectStore::Sequencer> osr(
     new ObjectStore::Sequencer("fuse"));
-  fs->store->apply_transaction(&*osr, t);
+  fs->store->apply_transaction(&*osr, std::move(t));
   C_SaferCond waiter;
   if (!osr->flush_commit(&waiter))
     waiter.wait();
@@ -920,7 +920,7 @@ static int os_unlink(const char *path)
 
   ceph::shared_ptr<ObjectStore::Sequencer> osr(
     new ObjectStore::Sequencer("fuse"));
-  fs->store->apply_transaction(&*osr, t);
+  fs->store->apply_transaction(&*osr, std::move(t));
   C_SaferCond waiter;
   if (!osr->flush_commit(&waiter))
     waiter.wait();
@@ -955,7 +955,7 @@ static int os_truncate(const char *path, off_t size)
   t.truncate(cid, oid, size);
   ceph::shared_ptr<ObjectStore::Sequencer> osr(
     new ObjectStore::Sequencer("fuse"));
-  fs->store->apply_transaction(&*osr, t);
+  fs->store->apply_transaction(&*osr, std::move(t));
   C_SaferCond waiter;
   if (!osr->flush_commit(&waiter))
     waiter.wait();
index 93afd84896ef94a6ae61967b3d534c2701b7dcd8..ba638bfad96c25e322b7ba006c6adbe68f60a4a3 100644 (file)
@@ -143,8 +143,13 @@ ostream& operator<<(ostream& out, const ObjectStore::Sequencer& s)
   return out << "osr(" << s.get_name() << " " << &s << ")";
 }
 
+ostream& operator<<(ostream& out, const ObjectStore::Transaction& tx) {
+
+  return out << "Transaction(" << &tx << ")"; 
+}
+
 unsigned ObjectStore::apply_transactions(Sequencer *osr,
-                                        list<Transaction*> &tls,
+                                        vector<Transaction>& tls,
                                         Context *ondisk)
 {
   // use op pool
@@ -165,7 +170,7 @@ unsigned ObjectStore::apply_transactions(Sequencer *osr,
 
 int ObjectStore::queue_transactions(
   Sequencer *osr,
-  list<Transaction*>& tls,
+  vector<Transaction>& tls,
   Context *onreadable,
   Context *oncommit,
   Context *onreadable_sync,
index fa92061677aee59c3b8148c7723201f7c76ca847..cc8b78374ba872e525885e68cfaaa0e88d9daaed 100644 (file)
@@ -585,7 +585,7 @@ public:
     }
 
     static void collect_contexts(
-      list<Transaction *> &t,
+      vector<Transaction>& t,
       Context **out_on_applied,
       Context **out_on_commit,
       Context **out_on_applied_sync) {
@@ -593,12 +593,12 @@ public:
       assert(out_on_commit);
       assert(out_on_applied_sync);
       list<Context *> on_applied, on_commit, on_applied_sync;
-      for (list<Transaction *>::iterator i = t.begin();
+      for (vector<Transaction>::iterator i = t.begin();
           i != t.end();
           ++i) {
-       on_applied.splice(on_applied.end(), (*i)->on_applied);
-       on_commit.splice(on_commit.end(), (*i)->on_commit);
-       on_applied_sync.splice(on_applied_sync.end(), (*i)->on_applied_sync);
+       on_applied.splice(on_applied.end(), (*i).on_applied);
+       on_commit.splice(on_commit.end(), (*i).on_commit);
+       on_applied_sync.splice(on_applied_sync.end(), (*i).on_applied_sync);
       }
       *out_on_applied = C_Contexts::list_to_context(on_applied);
       *out_on_commit = C_Contexts::list_to_context(on_commit);
@@ -1792,71 +1792,45 @@ public:
     static void generate_test_instances(list<Transaction*>& o);
   };
 
-  struct C_DeleteTransaction : public Context {
-    ObjectStore::Transaction *t;
-    C_DeleteTransaction(ObjectStore::Transaction *tt) : t(tt) {}
-    void finish(int r) {
-      delete t;
-    }
-  };
-  template<class T>
-  struct C_DeleteTransactionHolder : public Context {
-    ObjectStore::Transaction *t;
-    T obj;
-    C_DeleteTransactionHolder(ObjectStore::Transaction *tt, T &obj) :
-      t(tt), obj(obj) {}
-    void finish(int r) {
-      delete t;
-    }
-  };
-
   // synchronous wrappers
-  unsigned apply_transaction(Sequencer *osr, Transaction& t, Context *ondisk=0) {
-    list<Transaction*> tls;
-    tls.push_back(&t);
+  unsigned apply_transaction(Sequencer *osr, Transaction&& t, Context *ondisk=0) {
+    vector<Transaction> tls;
+    tls.push_back(std::move(t));
     return apply_transactions(osr, tls, ondisk);
   }
-  unsigned apply_transactions(Sequencer *osr, list<Transaction*>& tls, Context *ondisk=0);
-
-  int queue_transaction_and_cleanup(Sequencer *osr, Transaction* t,
-                                   ThreadPool::TPHandle *handle = NULL) {
-    list<Transaction *> tls;
-    tls.push_back(t);
-    return queue_transactions(osr, tls, new C_DeleteTransaction(t),
-                             NULL, NULL, TrackedOpRef(), handle);
-  }
+  unsigned apply_transactions(Sequencer *osr, vector<Transaction>& tls, Context *ondisk=0);
 
-  int queue_transaction(Sequencer *osr, Transaction *t, Context *onreadable, Context *ondisk=0,
+  int queue_transaction(Sequencer *osr, Transaction&& t, Context *onreadable, Context *ondisk=0,
                                Context *onreadable_sync=0,
                                TrackedOpRef op = TrackedOpRef(),
                                ThreadPool::TPHandle *handle = NULL) {
-    list<Transaction*> tls;
-    tls.push_back(t);
+    vector<Transaction> tls;
+    tls.push_back(std::move(t));
     return queue_transactions(osr, tls, onreadable, ondisk, onreadable_sync,
                              op, handle);
   }
 
-  int queue_transactions(Sequencer *osr, list<Transaction*>& tls,
+  int queue_transactions(Sequencer *osr, vector<Transaction>& tls,
                         Context *onreadable, Context *ondisk=0,
                         Context *onreadable_sync=0,
                         TrackedOpRef op = TrackedOpRef(),
                         ThreadPool::TPHandle *handle = NULL) {
     assert(!tls.empty());
-    tls.back()->register_on_applied(onreadable);
-    tls.back()->register_on_commit(ondisk);
-    tls.back()->register_on_applied_sync(onreadable_sync);
+    tls.back().register_on_applied(onreadable);
+    tls.back().register_on_commit(ondisk);
+    tls.back().register_on_applied_sync(onreadable_sync);
     return queue_transactions(osr, tls, op, handle);
   }
 
   virtual int queue_transactions(
-    Sequencer *osr, list<Transaction*>& tls,
+    Sequencer *osr, vector<Transaction>& tls,
     TrackedOpRef op = TrackedOpRef(),
     ThreadPool::TPHandle *handle = NULL) = 0;
 
 
   int queue_transactions(
     Sequencer *osr,
-    list<Transaction*>& tls,
+    vector<Transaction>& tls,
     Context *onreadable,
     Context *oncommit,
     Context *onreadable_sync,
@@ -1865,14 +1839,15 @@ public:
 
   int queue_transaction(
     Sequencer *osr,
-    Transaction* t,
+    Transaction&& t,
     Context *onreadable,
     Context *oncommit,
     Context *onreadable_sync,
     Context *oncomplete,
     TrackedOpRef op) {
-    list<Transaction*> tls;
-    tls.push_back(t);
+
+    vector<Transaction> tls;
+    tls.push_back(std::move(t));
     return queue_transactions(
       osr, tls, onreadable, oncommit, onreadable_sync, oncomplete, op);
   }
@@ -2385,5 +2360,6 @@ static inline void intrusive_ptr_release(ObjectStore::Sequencer_impl *s) {
 }
 
 ostream& operator<<(ostream& out, const ObjectStore::Sequencer& s);
+ostream& operator<<(ostream& out, const ObjectStore::Transaction& tx);
 
 #endif
index 3a02b17ffb84523df6cd53712bbc57f347e23243..1af33bee1b99bd25e31ccafc0d2ba06ae6feace3 100644 (file)
@@ -4066,7 +4066,7 @@ int BlueStore::_wal_replay()
 
 int BlueStore::queue_transactions(
     Sequencer *posr,
-    list<Transaction*>& tls,
+    vector<Transaction>& tls,
     TrackedOpRef op,
     ThreadPool::TPHandle *handle)
 {
@@ -4096,11 +4096,11 @@ int BlueStore::queue_transactions(
   txc->onreadable_sync = onreadable_sync;
   txc->oncommit = ondisk;
 
-  for (list<Transaction*>::iterator p = tls.begin(); p != tls.end(); ++p) {
-    (*p)->set_osr(osr);
-    txc->ops += (*p)->get_num_ops();
-    txc->bytes += (*p)->get_num_bytes();
-    _txc_add_transaction(txc, *p);
+  for (vector<Transaction>::iterator p = tls.begin(); p != tls.end(); ++p) {
+    (*p).set_osr(osr);
+    txc->ops += (*p).get_num_ops();
+    txc->bytes += (*p).get_num_bytes();
+    _txc_add_transaction(txc, &(*p));
   }
 
   r = _txc_finalize(osr, txc);
index a978da0eb97216c5229771e07d76759ca5df58d9..28ada142fb0b5e260e872c0d0bcc2f12f43c9d22 100644 (file)
@@ -778,7 +778,7 @@ public:
 
   int queue_transactions(
     Sequencer *osr,
-    list<Transaction*>& tls,
+    vector<Transaction>& tls,
     TrackedOpRef op = TrackedOpRef(),
     ThreadPool::TPHandle *handle = NULL);
 
index e331594446af7d860049eb2e4cdc04578cbc0f0e..2b41cf440d190c5ee62a7cd1f3a0517c692eff7c 100644 (file)
@@ -1584,20 +1584,19 @@ void FileJournal::check_aio_completion()
 }
 #endif
 
-int FileJournal::prepare_entry(list<ObjectStore::Transaction*>& tls, bufferlist* tbl) {
+int FileJournal::prepare_entry(vector<ObjectStore::Transaction>& tls, bufferlist* tbl) {
   dout(10) << "prepare_entry " << tls << dendl;
   unsigned data_len = 0;
   int data_align = -1; // -1 indicates that we don't care about the alignment
   bufferlist bl;
-  for (list<ObjectStore::Transaction*>::iterator p = tls.begin();
+  for (vector<ObjectStore::Transaction>::iterator p = tls.begin();
       p != tls.end(); ++p) {
-    ObjectStore::Transaction *t = *p;
-    if (t->get_data_length() > data_len &&
-     (int)t->get_data_length() >= g_conf->journal_align_min_size) {
-     data_len = t->get_data_length();
-     data_align = (t->get_data_alignment() - bl.length()) & ~CEPH_PAGE_MASK;
+   if ((*p).get_data_length() > data_len &&
+     (int)(*p).get_data_length() >= g_conf->journal_align_min_size) {
+     data_len = (*p).get_data_length();
+     data_align = ((*p).get_data_alignment() - bl.length()) & ~CEPH_PAGE_MASK;
     }
-    ::encode(*t, bl);
+    ::encode(*p, bl);
   }
   if (tbl->length()) {
     bl.claim_append(*tbl);
index 69935a61849fb4974460d83143db4fe097ab59bd..07d99f48ae5c8e7b9fda08101c58f3fa95e8cc62 100644 (file)
@@ -98,7 +98,7 @@ public:
     completions.pop_front();
   }
 
-  int prepare_entry(list<ObjectStore::Transaction*>& tls, bufferlist* tbl);
+  int prepare_entry(vector<ObjectStore::Transaction>& tls, bufferlist* tbl);
 
   void submit_entry(uint64_t seq, bufferlist& bl, uint32_t orig_len,
                    Context *oncommit,
index 7aa64ebffe5c527fe07fe987cfd309045bce1193..7aecad12cb1aeb515eadb57f6ebb5942143a8803 100644 (file)
@@ -1774,22 +1774,22 @@ int FileStore::umount()
 
 /// -----------------------------
 
-FileStore::Op *FileStore::build_op(list<Transaction*>& tls,
+FileStore::Op *FileStore::build_op(vector<Transaction>& tls,
                                   Context *onreadable,
                                   Context *onreadable_sync,
                                   TrackedOpRef osd_op)
 {
   uint64_t bytes = 0, ops = 0;
-  for (list<Transaction*>::iterator p = tls.begin();
+  for (vector<Transaction>::iterator p = tls.begin();
        p != tls.end();
        ++p) {
-    bytes += (*p)->get_num_bytes();
-    ops += (*p)->get_num_ops();
+    bytes += (*p).get_num_bytes();
+    ops += (*p).get_num_ops();
   }
 
   Op *o = new Op;
   o->start = ceph_clock_now(g_ceph_context);
-  o->tls.swap(tls);
+  o->tls = std::move(tls);
   o->onreadable = onreadable;
   o->onreadable_sync = onreadable_sync;
   o->ops = ops;
@@ -1879,6 +1879,9 @@ void FileStore::_do_op(OpSequencer *osr, ThreadPool::TPHandle &handle)
   apply_manager.op_apply_finish(o->op);
   dout(10) << "_do_op " << o << " seq " << o->op << " r = " << r
           << ", finisher " << o->onreadable << " " << o->onreadable_sync << dendl;
+
+  o->tls.clear();
+
 }
 
 void FileStore::_finish_op(OpSequencer *osr)
@@ -1923,7 +1926,7 @@ struct C_JournaledAhead : public Context {
   }
 };
 
-int FileStore::queue_transactions(Sequencer *posr, list<Transaction*> &tls,
+int FileStore::queue_transactions(Sequencer *posr, vector<Transaction>& tls,
                                  TrackedOpRef osd_op,
                                  ThreadPool::TPHandle *handle)
 {
@@ -1956,8 +1959,8 @@ int FileStore::queue_transactions(Sequencer *posr, list<Transaction*> &tls,
   }
 
   // used to include osr information in tracepoints during transaction apply
-  for (list<ObjectStore::Transaction*>::iterator i = tls.begin(); i != tls.end(); ++i) {
-    (*i)->set_osr(osr);
+  for (vector<Transaction>::iterator i = tls.begin(); i != tls.end(); ++i) {
+    (*i).set_osr(osr);
   }
 
   if (journal && journal->is_writeable() && !m_filestore_journal_trailing) {
@@ -2078,16 +2081,16 @@ void FileStore::_journaled_ahead(OpSequencer *osr, Op *o, Context *ondisk)
 }
 
 int FileStore::_do_transactions(
-  list<Transaction*> &tls,
+  vector<Transaction> &tls,
   uint64_t op_seq,
   ThreadPool::TPHandle *handle)
 {
   int trans_num = 0;
 
-  for (list<Transaction*>::iterator p = tls.begin();
+  for (vector<Transaction>::iterator p = tls.begin();
        p != tls.end();
        ++p, trans_num++) {
-    _do_transaction(**p, op_seq, trans_num, handle);
+    _do_transaction(*p, op_seq, trans_num, handle);
     if (handle)
       handle->reset_tp_timeout();
   }
@@ -5526,16 +5529,16 @@ void FileStore::dump_stop()
   }
 }
 
-void FileStore::dump_transactions(list<ObjectStore::Transaction*>& ls, uint64_t seq, OpSequencer *osr)
+void FileStore::dump_transactions(vector<ObjectStore::Transaction>& ls, uint64_t seq, OpSequencer *osr)
 {
   m_filestore_dump_fmt.open_array_section("transactions");
   unsigned trans_num = 0;
-  for (list<ObjectStore::Transaction*>::iterator i = ls.begin(); i != ls.end(); ++i, ++trans_num) {
+  for (vector<ObjectStore::Transaction>::iterator i = ls.begin(); i != ls.end(); ++i, ++trans_num) {
     m_filestore_dump_fmt.open_object_section("transaction");
     m_filestore_dump_fmt.dump_string("osr", osr->get_name());
     m_filestore_dump_fmt.dump_unsigned("seq", seq);
     m_filestore_dump_fmt.dump_unsigned("trans_num", trans_num);
-    (*i)->dump(&m_filestore_dump_fmt);
+    (*i).dump(&m_filestore_dump_fmt);
     m_filestore_dump_fmt.close_section();
   }
   m_filestore_dump_fmt.close_section();
index c3d8162236fa0907910aafee88a56f4aa9873565..93082fc3576fcff338f8a56822d001dade4be58b 100644 (file)
@@ -185,7 +185,7 @@ private:
   struct Op {
     utime_t start;
     uint64_t op;
-    list<Transaction*> tls;
+    vector<Transaction> tls;
     Context *onreadable, *onreadable_sync;
     uint64_t ops, bytes;
     TrackedOpRef osd_op;
@@ -378,7 +378,7 @@ private:
 
   void _do_op(OpSequencer *o, ThreadPool::TPHandle &handle);
   void _finish_op(OpSequencer *o);
-  Op *build_op(list<Transaction*>& tls,
+  Op *build_op(vector<Transaction>& tls,
               Context *onreadable, Context *onreadable_sync,
               TrackedOpRef osd_op);
   void queue_op(OpSequencer *osr, Op *o);
@@ -461,16 +461,16 @@ public:
   int statfs(struct statfs *buf);
 
   int _do_transactions(
-    list<Transaction*> &tls, uint64_t op_seq,
+    vector<Transaction> &tls, uint64_t op_seq,
     ThreadPool::TPHandle *handle);
-  int do_transactions(list<Transaction*> &tls, uint64_t op_seq) {
+  int do_transactions(vector<Transaction> &tls, uint64_t op_seq) {
     return _do_transactions(tls, op_seq, 0);
   }
   void _do_transaction(
     Transaction& t, uint64_t op_seq, int trans_num,
     ThreadPool::TPHandle *handle);
 
-  int queue_transactions(Sequencer *osr, list<Transaction*>& tls,
+  int queue_transactions(Sequencer *osr, vector<Transaction>& tls,
                         TrackedOpRef op = TrackedOpRef(),
                         ThreadPool::TPHandle *handle = NULL);
 
@@ -665,7 +665,7 @@ public:
 
   void dump_start(const std::string& file);
   void dump_stop();
-  void dump_transactions(list<ObjectStore::Transaction*>& ls, uint64_t seq, OpSequencer *osr);
+  void dump_transactions(vector<Transaction>& ls, uint64_t seq, OpSequencer *osr);
 
 private:
   void _inject_failure();
index 602e8ea7c36b608b827642c7baf238f94635a5bb..236e4315a35ca2d73f37734758a9abfbc1b052ed 100644 (file)
@@ -72,7 +72,7 @@ public:
 
   virtual bool should_commit_now() = 0;
 
-  virtual int prepare_entry(list<ObjectStore::Transaction*>& tls, bufferlist* tbl) = 0;
+  virtual int prepare_entry(vector<ObjectStore::Transaction>& tls, bufferlist* tbl) = 0;
 
   // reads/recovery
 
index e47b2e6e8b33ab76b357def0d91da045fda95449..4708d8a22e3c270e121a8f0489a3d8526c71dd80 100644 (file)
@@ -81,10 +81,9 @@ int JournalingObjectStore::journal_replay(uint64_t fs_op_seq)
 
     dout(3) << "journal_replay: applying op seq " << seq << dendl;
     bufferlist::iterator p = bl.begin();
-    list<Transaction*> tls;
+    vector<ObjectStore::Transaction> tls;
     while (!p.end()) {
-      Transaction *t = new Transaction(p);
-      tls.push_back(t);
+      tls.emplace_back(Transaction(p));
     }
 
     apply_manager.op_apply_start(seq);
@@ -93,11 +92,6 @@ int JournalingObjectStore::journal_replay(uint64_t fs_op_seq)
 
     op_seq = seq;
 
-    while (!tls.empty()) {
-      delete tls.front();
-      tls.pop_front();
-    }
-
     dout(3) << "journal_replay: r = " << r << ", op_seq now " << op_seq << dendl;
   }
 
index f384ba6a1b2da12a43bcb08961a8a42872a0889a..e7e50503b39357e6adba5106c2a4c43606c596a0 100644 (file)
@@ -118,7 +118,7 @@ protected:
   void _op_journal_transactions(bufferlist& tls, uint32_t orig_len, uint64_t op,
                                Context *onjournal, TrackedOpRef osd_op);
 
-  virtual int do_transactions(list<ObjectStore::Transaction*>& tls, uint64_t op_seq) = 0;
+  virtual int do_transactions(vector<ObjectStore::Transaction>& tls, uint64_t op_seq) = 0;
 
 public:
   bool is_committing() {
index dae95de19323659bbc3e3b9007e58ed63904b16e..e3292a3814c480f4c060a102da54d16cef912063 100644 (file)
@@ -2393,7 +2393,7 @@ void KStore::_kv_sync_thread()
 
 int KStore::queue_transactions(
     Sequencer *posr,
-    list<Transaction*>& tls,
+    vector<Transaction>& tls,
     TrackedOpRef op,
     ThreadPool::TPHandle *handle)
 {
@@ -2423,11 +2423,11 @@ int KStore::queue_transactions(
   txc->onreadable_sync = onreadable_sync;
   txc->oncommit = ondisk;
 
-  for (list<Transaction*>::iterator p = tls.begin(); p != tls.end(); ++p) {
-    (*p)->set_osr(osr);
-    txc->ops += (*p)->get_num_ops();
-    txc->bytes += (*p)->get_num_bytes();
-    _txc_add_transaction(txc, *p);
+  for (vector<Transaction>::iterator p = tls.begin(); p != tls.end(); ++p) {
+    (*p).set_osr(osr);
+    txc->ops += (*p).get_num_ops();
+    txc->bytes += (*p).get_num_bytes();
+    _txc_add_transaction(txc, &(*p));
   }
 
   r = _txc_finalize(osr, txc);
index b5664ffc3a4773164d5dff643966d1a52e86151f..8bf70f0246abafe57c0d332907b7b16731079ab3 100644 (file)
@@ -491,7 +491,7 @@ public:
 
   int queue_transactions(
     Sequencer *osr,
-    list<Transaction*>& tls,
+    vector<Transaction>& tls,
     TrackedOpRef op = TrackedOpRef(),
     ThreadPool::TPHandle *handle = NULL);
 
index 506af8ed5daa74ca71747bb4be942f9524252fe3..0e7e76769299d79807266734c6b98b28571ef1eb 100644 (file)
@@ -616,7 +616,7 @@ ObjectMap::ObjectMapIterator MemStore::get_omap_iterator(coll_t cid,
 // write operations
 
 int MemStore::queue_transactions(Sequencer *osr,
-                                list<Transaction*>& tls,
+                                vector<Transaction>& tls,
                                 TrackedOpRef op,
                                 ThreadPool::TPHandle *handle)
 {
@@ -637,12 +637,12 @@ int MemStore::queue_transactions(Sequencer *osr,
     lock = std::unique_lock<std::mutex>((*seq)->mutex);
   }
 
-  for (list<Transaction*>::iterator p = tls.begin(); p != tls.end(); ++p) {
+  for (vector<Transaction>::iterator p = tls.begin(); p != tls.end(); ++p) {
     // poke the TPHandle heartbeat just to exercise that code path
     if (handle)
       handle->reset_tp_timeout();
 
-    _do_transaction(**p);
+    _do_transaction(*p);
   }
 
   Context *on_apply = NULL, *on_apply_sync = NULL, *on_commit = NULL;
index 499b72dcd78dc4924aeac57bbf17bf075b22c705..8b56ddc430876ba9f093da74c7ab58a02dfbe19c 100644 (file)
@@ -477,7 +477,7 @@ public:
   objectstore_perf_stat_t get_cur_stats();
 
   int queue_transactions(
-    Sequencer *osr, list<Transaction*>& tls,
+    Sequencer *osr, vector<Transaction>& tls,
     TrackedOpRef op = TrackedOpRef(),
     ThreadPool::TPHandle *handle = NULL);
 };
index b9b1b04ec229ad6b57ccd31ab8fbfe0065bde61c..ba2e69daba473be9123b61a2ec4685b1e0e1af7b 100644 (file)
@@ -236,16 +236,15 @@ struct RecoveryMessages {
 
   map<pg_shard_t, vector<PushOp> > pushes;
   map<pg_shard_t, vector<PushReplyOp> > push_replies;
-  ObjectStore::Transaction *t;
-  RecoveryMessages() : t(NULL) {}
-  ~RecoveryMessages() { assert(!t); }
+  ObjectStore::Transaction t;
+  RecoveryMessages() {}
+  ~RecoveryMessages(){}
 };
 
 void ECBackend::handle_recovery_push(
   PushOp &op,
   RecoveryMessages *m)
 {
-  assert(m->t);
 
   bool oneshot = op.before_progress.first && op.after_progress.data_complete;
   ghobject_t tobj;
@@ -265,8 +264,8 @@ void ECBackend::handle_recovery_push(
   }
 
   if (op.before_progress.first) {
-    m->t->remove(coll, tobj);
-    m->t->touch(coll, tobj);
+    m->t.remove(coll, tobj);
+    m->t.touch(coll, tobj);
   }
 
   if (!op.data_included.empty()) {
@@ -274,7 +273,7 @@ void ECBackend::handle_recovery_push(
     uint64_t end = op.data_included.range_end();
     assert(op.data.length() == (end - start));
 
-    m->t->write(
+    m->t.write(
       coll,
       tobj,
       start,
@@ -286,7 +285,7 @@ void ECBackend::handle_recovery_push(
 
   if (op.before_progress.first) {
     assert(op.attrset.count(string("_")));
-    m->t->setattrs(
+    m->t.setattrs(
       coll,
       tobj,
       op.attrset);
@@ -296,9 +295,9 @@ void ECBackend::handle_recovery_push(
     dout(10) << __func__ << ": Removing oid "
             << tobj.hobj << " from the temp collection" << dendl;
     clear_temp_obj(tobj.hobj);
-    m->t->remove(coll, ghobject_t(
+    m->t.remove(coll, ghobject_t(
        op.soid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard));
-    m->t->collection_move_rename(
+    m->t.collection_move_rename(
       coll, tobj,
       coll, ghobject_t(
        op.soid, ghobject_t::NO_GEN, get_parent()->whoami_shard().shard));
@@ -315,14 +314,14 @@ void ECBackend::handle_recovery_push(
        stats,
        op.recovery_info,
        recovery_ops[op.soid].obc,
-       m->t);
+       &m->t);
     } else {
       get_parent()->on_local_recover(
        op.soid,
        object_stat_sum_t(),
        op.recovery_info,
        ObjectContextRef(),
-       m->t);
+       &m->t);
     }
   }
   m->push_replies[get_parent()->primary_shard()].push_back(PushReplyOp());
@@ -468,19 +467,14 @@ void ECBackend::dispatch_recovery_messages(RecoveryMessages &m, int priority)
   }
 
   if (!replies.empty()) {
-    m.t->register_on_complete(
+    (m.t).register_on_complete(
        get_parent()->bless_context(
          new SendPushReplies(
            get_parent(),
            get_parent()->get_epoch(),
            replies)));
-    m.t->register_on_applied(
-       new ObjectStore::C_DeleteTransaction(m.t));
-    get_parent()->queue_transaction(m.t);
-    m.t = NULL;
-  } else {
-    assert(!m.t);
-  }
+    get_parent()->queue_transaction(std::move(m.t));
+  } 
 
   if (m.reads.empty())
     return;
@@ -718,8 +712,6 @@ bool ECBackend::handle_message(
   case MSG_OSD_PG_PUSH: {
     MOSDPGPush *op = static_cast<MOSDPGPush *>(_op->get_req());
     RecoveryMessages rm;
-    rm.t = new ObjectStore::Transaction;
-    assert(rm.t);
     for (vector<PushOp>::iterator i = op->pushes.begin();
         i != op->pushes.end();
         ++i) {
@@ -841,8 +833,8 @@ void ECBackend::handle_sub_write(
   assert(!get_parent()->get_log().get_missing().is_missing(op.soid));
   if (!get_parent()->pgb_is_primary())
     get_parent()->update_stats(op.stats);
-  ObjectStore::Transaction *localt = new ObjectStore::Transaction;
-  localt->set_use_tbl(op.t.get_use_tbl());
+  ObjectStore::Transaction localt;
+  localt.set_use_tbl(op.t.get_use_tbl());
   if (!op.temp_added.empty()) {
     add_temp_objs(op.temp_added);
   }
@@ -852,7 +844,7 @@ void ECBackend::handle_sub_write(
         ++i) {
       dout(10) << __func__ << ": removing object " << *i
               << " since we won't get the transaction" << dendl;
-      localt->remove(
+      localt.remove(
        coll,
        ghobject_t(
          *i,
@@ -867,7 +859,7 @@ void ECBackend::handle_sub_write(
     op.trim_to,
     op.trim_rollback_to,
     !(op.t.empty()),
-    localt);
+    &localt);
 
   if (!(dynamic_cast<ReplicatedPG *>(get_parent())->is_undersized()) &&
       (unsigned)get_parent()->whoami_shard().shard >= ec_impl->get_data_chunk_count())
@@ -875,25 +867,21 @@ void ECBackend::handle_sub_write(
 
   if (on_local_applied_sync) {
     dout(10) << "Queueing onreadable_sync: " << on_local_applied_sync << dendl;
-    localt->register_on_applied_sync(on_local_applied_sync);
+    localt.register_on_applied_sync(on_local_applied_sync);
   }
-  localt->register_on_commit(
+  localt.register_on_commit(
     get_parent()->bless_context(
       new SubWriteCommitted(
        this, msg, op.tid,
        op.at_version,
        get_parent()->get_info().last_complete)));
-  localt->register_on_applied(
+  localt.register_on_applied(
     get_parent()->bless_context(
       new SubWriteApplied(this, msg, op.tid, op.at_version)));
-  localt->register_on_applied(
-    new ObjectStore::C_DeleteTransaction(localt));
-  list<ObjectStore::Transaction*> tls;
-  tls.push_back(localt);
-  tls.push_back(new ObjectStore::Transaction);
-  tls.back()->swap(op.t);
-  tls.back()->register_on_complete(
-    new ObjectStore::C_DeleteTransaction(tls.back()));
+  vector<ObjectStore::Transaction> tls;
+  tls.reserve(2);
+  tls.push_back(std::move(localt));
+  tls.push_back(std::move(op.t));
   get_parent()->queue_transactions(tls, msg);
 }
 
index e459758357301c583a4a8eec19f56692cb8e4546..a52a5571d2f65366e3a499de3ff1d20880a3ec85 100644 (file)
@@ -1428,7 +1428,7 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
     ObjectStore::Transaction t;
     t.create_collection(coll_t::meta(), 0);
     t.write(coll_t::meta(), OSD_SUPERBLOCK_POBJECT, 0, bl.length(), bl);
-    ret = store->apply_transaction(osr.get(), t);
+    ret = store->apply_transaction(osr.get(), std::move(t));
     if (ret) {
       derr << "OSD::mkfs: error while writing OSD_SUPERBLOCK_POBJECT: "
           << "apply_transaction returned " << ret << dendl;
@@ -1929,7 +1929,7 @@ int OSD::init()
     dout(5) << "Upgrading superblock adding: " << diff << dendl;
     ObjectStore::Transaction t;
     write_superblock(t);
-    r = store->apply_transaction(service.meta_osr.get(), t);
+    r = store->apply_transaction(service.meta_osr.get(), std::move(t));
     if (r < 0)
       goto out;
   }
@@ -1939,7 +1939,7 @@ int OSD::init()
     dout(10) << "init creating/touching snapmapper object" << dendl;
     ObjectStore::Transaction t;
     t.touch(coll_t::meta(), OSD::make_snapmapper_oid());
-    r = store->apply_transaction(service.meta_osr.get(), t);
+    r = store->apply_transaction(service.meta_osr.get(), std::move(t));
     if (r < 0)
       goto out;
   }
@@ -2493,7 +2493,7 @@ int OSD::shutdown()
   superblock.clean_thru = osdmap->get_epoch();
   ObjectStore::Transaction t;
   write_superblock(t);
-  int r = store->apply_transaction(service.meta_osr.get(), t);
+  int r = store->apply_transaction(service.meta_osr.get(), std::move(t));
   if (r) {
     derr << "OSD::shutdown: error writing superblock: "
         << cpp_strerror(r) << dendl;
@@ -2629,7 +2629,7 @@ void OSD::clear_temp_objects()
        dout(20) << "  removing " << *p << " object " << *q << dendl;
        t.remove(*p, *q);
       }
-      store->apply_transaction(service.meta_osr.get(), t);
+      store->apply_transaction(service.meta_osr.get(), std::move(t));
     }
   }
 }
@@ -2661,14 +2661,14 @@ void OSD::recursive_remove_collection(ObjectStore *store, spg_t pgid, coll_t tmp
       assert(0);
     t.remove(tmp, *p);
     if (removed > 300) {
-      int r = store->apply_transaction(osr.get(), t);
+      int r = store->apply_transaction(osr.get(), std::move(t));
       assert(r == 0);
       t = ObjectStore::Transaction();
       removed = 0;
     }
   }
   t.remove_collection(tmp);
-  int r = store->apply_transaction(osr.get(), t);
+  int r = store->apply_transaction(osr.get(), std::move(t));
   assert(r == 0);
 
   C_SaferCond waiter;
@@ -3049,7 +3049,7 @@ void OSD::load_pgs()
     dout(1) << __func__ << " removing legacy infos object" << dendl;
     ObjectStore::Transaction t;
     t.remove(coll_t::meta(), OSD::make_infos_oid());
-    int r = store->apply_transaction(service.meta_osr.get(), t);
+    int r = store->apply_transaction(service.meta_osr.get(), std::move(t));
     if (r != 0) {
       derr << __func__ << ": apply_transaction returned "
           << cpp_strerror(r) << dendl;
@@ -3218,13 +3218,13 @@ void OSD::build_past_intervals_parallel()
 
     // don't let the transaction get too big
     if (++num >= cct->_conf->osd_target_transaction_size) {
-      store->apply_transaction(service.meta_osr.get(), t);
+      store->apply_transaction(service.meta_osr.get(), std::move(t));
       t = ObjectStore::Transaction();
       num = 0;
     }
   }
   if (!t.empty())
-    store->apply_transaction(service.meta_osr.get(), t);
+    store->apply_transaction(service.meta_osr.get(), std::move(t));
 }
 
 /*
@@ -4207,7 +4207,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store,
       val.append(valstr);
       newattrs[key] = val;
       t.omap_setkeys(coll_t(pgid), ghobject_t(obj), newattrs);
-      r = store->apply_transaction(service->meta_osr.get(), t);
+      r = store->apply_transaction(service->meta_osr.get(), std::move(t));
       if (r < 0)
         ss << "error=" << r;
       else
@@ -4219,7 +4219,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store,
 
       keys.insert(key);
       t.omap_rmkeys(coll_t(pgid), ghobject_t(obj), keys);
-      r = store->apply_transaction(service->meta_osr.get(), t);
+      r = store->apply_transaction(service->meta_osr.get(), std::move(t));
       if (r < 0)
         ss << "error=" << r;
       else
@@ -4231,7 +4231,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store,
       cmd_getval(service->cct, cmdmap, "header", headerstr);
       newheader.append(headerstr);
       t.omap_setheader(coll_t(pgid), ghobject_t(obj), newheader);
-      r = store->apply_transaction(service->meta_osr.get(), t);
+      r = store->apply_transaction(service->meta_osr.get(), std::move(t));
       if (r < 0)
         ss << "error=" << r;
       else
@@ -4254,7 +4254,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store,
       int64_t trunclen;
       cmd_getval(service->cct, cmdmap, "len", trunclen);
       t.truncate(coll_t(pgid), ghobject_t(obj), trunclen);
-      r = store->apply_transaction(service->meta_osr.get(), t);
+      r = store->apply_transaction(service->meta_osr.get(), std::move(t));
       if (r < 0)
        ss << "error=" << r;
       else
@@ -4326,7 +4326,7 @@ bool remove_dir(
     t.remove(coll, *i);
     if (num >= cct->_conf->osd_target_transaction_size) {
       C_SaferCond waiter;
-      store->queue_transaction(osr, &t, &waiter);
+      store->queue_transaction(osr, std::move(t), &waiter);
       bool cont = dstate->pause_clearing();
       handle.suspend_tp_timeout();
       waiter.wait();
@@ -4339,9 +4339,8 @@ bool remove_dir(
       num = 0;
     }
   }
-
   C_SaferCond waiter;
-  store->queue_transaction(osr, &t, &waiter);
+  store->queue_transaction(osr, std::move(t), &waiter);
   bool cont = dstate->pause_clearing();
   handle.suspend_tp_timeout();
   waiter.wait();
@@ -4381,24 +4380,23 @@ void OSD::RemoveWQ::_process(
   if (!item.second->start_deleting())
     return;
 
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
-  PGLog::clear_info_log(pg->info.pgid, t);
+  ObjectStore::Transaction t;
+  PGLog::clear_info_log(pg->info.pgid, &t);
 
   if (g_conf->osd_inject_failure_on_pg_removal) {
     generic_derr << "osd_inject_failure_on_pg_removal" << dendl;
     exit(1);
   }
-  t->remove_collection(coll);
+  t.remove_collection(coll);
 
   // We need the sequencer to stick around until the op is complete
   store->queue_transaction(
     pg->osr.get(),
-    t,
+    std::move(t),
     0, // onapplied
     0, // oncommit
     0, // onreadable sync
-    new ObjectStore::C_DeleteTransactionHolder<PGRef>(
-      t, pg), // oncomplete
+    new ContainerContext<PGRef>(pg),
     TrackedOpRef());
 
   item.second->finish_deleting();
@@ -5296,7 +5294,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
     dout(1) << " bench count " << count
             << " bsize " << prettybyte_t(bsize) << dendl;
 
-    ObjectStore::Transaction *cleanupt = new ObjectStore::Transaction;
+    ObjectStore::Transaction cleanupt;
 
     if (osize && onum) {
       bufferlist bl;
@@ -5309,10 +5307,10 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
        snprintf(nm, sizeof(nm), "disk_bw_test_%d", i);
        object_t oid(nm);
        hobject_t soid(sobject_t(oid, 0));
-       ObjectStore::Transaction *t = new ObjectStore::Transaction;
-       t->write(coll_t(), ghobject_t(soid), 0, osize, bl);
-       store->queue_transaction_and_cleanup(osr.get(), t);
-       cleanupt->remove(coll_t(), ghobject_t(soid));
+       ObjectStore::Transaction t;
+       t.write(coll_t(), ghobject_t(soid), 0, osize, bl);
+       store->queue_transaction(osr.get(), std::move(t), NULL);
+       cleanupt.remove(coll_t(), ghobject_t(soid));
       }
     }
 
@@ -5341,11 +5339,11 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
       }
       object_t oid(nm);
       hobject_t soid(sobject_t(oid, 0));
-      ObjectStore::Transaction *t = new ObjectStore::Transaction;
-      t->write(coll_t::meta(), ghobject_t(soid), offset, bsize, bl);
-      store->queue_transaction_and_cleanup(osr.get(), t);
+      ObjectStore::Transaction t;
+      t.write(coll_t::meta(), ghobject_t(soid), offset, bsize, bl);
+      store->queue_transaction(osr.get(), std::move(t), NULL);
       if (!onum || !osize)
-       cleanupt->remove(coll_t::meta(), ghobject_t(soid));
+       cleanupt.remove(coll_t::meta(), ghobject_t(soid));
     }
 
     {
@@ -5357,7 +5355,7 @@ void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, buffe
     utime_t end = ceph_clock_now(cct);
 
     // clean up
-    store->queue_transaction_and_cleanup(osr.get(), cleanupt);
+    store->queue_transaction(osr.get(), std::move(cleanupt), NULL);
     {
       C_SaferCond waiter;
       if (!osr->flush_commit(&waiter)) {
@@ -6297,14 +6295,12 @@ void OSD::note_up_osd(int peer)
 
 struct C_OnMapApply : public Context {
   OSDService *service;
-  boost::scoped_ptr<ObjectStore::Transaction> t;
   list<OSDMapRef> pinned_maps;
   epoch_t e;
   C_OnMapApply(OSDService *service,
-              ObjectStore::Transaction *t,
               const list<OSDMapRef> &pinned_maps,
               epoch_t e)
-    : service(service), t(t), pinned_maps(pinned_maps), e(e) {}
+    : service(service), pinned_maps(pinned_maps), e(e) {}
   void finish(int r) {
     service->clear_map_bl_cache_pins(e);
   }
@@ -6393,8 +6389,7 @@ void OSD::handle_osd_map(MOSDMap *m)
     skip_maps = true;
   }
 
-  ObjectStore::Transaction *_t = new ObjectStore::Transaction;
-  ObjectStore::Transaction &t = *_t;
+  ObjectStore::Transaction t;
 
   // store new maps: queue for disk and put in the osdmap cache
   epoch_t start = MAX(osdmap->get_epoch() + 1, first);
@@ -6480,7 +6475,6 @@ void OSD::handle_osd_map(MOSDMap *m)
 
   if (last <= osdmap->get_epoch()) {
     dout(10) << " no new maps here, dropping" << dendl;
-    delete _t;
     m->put();
     return;
   }
@@ -6658,8 +6652,8 @@ void OSD::handle_osd_map(MOSDMap *m)
   write_superblock(t);
   store->queue_transaction(
     service.meta_osr.get(),
-    _t,
-    new C_OnMapApply(&service, _t, pinned_maps, osdmap->get_epoch()),
+    std::move(t),
+    new C_OnMapApply(&service, pinned_maps, osdmap->get_epoch()),
     0, 0);
   service.publish_superblock(superblock);
 
@@ -6760,9 +6754,9 @@ void OSD::check_osdmap_features(ObjectStore *fs)
        !superblock.compat_features.incompat.contains(CEPH_OSD_FEATURE_INCOMPAT_SHARDS)) {
       dout(0) << __func__ << " enabling on-disk ERASURE CODES compat feature" << dendl;
       superblock.compat_features.incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_SHARDS);
-      ObjectStore::Transaction *t = new ObjectStore::Transaction;
-      write_superblock(*t);
-      int err = store->queue_transaction_and_cleanup(service.meta_osr.get(), t);
+      ObjectStore::Transaction t;
+      write_superblock(t);
+      int err = store->queue_transaction(service.meta_osr.get(), std::move(t), NULL);
       assert(err == 0);
     }
   }
@@ -7312,11 +7306,11 @@ void OSD::dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg,
     if (!ctx.created_pgs.empty()) {
       ctx.on_applied->add(new C_OpenPGs(ctx.created_pgs, store));
     }
-    ctx.on_applied->add(new ObjectStore::C_DeleteTransaction(ctx.transaction));
     int tr = store->queue_transaction(
       pg->osr.get(),
-      ctx.transaction, ctx.on_applied, ctx.on_safe, NULL,
+      std::move(*ctx.transaction), ctx.on_applied, ctx.on_safe, NULL,
       TrackedOpRef(), handle);
+    delete (ctx.transaction);
     assert(tr == 0);
     ctx.transaction = new ObjectStore::Transaction;
     ctx.on_applied = new C_Contexts(cct);
@@ -7348,11 +7342,11 @@ void OSD::dispatch_context(PG::RecoveryCtx &ctx, PG *pg, OSDMapRef curmap,
     if (!ctx.created_pgs.empty()) {
       ctx.on_applied->add(new C_OpenPGs(ctx.created_pgs, store));
     }
-    ctx.on_applied->add(new ObjectStore::C_DeleteTransaction(ctx.transaction));
     int tr = store->queue_transaction(
       pg->osr.get(),
-      ctx.transaction, ctx.on_applied, ctx.on_safe, NULL, TrackedOpRef(),
+      std::move(*ctx.transaction), ctx.on_applied, ctx.on_safe, NULL, TrackedOpRef(),
       handle);
+    delete (ctx.transaction);
     assert(tr == 0);
   }
 }
@@ -7609,15 +7603,14 @@ void OSD::handle_pg_trim(OpRequestRef op)
       }
     } else {
       // primary is instructing us to trim
-      ObjectStore::Transaction *t = new ObjectStore::Transaction;
+      ObjectStore::Transaction t;
       PG::PGLogEntryHandler handler;
       pg->pg_log.trim(&handler, m->trim_to, pg->info);
-      handler.apply(pg, t);
+      handler.apply(pg, &t);
       pg->dirty_info = true;
-      pg->write_if_dirty(*t);
+      pg->write_if_dirty(t);
       int tr = store->queue_transaction(
-       pg->osr.get(), t,
-       new ObjectStore::C_DeleteTransaction(t));
+       pg->osr.get(), std::move(t), NULL);
       assert(tr == 0);
     }
     pg->unlock();
@@ -7894,20 +7887,18 @@ void OSD::handle_pg_remove(OpRequestRef op)
 
 void OSD::_remove_pg(PG *pg)
 {
-  ObjectStore::Transaction *rmt = new ObjectStore::Transaction;
+  ObjectStore::Transaction rmt ;
 
   // on_removal, which calls remove_watchers_and_notifies, and the erasure from
   // the pg_map must be done together without unlocking the pg lock,
   // to avoid racing with watcher cleanup in ms_handle_reset
   // and handle_notify_timeout
-  pg->on_removal(rmt);
+  pg->on_removal(&rmt);
 
   service.cancel_pending_splits_for_parent(pg->info.pgid);
 
   store->queue_transaction(
-    pg->osr.get(), rmt,
-    new ObjectStore::C_DeleteTransactionHolder<
-      SequencerRef>(rmt, pg->osr),
+    pg->osr.get(), std::move(rmt), NULL, 
     new ContainerContext<
       SequencerRef>(pg->osr));
 
index 1955be151621d9bc80abbadaddd567fa1191d512..01ea705d7f86bde9a911fe25df21511ae8da2de1 100644 (file)
@@ -1992,9 +1992,9 @@ void PG::_activate_committed(epoch_t epoch, epoch_t activation_epoch)
   }
 
   if (dirty_info) {
-    ObjectStore::Transaction *t = new ObjectStore::Transaction;
-    write_if_dirty(*t);
-    int tr = osd->store->queue_transaction_and_cleanup(osr.get(), t);
+    ObjectStore::Transaction t;
+    write_if_dirty(t);
+    int tr = osd->store->queue_transaction(osr.get(), std::move(t), NULL);
     assert(tr == 0);
   }
 
@@ -2721,7 +2721,7 @@ void PG::upgrade(ObjectStore *store)
 
   ceph::shared_ptr<ObjectStore::Sequencer> osr(
     new ObjectStore::Sequencer("upgrade"));
-  int r = store->apply_transaction(osr.get(), t);
+  int r = store->apply_transaction(osr.get(), std::move(t));
   if (r != 0) {
     derr << __func__ << ": apply_transaction returned "
         << cpp_strerror(r) << dendl;
@@ -3613,7 +3613,7 @@ void PG::_scan_rollback_obs(
   const vector<ghobject_t> &rollback_obs,
   ThreadPool::TPHandle &handle)
 {
-  ObjectStore::Transaction *t = NULL;
+  ObjectStore::Transaction t;
   eversion_t trimmed_to = last_rollback_info_trimmed_to_applied;
   for (vector<ghobject_t>::const_iterator i = rollback_obs.begin();
        i != rollback_obs.end();
@@ -3625,15 +3625,13 @@ void PG::_scan_rollback_obs(
                        << *i << " generation < trimmed_to "
                        << trimmed_to
                        << "...repaired";
-      if (!t)
-       t = new ObjectStore::Transaction;
-      t->remove(coll, *i);
+      t.remove(coll, *i);
     }
   }
-  if (t) {
+  if (!t.empty()) {
     derr << __func__ << ": queueing trans to clean up obsolete rollback objs"
         << dendl;
-    osd->store->queue_transaction_and_cleanup(osr.get(), t);
+    osd->store->queue_transaction(osr.get(), std::move(t), NULL);
   }
 }
 
@@ -3706,7 +3704,7 @@ void PG::_scan_snaps(ScrubMap &smap)
                            << "...repaired";
        }
        snap_mapper.add_oid(hoid, oi_snaps, &_t);
-       r = osd->store->apply_transaction(osr.get(), t);
+       r = osd->store->apply_transaction(osr.get(), std::move(t));
        if (r != 0) {
          derr << __func__ << ": apply_transaction got " << cpp_strerror(r)
               << dendl;
@@ -4451,10 +4449,10 @@ void PG::scrub_finish()
   reg_next_scrub();
 
   {
-    ObjectStore::Transaction *t = new ObjectStore::Transaction;
+    ObjectStore::Transaction t;
     dirty_info = true;
-    write_if_dirty(*t);
-    int tr = osd->store->queue_transaction_and_cleanup(osr.get(), t);
+    write_if_dirty(t);
+    int tr = osd->store->queue_transaction(osr.get(), std::move(t), NULL);
     assert(tr == 0);
   }
 
index e995f1ac38175856c828d40998a5144092b93a29..fa83c0d60fc8623f8946cf4ade5cf0f3323465b8 100644 (file)
 
      virtual void send_message(int to_osd, Message *m) = 0;
      virtual void queue_transaction(
-       ObjectStore::Transaction *t,
+       ObjectStore::Transaction&& t,
        OpRequestRef op = OpRequestRef()
        ) = 0;
      virtual void queue_transactions(
-       list<ObjectStore::Transaction*>& tls,
+       vector<ObjectStore::Transaction>& tls,
        OpRequestRef op = OpRequestRef()
        ) = 0;
      virtual epoch_t get_epoch() const = 0;
index d304ad6fb74557c3438779d5ebf3317139438c5e..33f4b976a6a3b85557a00f73ea06db3a809f37f2 100644 (file)
@@ -312,7 +312,7 @@ class RPGTransaction : public PGBackend::PGTransaction {
   coll_t coll;
   set<hobject_t, hobject_t::BitwiseComparator> temp_added;
   set<hobject_t, hobject_t::BitwiseComparator> temp_cleared;
-  ObjectStore::Transaction *t;
+  mutable ObjectStore::Transaction t;
   uint64_t written;
   const coll_t &get_coll_ct(const hobject_t &hoid) {
     if (hoid.is_temp()) {
@@ -333,15 +333,13 @@ class RPGTransaction : public PGBackend::PGTransaction {
   }
 public:
   RPGTransaction(coll_t coll, bool use_tbl)
-    : coll(coll), t(new ObjectStore::Transaction), written(0) {
-    t->set_use_tbl(use_tbl);
+    : coll(coll), written(0) {
+    t.set_use_tbl(use_tbl);
   }
 
   /// Yields ownership of contained transaction
-  ObjectStore::Transaction *get_transaction() {
-    ObjectStore::Transaction *_t = t;
-    t = 0;
-    return _t;
+  ObjectStore::Transaction&& get_transaction() {
+    return std::move(t);
   }
   const set<hobject_t, hobject_t::BitwiseComparator> &get_temp_added() {
     return temp_added;
@@ -358,17 +356,17 @@ public:
     uint32_t fadvise_flags
     ) {
     written += len;
-    t->write(get_coll_ct(hoid), ghobject_t(hoid), off, len, bl, fadvise_flags);
+    t.write(get_coll_ct(hoid), ghobject_t(hoid), off, len, bl, fadvise_flags);
   }
   void remove(
     const hobject_t &hoid
     ) {
-    t->remove(get_coll_rm(hoid), ghobject_t(hoid));
+    t.remove(get_coll_rm(hoid), ghobject_t(hoid));
   }
   void stash(
     const hobject_t &hoid,
     version_t former_version) {
-    t->collection_move_rename(
+    t.collection_move_rename(
       coll, ghobject_t(hoid), coll,
       ghobject_t(hoid, former_version, shard_id_t::NO_SHARD));
   }
@@ -376,20 +374,20 @@ public:
     const hobject_t &hoid,
     map<string, bufferlist> &attrs
     ) {
-    t->setattrs(get_coll(hoid), ghobject_t(hoid), attrs);
+    t.setattrs(get_coll(hoid), ghobject_t(hoid), attrs);
   }
   void setattr(
     const hobject_t &hoid,
     const string &attrname,
     bufferlist &bl
     ) {
-    t->setattr(get_coll(hoid), ghobject_t(hoid), attrname, bl);
+    t.setattr(get_coll(hoid), ghobject_t(hoid), attrname, bl);
   }
   void rmattr(
     const hobject_t &hoid,
     const string &attrname
     ) {
-    t->rmattr(get_coll(hoid), ghobject_t(hoid), attrname);
+    t.rmattr(get_coll(hoid), ghobject_t(hoid), attrname);
   }
   void omap_setkeys(
     const hobject_t &hoid,
@@ -397,38 +395,38 @@ public:
     ) {
     for (map<string, bufferlist>::iterator p = keys.begin(); p != keys.end(); ++p)
       written += p->first.length() + p->second.length();
-    return t->omap_setkeys(get_coll(hoid), ghobject_t(hoid), keys);
+    return t.omap_setkeys(get_coll(hoid), ghobject_t(hoid), keys);
   }
   void omap_setkeys(
     const hobject_t &hoid,
     bufferlist &keys_bl
     ) {
     written += keys_bl.length();
-    return t->omap_setkeys(get_coll(hoid), ghobject_t(hoid), keys_bl);
+    return t.omap_setkeys(get_coll(hoid), ghobject_t(hoid), keys_bl);
   }
   void omap_rmkeys(
     const hobject_t &hoid,
     set<string> &keys
     ) {
-    t->omap_rmkeys(get_coll(hoid), ghobject_t(hoid), keys);
+    t.omap_rmkeys(get_coll(hoid), ghobject_t(hoid), keys);
   }
   void omap_rmkeys(
     const hobject_t &hoid,
     bufferlist &keys_bl
     ) {
-    t->omap_rmkeys(get_coll(hoid), ghobject_t(hoid), keys_bl);
+    t.omap_rmkeys(get_coll(hoid), ghobject_t(hoid), keys_bl);
   }
   void omap_clear(
     const hobject_t &hoid
     ) {
-    t->omap_clear(get_coll(hoid), ghobject_t(hoid));
+    t.omap_clear(get_coll(hoid), ghobject_t(hoid));
   }
   void omap_setheader(
     const hobject_t &hoid,
     bufferlist &header
     ) {
     written += header.length();
-    t->omap_setheader(get_coll(hoid), ghobject_t(hoid), header);
+    t.omap_setheader(get_coll(hoid), ghobject_t(hoid), header);
   }
   void clone_range(
     const hobject_t &from,
@@ -438,20 +436,20 @@ public:
     uint64_t tooff
     ) {
     assert(get_coll(from) == get_coll_ct(to)  && get_coll(from) == coll);
-    t->clone_range(coll, ghobject_t(from), ghobject_t(to), fromoff, len, tooff);
+    t.clone_range(coll, ghobject_t(from), ghobject_t(to), fromoff, len, tooff);
   }
   void clone(
     const hobject_t &from,
     const hobject_t &to
     ) {
     assert(get_coll(from) == get_coll_ct(to)  && get_coll(from) == coll);
-    t->clone(coll, ghobject_t(from), ghobject_t(to));
+    t.clone(coll, ghobject_t(from), ghobject_t(to));
   }
   void rename(
     const hobject_t &from,
     const hobject_t &to
     ) {
-    t->collection_move_rename(
+    t.collection_move_rename(
       get_coll_rm(from),
       ghobject_t(from),
       get_coll_ct(to),
@@ -461,21 +459,21 @@ public:
   void touch(
     const hobject_t &hoid
     ) {
-    t->touch(get_coll_ct(hoid), ghobject_t(hoid));
+    t.touch(get_coll_ct(hoid), ghobject_t(hoid));
   }
 
   void truncate(
     const hobject_t &hoid,
     uint64_t off
     ) {
-    t->truncate(get_coll(hoid), ghobject_t(hoid), off);
+    t.truncate(get_coll(hoid), ghobject_t(hoid), off);
   }
   void zero(
     const hobject_t &hoid,
     uint64_t off,
     uint64_t len
     ) {
-    t->zero(get_coll(hoid), ghobject_t(hoid), off, len);
+    t.zero(get_coll(hoid), ghobject_t(hoid), off, len);
   }
 
   void set_alloc_hint(
@@ -483,7 +481,7 @@ public:
     uint64_t expected_object_size,
     uint64_t expected_write_size
     ) {
-    t->set_alloc_hint(get_coll(hoid), ghobject_t(hoid), expected_object_size,
+    t.set_alloc_hint(get_coll(hoid), ghobject_t(hoid), expected_object_size,
                       expected_write_size);
   }
 
@@ -495,7 +493,7 @@ public:
     assert(to_append);
     written += to_append->written;
     to_append->written = 0;
-    t->append(*(to_append->t));
+    t.append((to_append->t));
     for (set<hobject_t, hobject_t::BitwiseComparator>::iterator i = to_append->temp_added.begin();
         i != to_append->temp_added.end();
         ++i) {
@@ -510,15 +508,15 @@ public:
     }
   }
   void nop() {
-    t->nop();
+    t.nop();
   }
   bool empty() const {
-    return t->empty();
+    return t.empty(); 
   }
   uint64_t get_bytes_written() const {
     return written;
   }
-  ~RPGTransaction() { delete t; }
+  ~RPGTransaction() { }
 };
 
 PGBackend::PGTransaction *ReplicatedBackend::get_transaction()
@@ -565,7 +563,7 @@ void ReplicatedBackend::submit_transaction(
 {
   RPGTransaction *t = dynamic_cast<RPGTransaction*>(_t);
   assert(t);
-  ObjectStore::Transaction *op_t = t->get_transaction();
+  ObjectStore::Transaction op_t = t->get_transaction();
 
   assert(t->get_temp_added().size() <= 1);
   assert(t->get_temp_cleared().size() <= 1);
@@ -601,7 +599,7 @@ void ReplicatedBackend::submit_transaction(
     log_entries,
     hset_history,
     &op,
-    op_t);
+    &op_t);
 
   if (!(t->get_temp_added().empty())) {
     add_temp_objs(t->get_temp_added());
@@ -614,20 +612,17 @@ void ReplicatedBackend::submit_transaction(
     trim_to,
     trim_rollback_to,
     true,
-    op_t);
+    &op_t);
   
-  op_t->register_on_applied_sync(on_local_applied_sync);
-  op_t->register_on_applied(
+  op_t.register_on_applied_sync(on_local_applied_sync);
+  op_t.register_on_applied(
     parent->bless_context(
       new C_OSD_OnOpApplied(this, &op)));
-  op_t->register_on_applied(
-    new ObjectStore::C_DeleteTransaction(op_t));
-  op_t->register_on_commit(
+  op_t.register_on_commit(
     parent->bless_context(
       new C_OSD_OnOpCommit(this, &op)));
-
-  list<ObjectStore::Transaction*> tls;
-  tls.push_back(op_t);
+  vector<ObjectStore::Transaction> tls;
+  tls.push_back(std::move(op_t));
   parent->queue_transactions(tls, op.op);
   delete t;
 }
@@ -852,12 +847,12 @@ void ReplicatedBackend::_do_push(OpRequestRef op)
   pg_shard_t from = m->from;
 
   vector<PushReplyOp> replies;
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
+  ObjectStore::Transaction t;
   for (vector<PushOp>::iterator i = m->pushes.begin();
        i != m->pushes.end();
        ++i) {
     replies.push_back(PushReplyOp());
-    handle_push(from, *i, &(replies.back()), t);
+    handle_push(from, *i, &(replies.back()), &t);
   }
 
   MOSDPGPushReply *reply = new MOSDPGPushReply;
@@ -868,13 +863,11 @@ void ReplicatedBackend::_do_push(OpRequestRef op)
   reply->replies.swap(replies);
   reply->compute_cost(cct);
 
-  t->register_on_complete(
+  t.register_on_complete(
     new PG_SendMessageOnConn(
       get_parent(), reply, m->get_connection()));
 
-  t->register_on_applied(
-    new ObjectStore::C_DeleteTransaction(t));
-  get_parent()->queue_transaction(t);
+  get_parent()->queue_transaction(std::move(t));
 }
 
 struct C_ReplicatedBackend_OnPullComplete : GenContext<ThreadPool::TPHandle&> {
@@ -911,12 +904,12 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op)
   pg_shard_t from = m->from;
 
   vector<PullOp> replies(1);
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
+  ObjectStore::Transaction t;
   list<hobject_t> to_continue;
   for (vector<PushOp>::iterator i = m->pushes.begin();
        i != m->pushes.end();
        ++i) {
-    bool more = handle_pull_response(from, *i, &(replies.back()), &to_continue, t);
+    bool more = handle_pull_response(from, *i, &(replies.back()), &to_continue, &t);
     if (more)
       replies.push_back(PullOp());
   }
@@ -926,7 +919,7 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op)
        this,
        m->get_priority());
     c->to_continue.swap(to_continue);
-    t->register_on_complete(
+    t.register_on_complete(
       new PG_RecoveryQueueAsync(
        get_parent(),
        get_parent()->bless_gencontext(c)));
@@ -942,14 +935,12 @@ void ReplicatedBackend::_do_pull_response(OpRequestRef op)
     reply->pulls.swap(replies);
     reply->compute_cost(cct);
 
-    t->register_on_complete(
+    t.register_on_complete(
       new PG_SendMessageOnConn(
        get_parent(), reply, m->get_connection()));
   }
 
-  t->register_on_applied(
-    new ObjectStore::C_DeleteTransaction(t));
-  get_parent()->queue_transaction(t);
+  get_parent()->queue_transaction(std::move(t));
 }
 
 void ReplicatedBackend::do_pull(OpRequestRef op)
@@ -1215,9 +1206,10 @@ void ReplicatedBackend::sub_op_modify_impl(OpRequestRef op)
   rm->localt.register_on_applied(
     parent->bless_context(
       new C_OSD_RepModifyApply(this, rm)));
-  list<ObjectStore::Transaction*> tls;
-  tls.push_back(&(rm->localt));
-  tls.push_back(&(rm->opt));
+  vector<ObjectStore::Transaction> tls;
+  tls.reserve(2);
+  tls.push_back(std::move(rm->localt));
+  tls.push_back(std::move(rm->opt));
   parent->queue_transactions(tls, op);
   // op is cleaned up by oncommit/onapply when both are executed
 }
@@ -2360,7 +2352,7 @@ void ReplicatedBackend::sub_op_push(OpRequestRef op)
   pop.recovery_info = m->recovery_info;
   pop.before_progress = m->current_progress;
   pop.after_progress = m->recovery_progress;
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
+  ObjectStore::Transaction t;
 
   if (is_primary()) {
     PullOp resp;
@@ -2368,7 +2360,7 @@ void ReplicatedBackend::sub_op_push(OpRequestRef op)
     list<hobject_t> to_continue;
     bool more = handle_pull_response(
       m->from, pop, &resp,
-      &to_continue, t);
+      &to_continue, &t);
     if (more) {
       send_pull_legacy(
        m->get_priority(),
@@ -2381,7 +2373,7 @@ void ReplicatedBackend::sub_op_push(OpRequestRef op)
          this,
          op->get_req()->get_priority());
       c->to_continue.swap(to_continue);
-      t->register_on_complete(
+      t.register_on_complete(
        new PG_RecoveryQueueAsync(
          get_parent(),
          get_parent()->bless_gencontext(c)));
@@ -2394,13 +2386,11 @@ void ReplicatedBackend::sub_op_push(OpRequestRef op)
       get_osdmap()->get_epoch(), CEPH_OSD_FLAG_ACK);
     reply->set_priority(m->get_priority());
     assert(entity_name_t::TYPE_OSD == m->get_connection()->peer_type);
-    handle_push(m->from, pop, &resp, t);
-    t->register_on_complete(new PG_SendMessageOnConn(
+    handle_push(m->from, pop, &resp, &t);
+    t.register_on_complete(new PG_SendMessageOnConn(
                              get_parent(), reply, m->get_connection()));
   }
-  t->register_on_applied(
-    new ObjectStore::C_DeleteTransaction(t));
-  get_parent()->queue_transaction(t);
+  get_parent()->queue_transaction(std::move(t));
   return;
 }
 
index bf40634afd009f688d103e22e41c871595aa12ed..752ef73b5c1c493e189908e3b0c53ff2d171ce90 100644 (file)
@@ -3171,10 +3171,10 @@ void ReplicatedPG::do_backfill(OpRequestRef op)
        info.stats = m->stats;
       }
 
-      ObjectStore::Transaction *t = new ObjectStore::Transaction;
+      ObjectStore::Transaction t;
       dirty_info = true;
-      write_if_dirty(*t);
-      int tr = osd->store->queue_transaction_and_cleanup(osr.get(), t);
+      write_if_dirty(t);
+      int tr = osd->store->queue_transaction(osr.get(), std::move(t), NULL);
       assert(tr == 0);
     }
     break;
@@ -9291,9 +9291,9 @@ void ReplicatedPG::sub_op_remove(OpRequestRef op)
 
   op->mark_started();
 
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
-  remove_snap_mapped_object(*t, m->poid);
-  int r = osd->store->queue_transaction_and_cleanup(osr.get(), t);
+  ObjectStore::Transaction t;
+  remove_snap_mapped_object(t, m->poid);
+  int r = osd->store->queue_transaction(osr.get(), std::move(t), NULL);
   assert(r == 0);
 }
 
@@ -9380,7 +9380,7 @@ void ReplicatedPG::mark_all_unfound_lost(int what)
   pg_log.get_log().print(*_dout);
   *_dout << dendl;
 
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
+  ObjectStore::Transaction t;
   C_PG_MarkUnfoundLost *c = new C_PG_MarkUnfoundLost(this);
 
   utime_t mtime = ceph_clock_now(cct);
@@ -9403,7 +9403,7 @@ void ReplicatedPG::mark_all_unfound_lost(int what)
 
     switch (what) {
     case pg_log_entry_t::LOST_MARK:
-      obc = mark_object_lost(t, oid, m->second.need, mtime, pg_log_entry_t::LOST_MARK);
+      obc = mark_object_lost(&t, oid, m->second.need, mtime, pg_log_entry_t::LOST_MARK);
       pg_log.missing_got(m++);
       assert(0 == "actually, not implemented yet!");
       // we need to be careful about how this is handled on the replica!
@@ -9438,7 +9438,7 @@ void ReplicatedPG::mark_all_unfound_lost(int what)
        pg_log.add(e);
        dout(10) << e << dendl;
 
-       t->remove(
+       t.remove(
          coll,
          ghobject_t(oid, ghobject_t::NO_GEN, pg_whoami.shard));
        pg_log.missing_add_event(e);
@@ -9467,11 +9467,11 @@ void ReplicatedPG::mark_all_unfound_lost(int what)
   }
 
   dirty_info = true;
-  write_if_dirty(*t);
-
-  t->register_on_complete(new ObjectStore::C_DeleteTransaction(t));
+  write_if_dirty(t);
 
-  osd->store->queue_transaction(osr.get(), t, c, NULL, new C_OSD_OndiskWriteUnlockList(&c->obcs));
+  
+  osd->store->queue_transaction(osr.get(), std::move(t), c, NULL, 
+                            new C_OSD_OndiskWriteUnlockList(&c->obcs));
              
   // Send out the PG log to all replicas
   // So that they know what is lost
@@ -10168,19 +10168,18 @@ int ReplicatedPG::recover_primary(int max, ThreadPool::TPHandle &handle)
              obc->ondisk_write_lock();
              obc->obs.oi.version = latest->version;
 
-             ObjectStore::Transaction *t = new ObjectStore::Transaction;
-             t->register_on_applied(new ObjectStore::C_DeleteTransaction(t));
+             ObjectStore::Transaction t;
              bufferlist b2;
              obc->obs.oi.encode(b2);
              assert(!pool.info.require_rollback());
-             t->setattr(coll, ghobject_t(soid), OI_ATTR, b2);
+             t.setattr(coll, ghobject_t(soid), OI_ATTR, b2);
 
              recover_got(soid, latest->version);
              missing_loc.add_location(soid, pg_whoami);
 
              ++active_pushes;
 
-             osd->store->queue_transaction(osr.get(), t,
+             osd->store->queue_transaction(osr.get(), std::move(t),
                                            new C_OSD_AppliedRecoveredObject(this, obc),
                                            new C_OSD_CommittedPushedObject(
                                              this,
@@ -12762,10 +12761,10 @@ boost::statechart::result ReplicatedPG::WaitingOnReplicas::react(const SnapTrim&
   dout(10) << "purged_snaps now " << pg->info.purged_snaps << ", snap_trimq now " 
           << pg->snap_trimq << dendl;
   
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
+  ObjectStore::Transaction t;
   pg->dirty_big_info = true;
-  pg->write_if_dirty(*t);
-  int tr = pg->osd->store->queue_transaction_and_cleanup(pg->osr.get(), t);
+  pg->write_if_dirty(t);
+  int tr = pg->osd->store->queue_transaction(pg->osr.get(), std::move(t), NULL);
   assert(tr == 0);
 
   context<SnapTrimmer>().need_share_pg_info = true;
index c596cb059e991e70b285aae419400c34fd94ec86..1e6fcb2002fed2b58470345cd9b876e7406e473b 100644 (file)
@@ -327,11 +327,11 @@ public:
   void send_message(int to_osd, Message *m) {
     osd->send_message_osd_cluster(to_osd, m, get_osdmap()->get_epoch());
   }
-  void queue_transaction(ObjectStore::Transaction *t, OpRequestRef op) {
-    osd->store->queue_transaction(osr.get(), t, 0, 0, 0, op);
+  void queue_transaction(ObjectStore::Transaction&& t, OpRequestRef op) {
+    osd->store->queue_transaction(osr.get(), std::move(t), 0, 0, 0, op);
   }
-  void queue_transactions(list<ObjectStore::Transaction*>& tls, OpRequestRef op) {
-    osd->store->queue_transactions(osr.get(), tls, 0, 0, 0, op);
+  void queue_transactions(vector<ObjectStore::Transaction>& tls, OpRequestRef op) {
+    osd->store->queue_transactions(osr.get(), tls, 0, 0, 0, op, NULL);
   }
   epoch_t get_epoch() const {
     return get_osdmap()->get_epoch();
index 75ec051649383d443bf784065d9f0566b794c08e..75f0ded006c02d5ef283a21bb5f2385edb106a9a 100644 (file)
@@ -173,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(&osr, t);
+    fs.apply_transaction(&osr, std::move(t));
   }
   {
     ObjectStore::Transaction t;
     t.create_collection(coll_t(), 0);
-    fs.apply_transaction(&osr, t);
+    fs.apply_transaction(&osr, std::move(t));
   }
 
   vector<ceph::shared_ptr<Bencher> > benchers(
index 2ce1f8726956a5ccb9bd16c7d1bfd1b902aaca47..8a210ec49642bf45d362805b97d4646cbd541856 100644 (file)
@@ -4,17 +4,6 @@
 #include "global/global_init.h"
 #include "os/ObjectStore.h"
 
-struct C_DeleteTransWrapper : public Context {
-  Context *c;
-  ObjectStore::Transaction *t;
-  C_DeleteTransWrapper(
-    ObjectStore::Transaction *t,
-    Context *c) : c(c), t(t) {}
-  void finish(int r) {
-    c->complete(r);
-    delete t;
-  }
-};
 
 TestFileStoreBackend::TestFileStoreBackend(
   ObjectStore *os, bool write_infos)
@@ -57,9 +46,10 @@ void TestFileStoreBackend::write(
 
   os->queue_transaction(
     osr,
-    t,
-    new C_DeleteTransWrapper(t, on_applied),
+    std::move(*t),
+    on_applied,
     on_commit);
+  delete t;
 }
 
 void TestFileStoreBackend::read(
index c26173ffa39770cccc8f95f663e206740fe82077..4f0f65dea6f136abb6e1aeb98603f62e32f679ee 100644 (file)
@@ -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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(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(&m_osr, t);
+  m_store->apply_transaction(&m_osr, std::move(t));
 }
 
index 3e4cf97c5f1dfceebfb2a32ba785a0198da3c48f..dd46fb584b0b96836e9d4ac9b602cef50f55aa55 100644 (file)
@@ -9,12 +9,10 @@
 class OnApplied : public Context {
   FileStoreTracker *tracker;
   list<pair<pair<coll_t, string>, uint64_t> > in_flight;
-  ObjectStore::Transaction *t;
 public:
   OnApplied(FileStoreTracker *tracker,
-           list<pair<pair<coll_t, string>, uint64_t> > in_flight,
-           ObjectStore::Transaction *t)
-    : tracker(tracker), in_flight(in_flight), t(t) {}
+           list<pair<pair<coll_t, string>, uint64_t> > in_flight)
+    : tracker(tracker), in_flight(in_flight) {}
 
   void finish(int r) {
     for (list<pair<pair<coll_t, string>, uint64_t> >::iterator i =
@@ -23,7 +21,6 @@ public:
         ++i) {
       tracker->applied(i->first, i->second);
     }
-    delete t;
   }
 };
 
@@ -77,9 +74,10 @@ void FileStoreTracker::submit_transaction(Transaction &t)
     (**i)(this, &out);
   }
   store->queue_transaction(
-    0, out.t,
-    new OnApplied(this, in_flight, out.t),
+    0, std::move(*out.t),
+    new OnApplied(this, in_flight),
     new OnCommitted(this, in_flight));
+  delete out.t;
 }
 
 void FileStoreTracker::write(const pair<coll_t, string> &obj,
index e4252ce7b24f5f26e1c62707217e518375fbf409..873c68afd7f484343a3e28eacf21eca9dd0819f5 100644 (file)
@@ -34,11 +34,10 @@ 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;
+  ObjectStore::Transaction t;
 
-  t->create_collection(coll_t::meta(), 0);
-  m_store->apply_transaction(&osr, *t);
+  t.create_collection(coll_t::meta(), 0);
+  m_store->apply_transaction(&osr, std::move(t));
 
   wait_for_ready();
 
@@ -49,7 +48,7 @@ void TestObjectStoreState::init(int colls, int objs)
     dout(5) << "init create collection " << entry->m_coll.to_str()
         << " meta " << entry->m_meta_obj << dendl;
 
-    t = new ObjectStore::Transaction;
+    ObjectStore::Transaction *t = new ObjectStore::Transaction;
     t->create_collection(entry->m_coll, 32);
     bufferlist hint;
     uint32_t pg_num = colls;
@@ -68,8 +67,9 @@ void TestObjectStoreState::init(int colls, int objs)
     }
     baseid += objs;
 
-    m_store->queue_transaction(&(entry->m_osr), t,
-        new C_OnFinished(this, t));
+    m_store->queue_transaction(&(entry->m_osr), std::move(*t),
+        new C_OnFinished(this));
+    delete t;
     inc_in_flight();
 
     m_collections.insert(make_pair(coll_id, entry));
index bd13e1565ab9608319cf22da3de9b60d83abc386..66a604731ea3da047fc63ef4cb36a4df5f535ccd 100644 (file)
@@ -131,18 +131,15 @@ public:
   class C_OnFinished: public Context {
    protected:
     TestObjectStoreState *m_state;
-    ObjectStore::Transaction *m_tx;
 
    public:
-    C_OnFinished(TestObjectStoreState *state,
-        ObjectStore::Transaction *t) : m_state(state), m_tx(t) { }
+    C_OnFinished(TestObjectStoreState *state) : m_state(state) { }
 
     void finish(int r) {
       Mutex::Locker locker(m_state->m_finished_lock);
       m_state->dec_in_flight();
       m_state->m_finished_cond.Signal();
 
-      delete m_tx;
     }
   };
 };
index 3172da0db818594be8e6b3bc26f769ecc1ffbb04..4f7daf13a860748305f8568f05c87d456717539a 100644 (file)
@@ -129,7 +129,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   store->umount();
@@ -138,7 +138,7 @@ TEST_P(StoreTest, SimpleRemount) {
   {
     ObjectStore::Transaction t;
     t.write(cid, hoid2, 0, bl.length(), bl);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -147,7 +147,7 @@ TEST_P(StoreTest, SimpleRemount) {
     t.remove(cid, hoid2);
     t.remove_collection(cid);
     cerr << "remove collection" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   store->umount();
@@ -156,7 +156,7 @@ TEST_P(StoreTest, SimpleRemount) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
     bool exists = store->exists(cid, hoid);
     ASSERT_TRUE(!exists);
@@ -165,7 +165,7 @@ TEST_P(StoreTest, SimpleRemount) {
     ObjectStore::Transaction t;
     t.remove_collection(cid);
     cerr << "remove collection" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -184,7 +184,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   // overwrites
@@ -194,7 +194,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(&osr, t);
+      r = store->apply_transaction(&osr, std::move(t));
       ASSERT_EQ(r, 0);
     }
   }
@@ -208,7 +208,7 @@ TEST_P(StoreTest, IORemount) {
       t.remove(cid, hoid);
     }
     t.remove_collection(cid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -223,7 +223,7 @@ TEST_P(StoreTest, FiemapEmpty) {
     t.create_collection(cid, 0);
     t.touch(cid, oid);
     t.truncate(cid, oid, 100000);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -241,7 +241,7 @@ TEST_P(StoreTest, FiemapEmpty) {
     t.remove(cid, oid);
     t.remove_collection(cid);
     cerr << "remove collection" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -260,7 +260,7 @@ TEST_P(StoreTest, FiemapHoles) {
     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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -284,7 +284,7 @@ TEST_P(StoreTest, FiemapHoles) {
     t.remove(cid, oid);
     t.remove_collection(cid);
     cerr << "remove collection" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -297,28 +297,28 @@ TEST_P(StoreTest, SimpleMetaColTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "create collection" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -331,28 +331,28 @@ TEST_P(StoreTest, SimplePGColTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 4);
     cerr << "create collection" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -390,7 +390,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -398,7 +398,7 @@ TEST_P(StoreTest, SimpleColPreHashTest) {
     ObjectStore::Transaction t;
     t.remove_collection(cid);
     cerr << "remove collection" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   // Revert the config change so that it does not affect the split/merge tests
@@ -423,7 +423,7 @@ TEST_P(StoreTest, SimpleObjectTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -433,7 +433,7 @@ TEST_P(StoreTest, SimpleObjectTest) {
     ObjectStore::Transaction t;
     t.touch(cid, hoid);
     cerr << "Creating object " << hoid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
     exists = store->exists(cid, hoid);
@@ -444,7 +444,7 @@ TEST_P(StoreTest, SimpleObjectTest) {
     t.remove(cid, hoid);
     t.touch(cid, hoid);
     cerr << "Remove then create" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -455,7 +455,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
     bufferlist in;
@@ -471,7 +471,7 @@ TEST_P(StoreTest, SimpleObjectTest) {
     exp.append(bl);
     t.write(cid, hoid, 5, 5, bl);
     cerr << "Append" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
     bufferlist in;
@@ -486,7 +486,7 @@ TEST_P(StoreTest, SimpleObjectTest) {
     exp = bl;
     t.write(cid, hoid, 0, 10, bl);
     cerr << "Full overwrite" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
     bufferlist in;
@@ -500,7 +500,7 @@ TEST_P(StoreTest, SimpleObjectTest) {
     bl.append("abcde");
     t.write(cid, hoid, 3, 5, bl);
     cerr << "Partial overwrite" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
     bufferlist in, exp;
@@ -516,7 +516,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
     bufferlist in;
@@ -530,7 +530,7 @@ TEST_P(StoreTest, SimpleObjectTest) {
     t.remove(cid, hoid);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -545,7 +545,7 @@ TEST_P(StoreTest, ManySmallWrite) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   bufferlist bl;
@@ -555,13 +555,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(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -570,7 +570,7 @@ TEST_P(StoreTest, ManySmallWrite) {
     t.remove(cid, b);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -584,14 +584,14 @@ TEST_P(StoreTest, SmallSkipFront) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -601,7 +601,7 @@ TEST_P(StoreTest, SmallSkipFront) {
     bl.append(bp);
     ObjectStore::Transaction t;
     t.write(cid, a, 4096, 4096, bl);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -617,7 +617,7 @@ TEST_P(StoreTest, SmallSkipFront) {
     t.remove(cid, a);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -631,7 +631,7 @@ TEST_P(StoreTest, SmallSequentialUnaligned) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   bufferlist bl;
@@ -642,7 +642,7 @@ TEST_P(StoreTest, SmallSequentialUnaligned) {
   for (int i=0; i<1000; ++i) {
     ObjectStore::Transaction t;
     t.write(cid, a, i*len, len, bl, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -650,7 +650,7 @@ TEST_P(StoreTest, SmallSequentialUnaligned) {
     t.remove(cid, a);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -665,7 +665,7 @@ TEST_P(StoreTest, ManyBigWrite) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   bufferlist bl;
@@ -675,28 +675,28 @@ TEST_P(StoreTest, ManyBigWrite) {
   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, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -705,7 +705,7 @@ TEST_P(StoreTest, ManyBigWrite) {
     t.remove(cid, b);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -719,7 +719,7 @@ TEST_P(StoreTest, MiscFragmentTests) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   bufferlist bl;
@@ -729,13 +729,13 @@ TEST_P(StoreTest, MiscFragmentTests) {
   {
     ObjectStore::Transaction t;
     t.write(cid, a, 0, 524288, bl, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
     ObjectStore::Transaction t;
     t.write(cid, a, 1048576, 524288, bl, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -748,7 +748,7 @@ TEST_P(StoreTest, MiscFragmentTests) {
   {
     ObjectStore::Transaction t;
     t.write(cid, a, 1048576 - 4096, 524288, bl, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -756,7 +756,7 @@ TEST_P(StoreTest, MiscFragmentTests) {
     t.remove(cid, a);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -781,7 +781,7 @@ TEST_P(StoreTest, SimpleAttrTest) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -798,7 +798,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -825,7 +825,7 @@ TEST_P(StoreTest, SimpleAttrTest) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove_collection(cid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -838,7 +838,7 @@ TEST_P(StoreTest, SimpleListTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   set<ghobject_t, ghobject_t::BitwiseComparator> all;
@@ -854,7 +854,7 @@ TEST_P(StoreTest, SimpleListTest) {
       t.touch(cid, hoid);
       cerr << "Creating object " << hoid << std::endl;
     }
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   for (int bitwise=0; bitwise<2; ++bitwise) {
@@ -893,7 +893,7 @@ TEST_P(StoreTest, SimpleListTest) {
       t.remove(cid, *p);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -935,7 +935,7 @@ TEST_P(StoreTest, MultipoolListTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   set<ghobject_t, ghobject_t::BitwiseComparator> all, saw;
@@ -953,7 +953,7 @@ TEST_P(StoreTest, MultipoolListTest) {
       t.touch(cid, hoid);
       cerr << "Creating object " << hoid << std::endl;
     }
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -980,7 +980,7 @@ TEST_P(StoreTest, MultipoolListTest) {
       t.remove(cid, *p);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -993,7 +993,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP),
@@ -1011,7 +1011,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP),
@@ -1025,7 +1025,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
     r = store->read(cid, hoid, 10, 5, newdata);
@@ -1060,7 +1060,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove(cid, hoid2);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
   }
   {
     bufferlist final;
@@ -1078,7 +1078,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     al.append(a);
     final.append(a);
     t.write(cid, hoid, pl.length(), a.length(), al);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
     bufferlist rl;
     ASSERT_EQ((int)final.length(),
@@ -1089,7 +1089,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove(cid, hoid2);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
   }
   {
     bufferlist final;
@@ -1110,7 +1110,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     al.append(a);
     final.append(a);
     t.write(cid, hoid, pl.length() + z.length(), a.length(), al);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
     bufferlist rl;
     ASSERT_EQ((int)final.length(),
@@ -1121,7 +1121,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove(cid, hoid2);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
   }
   {
     bufferlist final;
@@ -1142,7 +1142,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     al.append(a);
     final.append(a);
     t.write(cid, hoid, 17000, a.length(), al);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
     bufferlist rl;
     ASSERT_EQ((int)final.length(),
              store->read(cid, hoid, 0, final.length(), rl));
@@ -1156,7 +1156,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove(cid, hoid2);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
   }
   {
     bufferptr p(1048576);
@@ -1171,7 +1171,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     bufferlist al;
     al.append(a);
     t.write(cid, hoid, a.length(), a.length(), al);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
     bufferlist rl;
     bufferlist final;
     final.substr_of(pl, 0, al.length());
@@ -1191,7 +1191,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove(cid, hoid2);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
   }
   {
     bufferptr p(65536);
@@ -1206,7 +1206,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     bufferlist al;
     al.append(a);
     t.write(cid, hoid, 32768, a.length(), al);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
     bufferlist rl;
     bufferlist final;
     final.substr_of(pl, 0, 32768);
@@ -1226,7 +1226,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove(cid, hoid2);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
   }
   {
     bufferptr p(65536);
@@ -1241,7 +1241,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     bufferlist al;
     al.append(a);
     t.write(cid, hoid, 33768, a.length(), al);
-    ASSERT_EQ(0u, store->apply_transaction(&osr, t));
+    ASSERT_EQ(0u, store->apply_transaction(&osr, std::move(t)));
     bufferlist rl;
     bufferlist final;
     final.substr_of(pl, 0, 33768);
@@ -1263,7 +1263,7 @@ TEST_P(StoreTest, SimpleCloneTest) {
     t.remove(cid, hoid2);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -1276,7 +1276,7 @@ TEST_P(StoreTest, OmapSimple) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid(hobject_t(sobject_t("omap_obj", CEPH_NOSNAP),
@@ -1294,7 +1294,7 @@ TEST_P(StoreTest, OmapSimple) {
     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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   // get header, keys
@@ -1331,7 +1331,7 @@ TEST_P(StoreTest, OmapSimple) {
     t.remove(cid, hoid);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -1344,7 +1344,7 @@ TEST_P(StoreTest, OmapCloneTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP),
@@ -1362,7 +1362,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP),
@@ -1371,7 +1371,7 @@ TEST_P(StoreTest, OmapCloneTest) {
     ObjectStore::Transaction t;
     t.clone(cid, hoid, hoid2);
     cerr << "Clone object" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -1387,7 +1387,7 @@ TEST_P(StoreTest, OmapCloneTest) {
     t.remove(cid, hoid2);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -1400,7 +1400,7 @@ TEST_P(StoreTest, SimpleCloneRangeTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid(hobject_t(sobject_t("Object 1", CEPH_NOSNAP)));
@@ -1411,7 +1411,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid2(hobject_t(sobject_t("Object 2", CEPH_NOSNAP)));
@@ -1420,7 +1420,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
     r = store->read(cid, hoid2, 0, 5, newdata);
     ASSERT_EQ(r, 5);
@@ -1431,7 +1431,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
     struct stat stat, stat2;
     r = store->stat(cid, hoid, &stat);
@@ -1445,7 +1445,7 @@ TEST_P(StoreTest, SimpleCloneRangeTest) {
     t.remove(cid, hoid2);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -1459,7 +1459,7 @@ TEST_P(StoreTest, SimpleObjectLongnameTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ghobject_t hoid(hobject_t(sobject_t("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaObjectaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 1", CEPH_NOSNAP)));
@@ -1467,7 +1467,7 @@ TEST_P(StoreTest, SimpleObjectLongnameTest) {
     ObjectStore::Transaction t;
     t.touch(cid, hoid);
     cerr << "Creating object " << hoid << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -1475,7 +1475,7 @@ TEST_P(StoreTest, SimpleObjectLongnameTest) {
     t.remove(cid, hoid);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -1491,7 +1491,7 @@ TEST_P(StoreTest, ManyObjectTest) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   for (int i = 0; i < NUM_OBJS; ++i) {
@@ -1504,7 +1504,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -1594,14 +1594,14 @@ TEST_P(StoreTest, ManyObjectTest) {
        ++i) {
     ObjectStore::Transaction t;
     t.remove(cid, *i);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -1771,7 +1771,7 @@ public:
   int init() {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    return store->apply_transaction(osr, t);
+    return store->apply_transaction(osr, std::move(t));
   }
   void shutdown() {
     while (1) {
@@ -1786,11 +1786,11 @@ public:
           p != objects.end(); ++p) {
        t.remove(cid, *p);
       }
-      store->apply_transaction(osr, t);
+      store->apply_transaction(osr, std::move(t));
     }
     ObjectStore::Transaction t;
     t.remove_collection(cid);
-    store->apply_transaction(osr, t);
+    store->apply_transaction(osr, std::move(t));
   }
 
   ghobject_t get_uniform_random_object() {
@@ -1838,7 +1838,9 @@ public:
     in_flight_objects.insert(new_obj);
     if (!contents.count(new_obj))
       contents[new_obj] = Object();
-    return store->queue_transaction(osr, t, new C_SyntheticOnReadable(this, t, new_obj));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnReadable(this, t, new_obj));
+    delete t;
+    return status;
   }
 
   int clone() {
@@ -1871,7 +1873,9 @@ public:
     contents[new_obj].data.clear();
     contents[new_obj].data.append(contents[old_obj].data.c_str(),
                                  contents[old_obj].data.length());
-    return store->queue_transaction(osr, t, new C_SyntheticOnClone(this, t, old_obj, new_obj));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnClone(this, t, old_obj, new_obj));
+    delete t;
+    return status;
   }
 
   int setattrs() {
@@ -1917,7 +1921,9 @@ public:
     t->setattrs(cid, obj, attrs);
     ++in_flight;
     in_flight_objects.insert(obj);
-    return store->queue_transaction(osr, t, new C_SyntheticOnReadable(this, t, obj));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnReadable(this, t, obj));
+    delete t;
+    return status;
   }
 
   void getattrs() {
@@ -2014,7 +2020,9 @@ public:
     contents[obj].attrs.erase(it->first);
     ++in_flight;
     in_flight_objects.insert(obj);
-    return store->queue_transaction(osr, t, new C_SyntheticOnReadable(this, t, obj));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnReadable(this, t, obj));
+    delete t;
+    return status;
   }
 
   int write() {
@@ -2056,7 +2064,9 @@ public:
     t->write(cid, new_obj, offset, len, bl);
     ++in_flight;
     in_flight_objects.insert(new_obj);
-    return store->queue_transaction(osr, t, new C_SyntheticOnReadable(this, t, new_obj));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnReadable(this, t, new_obj));
+    delete t;
+    return status;
   }
 
   void read() {
@@ -2135,7 +2145,9 @@ public:
       bl.swap(data);
     }
 
-    return store->queue_transaction(osr, t, new C_SyntheticOnReadable(this, t, obj));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnReadable(this, t, obj));
+    delete t;
+    return status;
   }
 
   void scan() {
@@ -2239,7 +2251,9 @@ public:
     available_objects.erase(to_remove);
     in_flight_objects.insert(to_remove);
     contents.erase(to_remove);
-    return store->queue_transaction(osr, t, new C_SyntheticOnReadable(this, t, to_remove));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnReadable(this, t, to_remove));
+    delete t;
+    return status;
   }
 
   int zero() {
@@ -2268,7 +2282,9 @@ public:
     t->zero(cid, new_obj, offset, len);
     ++in_flight;
     in_flight_objects.insert(new_obj);
-    return store->queue_transaction(osr, t, new C_SyntheticOnReadable(this, t, new_obj));
+    int status = store->queue_transaction(osr, std::move(*t), new C_SyntheticOnReadable(this, t, new_obj));
+    delete t;
+    return status;
   }
 
   void print_internal_state() {
@@ -2368,7 +2384,7 @@ TEST_P(StoreTest, HashCollisionTest) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   string base = "";
@@ -2387,7 +2403,7 @@ TEST_P(StoreTest, HashCollisionTest) {
     {
       ObjectStore::Transaction t;
       t.touch(cid, hoid);
-      r = store->apply_transaction(&osr, t);
+      r = store->apply_transaction(&osr, std::move(t));
       ASSERT_EQ(r, 0);
     }
     created.insert(hoid);
@@ -2434,12 +2450,12 @@ TEST_P(StoreTest, HashCollisionTest) {
        ++i) {
     ObjectStore::Transaction t;
     t.remove(cid, *i);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ObjectStore::Transaction t;
   t.remove_collection(cid);
-  r = store->apply_transaction(&osr, t);
+  r = store->apply_transaction(&osr, std::move(t));
   ASSERT_EQ(r, 0);
 }
 
@@ -2451,7 +2467,7 @@ TEST_P(StoreTest, ScrubTest) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   string base = "aaaaa";
@@ -2468,7 +2484,7 @@ TEST_P(StoreTest, ScrubTest) {
     {
       ObjectStore::Transaction t;
       t.touch(cid, hoid);
-      r = store->apply_transaction(&osr, t);
+      r = store->apply_transaction(&osr, std::move(t));
       ASSERT_EQ(r, 0);
     }
     created.insert(hoid);
@@ -2484,7 +2500,7 @@ TEST_P(StoreTest, ScrubTest) {
     t.touch(cid, hoid1);
     t.touch(cid, hoid2);
     t.touch(cid, hoid3);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     created.insert(hoid1);
     created.insert(hoid2);
     created.insert(hoid3);
@@ -2532,12 +2548,12 @@ TEST_P(StoreTest, ScrubTest) {
        ++i) {
     ObjectStore::Transaction t;
     t.remove(cid, *i);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ObjectStore::Transaction t;
   t.remove_collection(cid);
-  r = store->apply_transaction(&osr, t);
+  r = store->apply_transaction(&osr, std::move(t));
   ASSERT_EQ(r, 0);
 }
 
@@ -2550,7 +2566,7 @@ TEST_P(StoreTest, OMapTest) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2561,7 +2577,7 @@ TEST_P(StoreTest, OMapTest) {
     t.omap_clear(cid, hoid);
     map<string, bufferlist> start_set;
     t.omap_setkeys(cid, hoid, start_set);
-    store->apply_transaction(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
   }
 
   for (int i = 0; i < 100; i++) {
@@ -2596,7 +2612,7 @@ TEST_P(StoreTest, OMapTest) {
     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, t);
+    store->apply_transaction(&osr, std::move(t));
   }
 
   int i = 0;
@@ -2626,7 +2642,7 @@ TEST_P(StoreTest, OMapTest) {
     set<string> keys_to_remove;
     keys_to_remove.insert(to_remove);
     t.omap_rmkeys(cid, hoid, keys_to_remove);
-    store->apply_transaction(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
 
     attrs.erase(to_remove);
 
@@ -2638,14 +2654,15 @@ TEST_P(StoreTest, OMapTest) {
     bl1.append("omap_header");
     ObjectStore::Transaction t;
     t.omap_setheader(cid, hoid, bl1);
-    store->apply_transaction(&osr, t);
-
+    store->apply_transaction(&osr, std::move(t));
+    t = ObjectStore::Transaction();
     bufferlist bl2;
     bl2.append("value");
     map<string, bufferlist> to_add;
     to_add.insert(pair<string, bufferlist>("key", bl2));
     t.omap_setkeys(cid, hoid, to_add);
-    store->apply_transaction(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
 
     bufferlist bl3;
     map<string, bufferlist> cur_attrs;
@@ -2674,12 +2691,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(&osr, t);
+      store->apply_transaction(&osr, std::move(t));
     }
     {
       ObjectStore::Transaction t;
       t.omap_rmkeyrange(cid, hoid, "3", "7");
-      store->apply_transaction(&osr, t);
+      store->apply_transaction(&osr, std::move(t));
     }
     {
       bufferlist hdr;
@@ -2697,7 +2714,7 @@ TEST_P(StoreTest, OMapTest) {
     {
       ObjectStore::Transaction t;
       t.omap_clear(cid, hoid);
-      store->apply_transaction(&osr, t);
+      store->apply_transaction(&osr, std::move(t));
     }
     {
       bufferlist hdr;
@@ -2711,7 +2728,7 @@ TEST_P(StoreTest, OMapTest) {
   ObjectStore::Transaction t;
   t.remove(cid, hoid);
   t.remove_collection(cid);
-  r = store->apply_transaction(&osr, t);
+  r = store->apply_transaction(&osr, std::move(t));
   ASSERT_EQ(r, 0);
 }
 
@@ -2724,7 +2741,7 @@ TEST_P(StoreTest, OMapIterator) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2735,7 +2752,7 @@ TEST_P(StoreTest, OMapIterator) {
     t.omap_clear(cid, hoid);
     map<string, bufferlist> start_set;
     t.omap_setkeys(cid, hoid, start_set);
-    store->apply_transaction(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
   }
   ObjectMap::ObjectMapIterator iter;
   bool correct;
@@ -2778,7 +2795,7 @@ TEST_P(StoreTest, OMapIterator) {
     attrs.insert(pair<string, bufferlist>("key-" + string(buf), bl));
     ObjectStore::Transaction t;
     t.omap_setkeys(cid, hoid, to_add);
-    store->apply_transaction(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
   }
 
   iter = store->get_omap_iterator(cid, hoid);
@@ -2804,7 +2821,7 @@ TEST_P(StoreTest, OMapIterator) {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
     t.remove_collection(cid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -2826,7 +2843,7 @@ TEST_P(StoreTest, XattrTest) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     t.touch(cid, hoid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2845,7 +2862,7 @@ TEST_P(StoreTest, XattrTest) {
     attrs["attr4"] = big;
     t.setattr(cid, hoid, "attr3", big);
     attrs["attr3"] = big;
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2864,7 +2881,7 @@ TEST_P(StoreTest, XattrTest) {
     ObjectStore::Transaction t;
     t.rmattr(cid, hoid, "attr2");
     attrs.erase("attr2");
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2892,7 +2909,7 @@ TEST_P(StoreTest, XattrTest) {
   ObjectStore::Transaction t;
   t.remove(cid, hoid);
   t.remove_collection(cid);
-  r = store->apply_transaction(&osr, t);
+  r = store->apply_transaction(&osr, std::move(t));
   ASSERT_EQ(r, 0);
 }
 
@@ -2908,7 +2925,7 @@ void colsplittest(
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, common_suffix_size);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
@@ -2923,14 +2940,14 @@ void colsplittest(
          i<<common_suffix_size,
          52, "")));
     }
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2961,7 +2978,7 @@ void colsplittest(
 
   t.remove_collection(cid);
   t.remove_collection(tid);
-  r = store->apply_transaction(&osr, t);
+  r = store->apply_transaction(&osr, std::move(t));
   ASSERT_EQ(r, 0);
 }
 
@@ -2992,7 +3009,7 @@ TEST_P(StoreTest, TwoHash) {
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   std::cout << "Making objects" << std::endl;
@@ -3006,7 +3023,7 @@ TEST_P(StoreTest, TwoHash) {
     }
     o.hobj.set_hash((i << 16) | 0xB1);
     t.touch(cid, o);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   std::cout << "Removing half" << std::endl;
@@ -3016,7 +3033,7 @@ TEST_P(StoreTest, TwoHash) {
     o.hobj.pool = -1;
     o.hobj.set_hash((i << 16) | 0xA1);
     t.remove(cid, o);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   std::cout << "Checking" << std::endl;
@@ -3044,12 +3061,12 @@ TEST_P(StoreTest, TwoHash) {
     t.remove(cid, o);
     o.hobj.set_hash((i << 16) | 0xB1);
     t.remove(cid, o);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ObjectStore::Transaction t;
   t.remove_collection(cid);
-  r = store->apply_transaction(&osr, t);
+  r = store->apply_transaction(&osr, std::move(t));
   ASSERT_EQ(r, 0);
 }
 
@@ -3065,7 +3082,7 @@ TEST_P(StoreTest, Rename) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     t.write(cid, srcoid, 0, data.length(), data);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ASSERT_TRUE(store->exists(cid, srcoid));
@@ -3074,7 +3091,7 @@ TEST_P(StoreTest, Rename) {
     t.collection_move_rename(cid, srcoid, cid, dstoid);
     t.write(cid, srcoid, 0, data.length(), data);
     t.setattr(cid, srcoid, "attr", data);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ASSERT_TRUE(store->exists(cid, srcoid));
@@ -3084,7 +3101,7 @@ TEST_P(StoreTest, Rename) {
     t.remove(cid, dstoid);
     t.remove(cid, srcoid);
     t.remove_collection(cid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -3099,7 +3116,7 @@ TEST_P(StoreTest, MoveRename) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     t.touch(cid, oid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ASSERT_TRUE(store->exists(cid, oid));
@@ -3114,7 +3131,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ASSERT_TRUE(store->exists(cid, temp_oid));
@@ -3122,7 +3139,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   ASSERT_TRUE(store->exists(cid, oid));
@@ -3149,7 +3166,7 @@ TEST_P(StoreTest, MoveRename) {
     ObjectStore::Transaction t;
     t.remove(cid, oid);
     t.remove_collection(cid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -3180,14 +3197,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(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
   {
     ObjectStore::Transaction t;
     t.remove(cid, oid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -3206,7 +3223,7 @@ TEST_P(StoreTest, BigRGWObjectName) {
     ObjectStore::Transaction t;
     t.remove(cid, oid2);
     t.remove_collection(cid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
 
   }
@@ -3221,31 +3238,31 @@ TEST_P(StoreTest, SetAllocHint) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     t.touch(cid, hoid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
     ObjectStore::Transaction t;
     t.remove(cid, hoid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&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, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
     ObjectStore::Transaction t;
     t.remove_collection(cid);
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
index 8c663a6bf244734896b185d745ec911399469519..edb8e9b3bfc1e2713661b95626cb7273c4f702ac 100644 (file)
@@ -76,7 +76,7 @@ int main(int argc, char **argv) {
     ObjectStore::Transaction t;
     assert(!store->mount());
     t.create_collection(coll, 0);
-    store->apply_transaction(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
   } else {
     assert(!store->mount());
   }
index 25047b574585268d594c7a8057e747392fe5d31d..bbe3c74675e6bb1802610bb3370f00cebd3c2251 100644 (file)
@@ -459,7 +459,7 @@ void WorkloadGenerator::run()
         break;
       }
 
-      c = new C_OnReadable(this, t);
+      c = new C_OnReadable(this);
       goto queue_tx;
     }
 
@@ -469,7 +469,7 @@ void WorkloadGenerator::run()
 
     if (destroy_collection) {
       do_destroy_collection(t, entry, stat_state);
-      c = new C_OnDestroyed(this, t, entry);
+      c = new C_OnDestroyed(this, entry);
       if (!m_num_ops)
         create_coll = true;
     } else {
@@ -480,7 +480,7 @@ void WorkloadGenerator::run()
       do_pgmeta_omap_set(t, entry->m_pgid, entry->m_coll, stat_state);
       do_append_log(t, entry, stat_state);
 
-      c = new C_OnReadable(this, t);
+      c = new C_OnReadable(this);
     }
 
 queue_tx:
@@ -490,7 +490,8 @@ queue_tx:
       c = new C_StatWrapper(stat_state, tmp);
     }
 
-    m_store->queue_transaction(&(entry->m_osr), t, c);
+    m_store->queue_transaction(&(entry->m_osr), std::move(*t), c);
+    delete t;
 
     inc_in_flight();
 
index 65916594e5e11afa71be78edaa6c7cc02f2474c2..3b1557499a2297d62356a5abae614d0dbc74f11b 100644 (file)
@@ -129,9 +129,8 @@ public:
     WorkloadGenerator *wrkldgen_state;
 
   public:
-    C_OnReadable(WorkloadGenerator *state,
-                                  ObjectStore::Transaction *t)
-     :TestObjectStoreState::C_OnFinished(state, t), wrkldgen_state(state) { }
+    C_OnReadable(WorkloadGenerator *state)
+     :TestObjectStoreState::C_OnFinished(state), wrkldgen_state(state) { }
 
     void finish(int r)
     {
@@ -144,9 +143,8 @@ public:
     coll_entry_t *m_entry;
 
   public:
-    C_OnDestroyed(WorkloadGenerator *state,
-        ObjectStore::Transaction *t, coll_entry_t *entry) :
-          C_OnReadable(state, t), m_entry(entry) {}
+    C_OnDestroyed(WorkloadGenerator *state, coll_entry_t *entry) :
+          C_OnReadable(state), m_entry(entry) {}
 
     void finish(int r) {
       C_OnReadable::finish(r);
index 097e406981aa5a76d7c2004a59bd06dac6dfa882..9754cecf999f26a56ef7c2d74092db617ab0d48d 100644 (file)
@@ -111,7 +111,7 @@ void osbench_worker(ObjectStore *os, const Config &cfg,
     uint64_t offset = starting_offset;
     size_t len = cfg.size;
 
-    list<ObjectStore::Transaction*> tls;
+    vector<ObjectStore::Transaction> tls;
 
     std::cout << "Write cycle " << i << std::endl;
     while (len) {
@@ -119,7 +119,8 @@ void osbench_worker(ObjectStore *os, const Config &cfg,
 
       auto t = new ObjectStore::Transaction;
       t->write(cid, oid, offset, count, data);
-      tls.push_back(t);
+      tls.push_back(std::move(*t));
+      delete t;
 
       offset += count;
       if (offset > cfg.size)
@@ -139,11 +140,7 @@ void osbench_worker(ObjectStore *os, const Config &cfg,
     cond.wait(lock, [&done](){ return done; });
     lock.unlock();
 
-    while (!tls.empty()) {
-      auto t = tls.front();
-      tls.pop_front();
-      delete t;
-    }
+
   }
   sequencer.flush();
 }
@@ -261,7 +258,7 @@ int main(int argc, const char *argv[])
     ObjectStore::Sequencer osr(__func__);
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    os->apply_transaction(&osr, t);
+    os->apply_transaction(&osr, std::move(t));
   }
 
   // create the objects
@@ -276,7 +273,7 @@ int main(int argc, const char *argv[])
       ObjectStore::Sequencer osr(__func__);
       ObjectStore::Transaction t;
       t.touch(cid, oids[i]);
-      int r = os->apply_transaction(&osr, t);
+      int r = os->apply_transaction(&osr, std::move(t));
       assert(r == 0);
     }
   } else {
@@ -285,7 +282,7 @@ int main(int argc, const char *argv[])
     ObjectStore::Sequencer osr(__func__);
     ObjectStore::Transaction t;
     t.touch(cid, oids.back());
-    int r = os->apply_transaction(&osr, t);
+    int r = os->apply_transaction(&osr, std::move(t));
     assert(r == 0);
   }
 
@@ -318,7 +315,7 @@ int main(int argc, const char *argv[])
   ObjectStore::Transaction t;
   for (const auto &oid : oids)
     t.remove(cid, oid);
-  os->apply_transaction(&osr,t);
+  os->apply_transaction(&osr,std::move(t));
 
   os->umount();
   return 0;
index d9dfb30d58dd057ef4d105faf880c74be669302b..0d88eed1326ba4120372c2f3289774832ccab723 100644 (file)
@@ -138,7 +138,7 @@ TEST(TestFileJournal, WriteSmall) {
     ASSERT_EQ(0, j.create());
     j.make_writeable();
 
-    list<ObjectStore::Transaction*> tls;
+    vector<ObjectStore::Transaction> tls;
     bufferlist bl;
     bl.append("small");
     int orig_len = j.prepare_entry(tls, &bl);
@@ -168,7 +168,7 @@ TEST(TestFileJournal, WriteBig) {
       memset(foo, 1, sizeof(foo));
       bl.append(foo, sizeof(foo));
     }
-    list<ObjectStore::Transaction*> tls;
+    vector<ObjectStore::Transaction> tls;
     int orig_len = j.prepare_entry(tls, &bl);
     j.submit_entry(1, bl, orig_len, new C_SafeCond(&wait_lock, &cond, &done));
     wait();
@@ -191,7 +191,7 @@ TEST(TestFileJournal, WriteMany) {
 
     C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
 
-    list<ObjectStore::Transaction*> tls;
+    vector<ObjectStore::Transaction> tls;
     bufferlist bl;
     bl.append("small");
     uint64_t seq = 1;
@@ -225,7 +225,7 @@ TEST(TestFileJournal, WriteManyVecs) {
 
     bufferlist first;
     first.append("small");
-    list<ObjectStore::Transaction*> tls;
+    vector<ObjectStore::Transaction> tls;
     int orig_len = j.prepare_entry(tls, &first);
     j.submit_entry(1, first, orig_len, gb.new_sub());
 
@@ -261,7 +261,7 @@ TEST(TestFileJournal, ReplaySmall) {
   g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
   g_ceph_context->_conf->apply_changes(NULL);
 
-  list<ObjectStore::Transaction*> tls;
+  vector<ObjectStore::Transaction> tls;
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -319,7 +319,7 @@ TEST(TestFileJournal, ReplayCorrupt) {
   g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
   g_ceph_context->_conf->apply_changes(NULL);
 
-  list<ObjectStore::Transaction*> tls;
+  vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
     fsid.generate_random();
@@ -416,7 +416,7 @@ TEST(TestFileJournal, WriteTrim) {
     memset(foo, 1, sizeof(foo));
 
     uint64_t seq = 1, committed = 0;
-    list<ObjectStore::Transaction*> tls;
+    vector<ObjectStore::Transaction> tls;
 
     for (unsigned i=0; i<size_mb*2; i++) {
       bl.clear();
@@ -450,7 +450,7 @@ TEST(TestFileJournal, WriteTrimSmall) {
   g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
   g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
   g_ceph_context->_conf->apply_changes(NULL);
-  list<ObjectStore::Transaction*> tls;
+  vector<ObjectStore::Transaction> tls;
 
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
@@ -500,7 +500,7 @@ TEST(TestFileJournal, ReplayDetectCorruptFooterMagic) {
   g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
   g_ceph_context->_conf->apply_changes(NULL);
 
-  list<ObjectStore::Transaction*> tls;
+  vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
     fsid.generate_random();
@@ -557,7 +557,7 @@ TEST(TestFileJournal, ReplayDetectCorruptPayload) {
   g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
   g_ceph_context->_conf->apply_changes(NULL);
 
-  list<ObjectStore::Transaction*> tls;
+  vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
     fsid.generate_random();
@@ -614,7 +614,7 @@ TEST(TestFileJournal, ReplayDetectCorruptHeader) {
   g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
   g_ceph_context->_conf->apply_changes(NULL);
 
-  list<ObjectStore::Transaction*> tls;
+  vector<ObjectStore::Transaction> tls;
   for (unsigned i = 0 ; i < 3; ++i) {
     SCOPED_TRACE(subtests[i].description);
     fsid.generate_random();
index 415dea34dc71cba52b8026f2c64eb998251d9005..e671e47e04bcf61d4d275a6c6d4d77ef71b6bd50 100644 (file)
@@ -72,7 +72,7 @@ int main(int argc, const char **argv)
   dout(0) << "starting thread" << dendl;
   foo.create("foo");
   dout(0) << "starting op" << dendl;
-  fs->apply_transaction(&osr, t);
+  fs->apply_transaction(&osr, std::move(t));
 
 }
 
index a17db191f6ec8ba0ecf9e64ed8f3ee9f48c909fd..5c57b8927fe1074c2e08a6d51061f6a48c903c16 100644 (file)
@@ -106,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(&osr, t);
+  store->apply_transaction(&osr, std::move(t));
 
   bufferlist bl;
   for (int i = 0; i < attrsize; ++i) {
@@ -135,9 +135,10 @@ uint64_t do_run(ObjectStore *store, int attrsize, int numattrs,
                   bl);
       }
     }
-    store->queue_transaction(iter->second.second, t,
+    store->queue_transaction(iter->second.second, std::move(*t),
                             new OnApplied(&lock, &cond, &in_flight,
                                           t));
+    delete t;
   }
   {
     Mutex::Locker l(lock);
index f487bbb55a7af6d4e0d009e4aab54d5bf9cb5758..0d91a0ddd7028a257cc823259bb7aef6a45abc69 100644 (file)
@@ -479,7 +479,7 @@ int initiate_new_remove_pg(ObjectStore *store, spg_t r_pgid,
   if (r < 0) {
     return r;
   }
-  store->apply_transaction(&osr, rmt);
+  store->apply_transaction(&osr, std::move(rmt));
   finish_remove_pgs(store);
   return r;
 }
@@ -698,7 +698,7 @@ int set_inc_osdmap(ObjectStore *store, epoch_t e, bufferlist& bl, bool force,
   ObjectStore::Transaction t;
   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(&osr, t);
+  int ret = store->apply_transaction(&osr, std::move(t));
   if (ret) {
     cerr << "Failed to set inc-osdmap (" << inc_oid << "): " << ret << std::endl;
   } else {
@@ -745,7 +745,7 @@ int set_osdmap(ObjectStore *store, epoch_t e, bufferlist& bl, bool force,
   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(&osr, t);
+  int ret = store->apply_transaction(&osr, std::move(t));
   if (ret) {
     cerr << "Failed to set osdmap (" << full_oid << "): " << ret << std::endl;
   } else {
@@ -997,7 +997,7 @@ int ObjectStoreTool::get_object(ObjectStore *store, coll_t coll,
     }
   }
   if (!dry_run)
-    store->apply_transaction(&osr, *t);
+    store->apply_transaction(&osr, std::move(*t));
   return 0;
 }
 
@@ -1303,7 +1303,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(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
   }
 
   cout << "Importing pgid " << pgid;
@@ -1399,7 +1399,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb,
     set<string> remove;
     remove.insert("_remove");
     t.omap_rmkeys(coll, pgid.make_pgmeta_oid(), remove);
-    store->apply_transaction(&osr, t);
+    store->apply_transaction(&osr, std::move(t));
   }
 
   return 0;
@@ -1466,7 +1466,7 @@ int do_remove_object(ObjectStore *store, coll_t coll,
 
   t.remove(coll, ghobj);
 
-  store->apply_transaction(&osr, t);
+  store->apply_transaction(&osr, std::move(t));
   return 0;
 }
 
@@ -1593,7 +1593,7 @@ int do_set_bytes(ObjectStore *store, coll_t coll,
   } while(true);
 
   if (!dry_run)
-    store->apply_transaction(&osr, *t);
+    store->apply_transaction(&osr, std::move(*t));
   return 0;
 }
 
@@ -1639,7 +1639,7 @@ int do_set_attr(ObjectStore *store, coll_t coll,
 
   t->setattr(coll, ghobj, key,  bl);
 
-  store->apply_transaction(&osr, *t);
+  store->apply_transaction(&osr, std::move(*t));
   return 0;
 }
 
@@ -1658,7 +1658,7 @@ int do_rm_attr(ObjectStore *store, coll_t coll,
 
   t->rmattr(coll, ghobj, key);
 
-  store->apply_transaction(&osr, *t);
+  store->apply_transaction(&osr, std::move(*t));
   return 0;
 }
 
@@ -1718,7 +1718,7 @@ int do_set_omap(ObjectStore *store, coll_t coll,
 
   t->omap_setkeys(coll, ghobj, attrset);
 
-  store->apply_transaction(&osr, *t);
+  store->apply_transaction(&osr, std::move(*t));
   return 0;
 }
 
@@ -1740,7 +1740,7 @@ int do_rm_omap(ObjectStore *store, coll_t coll,
 
   t->omap_rmkeys(coll, ghobj, keys);
 
-  store->apply_transaction(&osr, *t);
+  store->apply_transaction(&osr, std::move(*t));
   return 0;
 }
 
@@ -1786,7 +1786,7 @@ int do_set_omaphdr(ObjectStore *store, coll_t coll,
 
   t->omap_setheader(coll, ghobj, hdrbl);
 
-  store->apply_transaction(&osr, *t);
+  store->apply_transaction(&osr, std::move(*t));
   return 0;
 }
 
@@ -1809,7 +1809,7 @@ struct do_fix_lost : public action_on_object_t {
       ::encode(oi, bl);
       ObjectStore::Transaction t;
       t.setattr(coll, ghobj, OI_ATTR, bl);
-      int r = store->apply_transaction(osr, t);
+      int r = store->apply_transaction(osr, std::move(t));
       if (r < 0) {
        cerr << "Error getting fixing attr on : " << make_pair(coll, ghobj)
             << ", "
@@ -1988,7 +1988,7 @@ int set_size(ObjectStore *store, coll_t coll, ghobject_t &ghobj, uint64_t setsiz
       ::encode(ss, snapattr);
       t.setattr(coll, head, SS_ATTR, snapattr);
     }
-    r = store->apply_transaction(&osr, t);
+    r = store->apply_transaction(&osr, std::move(t));
     if (r < 0) {
       cerr << "Error writing object info: " << make_pair(coll, ghobj) << ", "
          << cpp_strerror(r) << std::endl;
@@ -2042,7 +2042,7 @@ int clear_snapset(ObjectStore *store, coll_t coll, ghobject_t &ghobj,
     ::encode(ss, bl);
     ObjectStore::Transaction t;
     t.setattr(coll, ghobj, SS_ATTR, bl);
-    int r = store->apply_transaction(&osr, t);
+    int r = store->apply_transaction(&osr, std::move(t));
     if (r < 0) {
       cerr << "Error setting snapset on : " << make_pair(coll, ghobj) << ", "
           << cpp_strerror(r) << std::endl;
@@ -2140,7 +2140,7 @@ int remove_clone(ObjectStore *store, coll_t coll, ghobject_t &ghobj, snapid_t cl
   ::encode(snapset, bl);
   ObjectStore::Transaction t;
   t.setattr(coll, ghobj, SS_ATTR, bl);
-  int r = store->apply_transaction(&osr, t);
+  int r = store->apply_transaction(&osr, std::move(t));
   if (r < 0) {
     cerr << "Error setting snapset on : " << make_pair(coll, ghobj) << ", "
         << cpp_strerror(r) << std::endl;
@@ -3131,7 +3131,7 @@ int main(int argc, char **argv)
       ret = write_info(*t, map_epoch, info, past_intervals);
 
       if (ret == 0) {
-        fs->apply_transaction(osr, *t);
+        fs->apply_transaction(osr, std::move(*t));
         cout << "Removal succeeded" << std::endl;
       }
     } else if (op == "mark-complete") {
@@ -3159,7 +3159,7 @@ int main(int argc, char **argv)
        ret = write_info(*t, map_epoch, info, past_intervals);
        if (ret != 0)
          goto out;
-       fs->apply_transaction(osr, *t);
+       fs->apply_transaction(osr, std::move(*t));
       }
       cout << "Marking complete succeeded" << std::endl;
     } else {