fix lock for read hang when row_scn invalid
This commit is contained in:
@ -51,6 +51,7 @@ public:
|
|||||||
tx_scn_(-1),
|
tx_scn_(-1),
|
||||||
write_flag_(),
|
write_flag_(),
|
||||||
handle_start_time_(OB_INVALID_TIMESTAMP),
|
handle_start_time_(OB_INVALID_TIMESTAMP),
|
||||||
|
is_standby_read_(false),
|
||||||
lock_wait_start_ts_(0)
|
lock_wait_start_ts_(0)
|
||||||
{}
|
{}
|
||||||
~ObMvccAccessCtx() {
|
~ObMvccAccessCtx() {
|
||||||
@ -64,6 +65,7 @@ public:
|
|||||||
tx_scn_ = -1;
|
tx_scn_ = -1;
|
||||||
write_flag_.reset();
|
write_flag_.reset();
|
||||||
handle_start_time_ = OB_INVALID_TIMESTAMP;
|
handle_start_time_ = OB_INVALID_TIMESTAMP;
|
||||||
|
is_standby_read_ = false;
|
||||||
}
|
}
|
||||||
void reset() {
|
void reset() {
|
||||||
if (is_write() && OB_UNLIKELY(tx_ctx_)) {
|
if (is_write() && OB_UNLIKELY(tx_ctx_)) {
|
||||||
@ -81,6 +83,7 @@ public:
|
|||||||
tx_scn_ = -1;
|
tx_scn_ = -1;
|
||||||
write_flag_.reset();
|
write_flag_.reset();
|
||||||
handle_start_time_ = OB_INVALID_TIMESTAMP;
|
handle_start_time_ = OB_INVALID_TIMESTAMP;
|
||||||
|
is_standby_read_ = false;
|
||||||
}
|
}
|
||||||
bool is_valid() const {
|
bool is_valid() const {
|
||||||
switch(type_) {
|
switch(type_) {
|
||||||
@ -256,6 +259,8 @@ public: // NOTE: those field should only be accessed by txn relative routine
|
|||||||
|
|
||||||
// this was used for runtime mertic
|
// this was used for runtime mertic
|
||||||
int64_t handle_start_time_;
|
int64_t handle_start_time_;
|
||||||
|
|
||||||
|
bool is_standby_read_;
|
||||||
protected:
|
protected:
|
||||||
int64_t lock_wait_start_ts_;
|
int64_t lock_wait_start_ts_;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -228,6 +228,7 @@ int ObMvccValueIterator::lock_for_read_inner_(const ObQueryFlag &flag,
|
|||||||
// snapshot
|
// snapshot
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
while (OB_SUCC(ret)
|
while (OB_SUCC(ret)
|
||||||
|
&& !ctx_->is_standby_read_
|
||||||
&& is_determined_state
|
&& is_determined_state
|
||||||
&& !(iter->is_committed() || iter->is_aborted() || iter->is_elr())) {
|
&& !(iter->is_committed() || iter->is_aborted() || iter->is_elr())) {
|
||||||
if (OB_FAIL(try_cleanout_tx_node_(iter))) {
|
if (OB_FAIL(try_cleanout_tx_node_(iter))) {
|
||||||
|
|||||||
@ -1440,8 +1440,8 @@ OB_INLINE int ObReadRow::iterate_row_value_(
|
|||||||
const ObTransID snapshot_tx_id = value_iter.get_snapshot_tx_id();
|
const ObTransID snapshot_tx_id = value_iter.get_snapshot_tx_id();
|
||||||
const ObTransID reader_tx_id = value_iter.get_reader_tx_id();
|
const ObTransID reader_tx_id = value_iter.get_reader_tx_id();
|
||||||
row_scn = tx_node->trans_version_.get_val_for_tx();
|
row_scn = tx_node->trans_version_.get_val_for_tx();
|
||||||
if (!(snapshot_tx_id == tx_node->get_tx_id() || reader_tx_id == tx_node->get_tx_id())
|
if (!value_iter.get_mvcc_acc_ctx()->is_standby_read_ && (!(snapshot_tx_id == tx_node->get_tx_id() || reader_tx_id == tx_node->get_tx_id())
|
||||||
&& tx_node->trans_version_.is_max()) {
|
&& tx_node->trans_version_.is_max())) {
|
||||||
TRANS_LOG(ERROR, "meet row scn with undecided value", KPC(tx_node),
|
TRANS_LOG(ERROR, "meet row scn with undecided value", KPC(tx_node),
|
||||||
K(is_committed), K(trans_version), K(value_iter));
|
K(is_committed), K(trans_version), K(value_iter));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -375,9 +375,13 @@ int LockForReadFunctor::operator()(const ObTxData &tx_data, ObTxCCCtx *tx_cc_ctx
|
|||||||
|
|
||||||
int LockForReadFunctor::check_for_standby(const transaction::ObTransID &tx_id)
|
int LockForReadFunctor::check_for_standby(const transaction::ObTransID &tx_id)
|
||||||
{
|
{
|
||||||
return MTL(transaction::ObTransService *)->check_for_standby(ls_id_, tx_id,
|
int ret = OB_SUCCESS;
|
||||||
|
if (OB_SUCC(MTL(transaction::ObTransService *)->check_for_standby(ls_id_, tx_id,
|
||||||
lock_for_read_arg_.mvcc_acc_ctx_.snapshot_.version_,
|
lock_for_read_arg_.mvcc_acc_ctx_.snapshot_.version_,
|
||||||
can_read_, trans_version_, is_determined_state_);
|
can_read_, trans_version_, is_determined_state_))) {
|
||||||
|
lock_for_read_arg_.mvcc_acc_ctx_.is_standby_read_ = true;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CleanoutTxStateFunctor::operator()(const ObTxData &tx_data, ObTxCCCtx *tx_cc_ctx)
|
int CleanoutTxStateFunctor::operator()(const ObTxData &tx_data, ObTxCCCtx *tx_cc_ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user