[BugFix] fix diagnose_info core of all_virtual_minor_freeze_info

This commit is contained in:
obdev
2022-12-06 14:08:21 +00:00
committed by ob-robot
parent aba1df2db3
commit 4d38a86de9
4 changed files with 22 additions and 3 deletions

View File

@ -29,6 +29,7 @@ ObAllVirtualMinorFreezeInfo::ObAllVirtualMinorFreezeInfo()
addr_(), addr_(),
ls_id_(share::ObLSID::INVALID_LS_ID), ls_id_(share::ObLSID::INVALID_LS_ID),
ls_iter_guard_(), ls_iter_guard_(),
diagnose_info_(),
memtables_info_() memtables_info_()
{ {
} }
@ -44,6 +45,7 @@ void ObAllVirtualMinorFreezeInfo::reset()
addr_.reset(); addr_.reset();
ls_id_ = share::ObLSID::INVALID_LS_ID; ls_id_ = share::ObLSID::INVALID_LS_ID;
ls_iter_guard_.reset(); ls_iter_guard_.reset();
diagnose_info_.reset();
memtables_info_.reset(); memtables_info_.reset();
memset(ip_buf_, 0, common::OB_IP_STR_BUFF); memset(ip_buf_, 0, common::OB_IP_STR_BUFF);
memset(memtables_info_string_, 0, OB_MAX_CHAR_LENGTH); memset(memtables_info_string_, 0, OB_MAX_CHAR_LENGTH);
@ -54,6 +56,7 @@ void ObAllVirtualMinorFreezeInfo::release_last_tenant()
{ {
ls_id_ = share::ObLSID::INVALID_LS_ID; ls_id_ = share::ObLSID::INVALID_LS_ID;
ls_iter_guard_.reset(); ls_iter_guard_.reset();
diagnose_info_.reset();
memtables_info_.reset(); memtables_info_.reset();
memset(memtables_info_string_, 0, OB_MAX_CHAR_LENGTH); memset(memtables_info_string_, 0, OB_MAX_CHAR_LENGTH);
} }
@ -205,8 +208,10 @@ int ObAllVirtualMinorFreezeInfo::process_curr_tenant(ObNewRow *&row)
break; break;
case OB_APP_MIN_COLUMN_ID + 12: case OB_APP_MIN_COLUMN_ID + 12:
// diagnose_info // diagnose_info
cur_row_.cells_[i].set_varchar(freeze_stat.diagnose_info_.get_ob_string()); if (OB_SUCC(freeze_stat.get_diagnose_info(diagnose_info_))) {
cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset())); cur_row_.cells_[i].set_varchar(diagnose_info_.get_ob_string());
cur_row_.cells_[i].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
}
break; break;
case OB_APP_MIN_COLUMN_ID + 13: case OB_APP_MIN_COLUMN_ID + 13:
// memtables_info // memtables_info
@ -255,7 +260,7 @@ int ObAllVirtualMinorFreezeInfo::generate_memtables_info()
strcat(memtables_info_string_, ", unsubmitted_cnt:"); strcat(memtables_info_string_, ", unsubmitted_cnt:");
strcat(memtables_info_string_, to_cstring(memtables_info_[i].unsubmitted_cnt_)); strcat(memtables_info_string_, to_cstring(memtables_info_[i].unsubmitted_cnt_));
// unsynced_cnt // unsynced_cnt
strcat(memtables_info_string_, ", unsubmitted_cnt:"); strcat(memtables_info_string_, ", unsynced_cnt:");
strcat(memtables_info_string_, to_cstring(memtables_info_[i].unsynced_cnt_)); strcat(memtables_info_string_, to_cstring(memtables_info_[i].unsynced_cnt_));
// current_right_boundary // current_right_boundary
strcat(memtables_info_string_, ", current_right_boundary:"); strcat(memtables_info_string_, ", current_right_boundary:");

View File

@ -51,6 +51,7 @@ private:
int64_t ls_id_; int64_t ls_id_;
ObSharedGuard<storage::ObLSIterator> ls_iter_guard_; ObSharedGuard<storage::ObLSIterator> ls_iter_guard_;
char ip_buf_[common::OB_IP_STR_BUFF]; char ip_buf_[common::OB_IP_STR_BUFF];
ObStringHolder diagnose_info_;
common::ObSArray<ObFrozenMemtableInfo> memtables_info_; common::ObSArray<ObFrozenMemtableInfo> memtables_info_;
char memtables_info_string_[OB_MAX_CHAR_LENGTH]; char memtables_info_string_[OB_MAX_CHAR_LENGTH];
private: private:

View File

@ -193,6 +193,18 @@ void ObFreezerStat::add_diagnose_info(const ObString &str)
diagnose_info_.assign(str); diagnose_info_.assign(str);
} }
int ObFreezerStat::get_diagnose_info(ObStringHolder &diagnose_info)
{
int ret = OB_SUCCESS;
ObSpinLockGuard guard(diagnose_info_lock_);
if (OB_FAIL(diagnose_info.assign(diagnose_info_))) {
TRANS_LOG(WARN, "fail to assign diagnose_info", K(ret));
}
return ret;
}
ObFreezer::ObFreezer() ObFreezer::ObFreezer()
: freeze_flag_(0), : freeze_flag_(0),
freeze_snapshot_version_(), freeze_snapshot_version_(),

View File

@ -161,6 +161,7 @@ public:
int remove_memtable_info(const ObTabletID &tablet_id); int remove_memtable_info(const ObTabletID &tablet_id);
int get_memtables_info(common::ObSArray<ObFrozenMemtableInfo> &memtables_info); int get_memtables_info(common::ObSArray<ObFrozenMemtableInfo> &memtables_info);
void add_diagnose_info(const ObString &str); void add_diagnose_info(const ObString &str);
int get_diagnose_info(ObStringHolder &diagnose_info);
public: public:
ObTabletID tablet_id_; ObTabletID tablet_id_;