From b47a9e5f059c3a3b9a4166f2027ce9fe44943517 Mon Sep 17 00:00:00 2001 From: Yingxin Cheng Date: Thu, 22 May 2025 11:52:37 +0800 Subject: [PATCH] test/crimson/../test_transaction_manager: fix try_get_extent() to handle transaction conflicts Outside interruptible future, transaction can become invalidated implicitly. Signed-off-by: Yingxin Cheng --- .../seastore/test_transaction_manager.cc | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/test/crimson/seastore/test_transaction_manager.cc b/src/test/crimson/seastore/test_transaction_manager.cc index 514edc0407f..e8c0e19e03c 100644 --- a/src/test/crimson/seastore/test_transaction_manager.cc +++ b/src/test/crimson/seastore/test_transaction_manager.cc @@ -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", -- 2.39.5