implicit trx first stmt retry does not abort tx

This commit is contained in:
obdev
2024-02-06 23:39:29 +00:00
committed by ob-robot
parent cf46015461
commit 08bd926417
6 changed files with 86 additions and 14 deletions

View File

@ -223,6 +223,36 @@ TEST_F(ObTestTx, rollback_savepoint_with_uncertain_participants)
ASSERT_EQ(0, tx.parts_.count());
}
TEST_F(ObTestTx, rollback_savepoint_with_need_retry_error)
{
START_ONE_TX_NODE(n1);
PREPARE_TX(n1, tx);
PREPARE_TX_PARAM(tx_param);
GET_READ_SNAPSHOT(n1, tx, tx_param, snapshot);
{
CREATE_IMPLICIT_SAVEPOINT(n1, tx, tx_param, sp);
ASSERT_TRUE(sp.is_valid());
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 200));
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp, n1->ts_after_ms(5), nullptr, OB_TRANSACTION_SET_VIOLATION));
ASSERT_EQ(ObTxDesc::State::IDLE, tx.state_);
ASSERT_EQ(0, tx.parts_.count());
ASSERT_EQ(ObTxSEQ::INVL(), tx.active_scn_);
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp, n1->ts_after_ms(5), nullptr));
}
{
CREATE_IMPLICIT_SAVEPOINT(n1, tx, tx_param, sp);
ASSERT_TRUE(sp.is_valid());
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 200));
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp, n1->ts_after_ms(5), nullptr, OB_TRY_LOCK_ROW_CONFLICT));
ASSERT_EQ(ObTxDesc::State::IDLE, tx.state_);
ASSERT_EQ(0, tx.parts_.count());
ASSERT_EQ(ObTxSEQ::INVL(), tx.active_scn_);
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp, n1->ts_after_ms(5), nullptr));
}
}
TEST_F(ObTestTx, switch_to_follower_gracefully)
{
int ret = OB_SUCCESS;