fix:[TS-4921]refactor reporting logic for slow log
This commit is contained in:
parent
65696ce97f
commit
595c3f8e07
|
@ -537,6 +537,12 @@ static void monitorSendAllSlowLogAtQuit(){
|
|||
taosHashCancelIterate(monitorSlowLogHash, pIter);
|
||||
return;
|
||||
}
|
||||
int64_t size = getFileSize(pClient->path);
|
||||
if(size <= pClient->offset){
|
||||
taosUnLockFile(pClient->pFile);
|
||||
taosCloseFile(&(pClient->pFile));
|
||||
taosRemoveFile(pClient->path);
|
||||
}else{
|
||||
int64_t* clusterId = (int64_t*)taosHashGetKey(pIter, NULL);
|
||||
SAppInstInfo* pInst = getAppInstByClusterId(*clusterId);
|
||||
if(pInst == NULL) {
|
||||
|
@ -545,7 +551,6 @@ static void monitorSendAllSlowLogAtQuit(){
|
|||
}
|
||||
SEpSet ep = getEpSet_s(&pInst->mgmtEp);
|
||||
int64_t offset = 0;
|
||||
int64_t size = getFileSize(pClient->path);
|
||||
char* data = readFile(pClient->pFile, &offset, size);
|
||||
if(data != NULL && sendSlowLog(*clusterId, data, NULL, offset, SLOW_LOG_READ_QUIT, NULL, pInst->pTransporter, &ep) == 0){
|
||||
quitCnt ++;
|
||||
|
@ -553,6 +558,7 @@ static void monitorSendAllSlowLogAtQuit(){
|
|||
uDebug("[monitor] monitorSendAllSlowLogAtQuit send slow log :%s", data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void monitorSendAllSlowLog(){
|
||||
int64_t t = taosGetMonoTimestampMs();
|
||||
|
|
Loading…
Reference in New Issue