]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test/crimson/../test_transaction_manager: fix try_get_extent() to handle transaction...
authorYingxin Cheng <yingxin.cheng@intel.com>
Thu, 22 May 2025 03:52:37 +0000 (11:52 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Wed, 4 Jun 2025 02:17:52 +0000 (10:17 +0800)
Outside interruptible future, transaction can become invalidated
implicitly.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/test/crimson/seastore/test_transaction_manager.cc

index 514edc0407ff0f3f2f1c36039992a70bd0e0548e..e8c0e19e03cb700e345213573d358de4940ed6b7 100644 (file)
@@ -543,7 +543,11 @@ struct transaction_manager_test_t :
        "get_extent got invalid error"
       }
     ).get();
+    if (t.t->is_conflicted()) {
+      return nullptr;
+    }
     if (ext) {
+      ceph_assert(ext->is_valid());
       EXPECT_EQ(addr, ext->get_laddr());
     }
     return ext;
@@ -569,7 +573,11 @@ struct transaction_manager_test_t :
        "get_extent got invalid error"
       }
     ).get();
+    if (t.t->is_conflicted()) {
+      return nullptr;
+    }
     if (ext) {
+      ceph_assert(ext->is_valid());
       EXPECT_EQ(addr, ext->get_laddr());
     }
     return ext;
@@ -1572,14 +1580,12 @@ struct transaction_manager_test_t :
               last_pin = pin->duplicate();
            }
             auto last_ext = try_get_extent(t, last_pin.get_key());
-            if (last_ext) {
-             auto last_ext1 = mutate_extent(t, last_ext);
-             ASSERT_TRUE(last_ext1->is_exist_mutation_pending());
-            } else {
-             conflicted++;
-             return;
+            if (!last_ext) {
+              conflicted++;
+              return;
             }
-
+            auto last_ext1 = mutate_extent(t, last_ext);
+            ASSERT_TRUE(last_ext1->is_exist_mutation_pending());
            if (try_submit_transaction(std::move(t))) {
              success++;
              logger().info("transaction {} submit the transction",