diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 507843cb2fb575b5c48191e7db5c72ec204320c0..a19331c7067ce0cc6b7dfab7484a0eebf99b7b72 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -59,6 +59,7 @@ extern uint16_t tsMnodeDnodePort; extern uint16_t tsMnodeShellPort; extern uint16_t tsDnodeShellPort; extern uint16_t tsDnodeMnodePort; +extern uint16_t tsSyncPort; extern int tsStatusInterval; extern int tsShellActivityTimer; diff --git a/src/common/inc/tulog.h b/src/common/inc/tulog.h index 34b6ba7ae89dd0651006da254f3a79e1329b1c44..b5499d81fca796b94071706988053d9811d84d84 100644 --- a/src/common/inc/tulog.h +++ b/src/common/inc/tulog.h @@ -44,6 +44,11 @@ extern int32_t tscEmbedded; #define uPrint(...) \ { taosPrintLog("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); } +#define pError(...) \ + { taosPrintLog("ERROR APP ", 255, __VA_ARGS__); } +#define pPrint(...) \ + { taosPrintLog("APP ", 255, __VA_ARGS__); } + #ifdef __cplusplus } #endif diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 2965117d2da2793239bdd02957661f159c14ee0c..4998d4351871179c3762b8a28fd4887d71a23458 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -65,7 +65,8 @@ char tsSecondIp[TSDB_IPv4ADDR_LEN] = {0}; uint16_t tsMnodeShellPort = 6030; // udp[6030-6034] tcp[6030] uint16_t tsDnodeShellPort = 6035; // udp[6035-6039] tcp[6035] uint16_t tsMnodeDnodePort = 6040; // udp/tcp -uint16_t tsDnodeMnodePort = 6041; // udp/tcp +uint16_t tsDnodeMnodePort = 6045; // udp/tcp +uint16_t tsSyncPort = 6050; int32_t tsStatusInterval = 1; // second int32_t tsShellActivityTimer = 3; // second diff --git a/src/dnode/src/dnodeMClient.c b/src/dnode/src/dnodeMClient.c index fcf1f477b29137e4b5a15e1061b008df1a38d0ab..8d5d0a02ec5eb1e805e8d7af690286b6997dbe86 100644 --- a/src/dnode/src/dnodeMClient.c +++ b/src/dnode/src/dnodeMClient.c @@ -34,26 +34,28 @@ #define MPEER_CONTENT_LEN 2000 -static bool dnodeReadMnodeIpList(); -static void dnodeSaveMnodeIpList(); -static void dnodeReadDnodeInfo(); -static void dnodeUpdateDnodeInfo(int32_t dnodeId); +static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes); +static bool dnodeReadMnodeInfos(); +static void dnodeSaveMnodeInfos(); +static void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg); +static bool dnodeReadDnodeCfg(); +static void dnodeSaveDnodeCfg(); static void dnodeProcessRspFromMnode(SRpcMsg *pMsg); static void dnodeProcessStatusRsp(SRpcMsg *pMsg); static void dnodeSendStatusMsg(void *handle, void *tmrId); static void (*tsDnodeProcessMgmtRspFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); -static void *tsDnodeMClientRpc = NULL; -static SRpcIpSet tsMnodeIpList = {0}; -static SDMNodeInfos tsMnodeInfos = {0}; +static void *tsDnodeMClientRpc = NULL; static void *tsDnodeTmr = NULL; static void *tsStatusTimer = NULL; static uint32_t tsRebootTime; -static int32_t tsDnodeId = 0; -static char tsDnodeName[TSDB_NODE_NAME_LEN]; + +static SRpcIpSet tsMnodeIpSet = {0}; +static SDMMnodeInfos tsMnodeInfos = {0}; +static SDMDnodeCfg tsDnodeCfg = {0}; int32_t dnodeInitMClient() { - dnodeReadDnodeInfo(); + dnodeReadDnodeCfg(); tsRebootTime = taosGetTimestampSec(); tsDnodeTmr = taosTmrInit(100, 200, 60000, "DND-DM"); @@ -62,22 +64,22 @@ int32_t dnodeInitMClient() { return -1; } - if (!dnodeReadMnodeIpList()) { - memset(&tsMnodeIpList, 0, sizeof(SRpcIpSet)); - memset(&tsMnodeInfos, 0, sizeof(SDMNodeInfos)); - tsMnodeIpList.port = tsMnodeDnodePort; - tsMnodeIpList.numOfIps = 1; - tsMnodeIpList.ip[0] = inet_addr(tsMasterIp); + if (!dnodeReadMnodeInfos()) { + memset(&tsMnodeIpSet, 0, sizeof(SRpcIpSet)); + memset(&tsMnodeInfos, 0, sizeof(SDMMnodeInfos)); + tsMnodeIpSet.port = tsMnodeDnodePort; + tsMnodeIpSet.numOfIps = 1; + tsMnodeIpSet.ip[0] = inet_addr(tsMasterIp); if (strcmp(tsSecondIp, tsMasterIp) != 0) { - tsMnodeIpList.numOfIps = 2; - tsMnodeIpList.ip[1] = inet_addr(tsSecondIp); + tsMnodeIpSet.numOfIps = 2; + tsMnodeIpSet.ip[1] = inet_addr(tsSecondIp); } } else { - tsMnodeIpList.inUse = tsMnodeInfos.inUse; - tsMnodeIpList.numOfIps = tsMnodeInfos.nodeNum; - tsMnodeIpList.port = tsMnodeInfos.nodeInfos[0].nodePort; + tsMnodeIpSet.inUse = tsMnodeInfos.inUse; + tsMnodeIpSet.numOfIps = tsMnodeInfos.nodeNum; + tsMnodeIpSet.port = tsMnodeInfos.nodeInfos[0].nodePort; for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { - tsMnodeIpList.ip[i] = tsMnodeInfos.nodeInfos[i].nodeIp; + tsMnodeIpSet.ip[i] = tsMnodeInfos.nodeInfos[i].nodeIp; } } @@ -144,58 +146,68 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { } SDMStatusRsp *pStatusRsp = pMsg->pCont; - SDMNodeInfos *mnodes = &pStatusRsp->mnodes; - if (mnodes->nodeNum <= 0) { - dError("status msg is invalid, num of ips is %d", mnodes->nodeNum); + SDMMnodeInfos *pMnodes = &pStatusRsp->mnodes; + if (pMnodes->nodeNum <= 0) { + dError("status msg is invalid, num of ips is %d", pMnodes->nodeNum); taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); return; } - SDnodeState *pState = &pStatusRsp->dnodeState; - pState->numOfVnodes = htonl(pState->numOfVnodes); - pState->moduleStatus = htonl(pState->moduleStatus); - pState->createdTime = htonl(pState->createdTime); - pState->dnodeId = htonl(pState->dnodeId); - - dnodeProcessModuleStatus(pState->moduleStatus); - dnodeUpdateDnodeInfo(pState->dnodeId); - - SRpcIpSet mgmtIpSet = {0}; - mgmtIpSet.inUse = mnodes->inUse; - mgmtIpSet.numOfIps = mnodes->nodeNum; - mgmtIpSet.port = htons(mnodes->nodeInfos[0].nodePort); - for (int32_t i = 0; i < mnodes->nodeNum; i++) { - mgmtIpSet.ip[i] = htonl(mnodes->nodeInfos[i].nodeIp); - } - - if (memcmp(&mgmtIpSet, &tsMnodeIpList, sizeof(SRpcIpSet)) != 0 || tsMnodeInfos.nodeNum == 0) { - memcpy(&tsMnodeIpList, &mgmtIpSet, sizeof(SRpcIpSet)); - tsMnodeInfos.inUse = mnodes->inUse; - tsMnodeInfos.nodeNum = mnodes->nodeNum; - dPrint("mnode ip list is changed, numOfIps:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); - for (int32_t i = 0; i < mnodes->nodeNum; i++) { - tsMnodeInfos.nodeInfos[i].nodeId = htonl(mnodes->nodeInfos[i].nodeId); - tsMnodeInfos.nodeInfos[i].nodeIp = htonl(mnodes->nodeInfos[i].nodeIp); - tsMnodeInfos.nodeInfos[i].nodePort = htons(mnodes->nodeInfos[i].nodePort); - strcpy(tsMnodeInfos.nodeInfos[i].nodeName, mnodes->nodeInfos[i].nodeName); - dPrint("mnode:%d, ip:%s:%u name:%s", tsMnodeInfos.nodeInfos[i].nodeId, - taosIpStr(tsMnodeInfos.nodeInfos[i].nodeIp), tsMnodeInfos.nodeInfos[i].nodePort, - tsMnodeInfos.nodeInfos[i].nodeName); - } - dnodeSaveMnodeIpList(); - sdbUpdateSync(); + SDMDnodeCfg *pCfg = &pStatusRsp->dnodeCfg; + pCfg->numOfVnodes = htonl(pCfg->numOfVnodes); + pCfg->moduleStatus = htonl(pCfg->moduleStatus); + pCfg->dnodeId = htonl(pCfg->dnodeId); + + for (int32_t i = 0; i < pMnodes->nodeNum; ++i) { + SDMMnodeInfo *pMnodeInfo = &pMnodes->nodeInfos[i]; + pMnodeInfo->nodeId = htonl(pMnodeInfo->nodeId); + pMnodeInfo->nodeIp = htonl(pMnodeInfo->nodeIp); + pMnodeInfo->nodePort = htons(pMnodeInfo->nodePort); + pMnodeInfo->syncPort = htons(pMnodeInfo->syncPort); } + SDMVgroupAccess *pVgAcccess = pStatusRsp->vgAccess; + for (int32_t i = 0; i < pCfg->numOfVnodes; ++i) { + pVgAcccess[i].vgId = htonl(pVgAcccess[i].vgId); + } + + dnodeProcessModuleStatus(pCfg->moduleStatus); + dnodeUpdateDnodeCfg(pCfg); + dnodeUpdateMnodeInfos(pMnodes); taosTmrReset(dnodeSendStatusMsg, tsStatusInterval * 1000, NULL, tsDnodeTmr, &tsStatusTimer); } +static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) { + bool mnodesChanged = (memcmp(&tsMnodeInfos, pMnodes, sizeof(SDMMnodeInfos)) != 0); + bool mnodesNotInit = (tsMnodeInfos.nodeNum == 0); + if (!(mnodesChanged || mnodesNotInit)) return; + + memcpy(&tsMnodeInfos, pMnodes, sizeof(SDMMnodeInfos)); + + tsMnodeIpSet.inUse = tsMnodeInfos.inUse; + tsMnodeIpSet.numOfIps = tsMnodeInfos.nodeNum; + tsMnodeIpSet.port = tsMnodeInfos.nodeInfos[0].nodePort; + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { + tsMnodeIpSet.ip[i] = tsMnodeInfos.nodeInfos[i].nodeIp; + } + + dPrint("mnodes is changed, nodeNum:%d inUse:%d", tsMnodeInfos.nodeNum, tsMnodeInfos.inUse); + for (int32_t i = 0; i < tsMnodeInfos.nodeNum; i++) { + dPrint("mnode:%d, ip:%s:%u name:%s", tsMnodeInfos.nodeInfos[i].nodeId, taosIpStr(tsMnodeInfos.nodeInfos[i].nodeIp), + tsMnodeInfos.nodeInfos[i].nodePort, tsMnodeInfos.nodeInfos[i].nodeName); + } + + dnodeSaveMnodeInfos(); + sdbUpdateSync(); +} + void dnodeSendMsgToMnode(SRpcMsg *rpcMsg) { if (tsDnodeMClientRpc) { - rpcSendRequest(tsDnodeMClientRpc, &tsMnodeIpList, rpcMsg); + rpcSendRequest(tsDnodeMClientRpc, &tsMnodeIpSet, rpcMsg); } } -static bool dnodeReadMnodeIpList() { +static bool dnodeReadMnodeInfos() { char ipFile[TSDB_FILENAME_LEN] = {0}; sprintf(ipFile, "%s/mgmtIpList.json", tsDnodeDir); FILE *fp = fopen(ipFile, "r"); @@ -272,6 +284,13 @@ static bool dnodeReadMnodeIpList() { } tsMnodeInfos.nodeInfos[i].nodePort = (uint16_t)nodePort->valueint; + cJSON *syncPort = cJSON_GetObjectItem(nodeInfo, "syncPort"); + if (!syncPort || syncPort->type != cJSON_Number) { + dError("failed to read mnode mgmtIpList.json, syncPort not found"); + goto PARSE_OVER; + } + tsMnodeInfos.nodeInfos[i].syncPort = (uint16_t)syncPort->valueint; + cJSON *nodeName = cJSON_GetObjectItem(nodeInfo, "nodeName"); if (!nodeIp || nodeName->type != cJSON_String || nodeName->valuestring == NULL) { dError("failed to read mnode mgmtIpList.json, nodeName not found"); @@ -296,7 +315,7 @@ PARSE_OVER: return ret; } -static void dnodeSaveMnodeIpList() { +static void dnodeSaveMnodeInfos() { char ipFile[TSDB_FILENAME_LEN] = {0}; sprintf(ipFile, "%s/mgmtIpList.json", tsDnodeDir); FILE *fp = fopen(ipFile, "w"); @@ -314,6 +333,7 @@ static void dnodeSaveMnodeIpList() { len += snprintf(content + len, maxLen - len, " \"nodeId\": %d,\n", tsMnodeInfos.nodeInfos[i].nodeId); len += snprintf(content + len, maxLen - len, " \"nodeIp\": \"%s\",\n", taosIpStr(tsMnodeInfos.nodeInfos[i].nodeIp)); len += snprintf(content + len, maxLen - len, " \"nodePort\": %u,\n", tsMnodeInfos.nodeInfos[i].nodePort); + len += snprintf(content + len, maxLen - len, " \"syncPort\": %u,\n", tsMnodeInfos.nodeInfos[i].syncPort); len += snprintf(content + len, maxLen - len, " \"nodeName\": \"%s\"\n", tsMnodeInfos.nodeInfos[i].nodeName); if (i < tsMnodeInfos.nodeNum -1) { len += snprintf(content + len, maxLen - len, " },{\n"); @@ -331,10 +351,10 @@ static void dnodeSaveMnodeIpList() { } uint32_t dnodeGetMnodeMasteIp() { - return tsMnodeIpList.ip[tsMnodeIpList.inUse]; + return tsMnodeIpSet.ip[tsMnodeIpSet.inUse]; } -void* dnodeGetMnodeList() { +void* dnodeGetMnodeInfos() { return &tsMnodeInfos; } @@ -358,9 +378,9 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { return; } - strcpy(pStatus->dnodeName, tsDnodeName); + //strcpy(pStatus->dnodeName, tsDnodeName); pStatus->version = htonl(tsVersion); - pStatus->dnodeId = htonl(tsDnodeId); + pStatus->dnodeId = htonl(tsDnodeCfg.dnodeId); pStatus->privateIp = htonl(inet_addr(tsPrivateIp)); pStatus->publicIp = htonl(inet_addr(tsPublicIp)); pStatus->lastReboot = htonl(tsRebootTime); @@ -368,7 +388,7 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { pStatus->numOfCores = htons((uint16_t) tsNumOfCores); pStatus->diskAvailable = tsAvailDataDirGB; pStatus->alternativeRole = (uint8_t) tsAlternativeRole; - + vnodeBuildStatusMsg(pStatus); contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad); pStatus->openVnodes = htons(pStatus->openVnodes); @@ -382,47 +402,81 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { dnodeSendMsgToMnode(&rpcMsg); } -static void dnodeReadDnodeInfo() { - char dnodeIdFile[TSDB_FILENAME_LEN] = {0}; - sprintf(dnodeIdFile, "%s/dnodeId", tsDnodeDir); +static bool dnodeReadDnodeCfg() { + char dnodeCfgFile[TSDB_FILENAME_LEN] = {0}; + sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir); - FILE *fp = fopen(dnodeIdFile, "r"); - if (!fp) return; - - char option[32] = {0}; - int32_t value = 0; - int32_t num = 0; - - num = fscanf(fp, "%s %d", option, &value); - if (num != 2) return; - if (strcmp(option, "dnodeId") != 0) return; - tsDnodeId = value;; + FILE *fp = fopen(dnodeCfgFile, "r"); + if (!fp) { + dTrace("failed to read dnodeCfg.json, file not exist"); + return false; + } + bool ret = false; + int maxLen = 100; + char *content = calloc(1, maxLen + 1); + int len = fread(content, 1, maxLen, fp); + if (len <= 0) { + free(content); + fclose(fp); + dError("failed to read dnodeCfg.json, content is null"); + return false; + } + + cJSON* root = cJSON_Parse(content); + if (root == NULL) { + dError("failed to read dnodeCfg.json, invalid json format"); + goto PARSE_CFG_OVER; + } + + cJSON* dnodeId = cJSON_GetObjectItem(root, "dnodeId"); + if (!dnodeId || dnodeId->type != cJSON_Number) { + dError("failed to read dnodeCfg.json, dnodeId not found"); + goto PARSE_CFG_OVER; + } + tsDnodeCfg.dnodeId = dnodeId->valueint; + + ret = true; + + dPrint("read numOfVnodes successed, dnodeId:%d", tsDnodeCfg.dnodeId); + +PARSE_CFG_OVER: + free(content); + cJSON_Delete(root); fclose(fp); - dPrint("read dnodeId:%d successed", tsDnodeId); + return ret; } -static void dnodeSaveDnodeInfo() { - char dnodeIdFile[TSDB_FILENAME_LEN] = {0}; - sprintf(dnodeIdFile, "%s/dnodeId", tsDnodeDir); +static void dnodeSaveDnodeCfg() { + char dnodeCfgFile[TSDB_FILENAME_LEN] = {0}; + sprintf(dnodeCfgFile, "%s/dnodeCfg.json", tsDnodeDir); - FILE *fp = fopen(dnodeIdFile, "w"); + FILE *fp = fopen(dnodeCfgFile, "w"); if (!fp) return; - fprintf(fp, "dnodeId %d\n", tsDnodeId); + int32_t len = 0; + int32_t maxLen = 100; + 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, "}\n"); + + fwrite(content, 1, len, fp); fclose(fp); + free(content); + dPrint("save dnodeId successed"); } -void dnodeUpdateDnodeInfo(int32_t dnodeId) { - if (tsDnodeId == 0) { - dPrint("dnodeId is set to %d", dnodeId); - tsDnodeId = dnodeId; - dnodeSaveDnodeInfo(); +void dnodeUpdateDnodeCfg(SDMDnodeCfg *pCfg) { + if (tsDnodeCfg.dnodeId == 0) { + dPrint("dnodeId is set to %d", pCfg->dnodeId); + tsDnodeCfg.dnodeId = pCfg->dnodeId; + dnodeSaveDnodeCfg(); } } int32_t dnodeGetDnodeId() { - return tsDnodeId; + return tsDnodeCfg.dnodeId; } \ No newline at end of file diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 0be18a007e831614d0e5362bccf32a7b529abc8b..618cf79b1496f5be3001304ae4cc2f9fdc49169e 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -43,7 +43,7 @@ void dnodeSendRpcWriteRsp(void *pVnode, void *param, int32_t code); bool dnodeIsFirstDeploy(); uint32_t dnodeGetMnodeMasteIp(); -void * dnodeGetMnodeList(); +void * dnodeGetMnodeInfos(); int32_t dnodeGetDnodeId(); #ifdef __cplusplus diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index f292345e68636f1480c4c7c738965787362dbbe4..ef7cbc8eabe09616c650cd0ce6ae84288dc0202b 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -521,12 +521,6 @@ typedef struct { uint8_t reserved[5]; } SVnodeLoad; -typedef struct { - uint32_t vnode; - uint8_t accessState; - uint8_t reserved[3]; -} SVnodeAccess; - /* * NOTE: sizeof(SVnodeCfg) < TSDB_FILE_HEADER_LEN / 4 */ @@ -571,12 +565,30 @@ typedef struct { char reserved[64]; } SVnodeStatisticInfo; +typedef struct { + int32_t vgId; + int8_t accessState; +} SDMVgroupAccess; + typedef struct { int32_t dnodeId; uint32_t moduleStatus; - uint32_t createdTime; uint32_t numOfVnodes; -} SDnodeState; +} SDMDnodeCfg; + +typedef struct { + int32_t nodeId; + uint32_t nodeIp; + uint16_t nodePort; + uint16_t syncPort; + char nodeName[TSDB_NODE_NAME_LEN + 1]; +} SDMMnodeInfo; + +typedef struct { + int8_t inUse; + int8_t nodeNum; + SDMMnodeInfo nodeInfos[TSDB_MAX_MPEERS]; +} SDMMnodeInfos; typedef struct { uint32_t version; @@ -596,22 +608,9 @@ typedef struct { } SDMStatusMsg; typedef struct { - int32_t nodeId; - uint32_t nodeIp; - uint16_t nodePort; - char nodeName[TSDB_NODE_NAME_LEN + 1]; -} SDMNodeInfo; - -typedef struct { - int8_t inUse; - int8_t nodeNum; - SDMNodeInfo nodeInfos[TSDB_MAX_MPEERS]; -} SDMNodeInfos; - -typedef struct { - SDMNodeInfos mnodes; - SDnodeState dnodeState; - SVnodeAccess vnodeAccess[]; + SDMMnodeInfos mnodes; + SDMDnodeCfg dnodeCfg; + SDMVgroupAccess vgAccess[]; } SDMStatusRsp; typedef struct { diff --git a/src/inc/tsync.h b/src/inc/tsync.h index bc28831ecca4ef14906106f74dc251c055164a33..c7a05c0a2dca4b2989a1e98839eee135f15b04ff 100644 --- a/src/inc/tsync.h +++ b/src/inc/tsync.h @@ -104,10 +104,10 @@ extern char *syncRole[]; extern int tsMaxSyncNum; extern int tsSyncTcpThreads; extern int tsMaxWatchFiles; -extern short tsSyncPort; extern int tsSyncTimer; extern int tsMaxFwdInfo; extern int sDebugFlag; +extern uint16_t tsSyncPort; #ifdef __cplusplus } diff --git a/src/mnode/inc/mgmtMnode.h b/src/mnode/inc/mgmtMnode.h index 34b5d19cf21108aa7f9808bed4329fed02ebb9b5..f9f2909d9551c96460d3bf81aacda9be2fb4c81d 100644 --- a/src/mnode/inc/mgmtMnode.h +++ b/src/mnode/inc/mgmtMnode.h @@ -41,7 +41,7 @@ void mgmtReleaseMnode(struct SMnodeObj *pMnode); char * mgmtGetMnodeRoleStr(); void mgmtGetMnodeIpList(SRpcIpSet *ipSet, bool usePublicIp); -void mgmtGetMnodeList(void *mnodes); +void mgmtGetMnodeInfos(void *mnodes); #ifdef __cplusplus } diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index d8164e48da5a4d158317be961163338dc6123cbb..ddedbf7c046f7a9656451dc245f2a04048efc830 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -68,7 +68,7 @@ static int32_t mgmtDnodeActionInsert(SSdbOper *pOper) { pDnode->mnodeDnodePort = tsMnodeDnodePort; pDnode->dnodeShellPort = tsDnodeShellPort; pDnode->dnodeMnodePort = tsDnodeMnodePort; - pDnode->syncPort = 0; + pDnode->syncPort = tsSyncPort; return TSDB_CODE_SUCCESS; } @@ -274,12 +274,12 @@ static void mgmtProcessCfgDnodeMsgRsp(SRpcMsg *rpcMsg) { void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { SDMStatusMsg *pStatus = rpcMsg->pCont; - pStatus->dnodeId = htonl(pStatus->dnodeId); - pStatus->privateIp = htonl(pStatus->privateIp); - pStatus->publicIp = htonl(pStatus->publicIp); + pStatus->dnodeId = htonl(pStatus->dnodeId); + pStatus->privateIp = htonl(pStatus->privateIp); + pStatus->publicIp = htonl(pStatus->publicIp); pStatus->moduleStatus = htonl(pStatus->moduleStatus); - pStatus->lastReboot = htonl(pStatus->lastReboot); - pStatus->numOfCores = htons(pStatus->numOfCores); + pStatus->lastReboot = htonl(pStatus->lastReboot); + pStatus->numOfCores = htons(pStatus->numOfCores); pStatus->numOfTotalVnodes = htons(pStatus->numOfTotalVnodes); uint32_t version = htonl(pStatus->version); @@ -346,19 +346,18 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) { mgmtReleaseDnode(pDnode); - int32_t contLen = sizeof(SDMStatusRsp) + TSDB_MAX_VNODES * sizeof(SVnodeAccess); + int32_t contLen = sizeof(SDMStatusRsp) + TSDB_MAX_VNODES * sizeof(SDMVgroupAccess); SDMStatusRsp *pRsp = rpcMallocCont(contLen); if (pRsp == NULL) { mgmtSendSimpleResp(rpcMsg->handle, TSDB_CODE_SERV_OUT_OF_MEMORY); return; } - mgmtGetMnodeList(&pRsp->mnodes); + mgmtGetMnodeInfos(&pRsp->mnodes); - pRsp->dnodeState.dnodeId = htonl(pDnode->dnodeId); - pRsp->dnodeState.moduleStatus = htonl((int32_t)pDnode->isMgmt); - pRsp->dnodeState.createdTime = htonl(pDnode->createdTime / 1000); - pRsp->dnodeState.numOfVnodes = 0; + pRsp->dnodeCfg.dnodeId = htonl(pDnode->dnodeId); + pRsp->dnodeCfg.moduleStatus = htonl((int32_t)pDnode->isMgmt); + pRsp->dnodeCfg.numOfVnodes = 0; contLen = sizeof(SDMStatusRsp); diff --git a/src/mnode/src/mgmtMnode.c b/src/mnode/src/mgmtMnode.c index bfb6480aec3eb8898b6bfd7b68255985999007b8..6546b8ea3783a3a2fe059de1166c0d78b7b7d7dc 100644 --- a/src/mnode/src/mgmtMnode.c +++ b/src/mnode/src/mgmtMnode.c @@ -195,8 +195,8 @@ void mgmtGetMnodeIpList(SRpcIpSet *ipSet, bool usePublicIp) { } } -void mgmtGetMnodeList(void *param) { - SDMNodeInfos *mnodes = param; +void mgmtGetMnodeInfos(void *param) { + SDMMnodeInfos *mnodes = param; mnodes->inUse = 0; int32_t index = 0; @@ -209,6 +209,7 @@ void mgmtGetMnodeList(void *param) { mnodes->nodeInfos[index].nodeId = htonl(pMnode->mnodeId); mnodes->nodeInfos[index].nodeIp = htonl(pMnode->pDnode->privateIp); mnodes->nodeInfos[index].nodePort = htons(pMnode->pDnode->mnodeDnodePort); + mnodes->nodeInfos[index].syncPort = htons(pMnode->pDnode->syncPort); strcpy(mnodes->nodeInfos[index].nodeName, pMnode->pDnode->dnodeName); if (pMnode->role == TAOS_SYNC_ROLE_MASTER) { mnodes->inUse = index; @@ -290,17 +291,17 @@ static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; - pShow->bytes[cols] = 8; - pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP; - strcpy(pSchema[cols].name, "create time"); - pSchema[cols].bytes = htons(pShow->bytes[cols]); - cols++; - pShow->bytes[cols] = 10; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema[cols].name, "role"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; + + pShow->bytes[cols] = 8; + pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP; + strcpy(pSchema[cols].name, "create time"); + pSchema[cols].bytes = htons(pShow->bytes[cols]); + cols++; pMeta->numOfColumns = htons(cols); pShow->numOfColumns = cols; @@ -346,13 +347,13 @@ static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, voi cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int64_t *)pWrite = pMnode->createdTime; + strcpy(pWrite, mgmtGetMnodeRoleStr(pMnode->role)); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - strcpy(pWrite, mgmtGetMnodeRoleStr(pMnode->role)); + *(int64_t *)pWrite = pMnode->createdTime; cols++; - + numOfRows++; mgmtReleaseMnode(pMnode); diff --git a/src/mnode/src/mgmtSdb.c b/src/mnode/src/mgmtSdb.c index c58dd4c9230af2f702da88cb5a7afe64133df1b7..5ed0c460311fd44b7a49ba79d5c041bd142cefac 100644 --- a/src/mnode/src/mgmtSdb.c +++ b/src/mnode/src/mgmtSdb.c @@ -146,7 +146,7 @@ static int32_t sdbInitWal() { } sdbTrace("open sdb wal for restore"); - walRestore(tsSdbObj.wal, &tsSdbObj, sdbWrite); + walRestore(tsSdbObj.wal, NULL, sdbWrite); return 0; } @@ -174,12 +174,12 @@ void sdbUpdateMnodeRoles() { SNodesRole roles = {0}; syncGetNodesRole(tsSdbObj.sync, &roles); - mPrint("update mnodes:%d sync roles", tsSdbObj.cfg.replica); + sdbPrint("update mnodes:%d sync roles", tsSdbObj.cfg.replica); for (int32_t i = 0; i < tsSdbObj.cfg.replica; ++i) { SMnodeObj *pMnode = mgmtGetMnode(roles.nodeId[i]); if (pMnode != NULL) { pMnode->role = roles.role[i]; - mPrint("mnode:%d, role:%s", pMnode->mnodeId, mgmtGetMnodeRoleStr(pMnode->role)); + sdbPrint("mnode:%d, role:%s", pMnode->mnodeId, mgmtGetMnodeRoleStr(pMnode->role)); mgmtReleaseMnode(pMnode); } } @@ -196,7 +196,7 @@ static int sdbGetWalInfo(void *ahandle, char *name, uint32_t *index) { } static void sdbNotifyRole(void *ahandle, int8_t role) { - mPrint("mnode role changed from %s to %s", mgmtGetMnodeRoleStr(tsSdbObj.role), mgmtGetMnodeRoleStr(role)); + sdbPrint("mnode role changed from %s to %s", mgmtGetMnodeRoleStr(tsSdbObj.role), mgmtGetMnodeRoleStr(role)); if (role == TAOS_SYNC_ROLE_MASTER && tsSdbObj.role != TAOS_SYNC_ROLE_MASTER) { balanceReset(); @@ -208,8 +208,8 @@ static void sdbNotifyRole(void *ahandle, int8_t role) { static void sdbConfirmForward(void *ahandle, void *param, int32_t code) { tsSdbObj.code = code; + sdbTrace("sdb forward request confirmed, result:%s", tstrerror(code)); sem_post(&tsSdbObj.sem); - mPrint("sdb forward request confirmed, result:%s", tstrerror(code)); } static int32_t sdbForwardToPeer(void *pHead) { @@ -227,9 +227,9 @@ void sdbUpdateSync() { SSyncCfg syncCfg = {0}; int32_t index = 0; - SDMNodeInfos *mnodes = dnodeGetMnodeList(); + SDMMnodeInfos *mnodes = dnodeGetMnodeInfos(); for (int32_t i = 0; i < mnodes->nodeNum; ++i) { - SDMNodeInfo *node = &mnodes->nodeInfos[i]; + SDMMnodeInfo *node = &mnodes->nodeInfos[i]; syncCfg.nodeInfo[i].nodeId = node->nodeId; syncCfg.nodeInfo[i].nodeIp = node->nodeIp; strcpy(syncCfg.nodeInfo[i].name, node->nodeName); @@ -271,9 +271,9 @@ void sdbUpdateSync() { if (!hasThisDnode) return; if (memcmp(&syncCfg, &tsSdbObj.cfg, sizeof(SSyncCfg)) == 0) return; - mPrint("work as mnode, replica:%d arbitratorIp:%s", syncCfg.replica, taosIpStr(syncCfg.arbitratorIp)); + sdbPrint("work as mnode, replica:%d arbitratorIp:%s", syncCfg.replica, taosIpStr(syncCfg.arbitratorIp)); for (int32_t i = 0; i < syncCfg.replica; ++i) { - mPrint("mnode:%d, ip:%s name:%s", syncCfg.nodeInfo[i].nodeId, taosIpStr(syncCfg.nodeInfo[i].nodeIp), + sdbPrint("mnode:%d, ip:%s name:%s", syncCfg.nodeInfo[i].nodeId, taosIpStr(syncCfg.nodeInfo[i].nodeIp), syncCfg.nodeInfo[i].name); } @@ -476,9 +476,13 @@ static int sdbWrite(void *param, void *data, int type) { pthread_mutex_unlock(&tsSdbObj.mutex); // from app, oper is created - if (param == NULL) return code; + if (param != NULL) return code; + + // from wal or forward msg, should create oper + if (tsSdbObj.sync != NULL) { + syncConfirmForward(tsSdbObj.sync, pHead->version, code); + } - // from wal, should create oper if (action == SDB_ACTION_INSERT) { SSdbOper oper = {.rowSize = pHead->len, .rowData = pHead->cont, .table = pTable}; code = (*pTable->decodeFp)(&oper); @@ -529,7 +533,7 @@ int32_t sdbInsertRow(SSdbOper *pOper) { (*pTable->encodeFp)(pOper); pHead->len = pOper->rowSize; - int32_t code = sdbWrite(NULL, pHead, pHead->msgType); + int32_t code = sdbWrite(pOper, pHead, pHead->msgType); taosFreeQitem(pHead); if (code < 0) return code; } @@ -571,7 +575,7 @@ int32_t sdbDeleteRow(SSdbOper *pOper) { pHead->msgType = pTable->tableId * 10 + SDB_ACTION_DELETE; memcpy(pHead->cont, pOper->pObj, rowSize); - int32_t code = sdbWrite(NULL, pHead, pHead->msgType); + int32_t code = sdbWrite(pOper, pHead, pHead->msgType); taosFreeQitem(pHead); if (code < 0) return code; } @@ -602,7 +606,7 @@ int32_t sdbUpdateRow(SSdbOper *pOper) { (*pTable->encodeFp)(pOper); pHead->len = pOper->rowSize; - int32_t code = sdbWrite(NULL, pHead, pHead->msgType); + int32_t code = sdbWrite(pOper, pHead, pHead->msgType); taosFreeQitem(pHead); if (code < 0) return code; } diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index e007953a362baef1829653b8c18ec72a81ff51ec..9370e93683975e5d6636978198889aeface83a8c 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -49,6 +49,7 @@ int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle) { return void syncStop(tsync_h shandle) {} int syncReconfig(tsync_h shandle, const SSyncCfg * cfg) { return 0; } int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; } +void syncConfirmForward(tsync_h shandle, uint64_t version, int32_t code) {} #endif static void vnodeInit() { diff --git a/tests/script/general/account/testSuite.sim b/tests/script/general/account/testSuite.sim index a66b4ac500893e6d9cc9fd603f888220e548db9d..08fd03665fdc6e8dab88744d476b270070a738c9 100644 --- a/tests/script/general/account/testSuite.sim +++ b/tests/script/general/account/testSuite.sim @@ -1,5 +1,5 @@ -run lite/account/pass_alter.sim -run lite/account/pass_len.sim -run lite/account/user_create.sim -run lite/account/user_len.sim -run lite/account/monitor.sim \ No newline at end of file +run general/account/pass_alter.sim +run general/account/pass_len.sim +run general/account/user_create.sim +run general/account/user_len.sim +run general/account/monitor.sim \ No newline at end of file diff --git a/tests/script/general/agg/testSuite.sim b/tests/script/general/agg/testSuite.sim index 66d6dde565fcf9ad9dc04606fdf557809af13a61..9aac0d70264194392600d552517460449975a3fb 100644 --- a/tests/script/general/agg/testSuite.sim +++ b/tests/script/general/agg/testSuite.sim @@ -1,2 +1,2 @@ -run lite/agg/fill.sim -run lite/agg/stream.sim \ No newline at end of file +run general/agg/fill.sim +run general/agg/stream.sim \ No newline at end of file diff --git a/tests/script/general/alter/testSuite.sim b/tests/script/general/alter/testSuite.sim index f27c871a4d5ada42b56c2dc472faf92e543253b3..33a926f7b2475b07d175f320a21e63267998948a 100644 --- a/tests/script/general/alter/testSuite.sim +++ b/tests/script/general/alter/testSuite.sim @@ -1,7 +1,7 @@ -run lite/alter/count.sim -run lite/alter/cached_schema_after_alter.sim -run lite/alter/import.sim -run lite/alter/insert1.sim -run lite/alter/insert2.sim -run lite/alter/metrics.sim -run lite/alter/table.sim \ No newline at end of file +run general/alter/count.sim +run general/alter/cached_schema_after_alter.sim +run general/alter/import.sim +run general/alter/insert1.sim +run general/alter/insert2.sim +run general/alter/metrics.sim +run general/alter/table.sim \ No newline at end of file diff --git a/tests/script/general/cache/testSuite.sim b/tests/script/general/cache/testSuite.sim index c04b0b41f1ec8ba344c5d6c6497cd288803490a1..1265a1060eca95b0b0c517886a2b76e5ab2dfae2 100644 --- a/tests/script/general/cache/testSuite.sim +++ b/tests/script/general/cache/testSuite.sim @@ -1,5 +1,5 @@ -run lite/cache/restart_table.sim -run lite/cache/restart_metrics.sim -run lite/cache/restart_stream.sim -run lite/cache/new_metrics.sim -run lite/cache/new_stream.sim +run general/cache/restart_table.sim +run general/cache/restart_metrics.sim +run general/cache/restart_stream.sim +run general/cache/new_metrics.sim +run general/cache/new_stream.sim diff --git a/tests/script/general/compress/testSuite.sim b/tests/script/general/compress/testSuite.sim index d0025636eb1fbbd1f6296467659f487ed2c2cc89..97c76aec155b225eeac04a3a5d0355cf7ed9de74 100644 --- a/tests/script/general/compress/testSuite.sim +++ b/tests/script/general/compress/testSuite.sim @@ -1,4 +1,4 @@ -run lite/compress/compress.sim -run lite/compress/uncompress.sim -run lite/compress/commitlog.sim -run lite/compress/compress2.sim +run general/compress/compress.sim +run general/compress/uncompress.sim +run general/compress/commitlog.sim +run general/compress/compress2.sim diff --git a/tests/script/general/compute/testSuite.sim b/tests/script/general/compute/testSuite.sim index ad3afccdc6f204ca076680c3dad1a96d5fe41e8d..5539e08a9dd4980fa189d9eb6e9e3df2e828386a 100644 --- a/tests/script/general/compute/testSuite.sim +++ b/tests/script/general/compute/testSuite.sim @@ -1,16 +1,16 @@ -run lite/compute/count.sim -run lite/compute/avg.sim -run lite/compute/sum.sim -run lite/compute/min.sim -run lite/compute/max.sim -run lite/compute/first.sim -run lite/compute/last.sim -run lite/compute/stddev.sim -run lite/compute/leastsquare.sim -run lite/compute/top.sim -run lite/compute/bottom.sim -run lite/compute/percentile.sim -run lite/compute/diff.sim -run lite/compute/interval.sim -run lite/compute/null.sim -run lite/compute/diff2.sim +run general/compute/count.sim +run general/compute/avg.sim +run general/compute/sum.sim +run general/compute/min.sim +run general/compute/max.sim +run general/compute/first.sim +run general/compute/last.sim +run general/compute/stddev.sim +run general/compute/leastsquare.sim +run general/compute/top.sim +run general/compute/bottom.sim +run general/compute/percentile.sim +run general/compute/diff.sim +run general/compute/interval.sim +run general/compute/null.sim +run general/compute/diff2.sim diff --git a/tests/script/general/field/testSuite.sim b/tests/script/general/field/testSuite.sim index 5b086df88374cfd9151c861cf9fd8a68de31737c..9b58c77e929fedcceb0364d06602e15af641102e 100644 --- a/tests/script/general/field/testSuite.sim +++ b/tests/script/general/field/testSuite.sim @@ -1,14 +1,14 @@ -run lite/field/single.sim -run lite/field/bool.sim -run lite/field/smallint.sim -run lite/field/tinyint.sim -run lite/field/int.sim -run lite/field/bigint.sim -run lite/field/float.sim -run lite/field/double.sim -run lite/field/binary.sim -run lite/field/2.sim -run lite/field/3.sim -run lite/field/4.sim -run lite/field/5.sim -run lite/field/6.sim \ No newline at end of file +run general/field/single.sim +run general/field/bool.sim +run general/field/smallint.sim +run general/field/tinyint.sim +run general/field/int.sim +run general/field/bigint.sim +run general/field/float.sim +run general/field/double.sim +run general/field/binary.sim +run general/field/2.sim +run general/field/3.sim +run general/field/4.sim +run general/field/5.sim +run general/field/6.sim \ No newline at end of file diff --git a/tests/script/general/http/testSuite.sim b/tests/script/general/http/testSuite.sim index 9c50a60f78462436bf470975e0033769699a1f7c..ca93dedd3b4c4fee52f1018a756ed8beecb62a46 100644 --- a/tests/script/general/http/testSuite.sim +++ b/tests/script/general/http/testSuite.sim @@ -1,7 +1,7 @@ -run lite/http/grafana.sim -run lite/http/restful.sim -run lite/http/restful_full.sim -run lite/http/telegraf.sim -run lite/http/prepare.sim -run lite/http/grafana_bug.sim -#run lite/http/opentsdb.sim +run general/http/grafana.sim +run general/http/restful.sim +run general/http/restful_full.sim +run general/http/telegraf.sim +run general/http/prepare.sim +run general/http/grafana_bug.sim +#run general/http/opentsdb.sim diff --git a/tests/script/general/import/testSuite.sim b/tests/script/general/import/testSuite.sim index 51b652f9c1cdee169c8466d580c459012100e9db..d340d90d6645a462be6511532fa9f08c8c629dbb 100644 --- a/tests/script/general/import/testSuite.sim +++ b/tests/script/general/import/testSuite.sim @@ -1,4 +1,4 @@ -run lite/import/basic.sim -#run lite/import/commit.sim -run lite/import/large.sim -run lite/import/replica1.sim +run general/import/basic.sim +#run general/import/commit.sim +run general/import/large.sim +run general/import/replica1.sim diff --git a/tests/script/general/metrics/testSuite.sim b/tests/script/general/metrics/testSuite.sim index 7f23e30823475263a7d7a28077c91ba657325e04..55300034b65f2d7c94cd1b76d384b9d8db0a263c 100644 --- a/tests/script/general/metrics/testSuite.sim +++ b/tests/script/general/metrics/testSuite.sim @@ -1,4 +1,4 @@ -run lite/metrics/disk.sim -run lite/metrics/metrics.sim -run lite/metrics/values.sim -run lite/metrics/vnode3.sim +run general/metrics/disk.sim +run general/metrics/metrics.sim +run general/metrics/values.sim +run general/metrics/vnode3.sim diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim index 12b1631821615178e300d33ac06e29bc6a750b14..402ed19918fbd3087a297d708312b653b387a4b9 100644 --- a/tests/script/general/parser/testSuite.sim +++ b/tests/script/general/parser/testSuite.sim @@ -1,92 +1,92 @@ -run lite/parser/alter.sim +run general/parser/alter.sim sleep 2000 -run lite/parser/alter1.sim +run general/parser/alter1.sim sleep 2000 -run lite/parser/alter_stable.sim +run general/parser/alter_stable.sim sleep 2000 -run lite/parser/auto_create_tb.sim +run general/parser/auto_create_tb.sim sleep 2000 -run lite/parser/auto_create_tb_drop_tb.sim +run general/parser/auto_create_tb_drop_tb.sim sleep 2000 -run lite/parser/col_arithmetic_operation.sim +run general/parser/col_arithmetic_operation.sim sleep 2000 -run lite/parser/columnValue.sim +run general/parser/columnValue.sim sleep 2000 -run lite/parser/commit.sim -run lite/parser/create_db.sim +run general/parser/commit.sim +run general/parser/create_db.sim sleep 2000 -run lite/parser/create_mt.sim +run general/parser/create_mt.sim sleep 2000 -run lite/parser/create_tb.sim +run general/parser/create_tb.sim sleep 2000 -run lite/parser/dbtbnameValidate.sim +run general/parser/dbtbnameValidate.sim sleep 2000 -run lite/parser/fill.sim +run general/parser/fill.sim sleep 2000 -run lite/parser/fill_stb.sim +run general/parser/fill_stb.sim sleep 2000 -run lite/parser/first_last.sim +run general/parser/first_last.sim sleep 2000 -run lite/parser/import_commit1.sim +run general/parser/import_commit1.sim sleep 2000 -run lite/parser/import_commit2.sim +run general/parser/import_commit2.sim sleep 2000 -run lite/parser/import_commit3.sim +run general/parser/import_commit3.sim sleep 2000 -run lite/parser/import_file.sim +run general/parser/import_file.sim sleep 2000 -run lite/parser/insert_tb.sim +run general/parser/insert_tb.sim sleep 2000 -run lite/parser/tags_dynamically_specifiy.sim +run general/parser/tags_dynamically_specifiy.sim sleep 2000 -run lite/parser/interp.sim -run lite/parser/lastrow.sim +run general/parser/interp.sim +run general/parser/lastrow.sim sleep 2000 -run lite/parser/limit.sim +run general/parser/limit.sim sleep 2000 -run lite/parser/limit1.sim +run general/parser/limit1.sim sleep 2000 -run lite/parser/limit1_tblocks100.sim +run general/parser/limit1_tblocks100.sim sleep 2000 -run lite/parser/limit2.sim +run general/parser/limit2.sim sleep 2000 -run lite/parser/mixed_blocks.sim +run general/parser/mixed_blocks.sim sleep 2000 -run lite/parser/nchar.sim +run general/parser/nchar.sim sleep 2000 -run lite/parser/null_char.sim +run general/parser/null_char.sim sleep 2000 -run lite/parser/selectResNum.sim +run general/parser/selectResNum.sim sleep 2000 -run lite/parser/select_across_vnodes.sim +run general/parser/select_across_vnodes.sim sleep 2000 -run lite/parser/select_from_cache_disk.sim +run general/parser/select_from_cache_disk.sim sleep 2000 -run lite/parser/set_tag_vals.sim +run general/parser/set_tag_vals.sim sleep 2000 -run lite/parser/single_row_in_tb.sim +run general/parser/single_row_in_tb.sim sleep 2000 -run lite/parser/slimit.sim +run general/parser/slimit.sim sleep 2000 -run lite/parser/slimit1.sim +run general/parser/slimit1.sim sleep 2000 -run lite/parser/slimit_alter_tags.sim +run general/parser/slimit_alter_tags.sim sleep 2000 -run lite/parser/stream_on_sys.sim +run general/parser/stream_on_sys.sim sleep 2000 -run lite/parser/stream.sim +run general/parser/stream.sim sleep 2000 -run lite/parser/tbnameIn.sim +run general/parser/tbnameIn.sim sleep 2000 -run lite/parser/where.sim +run general/parser/where.sim sleep 2000 -#run lite/parser/repeatAlter.sim +#run general/parser/repeatAlter.sim sleep 2000 -#run lite/parser/repeatStream.sim +#run general/parser/repeatStream.sim sleep 2000 -run lite/parser/join.sim -run lite/parser/join_multivnode.sim -run lite/parser/projection_limit_offset.sim +run general/parser/join.sim +run general/parser/join_multivnode.sim +run general/parser/projection_limit_offset.sim sleep 2000 -run lite/parser/select_with_tags.sim -run lite/parser/groupby.sim +run general/parser/select_with_tags.sim +run general/parser/groupby.sim diff --git a/tests/script/general/stream/testSuite.sim b/tests/script/general/stream/testSuite.sim index cda88dc8269c53a334317df7c16749077b5d6038..046348b1238dbf9e7f779eee3a243136f78edc7e 100644 --- a/tests/script/general/stream/testSuite.sim +++ b/tests/script/general/stream/testSuite.sim @@ -1,12 +1,12 @@ -run lite/stream/stream_1.sim -run lite/stream/stream_2.sim -run lite/stream/stream_3.sim -run lite/stream/stream_restart.sim -run lite/stream/table_1.sim -run lite/stream/metrics_1.sim -run lite/stream/table_n.sim -run lite/stream/metrics_n.sim -run lite/stream/table_del.sim -run lite/stream/metrics_del.sim -run lite/stream/table_replica1_vnoden.sim -run lite/stream/metrics_replica1_vnoden.sim \ No newline at end of file +run general/stream/stream_1.sim +run general/stream/stream_2.sim +run general/stream/stream_3.sim +run general/stream/stream_restart.sim +run general/stream/table_1.sim +run general/stream/metrics_1.sim +run general/stream/table_n.sim +run general/stream/metrics_n.sim +run general/stream/table_del.sim +run general/stream/metrics_del.sim +run general/stream/table_replica1_vnoden.sim +run general/stream/metrics_replica1_vnoden.sim \ No newline at end of file diff --git a/tests/script/general/tag/testSuite.sim b/tests/script/general/tag/testSuite.sim index ffe61c54fdfa5fb9ac254bb43cd64167340a58d3..10874262d64b56112e6d3c4436f97f1c43ac437d 100644 --- a/tests/script/general/tag/testSuite.sim +++ b/tests/script/general/tag/testSuite.sim @@ -1,25 +1,25 @@ -run lite/tag/filter.sim -run lite/tag/column.sim -run lite/tag/bool.sim -run lite/tag/smallint.sim -run lite/tag/tinyint.sim -run lite/tag/int.sim -run lite/tag/bigint.sim -run lite/tag/float.sim -run lite/tag/double.sim -run lite/tag/binary.sim -run lite/tag/bool_int.sim -run lite/tag/bool_binary.sim -run lite/tag/int_float.sim -run lite/tag/int_binary.sim -run lite/tag/binary_binary.sim -run lite/tag/3.sim -run lite/tag/4.sim -run lite/tag/5.sim -run lite/tag/6.sim -run lite/tag/create.sim -run lite/tag/delete.sim -run lite/tag/change.sim -run lite/tag/set.sim -run lite/tag/add.sim -run lite/tag/commit.sim \ No newline at end of file +run general/tag/filter.sim +run general/tag/column.sim +run general/tag/bool.sim +run general/tag/smallint.sim +run general/tag/tinyint.sim +run general/tag/int.sim +run general/tag/bigint.sim +run general/tag/float.sim +run general/tag/double.sim +run general/tag/binary.sim +run general/tag/bool_int.sim +run general/tag/bool_binary.sim +run general/tag/int_float.sim +run general/tag/int_binary.sim +run general/tag/binary_binary.sim +run general/tag/3.sim +run general/tag/4.sim +run general/tag/5.sim +run general/tag/6.sim +run general/tag/create.sim +run general/tag/delete.sim +run general/tag/change.sim +run general/tag/set.sim +run general/tag/add.sim +run general/tag/commit.sim \ No newline at end of file diff --git a/tests/script/general/vector/testSuite.sim b/tests/script/general/vector/testSuite.sim index 65bfffa1ad917177a933064d3f07109bcd9cc53f..e660fd90a971203323e8b1db829ceac64d6747dd 100644 --- a/tests/script/general/vector/testSuite.sim +++ b/tests/script/general/vector/testSuite.sim @@ -1,12 +1,12 @@ -run lite/vector/single.sim -run lite/vector/multi.sim -run lite/vector/table_query.sim -run lite/vector/table_time.sim -run lite/vector/table_field.sim -run lite/vector/table_mix.sim -run lite/vector/metrics_query.sim -run lite/vector/metrics_tag.sim -run lite/vector/metrics_time.sim -run lite/vector/metrics_field.sim -run lite/vector/metrics_mix.sim +run general/vector/single.sim +run general/vector/multi.sim +run general/vector/table_query.sim +run general/vector/table_time.sim +run general/vector/table_field.sim +run general/vector/table_mix.sim +run general/vector/metrics_query.sim +run general/vector/metrics_tag.sim +run general/vector/metrics_time.sim +run general/vector/metrics_field.sim +run general/vector/metrics_mix.sim diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 6c4ada50fe86c272d7a96ec8fa7f698d9ba3e200..12f9689fd34cc3a3d7488e1d46cdd1af58ae656d 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -93,7 +93,7 @@ echo "privateIp $NODE_IP" >> $TAOS_CFG echo "dDebugFlag 199" >> $TAOS_CFG echo "mDebugFlag 199" >> $TAOS_CFG echo "sdbDebugFlag 199" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "rpcDebugFlag 131" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG echo "cDebugFlag 135" >> $TAOS_CFG echo "httpDebugFlag 131" >> $TAOS_CFG diff --git a/tests/script/unique/account/testSuite.sim b/tests/script/unique/account/testSuite.sim index 542c5c23d1702dfd54f5626f0e1639ad9c86ba09..95bdeeb7604c5f7775f860212aaa5c9248d51a2a 100644 --- a/tests/script/unique/account/testSuite.sim +++ b/tests/script/unique/account/testSuite.sim @@ -1,9 +1,9 @@ -run cluster/account/account_create.sim -run cluster/account/account_len.sim -run cluster/account/pass_alter.sim -run cluster/account/pass_len.sim -run cluster/account/authority.sim -run cluster/account/account_delete.sim -run cluster/account/user_create.sim -run cluster/account/user_len.sim -run cluster/account/monitor.sim +run unique/account/account_create.sim +run unique/account/account_len.sim +run unique/account/pass_alter.sim +run unique/account/pass_len.sim +run unique/account/authority.sim +run unique/account/account_delete.sim +run unique/account/user_create.sim +run unique/account/user_len.sim +run unique/account/monitor.sim diff --git a/tests/script/unique/big/testSuite.sim b/tests/script/unique/big/testSuite.sim index 178192cff408bebfeccb6c741059092c904ca551..05a003ac2fc975cf2f537db394622998432159cc 100644 --- a/tests/script/unique/big/testSuite.sim +++ b/tests/script/unique/big/testSuite.sim @@ -1,3 +1,3 @@ -#run cluster/big/balance.sim -#run cluster/big/maxvnodes.sim -run cluster/big/tcp.sim +#run unique/big/balance.sim +#run unique/big/maxvnodes.sim +run unique/big/tcp.sim diff --git a/tests/script/unique/cluster/testSuite.sim b/tests/script/unique/cluster/testSuite.sim index 321ff9a2a9ab752c8cd7662bb1b8ac3f842cee80..f1f59097c506c3ac4c6b561aeb44c92b2fb2502e 100644 --- a/tests/script/unique/cluster/testSuite.sim +++ b/tests/script/unique/cluster/testSuite.sim @@ -1,5 +1,5 @@ -run cluster/cluster/balance1.sim -run cluster/cluster/balance2.sim -run cluster/cluster/balance3.sim -run cluster/cluster/balance1_bug.sim -run cluster/cluster/balance1_single.sim \ No newline at end of file +run unique/unique/balance1.sim +run unique/unique/balance2.sim +run unique/unique/balance3.sim +run unique/unique/balance1_bug.sim +run unique/unique/balance1_single.sim \ No newline at end of file diff --git a/tests/script/unique/column/testSuite.sim b/tests/script/unique/column/testSuite.sim index 2926157a44ecb1ef661ce95d501a577cd3d9e25c..8663e9f30518e1092bc63b60e429753fc7ad8712 100644 --- a/tests/script/unique/column/testSuite.sim +++ b/tests/script/unique/column/testSuite.sim @@ -1 +1 @@ -run cluster/column/replica3.sim +run unique/column/replica3.sim diff --git a/tests/script/unique/db/testSuite.sim b/tests/script/unique/db/testSuite.sim index 27bd24d9dc3799333fbc019e1c70bfe5baa28d3b..a370668860e85c124f75e83ce8b6bc18e47c253a 100644 --- a/tests/script/unique/db/testSuite.sim +++ b/tests/script/unique/db/testSuite.sim @@ -1,10 +1,10 @@ -#run cluster/db/commit.sim -run cluster/db/delete.sim -run cluster/db/replica_add12.sim -run cluster/db/replica_add13.sim -run cluster/db/replica_add23.sim -run cluster/db/replica_reduce21.sim -run cluster/db/replica_reduce32.sim -run cluster/db/replica_reduce31.sim -run cluster/db/replica_part.sim -run cluster/db/delete_part.sim +#run unique/db/commit.sim +run unique/db/delete.sim +run unique/db/replica_add12.sim +run unique/db/replica_add13.sim +run unique/db/replica_add23.sim +run unique/db/replica_reduce21.sim +run unique/db/replica_reduce32.sim +run unique/db/replica_reduce31.sim +run unique/db/replica_part.sim +run unique/db/delete_part.sim diff --git a/tests/script/unique/dnode/testSuite.sim b/tests/script/unique/dnode/testSuite.sim index 9929bfe43a490d5e1e5f2c68f9ede7c213d3d9fc..afb1cafd2c390d8888d87850b4e0ac92b7fd9727 100644 --- a/tests/script/unique/dnode/testSuite.sim +++ b/tests/script/unique/dnode/testSuite.sim @@ -1,12 +1,12 @@ -run cluster/dnode/balance1.sim -run cluster/dnode/balance2.sim -run cluster/dnode/balance3.sim -run cluster/dnode/balancex.sim -run cluster/dnode/offline1.sim -run cluster/dnode/offline2.sim -run cluster/dnode/remove1.sim -run cluster/dnode/remove2.sim -run cluster/dnode/vnode_clean.sim +run unique/dnode/balance1.sim +run unique/dnode/balance2.sim +run unique/dnode/balance3.sim +run unique/dnode/balancex.sim +run unique/dnode/offline1.sim +run unique/dnode/offline2.sim +run unique/dnode/remove1.sim +run unique/dnode/remove2.sim +run unique/dnode/vnode_clean.sim diff --git a/tests/script/unique/http/testSuite.sim b/tests/script/unique/http/testSuite.sim index cfc86d9c9fdae0d108c629f26aac4ad9b9867e7f..b3ee1792f55dc1fc464b8cbea065e06dcdd2777b 100644 --- a/tests/script/unique/http/testSuite.sim +++ b/tests/script/unique/http/testSuite.sim @@ -1 +1 @@ -run cluster/http/admin.sim \ No newline at end of file +run unique/http/admin.sim \ No newline at end of file diff --git a/tests/script/unique/import/testSuite.sim b/tests/script/unique/import/testSuite.sim index e004e8f62b426fc31f1b367cb2bb35a3c5d5b9b0..8be358ce17ee864538c47137630520cd3e69c337 100644 --- a/tests/script/unique/import/testSuite.sim +++ b/tests/script/unique/import/testSuite.sim @@ -1,2 +1,2 @@ -run cluster/import/replica2.sim -run cluster/import/replica3.sim \ No newline at end of file +run unique/import/replica2.sim +run unique/import/replica3.sim \ No newline at end of file diff --git a/tests/script/unique/metrics/testSuite.sim b/tests/script/unique/metrics/testSuite.sim index 6740a664897fd97b428451286fcd73dad926b22e..98de87aaf131d31283979972a1251d4739dc4438 100644 --- a/tests/script/unique/metrics/testSuite.sim +++ b/tests/script/unique/metrics/testSuite.sim @@ -1,4 +1,4 @@ -run cluster/metrics/disk.sim -run cluster/metrics/metrics.sim -run cluster/metrics/values.sim -run cluster/metrics/vnode3.sim \ No newline at end of file +run unique/metrics/disk.sim +run unique/metrics/metrics.sim +run unique/metrics/values.sim +run unique/metrics/vnode3.sim \ No newline at end of file diff --git a/tests/script/unique/mnode/mgmt22.sim b/tests/script/unique/mnode/mgmt22.sim index 8d1d6c88ccfb71d0b42b7f7180b22331e2c6eb49..f51be5a3bb38a7882b3dc39e15aff561615e4d7b 100644 --- a/tests/script/unique/mnode/mgmt22.sim +++ b/tests/script/unique/mnode/mgmt22.sim @@ -17,7 +17,7 @@ system sh/cfg.sh -n dnode2 -c secondIp -v 192.168.0.2 system sh/cfg.sh -n dnode3 -c secondIp -v 192.168.0.2 print ============== step1 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sleep 3000 sql connect @@ -29,7 +29,7 @@ if $data3_192.168.0.1 != master then endi print ============== step2 -system sh/exec.sh -n dnode2 -s start +system sh/exec_up.sh -n dnode2 -s start sql create dnode 192.168.0.2 $x = 0 @@ -57,7 +57,7 @@ sql drop dnode 192.168.0.1 -x error1 error1: print ============== step4 -system sh/exec.sh -n dnode1 -s stop +system sh/exec_up.sh -n dnode1 -s stop sleep 8000 $x = 0 @@ -105,7 +105,7 @@ system sh/deploy.sh -n dnode1 -m 192.168.0.2 -i 192.168.0.1 system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode1 -c secondIp -v 192.168.0.1 -system sh/exec.sh -n dnode1 -s start +system sh/exec_up.sh -n dnode1 -s start sql create dnode 192.168.0.1 sleep 5000 @@ -128,7 +128,7 @@ if $data3_192.168.0.2 != master then endi print ============== step7 -system sh/exec.sh -n dnode3 -s start +system sh/exec_up.sh -n dnode3 -s start sql create dnode 192.168.0.3 sleep 5000 diff --git a/tests/script/unique/mnode/testSuite.sim b/tests/script/unique/mnode/testSuite.sim index 832fe33523b39c97f884524ca9f075bc473ab32f..8b60f77c611b5b7ccaa3eeb0046409ba8075dee7 100644 --- a/tests/script/unique/mnode/testSuite.sim +++ b/tests/script/unique/mnode/testSuite.sim @@ -1,13 +1,13 @@ -run cluster/mnode/mgmt22.sim -run cluster/mnode/mgmt23.sim -run cluster/mnode/mgmt24.sim -run cluster/mnode/mgmt25.sim -run cluster/mnode/mgmt26.sim -run cluster/mnode/mgmt33.sim -run cluster/mnode/mgmt34.sim -run cluster/mnode/mgmtr1.sim -run cluster/mnode/mgmtr2.sim -run cluster/mnode/drop.sim -run cluster/mnode/reuse.sim -run cluster/mnode/secondIp.sim +run unique/mnode/mgmt22.sim +run unique/mnode/mgmt23.sim +run unique/mnode/mgmt24.sim +run unique/mnode/mgmt25.sim +run unique/mnode/mgmt26.sim +run unique/mnode/mgmt33.sim +run unique/mnode/mgmt34.sim +run unique/mnode/mgmtr1.sim +run unique/mnode/mgmtr2.sim +run unique/mnode/drop.sim +run unique/mnode/reuse.sim +run unique/mnode/secondIp.sim diff --git a/tests/script/unique/stream/testSuite.sim b/tests/script/unique/stream/testSuite.sim index fdf7b540deeea0c762933bbe80dcb0544b712744..f7de872cc388a8e5f28a17cb77f6c3b80fb2448a 100644 --- a/tests/script/unique/stream/testSuite.sim +++ b/tests/script/unique/stream/testSuite.sim @@ -1,15 +1,15 @@ -run cluster/stream/table_replica1_dnode2.sim -run cluster/stream/metrics_replica1_dnode2.sim -run cluster/stream/table_replica2_dnode2.sim -run cluster/stream/metrics_replica2_dnode2.sim -run cluster/stream/table_replica2_dnode2_vnoden.sim -run cluster/stream/metrics_replica2_dnode2_vnoden.sim -run cluster/stream/table_replica2_dnode3.sim -run cluster/stream/metrics_replica2_dnode3.sim -run cluster/stream/table_replica3_dnode4.sim -run cluster/stream/metrics_replica3_dnode4.sim -run cluster/stream/table_vnode_stop.sim -run cluster/stream/metrics_vnode_stop.sim -#run cluster/stream/table_balance.sim -#run cluster/stream/metrics_balance.sim -#run cluster/stream/table_move.sim \ No newline at end of file +run unique/stream/table_replica1_dnode2.sim +run unique/stream/metrics_replica1_dnode2.sim +run unique/stream/table_replica2_dnode2.sim +run unique/stream/metrics_replica2_dnode2.sim +run unique/stream/table_replica2_dnode2_vnoden.sim +run unique/stream/metrics_replica2_dnode2_vnoden.sim +run unique/stream/table_replica2_dnode3.sim +run unique/stream/metrics_replica2_dnode3.sim +run unique/stream/table_replica3_dnode4.sim +run unique/stream/metrics_replica3_dnode4.sim +run unique/stream/table_vnode_stop.sim +run unique/stream/metrics_vnode_stop.sim +#run unique/stream/table_balance.sim +#run unique/stream/metrics_balance.sim +#run unique/stream/table_move.sim \ No newline at end of file diff --git a/tests/script/unique/table/testSuite.sim b/tests/script/unique/table/testSuite.sim index e1ab34edbe5d4c663697ad013742ea0e36a14d12..e0c0a1f2fabdaa079deb8b8db08db2095d1148fd 100644 --- a/tests/script/unique/table/testSuite.sim +++ b/tests/script/unique/table/testSuite.sim @@ -1 +1 @@ -run cluster/table/delete_part.sim +run unique/table/delete_part.sim diff --git a/tests/script/unique/vnode/testSuite.sim b/tests/script/unique/vnode/testSuite.sim index 36e2c34c46bc6f46538d401b6bfe4eaffcecfb98..9a9c0bfb828a4d3b1baf17656525fe41f627dee4 100644 --- a/tests/script/unique/vnode/testSuite.sim +++ b/tests/script/unique/vnode/testSuite.sim @@ -1,9 +1,9 @@ -run cluster/vnode/replica2_basic2.sim -run cluster/vnode/replica2_basic.sim -run cluster/vnode/replica2_repeat.sim -run cluster/vnode/replica3_basic.sim -run cluster/vnode/replica3_repeat.sim -run cluster/vnode/commit.sim -run cluster/vnode/many.sim +run unique/vnode/replica2_basic2.sim +run unique/vnode/replica2_basic.sim +run unique/vnode/replica2_repeat.sim +run unique/vnode/replica3_basic.sim +run unique/vnode/replica3_repeat.sim +run unique/vnode/commit.sim +run unique/vnode/many.sim diff --git a/tests/script/uniqueSuite.sim b/tests/script/uniqueSuite.sim new file mode 100644 index 0000000000000000000000000000000000000000..0a3d57c27e3f11012e9d37f53745fb617d545d50 --- /dev/null +++ b/tests/script/uniqueSuite.sim @@ -0,0 +1,5 @@ +################################# + +run unique/mnode/testSuite.sim + +################################## diff --git a/tests/test/c/importOneRow.c b/tests/test/c/importOneRow.c index cf9e9b985deb3e90b3b23ad750eab2dd1eaaebee..babfdae2779f229281843a438ac75092a7a3e55c 100644 --- a/tests/test/c/importOneRow.c +++ b/tests/test/c/importOneRow.c @@ -66,9 +66,9 @@ void shellParseArgument(int argc, char *argv[]) { } } - uPrint("%s rowNum:%d %s", GREEN, rowNum, NC); - uPrint("%s threadNum:%d %s", GREEN, threadNum, NC); - uPrint("%s replica:%d %s", GREEN, replica, NC); + pPrint("%s rowNum:%d %s", GREEN, rowNum, NC); + pPrint("%s threadNum:%d %s", GREEN, threadNum, NC); + pPrint("%s replica:%d %s", GREEN, replica, NC); } int main(int argc, char *argv[]) { diff --git a/tests/test/c/importPerTabe.c b/tests/test/c/importPerTabe.c index 62ef0ff33de0d77f4fd1bce57d09f1bc695c17bb..8a3ff048d3811b706981c76815c22590985386d0 100644 --- a/tests/test/c/importPerTabe.c +++ b/tests/test/c/importPerTabe.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { } void createDbAndTable() { - uPrint("start to create table"); + pPrint("start to create table"); TAOS * con; struct timeval systemTime; @@ -70,19 +70,19 @@ void createDbAndTable() { con = taos_connect(tsMasterIp, tsDefaultUser, tsDefaultPass, NULL, 0); if (con == NULL) { - uError("failed to connect to DB, reason:%s", taos_errstr(con)); + pError("failed to connect to DB, reason:%s", taos_errstr(con)); exit(1); } sprintf(qstr, "create database if not exists %s cache %d tables %d", dbName, cache, tables); if (taos_query(con, qstr)) { - uError("failed to create database:%s, code:%d reason:%s", dbName, taos_errno(con), taos_errstr(con)); + pError("failed to create database:%s, code:%d reason:%s", dbName, taos_errno(con), taos_errstr(con)); exit(0); } sprintf(qstr, "use %s", dbName); if (taos_query(con, qstr)) { - uError("failed to use db, code:%d reason:%s", taos_errno(con), taos_errstr(con)); + pError("failed to use db, code:%d reason:%s", taos_errno(con), taos_errstr(con)); exit(0); } @@ -98,14 +98,14 @@ void createDbAndTable() { sprintf(qstr + len, ") tags(t int)"); if (taos_query(con, qstr)) { - uError("failed to create stable, code:%d reason:%s", taos_errno(con), taos_errstr(con)); + pError("failed to create stable, code:%d reason:%s", taos_errno(con), taos_errstr(con)); exit(0); } for (int64_t t = 0; t < totalTables; ++t) { sprintf(qstr, "create table if not exists %s%ld using %s tags(%ld)", stableName, t, stableName, t); if (taos_query(con, qstr)) { - uError("failed to create table %s%d, reason:%s", stableName, t, taos_errstr(con)); + pError("failed to create table %s%d, reason:%s", stableName, t, taos_errstr(con)); exit(0); } } @@ -118,7 +118,7 @@ void createDbAndTable() { sprintf(qstr + len, ")"); if (taos_query(con, qstr)) { - uError("failed to create table %s%ld, reason:%s", stableName, t, taos_errstr(con)); + pError("failed to create table %s%ld, reason:%s", stableName, t, taos_errstr(con)); exit(0); } } @@ -126,7 +126,7 @@ void createDbAndTable() { gettimeofday(&systemTime, NULL); et = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - uPrint("%.1f seconds to create %ld tables", (et - st) / 1000.0 / 1000.0, totalTables); + pPrint("%.1f seconds to create %ld tables", (et - st) / 1000.0 / 1000.0, totalTables); } void insertData() { @@ -136,7 +136,7 @@ void insertData() { gettimeofday(&systemTime, NULL); st = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - uPrint("%d threads are spawned to import data", numOfThreads); + pPrint("%d threads are spawned to import data", numOfThreads); pthread_attr_t thattr; pthread_attr_init(&thattr); @@ -170,12 +170,12 @@ void insertData() { double speedOfRows = totalRows / seconds; double speedOfPoints = totalPoints / seconds; - uPrint( + pPrint( "%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf " "PointsPerSecond:%.1lf%s", GREEN, numOfThreads, seconds, totalTables, totalRows, totalPoints, speedOfRows, speedOfPoints, NC); - uPrint("threads exit"); + pPrint("threads exit"); pthread_attr_destroy(&thattr); free(pInfo); @@ -189,11 +189,11 @@ void *syncTest(void *param) { char qstr[65000]; int maxBytes = 60000; - uPrint("thread:%d, start to run", pInfo->threadIndex); + pPrint("thread:%d, start to run", pInfo->threadIndex); con = taos_connect(tsMasterIp, tsDefaultUser, tsDefaultPass, NULL, 0); if (con == NULL) { - uError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con)); + pError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con)); exit(1); } @@ -221,7 +221,7 @@ void *syncTest(void *param) { len += sprintf(sql + len, ")"); if (len > maxBytes) { if (taos_query(con, qstr)) { - uError("thread:%d, failed to import table:%s%ld row:%ld, reason:%s", pInfo->threadIndex, pInfo->stableName, + pError("thread:%d, failed to import table:%s%ld row:%ld, reason:%s", pInfo->threadIndex, pInfo->stableName, table, row, taos_errstr(con)); } @@ -245,7 +245,7 @@ void *syncTest(void *param) { int64_t totalTables = pInfo->tableEndIndex - pInfo->tableBeginIndex; int64_t totalRows = totalTables * pInfo->rowsPerTable; int64_t totalPoints = totalRows * pInfo->pointsPerTable; - uPrint("thread:%d, import finished, use %.2f seconds, tables:%ld rows:%ld points:%ld", pInfo->threadIndex, + pPrint("thread:%d, import finished, use %.2f seconds, tables:%ld rows:%ld points:%ld", pInfo->threadIndex, (et - st) / 1000.0 / 1000.0, totalTables, totalRows, totalPoints); return NULL; @@ -310,13 +310,13 @@ void shellParseArgument(int argc, char *argv[]) { } } - uPrint("%srowsPerTable:%" PRId64 "%s", GREEN, rowsPerTable, NC); - uPrint("%spointsPerTable:%" PRId64 "%s", GREEN, pointsPerTable, NC); - uPrint("%snumOfThreads:%" PRId64 "%s", GREEN, numOfThreads, NC); - uPrint("%snumOfTablesPerThread:%" PRId64 "%s", GREEN, numOfTablesPerThread, NC); - uPrint("%scache:%" PRId64 "%s", GREEN, cache, NC); - uPrint("%stables:%" PRId64 "%s", GREEN, tables, NC); - uPrint("%sdbName:%s%s", GREEN, dbName, NC); - uPrint("%stableName:%s%s", GREEN, stableName, NC); - uPrint("%sstart to run%s", GREEN, NC); + pPrint("%srowsPerTable:%" PRId64 "%s", GREEN, rowsPerTable, NC); + pPrint("%spointsPerTable:%" PRId64 "%s", GREEN, pointsPerTable, NC); + pPrint("%snumOfThreads:%" PRId64 "%s", GREEN, numOfThreads, NC); + pPrint("%snumOfTablesPerThread:%" PRId64 "%s", GREEN, numOfTablesPerThread, NC); + pPrint("%scache:%" PRId64 "%s", GREEN, cache, NC); + pPrint("%stables:%" PRId64 "%s", GREEN, tables, NC); + pPrint("%sdbName:%s%s", GREEN, dbName, NC); + pPrint("%stableName:%s%s", GREEN, stableName, NC); + pPrint("%sstart to run%s", GREEN, NC); } diff --git a/tests/test/c/insertPerRow.c b/tests/test/c/insertPerRow.c index d4ef788be9b80bc96bd224f27abb93f9bb8bc2a1..de611eeec19b1056afbba843cebf4e137a1dc433 100644 --- a/tests/test/c/insertPerRow.c +++ b/tests/test/c/insertPerRow.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { } void createDbAndTable() { - uPrint("start to create table"); + pPrint("start to create table"); TAOS * con; struct timeval systemTime; @@ -70,19 +70,19 @@ void createDbAndTable() { con = taos_connect(tsMasterIp, tsDefaultUser, tsDefaultPass, NULL, 0); if (con == NULL) { - uError("failed to connect to DB, reason:%s", taos_errstr(con)); + pError("failed to connect to DB, reason:%s", taos_errstr(con)); exit(1); } sprintf(qstr, "create database if not exists %s cache %d tables %d", dbName, cache, tables); if (taos_query(con, qstr)) { - uError("failed to create database:%s, code:%d reason:%s", dbName, taos_errno(con), taos_errstr(con)); + pError("failed to create database:%s, code:%d reason:%s", dbName, taos_errno(con), taos_errstr(con)); exit(0); } sprintf(qstr, "use %s", dbName); if (taos_query(con, qstr)) { - uError("failed to use db, code:%d reason:%s", taos_errno(con), taos_errstr(con)); + pError("failed to use db, code:%d reason:%s", taos_errno(con), taos_errstr(con)); exit(0); } @@ -98,14 +98,14 @@ void createDbAndTable() { sprintf(qstr + len, ") tags(t int)"); if (taos_query(con, qstr)) { - uError("failed to create stable, code:%d reason:%s", taos_errno(con), taos_errstr(con)); + pError("failed to create stable, code:%d reason:%s", taos_errno(con), taos_errstr(con)); exit(0); } for (int64_t t = 0; t < totalTables; ++t) { sprintf(qstr, "create table if not exists %s%ld using %s tags(%ld)", stableName, t, stableName, t); if (taos_query(con, qstr)) { - uError("failed to create table %s%d, reason:%s", stableName, t, taos_errstr(con)); + pError("failed to create table %s%d, reason:%s", stableName, t, taos_errstr(con)); exit(0); } } @@ -118,7 +118,7 @@ void createDbAndTable() { sprintf(qstr + len, ")"); if (taos_query(con, qstr)) { - uError("failed to create table %s%ld, reason:%s", stableName, t, taos_errstr(con)); + pError("failed to create table %s%ld, reason:%s", stableName, t, taos_errstr(con)); exit(0); } } @@ -126,7 +126,7 @@ void createDbAndTable() { gettimeofday(&systemTime, NULL); et = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - uPrint("%.1f seconds to create %ld tables", (et - st) / 1000.0 / 1000.0, totalTables); + pPrint("%.1f seconds to create %ld tables", (et - st) / 1000.0 / 1000.0, totalTables); } void insertData() { @@ -136,7 +136,7 @@ void insertData() { gettimeofday(&systemTime, NULL); st = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - uPrint("%d threads are spawned to insert data", numOfThreads); + pPrint("%d threads are spawned to insert data", numOfThreads); pthread_attr_t thattr; pthread_attr_init(&thattr); @@ -170,12 +170,12 @@ void insertData() { double speedOfRows = totalRows / seconds; double speedOfPoints = totalPoints / seconds; - uPrint( + pPrint( "%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf " "PointsPerSecond:%.1lf%s", GREEN, numOfThreads, seconds, totalTables, totalRows, totalPoints, speedOfRows, speedOfPoints, NC); - uPrint("threads exit"); + pPrint("threads exit"); pthread_attr_destroy(&thattr); free(pInfo); @@ -189,11 +189,11 @@ void *syncTest(void *param) { char qstr[65000]; int maxBytes = 60000; - uPrint("thread:%d, start to run", pInfo->threadIndex); + pPrint("thread:%d, start to run", pInfo->threadIndex); con = taos_connect(tsMasterIp, tsDefaultUser, tsDefaultPass, NULL, 0); if (con == NULL) { - uError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con)); + pError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con)); exit(1); } @@ -221,7 +221,7 @@ void *syncTest(void *param) { len += sprintf(sql + len, ")"); if (len > maxBytes) { if (taos_query(con, qstr)) { - uError("thread:%d, failed to insert table:%s%ld row:%ld, reason:%s", pInfo->threadIndex, pInfo->stableName, + pError("thread:%d, failed to insert table:%s%ld row:%ld, reason:%s", pInfo->threadIndex, pInfo->stableName, table, row, taos_errstr(con)); } @@ -240,7 +240,7 @@ void *syncTest(void *param) { int64_t totalTables = pInfo->tableEndIndex - pInfo->tableBeginIndex; int64_t totalRows = totalTables * pInfo->rowsPerTable; int64_t totalPoints = totalRows * pInfo->pointsPerTable; - uPrint("thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld", pInfo->threadIndex, + pPrint("thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld", pInfo->threadIndex, (et - st) / 1000.0 / 1000.0, totalTables, totalRows, totalPoints); return NULL; @@ -305,13 +305,13 @@ void shellParseArgument(int argc, char *argv[]) { } } - uPrint("%srowsPerTable:%" PRId64 "%s", GREEN, rowsPerTable, NC); - uPrint("%spointsPerTable:%" PRId64 "%s", GREEN, pointsPerTable, NC); - uPrint("%snumOfThreads:%" PRId64 "%s", GREEN, numOfThreads, NC); - uPrint("%snumOfTablesPerThread:%" PRId64 "%s", GREEN, numOfTablesPerThread, NC); - uPrint("%scache:%" PRId64 "%s", GREEN, cache, NC); - uPrint("%stables:%" PRId64 "%s", GREEN, tables, NC); - uPrint("%sdbName:%s%s", GREEN, dbName, NC); - uPrint("%stableName:%s%s", GREEN, stableName, NC); - uPrint("%sstart to run%s", GREEN, NC); + pPrint("%srowsPerTable:%" PRId64 "%s", GREEN, rowsPerTable, NC); + pPrint("%spointsPerTable:%" PRId64 "%s", GREEN, pointsPerTable, NC); + pPrint("%snumOfThreads:%" PRId64 "%s", GREEN, numOfThreads, NC); + pPrint("%snumOfTablesPerThread:%" PRId64 "%s", GREEN, numOfTablesPerThread, NC); + pPrint("%scache:%" PRId64 "%s", GREEN, cache, NC); + pPrint("%stables:%" PRId64 "%s", GREEN, tables, NC); + pPrint("%sdbName:%s%s", GREEN, dbName, NC); + pPrint("%stableName:%s%s", GREEN, stableName, NC); + pPrint("%sstart to run%s", GREEN, NC); } diff --git a/tests/test/c/insertPerTable.c b/tests/test/c/insertPerTable.c index c9ead1c5ca3dffe1bbe73da5dd8a1309ebf6b47b..0edae323fa09d1f842f47c904880da0c6c2e6876 100644 --- a/tests/test/c/insertPerTable.c +++ b/tests/test/c/insertPerTable.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { } void createDbAndTable() { - uPrint("start to create table"); + pPrint("start to create table"); TAOS * con; struct timeval systemTime; @@ -70,19 +70,19 @@ void createDbAndTable() { con = taos_connect(tsMasterIp, tsDefaultUser, tsDefaultPass, NULL, 0); if (con == NULL) { - uError("failed to connect to DB, reason:%s", taos_errstr(con)); + pError("failed to connect to DB, reason:%s", taos_errstr(con)); exit(1); } sprintf(qstr, "create database if not exists %s cache %d tables %d", dbName, cache, tables); if (taos_query(con, qstr)) { - uError("failed to create database:%s, code:%d reason:%s", dbName, taos_errno(con), taos_errstr(con)); + pError("failed to create database:%s, code:%d reason:%s", dbName, taos_errno(con), taos_errstr(con)); exit(0); } sprintf(qstr, "use %s", dbName); if (taos_query(con, qstr)) { - uError("failed to use db, code:%d reason:%s", taos_errno(con), taos_errstr(con)); + pError("failed to use db, code:%d reason:%s", taos_errno(con), taos_errstr(con)); exit(0); } @@ -98,14 +98,14 @@ void createDbAndTable() { sprintf(qstr + len, ") tags(t int)"); if (taos_query(con, qstr)) { - uError("failed to create stable, code:%d reason:%s", taos_errno(con), taos_errstr(con)); + pError("failed to create stable, code:%d reason:%s", taos_errno(con), taos_errstr(con)); exit(0); } for (int64_t t = 0; t < totalTables; ++t) { sprintf(qstr, "create table if not exists %s%ld using %s tags(%ld)", stableName, t, stableName, t); if (taos_query(con, qstr)) { - uError("failed to create table %s%d, reason:%s", stableName, t, taos_errstr(con)); + pError("failed to create table %s%d, reason:%s", stableName, t, taos_errstr(con)); exit(0); } } @@ -118,7 +118,7 @@ void createDbAndTable() { sprintf(qstr + len, ")"); if (taos_query(con, qstr)) { - uError("failed to create table %s%ld, reason:%s", stableName, t, taos_errstr(con)); + pError("failed to create table %s%ld, reason:%s", stableName, t, taos_errstr(con)); exit(0); } } @@ -126,7 +126,7 @@ void createDbAndTable() { gettimeofday(&systemTime, NULL); et = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - uPrint("%.1f seconds to create %ld tables", (et - st) / 1000.0 / 1000.0, totalTables); + pPrint("%.1f seconds to create %ld tables", (et - st) / 1000.0 / 1000.0, totalTables); } void insertData() { @@ -136,7 +136,7 @@ void insertData() { gettimeofday(&systemTime, NULL); st = systemTime.tv_sec * 1000000 + systemTime.tv_usec; - uPrint("%d threads are spawned to insert data", numOfThreads); + pPrint("%d threads are spawned to insert data", numOfThreads); pthread_attr_t thattr; pthread_attr_init(&thattr); @@ -170,12 +170,12 @@ void insertData() { double speedOfRows = totalRows / seconds; double speedOfPoints = totalPoints / seconds; - uPrint( + pPrint( "%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf " "PointsPerSecond:%.1lf%s", GREEN, numOfThreads, seconds, totalTables, totalRows, totalPoints, speedOfRows, speedOfPoints, NC); - uPrint("threads exit"); + pPrint("threads exit"); pthread_attr_destroy(&thattr); free(pInfo); @@ -189,11 +189,11 @@ void *syncTest(void *param) { char qstr[65000]; int maxBytes = 60000; - uPrint("thread:%d, start to run", pInfo->threadIndex); + pPrint("thread:%d, start to run", pInfo->threadIndex); con = taos_connect(tsMasterIp, tsDefaultUser, tsDefaultPass, NULL, 0); if (con == NULL) { - uError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con)); + pError("index:%d, failed to connect to DB, reason:%s", pInfo->threadIndex, taos_errstr(con)); exit(1); } @@ -221,7 +221,7 @@ void *syncTest(void *param) { len += sprintf(sql + len, ")"); if (len > maxBytes) { if (taos_query(con, qstr)) { - uError("thread:%d, failed to insert table:%s%ld row:%ld, reason:%s", pInfo->threadIndex, pInfo->stableName, + pError("thread:%d, failed to insert table:%s%ld row:%ld, reason:%s", pInfo->threadIndex, pInfo->stableName, table, row, taos_errstr(con)); } @@ -245,7 +245,7 @@ void *syncTest(void *param) { int64_t totalTables = pInfo->tableEndIndex - pInfo->tableBeginIndex; int64_t totalRows = totalTables * pInfo->rowsPerTable; int64_t totalPoints = totalRows * pInfo->pointsPerTable; - uPrint("thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld", pInfo->threadIndex, + pPrint("thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld", pInfo->threadIndex, (et - st) / 1000.0 / 1000.0, totalTables, totalRows, totalPoints); return NULL; @@ -310,13 +310,13 @@ void shellParseArgument(int argc, char *argv[]) { } } - uPrint("%srowsPerTable:%" PRId64 "%s", GREEN, rowsPerTable, NC); - uPrint("%spointsPerTable:%" PRId64 "%s", GREEN, pointsPerTable, NC); - uPrint("%snumOfThreads:%" PRId64 "%s", GREEN, numOfThreads, NC); - uPrint("%snumOfTablesPerThread:%" PRId64 "%s", GREEN, numOfTablesPerThread, NC); - uPrint("%scache:%" PRId64 "%s", GREEN, cache, NC); - uPrint("%stables:%" PRId64 "%s", GREEN, tables, NC); - uPrint("%sdbName:%s%s", GREEN, dbName, NC); - uPrint("%stableName:%s%s", GREEN, stableName, NC); - uPrint("%sstart to run%s", GREEN, NC); + pPrint("%srowsPerTable:%" PRId64 "%s", GREEN, rowsPerTable, NC); + pPrint("%spointsPerTable:%" PRId64 "%s", GREEN, pointsPerTable, NC); + pPrint("%snumOfThreads:%" PRId64 "%s", GREEN, numOfThreads, NC); + pPrint("%snumOfTablesPerThread:%" PRId64 "%s", GREEN, numOfTablesPerThread, NC); + pPrint("%scache:%" PRId64 "%s", GREEN, cache, NC); + pPrint("%stables:%" PRId64 "%s", GREEN, tables, NC); + pPrint("%sdbName:%s%s", GREEN, dbName, NC); + pPrint("%stableName:%s%s", GREEN, stableName, NC); + pPrint("%sstart to run%s", GREEN, NC); }