From 8a68dd6e6b22ad84982214c6597976599f662a8b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 2 Aug 2020 11:43:07 +0000 Subject: [PATCH 1/6] [TD-1033] change clusterId to string --- src/dnode/src/dnodeMgmt.c | 21 ++++++++++----------- src/dnode/src/dnodeTelemetry.c | 2 +- src/inc/taosdef.h | 1 + src/inc/taosmsg.h | 6 +++--- src/mnode/inc/mnodeCluster.h | 8 +------- src/mnode/inc/mnodeDef.h | 11 +++++------ src/mnode/src/mnodeCluster.c | 30 ++++++++++++++++-------------- src/mnode/src/mnodeDnode.c | 9 ++++----- src/os/inc/osSysinfo.h | 1 + src/os/src/detail/osSysinfo.c | 15 +++++++++++++++ 10 files changed, 57 insertions(+), 47 deletions(-) diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 745ffb3b84..532f03bcb5 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -489,8 +489,7 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { SDMDnodeCfg *pCfg = &pStatusRsp->dnodeCfg; pCfg->numOfVnodes = htonl(pCfg->numOfVnodes); pCfg->moduleStatus = htonl(pCfg->moduleStatus); - pCfg->dnodeId = htonl(pCfg->dnodeId); - pCfg->clusterId = htonl(pCfg->clusterId); + pCfg->dnodeId = htonl(pCfg->dnodeId); for (int32_t i = 0; i < pMnodes->nodeNum; ++i) { SDMMnodeInfo *pMnodeInfo = &pMnodes->nodeInfos[i]; @@ -696,12 +695,12 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { //strcpy(pStatus->dnodeName, tsDnodeName); pStatus->version = htonl(tsVersion); pStatus->dnodeId = htonl(tsDnodeCfg.dnodeId); - pStatus->clusterId = htonl(tsDnodeCfg.clusterId); - strcpy(pStatus->dnodeEp, tsLocalEp); pStatus->lastReboot = htonl(tsRebootTime); pStatus->numOfCores = htons((uint16_t) tsNumOfCores); pStatus->diskAvailable = tsAvailDataDirGB; pStatus->alternativeRole = (uint8_t) tsAlternativeRole; + tstrncpy(pStatus->clusterId, tsDnodeCfg.clusterId, TSDB_CLUSTER_ID_LEN); + tstrncpy(pStatus->dnodeEp, tsLocalEp, TSDB_EP_LEN); // fill cluster cfg parameters pStatus->clusterCfg.numOfMnodes = htonl(tsNumOfMnodes); @@ -768,11 +767,11 @@ static bool dnodeReadDnodeCfg() { tsDnodeCfg.dnodeId = dnodeId->valueint; cJSON* clusterId = cJSON_GetObjectItem(root, "clusterId"); - if (!clusterId || clusterId->type != cJSON_Number) { + if (!clusterId || clusterId->type != cJSON_String) { dError("failed to read dnodeCfg.json, clusterId not found"); goto PARSE_CFG_OVER; } - tsDnodeCfg.clusterId = clusterId->valueint; + tstrncpy(tsDnodeCfg.clusterId, clusterId->valuestring, TSDB_CLUSTER_ID_LEN); ret = true; @@ -793,13 +792,13 @@ static void dnodeSaveDnodeCfg() { if (!fp) return; int32_t len = 0; - int32_t maxLen = 100; + int32_t maxLen = 200; char * content = calloc(1, maxLen + 1); len += snprintf(content + len, maxLen - len, "{\n"); len += snprintf(content + len, maxLen - len, " \"dnodeId\": %d,\n", tsDnodeCfg.dnodeId); - len += snprintf(content + len, maxLen - len, " \"clusterId\": %d\n", tsDnodeCfg.clusterId); - len += snprintf(content + len, maxLen - len, "}\n"); + len += snprintf(content + len, maxLen - len, " \"clusterId\": \"%s\"\n", tsDnodeCfg.clusterId); + len += snprintf(content + len, maxLen - len, "}\n"); fwrite(content, 1, len, fp); fflush(fp); @@ -811,9 +810,9 @@ static void dnodeSaveDnodeCfg() { void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg) { if (tsDnodeCfg.dnodeId == 0) { - dInfo("dnodeId is set to %d, clusterId is set to %d", pCfg->dnodeId, pCfg->clusterId); + dInfo("dnodeId is set to %d, clusterId is set to %s", pCfg->dnodeId, pCfg->clusterId); tsDnodeCfg.dnodeId = pCfg->dnodeId; - tsDnodeCfg.clusterId = pCfg->clusterId; + tstrncpy(tsDnodeCfg.clusterId, pCfg->clusterId, TSDB_CLUSTER_ID_LEN); dnodeSaveDnodeCfg(); } } diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c index ce041d8303..8f9f042022 100644 --- a/src/dnode/src/dnodeTelemetry.c +++ b/src/dnode/src/dnodeTelemetry.c @@ -174,7 +174,7 @@ static void addVersionInfo(SBufferWriter* bw) { } static void addRuntimeInfo(SBufferWriter* bw) { - addIntField(bw, "clusterId", mnodeGetClusterId()); + addStringField(bw, "clusterId", mnodeGetClusterId()); // addIntField(&bw, "numOfDnode", 1); // addIntField(&bw, "numOfVnode", 1); // addIntField(&bw, "numOfStable", 1); diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index c328e57453..c3a808b765 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -254,6 +254,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size); #define TSDB_TIMEZONE_LEN 96 #define TSDB_LABEL_LEN 8 +#define TSDB_CLUSTER_ID_LEN 40 #define TSDB_FQDN_LEN 128 #define TSDB_EP_LEN (TSDB_FQDN_LEN+6) #define TSDB_IPv4ADDR_LEN 16 diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index edddc717c0..57e0b46f06 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -548,10 +548,10 @@ typedef struct { typedef struct { int32_t dnodeId; - int32_t clusterId; uint32_t moduleStatus; uint32_t numOfVnodes; - uint32_t reserved; + char clusterId[TSDB_CLUSTER_ID_LEN]; + char reserved[16]; } SDMDnodeCfg; typedef struct { @@ -589,7 +589,7 @@ typedef struct { uint16_t openVnodes; uint16_t numOfCores; float diskAvailable; // GB - int32_t clusterId; + char clusterId[TSDB_CLUSTER_ID_LEN]; uint8_t alternativeRole; uint8_t reserve2[15]; SClusterCfg clusterCfg; diff --git a/src/mnode/inc/mnodeCluster.h b/src/mnode/inc/mnodeCluster.h index 3be5d601af..a5af544dc2 100644 --- a/src/mnode/inc/mnodeCluster.h +++ b/src/mnode/inc/mnodeCluster.h @@ -20,16 +20,10 @@ extern "C" { #endif -struct SClusterObj; - int32_t mnodeInitCluster(); void mnodeCleanupCluster(); -int32_t mnodeGetClusterId(); void mnodeUpdateClusterId(); -void * mnodeGetCluster(int32_t clusterId); -void * mnodeGetNextCluster(void *pIter, struct SClusterObj **pCluster); -void mnodeIncClusterRef(struct SClusterObj *pCluster); -void mnodeDecClusterRef(struct SClusterObj *pCluster); +const char* mnodeGetClusterId(); #ifdef __cplusplus } diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index f6e3904c64..682986b29f 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -37,9 +37,9 @@ struct define notes: */ typedef struct SClusterObj { - int32_t clusterId; + char uid[TSDB_CLUSTER_ID_LEN]; int64_t createdTime; - int8_t reserved[36]; + int8_t reserved[12]; int8_t updateEnd[4]; int32_t refCount; } SClusterObj; @@ -90,7 +90,7 @@ typedef struct STableObj { typedef struct SSuperTableObj { STableObj info; - int8_t reserved0[1]; // for fill struct STableObj to 4byte align + int8_t reserved0[9]; // for fill struct STableObj to 4byte align int16_t nextColId; int32_t sversion; uint64_t uid; @@ -103,12 +103,11 @@ typedef struct SSuperTableObj { int32_t numOfTables; SSchema * schema; void * vgHash; - int8_t reserved2[6]; } SSuperTableObj; typedef struct { STableObj info; - int8_t reserved0[1]; // for fill struct STableObj to 4byte align + int8_t reserved0[9]; // for fill struct STableObj to 4byte align int16_t nextColId; //used by normal table int32_t sversion; //used by normal table uint64_t uid; @@ -144,7 +143,7 @@ typedef struct SVgObj { int8_t status; int8_t reserved0[4]; SVnodeGid vnodeGid[TSDB_MAX_REPLICA]; - int8_t reserved1[4]; + int8_t reserved1[12]; int8_t updateEnd[4]; int32_t refCount; int32_t numOfTables; diff --git a/src/mnode/src/mnodeCluster.c b/src/mnode/src/mnodeCluster.c index 5231b7bcd3..69614f77d6 100644 --- a/src/mnode/src/mnodeCluster.c +++ b/src/mnode/src/mnodeCluster.c @@ -26,7 +26,7 @@ static void * tsClusterSdb = NULL; static int32_t tsClusterUpdateSize; -static int32_t tsClusterId; +static char tsClusterId[TSDB_CLUSTER_ID_LEN]; static int32_t mnodeCreateCluster(); static int32_t mnodeGetClusterMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); @@ -90,7 +90,7 @@ int32_t mnodeInitCluster() { .hashSessions = TSDB_DEFAULT_CLUSTER_HASH_SIZE, .maxRowSize = tsClusterUpdateSize, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, - .keyType = SDB_KEY_INT, + .keyType = SDB_KEY_STRING, .insertFp = mnodeClusterActionInsert, .deleteFp = mnodeClusterActionDelete, .updateFp = mnodeClusterActionUpdate, @@ -118,10 +118,6 @@ void mnodeCleanupCluster() { tsClusterSdb = NULL; } -void *mnodeGetCluster(int32_t clusterId) { - return sdbGetRow(tsClusterSdb, &clusterId); -} - void *mnodeGetNextCluster(void *pIter, SClusterObj **pCluster) { return sdbFetchRow(tsClusterSdb, pIter, (void **)pCluster); } @@ -141,8 +137,14 @@ static int32_t mnodeCreateCluster() { SClusterObj *pCluster = malloc(sizeof(SClusterObj)); memset(pCluster, 0, sizeof(SClusterObj)); pCluster->createdTime = taosGetTimestampMs(); - pCluster->clusterId = labs((pCluster->createdTime >> 32) & (pCluster->createdTime)) | (*(int32_t*)tsFirst); - + bool getuid = taosGetSystemUid(pCluster->uid); + if (!getuid) { + strcpy(pCluster->uid, "tdengine2.0"); + mError("failed to get uid from system, set to default val %s", pCluster->uid); + } else { + mDebug("uid is %s", pCluster->uid); + } + SSdbOper oper = { .type = SDB_OPER_GLOBAL, .table = tsClusterSdb, @@ -152,7 +154,7 @@ static int32_t mnodeCreateCluster() { return sdbInsertRow(&oper); } -int32_t mnodeGetClusterId() { +const char* mnodeGetClusterId() { return tsClusterId; } @@ -160,8 +162,8 @@ void mnodeUpdateClusterId() { SClusterObj *pCluster = NULL; void *pIter = mnodeGetNextCluster(NULL, &pCluster); if (pCluster != NULL) { - tsClusterId = pCluster->clusterId; - mInfo("cluster id is %d", tsClusterId); + tstrncpy(tsClusterId, pCluster->uid, TSDB_CLUSTER_ID_LEN); + mInfo("cluster id is set to %s", tsClusterId); } mnodeDecClusterRef(pCluster); @@ -172,8 +174,8 @@ static int32_t mnodeGetClusterMeta(STableMetaMsg *pMeta, SShowObj *pShow, void * int32_t cols = 0; SSchema *pSchema = pMeta->schema; - pShow->bytes[cols] = 4; - pSchema[cols].type = TSDB_DATA_TYPE_INT; + pShow->bytes[cols] = TSDB_CLUSTER_ID_LEN + VARSTR_HEADER_SIZE; + pSchema[cols].type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema[cols].name, "clusterId"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; @@ -212,7 +214,7 @@ static int32_t mnodeRetrieveClusters(SShowObj *pShow, char *data, int32_t rows, cols = 0; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t *) pWrite = pCluster->clusterId; + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pCluster->uid, TSDB_CLUSTER_ID_LEN); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 06c343a903..b68095ea3d 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -353,7 +353,6 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { pStatus->moduleStatus = htonl(pStatus->moduleStatus); pStatus->lastReboot = htonl(pStatus->lastReboot); pStatus->numOfCores = htons(pStatus->numOfCores); - pStatus->clusterId = htonl(pStatus->clusterId); uint32_t version = htonl(pStatus->version); if (version != tsVersion) { @@ -383,10 +382,10 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { pDnode->moduleStatus = pStatus->moduleStatus; if (pStatus->dnodeId == 0) { - mDebug("dnode:%d %s, first access, set clusterId %d", pDnode->dnodeId, pDnode->dnodeEp, mnodeGetClusterId()); + mDebug("dnode:%d %s, first access, set clusterId %s", pDnode->dnodeId, pDnode->dnodeEp, mnodeGetClusterId()); } else { - if (pStatus->clusterId != mnodeGetClusterId()) { - mError("dnode:%d, input clusterId %d not match with exist %d", pDnode->dnodeId, pStatus->clusterId, + if (strncmp(pStatus->clusterId, mnodeGetClusterId(), TSDB_CLUSTER_ID_LEN - 1) != 0) { + mError("dnode:%d, input clusterId %s not match with exist %s", pDnode->dnodeId, pStatus->clusterId, mnodeGetClusterId()); return TSDB_CODE_MND_INVALID_CLUSTER_ID; } else { @@ -405,7 +404,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId); pRsp->dnodeCfg.moduleStatus = htonl((int32_t)pDnode->isMgmt); pRsp->dnodeCfg.numOfVnodes = htonl(openVnodes); - pRsp->dnodeCfg.clusterId = htonl(mnodeGetClusterId()); + tstrncpy(pRsp->dnodeCfg.clusterId, mnodeGetClusterId(), TSDB_CLUSTER_ID_LEN); SDMVgroupAccess *pAccess = (SDMVgroupAccess *)((char *)pRsp + sizeof(SDMStatusRsp)); for (int32_t j = 0; j < openVnodes; ++j) { diff --git a/src/os/inc/osSysinfo.h b/src/os/inc/osSysinfo.h index c3db406a17..2b98f8b4bf 100644 --- a/src/os/inc/osSysinfo.h +++ b/src/os/inc/osSysinfo.h @@ -31,6 +31,7 @@ bool taosGetSysMemory(float *memoryUsedMB); void taosPrintOsInfo(); int taosSystem(const char * cmd) ; void taosKillSystem(); +bool taosGetSystemUid(char *uid); // TAOS_OS_FUNC_SYSINFO_CORE void taosSetCoreDump(); diff --git a/src/os/src/detail/osSysinfo.c b/src/os/src/detail/osSysinfo.c index a03199e8d1..9703d26ec4 100644 --- a/src/os/src/detail/osSysinfo.c +++ b/src/os/src/detail/osSysinfo.c @@ -639,4 +639,19 @@ void taosSetCoreDump() { } +bool taosGetSystemUid(char *uid) { + int fd; + int len = 0; + + fd = open("/proc/sys/kernel/random/uuid", 0); + if (fd < 0) { + return false; + } else { + len = read(fd, uid, TSDB_CLUSTER_ID_LEN); + close(fd); + } + + return len > 0; +} + #endif \ No newline at end of file From 1fe3dbebfb6c9b4cbda5a24c24182e2a6c94412c Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 2 Aug 2020 11:48:42 +0000 Subject: [PATCH 2/6] set telemetryReporting default val to false --- src/common/src/tglobal.c | 2 +- tests/pytest/util/dnodes.py | 1 + tests/script/sh/deploy.sh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index c3dc078428..9528d3705c 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -40,7 +40,7 @@ uint16_t tsSyncPort = 6040; int32_t tsStatusInterval = 1; // second int32_t tsNumOfMnodes = 3; int32_t tsEnableVnodeBak = 1; -int32_t tsEnableTelemetryReporting = 1; +int32_t tsEnableTelemetryReporting = 0; // common int32_t tsRpcTimer = 1000; diff --git a/tests/pytest/util/dnodes.py b/tests/pytest/util/dnodes.py index ec3865f4f2..2e7732ea4f 100644 --- a/tests/pytest/util/dnodes.py +++ b/tests/pytest/util/dnodes.py @@ -191,6 +191,7 @@ class TDDnode: self.cfg("charset", "UTF-8") self.cfg("asyncLog", "0") self.cfg("anyIp", "0") + self.cfg("tsEnableTelemetryReporting", "0") self.cfg("dDebugFlag", "135") self.cfg("mDebugFlag", "135") self.cfg("sdbDebugFlag", "135") diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 90ca14277b..1a0d667f88 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -147,5 +147,6 @@ echo "asyncLog 0" >> $TAOS_CFG echo "numOfMnodes 1" >> $TAOS_CFG echo "locale en_US.UTF-8" >> $TAOS_CFG echo "fsync 0" >> $TAOS_CFG +echo "tsEnableTelemetryReporting 0" >> $TAOS_CFG echo " " >> $TAOS_CFG From 28cc613e194c1781eac467536b77fa71333729f6 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 2 Aug 2020 20:54:29 +0800 Subject: [PATCH 3/6] unlock dbmutex while create vgroup failed --- src/mnode/src/mnodeVgroup.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 9423720241..b3acf5d4d0 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -450,6 +450,7 @@ int32_t mnodeGetAvailableVgroup(SMnodeMsg *pMsg, SVgObj **ppVgroup, int32_t *pSi } if (pDb->numOfVgroups < 1) { + pthread_mutex_unlock(&pDb->mutex); mDebug("app:%p:%p, db:%s, failed create new vgroup since:%s, numOfVgroups:%d maxVgroupsPerDb:%d ", pMsg->rpcMsg.ahandle, pMsg, pDb->name, tstrerror(code), pDb->numOfVgroups, maxVgroupsPerDb); return code; From 9bc81582463c9a9c2072280e0f046814107980d7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 2 Aug 2020 21:33:05 +0800 Subject: [PATCH 4/6] Modify the incorrect use of tqueue --- src/mnode/src/mnodeSdb.c | 2 +- src/util/src/tqueue.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 301dd41cbc..efca748e9f 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -988,7 +988,7 @@ int32_t sdbAllocWriteQueue() { } void sdbFreeWritequeue() { - taosCloseQset(tsSdbWriteQueue); + taosCloseQueue(tsSdbWriteQueue); taosFreeQall(tsSdbWriteQall); taosCloseQset(tsSdbWriteQset); tsSdbWriteQall = NULL; diff --git a/src/util/src/tqueue.c b/src/util/src/tqueue.c index e2f0614455..8c6d6243eb 100644 --- a/src/util/src/tqueue.c +++ b/src/util/src/tqueue.c @@ -241,7 +241,6 @@ void taosCloseQset(taos_qset param) { if (param == NULL) return; STaosQset *qset = (STaosQset *)param; -#if 0 // remove all the queues from qset pthread_mutex_lock(&qset->mutex); while (qset->head) { @@ -252,7 +251,6 @@ void taosCloseQset(taos_qset param) { queue->next = NULL; } pthread_mutex_unlock(&qset->mutex); -#endif pthread_mutex_destroy(&qset->mutex); tsem_destroy(&qset->sem); From ce3d4a79a600b7b044b0171eca3948320428c7d9 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sun, 2 Aug 2020 21:37:40 +0800 Subject: [PATCH 5/6] minor changes --- src/rpc/src/rpcMain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index be609c4ee8..01c753ec5b 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -747,7 +747,8 @@ static SRpcConn *rpcGetConnObj(SRpcInfo *pRpc, int sid, SRecvInfo *pRecv) { if (pConn) { if (pConn->linkUid != pHead->linkUid) { terrno = TSDB_CODE_RPC_MISMATCHED_LINK_ID; - tError("%s %p %p, linkUid:0x%x is not matched with received:0x%x", pRpc->label, pConn, (void*)pHead->ahandle, pConn->linkUid, pHead->linkUid); + tDebug("%s %p %p, linkUid:0x%x is not matched with received:0x%x", pRpc->label, pConn, (void *)pHead->ahandle, + pConn->linkUid, pHead->linkUid); pConn = NULL; } } From 05c356280e0cce35f764a1831fa66bf586a4f379 Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Mon, 3 Aug 2020 09:18:54 +0800 Subject: [PATCH 6/6] td-1033: fix high cpu usage --- src/dnode/src/dnodeTelemetry.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c index 8f9f042022..356aebd654 100644 --- a/src/dnode/src/dnodeTelemetry.c +++ b/src/dnode/src/dnodeTelemetry.c @@ -235,7 +235,9 @@ static void* telemetryThread(void* param) { } int startAt = taosGetTimestampSec(); - struct timespec timeout = {.tv_sec = timeToWait, .tv_nsec = 0}; + struct timespec timeout = {.tv_sec = 0, .tv_nsec = 0}; + clock_gettime(CLOCK_REALTIME, &timeout); + timeout.tv_sec += timeToWait; if (sem_timedwait(&tsExitSem, &timeout) == 0) { break; } @@ -279,4 +281,4 @@ void dnodeCleanupTelemetry() { pthread_join(tsTelemetryThread, NULL); sem_destroy(&tsExitSem); } -} \ No newline at end of file +}