Fix the bug of sequence currval session self-verification failure

This commit is contained in:
hwx65
2024-01-10 10:16:11 +00:00
committed by ob-robot
parent 893dcea8e1
commit 3dc90a8451
3 changed files with 119 additions and 58 deletions

View File

@ -218,7 +218,7 @@ int ObSessInfoVerify::compare_verify_session_info(sql::ObSQLSessionInfo &sess,
LOG_WARN("info type is not consistent", K(ret), K(info_type1), K(info_type2)); LOG_WARN("info type is not consistent", K(ret), K(info_type1), K(info_type2));
} else if (OB_FAIL(sess.get_sess_encoder(SessionSyncInfoType(info_type1), encoder))) { } else if (OB_FAIL(sess.get_sess_encoder(SessionSyncInfoType(info_type1), encoder))) {
LOG_WARN("failed to get session encoder", K(ret)); LOG_WARN("failed to get session encoder", K(ret));
} else if (OB_FAIL(encoder->compare_sess_info(buf1 + pos1, info_len1, } else if (OB_FAIL(encoder->compare_sess_info(sess, buf1 + pos1, info_len1,
buf2 + pos2, info_len2))) { buf2 + pos2, info_len2))) {
LOG_ERROR("fail to compare session info", K(ret), LOG_ERROR("fail to compare session info", K(ret),
K(sess.get_sessid()), K(sess.get_sessid()),

View File

@ -3164,10 +3164,13 @@ int64_t ObErrorSyncSysVarEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& ses
return size; return size;
} }
int ObErrorSyncSysVarEncoder::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int ObErrorSyncSysVarEncoder::compare_sess_info(ObSQLSessionInfo &sess,
const char* last_sess_buf, int64_t last_sess_length) const char *current_sess_buf,
int64_t current_sess_length,
const char *last_sess_buf, int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(sess);
if (current_sess_length != last_sess_length) { if (current_sess_length != last_sess_length) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length), LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length),
@ -3325,10 +3328,12 @@ int64_t ObSysVarEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& sess)
return size; return size;
} }
int ObSysVarEncoder::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int ObSysVarEncoder::compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(sess);
if (current_sess_length != last_sess_length) { if (current_sess_length != last_sess_length) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length), LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length),
@ -3486,10 +3491,11 @@ int64_t ObAppInfoEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& sess)
return len; return len;
} }
int ObAppInfoEncoder::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int ObAppInfoEncoder::compare_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int64_t current_sess_length,
const char* last_sess_buf, int64_t last_sess_length) const char* last_sess_buf, int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(sess);
if (current_sess_length != last_sess_length) { if (current_sess_length != last_sess_length) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length), LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length),
@ -3623,10 +3629,12 @@ int64_t ObClientIdInfoEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& sess)
return len; return len;
} }
int ObClientIdInfoEncoder::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int ObClientIdInfoEncoder::compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(sess);
if (current_sess_length != last_sess_length) { if (current_sess_length != last_sess_length) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length), LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length),
@ -3728,10 +3736,12 @@ int64_t ObAppCtxInfoEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& sess)
return len; return len;
} }
int ObAppCtxInfoEncoder::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int ObAppCtxInfoEncoder::compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(sess);
if (current_sess_length != last_sess_length) { if (current_sess_length != last_sess_length) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length), LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length),
@ -3890,9 +3900,10 @@ int64_t ObSequenceCurrvalEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& ses
return len; return len;
} }
int ObSequenceCurrvalEncoder::compare_sess_info(const char* current_sess_buf, int ObSequenceCurrvalEncoder::compare_sess_info(ObSQLSessionInfo &sess,
const char *current_sess_buf,
int64_t current_sess_length, int64_t current_sess_length,
const char* last_sess_buf, const char *last_sess_buf,
int64_t last_sess_length) int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
@ -3903,9 +3914,18 @@ int ObSequenceCurrvalEncoder::compare_sess_info(const char* current_sess_buf,
} else if (memcmp(current_sess_buf, last_sess_buf, current_sess_length) == 0) { } else if (memcmp(current_sess_buf, last_sess_buf, current_sess_length) == 0) {
LOG_TRACE("success to compare session info", K(ret)); LOG_TRACE("success to compare session info", K(ret));
} else { } else {
ret = OB_ERR_UNEXPECTED; bool found_mismatch = false;
LOG_WARN("fail to compare buf session info", K(ret), if (OB_FAIL(cmp_display_sess_info_helper<false>(sess, current_sess_buf, current_sess_length,
KPHEX(current_sess_buf, current_sess_length), KPHEX(last_sess_buf, last_sess_length)); last_sess_buf, last_sess_length,
found_mismatch))) {
LOG_WARN("cmp_display_sess_info_helper fail", K(ret));
} else if (!found_mismatch) {
LOG_TRACE("success to compare session info", K(ret));
} else {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to compare buf session info", K(ret),
KPHEX(current_sess_buf, current_sess_length), KPHEX(last_sess_buf, last_sess_length));
}
} }
return ret; return ret;
} }
@ -3915,6 +3935,17 @@ int ObSequenceCurrvalEncoder::display_sess_info(ObSQLSessionInfo &sess,
int64_t current_sess_length, int64_t current_sess_length,
const char* last_sess_buf, const char* last_sess_buf,
int64_t last_sess_length) int64_t last_sess_length)
{
int ret = OB_SUCCESS;
bool found_mismatch = false;
return cmp_display_sess_info_helper<true>(sess, current_sess_buf, current_sess_length,
last_sess_buf, last_sess_length, found_mismatch);
}
template <bool display_seq_info>
int ObSequenceCurrvalEncoder::cmp_display_sess_info_helper(
ObSQLSessionInfo &sess, const char *current_sess_buf, int64_t current_sess_length,
const char *last_sess_buf, int64_t last_sess_length, bool &found_mismatch)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(current_sess_buf); UNUSED(current_sess_buf);
@ -3924,13 +3955,14 @@ int ObSequenceCurrvalEncoder::display_sess_info(ObSQLSessionInfo &sess,
int64_t data_len = last_sess_length; int64_t data_len = last_sess_length;
int64_t map_size = 0; int64_t map_size = 0;
int64_t current_id = 0; int64_t current_id = 0;
bool found_mismatch = false;
OB_UNIS_DECODE(map_size); OB_UNIS_DECODE(map_size);
ObSequenceCurrvalMap &map = sess.get_sequence_currval_map(); ObSequenceCurrvalMap &map = sess.get_sequence_currval_map();
if (map_size != map.size()) { if (map_size != map.size()) {
share::ObTaskController::get().allow_next_syslog(); if (display_seq_info) {
LOG_WARN("Sequence currval map size mismatch", K(ret), "current_map_size", map.size(), share::ObTaskController::get().allow_next_syslog();
"last_map_size", map_size); LOG_WARN("Sequence currval map size mismatch", K(ret), "current_map_size", map.size(),
"last_map_size", map_size);
}
} else { } else {
uint64_t seq_id = 0; uint64_t seq_id = 0;
ObSequenceValue seq_val_decode; ObSequenceValue seq_val_decode;
@ -3942,17 +3974,21 @@ int ObSequenceCurrvalEncoder::display_sess_info(ObSQLSessionInfo &sess,
if (OB_FAIL(map.get_refactored(seq_id, seq_val_origin))) { if (OB_FAIL(map.get_refactored(seq_id, seq_val_origin))) {
if (ret == OB_HASH_NOT_EXIST) { if (ret == OB_HASH_NOT_EXIST) {
found_mismatch = true; found_mismatch = true;
share::ObTaskController::get().allow_next_syslog(); if (display_seq_info) {
LOG_WARN("Decoded sequence id not found", K(ret), K(i), K(map_size), K(seq_id)); share::ObTaskController::get().allow_next_syslog();
LOG_WARN("Decoded sequence id not found", K(ret), K(i), K(map_size), K(seq_id));
}
ret = OB_SUCCESS; ret = OB_SUCCESS;
} else { } else {
LOG_WARN("Fail to get refactored from map", K(ret), K(seq_id)); LOG_WARN("Fail to get refactored from map", K(ret), K(seq_id));
} }
} else if (seq_val_decode.val() != seq_val_origin.val()) { } else if (seq_val_decode.val() != seq_val_origin.val()) {
found_mismatch = true; found_mismatch = true;
share::ObTaskController::get().allow_next_syslog(); if (display_seq_info) {
LOG_WARN("Sequence currval mismatch", K(ret), K(i), K(map_size), K(seq_id), share::ObTaskController::get().allow_next_syslog();
"current_seq_val", seq_val_origin, "last_seq_val", seq_val_decode); LOG_WARN("Sequence currval mismatch", K(ret), K(i), K(map_size), K(seq_id),
"current_seq_val", seq_val_origin, "last_seq_val", seq_val_decode);
}
} }
} }
} }
@ -3961,9 +3997,11 @@ int ObSequenceCurrvalEncoder::display_sess_info(ObSQLSessionInfo &sess,
OB_UNIS_DECODE(current_id); OB_UNIS_DECODE(current_id);
if (current_id != sess.get_current_dblink_sequence_id()) { if (current_id != sess.get_current_dblink_sequence_id()) {
found_mismatch = true; found_mismatch = true;
share::ObTaskController::get().allow_next_syslog(); if (display_seq_info) {
LOG_WARN("current dblink sequence id mismatch", share::ObTaskController::get().allow_next_syslog();
"current_seq_id", current_id, "last_seq_id", sess.get_current_dblink_sequence_id()); LOG_WARN("current dblink sequence id mismatch", "current_seq_id", current_id, "last_seq_id",
sess.get_current_dblink_sequence_id());
}
} }
OB_UNIS_DECODE(map_size); OB_UNIS_DECODE(map_size);
ObDBlinkSequenceIdMap &id_map = sess.get_dblink_sequence_id_map(); ObDBlinkSequenceIdMap &id_map = sess.get_dblink_sequence_id_map();
@ -3983,23 +4021,29 @@ int ObSequenceCurrvalEncoder::display_sess_info(ObSQLSessionInfo &sess,
if (OB_FAIL(id_map.get_refactored(key, seq_id_origin))) { if (OB_FAIL(id_map.get_refactored(key, seq_id_origin))) {
if (ret == OB_HASH_NOT_EXIST) { if (ret == OB_HASH_NOT_EXIST) {
found_mismatch = true; found_mismatch = true;
share::ObTaskController::get().allow_next_syslog(); if (display_seq_info) {
LOG_WARN("Decoded sequence id not found", K(ret), K(i), K(map_size), K(seq_id_decode)); share::ObTaskController::get().allow_next_syslog();
LOG_WARN("Decoded sequence id not found", K(ret), K(i), K(map_size), K(seq_id_decode));
}
ret = OB_SUCCESS; ret = OB_SUCCESS;
} else { } else {
LOG_WARN("Fail to get refactored from map", K(ret), K(seq_id_decode)); LOG_WARN("Fail to get refactored from map", K(ret), K(seq_id_decode));
} }
} else if (seq_id_decode != seq_id_origin) { } else if (seq_id_decode != seq_id_origin) {
found_mismatch = true; found_mismatch = true;
share::ObTaskController::get().allow_next_syslog(); if (display_seq_info) {
LOG_WARN("Sequence id mismatch", K(ret), K(i), K(map_size), share::ObTaskController::get().allow_next_syslog();
"current_seq_id", seq_id_decode, "last_seq_id", seq_id_origin); LOG_WARN("Sequence id mismatch", K(ret), K(i), K(map_size),
"current_seq_id", seq_id_decode, "last_seq_id", seq_id_origin);
}
} }
} }
} }
if (OB_SUCC(ret) && !found_mismatch) { if (OB_SUCC(ret) && !found_mismatch) {
share::ObTaskController::get().allow_next_syslog(); if (display_seq_info) {
LOG_WARN("All sequence currval is matched", K(ret), K(map_size)); share::ObTaskController::get().allow_next_syslog();
LOG_WARN("All sequence currval is matched", K(ret), K(map_size));
}
} }
} }
} }
@ -4045,10 +4089,12 @@ int64_t ObQueryInfoEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& sess)
return len; return len;
} }
int ObQueryInfoEncoder::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int ObQueryInfoEncoder::compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
UNUSED(sess);
if (current_sess_length != last_sess_length) { if (current_sess_length != last_sess_length) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length), LOG_WARN("fail to compare session info", K(ret), K(current_sess_length), K(last_sess_length),
@ -4227,8 +4273,9 @@ int64_t ObControlInfoEncoder::get_fetch_sess_info_size(ObSQLSessionInfo& sess)
return len; return len;
} }
int ObControlInfoEncoder::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int ObControlInfoEncoder::compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length)
{ {
int ret = OB_SUCCESS; int ret = OB_SUCCESS;
// todo The current control info does not meet the synchronization mechanism and cannot be verified // todo The current control info does not meet the synchronization mechanism and cannot be verified
@ -4305,8 +4352,9 @@ int64_t CLS::get_fetch_sess_info_size(ObSQLSessionInfo &sess) \
{ \ { \
return ObSqlTransControl::get_fetch_txn_##func##_state_size(sess); \ return ObSqlTransControl::get_fetch_txn_##func##_state_size(sess); \
} \ } \
int CLS::compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) \ int CLS::compare_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) \
{ \ { \
UNUSED(sess); \
return ObSqlTransControl::cmp_txn_##func##_state(current_sess_buf, current_sess_length, last_sess_buf, last_sess_length); \ return ObSqlTransControl::cmp_txn_##func##_state(current_sess_buf, current_sess_length, last_sess_buf, last_sess_length); \
} \ } \
int CLS::display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) \ int CLS::display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) \

View File

@ -264,8 +264,9 @@ public:
virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf,
const int64_t length, int64_t &pos) = 0; const int64_t length, int64_t &pos) = 0;
virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess)= 0; virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess)= 0;
virtual int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, virtual int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) = 0; int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length) = 0;
virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) = 0; int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) = 0;
bool is_changed_; bool is_changed_;
@ -280,8 +281,9 @@ public:
int get_serialize_size(ObSQLSessionInfo& sess, int64_t &length) const; int get_serialize_size(ObSQLSessionInfo& sess, int64_t &length) const;
int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos); int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos);
int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess); int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess);
int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length);
int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length);
}; };
@ -295,8 +297,9 @@ public:
int get_serialize_size(ObSQLSessionInfo& sess, int64_t &length) const; int get_serialize_size(ObSQLSessionInfo& sess, int64_t &length) const;
int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos); int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos);
int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess); int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess);
int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length);
int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length);
int set_client_info(ObSQLSessionInfo* sess, const ObString &client_info); int set_client_info(ObSQLSessionInfo* sess, const ObString &client_info);
@ -324,8 +327,9 @@ public:
virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf,
const int64_t length, int64_t &pos); const int64_t length, int64_t &pos);
virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess); virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess);
virtual int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, virtual int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length);
virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length);
}; };
@ -339,8 +343,9 @@ public:
virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf,
const int64_t length, int64_t &pos); const int64_t length, int64_t &pos);
virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess); virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess);
virtual int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, virtual int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length);
virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length);
}; };
@ -354,10 +359,15 @@ public:
virtual int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override; virtual int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override;
virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override; virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override;
virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override; virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override;
virtual int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, virtual int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) override; int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length) override;
virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override; int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override;
template <bool cmp_only>
int cmp_display_sess_info_helper(ObSQLSessionInfo &sess, const char *current_sess_buf,
int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length, bool &found_mismatch);
}; };
class ObControlInfoEncoder : public ObSessInfoEncoder { class ObControlInfoEncoder : public ObSessInfoEncoder {
@ -370,8 +380,9 @@ public:
virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf,
const int64_t length, int64_t &pos); const int64_t length, int64_t &pos);
virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess); virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess);
virtual int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, virtual int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length);
virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length); int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length);
static const int16_t CONINFO_BY_SESS = 0xC078; static const int16_t CONINFO_BY_SESS = 0xC078;
@ -389,8 +400,9 @@ public:
virtual int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override; virtual int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override;
virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override; virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override;
virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override; virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override;
virtual int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, virtual int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) override; int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length) override;
virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override; int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override;
}; };
@ -404,8 +416,9 @@ public:
virtual int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override; virtual int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override;
virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override; virtual int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override;
virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override; virtual int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override;
virtual int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, virtual int compare_sess_info(ObSQLSessionInfo &sess, const char *current_sess_buf,
const char* last_sess_buf, int64_t last_sess_length) override; int64_t current_sess_length, const char *last_sess_buf,
int64_t last_sess_length) override;
virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, virtual int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf,
int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override; int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override;
}; };
@ -418,7 +431,7 @@ public: \
int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override; \ int get_serialize_size(ObSQLSessionInfo &sess, int64_t &length) const override; \
int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override; \ int fetch_sess_info(ObSQLSessionInfo &sess, char *buf, const int64_t length, int64_t &pos) override; \
int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override; \ int64_t get_fetch_sess_info_size(ObSQLSessionInfo& sess) override; \
int compare_sess_info(const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override; \ int compare_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override; \
int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override; \ int display_sess_info(ObSQLSessionInfo &sess, const char* current_sess_buf, int64_t current_sess_length, const char* last_sess_buf, int64_t last_sess_length) override; \
}; };
DEF_SESSION_TXN_ENCODER(ObTxnStaticInfoEncoder); DEF_SESSION_TXN_ENCODER(ObTxnStaticInfoEncoder);