fix:print error msg

This commit is contained in:
wangmm0220 2024-06-27 14:13:18 +08:00
parent 1ec867449e
commit 4d77d321df
1 changed files with 9 additions and 8 deletions

View File

@ -147,7 +147,8 @@ static void monitorReadSendSlowLog(TdFilePtr pFile, void* pTransporter, SEpSet *
while(1){ while(1){
int64_t readSize = taosReadFile(pFile, buf + offset, SLOW_LOG_SEND_SIZE - offset); int64_t readSize = taosReadFile(pFile, buf + offset, SLOW_LOG_SEND_SIZE - offset);
if (readSize <= 0) { if (readSize <= 0) {
uError("failed to read len from file:%p since %s", pFile, terrstr()); if (readSize < 0)
uError("failed to read len from file:%p since %s", pFile, terrstr());
return; return;
} }
@ -423,7 +424,7 @@ void monitorCounterInc(int64_t clusterId, const char* counterName, const char**
MonitorClient* pMonitor = *ppMonitor; MonitorClient* pMonitor = *ppMonitor;
taos_counter_t** ppCounter = (taos_counter_t**)taosHashGet(pMonitor->counters, counterName, strlen(counterName)); taos_counter_t** ppCounter = (taos_counter_t**)taosHashGet(pMonitor->counters, counterName, strlen(counterName));
if (ppCounter == NULL || *ppCounter != NULL) { if (ppCounter == NULL || *ppCounter == NULL) {
uError("monitorCounterInc not found pCounter %"PRIx64":%s.", clusterId, counterName); uError("monitorCounterInc not found pCounter %"PRIx64":%s.", clusterId, counterName);
goto end; goto end;
} }
@ -543,10 +544,6 @@ static void* monitorThreadFunc(void *param){
} }
#endif #endif
if (-1 != atomic_val_compare_exchange_32(&slowLogFlag, -1, 0)) {
return NULL;
}
char tmpPath[PATH_MAX] = {0}; char tmpPath[PATH_MAX] = {0};
if (getSlowLogTmpDir(tmpPath, sizeof(tmpPath)) < 0){ if (getSlowLogTmpDir(tmpPath, sizeof(tmpPath)) < 0){
return NULL; return NULL;
@ -568,6 +565,10 @@ static void* monitorThreadFunc(void *param){
uError("open queue error since %s", terrstr()); uError("open queue error since %s", terrstr());
return NULL; return NULL;
} }
if (-1 != atomic_val_compare_exchange_32(&slowLogFlag, -1, 0)) {
return NULL;
}
uDebug("monitorThreadFunc start"); uDebug("monitorThreadFunc start");
while (1) { while (1) {
if (slowLogFlag > 0) break; if (slowLogFlag > 0) break;
@ -666,8 +667,8 @@ int32_t monitorPutData2MonitorQueue(int64_t clusterId, char* value){
slowLogData->clusterId = clusterId; slowLogData->clusterId = clusterId;
slowLogData->value = value; slowLogData->value = value;
uDebug("[monitor] write slow log to queue, clusterId:%"PRIx64 " value:%s", slowLogData->clusterId, slowLogData->value); uDebug("[monitor] write slow log to queue, clusterId:%"PRIx64 " value:%s", slowLogData->clusterId, slowLogData->value);
while (monitorQueue == NULL) { while (atomic_load_32(&slowLogFlag) == -1) {
taosMsleep(100); taosMsleep(5);
} }
if (taosWriteQitem(monitorQueue, slowLogData) == 0){ if (taosWriteQitem(monitorQueue, slowLogData) == 0){
tsem2_post(&monitorSem); tsem2_post(&monitorSem);