Merge remote-tracking branch 'origin/develop' into feature/crash_gen
This commit is contained in:
commit
c4b6d4523e
|
@ -2965,14 +2965,28 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
|
|||
assert(pCtx->inputBytes == pCtx->outputBytes);
|
||||
|
||||
for (int32_t i = 0; i < pCtx->size; ++i) {
|
||||
tVariantDump(&pCtx->tag, pCtx->aOutputBuf, pCtx->outputType);
|
||||
char* output = pCtx->aOutputBuf;
|
||||
|
||||
if (pCtx->tag.nType == TSDB_DATA_TYPE_BINARY || pCtx->tag.nType == TSDB_DATA_TYPE_NCHAR) {
|
||||
*(int16_t*) output = pCtx->tag.nLen;
|
||||
output += VARSTR_HEADER_SIZE;
|
||||
}
|
||||
|
||||
tVariantDump(&pCtx->tag, output, pCtx->outputType);
|
||||
pCtx->aOutputBuf += pCtx->outputBytes;
|
||||
}
|
||||
}
|
||||
|
||||
static void tag_project_function_f(SQLFunctionCtx *pCtx, int32_t index) {
|
||||
INC_INIT_VAL(pCtx, 1);
|
||||
tVariantDump(&pCtx->tag, pCtx->aOutputBuf, pCtx->tag.nType);
|
||||
|
||||
char* output = pCtx->aOutputBuf;
|
||||
if (pCtx->tag.nType == TSDB_DATA_TYPE_BINARY || pCtx->tag.nType == TSDB_DATA_TYPE_NCHAR) {
|
||||
*(int16_t*) output = pCtx->tag.nLen;
|
||||
output += VARSTR_HEADER_SIZE;
|
||||
}
|
||||
|
||||
tVariantDump(&pCtx->tag, output, pCtx->tag.nType);
|
||||
pCtx->aOutputBuf += pCtx->outputBytes;
|
||||
}
|
||||
|
||||
|
@ -3007,7 +3021,8 @@ static void tag_function_f(SQLFunctionCtx *pCtx, int32_t index) {
|
|||
*(int16_t*) output = pCtx->tag.nLen;
|
||||
output += VARSTR_HEADER_SIZE;
|
||||
}
|
||||
tVariantDump(&pCtx->tag, pCtx->aOutputBuf, pCtx->tag.nType);
|
||||
|
||||
tVariantDump(&pCtx->tag, output, pCtx->tag.nType);
|
||||
}
|
||||
|
||||
static void copy_function(SQLFunctionCtx *pCtx) {
|
||||
|
|
|
@ -5132,7 +5132,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
|
|||
int16_t colIndex = pColIndex->colIndex;
|
||||
if (colIndex == TSDB_TBNAME_COLUMN_INDEX) {
|
||||
type = TSDB_DATA_TYPE_BINARY;
|
||||
bytes = TSDB_TABLE_NAME_LEN;
|
||||
bytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE; // todo extract method
|
||||
name = TSQL_TBNAME_L;
|
||||
} else {
|
||||
if (TSDB_COL_IS_TAG(pColIndex->flag)) {
|
||||
|
|
|
@ -2134,7 +2134,7 @@ char* tscGetResultColumnChr(SSqlRes* pRes, SQueryInfo* pQueryInfo, int32_t colum
|
|||
if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BINARY) {
|
||||
int32_t realLen = varDataLen(pData);
|
||||
if (realLen < pInfo->pSqlExpr->resBytes - VARSTR_HEADER_SIZE) { // todo refactor
|
||||
*(char*) (pData + realLen + sizeof(int16_t)) = 0;
|
||||
*(char*) (pData + realLen + VARSTR_HEADER_SIZE) = 0;
|
||||
}
|
||||
|
||||
return pData + VARSTR_HEADER_SIZE; // head is the length of binary/nchar data
|
||||
|
|
|
@ -424,8 +424,8 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge) {
|
|||
dataColAppendVal(target->cols + j, tdGetColDataOfRow(source->cols + j, i), target->numOfPoints,
|
||||
target->maxPoints);
|
||||
}
|
||||
target->numOfPoints++;
|
||||
}
|
||||
target->numOfPoints++;
|
||||
} else {
|
||||
pTarget = tdDupDataCols(target, true);
|
||||
if (pTarget == NULL) goto _err;
|
||||
|
|
|
@ -480,7 +480,7 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
|
|||
}
|
||||
#endif
|
||||
|
||||
pShow->bytes[cols] = 24;
|
||||
pShow->bytes[cols] = 24 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "keep1,keep2,keep(D)");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
@ -540,13 +540,13 @@ static int32_t mgmtGetDbMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn)
|
|||
}
|
||||
#endif
|
||||
|
||||
pShow->bytes[cols] = 3;
|
||||
pShow->bytes[cols] = 3 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "precision");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 10;
|
||||
pShow->bytes[cols] = 10 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "status");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
|
|
@ -491,7 +491,7 @@ static int32_t mgmtGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 40;
|
||||
pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "end_point");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
@ -509,7 +509,7 @@ static int32_t mgmtGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 12;
|
||||
pShow->bytes[cols] = 12 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "status");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
@ -609,19 +609,19 @@ static int32_t mgmtGetModuleMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 40;
|
||||
pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "end point");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pShow->bytes[cols] = 8 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "module");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 8;
|
||||
pShow->bytes[cols] = 8 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "status");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
@ -713,13 +713,13 @@ static int32_t mgmtGetConfigMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
|
|||
|
||||
SSchema *pSchema = pMeta->schema;
|
||||
|
||||
pShow->bytes[cols] = TSDB_CFG_OPTION_LEN;
|
||||
pShow->bytes[cols] = TSDB_CFG_OPTION_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "config name");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = TSDB_CFG_VALUE_LEN;
|
||||
pShow->bytes[cols] = TSDB_CFG_VALUE_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "config value");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
@ -806,7 +806,7 @@ static int32_t mgmtGetVnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 12;
|
||||
pShow->bytes[cols] = 12 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "status");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
|
|
@ -295,7 +295,7 @@ static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 12;
|
||||
pShow->bytes[cols] = 12 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "role");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
|
|
@ -458,6 +458,10 @@ static int sdbWrite(void *param, void *data, int type) {
|
|||
// for data from WAL or forward, version may be smaller
|
||||
if (pHead->version <= tsSdbObj.version) {
|
||||
pthread_mutex_unlock(&tsSdbObj.mutex);
|
||||
if (type == TAOS_QTYPE_FWD && tsSdbObj.sync != NULL) {
|
||||
sdbTrace("forward request is received, version:%" PRIu64 " confirm it", pHead->version);
|
||||
syncConfirmForward(tsSdbObj.sync, pHead->version, TSDB_CODE_SUCCESS);
|
||||
}
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else if (pHead->version != tsSdbObj.version + 1) {
|
||||
pthread_mutex_unlock(&tsSdbObj.mutex);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "tutil.h"
|
||||
#include "tglobal.h"
|
||||
#include "tgrant.h"
|
||||
#include "tdataformat.h"
|
||||
#include "dnode.h"
|
||||
#include "mgmtDef.h"
|
||||
#include "mgmtLog.h"
|
||||
|
@ -256,13 +257,13 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon
|
|||
int32_t cols = 0;
|
||||
SSchema *pSchema = pMeta->schema;
|
||||
|
||||
pShow->bytes[cols] = TSDB_USER_LEN;
|
||||
pShow->bytes[cols] = TSDB_USER_LEN + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "name");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 6;
|
||||
pShow->bytes[cols] = 8 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "privilege");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
@ -270,7 +271,7 @@ static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCon
|
|||
|
||||
pShow->bytes[cols] = 8;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
|
||||
strcpy(pSchema[cols].name, "create time");
|
||||
strcpy(pSchema[cols].name, "create_time");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
|
@ -303,16 +304,16 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void
|
|||
cols = 0;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
strcpy(pWrite, pUser->user);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pUser->user, TSDB_USER_LEN);
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
if (pUser->superAuth) {
|
||||
strcpy(pWrite, "super");
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, "super", 5);
|
||||
} else if (pUser->writeAuth) {
|
||||
strcpy(pWrite, "write");
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, "writable", 8);
|
||||
} else {
|
||||
strcpy(pWrite, "read");
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, "readable", 8);
|
||||
}
|
||||
cols++;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "ttime.h"
|
||||
#include "tbalance.h"
|
||||
#include "tglobal.h"
|
||||
#include "tdataformat.h"
|
||||
#include "mgmtDef.h"
|
||||
#include "mgmtLog.h"
|
||||
#include "mgmtDb.h"
|
||||
|
@ -374,9 +375,9 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 9;
|
||||
pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "vgroup status");
|
||||
strcpy(pSchema[cols].name, "vgroup_status");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
|
@ -409,13 +410,13 @@ int32_t mgmtGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
|
|||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 40;
|
||||
pShow->bytes[cols] = 40 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "end point");
|
||||
strcpy(pSchema[cols].name, "end_point");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
cols++;
|
||||
|
||||
pShow->bytes[cols] = 9;
|
||||
pShow->bytes[cols] = 9 + VARSTR_HEADER_SIZE;
|
||||
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
|
||||
strcpy(pSchema[cols].name, "vstatus");
|
||||
pSchema[cols].bytes = htons(pShow->bytes[cols]);
|
||||
|
@ -475,7 +476,8 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo
|
|||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
strcpy(pWrite, pVgroup->status ? "updating" : "ready");
|
||||
char* status = pVgroup->status? "updating" : "ready";
|
||||
STR_TO_VARSTR(pWrite, status);
|
||||
cols++;
|
||||
|
||||
for (int32_t i = 0; i < maxReplica; ++i) {
|
||||
|
@ -487,18 +489,20 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo
|
|||
|
||||
if (pDnode != NULL) {
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
strncpy(pWrite, pDnode->dnodeEp, pShow->bytes[cols]-1);
|
||||
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDnode->dnodeEp, pShow->bytes[cols] - VARSTR_HEADER_SIZE);
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
strcpy(pWrite, mgmtGetMnodeRoleStr(pVgroup->vnodeGid[i].role));
|
||||
status = mgmtGetMnodeRoleStr(pVgroup->vnodeGid[i].role);
|
||||
STR_TO_VARSTR(pWrite, status);
|
||||
cols++;
|
||||
} else {
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
strcpy(pWrite, "null");
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4);
|
||||
cols++;
|
||||
|
||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||
strcpy(pWrite, "null");
|
||||
STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4);
|
||||
cols++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1427,7 +1427,7 @@ static int32_t setupQueryRuntimeEnv(SQueryRuntimeEnv *pRuntimeEnv, int16_t order
|
|||
int32_t index = pSqlFuncMsg->colInfo.colIndex;
|
||||
if (TSDB_COL_IS_TAG(pIndex->flag)) {
|
||||
if (pIndex->colId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||
pCtx->inputBytes = TSDB_TABLE_NAME_LEN;
|
||||
pCtx->inputBytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE;
|
||||
pCtx->inputType = TSDB_DATA_TYPE_BINARY;
|
||||
} else {
|
||||
pCtx->inputBytes = pQuery->tagColList[index].bytes;
|
||||
|
@ -5528,7 +5528,7 @@ static int32_t createSqlFunctionExprFromMsg(SQueryTableMsg *pQueryMsg, SExprInfo
|
|||
bytes = tDataTypeDesc[type].nSize;
|
||||
} else if (pExprs[i].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) { // parse the normal column
|
||||
type = TSDB_DATA_TYPE_BINARY;
|
||||
bytes = TSDB_TABLE_NAME_LEN;
|
||||
bytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE;
|
||||
} else{
|
||||
int32_t j = getColumnIndexInSource(pQueryMsg, &pExprs[i].base, pTagCols);
|
||||
assert(j < pQueryMsg->numOfCols || j < pQueryMsg->numOfTags);
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
#include "rpcCache.h"
|
||||
#include "rpcTcp.h"
|
||||
#include "rpcHead.h"
|
||||
#include "shash.h"
|
||||
|
||||
|
||||
#define RPC_MSG_OVERHEAD (sizeof(SRpcReqContext) + sizeof(SRpcHead) + sizeof(SRpcDigest))
|
||||
#define rpcHeadFromCont(cont) ((SRpcHead *) (cont - sizeof(SRpcHead)))
|
||||
|
@ -262,9 +260,7 @@ void *rpcOpen(const SRpcInit *pInit) {
|
|||
}
|
||||
|
||||
if (pRpc->connType == TAOS_CONN_SERVER) {
|
||||
pRpc->hash = taosInitStrHash(pRpc->sessions, sizeof(pRpc), taosHashString);
|
||||
|
||||
// pRpc->hash = taosHashInit(pRpc->sessions, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true);
|
||||
pRpc->hash = taosHashInit(pRpc->sessions, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true);
|
||||
if (pRpc->hash == NULL) {
|
||||
tError("%s failed to init string hash", pRpc->label);
|
||||
rpcClose(pRpc);
|
||||
|
@ -298,8 +294,7 @@ void rpcClose(void *param) {
|
|||
(*taosCleanUpConn[pRpc->connType | RPC_CONN_TCP])(pRpc->tcphandle);
|
||||
(*taosCleanUpConn[pRpc->connType])(pRpc->udphandle);
|
||||
|
||||
// taosHashCleanup(pRpc->hash);
|
||||
taosCleanUpStrHash(pRpc->hash);
|
||||
taosHashCleanup(pRpc->hash);
|
||||
taosTmrCleanUp(pRpc->tmrCtrl);
|
||||
taosIdPoolCleanUp(pRpc->idPool);
|
||||
rpcCloseConnCache(pRpc->pCache);
|
||||
|
@ -548,9 +543,8 @@ static void rpcCloseConn(void *thandle) {
|
|||
|
||||
if ( pRpc->connType == TAOS_CONN_SERVER) {
|
||||
char hashstr[40] = {0};
|
||||
/*size_t size = */sprintf(hashstr, "%x:%x:%x:%d", pConn->peerIp, pConn->linkUid, pConn->peerId, pConn->connType);
|
||||
// taosHashRemove(pRpc->hash, hashstr, size);
|
||||
taosDeleteStrHash(pRpc->hash, hashstr);
|
||||
size_t size = sprintf(hashstr, "%x:%x:%x:%d", pConn->peerIp, pConn->linkUid, pConn->peerId, pConn->connType);
|
||||
taosHashRemove(pRpc->hash, hashstr, size);
|
||||
|
||||
rpcFreeMsg(pConn->pRspMsg); // it may have a response msg saved, but not request msg
|
||||
pConn->pRspMsg = NULL;
|
||||
|
@ -599,12 +593,10 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
|
|||
char hashstr[40] = {0};
|
||||
SRpcHead *pHead = (SRpcHead *)pRecv->msg;
|
||||
|
||||
/*size_t size = */sprintf(hashstr, "%x:%x:%x:%d", pRecv->ip, pHead->linkUid, pHead->sourceId, pRecv->connType);
|
||||
size_t size = sprintf(hashstr, "%x:%x:%x:%d", pRecv->ip, pHead->linkUid, pHead->sourceId, pRecv->connType);
|
||||
|
||||
// check if it is already allocated
|
||||
SRpcConn **ppConn = (SRpcConn **)(taosGetStrHashData(pRpc->hash, hashstr));
|
||||
|
||||
// SRpcConn **ppConn = (SRpcConn **)(taosHashGet(pRpc->hash, hashstr, size));
|
||||
SRpcConn **ppConn = (SRpcConn **)(taosHashGet(pRpc->hash, hashstr, size));
|
||||
if (ppConn) pConn = *ppConn;
|
||||
if (pConn) return pConn;
|
||||
|
||||
|
@ -638,10 +630,7 @@ static SRpcConn *rpcAllocateServerConn(SRpcInfo *pRpc, SRecvInfo *pRecv) {
|
|||
pConn->localPort = (pRpc->localPort + pRpc->index);
|
||||
}
|
||||
|
||||
taosAddStrHash(pRpc->hash, hashstr, (char *)&pConn);
|
||||
|
||||
// taosHashPut(pRpc->hash, hashstr, size, (char *)&pConn, POINTER_BYTES);
|
||||
|
||||
taosHashPut(pRpc->hash, hashstr, size, (char *)&pConn, POINTER_BYTES);
|
||||
tTrace("%s %p, rpc connection is allocated, sid:%d id:%s port:%u",
|
||||
pRpc->label, pConn, sid, pConn->user, pConn->localPort);
|
||||
}
|
||||
|
@ -803,6 +792,7 @@ static SRpcConn *rpcProcessMsgHead(SRpcInfo *pRpc, SRecvInfo *pRecv) {
|
|||
sid = pConn->sid;
|
||||
|
||||
pConn->chandle = pRecv->chandle;
|
||||
pConn->peerIp = pRecv->ip;
|
||||
if (pConn->peerPort == 0) pConn->peerPort = pRecv->port;
|
||||
if (pHead->port) pConn->peerPort = htons(pHead->port);
|
||||
|
||||
|
|
|
@ -49,19 +49,22 @@ sleep 2000
|
|||
|
||||
sql alter user read privilege read
|
||||
sql show users
|
||||
if $data1_read != read then
|
||||
print $data1_read
|
||||
if $data1_read != readable then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error alter user read privilege super
|
||||
sql show users
|
||||
if $data1_read != read then
|
||||
print $data1_read
|
||||
if $data1_read != readable then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql alter user read privilege write
|
||||
sql show users
|
||||
if $data1_read != write then
|
||||
print $data1_read
|
||||
if $data1_read != writable then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -49,19 +49,21 @@ sleep 2000
|
|||
|
||||
sql alter user read privilege read
|
||||
sql show users
|
||||
if $data1_read != read then
|
||||
print $data1_read
|
||||
if $data1_read != readable then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error alter user read privilege super
|
||||
sql show users
|
||||
if $data1_read != read then
|
||||
print $data1_read
|
||||
if $data1_read != readable then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql alter user read privilege write
|
||||
sql show users
|
||||
if $data1_read != write then
|
||||
if $data1_read != writable then
|
||||
return -1
|
||||
endi
|
||||
|
||||
|
|
|
@ -438,22 +438,25 @@ sleep 1000
|
|||
print ============================== step17
|
||||
print ========= check data
|
||||
|
||||
sql reset query cache
|
||||
sleep 1000
|
||||
|
||||
sql use c_b1_d1
|
||||
sql select * from c_b1_t1
|
||||
if $rows != 0 then
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d2
|
||||
sql select * from c_b1_t2
|
||||
if $rows == 0 then
|
||||
if $rows == 6 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d3
|
||||
sql select * from c_b1_t3 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $rows != 1 then
|
||||
if $rows != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 36 then
|
||||
|
@ -540,30 +543,11 @@ if $data41 != 85 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d9
|
||||
sql select * from c_b1_t9 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 91 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 92 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 93 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 94 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 95 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================================ over
|
||||
#system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
|
||||
#system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
|
||||
#system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
|
||||
#system sh/exec_up.sh -n dnode5 -s stop -x SIGINT
|
||||
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
|
||||
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
|
||||
system sh/exec_up.sh -n dnode5 -s stop -x SIGINT
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,23 +7,28 @@ GREEN_DARK='\033[0;32m'
|
|||
GREEN_UNDERLINE='\033[4;32m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo "### run TSIM script ###"
|
||||
cd script
|
||||
./test.sh -f basicSuite.sim 2>&1 | grep 'success\|failed\|fault' | tee out.txt
|
||||
./test.sh -f basicSuite.sim 2>&1 | grep 'success\|failed\|fault' | grep -v 'default' | tee out.txt
|
||||
|
||||
totalSuccess=`grep -w 'success' out.txt | wc -l`
|
||||
totalSuccess=`grep 'success' out.txt | wc -l`
|
||||
totalBasic=`grep success out.txt | grep Suite | wc -l`
|
||||
|
||||
if [ "$totalSuccess" -gt "0" ]; then
|
||||
totalSuccess=`expr $totalSuccess - $totalBasic`
|
||||
echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}"
|
||||
fi
|
||||
|
||||
totalFailed=`grep -w 'failed\|fault' out.txt | wc -l`
|
||||
echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}"
|
||||
|
||||
totalFailed=`grep 'failed\|fault' out.txt | wc -l`
|
||||
echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
|
||||
|
||||
if [ "$totalFailed" -ne "0" ]; then
|
||||
echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
|
||||
# echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
|
||||
exit $totalFailed
|
||||
fi
|
||||
|
||||
echo "### run Python script ###"
|
||||
cd ../pytest
|
||||
|
||||
if [ "$1" == "cron" ]; then
|
||||
|
|
|
@ -733,6 +733,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
|
|||
break;
|
||||
case TSDB_DATA_TYPE_BINARY:
|
||||
case TSDB_DATA_TYPE_NCHAR:
|
||||
memset(value, 0, MAX_QUERY_VALUE_LEN);
|
||||
memcpy(value, row[i], fields[i].bytes);
|
||||
value[fields[i].bytes] = 0;
|
||||
// snprintf(value, fields[i].bytes, "%s", (char *)row[i]);
|
||||
|
|
Loading…
Reference in New Issue