[FIX] mini merge of tx data may fail because of gts service error
This commit is contained in:
@ -782,8 +782,11 @@ int ObTxDataTable::get_recycle_scn(SCN &recycle_scn)
|
||||
//it may cause the standby tenant to commit and recycle when the primary is switched to standby.
|
||||
SCN snapshot_version;
|
||||
MonotonicTs unused_ts(0);
|
||||
if (OB_FAIL(OB_TS_MGR.get_gts(MTL_ID(), MonotonicTs(1), NULL, snapshot_version, unused_ts))) {
|
||||
LOG_WARN("failed to get snapshot version", K(ret), K(MTL_ID()));
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if (OB_TMP_FAIL(OB_TS_MGR.get_gts(MTL_ID(), MonotonicTs(1), NULL, snapshot_version, unused_ts))) {
|
||||
LOG_WARN("failed to get snapshot version", K(tmp_ret), K(MTL_ID()));
|
||||
// recycle nothing this time
|
||||
recycle_scn.set_min();
|
||||
} else {
|
||||
recycle_scn = std::min(recycle_scn, snapshot_version);
|
||||
}
|
||||
|
||||
@ -917,7 +917,9 @@ int ObTxTable::get_recycle_scn(SCN &real_recycle_scn)
|
||||
SCN tablet_recycle_scn = SCN::min_scn();
|
||||
const int64_t retain_tx_data_us = tx_result_retention * 1000L * 1000L;
|
||||
|
||||
if (current_time_us - recycle_scn_cache_.update_ts_ < retain_tx_data_us && recycle_scn_cache_.val_.is_valid()) {
|
||||
if (current_time_us - recycle_scn_cache_.update_ts_ < retain_tx_data_us
|
||||
&& recycle_scn_cache_.val_.is_valid()
|
||||
&& (!recycle_scn_cache_.val_.is_min())) {
|
||||
// cache is valid, get recycle scn from cache
|
||||
real_recycle_scn = recycle_scn_cache_.val_;
|
||||
STORAGE_LOG(INFO, "use recycle scn cache", K(ls_id_), K(recycle_scn_cache_));
|
||||
|
||||
Reference in New Issue
Block a user