Merge pull request #27518 from taosdata/fix/TD-31686-remove-void-hash

fix/TD-31686-remove-void-hash
This commit is contained in:
Hongze Cheng 2024-08-29 11:57:29 +08:00 committed by GitHub
commit fec49abf33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 41 additions and 13 deletions

View File

@ -404,7 +404,9 @@ static int32_t mndProcessArbHbTimer(SRpcMsg *pReq) {
hbMembers = *(SArray **)pObj;
} else {
hbMembers = taosArrayInit(16, sizeof(SVArbHbReqMember));
(void)taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES);
if (taosHashPut(pDnodeHash, &dnodeId, sizeof(int32_t), &hbMembers, POINTER_BYTES) == 0) {
mError("dnodeId:%d, failed to push hb member inty]o hash, but conitnue next at this timer round", dnodeId);
}
}
SVArbHbReqMember reqMember = {.vgId = pArbGroup->vgId, .hbSeq = pMember->state.nextHbSeq++};
if (taosArrayPush(hbMembers, &reqMember) == NULL) {

View File

@ -2168,6 +2168,16 @@ static int32_t refreshNodeListFromExistedStreams(SMnode *pMnode, SArray *pNodeLi
SNodeEntry entry = {.hbTimestamp = -1, .nodeId = pTask->info.nodeId, .lastHbMsgId = -1};
epsetAssign(&entry.epset, &pTask->info.epSet);
(void)taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry));
/*
if (taosHashPut(pHash, &entry.nodeId, sizeof(entry.nodeId), &entry, sizeof(entry)) == 0) {
code = terrno;
taosWUnLockLatch(&pStream->lock);
sdbRelease(pSdb, pStream);
destroyStreamTaskIter(pTaskIter);
taosArrayClear(pNodeList);
return code;
}
*/
}
destroyStreamTaskIter(pTaskIter);

View File

@ -768,7 +768,9 @@ void mndTransSetDbName(STrans *pTrans, const char *dbname, const char *stbname)
}
void mndTransAddArbGroupId(STrans *pTrans, int32_t groupId) {
(void)taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0);
if (taosHashPut(pTrans->arbGroupIds, &groupId, sizeof(int32_t), NULL, 0) == 0) {
mError("trans:%d, failed to put groupid into hash, groupId:%d", pTrans->id, groupId);
}
}
void mndTransSetSerial(STrans *pTrans) { pTrans->exec = TRN_EXEC_SERIAL; }

View File

@ -117,7 +117,10 @@ void monInitMonitorFW(){
if(taos_collector_registry_register_metric(gauge) == 1){
(void)taos_counter_destroy(gauge);
}
(void)taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *));
if (taosHashPut(tsMonitor.metrics, dnodes_gauges[i], strlen(dnodes_gauges[i]), &gauge, sizeof(taos_gauge_t *)) !=
0) {
uError("failed to add dnode gauge at%d:%s", i, dnodes_gauges[i]);
}
}
int32_t dnodes_data_label_count = 5;
@ -128,8 +131,10 @@ void monInitMonitorFW(){
if(taos_collector_registry_register_metric(gauge) == 1){
(void)taos_counter_destroy(gauge);
}
(void)taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge,
sizeof(taos_gauge_t *));
if (taosHashPut(tsMonitor.metrics, dnodes_data_gauges[i], strlen(dnodes_data_gauges[i]), &gauge,
sizeof(taos_gauge_t *)) != 0) {
uError("failed to add dnode data gauge at%d:%s", i, dnodes_data_gauges[i]);
}
}
int32_t dnodes_log_label_count = 4;
@ -140,8 +145,10 @@ void monInitMonitorFW(){
if(taos_collector_registry_register_metric(gauge) == 1){
(void)taos_counter_destroy(gauge);
}
(void)taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge,
sizeof(taos_gauge_t *));
if (taosHashPut(tsMonitor.metrics, dnodes_log_gauges[i], strlen(dnodes_log_gauges[i]), &gauge,
sizeof(taos_gauge_t *)) != 0) {
uError("failed to add dnode log gauge at%d:%s", i, dnodes_log_gauges[i]);
}
}
}
@ -186,7 +193,9 @@ void monGenClusterInfoTable(SMonInfo *pMonitor){
if(taos_collector_registry_register_metric(gauge) == 1){
(void)taos_counter_destroy(gauge);
}
(void)taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *));
if (taosHashPut(tsMonitor.metrics, metric_names[i], strlen(metric_names[i]), &gauge, sizeof(taos_gauge_t *)) != 0) {
uError("failed to add cluster gauge at%d:%s", i, metric_names[i]);
}
}
char buf[TSDB_CLUSTER_ID_LEN] = {0};
@ -640,8 +649,10 @@ void monGenMnodeRoleTable(SMonInfo *pMonitor){
if(taos_collector_registry_register_metric(gauge) == 1){
(void)taos_counter_destroy(gauge);
}
(void)taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge,
sizeof(taos_gauge_t *));
if (taosHashPut(tsMonitor.metrics, mnodes_role_gauges[i], strlen(mnodes_role_gauges[i]), &gauge,
sizeof(taos_gauge_t *)) != 0) {
uError("failed to add mnode role gauge at%d:%s", i, mnodes_role_gauges[i]);
}
}
char buf[TSDB_CLUSTER_ID_LEN] = {0};
@ -707,8 +718,10 @@ void monGenVnodeRoleTable(SMonInfo *pMonitor){
if(taos_collector_registry_register_metric(gauge) == 1){
(void)taos_counter_destroy(gauge);
}
(void)taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge,
sizeof(taos_gauge_t *));
if (taosHashPut(tsMonitor.metrics, vnodes_role_gauges[i], strlen(vnodes_role_gauges[i]), &gauge,
sizeof(taos_gauge_t *)) != 0) {
uError("failed to add vnode role gauge at%d:%s", i, vnodes_role_gauges[i]);
}
}
char buf[TSDB_CLUSTER_ID_LEN] = {0};

View File

@ -132,7 +132,8 @@ int32_t monInit(const SMonCfg *pCfg) {
}
void monInitVnode() {
if (tsEnableMonitor && tsMonitorFqdn[0] != 0 && tsMonitorPort != 0 && tsInsertCounter == NULL) {
if (!tsEnableMonitor || tsMonitorFqdn[0] == 0 || tsMonitorPort == 0) return;
if (tsInsertCounter == NULL) {
taos_counter_t *counter = NULL;
int32_t label_count = 7;
const char *sample_labels[] = {VNODE_METRIC_TAG_NAME_SQL_TYPE, VNODE_METRIC_TAG_NAME_CLUSTER_ID,