提交 03b141e0 编写于 作者: P Ping Xiao

Merge branch 'develop' into xiaoping/add_test_case

...@@ -4,7 +4,7 @@ PROJECT(TDengine) ...@@ -4,7 +4,7 @@ PROJECT(TDengine)
IF (DEFINED VERNUMBER) IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER}) SET(TD_VER_NUMBER ${VERNUMBER})
ELSE () ELSE ()
SET(TD_VER_NUMBER "2.0.8.0") SET(TD_VER_NUMBER "2.0.9.0")
ENDIF () ENDIF ()
IF (DEFINED VERCOMPATIBLE) IF (DEFINED VERCOMPATIBLE)
......
name: tdengine name: tdengine
base: core18 base: core18
version: '2.0.8.0' version: '2.0.9.0'
icon: snap/gui/t-dengine.svg icon: snap/gui/t-dengine.svg
summary: an open-source big data platform designed and optimized for IoT. summary: an open-source big data platform designed and optimized for IoT.
description: | description: |
...@@ -72,7 +72,7 @@ parts: ...@@ -72,7 +72,7 @@ parts:
- usr/bin/taosd - usr/bin/taosd
- usr/bin/taos - usr/bin/taos
- usr/bin/taosdemo - usr/bin/taosdemo
- usr/lib/libtaos.so.2.0.8.0 - usr/lib/libtaos.so.2.0.9.0
- usr/lib/libtaos.so.1 - usr/lib/libtaos.so.1
- usr/lib/libtaos.so - usr/lib/libtaos.so
......
...@@ -1633,7 +1633,7 @@ void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen) ...@@ -1633,7 +1633,7 @@ void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen)
int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_t rowSize, int32_t finalRowSize) { int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_t rowSize, int32_t finalRowSize) {
int32_t maxRowSize = MAX(rowSize, finalRowSize); int32_t maxRowSize = MAX(rowSize, finalRowSize);
char* pbuf = calloc(1, pOutput->num * maxRowSize); char* pbuf = calloc(1, (size_t)(pOutput->num * maxRowSize));
size_t size = tscNumOfFields(pQueryInfo); size_t size = tscNumOfFields(pQueryInfo);
SArithmeticSupport arithSup = {0}; SArithmeticSupport arithSup = {0};
...@@ -1660,16 +1660,16 @@ int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_ ...@@ -1660,16 +1660,16 @@ int32_t doArithmeticCalculate(SQueryInfo* pQueryInfo, tFilePage* pOutput, int32_
tExprTreeCalcTraverse(arithSup.pArithExpr->pExpr, (int32_t) pOutput->num, pbuf + pOutput->num*offset, &arithSup, TSDB_ORDER_ASC, getArithmeticInputSrc); tExprTreeCalcTraverse(arithSup.pArithExpr->pExpr, (int32_t) pOutput->num, pbuf + pOutput->num*offset, &arithSup, TSDB_ORDER_ASC, getArithmeticInputSrc);
} else { } else {
SSqlExpr* pExpr = pSup->pSqlExpr; SSqlExpr* pExpr = pSup->pSqlExpr;
memcpy(pbuf + pOutput->num * offset, pExpr->offset * pOutput->num + pOutput->data, pExpr->resBytes * pOutput->num); memcpy(pbuf + pOutput->num * offset, pExpr->offset * pOutput->num + pOutput->data, (size_t)(pExpr->resBytes * pOutput->num));
} }
offset += pSup->field.bytes; offset += pSup->field.bytes;
} }
memcpy(pOutput->data, pbuf, pOutput->num * offset); memcpy(pOutput->data, pbuf, (size_t)(pOutput->num * offset));
tfree(pbuf); tfree(pbuf);
tfree(arithSup.data); tfree(arithSup.data);
return offset; return offset;
} }
\ No newline at end of file
...@@ -25,6 +25,8 @@ void extractTableName(const char *tableId, char *name); ...@@ -25,6 +25,8 @@ void extractTableName(const char *tableId, char *name);
char* extractDBName(const char *tableId, char *name); char* extractDBName(const char *tableId, char *name);
size_t tableIdPrefix(const char* name, char* prefix, int32_t len);
void extractTableNameFromToken(SStrToken *pToken, SStrToken* pTable); void extractTableNameFromToken(SStrToken *pToken, SStrToken* pTable);
SSchema tGetTableNameColumnSchema(); SSchema tGetTableNameColumnSchema();
......
...@@ -39,6 +39,13 @@ char* extractDBName(const char* tableId, char* name) { ...@@ -39,6 +39,13 @@ char* extractDBName(const char* tableId, char* name) {
return strncpy(name, &tableId[offset1 + 1], len); return strncpy(name, &tableId[offset1 + 1], len);
} }
size_t tableIdPrefix(const char* name, char* prefix, int32_t len) {
tstrncpy(prefix, name, len);
strcat(prefix, TS_PATH_DELIMITER);
return strlen(prefix);
}
SSchema tGetTableNameColumnSchema() { SSchema tGetTableNameColumnSchema() {
SSchema s = {0}; SSchema s = {0};
s.bytes = TSDB_TABLE_NAME_LEN - 1 + VARSTR_HEADER_SIZE; s.bytes = TSDB_TABLE_NAME_LEN - 1 + VARSTR_HEADER_SIZE;
...@@ -198,4 +205,4 @@ SSchema tscGetTbnameColumnSchema() { ...@@ -198,4 +205,4 @@ SSchema tscGetTbnameColumnSchema() {
strcpy(s.name, TSQL_TBNAME_L); strcpy(s.name, TSQL_TBNAME_L);
return s; return s;
} }
\ No newline at end of file
Subproject commit 8c58c512b6acda8bcdfa48fdc7140227b5221766 Subproject commit 050667e5b4d0eafa5387e4283e713559b421203f
Subproject commit d598db167eb256fe67409b7bb3d0eb7fffc3ff8c Subproject commit ec77d9049a719dabfd1a7c1122a209e201861944
...@@ -236,7 +236,14 @@ PRASE_EPS_OVER: ...@@ -236,7 +236,14 @@ PRASE_EPS_OVER:
dnodeResetEps(eps); dnodeResetEps(eps);
if (eps) free(eps); if (eps) free(eps);
#if 0
dnodeUpdateEp(dnodeGetDnodeId(), tsLocalEp, tsLocalFqdn, &tsServerPort); dnodeUpdateEp(dnodeGetDnodeId(), tsLocalEp, tsLocalFqdn, &tsServerPort);
#else
if (dnodeCheckEpChanged(dnodeGetDnodeId(), tsLocalEp)) {
dError("dnode:%d, localEp is changed to %s in dnodeEps.json and need reconfigured", dnodeGetDnodeId(), tsLocalEp);
return -1;
}
#endif
terrno = 0; terrno = 0;
return 0; return 0;
......
...@@ -157,12 +157,13 @@ static void dnodeResetMInfos(SMInfos *pMinfos) { ...@@ -157,12 +157,13 @@ static void dnodeResetMInfos(SMInfos *pMinfos) {
} }
static int32_t dnodeReadMInfos() { static int32_t dnodeReadMInfos() {
int32_t len = 0; int32_t len = 0;
int32_t maxLen = 2000; int32_t maxLen = 2000;
char * content = calloc(1, maxLen + 1); char * content = calloc(1, maxLen + 1);
cJSON * root = NULL; cJSON * root = NULL;
FILE * fp = NULL; FILE * fp = NULL;
SMInfos minfos = {0}; SMInfos minfos = {0};
bool nodeChanged = false;
char file[TSDB_FILENAME_LEN + 20] = {0}; char file[TSDB_FILENAME_LEN + 20] = {0};
sprintf(file, "%s/mnodeEpSet.json", tsDnodeDir); sprintf(file, "%s/mnodeEpSet.json", tsDnodeDir);
...@@ -221,14 +222,19 @@ static int32_t dnodeReadMInfos() { ...@@ -221,14 +222,19 @@ static int32_t dnodeReadMInfos() {
dError("failed to read mnodeEpSet.json, nodeId not found"); dError("failed to read mnodeEpSet.json, nodeId not found");
goto PARSE_MINFOS_OVER; goto PARSE_MINFOS_OVER;
} }
minfos.mnodeInfos[i].mnodeId = nodeId->valueint;
cJSON *nodeEp = cJSON_GetObjectItem(nodeInfo, "nodeEp"); cJSON *nodeEp = cJSON_GetObjectItem(nodeInfo, "nodeEp");
if (!nodeEp || nodeEp->type != cJSON_String || nodeEp->valuestring == NULL) { if (!nodeEp || nodeEp->type != cJSON_String || nodeEp->valuestring == NULL) {
dError("failed to read mnodeEpSet.json, nodeName not found"); dError("failed to read mnodeEpSet.json, nodeName not found");
goto PARSE_MINFOS_OVER; goto PARSE_MINFOS_OVER;
} }
strncpy(minfos.mnodeInfos[i].mnodeEp, nodeEp->valuestring, TSDB_EP_LEN);
SMInfo *pMinfo = &minfos.mnodeInfos[i];
pMinfo->mnodeId = nodeId->valueint;
tstrncpy(pMinfo->mnodeEp, nodeEp->valuestring, TSDB_EP_LEN);
bool changed = dnodeCheckEpChanged(pMinfo->mnodeId, pMinfo->mnodeEp);
if (changed) nodeChanged = changed;
} }
dInfo("read file %s successed", file); dInfo("read file %s successed", file);
...@@ -245,6 +251,11 @@ PARSE_MINFOS_OVER: ...@@ -245,6 +251,11 @@ PARSE_MINFOS_OVER:
dnodeUpdateEp(mInfo->mnodeId, mInfo->mnodeEp, NULL, NULL); dnodeUpdateEp(mInfo->mnodeId, mInfo->mnodeEp, NULL, NULL);
} }
dnodeResetMInfos(&minfos); dnodeResetMInfos(&minfos);
if (nodeChanged) {
dnodeWriteMInfos();
}
return 0; return 0;
} }
......
...@@ -58,10 +58,10 @@ typedef struct { ...@@ -58,10 +58,10 @@ typedef struct {
static const SDnodeComponent tsDnodeComponents[] = { static const SDnodeComponent tsDnodeComponents[] = {
{"tfile", tfInit, tfCleanup}, {"tfile", tfInit, tfCleanup},
{"rpc", rpcInit, rpcCleanup}, {"rpc", rpcInit, rpcCleanup},
{"globalcfg" ,taosCheckGlobalCfg, NULL},
{"storage", dnodeInitStorage, dnodeCleanupStorage}, {"storage", dnodeInitStorage, dnodeCleanupStorage},
{"dnodecfg", dnodeInitCfg, dnodeCleanupCfg}, {"dnodecfg", dnodeInitCfg, dnodeCleanupCfg},
{"dnodeeps", dnodeInitEps, dnodeCleanupEps}, {"dnodeeps", dnodeInitEps, dnodeCleanupEps},
{"globalcfg" ,taosCheckGlobalCfg, NULL},
{"mnodeinfos",dnodeInitMInfos, dnodeCleanupMInfos}, {"mnodeinfos",dnodeInitMInfos, dnodeCleanupMInfos},
{"wal", walInit, walCleanUp}, {"wal", walInit, walCleanUp},
{"check", dnodeInitCheck, dnodeCleanupCheck}, // NOTES: dnodeInitCheck must be behind the dnodeinitStorage component !!! {"check", dnodeInitCheck, dnodeCleanupCheck}, // NOTES: dnodeInitCheck must be behind the dnodeinitStorage component !!!
......
...@@ -339,7 +339,12 @@ static int32_t dnodeOpenVnodes() { ...@@ -339,7 +339,12 @@ static int32_t dnodeOpenVnodes() {
} }
free(threads); free(threads);
dInfo("there are total vnodes:%d, openned:%d failed:%d", numOfVnodes, openVnodes, failedVnodes); dInfo("there are total vnodes:%d, openned:%d", numOfVnodes, openVnodes);
if (failedVnodes != 0) {
dError("there are total vnodes:%d, failed:%d", numOfVnodes, failedVnodes);
return -1;
}
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -64,7 +64,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_TRAN_ID, 0, 0x000F, "Invalid tr ...@@ -64,7 +64,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_TRAN_ID, 0, 0x000F, "Invalid tr
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_SESSION_ID, 0, 0x0010, "Invalid session id") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_SESSION_ID, 0, 0x0010, "Invalid session id")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_MSG_TYPE, 0, 0x0011, "Invalid message type") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_MSG_TYPE, 0, 0x0011, "Invalid message type")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_RESPONSE_TYPE, 0, 0x0012, "Invalid response type") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_RESPONSE_TYPE, 0, 0x0012, "Invalid response type")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_TIME_STAMP, 0, 0x0013, "Invalid timestamp") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_INVALID_TIME_STAMP, 0, 0x0013, "Client and server's time is not synchronized")
TAOS_DEFINE_ERROR(TSDB_CODE_APP_NOT_READY, 0, 0x0014, "Database not ready") TAOS_DEFINE_ERROR(TSDB_CODE_APP_NOT_READY, 0, 0x0014, "Database not ready")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, 0, 0x0015, "Unable to resolve FQDN") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, 0, 0x0015, "Unable to resolve FQDN")
......
...@@ -1734,6 +1734,16 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { ...@@ -1734,6 +1734,16 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
if (pTable->info.type == TSDB_CHILD_TABLE) { if (pTable->info.type == TSDB_CHILD_TABLE) {
STagData *pTagData = (STagData *)pCreate->schema; // it is a tag key STagData *pTagData = (STagData *)pCreate->schema; // it is a tag key
char prefix[64] = {0};
size_t prefixLen = tableIdPrefix(pMsg->pDb->name, prefix, 64);
if (0 != strncasecmp(prefix, pTagData->name, prefixLen)) {
mError("msg:%p, app:%p table:%s, corresponding super table:%s not in this db", pMsg, pMsg->rpcMsg.ahandle,
pCreate->tableId, pTagData->name);
mnodeDestroyChildTable(pTable);
return TSDB_CODE_TDB_INVALID_CREATE_TB_MSG;
}
if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(pTagData->name); if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(pTagData->name);
if (pMsg->pSTable == NULL) { if (pMsg->pSTable == NULL) {
mError("msg:%p, app:%p table:%s, corresponding super table:%s does not exist", pMsg, pMsg->rpcMsg.ahandle, mError("msg:%p, app:%p table:%s, corresponding super table:%s does not exist", pMsg, pMsg->rpcMsg.ahandle,
...@@ -2629,9 +2639,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows ...@@ -2629,9 +2639,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER; SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER;
char prefix[64] = {0}; char prefix[64] = {0};
tstrncpy(prefix, pDb->name, 64); int32_t prefixLen = tableIdPrefix(pDb->name, prefix, 64);
strcat(prefix, TS_PATH_DELIMITER);
int32_t prefixLen = strlen(prefix);
char* pattern = NULL; char* pattern = NULL;
if (pShow->payloadLen > 0) { if (pShow->payloadLen > 0) {
......
...@@ -5837,7 +5837,7 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) { ...@@ -5837,7 +5837,7 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) {
tFilePage **data = calloc(pQuery->numOfExpr2, POINTER_BYTES); tFilePage **data = calloc(pQuery->numOfExpr2, POINTER_BYTES);
for (int32_t i = 0; i < pQuery->numOfExpr2; ++i) { for (int32_t i = 0; i < pQuery->numOfExpr2; ++i) {
int32_t bytes = pQuery->pExpr2[i].bytes; int32_t bytes = pQuery->pExpr2[i].bytes;
data[i] = (tFilePage *)malloc(bytes * pQuery->rec.rows + sizeof(tFilePage)); data[i] = (tFilePage *)malloc((size_t)(bytes * pQuery->rec.rows) + sizeof(tFilePage));
} }
arithSup.offset = 0; arithSup.offset = 0;
...@@ -5859,7 +5859,7 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) { ...@@ -5859,7 +5859,7 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) {
for (int32_t j = 0; j < pQuery->numOfOutput; ++j) { for (int32_t j = 0; j < pQuery->numOfOutput; ++j) {
if (pSqlFunc->functionId == pQuery->pExpr1[j].base.functionId && if (pSqlFunc->functionId == pQuery->pExpr1[j].base.functionId &&
pSqlFunc->colInfo.colId == pQuery->pExpr1[j].base.colInfo.colId) { pSqlFunc->colInfo.colId == pQuery->pExpr1[j].base.colInfo.colId) {
memcpy(data[i]->data, pQuery->sdata[j]->data, pQuery->pExpr1[j].bytes * pQuery->rec.rows); memcpy(data[i]->data, pQuery->sdata[j]->data, (size_t)(pQuery->pExpr1[j].bytes * pQuery->rec.rows));
break; break;
} }
} }
...@@ -5871,7 +5871,7 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) { ...@@ -5871,7 +5871,7 @@ static void doSecondaryArithmeticProcess(SQuery* pQuery) {
} }
for (int32_t i = 0; i < pQuery->numOfExpr2; ++i) { for (int32_t i = 0; i < pQuery->numOfExpr2; ++i) {
memcpy(pQuery->sdata[i]->data, data[i]->data, pQuery->pExpr2[i].bytes * pQuery->rec.rows); memcpy(pQuery->sdata[i]->data, data[i]->data, (size_t)(pQuery->pExpr2[i].bytes * pQuery->rec.rows));
} }
for (int32_t i = 0; i < pQuery->numOfExpr2; ++i) { for (int32_t i = 0; i < pQuery->numOfExpr2; ++i) {
......
...@@ -226,7 +226,7 @@ int64_t syncStart(const SSyncInfo *pInfo) { ...@@ -226,7 +226,7 @@ int64_t syncStart(const SSyncInfo *pInfo) {
} }
if (pNode->selfIndex < 0) { if (pNode->selfIndex < 0) {
sInfo("vgId:%d, this node is not configured", pNode->vgId); sError("vgId:%d, this node is not configured", pNode->vgId);
terrno = TSDB_CODE_SYN_INVALID_CONFIG; terrno = TSDB_CODE_SYN_INVALID_CONFIG;
syncStop(pNode->rid); syncStop(pNode->rid);
return -1; return -1;
......
...@@ -242,9 +242,8 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) { ...@@ -242,9 +242,8 @@ int32_t vnodeReadCfg(SVnodeObj *pVnode) {
} }
tstrncpy(node->nodeEp, nodeEp->valuestring, TSDB_EP_LEN); tstrncpy(node->nodeEp, nodeEp->valuestring, TSDB_EP_LEN);
if (!nodeChanged) { bool changed = dnodeCheckEpChanged(node->nodeId, node->nodeEp);
nodeChanged = dnodeCheckEpChanged(node->nodeId, node->nodeEp); if (changed) nodeChanged = changed;
}
} }
ret = TSDB_CODE_SUCCESS; ret = TSDB_CODE_SUCCESS;
......
...@@ -362,9 +362,8 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { ...@@ -362,9 +362,8 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
pVnode->role = TAOS_SYNC_ROLE_MASTER; pVnode->role = TAOS_SYNC_ROLE_MASTER;
#else #else
if (pVnode->sync <= 0) { if (pVnode->sync <= 0) {
vError("vgId:%d, failed to open sync module, replica:%d reason:%s", pVnode->vgId, pVnode->syncCfg.replica, vError("vgId:%d, failed to open sync, replica:%d reason:%s", pVnode->vgId, pVnode->syncCfg.replica,
tstrerror(terrno)); tstrerror(terrno));
vnodeRelease(pVnode);
vnodeCleanUp(pVnode); vnodeCleanUp(pVnode);
return terrno; return terrno;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册