[MDS] defense abort ignore upgrade from old mds

This commit is contained in:
fengdeyiji
2023-11-20 14:44:53 +00:00
committed by ob-robot
parent f8a9c93b63
commit d4a411c686
4 changed files with 17 additions and 14 deletions

View File

@ -167,7 +167,7 @@ int MdsTableHandle::set(T &&data, MdsCtx &ctx, const int64_t lock_timeout_us)
} else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) { } else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) {
if (lock_timeout_us > 30_s) {// timeout no more than 30s if (lock_timeout_us > 30_s) {// timeout no more than 30s
MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version",
KR(ret), K(unit_id), K(data), K(ctx), K(lock_timeout_us), K(converted_timeout)); KR(ret), K(unit_id), K(data), K(ctx), K(lock_timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
converted_timeout = 30_s; converted_timeout = 30_s;
} else { } else {
converted_timeout = lock_timeout_us; converted_timeout = lock_timeout_us;
@ -176,7 +176,7 @@ int MdsTableHandle::set(T &&data, MdsCtx &ctx, const int64_t lock_timeout_us)
ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided
MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :" MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :"
" on_redo/before_prepare/on_prepare/on_commit/on_abort", " on_redo/before_prepare/on_prepare/on_commit/on_abort",
KR(ret), K(unit_id), K(data), K(ctx), K(lock_timeout_us), K(converted_timeout)); KR(ret), K(unit_id), K(data), K(ctx), K(lock_timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
MDS_ASSERT(false);// abort in test environment MDS_ASSERT(false);// abort in test environment
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
@ -262,7 +262,7 @@ int MdsTableHandle::get_snapshot(OP &&read_op,
} else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) { } else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) {
if (timeout_us > 30_s) {// timeout no more than 30s if (timeout_us > 30_s) {// timeout no more than 30s
MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(snapshot), MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(snapshot),
K(read_seq), K(timeout_us), K(converted_timeout)); K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
converted_timeout = 30_s; converted_timeout = 30_s;
} else { } else {
converted_timeout = timeout_us; converted_timeout = timeout_us;
@ -271,7 +271,7 @@ int MdsTableHandle::get_snapshot(OP &&read_op,
ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided
MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :" MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :"
" on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(snapshot), " on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(snapshot),
K(read_seq), K(timeout_us), K(converted_timeout)); K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
MDS_ASSERT(false);// abort in test environment MDS_ASSERT(false);// abort in test environment
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
@ -314,7 +314,7 @@ int MdsTableHandle::get_by_writer(OP &&read_op,
} else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) { } else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) {
if (timeout_us > 30_s) {// timeout no more than 30s if (timeout_us > 30_s) {// timeout no more than 30s
MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(writer), MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(writer),
K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout)); K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
converted_timeout = 30_s; converted_timeout = 30_s;
} else { } else {
converted_timeout = timeout_us; converted_timeout = timeout_us;
@ -323,7 +323,7 @@ int MdsTableHandle::get_by_writer(OP &&read_op,
ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided
MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :" MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :"
" on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(writer), " on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(writer),
K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout)); K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
MDS_ASSERT(false);// abort in test environment MDS_ASSERT(false);// abort in test environment
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
@ -380,7 +380,7 @@ int MdsTableHandle::set(const Key &key, Value &&data, MdsCtx &ctx, const int64_t
} else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) { } else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) {
if (lock_timeout_us > 30_s) {// timeout no more than 30s if (lock_timeout_us > 30_s) {// timeout no more than 30s
MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(data), K(ctx), MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(data), K(ctx),
K(lock_timeout_us), K(converted_timeout)); K(lock_timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
converted_timeout = 30_s; converted_timeout = 30_s;
} else { } else {
converted_timeout = lock_timeout_us; converted_timeout = lock_timeout_us;
@ -389,7 +389,7 @@ int MdsTableHandle::set(const Key &key, Value &&data, MdsCtx &ctx, const int64_t
ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided
MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :" MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :"
" on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(data), " on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(data),
K(ctx), K(lock_timeout_us), K(converted_timeout)); K(ctx), K(lock_timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
MDS_ASSERT(false);// abort in test environment MDS_ASSERT(false);// abort in test environment
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
@ -441,7 +441,7 @@ int MdsTableHandle::remove(const Key &key, MdsCtx &ctx, const int64_t lock_timeo
} else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) { } else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) {
if (lock_timeout_us > 30_s) {// timeout no more than 30s if (lock_timeout_us > 30_s) {// timeout no more than 30s
MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(ctx), MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(ctx),
K(lock_timeout_us), K(converted_timeout)); K(lock_timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
converted_timeout = 30_s; converted_timeout = 30_s;
} else { } else {
converted_timeout = lock_timeout_us; converted_timeout = lock_timeout_us;
@ -450,7 +450,7 @@ int MdsTableHandle::remove(const Key &key, MdsCtx &ctx, const int64_t lock_timeo
ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided
MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :" MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :"
" on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(ctx), " on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(ctx),
K(lock_timeout_us), K(converted_timeout)); K(lock_timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
MDS_ASSERT(false);// abort in test environment MDS_ASSERT(false);// abort in test environment
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
@ -532,7 +532,7 @@ int MdsTableHandle::get_snapshot(const Key &key,
} else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) { } else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) {
if (timeout_us > 30_s) {// timeout no more than 30s if (timeout_us > 30_s) {// timeout no more than 30s
MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(snapshot), MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(snapshot),
K(read_seq), K(timeout_us), K(converted_timeout)); K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
converted_timeout = 30_s; converted_timeout = 30_s;
} else { } else {
converted_timeout = timeout_us; converted_timeout = timeout_us;
@ -541,7 +541,7 @@ int MdsTableHandle::get_snapshot(const Key &key,
ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided
MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :" MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :"
" on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(snapshot), " on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(snapshot),
K(read_seq), K(timeout_us), K(converted_timeout)); K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
MDS_ASSERT(false);// abort in test environment MDS_ASSERT(false);// abort in test environment
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
@ -583,7 +583,7 @@ int MdsTableHandle::get_by_writer(const Key &key,
} else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) { } else if (TLOCAL_MDS_TRANS_NOTIFY_TYPE == transaction::NotifyType::REGISTER_SUCC) {
if (timeout_us > 30_s) {// timeout no more than 30s if (timeout_us > 30_s) {// timeout no more than 30s
MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(writer), MDS_LOG(INFO, "timeout ts mustn't more than 30s in current version", KR(ret), K(unit_id), K(key), K(writer),
K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout)); K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
converted_timeout = 30_s; converted_timeout = 30_s;
} else { } else {
converted_timeout = timeout_us; converted_timeout = timeout_us;
@ -592,7 +592,7 @@ int MdsTableHandle::get_by_writer(const Key &key,
ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided ret = OB_OP_NOT_ALLOW;// this call may deadlock with other threads and can not be avoided
MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :" MDS_LOG(ERROR, "you mustn't do maybe hung operation in trans callbacks :"
" on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(writer), " on_redo/before_prepare/on_prepare/on_commit/on_abort", KR(ret), K(unit_id), K(key), K(writer),
K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout)); K(snapshot), K(read_seq), K(timeout_us), K(converted_timeout), K(TLOCAL_MDS_TRANS_NOTIFY_TYPE));
MDS_ASSERT(false);// abort in test environment MDS_ASSERT(false);// abort in test environment
} }
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {

View File

@ -361,6 +361,7 @@ int ObTabletUnbindMdsHelper::on_commit_for_old_mds(
const int64_t len, const int64_t len,
const transaction::ObMulSourceDataNotifyArg &notify_arg) const transaction::ObMulSourceDataNotifyArg &notify_arg)
{ {
mds::TLOCAL_MDS_TRANS_NOTIFY_TYPE = NotifyType::UNKNOWN;// disable runtime check
return ObTabletCreateDeleteHelper::process_for_old_mds<ObBatchUnbindTabletArg, ObTabletUnbindMdsHelper>(buf, len, notify_arg); return ObTabletCreateDeleteHelper::process_for_old_mds<ObBatchUnbindTabletArg, ObTabletUnbindMdsHelper>(buf, len, notify_arg);
} }

View File

@ -45,6 +45,7 @@ int ObTabletCreateMdsHelper::on_commit_for_old_mds(
const int64_t len, const int64_t len,
const transaction::ObMulSourceDataNotifyArg &notify_arg) const transaction::ObMulSourceDataNotifyArg &notify_arg)
{ {
mds::TLOCAL_MDS_TRANS_NOTIFY_TYPE = NotifyType::UNKNOWN;// disable runtime check
return ObTabletCreateDeleteHelper::process_for_old_mds<ObBatchCreateTabletArg, ObTabletCreateMdsHelper>(buf, len, notify_arg); return ObTabletCreateDeleteHelper::process_for_old_mds<ObBatchCreateTabletArg, ObTabletCreateMdsHelper>(buf, len, notify_arg);
} }

View File

@ -55,6 +55,7 @@ int ObTabletDeleteMdsHelper::on_commit_for_old_mds(
const int64_t len, const int64_t len,
const transaction::ObMulSourceDataNotifyArg &notify_arg) const transaction::ObMulSourceDataNotifyArg &notify_arg)
{ {
mds::TLOCAL_MDS_TRANS_NOTIFY_TYPE = NotifyType::UNKNOWN;// disable runtime check
return ObTabletCreateDeleteHelper::process_for_old_mds<obrpc::ObBatchRemoveTabletArg, ObTabletDeleteMdsHelper>(buf, len, notify_arg); return ObTabletCreateDeleteHelper::process_for_old_mds<obrpc::ObBatchRemoveTabletArg, ObTabletDeleteMdsHelper>(buf, len, notify_arg);
} }