[master] change seq_no to ObTxSEQ
This commit is contained in:
@ -35,19 +35,19 @@ public:
|
||||
bool need_submit_log = true,
|
||||
bool need_fill_redo = true,
|
||||
share::SCN scn = share::SCN::max_scn(),
|
||||
int64_t seq_no = INT64_MAX)
|
||||
transaction::ObTxSEQ seq_no = transaction::ObTxSEQ::MAX_VAL())
|
||||
: ObITransCallback(need_fill_redo, need_submit_log),
|
||||
mt_(mt), seq_no_(seq_no) { scn_ = scn; }
|
||||
|
||||
virtual ObIMemtable* get_memtable() const override { return mt_; }
|
||||
virtual int64_t get_seq_no() const override { return seq_no_; }
|
||||
virtual transaction::ObTxSEQ get_seq_no() const override { return seq_no_; }
|
||||
virtual int checkpoint_callback() override;
|
||||
virtual int rollback_callback() override;
|
||||
virtual int calc_checksum(const share::SCN checksum_scn,
|
||||
ObBatchChecksum *checksumer) override;
|
||||
|
||||
ObMemtable *mt_;
|
||||
int64_t seq_no_;
|
||||
transaction::ObTxSEQ seq_no_;
|
||||
};
|
||||
|
||||
class ObMockBitSet {
|
||||
@ -99,7 +99,7 @@ class TestTxCallbackList : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
TestTxCallbackList()
|
||||
: seq_counter_(0),
|
||||
: seq_counter_(),
|
||||
mt_counter_(0),
|
||||
mt_ctx_(),
|
||||
cb_allocator_(),
|
||||
@ -140,7 +140,7 @@ public:
|
||||
bool need_fill_redo = true,
|
||||
share::SCN scn = share::SCN::max_scn())
|
||||
{
|
||||
int64_t seq_no = ++seq_counter_;
|
||||
auto seq_no = ++seq_counter_;
|
||||
ObMockTxCallback *cb = new ObMockTxCallback(mt,
|
||||
need_submit_log,
|
||||
need_fill_redo,
|
||||
@ -171,7 +171,7 @@ public:
|
||||
return (ObMemtable *)(mt_counter_);
|
||||
}
|
||||
|
||||
int64_t get_seq_no() const
|
||||
transaction::ObTxSEQ get_seq_no() const
|
||||
{
|
||||
return seq_counter_;
|
||||
}
|
||||
@ -193,7 +193,7 @@ public:
|
||||
static int64_t rollback_cnt_;
|
||||
static ObMockBitSet checksum_;
|
||||
|
||||
int64_t seq_counter_;
|
||||
transaction::ObTxSEQ seq_counter_;
|
||||
int64_t mt_counter_;
|
||||
ObMemtableCtx mt_ctx_;
|
||||
ObMemtableCtxCbAllocator cb_allocator_;
|
||||
@ -222,7 +222,7 @@ int ObMockTxCallback::calc_checksum(const share::SCN checksum_scn,
|
||||
ObBatchChecksum *)
|
||||
{
|
||||
if (checksum_scn <= scn_) {
|
||||
TestTxCallbackList::checksum_.add_bit(seq_no_);
|
||||
TestTxCallbackList::checksum_.add_bit(seq_no_.get_seq());
|
||||
TRANS_LOG(INFO, "need to calc checksum", K(checksum_scn), K(scn_), K(seq_no_));
|
||||
} else {
|
||||
TRANS_LOG(INFO, "no need to calc checksum", K(checksum_scn), K(scn_), K(seq_no_));
|
||||
@ -466,7 +466,7 @@ TEST_F(TestTxCallbackList, remove_callback_by_rollback_to)
|
||||
scn_2.convert_for_logservice(2);
|
||||
scn_3.convert_for_logservice(3);
|
||||
|
||||
int64_t savepoint0 = get_seq_no();
|
||||
auto savepoint0 = get_seq_no();
|
||||
create_and_append_callback(memtable1,
|
||||
false, /*need_submit_log*/
|
||||
false, /*need_fill_redo*/
|
||||
@ -479,7 +479,7 @@ TEST_F(TestTxCallbackList, remove_callback_by_rollback_to)
|
||||
false, /*need_submit_log*/
|
||||
false, /*need_fill_redo*/
|
||||
scn_2/*scn*/);
|
||||
int64_t savepoint1 = get_seq_no();
|
||||
auto savepoint1 = get_seq_no();
|
||||
create_and_append_callback(memtable3,
|
||||
false, /*need_submit_log*/
|
||||
false, /*need_fill_redo*/
|
||||
@ -494,11 +494,11 @@ TEST_F(TestTxCallbackList, remove_callback_by_rollback_to)
|
||||
create_and_append_callback(memtable1,
|
||||
true, /*need_submit_log*/
|
||||
true /*need_fill_redo*/);
|
||||
int64_t savepoint2 = get_seq_no();
|
||||
auto savepoint2 = get_seq_no();
|
||||
create_and_append_callback(memtable3,
|
||||
true, /*need_submit_log*/
|
||||
true /*need_fill_redo*/);
|
||||
int64_t savepoint3 = get_seq_no();
|
||||
auto savepoint3 = get_seq_no();
|
||||
create_and_append_callback(memtable1,
|
||||
true, /*need_submit_log*/
|
||||
true /*need_fill_redo*/);
|
||||
@ -923,7 +923,7 @@ TEST_F(TestTxCallbackList, checksum_rollback_to_and_tx_end)
|
||||
scn_3.convert_for_logservice(3);
|
||||
scn_4.convert_for_logservice(4);
|
||||
|
||||
int64_t savepoint0 = get_seq_no();
|
||||
auto savepoint0 = get_seq_no();
|
||||
create_and_append_callback(memtable1,
|
||||
false, /*need_submit_log*/
|
||||
false, /*need_fill_redo*/
|
||||
@ -936,7 +936,7 @@ TEST_F(TestTxCallbackList, checksum_rollback_to_and_tx_end)
|
||||
false, /*need_submit_log*/
|
||||
false, /*need_fill_redo*/
|
||||
scn_2/*scn*/);
|
||||
int64_t savepoint1 = get_seq_no();
|
||||
auto savepoint1 = get_seq_no();
|
||||
create_and_append_callback(memtable3,
|
||||
false, /*need_submit_log*/
|
||||
false, /*need_fill_redo*/
|
||||
@ -951,11 +951,11 @@ TEST_F(TestTxCallbackList, checksum_rollback_to_and_tx_end)
|
||||
create_and_append_callback(memtable1,
|
||||
true, /*need_submit_log*/
|
||||
true /*need_fill_redo*/);
|
||||
int64_t savepoint2 = get_seq_no();
|
||||
auto savepoint2 = get_seq_no();
|
||||
create_and_append_callback(memtable3,
|
||||
true, /*need_submit_log*/
|
||||
true /*need_fill_redo*/);
|
||||
int64_t savepoint3 = get_seq_no();
|
||||
auto savepoint3 = get_seq_no();
|
||||
create_and_append_callback(memtable1,
|
||||
true, /*need_submit_log*/
|
||||
true /*need_fill_redo*/);
|
||||
@ -1023,7 +1023,7 @@ TEST_F(TestTxCallbackList, checksum_all_and_tx_end_test) {
|
||||
it->scn_.convert_for_logservice(cur_log);
|
||||
enable = true;
|
||||
need_submit_head = it;
|
||||
my_calculate.add_bit(it->get_seq_no());
|
||||
my_calculate.add_bit(it->get_seq_no().get_seq());
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
@ -1085,9 +1085,10 @@ TEST_F(TestTxCallbackList, checksum_all_and_tx_end_test) {
|
||||
[&]() -> bool{
|
||||
bool enable = false;
|
||||
if (!callback_list_.empty() &&
|
||||
callback_list_.head_.next_->get_seq_no() + 1 < seq_counter_ - 1) {
|
||||
int64_t seq = ObRandom::rand(callback_list_.head_.next_->get_seq_no() + 1,
|
||||
seq_counter_ - 1);
|
||||
callback_list_.head_.next_->get_seq_no().get_seq() + 1 < seq_counter_.get_seq() - 1) {
|
||||
auto from = callback_list_.head_.next_->get_seq_no();
|
||||
auto range_cnt = seq_counter_.get_seq() - from.get_seq();
|
||||
auto seq = from + ObRandom::rand(1, range_cnt - 1);
|
||||
enable = true;
|
||||
if (enable) {
|
||||
if (need_submit_head->get_seq_no() > seq) {
|
||||
@ -1131,7 +1132,7 @@ TEST_F(TestTxCallbackList, checksum_all_and_tx_end_test) {
|
||||
it = it->next_) {
|
||||
EXPECT_EQ(it->need_submit_log_, true);
|
||||
EXPECT_EQ(it->need_fill_redo_, true);
|
||||
my_calculate.add_bit(it->get_seq_no());
|
||||
my_calculate.add_bit(it->get_seq_no().get_seq());
|
||||
}
|
||||
|
||||
EXPECT_EQ(OB_SUCCESS, callback_list_.tx_commit());
|
||||
|
||||
@ -292,7 +292,7 @@ public:
|
||||
store_ctx.mvcc_acc_ctx_.init_write(trans_ctx_,
|
||||
mem_ctx_,
|
||||
tx_desc_.tx_id_,
|
||||
1000,
|
||||
ObTxSEQ(1000, 0),
|
||||
tx_desc_,
|
||||
tx_table_guard,
|
||||
snapshot,
|
||||
|
||||
@ -139,7 +139,7 @@ public:
|
||||
|
||||
int check_sql_sequence_can_read(
|
||||
const transaction::ObTransID &data_trans_id,
|
||||
const int64_t sql_sequence,
|
||||
const transaction::ObTxSEQ &sql_sequence,
|
||||
const share::SCN scn,
|
||||
bool &can_read)
|
||||
{
|
||||
|
||||
@ -150,10 +150,10 @@ TEST_F(ObTestTx, rollback_savepoint_with_msg_lost)
|
||||
tx_param.cluster_id_ = 100;
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx, tx_param.isolation_, n1->ts_after_ms(5), snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
int64_t sp2 = 0;
|
||||
ObTxSEQ sp2;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp2));
|
||||
ASSERT_EQ(OB_SUCCESS, n2->write(tx, snapshot, 101, 113));
|
||||
// inject link failure between scheduler to participant 2
|
||||
@ -215,7 +215,7 @@ TEST_F(ObTestTx, rollback_savepoint_with_uncertain_participants)
|
||||
PREPARE_TX(n1, tx);
|
||||
PREPARE_TX_PARAM(tx_param);
|
||||
CREATE_IMPLICIT_SAVEPOINT(n1, tx, tx_param, sp);
|
||||
ASSERT_NE(sp, 0);
|
||||
ASSERT_TRUE(sp.is_valid());
|
||||
share::ObLSArray uncertain_parts;
|
||||
ASSERT_EQ(OB_SUCCESS, uncertain_parts.push_back(share::ObLSID(1001)));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp, n1->ts_after_us(100000), &uncertain_parts));
|
||||
@ -244,7 +244,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully)
|
||||
ASSERT_EQ(OB_SUCCESS, n1->acquire_tx(tx_ptr));
|
||||
ObTxDesc &tx = *tx_ptr;
|
||||
|
||||
int64_t sp1 = 0, sp2 = 0;
|
||||
ObTxSEQ sp1, sp2;
|
||||
|
||||
{ // prepare snapshot for write
|
||||
ObTxReadSnapshot snapshot;
|
||||
@ -328,7 +328,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_fail)
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp = 0;
|
||||
ObTxSEQ sp;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 1000 + i, 2000 + i));
|
||||
}
|
||||
@ -389,7 +389,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_fail)
|
||||
snapshot));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->read(snapshot, 1000 + i, val1));
|
||||
ASSERT_EQ(2000 + i, val1);
|
||||
int64_t sp = 0;
|
||||
ObTxSEQ sp;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 1000 + i, 3000 + i));
|
||||
}
|
||||
@ -435,7 +435,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_then_forcedly)
|
||||
ASSERT_EQ(OB_SUCCESS, n1->acquire_tx(tx_ptr));
|
||||
ObTxDesc &tx = *tx_ptr;
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
{ // prepare snapshot for write
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -509,7 +509,7 @@ TEST_F(ObTestTx, switch_to_follower_forcedly)
|
||||
tx_param.isolation_ = ObTxIsolationLevel::RC;
|
||||
tx_param.cluster_id_ = 100;
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
{ // prepare snapshot for write
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -567,7 +567,7 @@ TEST_F(ObTestTx, resume_leader)
|
||||
tx_param.access_mode_ = ObTxAccessMode::RW;
|
||||
tx_param.isolation_ = ObTxIsolationLevel::RC;
|
||||
tx_param.cluster_id_ = 100;
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
{ // prepare snapshot for write
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -636,7 +636,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_in_stmt_then_resume_leader)
|
||||
tx_param.isolation_ = ObTxIsolationLevel::RC;
|
||||
tx_param.cluster_id_ = 100;
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
|
||||
ObStoreCtx write_store_ctx;
|
||||
{ // prepare snapshot for write
|
||||
@ -736,7 +736,7 @@ TEST_F(ObTestTx, replay_basic)
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
}
|
||||
@ -832,7 +832,7 @@ TEST_F(ObTestTx, replay_then_commit)
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
}
|
||||
@ -864,7 +864,7 @@ TEST_F(ObTestTx, replay_then_commit)
|
||||
ASSERT_EQ(OB_SUCCESS, n2->read(snapshot, 100, val1));
|
||||
ASSERT_EQ(112, val1);
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n2->write(tx, snapshot, 100, 113));
|
||||
}
|
||||
@ -929,7 +929,7 @@ TEST_F(ObTestTx, wait_commit_version_elapse_block)
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 113));
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ TEST_F(ObTestTx, wait_commit_version_elapse_block_and_switch_to_follower_forcedl
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 113));
|
||||
}
|
||||
@ -1132,7 +1132,7 @@ TEST_F(ObTestTx, get_gts_block_and_switch_to_follower_gracefully)
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
}
|
||||
@ -1201,7 +1201,7 @@ TEST_F(ObTestTx, get_gts_block_and_switch_to_follower_forcedly)
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
}
|
||||
@ -1257,7 +1257,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_in_stmt_rollback_to_last_savepoin
|
||||
tx_param.isolation_ = ObTxIsolationLevel::RC;
|
||||
tx_param.cluster_id_ = 100;
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ObStoreCtx write_store_ctx;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
@ -1354,7 +1354,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_in_stmt_then_commit)
|
||||
tx_param.isolation_ = ObTxIsolationLevel::RC;
|
||||
tx_param.cluster_id_ = 100;
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ObStoreCtx write_store_ctx;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
@ -1366,7 +1366,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_in_stmt_then_commit)
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 1000, 1111));
|
||||
}
|
||||
|
||||
int64_t sp2 = 0;
|
||||
ObTxSEQ sp2;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1400,7 +1400,7 @@ TEST_F(ObTestTx, switch_to_follower_gracefully_in_stmt_then_commit)
|
||||
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp2, n1->ts_after_ms(100), nullptr));
|
||||
}
|
||||
|
||||
int64_t sp3 = -1;
|
||||
ObTxSEQ sp3;
|
||||
{ // prepare snapshot for read
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n2->get_read_snapshot(tx,
|
||||
@ -1471,7 +1471,7 @@ TEST_F(ObTestTx, distributed_tx_participant_switch_to_follower_gracefully_in_stm
|
||||
tx_param.isolation_ = ObTxIsolationLevel::RC;
|
||||
tx_param.cluster_id_ = 100;
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1482,7 +1482,7 @@ TEST_F(ObTestTx, distributed_tx_participant_switch_to_follower_gracefully_in_stm
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 1000, 1111));
|
||||
}
|
||||
|
||||
int64_t sp2 = 0;
|
||||
ObTxSEQ sp2;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1494,7 +1494,7 @@ TEST_F(ObTestTx, distributed_tx_participant_switch_to_follower_gracefully_in_stm
|
||||
}
|
||||
|
||||
ObStoreCtx write_store_ctx;
|
||||
int64_t sp3 = 0;
|
||||
ObTxSEQ sp3;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1528,7 +1528,7 @@ TEST_F(ObTestTx, distributed_tx_participant_switch_to_follower_gracefully_in_stm
|
||||
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp3, n1->ts_after_ms(100), nullptr));
|
||||
}
|
||||
|
||||
int64_t sp4 = -1;
|
||||
ObTxSEQ sp4;
|
||||
{ // prepare snapshot for read
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1604,7 +1604,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_gracefully_in_stm
|
||||
tx_param.isolation_ = ObTxIsolationLevel::RC;
|
||||
tx_param.cluster_id_ = 100;
|
||||
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1617,7 +1617,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_gracefully_in_stm
|
||||
}
|
||||
|
||||
ObStoreCtx write_store_ctx;
|
||||
int64_t sp3 = 0;
|
||||
ObTxSEQ sp3;
|
||||
{
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1651,7 +1651,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_gracefully_in_stm
|
||||
ASSERT_EQ(OB_SUCCESS, n1->rollback_to_implicit_savepoint(tx, sp3, n1->ts_after_ms(100), nullptr));
|
||||
}
|
||||
|
||||
int64_t sp4 = -1;
|
||||
ObTxSEQ sp4;
|
||||
{ // prepare snapshot for read
|
||||
ObTxReadSnapshot snapshot;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx,
|
||||
@ -1729,7 +1729,7 @@ TEST_F(ObTestTx, distributed_tx_switch_to_follower_forcedly_in_prepare_state)
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
}
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
ASSERT_EQ(OB_SUCCESS, n2->write(tx, snapshot, 101, 113));
|
||||
@ -1827,7 +1827,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_forcedly_in_prepa
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
}
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
ASSERT_EQ(OB_SUCCESS, n2->write(tx, snapshot, 101, 113));
|
||||
@ -1918,7 +1918,7 @@ TEST_F(ObTestTx, distributed_tx_participant_switch_to_follower_forcedly_in_pre_c
|
||||
tx_param.isolation_,
|
||||
n2->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n2->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n2->write(tx, snapshot, 200, 112));
|
||||
}
|
||||
@ -1940,7 +1940,7 @@ TEST_F(ObTestTx, distributed_tx_participant_switch_to_follower_forcedly_in_pre_c
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
}
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 101, 112));
|
||||
@ -2049,7 +2049,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_forcedly_in_pre_c
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
}
|
||||
@ -2071,7 +2071,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_forcedly_in_pre_c
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
}
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 113));
|
||||
ASSERT_EQ(OB_SUCCESS, n2->write(tx, snapshot, 200, 113));
|
||||
@ -2178,7 +2178,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_forcedly_in_parti
|
||||
tx_param.isolation_,
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 112));
|
||||
}
|
||||
@ -2200,7 +2200,7 @@ TEST_F(ObTestTx, distributed_tx_coordinator_switch_to_follower_forcedly_in_parti
|
||||
n1->ts_after_ms(100),
|
||||
snapshot));
|
||||
}
|
||||
int64_t sp1 = 0;
|
||||
ObTxSEQ sp1;
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp1));
|
||||
ASSERT_EQ(OB_SUCCESS, n1->write(tx, snapshot, 100, 113));
|
||||
ASSERT_EQ(OB_SUCCESS, n2->write(tx, snapshot, 200, 113));
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
ASSERT_EQ(OB_SUCCESS, n1->get_read_snapshot(tx, tx_param.isolation_, n1->ts_after_ms(100), snapshot));
|
||||
|
||||
#define CREATE_IMPLICIT_SAVEPOINT(n1, tx, tx_param, sp) \
|
||||
int64_t sp = 0; \
|
||||
ObTxSEQ sp; \
|
||||
ASSERT_EQ(OB_SUCCESS, n1->create_implicit_savepoint(tx, tx_param, sp));
|
||||
|
||||
#define ROLLBACK_TO_IMPLICIT_SAVEPOINT(n1, tx, sp, timeout_us) \
|
||||
|
||||
@ -517,7 +517,7 @@ int MockObServer::do_handle_(ObReq &req, ObResp &resp)
|
||||
break;
|
||||
case ObReq::T::DUMMY_WRITE: {
|
||||
PREPARE_TX_PARAM(tx_param);
|
||||
int64_t sp;
|
||||
ObTxSEQ sp;
|
||||
ret = tx_node_.create_implicit_savepoint(*tx_desc, tx_param, sp, true);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -555,10 +555,10 @@ int ObTxNode::atomic_write(ObTxDesc &tx, const int64_t key, const int64_t value,
|
||||
const int64_t expire_ts, const ObTxParam &tx_param)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t sp = -1;
|
||||
ObTxSEQ sp;
|
||||
OZ(create_implicit_savepoint(tx, tx_param, sp, true));
|
||||
OZ(write(tx, key, value));
|
||||
if (sp != -1 && OB_FAIL(ret)) {
|
||||
if (sp.is_valid() && OB_FAIL(ret)) {
|
||||
OZ(rollback_to_implicit_savepoint(tx, sp, expire_ts, nullptr));
|
||||
}
|
||||
return ret;
|
||||
@ -595,8 +595,7 @@ int ObTxNode::write(ObTxDesc &tx,
|
||||
OZ(txs_.get_write_store_ctx(tx,
|
||||
snapshot,
|
||||
write_flag,
|
||||
write_store_ctx,
|
||||
false));
|
||||
write_store_ctx));
|
||||
write_store_ctx.mvcc_acc_ctx_.tx_table_guards_.tx_table_guard_.init(&fake_tx_table_);
|
||||
ObArenaAllocator allocator;
|
||||
ObStoreRow row;
|
||||
@ -650,8 +649,7 @@ int ObTxNode::write_begin(ObTxDesc &tx,
|
||||
OZ(txs_.get_write_store_ctx(tx,
|
||||
snapshot,
|
||||
write_flag,
|
||||
write_store_ctx,
|
||||
false));
|
||||
write_store_ctx));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@ -47,8 +47,8 @@ bool TEST_IS_DUP = true;
|
||||
bool TEST_IS_SUB2PC = false;
|
||||
int64_t TEST_EPOCH = 1315;
|
||||
int64_t TEST_LAST_OP_SN = 1315;
|
||||
int64_t TEST_FIRST_SCN = 1315;
|
||||
int64_t TEST_LAST_SCN = 1315;
|
||||
auto TEST_FIRST_SCN = ObTxSEQ(1315, 0);
|
||||
auto TEST_LAST_SCN = ObTxSEQ(1315, 0);
|
||||
uint64_t TEST_ORG_CLUSTER_ID = 1208;
|
||||
common::ObString TEST_TRCE_INFO("trace_info_test");
|
||||
LogOffSet TEST_LOG_OFFSET(10);
|
||||
@ -57,7 +57,7 @@ int64_t TEST_CHECKSUM = 29890209;
|
||||
int64_t TEST_SCHEMA_VERSION = 372837;
|
||||
int64_t TEST_TX_EXPIRED_TIME = 12099087;
|
||||
int64_t TEST_LOG_ENTRY_NO = 1233;
|
||||
int64_t TEST_MAX_SUBMITTED_SEQ_NO = 12345;
|
||||
auto TEST_MAX_SUBMITTED_SEQ_NO = ObTxSEQ(12345, 0);
|
||||
LSKey TEST_LS_KEY;
|
||||
ObXATransID TEST_XID;
|
||||
|
||||
@ -241,8 +241,8 @@ TEST_F(TestObTxLog, tx_log_body_except_redo)
|
||||
EXPECT_EQ(TEST_TX_EXPIRED_TIME, replay_active_state.get_tx_expired_time());
|
||||
EXPECT_EQ(TEST_EPOCH, replay_active_state.get_epoch());
|
||||
EXPECT_EQ(TEST_LAST_OP_SN, replay_active_state.get_last_op_sn());
|
||||
EXPECT_EQ(TEST_FIRST_SCN, replay_active_state.get_first_scn());
|
||||
EXPECT_EQ(TEST_LAST_SCN, replay_active_state.get_last_scn());
|
||||
EXPECT_EQ(TEST_FIRST_SCN, replay_active_state.get_first_seq_no());
|
||||
EXPECT_EQ(TEST_LAST_SCN, replay_active_state.get_last_seq_no());
|
||||
EXPECT_EQ(TEST_CLUSTER_VERSION, replay_active_state.get_cluster_version());
|
||||
|
||||
ObTxCommitInfoLogTempRef commit_state_temp_ref;
|
||||
@ -542,9 +542,9 @@ TEST_F(TestObTxLog, test_default_log_deserialize)
|
||||
replay_member_cnt++;
|
||||
EXPECT_EQ(fill_active_state.get_last_op_sn(), replay_active_state.get_last_op_sn());
|
||||
replay_member_cnt++;
|
||||
EXPECT_EQ(fill_active_state.get_first_scn(), replay_active_state.get_first_scn());
|
||||
EXPECT_EQ(fill_active_state.get_first_seq_no(), replay_active_state.get_first_seq_no());
|
||||
replay_member_cnt++;
|
||||
EXPECT_EQ(fill_active_state.get_last_scn(), replay_active_state.get_last_scn());
|
||||
EXPECT_EQ(fill_active_state.get_last_seq_no(), replay_active_state.get_last_seq_no());
|
||||
replay_member_cnt++;
|
||||
EXPECT_EQ(fill_active_state.get_cluster_version(), replay_active_state.get_cluster_version());
|
||||
replay_member_cnt++;
|
||||
|
||||
@ -119,7 +119,7 @@ public:
|
||||
msg.timestamp_ = op_sn_;
|
||||
msg.epoch_ = -1;
|
||||
msg.request_id_ = op_sn_;
|
||||
msg.savepoint_ = 1;
|
||||
msg.savepoint_ = ObTxSEQ(1, 0);
|
||||
msg.op_sn_ = op_sn_;
|
||||
msg.branch_id_ = 1;
|
||||
msg.tx_ptr_ = tx;
|
||||
|
||||
Reference in New Issue
Block a user