fix bug in suspect info hash value using

This commit is contained in:
obdev
2022-11-13 02:23:56 +08:00
committed by wangzelin.wzl
parent 96afe7bb8a
commit fedb40cf7a
4 changed files with 26 additions and 15 deletions

View File

@ -25,9 +25,9 @@ namespace oceanbase
{
namespace sql
{
ObExprToOutfileRow::ObExprToOutfileRow(ObIAllocator &alloc)
: ObStringExprOperator(alloc, T_OP_TO_OUTFILE_ROW, N_TO_OUTFILE_ROW, MORE_THAN_ZERO, INTERNAL_IN_MYSQL_MODE)
ObExprToOutfileRow::ObExprToOutfileRow(ObIAllocator &alloc)
: ObStringExprOperator(alloc, T_OP_TO_OUTFILE_ROW, N_TO_OUTFILE_ROW, MORE_THAN_ZERO, INTERNAL_IN_MYSQL_MODE)
{
need_charset_convert_ = false;
}
@ -108,9 +108,9 @@ int ObExprToOutfileRow::extend_buffer(ObExprOutFileInfo &out_info,
out_info.tmp_buf_len_ = new_len;
}
return ret;
}
int ObExprToOutfileRow::calc_outfile_info(const ObExpr &expr,
}
int ObExprToOutfileRow::calc_outfile_info(const ObExpr &expr,
ObEvalCtx &ctx,
ObIAllocator &allocator,
ObExprOutFileInfo &out_info)
@ -142,9 +142,9 @@ int ObExprToOutfileRow::calc_outfile_info(const ObExpr &expr,
out_info.print_params_.cs_type_ = static_cast<ObCollationType>(objs_array[PARAM_CHARSET].get_int());
}
OZ(extract_fisrt_wchar_from_varhcar(out_info.field_, out_info.wchar_field_));
OZ(extract_fisrt_wchar_from_varhcar(out_info.line_, out_info.wchar_line_));
OZ(extract_fisrt_wchar_from_varhcar(out_info.enclose_, out_info.wchar_enclose_));
OZ(extract_fisrt_wchar_from_varhcar(out_info.field_, out_info.wchar_field_));
OZ(extract_fisrt_wchar_from_varhcar(out_info.line_, out_info.wchar_line_));
OZ(extract_fisrt_wchar_from_varhcar(out_info.enclose_, out_info.wchar_enclose_));
OZ(extract_fisrt_wchar_from_varhcar(out_info.escape_, out_info.wchar_escape_));
OZ(extend_buffer(out_info, allocator));
return ret;

View File

@ -61,6 +61,13 @@ ObScheduleSuspectInfo & ObScheduleSuspectInfo::operator = (const ObScheduleSuspe
return *this;
}
int64_t ObScheduleSuspectInfo::gen_hash(int64_t tenant_id, int64_t dag_hash)
{
int64_t hash_value = dag_hash;
hash_value = common::murmurhash(&tenant_id, sizeof(tenant_id), hash_value);
return hash_value;
}
ObScheduleSuspectInfoMgr::ObScheduleSuspectInfoMgr()
: is_inited_(false),
allocator_("scheSuspectInfo", OB_SERVER_TENANT_ID),
@ -616,7 +623,7 @@ int ObCompactionDiagnoseMgr::get_suspect_and_warning_info(
ObDagWarningInfo *warning_info = nullptr;
bool add_schedule_info = false;
if (OB_FAIL(ObScheduleSuspectInfoMgr::get_instance().get_suspect_info(dag.hash(), info))) {
if (OB_FAIL(ObScheduleSuspectInfoMgr::get_instance().get_suspect_info(ObScheduleSuspectInfo::gen_hash(MTL_ID(), dag.hash()), info))) {
if (OB_HASH_NOT_EXIST != ret) {
LOG_WARN("failed to get suspect info", K(ret), K(ls_id), K(tablet_id));
} else { // no schedule suspect info

View File

@ -40,6 +40,7 @@ struct ObScheduleSuspectInfo : public common::ObDLinkBase<ObScheduleSuspectInfo>
bool is_valid() const;
ObScheduleSuspectInfo & operator = (const ObScheduleSuspectInfo &other);
static int64_t gen_hash(int64_t tenant_id, int64_t dag_hash);
TO_STRING_KV(K_(tenant_id), K_(merge_type), K_(ls_id), K_(tablet_id), K_(add_time), K_(suspect_info));
int64_t tenant_id_;
int64_t add_time_;
@ -195,14 +196,16 @@ private:
dag_hash.merge_type_ = type; \
dag_hash.ls_id_ = ls_id; \
dag_hash.tablet_id_ = tablet_id; \
if (OB_FAIL(ObScheduleSuspectInfoMgr::get_instance().del_suspect_info(dag_hash.inner_hash()))) { \
int64_t tenant_id = MTL_ID(); \
int64_t hash_value = ObScheduleSuspectInfo::gen_hash(tenant_id, dag_hash.inner_hash()); \
if (OB_FAIL(ObScheduleSuspectInfoMgr::get_instance().del_suspect_info(hash_value))) { \
if (OB_HASH_NOT_EXIST != ret) { \
STORAGE_LOG(WARN, "failed to add suspect info", K(ret), K(dag_hash)); \
STORAGE_LOG(WARN, "failed to add suspect info", K(ret), K(dag_hash), K(tenant_id)); \
} else { \
ret = OB_SUCCESS; \
} \
} else { \
STORAGE_LOG(DEBUG, "success to add suspect info", K(ret), K(dag_hash)); \
STORAGE_LOG(DEBUG, "success to add suspect info", K(ret), K(dag_hash), K(tenant_id)); \
} \
}

View File

@ -1210,11 +1210,12 @@ void ObTabletMergeCtx::collect_running_info()
}
ObScheduleSuspectInfo ret_info;
if (OB_SUCCESS == ObScheduleSuspectInfoMgr::get_instance().get_suspect_info(dag_key, ret_info)) {
int64_t suspect_info_hash = ObScheduleSuspectInfo::gen_hash(MTL_ID(), dag_key);
if (OB_SUCCESS == ObScheduleSuspectInfoMgr::get_instance().get_suspect_info(suspect_info_hash, ret_info)) {
ADD_COMPACTION_INFO_PARAM(sstable_merge_info.comment_, sizeof(sstable_merge_info.comment_),
"add_timestamp", ret_info.add_time_,
"suspect_schedule_info", ret_info.suspect_info_);
(void)ObScheduleSuspectInfoMgr::get_instance().del_suspect_info(dag_key);
(void)ObScheduleSuspectInfoMgr::get_instance().del_suspect_info(suspect_info_hash);
}
if (OB_TMP_FAIL(MTL(storage::ObTenantSSTableMergeInfoMgr*)->add_sstable_merge_info(sstable_merge_info))) {