[PDML] discover seq no reorder under pdml and report new error

This commit is contained in:
Handora
2024-02-09 17:26:40 +00:00
committed by ob-robot
parent 8258a9bfb8
commit 290aa16bf3
5 changed files with 28 additions and 4 deletions

View File

@ -1072,6 +1072,7 @@ int ObQueryRetryCtrl::init()
ERR_RETRY_FUNC("TRX", OB_GTS_NOT_READY, short_wait_retry_proc, short_wait_retry_proc, nullptr);
ERR_RETRY_FUNC("TRX", OB_GTI_NOT_READY, short_wait_retry_proc, short_wait_retry_proc, nullptr);
ERR_RETRY_FUNC("TRX", OB_TRANS_WEAK_READ_VERSION_NOT_READY, short_wait_retry_proc, short_wait_retry_proc, nullptr);
ERR_RETRY_FUNC("TRX", OB_SEQ_NO_REORDER_UNDER_PDML, short_wait_retry_proc, short_wait_retry_proc, nullptr);
/* sql */
ERR_RETRY_FUNC("SQL", OB_ERR_INSUFFICIENT_PX_WORKER, px_thread_not_enough_proc, short_wait_retry_proc, nullptr);

File diff suppressed because one or more lines are too long

View File

@ -1840,6 +1840,7 @@ DEFINE_ERROR(OB_CLOG_DISK_HANG, -6325, -1, "HY000", "ob clog disk hang");
DEFINE_ERROR(OB_TABLE_LOCK_SPLIT_TWICE, -6326, -1, "HY000", "table lock has been splitted before, can not be splitted again")
DEFINE_ERROR(OB_TABLE_LOCK_IS_SPLITTING, -6327, -1, "HY000", "table lock is being splitted, can not be splitted again")
DEFINE_ERROR(OB_TABLE_LOCK_SPLIT_FAIL, -6328, -1, "HY000", "table lock splitting failed")
DEFINE_ERROR(OB_SEQ_NO_REORDER_UNDER_PDML, -6329, -1, "HY000", "pdml sql need retry under sequence number reorder")
// 余留位置
////////////////////////////////////////////////////////////////

View File

@ -1386,6 +1386,7 @@ constexpr int OB_CLOG_DISK_HANG = -6325;
constexpr int OB_TABLE_LOCK_SPLIT_TWICE = -6326;
constexpr int OB_TABLE_LOCK_IS_SPLITTING = -6327;
constexpr int OB_TABLE_LOCK_SPLIT_FAIL = -6328;
constexpr int OB_SEQ_NO_REORDER_UNDER_PDML = -6329;
constexpr int OB_ELECTION_WARN_LOGBUF_FULL = -7000;
constexpr int OB_ELECTION_WARN_LOGBUF_EMPTY = -7001;
constexpr int OB_ELECTION_WARN_NOT_RUNNING = -7002;
@ -3476,6 +3477,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_TABLE_LOCK_SPLIT_TWICE__USER_ERROR_MSG "table lock has been splitted before, can not be splitted again"
#define OB_TABLE_LOCK_IS_SPLITTING__USER_ERROR_MSG "table lock is being splitted, can not be splitted again"
#define OB_TABLE_LOCK_SPLIT_FAIL__USER_ERROR_MSG "table lock splitting failed"
#define OB_SEQ_NO_REORDER_UNDER_PDML__USER_ERROR_MSG "pdml sql need retry under sequence number reorder"
#define OB_ELECTION_WARN_LOGBUF_FULL__USER_ERROR_MSG "The log buffer is full"
#define OB_ELECTION_WARN_LOGBUF_EMPTY__USER_ERROR_MSG "The log buffer is empty"
#define OB_ELECTION_WARN_NOT_RUNNING__USER_ERROR_MSG "The object is not running"
@ -5697,6 +5699,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_TABLE_LOCK_SPLIT_TWICE__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6326, table lock has been splitted before, can not be splitted again"
#define OB_TABLE_LOCK_IS_SPLITTING__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6327, table lock is being splitted, can not be splitted again"
#define OB_TABLE_LOCK_SPLIT_FAIL__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6328, table lock splitting failed"
#define OB_SEQ_NO_REORDER_UNDER_PDML__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -6329, pdml sql need retry under sequence number reorder"
#define OB_ELECTION_WARN_LOGBUF_FULL__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -7000, The log buffer is full"
#define OB_ELECTION_WARN_LOGBUF_EMPTY__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -7001, The log buffer is empty"
#define OB_ELECTION_WARN_NOT_RUNNING__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -7002, The object is not running"
@ -6300,7 +6303,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_DATA_TOO_LONG_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-12899: value too large for column %.*s (actual: %ld, maximum: %ld)"
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-01861: Incorrect datetime value for column '%.*s' at row %ld"
extern int g_all_ob_errnos[2217];
extern int g_all_ob_errnos[2218];
const char *ob_error_name(const int oberr);
const char* ob_error_cause(const int oberr);

View File

@ -73,6 +73,7 @@ int check_sequence_set_violation(const concurrent_control::ObWriteFlag write_fla
// it). We use the common idea that all operations split in the storage
// layer will use same sequence number, so we bypass the check if the writer
// sequence number is equal to the locker sequence number.
// } else if (writer_seq_no == locker_seq_no &&
// (blocksstable::ObDmlFlag::DF_UPDATE == writer_dml_flag
// && blocksstable::ObDmlFlag::DF_LOCK == locker_dml_flag)) {
@ -153,8 +154,13 @@ int check_sequence_set_violation(const concurrent_control::ObWriteFlag write_fla
}
if (OB_SUCC(ret) && writer_seq_no < locker_seq_no) {
// We need guarantee the right sequence of the same txn operations
ret = OB_ERR_UNEXPECTED;
// Under the PDML scenario, there exists a case where a row may be
// concurrently modified by both a delete and an insert operation
// (consider a scenario like 'a = a + 1'). In such a situation, there is a
// possibility of sequence numbers becoming out of order on the row which
// may break the promise of the memtable semantics. We need to be aware of
// this situation and retry the entire SQL statement in such cases.
ret = OB_SEQ_NO_REORDER_UNDER_PDML;
TRANS_LOG(ERROR, "wrong row of sequence on one row found", K(reader_seq_no),
K(writer_tx_id), K(writer_dml_flag), K(writer_seq_no),
K(locker_tx_id), K(locker_dml_flag), K(locker_seq_no));