push the memtable whose end_max_scn is 0 from max_end_scn to start_scn + 1 for replay multi-transaction commit log
This commit is contained in:
parent
c25187b07c
commit
cf5be5d6f4
@ -642,11 +642,15 @@ int ObMemtable::save_multi_source_data_unit(const T *const multi_source_data_uni
|
||||
&& OB_FAIL(set_max_end_scn(scn))) {
|
||||
TRANS_LOG(WARN, "failed to set max_end_scn", K(ret), K(scn), KPC(this));
|
||||
}
|
||||
// commit log is replayed to empty memtable whitch is frozen after clog switch to follower gracefully, commit status mds will be lost.
|
||||
// so push max_end_scn to start_scn + 1
|
||||
else if (start_scn == get_end_scn()
|
||||
&& OB_FAIL(set_end_scn(share::SCN::scn_inc(start_scn)))) {
|
||||
TRANS_LOG(WARN, "failed to set max_end_scn", K(ret), K(scn), KPC(this));
|
||||
// commit log is replayed to empty memtable which is frozen after clog switch to follower gracefully, commit status mds will be lost.
|
||||
// so push end_scn to start_scn + 1
|
||||
else if (get_max_end_scn().is_min() && get_end_scn().is_max()) {
|
||||
TRANS_LOG(INFO, "empty memtable push end_scn to start_scn + 1", K(ret), K(scn), KPC(this));
|
||||
if (OB_FAIL(set_end_scn(share::SCN::scn_inc(start_scn)))) {
|
||||
TRANS_LOG(WARN, "failed to set max_end_scn", K(ret), K(scn), KPC(this));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(set_rec_scn(scn))) {
|
||||
TRANS_LOG(WARN, "failed to set rec_scn", K(ret), K(scn), KPC(this));
|
||||
}
|
||||
|
@ -537,11 +537,12 @@ TEST_F(TestMemtable, test_mds_commit_to_empty_memtable)
|
||||
share::SCN scn;
|
||||
scn.set_max();
|
||||
|
||||
|
||||
ASSERT_EQ(OB_SUCCESS, memtable.save_multi_source_data_unit(&tablet_status, scn, !for_replay, memtable::MemtableRefOp::INC_REF, !is_callback));
|
||||
memtable.key_.scn_range_.start_scn_.convert_for_gts(100);
|
||||
memtable.key_.scn_range_.end_scn_.convert_for_gts(100);
|
||||
ASSERT_EQ(1, tablet_status.get_unsync_cnt_for_multi_data());
|
||||
|
||||
memtable.key_.scn_range_.start_scn_.convert_for_gts(100);
|
||||
memtable.key_.scn_range_.end_scn_.set_max();
|
||||
memtable.max_end_scn_.set_min();
|
||||
ASSERT_EQ(OB_SUCCESS, scn.convert_for_gts(102));
|
||||
ASSERT_EQ(OB_SUCCESS, memtable.save_multi_source_data_unit(&tablet_status, scn, for_replay, memtable::MemtableRefOp::DEC_REF, is_callback));
|
||||
ASSERT_EQ(0, tablet_status.get_unsync_cnt_for_multi_data());
|
||||
|
Loading…
x
Reference in New Issue
Block a user