]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore: deal with transaction conflicts when doing mkfs
authorXuehan Xu <xxhdx1985126@gmail.com>
Fri, 13 Aug 2021 13:57:48 +0000 (21:57 +0800)
committerXuehan Xu <xxhdx1985126@gmail.com>
Wed, 8 Sep 2021 03:03:01 +0000 (11:03 +0800)
Cleaner transactions can conflict with mkfs transactions, retry mkfs transactions
when that happens

Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
src/crimson/os/seastore/seastore.cc
src/test/crimson/seastore/onode_tree/test_fltree_onode_manager.cc

index 0e6772bff7108f17658364f642910f4c23413ce0..295518d43645230e84ba72981edfe3e834d2a967 100644 (file)
@@ -119,15 +119,17 @@ seastar::future<> SeaStore::mkfs(uuid_d new_osd_fsid)
   }).safe_then([this] {
     return transaction_manager->mount();
   }).safe_then([this] {
-    return transaction_manager->with_transaction_intr(
-        Transaction::src_t::MUTATE, [this](auto& t) {
-      return onode_manager->mkfs(t
-      ).si_then([this, &t] {
-        return collection_manager->mkfs(t);
-      }).si_then([this, &t](auto coll_root) {
-        transaction_manager->write_collection_root(
-          t, coll_root);
-        return transaction_manager->submit_transaction(t);
+    return repeat_eagain([this] {
+      return transaction_manager->with_transaction_intr(
+         Transaction::src_t::MUTATE, [this](auto& t) {
+       return onode_manager->mkfs(t
+       ).si_then([this, &t] {
+         return collection_manager->mkfs(t);
+       }).si_then([this, &t](auto coll_root) {
+         transaction_manager->write_collection_root(
+           t, coll_root);
+         return transaction_manager->submit_transaction(t);
+       });
       });
     });
   }).safe_then([this] {
index b132ec29dd2acab91b32f9f3d8efaada4526644c..b52a79e29a7876574c166e5b7e57ddce7fa3aaa1 100644 (file)
@@ -84,16 +84,18 @@ struct fltree_onode_manager_test_t
     ).then([this] {
       return tm->mount(
       ).safe_then([this] {
-       return seastar::do_with(
-         create_mutate_transaction(),
-         [this](auto &ref_t) {
-           return with_trans_intr(*ref_t, [&](auto &t) {
-             return manager->mkfs(t
-             ).si_then([this, &t] {
-               return submit_transaction_fut2(t);
+       return repeat_eagain([this] {
+         return seastar::do_with(
+           create_mutate_transaction(),
+           [this](auto &ref_t) {
+             return with_trans_intr(*ref_t, [&](auto &t) {
+               return manager->mkfs(t
+               ).si_then([this, &t] {
+                 return submit_transaction_fut2(t);
+               });
              });
-           });
          });
+       });
       }).safe_then([this] {
        return tm->close();
       }).handle_error(