提交 1684f07a 编写于 作者: A Alex Duan

Merge branch '3.0' into test/TD-22889-3.0

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# taos-tools # taos-tools
ExternalProject_Add(taos-tools ExternalProject_Add(taos-tools
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
GIT_TAG d11f210 GIT_TAG 04296a5
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
BINARY_DIR "" BINARY_DIR ""
#BUILD_IN_SOURCE TRUE #BUILD_IN_SOURCE TRUE
......
...@@ -15,14 +15,14 @@ About details of installing TDenine, please refer to [Installation Guide](../../ ...@@ -15,14 +15,14 @@ About details of installing TDenine, please refer to [Installation Guide](../../
## Uninstall ## Uninstall
<Tabs> <Tabs>
<TabItem label="Uninstall apt-get" value="aptremove"> <TabItem label="Uninstall by apt-get" value="aptremove">
Apt-get package of TDengine can be uninstalled as below: Uninstall package of TDengine by apt-get can be uninstalled as below:
```bash ```bash
$ sudo apt-get remove tdengine $ sudo apt-get remove tdengine
Reading package lists... Done Reading package lists... Done
Building dependency tree Building dependency tree
Reading state information... Done Reading state information... Done
The following packages will be REMOVED: The following packages will be REMOVED:
tdengine tdengine
...@@ -35,7 +35,7 @@ TDengine is removed successfully! ...@@ -35,7 +35,7 @@ TDengine is removed successfully!
``` ```
Apt-get package of taosTools can be uninstalled as below: If you have installed taos-tools, please uninstall it first before uninstall TDengine. The command of uninstall is following:
``` ```
$ sudo apt remove taostools $ sudo apt remove taostools
...@@ -168,7 +168,7 @@ Upgrading a running server is much more complex. First please check the version ...@@ -168,7 +168,7 @@ Upgrading a running server is much more complex. First please check the version
- Stop the cluster of TDengine - Stop the cluster of TDengine
- Uninstall old version and install new version - Uninstall old version and install new version
- Start the cluster of TDengine - Start the cluster of TDengine
- Execute simple queries, such as the ones executed prior to installing the new package, to make sure there is no data loss - Execute simple queries, such as the ones executed prior to installing the new package, to make sure there is no data loss
- Run some simple data insertion statements to make sure the cluster works well - Run some simple data insertion statements to make sure the cluster works well
- Restore business services - Restore business services
......
...@@ -223,6 +223,7 @@ int32_t* taosGetErrno(); ...@@ -223,6 +223,7 @@ int32_t* taosGetErrno();
// #define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x033C) // 2.x // #define TSDB_CODE_MND_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x033C) // 2.x
// #define TSDB_CODE_MND_DNODE_ID_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033D) // 2.x // #define TSDB_CODE_MND_DNODE_ID_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033D) // 2.x
// #define TSDB_CODE_MND_DNODE_EP_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033E) // 2.x // #define TSDB_CODE_MND_DNODE_EP_NOT_CONFIGUREDTAOS_DEF_ERROR_CODE(0, 0x033E) // 2.x
#define TSDB_CODE_MND_DNODE_DIFF_CLUSTER TAOS_DEF_ERROR_CODE(0, 0x033F) // internal
// mnode-acct // mnode-acct
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340) #define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0340)
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "mndUser.h" #include "mndUser.h"
#include "mndVgroup.h" #include "mndVgroup.h"
#include "tmisce.h" #include "tmisce.h"
#include "mndCluster.h"
#define TSDB_DNODE_VER_NUMBER 1 #define TSDB_DNODE_VER_NUMBER 1
#define TSDB_DNODE_RESERVE_SIZE 64 #define TSDB_DNODE_RESERVE_SIZE 64
...@@ -366,6 +367,14 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) { ...@@ -366,6 +367,14 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
goto _OVER; goto _OVER;
} }
int64_t clusterid = mndGetClusterId(pMnode);
if (statusReq.clusterId != 0 && statusReq.clusterId != clusterid) {
code = TSDB_CODE_MND_DNODE_DIFF_CLUSTER;
mWarn("dnode:%d, %s, its clusterid:%" PRId64 " differ from current cluster:%" PRId64 ", code:0x%x",
statusReq.dnodeId, statusReq.dnodeEp, statusReq.clusterId, clusterid, code);
goto _OVER;
}
if (statusReq.dnodeId == 0) { if (statusReq.dnodeId == 0) {
pDnode = mndAcquireDnodeByEp(pMnode, statusReq.dnodeEp); pDnode = mndAcquireDnodeByEp(pMnode, statusReq.dnodeEp);
if (pDnode == NULL) { if (pDnode == NULL) {
......
...@@ -1210,14 +1210,19 @@ int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock) { ...@@ -1210,14 +1210,19 @@ int32_t udfAggFinalize(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock) {
fnError("udfAggFinalize error. doCallUdfAggFinalize step. udf code:%d", udfCallCode); fnError("udfAggFinalize error. doCallUdfAggFinalize step. udf code:%d", udfCallCode);
GET_RES_INFO(pCtx)->numOfRes = 0; GET_RES_INFO(pCtx)->numOfRes = 0;
} else { } else {
if (resultBuf.bufLen <= session->bytes) { if (resultBuf.numOfResult == 0) {
memcpy(udfRes->finalResBuf, resultBuf.buf, resultBuf.bufLen); udfRes->finalResNum = 0;
udfRes->finalResNum = resultBuf.numOfResult;
GET_RES_INFO(pCtx)->numOfRes = udfRes->finalResNum;
} else {
fnError("udfc inter buf size %d is greater than function output size %d", resultBuf.bufLen, session->bytes);
GET_RES_INFO(pCtx)->numOfRes = 0; GET_RES_INFO(pCtx)->numOfRes = 0;
udfCallCode = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE; } else {
if (resultBuf.bufLen <= session->bytes) {
memcpy(udfRes->finalResBuf, resultBuf.buf, resultBuf.bufLen);
udfRes->finalResNum = resultBuf.numOfResult;
GET_RES_INFO(pCtx)->numOfRes = udfRes->finalResNum;
} else {
fnError("udfc inter buf size %d is greater than function output size %d", resultBuf.bufLen, session->bytes);
GET_RES_INFO(pCtx)->numOfRes = 0;
udfCallCode = TSDB_CODE_UDF_INVALID_OUTPUT_TYPE;
}
} }
} }
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "syncVoteMgr.h" #include "syncVoteMgr.h"
#include "tglobal.h" #include "tglobal.h"
#include "tref.h" #include "tref.h"
#include "syncUtil.h"
static void syncNodeEqPingTimer(void* param, void* tmrId); static void syncNodeEqPingTimer(void* param, void* tmrId);
static void syncNodeEqElectTimer(void* param, void* tmrId); static void syncNodeEqElectTimer(void* param, void* tmrId);
...@@ -2295,6 +2296,14 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) { ...@@ -2295,6 +2296,14 @@ int32_t syncNodeOnHeartbeat(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
int64_t timeDiff = tsMs - pMsg->timeStamp; int64_t timeDiff = tsMs - pMsg->timeStamp;
syncLogRecvHeartbeat(ths, pMsg, timeDiff, tbuf); syncLogRecvHeartbeat(ths, pMsg, timeDiff, tbuf);
if (!syncNodeInRaftGroup(ths, &pMsg->srcId)) {
sWarn(
"vgId:%d, drop heartbeat msg from dnode:%d, because it come from another cluster:%d, differ from current "
"cluster:%d",
ths->vgId, DID(&(pMsg->srcId)), CID(&(pMsg->srcId)), CID(&(ths->myRaftId)));
return 0;
}
SRpcMsg rpcMsg = {0}; SRpcMsg rpcMsg = {0};
(void)syncBuildHeartbeatReply(&rpcMsg, ths->vgId); (void)syncBuildHeartbeatReply(&rpcMsg, ths->vgId);
SyncTerm currentTerm = raftStoreGetTerm(ths); SyncTerm currentTerm = raftStoreGetTerm(ths);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "syncRaftStore.h" #include "syncRaftStore.h"
#include "syncUtil.h" #include "syncUtil.h"
#include "syncVoteMgr.h" #include "syncVoteMgr.h"
#include "syncUtil.h"
// TLA+ Spec // TLA+ Spec
// HandleRequestVoteRequest(i, j, m) == // HandleRequestVoteRequest(i, j, m) ==
......
...@@ -413,12 +413,16 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) { ...@@ -413,12 +413,16 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) {
} }
#ifdef WINDOWS #ifdef WINDOWS
if (*timep < 0) { if (*timep < 0) {
return NULL;
// TODO: bugs in following code
SYSTEMTIME ss, s; SYSTEMTIME ss, s;
FILETIME ff, f; FILETIME ff, f;
LARGE_INTEGER offset; LARGE_INTEGER offset;
struct tm tm1; struct tm tm1;
time_t tt = 0; time_t tt = 0;
localtime_s(&tm1, &tt); if (localtime_s(&tm1, &tt) != 0 ) {
return NULL;
}
ss.wYear = tm1.tm_year + 1900; ss.wYear = tm1.tm_year + 1900;
ss.wMonth = tm1.tm_mon + 1; ss.wMonth = tm1.tm_mon + 1;
ss.wDay = tm1.tm_mday; ss.wDay = tm1.tm_mday;
...@@ -444,7 +448,9 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) { ...@@ -444,7 +448,9 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) {
result->tm_yday = 0; result->tm_yday = 0;
result->tm_isdst = 0; result->tm_isdst = 0;
} else { } else {
localtime_s(result, timep); if (localtime_s(result, timep) != 0) {
return NULL;
}
} }
#else #else
localtime_r(timep, result); localtime_r(timep, result);
...@@ -469,12 +475,16 @@ struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst) ...@@ -469,12 +475,16 @@ struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst)
} }
#ifdef WINDOWS #ifdef WINDOWS
if (*timep < 0) { if (*timep < 0) {
return NULL;
// TODO: bugs in following code
SYSTEMTIME ss, s; SYSTEMTIME ss, s;
FILETIME ff, f; FILETIME ff, f;
LARGE_INTEGER offset; LARGE_INTEGER offset;
struct tm tm1; struct tm tm1;
time_t tt = 0; time_t tt = 0;
localtime_s(&tm1, &tt); if (localtime_s(&tm1, &tt) != 0) {
return NULL;
}
ss.wYear = tm1.tm_year + 1900; ss.wYear = tm1.tm_year + 1900;
ss.wMonth = tm1.tm_mon + 1; ss.wMonth = tm1.tm_mon + 1;
ss.wDay = tm1.tm_mday; ss.wDay = tm1.tm_mday;
...@@ -500,7 +510,9 @@ struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst) ...@@ -500,7 +510,9 @@ struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst)
result->tm_yday = 0; result->tm_yday = 0;
result->tm_isdst = 0; result->tm_isdst = 0;
} else { } else {
localtime_s(result, timep); if (localtime_s(result, timep) != 0) {
return NULL;
}
} }
#elif defined(LINUX) #elif defined(LINUX)
time_t secsMin = 60, secsHour = 3600, secsDay = 3600 * 24; time_t secsMin = 60, secsHour = 3600, secsDay = 3600 * 24;
......
...@@ -291,7 +291,10 @@ char *shellFormatTimestamp(char *buf, int64_t val, int32_t precision) { ...@@ -291,7 +291,10 @@ char *shellFormatTimestamp(char *buf, int64_t val, int32_t precision) {
} }
struct tm ptm = {0}; struct tm ptm = {0};
taosLocalTime(&tt, &ptm); if (taosLocalTime(&tt, &ptm) == NULL) {
sprintf(buf, "NaN");
return buf;
}
size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm); size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm);
if (precision == TSDB_TIME_PRECISION_NANO) { if (precision == TSDB_TIME_PRECISION_NANO) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册