From 3cdfb11aa583c7c848628c5437d82d5c044bab46 Mon Sep 17 00:00:00 2001 From: Handora Date: Mon, 28 Nov 2022 02:15:34 +0000 Subject: [PATCH] [scn] fix test_memtable and errno --- src/share/ob_errno.cpp | 14 +++++++------- src/share/ob_errno.def | 4 ++-- src/share/ob_errno.h | 6 +++--- src/storage/memtable/ob_memtable.cpp | 8 ++++---- .../tablet/ob_tablet_create_delete_helper.cpp | 5 ----- src/storage/tx/ob_tx_replay_executor.cpp | 2 +- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/share/ob_errno.cpp b/src/share/ob_errno.cpp index 33b26c245..ab22c0697 100644 --- a/src/share/ob_errno.cpp +++ b/src/share/ob_errno.cpp @@ -17397,17 +17397,17 @@ static const _error _error_OB_OBJ_UNLOCK_CONFLICT = { .oracle_str_error = "ORA-00600: internal error code, arguments: -6276, there is an unlock operation doing, unlock conflict.", .oracle_str_user_error = "ORA-00600: internal error code, arguments: -6276, there is an unlock operation doing, unlock conflict." }; -static const _error _error_OB_LOG_TS_OUT_OF_BOUND = { - .error_name = "OB_LOG_TS_OUT_OF_BOUND", +static const _error _error_OB_SCN_OUT_OF_BOUND = { + .error_name = "OB_SCN_OUT_OF_BOUND", .error_cause = "Internal Error", .error_solution = "Contact OceanBase Support", .mysql_errno = -1, .sqlstate = "HY000", - .str_error = "log_ts is out of bounds of memtable", - .str_user_error = "log_ts is out of bounds of memtable", + .str_error = "scn is out of bounds of memtable", + .str_user_error = "scn is out of bounds of memtable", .oracle_errno = 600, - .oracle_str_error = "ORA-00600: internal error code, arguments: -6277, log_ts is out of bounds of memtable", - .oracle_str_user_error = "ORA-00600: internal error code, arguments: -6277, log_ts is out of bounds of memtable" + .oracle_str_error = "ORA-00600: internal error code, arguments: -6277, scn is out of bounds of memtable", + .oracle_str_user_error = "ORA-00600: internal error code, arguments: -6277, scn is out of bounds of memtable" }; static const _error _error_OB_TRANS_IDLE_TIMEOUT = { .error_name = "OB_TRANS_IDLE_TIMEOUT", @@ -23400,7 +23400,7 @@ struct ObStrErrorInit _errors[-OB_ERR_PARTITIONING_KEY_MAPS_TO_A_PARTITION_OUTSIDE_MAXIMUM_PERMITTED_NUMBER_OF_PARTITIONS] = &_error_OB_ERR_PARTITIONING_KEY_MAPS_TO_A_PARTITION_OUTSIDE_MAXIMUM_PERMITTED_NUMBER_OF_PARTITIONS; _errors[-OB_OBJ_LOCK_NOT_COMPLETED] = &_error_OB_OBJ_LOCK_NOT_COMPLETED; _errors[-OB_OBJ_UNLOCK_CONFLICT] = &_error_OB_OBJ_UNLOCK_CONFLICT; - _errors[-OB_LOG_TS_OUT_OF_BOUND] = &_error_OB_LOG_TS_OUT_OF_BOUND; + _errors[-OB_SCN_OUT_OF_BOUND] = &_error_OB_SCN_OUT_OF_BOUND; _errors[-OB_TRANS_IDLE_TIMEOUT] = &_error_OB_TRANS_IDLE_TIMEOUT; _errors[-OB_LOG_ID_NOT_FOUND] = &_error_OB_LOG_ID_NOT_FOUND; _errors[-OB_LSR_THREAD_STOPPED] = &_error_OB_LSR_THREAD_STOPPED; diff --git a/src/share/ob_errno.def b/src/share/ob_errno.def index a81b8fd28..a3bd6ccf0 100644 --- a/src/share/ob_errno.def +++ b/src/share/ob_errno.def @@ -1590,8 +1590,8 @@ DEFINE_ORACLE_ERROR(OB_ERR_PARTITIONING_KEY_MAPS_TO_A_PARTITION_OUTSIDE_MAXIMUM_ DEFINE_ERROR(OB_OBJ_LOCK_NOT_COMPLETED, -6275, -1, "HY000", "object lock not completed, and can not unlock."); DEFINE_ERROR(OB_OBJ_UNLOCK_CONFLICT, -6276, -1, "HY000", "there is an unlock operation doing, unlock conflict."); -// for memtable log_ts -DEFINE_ERROR(OB_LOG_TS_OUT_OF_BOUND, -6277, -1, "HY000", "log_ts is out of bounds of memtable"); +// for memtable scn +DEFINE_ERROR(OB_SCN_OUT_OF_BOUND, -6277, -1, "HY000", "scn is out of bounds of memtable"); DEFINE_ORACLE_ERROR(OB_TRANS_IDLE_TIMEOUT, -6278, 6002, "25000", "Transaction idle timeout occurred, please rollback the transaction, set the variable ob_trx_idle_timeout to a larger value and then restart the transaction", 24761, "transaction rolled back: transaction idle timeout"); diff --git a/src/share/ob_errno.h b/src/share/ob_errno.h index 46f979b10..e57b7ea78 100644 --- a/src/share/ob_errno.h +++ b/src/share/ob_errno.h @@ -1237,7 +1237,7 @@ constexpr int OB_ERR_INTERVAL_CANNOT_BE_ZERO = -6273; constexpr int OB_ERR_PARTITIONING_KEY_MAPS_TO_A_PARTITION_OUTSIDE_MAXIMUM_PERMITTED_NUMBER_OF_PARTITIONS = -6274; constexpr int OB_OBJ_LOCK_NOT_COMPLETED = -6275; constexpr int OB_OBJ_UNLOCK_CONFLICT = -6276; -constexpr int OB_LOG_TS_OUT_OF_BOUND = -6277; +constexpr int OB_SCN_OUT_OF_BOUND = -6277; constexpr int OB_TRANS_IDLE_TIMEOUT = -6278; constexpr int OB_LOG_ID_NOT_FOUND = -6301; constexpr int OB_LSR_THREAD_STOPPED = -6302; @@ -3046,7 +3046,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219; #define OB_ERR_PARTITIONING_KEY_MAPS_TO_A_PARTITION_OUTSIDE_MAXIMUM_PERMITTED_NUMBER_OF_PARTITIONS__USER_ERROR_MSG "partitioning key maps to a partition outside maximum permitted number of partitions" #define OB_OBJ_LOCK_NOT_COMPLETED__USER_ERROR_MSG "object lock not completed, and can not unlock." #define OB_OBJ_UNLOCK_CONFLICT__USER_ERROR_MSG "there is an unlock operation doing, unlock conflict." -#define OB_LOG_TS_OUT_OF_BOUND__USER_ERROR_MSG "log_ts is out of bounds of memtable" +#define OB_SCN_OUT_OF_BOUND__USER_ERROR_MSG "scn is out of bounds of memtable" #define OB_TRANS_IDLE_TIMEOUT__USER_ERROR_MSG "Transaction idle timeout occurred, please rollback the transaction, set the variable ob_trx_idle_timeout to a larger value and then restart the transaction" #define OB_LOG_ID_NOT_FOUND__USER_ERROR_MSG "log id not found" #define OB_LSR_THREAD_STOPPED__USER_ERROR_MSG "log scan runnable thread stop" @@ -4876,7 +4876,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219; #define OB_ERR_PARTITIONING_KEY_MAPS_TO_A_PARTITION_OUTSIDE_MAXIMUM_PERMITTED_NUMBER_OF_PARTITIONS__ORA_USER_ERROR_MSG "ORA-14300: partitioning key maps to a partition outside maximum permitted number of partitions" #define OB_OBJ_LOCK_NOT_COMPLETED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6275, object lock not completed, and can not unlock." #define OB_OBJ_UNLOCK_CONFLICT__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6276, there is an unlock operation doing, unlock conflict." -#define OB_LOG_TS_OUT_OF_BOUND__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6277, log_ts is out of bounds of memtable" +#define OB_SCN_OUT_OF_BOUND__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6277, scn is out of bounds of memtable" #define OB_TRANS_IDLE_TIMEOUT__ORA_USER_ERROR_MSG "ORA-24761: transaction rolled back: transaction idle timeout" #define OB_LOG_ID_NOT_FOUND__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6301, log id not found" #define OB_LSR_THREAD_STOPPED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6302, log scan runnable thread stop" diff --git a/src/storage/memtable/ob_memtable.cpp b/src/storage/memtable/ob_memtable.cpp index 99afd9f8e..60bf84a37 100644 --- a/src/storage/memtable/ob_memtable.cpp +++ b/src/storage/memtable/ob_memtable.cpp @@ -1466,7 +1466,7 @@ int ObMemtable::set_rec_scn(palf::SCN rec_scn) ret = OB_INVALID_ARGUMENT; TRANS_LOG(WARN, "invalid args", K(ret), K(rec_scn)); } else if (rec_scn <= get_start_scn()) { - ret = OB_LOG_TS_OUT_OF_BOUND; + ret = OB_SCN_OUT_OF_BOUND; TRANS_LOG(ERROR, "cannot set freeze log ts smaller to start log ts", K(ret), K(rec_scn), K(ls_id), KPC(this)); } else { palf::SCN old_rec_scn; @@ -1496,7 +1496,7 @@ int ObMemtable::set_start_scn(const palf::SCN start_scn) } else if (start_scn >= get_end_scn() || (max_end_scn_ != palf::SCN::min_scn() && start_scn >= max_end_scn_) || start_scn >= rec_scn_) { - ret = OB_LOG_TS_OUT_OF_BOUND; + ret = OB_SCN_OUT_OF_BOUND; TRANS_LOG(ERROR, "cannot set start ts now", K(ret), K(start_scn), K(ls_id), KPC(this)); } else { key_.scn_range_.start_scn_ = start_scn; @@ -1517,7 +1517,7 @@ int ObMemtable::set_end_scn(const palf::SCN freeze_scn) ret = OB_INVALID_ARGUMENT; TRANS_LOG(WARN, "invalid args", K(ret), K(freeze_scn)); } else if (freeze_scn < get_start_scn()) { - ret = OB_LOG_TS_OUT_OF_BOUND; + ret = OB_SCN_OUT_OF_BOUND; TRANS_LOG(ERROR, "cannot set freeze log ts smaller to start log ts", K(ret), K(freeze_scn), K(ls_id), KPC(this)); } else { @@ -1549,7 +1549,7 @@ int ObMemtable::set_max_end_scn(const palf::SCN scn) ret = OB_INVALID_ARGUMENT; TRANS_LOG(WARN, "invalid args", K(ret), K(scn)); } else if (scn <= get_start_scn() || scn > get_end_scn()) { - ret = OB_LOG_TS_OUT_OF_BOUND; + ret = OB_SCN_OUT_OF_BOUND; TRANS_LOG(WARN, "cannot set max end log ts smaller to start log ts", K(ret), K(scn), K(ls_id), KPC(this)); } else { diff --git a/src/storage/tablet/ob_tablet_create_delete_helper.cpp b/src/storage/tablet/ob_tablet_create_delete_helper.cpp index 97950dd3e..e83229e8c 100644 --- a/src/storage/tablet/ob_tablet_create_delete_helper.cpp +++ b/src/storage/tablet/ob_tablet_create_delete_helper.cpp @@ -686,11 +686,6 @@ int ObTabletCreateDeleteHelper::do_abort_create_tablets( ObTabletMapKey key; key.ls_id_ = ls_.get_ls_id(); - // TODO: fix it after multi source data refactor - // if (OB_UNLIKELY(trans_flags.log_ts_ < OB_INVALID_TIMESTAMP)) { - // ret = OB_ERR_UNEXPECTED; - // LOG_WARN("invalid log ts", K(ret), K(trans_flags)); - // } else if (!trans_flags.is_redo_synced()) { // on redo cb has not been called // just remove tablets directly diff --git a/src/storage/tx/ob_tx_replay_executor.cpp b/src/storage/tx/ob_tx_replay_executor.cpp index 0150cdf2d..b1f897a6a 100644 --- a/src/storage/tx/ob_tx_replay_executor.cpp +++ b/src/storage/tx/ob_tx_replay_executor.cpp @@ -724,7 +724,7 @@ int ObTxReplayExecutor::get_compat_mode_(const ObTabletID &tablet_id, lib::Worke void ObTxReplayExecutor::rewrite_replay_retry_code_(int &ret_code) { - if (ret_code == OB_MINOR_FREEZE_NOT_ALLOW || ret_code == OB_LOG_TS_OUT_OF_BOUND || + if (ret_code == OB_MINOR_FREEZE_NOT_ALLOW || ret_code == OB_SCN_OUT_OF_BOUND || ret_code == OB_ALLOCATE_MEMORY_FAILED || ret_code == OB_TIMEOUT) { TRANS_LOG(INFO, "rewrite replay error_code as OB_EAGAIN for retry", K(ret_code), K(ls_->get_ls_id()), K(log_ts_ns_));