]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: drop most queue_transactions() variants
authorSage Weil <sage@redhat.com>
Sat, 27 Jan 2018 19:07:55 +0000 (13:07 -0600)
committerSage Weil <sage@redhat.com>
Mon, 12 Feb 2018 20:35:26 +0000 (14:35 -0600)
Register completions on the Transaction(s) in the caller!

Signed-off-by: Sage Weil <sage@redhat.com>
15 files changed:
src/os/FuseStore.cc
src/os/ObjectStore.cc
src/os/ObjectStore.h
src/osd/OSD.cc
src/osd/PG.cc
src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h
src/test/objectstore/TestObjectStoreState.cc
src/test/objectstore/store_test.cc
src/test/objectstore/test_idempotent.cc
src/test/objectstore/test_memstore_clone.cc
src/test/objectstore_bench.cc
src/test/osd/TestPGLog.cc
src/test/test_trans.cc
src/tools/ceph_objectstore_tool.cc

index a7f4eaf26ccdddca1fedd31c82aa6d50f0d7318a..fb8af3aa2330d68bdf15ed448d0136a5a9f1ef87 100644 (file)
@@ -775,7 +775,7 @@ static int os_mkdir(const char *path, mode_t mode)
   }
 
   if (!t.empty()) {
-    fs->store->queue_transaction(ch, std::move(t), nullptr);
+    fs->store->queue_transaction(ch, std::move(t));
   }
 
   return 0;
@@ -849,7 +849,7 @@ static int os_create(const char *path, mode_t mode, struct fuse_file_info *fi)
   }
 
   if (!t.empty()) {
-    fs->store->queue_transaction(ch, std::move(t), nullptr);
+    fs->store->queue_transaction(ch, std::move(t));
   }
 
   if (pbl) {
@@ -981,7 +981,7 @@ int os_flush(const char *path, struct fuse_file_info *fi)
     return 0;
   }
 
-  fs->store->queue_transaction(ch, std::move(t), nullptr);
+  fs->store->queue_transaction(ch, std::move(t));
 
   return 0;
 }
@@ -1055,7 +1055,7 @@ static int os_unlink(const char *path)
     return -EPERM;
   }
 
-  fs->store->queue_transaction(ch, std::move(t), nullptr);
+  fs->store->queue_transaction(ch, std::move(t));
 
   return 0;
 }
@@ -1098,7 +1098,7 @@ static int os_truncate(const char *path, off_t size)
   ObjectStore::CollectionHandle ch = fs->store->open_collection(cid);
   ObjectStore::Transaction t;
   t.truncate(cid, oid, size);
-  fs->store->queue_transaction(ch, std::move(t), nullptr);
+  fs->store->queue_transaction(ch, std::move(t));
   return 0;
 }
 
index 3356d8b61e0f623fc6ec841bf0416d39e940b2c5..0f08a351bfac1bfe8f1432291dafd69aa226c67c 100644 (file)
@@ -159,20 +159,3 @@ ostream& operator<<(ostream& out, const ObjectStore::Transaction& tx) {
 
   return out << "Transaction(" << &tx << ")"; 
 }
-int ObjectStore::queue_transactions(
-  CollectionHandle& ch,
-  vector<Transaction>& tls,
-  Context *onreadable,
-  Context *oncommit,
-  Context *onreadable_sync,
-  Context *oncomplete,
-  TrackedOpRef op = TrackedOpRef())
-{
-  RunOnDeleteRef _complete (std::make_shared<RunOnDelete>(oncomplete));
-  Context *_onreadable = new Wrapper<RunOnDeleteRef>(
-    onreadable, _complete);
-  Context *_oncommit = new Wrapper<RunOnDeleteRef>(
-    oncommit, _complete);
-  return queue_transactions(ch, tls, _onreadable, _oncommit,
-                           onreadable_sync, op);
-}
index a529266fc0fb0c931f5580860eefe0608ca7fee3..695ca731ff8b39e61694e06c8ef38a7dc449a8c8 100644 (file)
@@ -1420,25 +1420,12 @@ public:
     static void generate_test_instances(list<Transaction*>& o);
   };
 
-  int queue_transaction(CollectionHandle& ch, Transaction&& t, Context *onreadable, Context *ondisk=0,
-                               Context *onreadable_sync=0,
-                               TrackedOpRef op = TrackedOpRef(),
-                               ThreadPool::TPHandle *handle = NULL) {
+  int queue_transaction(CollectionHandle& ch,
+                       Transaction&& t,
+                       TrackedOpRef op = TrackedOpRef(),
+                       ThreadPool::TPHandle *handle = NULL) {
     vector<Transaction> tls;
     tls.push_back(std::move(t));
-    return queue_transactions(ch, tls, onreadable, ondisk, onreadable_sync,
-                             op, handle);
-  }
-
-  int queue_transactions(CollectionHandle& ch, 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);
     return queue_transactions(ch, tls, op, handle);
   }
 
@@ -1448,30 +1435,6 @@ public:
     ThreadPool::TPHandle *handle = NULL) = 0;
 
 
-  int queue_transactions(
-    CollectionHandle& ch,
-    vector<Transaction>& tls,
-    Context *onreadable,
-    Context *oncommit,
-    Context *onreadable_sync,
-    Context *oncomplete,
-    TrackedOpRef op);
-
-  int queue_transaction(
-    CollectionHandle& ch,
-    Transaction&& t,
-    Context *onreadable,
-    Context *oncommit,
-    Context *onreadable_sync,
-    Context *oncomplete,
-    TrackedOpRef op) {
-
-    vector<Transaction> tls;
-    tls.push_back(std::move(t));
-    return queue_transactions(
-      ch, tls, onreadable, oncommit, onreadable_sync, oncomplete, op);
-  }
-
  public:
   ObjectStore(CephContext* cct,
              const std::string& path_) : path(path_), cct(cct) {}
index 9e7154138202dfde0eecc7c26afc4c98cbc07029..8f746d1ee483f5739946c93fc6bd0ee61f141836 100644 (file)
@@ -1886,7 +1886,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_GOBJECT, 0, bl.length(), bl);
-    ret = store->queue_transaction(ch, std::move(t), nullptr);
+    ret = store->queue_transaction(ch, std::move(t));
     if (ret) {
       derr << "OSD::mkfs: error while writing OSD_SUPERBLOCK_GOBJECT: "
           << "queue_transaction returned " << cpp_strerror(ret) << dendl;
@@ -2649,7 +2649,7 @@ int OSD::init()
     dout(5) << "Upgrading superblock adding: " << diff << dendl;
     ObjectStore::Transaction t;
     write_superblock(t);
-    r = store->queue_transaction(service.meta_ch, std::move(t), nullptr);
+    r = store->queue_transaction(service.meta_ch, std::move(t));
     if (r < 0)
       goto out;
   }
@@ -2659,7 +2659,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->queue_transaction(service.meta_ch, std::move(t), nullptr);
+    r = store->queue_transaction(service.meta_ch, std::move(t));
     if (r < 0)
       goto out;
   }
@@ -3485,7 +3485,7 @@ int OSD::shutdown()
   superblock.clean_thru = osdmap->get_epoch();
   ObjectStore::Transaction t;
   write_superblock(t);
-  int r = store->queue_transaction(service.meta_ch, std::move(t), nullptr);
+  int r = store->queue_transaction(service.meta_ch, std::move(t));
   if (r) {
     derr << "OSD::shutdown: error writing superblock: "
         << cpp_strerror(r) << dendl;
@@ -3747,13 +3747,13 @@ void OSD::clear_temp_objects()
        dout(20) << "  removing " << *p << " object " << *q << dendl;
        t.remove(*p, *q);
         if (++removed > cct->_conf->osd_target_transaction_size) {
-          store->queue_transaction(service.meta_ch, std::move(t), nullptr);
+          store->queue_transaction(service.meta_ch, std::move(t));
           t = ObjectStore::Transaction();
           removed = 0;
         }
       }
       if (removed) {
-        store->queue_transaction(service.meta_ch, std::move(t), nullptr);
+        store->queue_transaction(service.meta_ch, std::move(t));
       }
     }
   }
@@ -3787,14 +3787,14 @@ void OSD::recursive_remove_collection(CephContext* cct,
       ceph_abort();
     t.remove(tmp, *p);
     if (removed > cct->_conf->osd_target_transaction_size) {
-      int r = store->queue_transaction(ch, std::move(t), nullptr);
+      int r = store->queue_transaction(ch, std::move(t));
       assert(r == 0);
       t = ObjectStore::Transaction();
       removed = 0;
     }
   }
   t.remove_collection(tmp);
-  int r = store->queue_transaction(ch, std::move(t), nullptr);
+  int r = store->queue_transaction(ch, std::move(t));
   assert(r == 0);
 
   C_SaferCond waiter;
@@ -5097,7 +5097,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->queue_transaction(service->meta_ch, std::move(t), nullptr);
+      r = store->queue_transaction(service->meta_ch, std::move(t));
       if (r < 0)
         ss << "error=" << r;
       else
@@ -5109,7 +5109,7 @@ void TestOpsSocketHook::test_ops(OSDService *service, ObjectStore *store,
 
       keys.insert(key);
       t.omap_rmkeys(coll_t(pgid), ghobject_t(obj), keys);
-      r = store->queue_transaction(service->meta_ch, std::move(t), nullptr);
+      r = store->queue_transaction(service->meta_ch, std::move(t));
       if (r < 0)
         ss << "error=" << r;
       else
@@ -5121,7 +5121,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->queue_transaction(service->meta_ch, std::move(t), nullptr);
+      r = store->queue_transaction(service->meta_ch, std::move(t));
       if (r < 0)
         ss << "error=" << r;
       else
@@ -5150,7 +5150,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->queue_transaction(service->meta_ch, std::move(t), nullptr);
+      r = store->queue_transaction(service->meta_ch, std::move(t));
       if (r < 0)
        ss << "error=" << r;
       else
@@ -7398,11 +7398,11 @@ void OSD::handle_osd_map(MOSDMap *m)
 
   // superblock and commit
   write_superblock(t);
+  t.register_on_applied(new C_OnMapApply(&service, std::move(pinned_maps), last));
+  t.register_on_commit(new C_OnMapCommit(this, start, last, m));
   store->queue_transaction(
     service.meta_ch,
-    std::move(t),
-    new C_OnMapApply(&service, std::move(pinned_maps), last),
-    new C_OnMapCommit(this, start, last, m), 0);
+    std::move(t));
   service.publish_superblock(superblock);
 }
 
@@ -8233,10 +8233,13 @@ void OSD::dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg,
                                        ThreadPool::TPHandle *handle)
 {
   if (!ctx.transaction->empty()) {
+    if (ctx.on_applied)
+      ctx.transaction->register_on_applied(ctx.on_applied);
+    if (ctx.on_safe)
+      ctx.transaction->register_on_commit(ctx.on_safe);
     int tr = store->queue_transaction(
       pg->ch,
-      std::move(*ctx.transaction), ctx.on_applied, ctx.on_safe, NULL,
-      TrackedOpRef(), handle);
+      std::move(*ctx.transaction), TrackedOpRef(), handle);
     assert(tr == 0);
     delete (ctx.transaction);
     for (auto pg : ctx.created_pgs) {
@@ -8271,9 +8274,13 @@ void OSD::dispatch_context(PG::RecoveryCtx &ctx, PG *pg, OSDMapRef curmap,
     delete ctx.on_safe;
     assert(ctx.created_pgs.empty());
   } else {
+    if (ctx.on_applied)
+      ctx.transaction->register_on_applied(ctx.on_applied);
+    if (ctx.on_safe)
+      ctx.transaction->register_on_commit(ctx.on_safe);
     int tr = store->queue_transaction(
       pg->ch,
-      std::move(*ctx.transaction), ctx.on_applied, ctx.on_safe, NULL, TrackedOpRef(),
+      std::move(*ctx.transaction), TrackedOpRef(),
       handle);
     for (auto pg : ctx.created_pgs) {
       pg->ch = store->open_collection(pg->coll);
index 856c2b5bd983e2d6e7cb26aa0eed26f6c097379f..554ae9199d78c6e43627dd8bb394ce181a0c3ebf 100644 (file)
@@ -3053,7 +3053,7 @@ void PG::upgrade(ObjectStore *store)
   write_if_dirty(t);
 
   ObjectStore::CollectionHandle ch = store->open_collection(coll);
-  int r = store->queue_transaction(ch, std::move(t), nullptr);
+  int r = store->queue_transaction(ch, std::move(t));
   if (r != 0) {
     derr << __func__ << ": queue_transaction returned "
         << cpp_strerror(r) << dendl;
@@ -3522,7 +3522,7 @@ void PG::read_state(ObjectStore *store)
   PG::RecoveryCtx rctx(0, 0, 0, 0, 0, new ObjectStore::Transaction);
   handle_loaded(&rctx);
   write_if_dirty(*rctx.transaction);
-  store->queue_transaction(ch, std::move(*rctx.transaction), nullptr);
+  store->queue_transaction(ch, std::move(*rctx.transaction));
   delete rctx.transaction;
 }
 
@@ -4185,7 +4185,7 @@ void PG::_scan_snaps(ScrubMap &smap)
                            << "...repaired";
        }
        snap_mapper.add_oid(hoid, obj_snaps, &_t);
-       r = osd->store->queue_transaction(ch, std::move(t), nullptr);
+       r = osd->store->queue_transaction(ch, std::move(t));
        if (r != 0) {
          derr << __func__ << ": queue_transaction got " << cpp_strerror(r)
               << dendl;
@@ -4232,7 +4232,7 @@ void PG::_repair_oinfo_oid(ScrubMap &smap)
       o.attrs[OI_ATTR] = bp;
 
       t.setattr(coll, ghobject_t(hoid), OI_ATTR, bl);
-      int r = osd->store->queue_transaction(ch, std::move(t), nullptr);
+      int r = osd->store->queue_transaction(ch, std::move(t));
       if (r != 0) {
        derr << __func__ << ": queue_transaction got " << cpp_strerror(r)
             << dendl;
@@ -6209,7 +6209,7 @@ void PG::update_store_on_load()
       lderr(cct) << __func__ << " setting bit width to " << bits << dendl;
       ObjectStore::Transaction t;
       t.collection_set_bits(coll, bits);
-      osd->store->queue_transaction(ch, std::move(t), nullptr);
+      osd->store->queue_transaction(ch, std::move(t));
     }
   }
 }
@@ -6277,11 +6277,11 @@ void PG::_delete_some()
   if (num) {
     dout(20) << __func__ << " deleting " << num << " objects" << dendl;
     Context *fin = new C_DeleteMore(this, e);
+    t.register_on_applied(fin);
+    t.register_on_commit(fin);
     osd->store->queue_transaction(
       ch,
-      std::move(t),
-      fin,
-      fin);
+      std::move(t));
   } else {
     dout(20) << __func__ << " finished" << dendl;
     if (cct->_conf->osd_inject_failure_on_pg_removal) {
@@ -6292,12 +6292,13 @@ void PG::_delete_some()
     PGLog::clear_info_log(info.pgid, &t);
     t.remove_collection(coll);
     PGRef pgref(this);
+    // keep pg ref around until txn completes to avoid any issues
+    // with Sequencer lifecycle (seen w/ filestore).
+    t.register_on_applied(new ContainerContext<PGRef>(pgref));
+    t.register_on_commit(new ContainerContext<PGRef>(pgref));
+    t.register_on_applied(new ContainerContext<PGRef>(pgref));
     int r = osd->store->queue_transaction(
-      osd->meta_ch, std::move(t),
-      // keep pg ref around until txn completes to avoid any issues
-      // with Sequencer lifecycle (seen w/ filestore).
-      new ContainerContext<PGRef>(pgref),
-      new ContainerContext<PGRef>(pgref));
+      osd->meta_ch, std::move(t));
     assert(r == 0);
 
     osd->finish_pg_delete(this);
index 02279f0a3373043c1b58c5959bc778832cba7bde..a1519fc25b23f09f8841db3e6b6bee87f60f5789 100644 (file)
@@ -12254,13 +12254,13 @@ uint64_t PrimaryLogPG::recover_primary(uint64_t max, ThreadPool::TPHandle &handl
 
              ++active_pushes;
 
-             osd->store->queue_transaction(ch, std::move(t),
-                                           new C_OSD_AppliedRecoveredObject(this, obc),
-                                           new C_OSD_CommittedPushedObject(
-                                             this,
-                                             get_osdmap()->get_epoch(),
-                                             info.last_complete),
-                                           new C_OSD_OndiskWriteUnlock(obc));
+             t.register_on_applied_sync(new C_OSD_OndiskWriteUnlock(obc));
+             t.register_on_applied(new C_OSD_AppliedRecoveredObject(this, obc));
+             t.register_on_commit(new C_OSD_CommittedPushedObject(
+                                    this,
+                                    get_osdmap()->get_epoch(),
+                                    info.last_complete));
+             osd->store->queue_transaction(ch, std::move(t));
              continue;
            }
          } else {
index a283fd2864e83c935a4469fdb273a9a126edbf46..f11a391775a443cdcdbb53fa4d3c735a6d1dd619 100644 (file)
@@ -310,11 +310,11 @@ public:
   }
   void queue_transaction(ObjectStore::Transaction&& t,
                         OpRequestRef op) override {
-    osd->store->queue_transaction(ch, std::move(t), 0, 0, 0, op);
+    osd->store->queue_transaction(ch, std::move(t), op);
   }
   void queue_transactions(vector<ObjectStore::Transaction>& tls,
                          OpRequestRef op) override {
-    osd->store->queue_transactions(ch, tls, 0, 0, 0, op, NULL);
+    osd->store->queue_transactions(ch, tls, op, NULL);
   }
   epoch_t get_epoch() const override {
     return get_osdmap()->get_epoch();
index 5a8f90131f3f071addc39093b258de7a4a2077f0..61cba8d9cecbbfc2a848673969c86d6093c955c8 100644 (file)
@@ -37,7 +37,7 @@ void TestObjectStoreState::init(int colls, int objs)
   ObjectStore::Transaction t;
   auto meta_ch = m_store->create_new_collection(coll_t::meta());
   t.create_collection(coll_t::meta(), 0);
-  m_store->queue_transaction(meta_ch, std::move(t), nullptr);
+  m_store->queue_transaction(meta_ch, std::move(t));
 
   wait_for_ready();
 
index 1bf0e96d63b2ff024d4523d1d9ab477ead69fdea..81c03e88f0065a0d8996d53cc8d03237050b6154 100644 (file)
@@ -94,9 +94,9 @@ int queue_transaction(
   if (rand() % 2) {
     ObjectStore::Transaction t2;
     t2.append(t);
-    return store->queue_transaction(ch, std::move(t2), nullptr, nullptr);
+    return store->queue_transaction(ch, std::move(t2));
   } else {
-    return store->queue_transaction(ch, std::move(t), nullptr, nullptr);
+    return store->queue_transaction(ch, std::move(t));
   }
 }
 
@@ -1874,8 +1874,9 @@ TEST_P(StoreTest, MultiSmallWriteSameBlock) {
     t.write(cid, a, 9000, 5, bl, 0);
     u.write(cid, a, 10, 5, bl, 0);
     u.write(cid, a, 7000, 5, bl, 0);
+    t.register_on_commit(&c);
     vector<ObjectStore::Transaction> v = {t, u};
-    store->queue_transactions(ch, v, nullptr, &c);
+    store->queue_transactions(ch, v);
   }
   {
     ObjectStore::Transaction t, u;
@@ -1885,8 +1886,9 @@ TEST_P(StoreTest, MultiSmallWriteSameBlock) {
     t.write(cid, a, 6000, 5, bl, 0);
     u.write(cid, a, 610, 5, bl, 0);
     u.write(cid, a, 11000, 5, bl, 0);
+    t.register_on_commit(&d);
     vector<ObjectStore::Transaction> v = {t, u};
-    store->queue_transactions(ch, v, nullptr, &d);
+    store->queue_transactions(ch, v);
   }
   c.wait();
   d.wait();
@@ -1961,7 +1963,7 @@ TEST_P(StoreTest, AppendDeferredVsTailCache) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
   unsigned min_alloc = g_conf->bluestore_min_alloc_size;
@@ -1975,7 +1977,7 @@ TEST_P(StoreTest, AppendDeferredVsTailCache) {
   {
     ObjectStore::Transaction t;
     t.write(cid, a, 0, bla.length(), bla, 0);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -1996,7 +1998,7 @@ TEST_P(StoreTest, AppendDeferredVsTailCache) {
   {
     ObjectStore::Transaction t;
     t.write(cid, a, bla.length(), blb.length(), blb, 0);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
   bufferptr bpc(size);
@@ -2006,7 +2008,7 @@ TEST_P(StoreTest, AppendDeferredVsTailCache) {
   {
     ObjectStore::Transaction t;
     t.write(cid, a, bla.length() + blb.length(), blc.length(), blc, 0);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
   bufferlist final;
@@ -2024,7 +2026,7 @@ TEST_P(StoreTest, AppendDeferredVsTailCache) {
     t.remove(cid, a);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
   g_conf->set_val("bluestore_inject_deferred_apply_delay", "0");
@@ -2042,7 +2044,7 @@ TEST_P(StoreTest, AppendZeroTrailingSharedBlock) {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
     cerr << "Creating collection " << cid << std::endl;
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
   unsigned min_alloc = g_conf->bluestore_min_alloc_size;
@@ -2058,13 +2060,13 @@ TEST_P(StoreTest, AppendZeroTrailingSharedBlock) {
     bt.append("BADBADBADBAD");
     ObjectStore::Transaction t;
     t.write(cid, a, 0, bt.length(), bt, 0);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
   {
     ObjectStore::Transaction t;
     t.truncate(cid, a, size);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2072,7 +2074,7 @@ TEST_P(StoreTest, AppendZeroTrailingSharedBlock) {
   {
     ObjectStore::Transaction t;
     t.clone(cid, a, b);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
 
@@ -2084,7 +2086,7 @@ TEST_P(StoreTest, AppendZeroTrailingSharedBlock) {
   {
     ObjectStore::Transaction t;
     t.write(cid, a, min_alloc * 3, blb.length(), blb, 0);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
   bufferlist final;
@@ -2107,7 +2109,7 @@ TEST_P(StoreTest, AppendZeroTrailingSharedBlock) {
     t.remove(cid, b);
     t.remove_collection(cid);
     cerr << "Cleaning" << std::endl;
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     ASSERT_EQ(r, 0);
   }
 }
@@ -3697,7 +3699,8 @@ public:
     in_flight_objects.insert(new_obj);
     if (!contents.count(new_obj))
       contents[new_obj] = Object();
-    int status = store->queue_transaction(ch, std::move(t), new C_SyntheticOnReadable(this, new_obj));
+    t.register_on_applied(new C_SyntheticOnReadable(this, new_obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -3728,9 +3731,8 @@ public:
     contents[new_obj].attrs = contents[old_obj].attrs;
     contents[new_obj].data = contents[old_obj].data;
     contents.erase(old_obj);
-    int status = store->queue_transaction(
-      ch, std::move(t),
-      new C_SyntheticOnStash(this, old_obj, new_obj));
+    t.register_on_applied(new C_SyntheticOnStash(this, old_obj, new_obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -3762,9 +3764,8 @@ public:
     contents[new_obj].attrs = contents[old_obj].attrs;
     contents[new_obj].data = contents[old_obj].data;
 
-    int status = store->queue_transaction(
-      ch, std::move(t),
-      new C_SyntheticOnClone(this, old_obj, new_obj));
+    t.register_on_applied(new C_SyntheticOnClone(this, old_obj, new_obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -3844,8 +3845,8 @@ public:
       value.swap(dstdata);
     }
 
-    int status = store->queue_transaction(
-      ch, std::move(t), new C_SyntheticOnClone(this, old_obj, new_obj));
+    t.register_on_applied(new C_SyntheticOnClone(this, old_obj, new_obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -3893,8 +3894,8 @@ public:
     t.write(cid, new_obj, offset, len, bl);
     ++in_flight;
     in_flight_objects.insert(new_obj);
-    int status = store->queue_transaction(
-      ch, std::move(t), new C_SyntheticOnReadable(this, new_obj));
+    t.register_on_applied(new C_SyntheticOnReadable(this, new_obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -3927,8 +3928,8 @@ public:
       bl.swap(data);
     }
 
-    int status = store->queue_transaction(
-      ch, std::move(t), new C_SyntheticOnReadable(this, obj));
+    t.register_on_applied(new C_SyntheticOnReadable(this, obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -3968,8 +3969,8 @@ public:
     t.zero(cid, new_obj, offset, len);
     ++in_flight;
     in_flight_objects.insert(new_obj);
-    int status = store->queue_transaction(
-      ch, std::move(t), new C_SyntheticOnReadable(this, new_obj));
+    t.register_on_applied(new C_SyntheticOnReadable(this, new_obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -4058,8 +4059,8 @@ public:
     t.setattrs(cid, obj, attrs);
     ++in_flight;
     in_flight_objects.insert(obj);
-    int status = store->queue_transaction(
-      ch, std::move(t), new C_SyntheticOnReadable(this, obj));
+    t.register_on_applied(new C_SyntheticOnReadable(this, obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -4157,8 +4158,8 @@ public:
     contents[obj].attrs.erase(it->first);
     ++in_flight;
     in_flight_objects.insert(obj);
-    int status = store->queue_transaction(
-      ch, std::move(t), new C_SyntheticOnReadable(this, obj));
+    t.register_on_applied(new C_SyntheticOnReadable(this, obj));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
@@ -4276,7 +4277,8 @@ public:
     available_objects.erase(to_remove);
     in_flight_objects.insert(to_remove);
     contents.erase(to_remove);
-    int status = store->queue_transaction(ch, std::move(t), new C_SyntheticOnReadable(this, to_remove));
+    t.register_on_applied(new C_SyntheticOnReadable(this, to_remove));
+    int status = store->queue_transaction(ch, std::move(t));
     return status;
   }
 
index 2b256930e0f08b8fbdd2b725d3beb3cb2102bfa0..3fa04e9004f124380d56d65623682dbaba4a7c39 100644 (file)
@@ -79,7 +79,7 @@ int main(int argc, char **argv) {
     assert(!store->mount());
     ch = store->create_new_collection(coll);
     t.create_collection(coll, 0);
-    store->queue_transaction(ch, std::move(t), nullptr);
+    store->queue_transaction(ch, std::move(t));
   } else {
     assert(!store->mount());
     ch = store->open_collection(coll);
index bb20ab2af27cac07652feafff837b09462c2cdb6..adf07cdb9489b2c73307ecaa7337e03ad6145bf8 100644 (file)
@@ -46,7 +46,7 @@ public:
     ObjectStore::Transaction t;
     ch = store->create_new_collection(cid);
     t.create_collection(cid, 4);
-    unsigned r = store->queue_transaction(ch, std::move(t), nullptr);
+    unsigned r = store->queue_transaction(ch, std::move(t));
     if (r != 0) {
       derr << "failed to create collection with " << cpp_strerror(r) << dendl;
     }
@@ -77,7 +77,7 @@ TEST_F(MemStoreClone, CloneRangeAllocated)
   t.write(cid, src, 0, 12, srcbl);
   t.write(cid, dst, 0, 12, dstbl);
   t.clone_range(cid, src, dst, 2, 8, 2);
-  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t), nullptr));
+  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t)));
   ASSERT_EQ(12, store->read(ch, dst, 0, 12, result));
   ASSERT_EQ(expected, result);
 }
@@ -101,7 +101,7 @@ TEST_F(MemStoreClone, CloneRangeHole)
   t.write(cid, src, 12, 4, srcbl);
   t.write(cid, dst, 0, 12, dstbl);
   t.clone_range(cid, src, dst, 2, 8, 2);
-  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t), nullptr));
+  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t)));
   ASSERT_EQ(12, store->read(ch, dst, 0, 12, result));
   ASSERT_EQ(expected, result);
 }
@@ -125,7 +125,7 @@ TEST_F(MemStoreClone, CloneRangeHoleStart)
   t.write(cid, src, 8, 4, srcbl);
   t.write(cid, dst, 0, 12, dstbl);
   t.clone_range(cid, src, dst, 2, 8, 2);
-  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t), nullptr));
+  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t)));
   ASSERT_EQ(12, store->read(ch, dst, 0, 12, result));
   ASSERT_EQ(expected, result);
 }
@@ -150,7 +150,7 @@ TEST_F(MemStoreClone, CloneRangeHoleMiddle)
   t.write(cid, src, 8, 4, srcbl);
   t.write(cid, dst, 0, 12, dstbl);
   t.clone_range(cid, src, dst, 2, 8, 2);
-  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t), nullptr));
+  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t)));
   ASSERT_EQ(12, store->read(ch, dst, 0, 12, result));
   ASSERT_EQ(expected, result);
 }
@@ -175,7 +175,7 @@ TEST_F(MemStoreClone, CloneRangeHoleEnd)
   t.write(cid, src, 12, 4, srcbl);
   t.write(cid, dst, 0, 12, dstbl);
   t.clone_range(cid, src, dst, 2, 8, 2);
-  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t), nullptr));
+  ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t)));
   ASSERT_EQ(12, store->read(ch, dst, 0, 12, result));
   ASSERT_EQ(expected, result);
 }
index a1f2feee99bc947caf59d33fdc144fe54b6f5c89..a23b0c4cba8b3ddede39716073031f95a83f97ef 100644 (file)
@@ -259,7 +259,7 @@ int main(int argc, const char *argv[])
   {
     ObjectStore::Transaction t;
     t.create_collection(cid, 0);
-    os->queue_transaction(ch, std::move(t), nullptr);
+    os->queue_transaction(ch, std::move(t));
   }
 
   // create the objects
@@ -273,7 +273,7 @@ int main(int argc, const char *argv[])
 
       ObjectStore::Transaction t;
       t.touch(cid, oids[i]);
-      int r = os->queue_transaction(ch, std::move(t), nullptr);
+      int r = os->queue_transaction(ch, std::move(t));
       assert(r == 0);
     }
   } else {
@@ -281,7 +281,7 @@ int main(int argc, const char *argv[])
 
     ObjectStore::Transaction t;
     t.touch(cid, oids.back());
-    int r = os->queue_transaction(ch, std::move(t), nullptr);
+    int r = os->queue_transaction(ch, std::move(t));
     assert(r == 0);
   }
 
@@ -313,7 +313,7 @@ int main(int argc, const char *argv[])
   ObjectStore::Transaction t;
   for (const auto &oid : oids)
     t.remove(cid, oid);
-  os->queue_transaction(ch, std::move(t), nullptr);
+  os->queue_transaction(ch, std::move(t));
 
   os->umount();
   return 0;
index 1aa64f4cdb6ffe693824eb33037fbc44e2c1b513..f26af817da553b12dcb40aad1db65db327091bd7 100644 (file)
@@ -2321,7 +2321,7 @@ public:
     test_coll = coll_t(spg_t(pg_t(1, 1)));
     ch = store->create_new_collection(test_coll);
     t.create_collection(test_coll, 0);
-    store->queue_transaction(ch, std::move(t), nullptr);
+    store->queue_transaction(ch, std::move(t));
     existing_oid = mk_obj(0);
     nonexistent_oid = mk_obj(1);
     ghobject_t existing_ghobj(existing_oid);
@@ -2332,7 +2332,7 @@ public:
     ObjectStore::Transaction t2;
     t2.touch(test_coll, ghobject_t(existing_oid));
     t2.setattr(test_coll, ghobject_t(existing_oid), OI_ATTR, enc_oi);
-    ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t2), nullptr));
+    ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t2)));
     info.last_backfill = hobject_t::get_max();
     info.last_complete = eversion_t();
   }
@@ -2404,7 +2404,7 @@ public:
     test_coll = coll_t(spg_t(pg_t(1, 1)));
     auto ch = store->create_new_collection(test_coll);
     t.create_collection(test_coll, 0);
-    store->queue_transaction(ch, std::move(t), nullptr);
+    store->queue_transaction(ch, std::move(t));
   }
 
   void TearDown() override {
@@ -2490,7 +2490,7 @@ public:
       t.omap_setkeys(test_coll, log_oid, km);
     }
     auto ch = store->open_collection(test_coll);
-    ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t), nullptr));
+    ASSERT_EQ(0u, store->queue_transaction(ch, std::move(t)));
 
     auto orig_dups = log.dups;
     clear();
index 9b161e180f60c619661adbdc018efcacdd69ff5d..75782c80d56dc3b65b1bf0e01165cd3c21271f7c 100644 (file)
@@ -74,6 +74,6 @@ int main(int argc, const char **argv)
   dout(0) << "starting thread" << dendl;
   foo.create("foo");
   dout(0) << "starting op" << dendl;
-  fs->queue_transaction(ch, std::move(t), nullptr);
+  fs->queue_transaction(ch, std::move(t));
 }
 
index 048350cc552cf70c0ba1de9a319ac9cfd8420757..c84d138997783de2f082407551a8ea8ae814656f 100644 (file)
@@ -431,7 +431,7 @@ int initiate_new_remove_pg(ObjectStore *store, spg_t r_pgid)
     return r;
   }
   ObjectStore::CollectionHandle ch = store->open_collection(coll_t(r_pgid));
-  store->queue_transaction(ch, std::move(rmt), nullptr);
+  store->queue_transaction(ch, std::move(rmt));
   finish_remove_pgs(store);
   return r;
 }
@@ -668,7 +668,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->queue_transaction(ch, std::move(t), nullptr);
+  int ret = store->queue_transaction(ch, std::move(t));
   if (ret) {
     cerr << "Failed to set inc-osdmap (" << inc_oid << "): " << ret << std::endl;
   } else {
@@ -716,7 +716,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->queue_transaction(ch, std::move(t), nullptr);
+  int ret = store->queue_transaction(ch, std::move(t));
   if (ret) {
     cerr << "Failed to set osdmap (" << full_oid << "): " << ret << std::endl;
   } else {
@@ -1170,7 +1170,7 @@ int ObjectStoreTool::get_object(ObjectStore *store,
     }
   }
   if (!dry_run)
-    store->queue_transaction(ch, std::move(*t), nullptr);
+    store->queue_transaction(ch, std::move(*t));
   return 0;
 }
 
@@ -1711,7 +1711,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb,
     encode((char)1, values["_remove"]);
     t.omap_setkeys(coll, pgid.make_pgmeta_oid(), values);
 
-    store->queue_transaction(ch, std::move(t), nullptr);
+    store->queue_transaction(ch, std::move(t));
   }
 
   cout << "Importing pgid " << pgid;
@@ -1829,7 +1829,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->queue_transaction(ch, std::move(t), nullptr);
+    store->queue_transaction(ch, std::move(t));
   }
 
   return 0;
@@ -1945,7 +1945,7 @@ int do_remove_object(ObjectStore *store, coll_t coll,
   }
 
   if (!dry_run)
-    store->queue_transaction(ch, std::move(t), nullptr);
+    store->queue_transaction(ch, std::move(t));
 
   return 0;
 }
@@ -2076,7 +2076,7 @@ int do_set_bytes(ObjectStore *store, coll_t coll,
 
   auto ch = store->open_collection(coll);
   if (!dry_run)
-    store->queue_transaction(ch, std::move(*t), nullptr);
+    store->queue_transaction(ch, std::move(*t));
   return 0;
 }
 
@@ -2123,7 +2123,7 @@ int do_set_attr(ObjectStore *store, coll_t coll,
   t->setattr(coll, ghobj, key,  bl);
 
   auto ch = store->open_collection(coll);
-  store->queue_transaction(ch, std::move(*t), nullptr);
+  store->queue_transaction(ch, std::move(*t));
   return 0;
 }
 
@@ -2142,7 +2142,7 @@ int do_rm_attr(ObjectStore *store, coll_t coll,
   t->rmattr(coll, ghobj, key);
 
   auto ch = store->open_collection(coll);
-  store->queue_transaction(ch, std::move(*t), nullptr);
+  store->queue_transaction(ch, std::move(*t));
   return 0;
 }
 
@@ -2203,7 +2203,7 @@ int do_set_omap(ObjectStore *store, coll_t coll,
   t->omap_setkeys(coll, ghobj, attrset);
 
   auto ch = store->open_collection(coll);
-  store->queue_transaction(ch, std::move(*t), nullptr);
+  store->queue_transaction(ch, std::move(*t));
   return 0;
 }
 
@@ -2225,7 +2225,7 @@ int do_rm_omap(ObjectStore *store, coll_t coll,
   t->omap_rmkeys(coll, ghobj, keys);
 
   auto ch = store->open_collection(coll);
-  store->queue_transaction(ch, std::move(*t), nullptr);
+  store->queue_transaction(ch, std::move(*t));
   return 0;
 }
 
@@ -2272,7 +2272,7 @@ int do_set_omaphdr(ObjectStore *store, coll_t coll,
   t->omap_setheader(coll, ghobj, hdrbl);
 
   auto ch = store->open_collection(coll);
-  store->queue_transaction(ch, std::move(*t), nullptr);
+  store->queue_transaction(ch, std::move(*t));
   return 0;
 }
 
@@ -2292,7 +2292,7 @@ struct do_fix_lost : public action_on_object_t {
       ObjectStore::Transaction t;
       t.setattr(coll, ghobj, OI_ATTR, bl);
       auto ch = store->open_collection(coll);
-      int r = store->queue_transaction(ch, std::move(t), nullptr);
+      int r = store->queue_transaction(ch, std::move(t));
       if (r < 0) {
        cerr << "Error getting fixing attr on : " << make_pair(coll, ghobj)
             << ", "
@@ -2481,7 +2481,7 @@ int set_size(
       t.setattr(coll, head, SS_ATTR, snapattr);
     }
     auto ch = store->open_collection(coll);
-    r = store->queue_transaction(ch, std::move(t), nullptr);
+    r = store->queue_transaction(ch, std::move(t));
     if (r < 0) {
       cerr << "Error writing object info: " << make_pair(coll, ghobj) << ", "
          << cpp_strerror(r) << std::endl;
@@ -2528,7 +2528,7 @@ int clear_snapset(ObjectStore *store, coll_t coll, ghobject_t &ghobj,
     ObjectStore::Transaction t;
     t.setattr(coll, ghobj, SS_ATTR, bl);
     auto ch = store->open_collection(coll);
-    int r = store->queue_transaction(ch, std::move(t), nullptr);
+    int r = store->queue_transaction(ch, std::move(t));
     if (r < 0) {
       cerr << "Error setting snapset on : " << make_pair(coll, ghobj) << ", "
           << cpp_strerror(r) << std::endl;
@@ -2627,7 +2627,7 @@ int remove_clone(
   ObjectStore::Transaction t;
   t.setattr(coll, ghobj, SS_ATTR, bl);
   auto ch = store->open_collection(coll);
-  int r = store->queue_transaction(ch, std::move(t), nullptr);
+  int r = store->queue_transaction(ch, std::move(t));
   if (r < 0) {
     cerr << "Error setting snapset on : " << make_pair(coll, ghobj) << ", "
         << cpp_strerror(r) << std::endl;
@@ -2702,7 +2702,7 @@ int dup(string srcpath, ObjectStore *src, string dstpath, ObjectStore *dst)
         }
       }
       t.create_collection(cid, bits);
-      dst->queue_transaction(dch, std::move(t), nullptr);
+      dst->queue_transaction(dch, std::move(t));
     }
 
     ghobject_t pos;
@@ -2758,7 +2758,7 @@ int dup(string srcpath, ObjectStore *src, string dstpath, ObjectStore *dst)
          t.omap_setkeys(cid, oid, omap);
        }
 
-       dst->queue_transaction(dch, std::move(t), nullptr);
+       dst->queue_transaction(dch, std::move(t));
       }
     }
     cout << "  " << std::setw(16) << n << " objects, "
@@ -3978,7 +3978,7 @@ int main(int argc, char **argv)
        if (ret != 0)
          goto out;
        auto ch = fs->open_collection(coll_t(pgid));
-       fs->queue_transaction(ch, std::move(*t), nullptr);
+       fs->queue_transaction(ch, std::move(*t));
       }
       cout << "Marking complete succeeded" << std::endl;
     } else {