Merge branch 'develop' into feature/2.0tsdb

This commit is contained in:
hzcheng 2020-05-12 01:39:31 +00:00
commit d5d6785383
76 changed files with 932 additions and 911 deletions

View File

@ -49,7 +49,7 @@ matrix:
./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $? ./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $?
cd ${TRAVIS_BUILD_DIR}/tests/pytest cd ${TRAVIS_BUILD_DIR}/tests/pytest
./smoketest.sh -g 2>&1 | tee mem-error-out.txt ./valgrind-test.sh -g 2>&1 | tee mem-error-out.txt
sleep 1 sleep 1
# Color setting # Color setting
@ -115,7 +115,7 @@ matrix:
# The command that will be added as an argument to "cov-build" to compile your project for analysis, # The command that will be added as an argument to "cov-build" to compile your project for analysis,
# ** likely specific to your build ** # ** likely specific to your build **
build_command: make > /dev/null build_command: make
# Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'. # Pattern to match selecting branches that will run analysis. We recommend leaving this set to 'coverity_scan'.
# Take care in resource usage, and consider the build frequency allowances per # Take care in resource usage, and consider the build frequency allowances per
@ -163,11 +163,9 @@ matrix:
cd ${TRAVIS_BUILD_DIR}/tests cd ${TRAVIS_BUILD_DIR}/tests
./test-all.sh ./test-all.sh $TRAVIS_EVENT_TYPE COVER
if [ "$?" -ne "0" ]; then TEST_RESULT=$?
travis_terminate $?
fi
pkill taosd pkill taosd
sleep 1 sleep 1
@ -199,6 +197,9 @@ matrix:
echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} " echo -e "${RED} ## Codecov did not collect coverage report! ## ${NC} "
fi fi
if [ "$TEST_RESULT" -ne "0" ]; then
travis_terminate $?
fi
;; ;;
esac esac

View File

@ -121,7 +121,7 @@ TDengine provides abundant developing tools for users to develop on TDengine. Fo
1. sudo apt install 1. sudo apt install
build-essential cmake net-tools python-pip python-setuptools python3-pip build-essential cmake net-tools python-pip python-setuptools python3-pip
python3-setuptools valgrind python3-setuptools valgrind psmisc curl
2. git clone <https://github.com/taosdata/TDengine>; cd TDengine 2. git clone <https://github.com/taosdata/TDengine>; cd TDengine

View File

@ -365,7 +365,7 @@ void tscInitMsgsFp();
int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion); int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion);
void tscProcessMsgFromServer(SRpcMsg *rpcMsg); void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet);
int tscProcessSql(SSqlObj *pSql); int tscProcessSql(SSqlObj *pSql);
int tscRenewMeterMeta(SSqlObj *pSql, char *tableId); int tscRenewMeterMeta(SSqlObj *pSql, char *tableId);

View File

@ -1691,10 +1691,7 @@ static void last_function(SQLFunctionCtx *pCtx) {
} }
static void last_function_f(SQLFunctionCtx *pCtx, int32_t index) { static void last_function_f(SQLFunctionCtx *pCtx, int32_t index) {
if (pCtx->order == TSDB_ORDER_ASC) { assert(pCtx->order != TSDB_ORDER_ASC);
return;
}
void *pData = GET_INPUT_CHAR_INDEX(pCtx, index); void *pData = GET_INPUT_CHAR_INDEX(pCtx, index);
if (pCtx->hasNull && isNull(pData, pCtx->inputType)) { if (pCtx->hasNull && isNull(pData, pCtx->inputType)) {
return; return;
@ -2912,7 +2909,7 @@ static void leastsquares_finalizer(SQLFunctionCtx *pCtx) {
} }
static void date_col_output_function(SQLFunctionCtx *pCtx) { static void date_col_output_function(SQLFunctionCtx *pCtx) {
if (pCtx->scanFlag == SUPPLEMENTARY_SCAN) { if (pCtx->scanFlag == REVERSE_SCAN) {
return; return;
} }
@ -2969,11 +2966,12 @@ static void tag_project_function(SQLFunctionCtx *pCtx) {
char* output = pCtx->aOutputBuf; char* output = pCtx->aOutputBuf;
if (pCtx->tag.nType == TSDB_DATA_TYPE_BINARY || pCtx->tag.nType == TSDB_DATA_TYPE_NCHAR) { if (pCtx->tag.nType == TSDB_DATA_TYPE_BINARY || pCtx->tag.nType == TSDB_DATA_TYPE_NCHAR) {
*(int16_t*) output = pCtx->tag.nLen; varDataSetLen(output, pCtx->tag.nLen);
output += VARSTR_HEADER_SIZE; tVariantDump(&pCtx->tag, varDataVal(output), pCtx->outputType);
} else {
tVariantDump(&pCtx->tag, output, pCtx->outputType);
} }
tVariantDump(&pCtx->tag, output, pCtx->outputType);
pCtx->aOutputBuf += pCtx->outputBytes; pCtx->aOutputBuf += pCtx->outputBytes;
} }
} }

View File

@ -5563,8 +5563,8 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
} }
*(VarDataLenT*)tagVal = pList->a[i].pVar.nLen; ret = tVariantDump(&(pList->a[i].pVar), varDataVal(tagVal), pTagSchema[i].type);
ret = tVariantDump(&(pList->a[i].pVar), tagVal + VARSTR_HEADER_SIZE, pTagSchema[i].type); varDataSetLen(tagVal, pList->a[i].pVar.nLen);
} else { } else {
ret = tVariantDump(&(pList->a[i].pVar), tagVal, pTagSchema[i].type); ret = tVariantDump(&(pList->a[i].pVar), tagVal, pTagSchema[i].type);
} }
@ -5911,7 +5911,7 @@ int32_t exprTreeFromSqlExpr(tExprNode **pExpr, const tSQLExpr* pSqlExpr, SArray*
} }
if (pSqlExpr->pLeft == NULL) { if (pSqlExpr->pLeft == NULL) {
if (pSqlExpr->nSQLOptr >= TK_TINYINT && pSqlExpr->nSQLOptr <= TK_DOUBLE) { if (pSqlExpr->nSQLOptr >= TK_BOOL && pSqlExpr->nSQLOptr <= TK_STRING) {
*pExpr = calloc(1, sizeof(tExprNode)); *pExpr = calloc(1, sizeof(tExprNode));
(*pExpr)->nodeType = TSQL_NODE_VALUE; (*pExpr)->nodeType = TSQL_NODE_VALUE;
(*pExpr)->pVal = calloc(1, sizeof(tVariant)); (*pExpr)->pVal = calloc(1, sizeof(tVariant));

View File

@ -221,7 +221,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
void tscProcessMsgFromServer(SRpcMsg *rpcMsg) { void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
SSqlObj *pSql = (SSqlObj *)rpcMsg->handle; SSqlObj *pSql = (SSqlObj *)rpcMsg->handle;
if (pSql == NULL) { if (pSql == NULL) {
tscError("%p sql is already released", pSql->signature); tscError("%p sql is already released", pSql->signature);
@ -245,6 +245,12 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg) {
return; return;
} }
if (pCmd->command < TSDB_SQL_MGMT) {
if (pIpSet) pSql->ipList = *pIpSet;
} else {
if (pIpSet) tscMgmtIpSet = *pIpSet;
}
if (rpcMsg->pCont == NULL) { if (rpcMsg->pCont == NULL) {
rpcMsg->code = TSDB_CODE_NETWORK_UNAVAIL; rpcMsg->code = TSDB_CODE_NETWORK_UNAVAIL;
} else { } else {
@ -492,13 +498,15 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg += sizeof(pQueryInfo->type); pMsg += sizeof(pQueryInfo->type);
// todo valid the vgroupId at the client side // todo valid the vgroupId at the client side
if (UTIL_TABLE_IS_SUPERTABLE(pQueryInfo->pTableMetaInfo[0])) { STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
SVgroupsInfo* pVgroupInfo = pQueryInfo->pTableMetaInfo[0]->vgroupList;
assert(pVgroupInfo->numOfVgroups == 1); // todo fix me if (UTIL_TABLE_IS_SUPERTABLE(pTableMetaInfo)) {
int32_t vgIndex = pTableMetaInfo->vgroupIndex;
pRetrieveMsg->header.vgId = htonl(pVgroupInfo->vgroups[0].vgId); SVgroupsInfo* pVgroupInfo = pTableMetaInfo->vgroupList;
pRetrieveMsg->header.vgId = htonl(pVgroupInfo->vgroups[vgIndex].vgId);
} else { } else {
STableMeta* pTableMeta = pQueryInfo->pTableMetaInfo[0]->pTableMeta; STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
pRetrieveMsg->header.vgId = htonl(pTableMeta->vgroupInfo.vgId); pRetrieveMsg->header.vgId = htonl(pTableMeta->vgroupInfo.vgId);
} }

View File

@ -1436,8 +1436,8 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
return; return;
} else { // reach the maximum retry count, abort } else { // reach the maximum retry count, abort
atomic_val_compare_exchange_32(&pState->code, TSDB_CODE_SUCCESS, numOfRows); atomic_val_compare_exchange_32(&pState->code, TSDB_CODE_SUCCESS, numOfRows);
tscError("%p sub:%p retrieve failed,code:%d,orderOfSub:%d failed.no more retry,set global code:%d", pPObj, pSql, tscError("%p sub:%p retrieve failed,code:%s,orderOfSub:%d failed.no more retry,set global code:%s", pPObj, pSql,
numOfRows, subqueryIndex, tstrerror(pState->code)); tstrerror(numOfRows), subqueryIndex, tstrerror(pState->code));
} }
} }
@ -1450,7 +1450,7 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
} }
// all subqueries are failed // all subqueries are failed
tscError("%p retrieve from %d vnode(s) completed,code:%d.FAILED.", pPObj, pState->numOfTotal, pState->code); tscError("%p retrieve from %d vnode(s) completed,code:%s.FAILED.", pPObj, pState->numOfTotal, tstrerror(pState->code));
pPObj->res.code = pState->code; pPObj->res.code = pState->code;
// release allocated resource // release allocated resource

View File

@ -1675,10 +1675,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST
pTableMetaInfo->pTableMeta = pTableMeta; pTableMetaInfo->pTableMeta = pTableMeta;
if (vgroupList != NULL) { if (vgroupList != NULL) {
assert(vgroupList->numOfVgroups == 1); // todo fix me
size_t size = sizeof(SVgroupsInfo) + sizeof(SCMVgroupInfo) * vgroupList->numOfVgroups; size_t size = sizeof(SVgroupsInfo) + sizeof(SCMVgroupInfo) * vgroupList->numOfVgroups;
pTableMetaInfo->vgroupList = malloc(size); pTableMetaInfo->vgroupList = malloc(size);
memcpy(pTableMetaInfo->vgroupList, vgroupList, size); memcpy(pTableMetaInfo->vgroupList, vgroupList, size);
} }

View File

@ -115,10 +115,8 @@ static FORCE_INLINE void *tdGetRowDataOfCol(SDataRow row, int8_t type, int32_t o
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
return POINTER_SHIFT(row, *(VarDataOffsetT *)POINTER_SHIFT(row, offset)); return POINTER_SHIFT(row, *(VarDataOffsetT *)POINTER_SHIFT(row, offset));
break;
default: default:
return POINTER_SHIFT(row, offset); return POINTER_SHIFT(row, offset);
break;
} }
} }

View File

@ -266,9 +266,12 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
return taosCfgDynamicOptions(pCfg->config); return taosCfgDynamicOptions(pCfg->config);
} }
void dnodeUpdateIpSet(SRpcIpSet *pIpSet) {
dPrint("mnode IP list is changed, numOfIps:%d inUse:%d", pIpSet->numOfIps, pIpSet->inUse);
for (int i = 0; i < pIpSet->numOfIps; ++i) {
dPrint("mnode index:%d %s:%u", i, pIpSet->fqdn[i], pIpSet->port[i])
}
void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet) {
dTrace("mgmt IP list is changed for ufp is called");
tsMnodeIpSet = *pIpSet; tsMnodeIpSet = *pIpSet;
} }

View File

@ -29,11 +29,11 @@
#include "dnodeVWrite.h" #include "dnodeVWrite.h"
#include "mnode.h" #include "mnode.h"
extern void dnodeUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet); extern void dnodeUpdateIpSet(SRpcIpSet *pIpSet);
static void (*dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); static void (*dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *);
static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg); static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *);
static void (*dnodeProcessRspMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg); static void (*dnodeProcessRspMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *rpcMsg);
static void dnodeProcessRspFromDnode(SRpcMsg *pMsg); static void dnodeProcessRspFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet);
static void *tsDnodeServerRpc = NULL; static void *tsDnodeServerRpc = NULL;
static void *tsDnodeClientRpc = NULL; static void *tsDnodeClientRpc = NULL;
@ -81,7 +81,7 @@ void dnodeCleanupServer() {
} }
} }
static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg) { static void dnodeProcessReqMsgFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SRpcMsg rspMsg; SRpcMsg rspMsg;
rspMsg.handle = pMsg->handle; rspMsg.handle = pMsg->handle;
rspMsg.pCont = NULL; rspMsg.pCont = NULL;
@ -119,7 +119,6 @@ int32_t dnodeInitClient() {
rpcInit.label = "DND-C"; rpcInit.label = "DND-C";
rpcInit.numOfThreads = 1; rpcInit.numOfThreads = 1;
rpcInit.cfp = dnodeProcessRspFromDnode; rpcInit.cfp = dnodeProcessRspFromDnode;
rpcInit.ufp = dnodeUpdateIpSet;
rpcInit.sessions = 100; rpcInit.sessions = 100;
rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.connType = TAOS_CONN_CLIENT;
rpcInit.idleTime = tsShellActivityTimer * 1000; rpcInit.idleTime = tsShellActivityTimer * 1000;
@ -145,9 +144,10 @@ void dnodeCleanupClient() {
} }
} }
static void dnodeProcessRspFromDnode(SRpcMsg *pMsg) { static void dnodeProcessRspFromDnode(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
if (dnodeProcessRspMsgFp[pMsg->msgType]) { if (dnodeProcessRspMsgFp[pMsg->msgType]) {
if (pMsg->msgType == TSDB_MSG_TYPE_DM_STATUS_RSP && pIpSet) dnodeUpdateIpSet(pIpSet);
(*dnodeProcessRspMsgFp[pMsg->msgType])(pMsg); (*dnodeProcessRspMsgFp[pMsg->msgType])(pMsg);
} else { } else {
dError("RPC %p, msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]); dError("RPC %p, msg:%s is not processed", pMsg->handle, taosMsg[pMsg->msgType]);

View File

@ -28,7 +28,7 @@
#include "dnodeShell.h" #include "dnodeShell.h"
static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *); static void (*dnodeProcessShellMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *);
static void dnodeProcessMsgFromShell(SRpcMsg *pMsg); static void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *);
static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey); static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char *secret, char *ckey);
static void * tsDnodeShellRpc = NULL; static void * tsDnodeShellRpc = NULL;
static int32_t tsDnodeQueryReqNum = 0; static int32_t tsDnodeQueryReqNum = 0;
@ -106,7 +106,7 @@ void dnodeCleanupShell() {
} }
} }
void dnodeProcessMsgFromShell(SRpcMsg *pMsg) { void dnodeProcessMsgFromShell(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SRpcMsg rpcMsg; SRpcMsg rpcMsg;
rpcMsg.handle = pMsg->handle; rpcMsg.handle = pMsg->handle;
rpcMsg.pCont = NULL; rpcMsg.pCont = NULL;

View File

@ -36,6 +36,11 @@ extern "C" {
typedef int32_t VarDataOffsetT; typedef int32_t VarDataOffsetT;
typedef int16_t VarDataLenT; typedef int16_t VarDataLenT;
typedef struct tstr {
VarDataLenT len;
char data[];
} tstr;
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT) #define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0] #define varDataLen(v) ((VarDataLenT *)(v))[0]
@ -74,10 +79,10 @@ extern const int32_t TYPE_BYTES[11];
#define TSDB_DATA_NULL_STR "NULL" #define TSDB_DATA_NULL_STR "NULL"
#define TSDB_DATA_NULL_STR_L "null" #define TSDB_DATA_NULL_STR_L "null"
#define TSDB_TRUE 1 #define TSDB_TRUE 1
#define TSDB_FALSE 0 #define TSDB_FALSE 0
#define TSDB_OK 0 #define TSDB_OK 0
#define TSDB_ERR -1 #define TSDB_ERR -1
#define TS_PATH_DELIMITER "." #define TS_PATH_DELIMITER "."

View File

@ -66,10 +66,7 @@ typedef struct {
char *ckey; // ciphering key char *ckey; // ciphering key
// call back to process incoming msg, code shall be ignored by server app // call back to process incoming msg, code shall be ignored by server app
void (*cfp)(SRpcMsg *); void (*cfp)(SRpcMsg *, SRpcIpSet *);
// call back to process notify the ipSet changes, for client app only
void (*ufp)(void *ahandle, SRpcIpSet *pIpSet);
// call back to retrieve the client auth info, for server app only // call back to retrieve the client auth info, for server app only
int (*afp)(char *tableId, char *spi, char *encrypt, char *secret, char *ckey); int (*afp)(char *tableId, char *spi, char *encrypt, char *secret, char *ckey);

View File

@ -102,7 +102,7 @@ int tsdbTableSetSName(STableCfg *config, char *sname, bool dup);
void tsdbClearTableCfg(STableCfg *config); void tsdbClearTableCfg(STableCfg *config);
int32_t tsdbGetTableTagVal(TsdbRepoT *repo, STableId* id, int32_t colId, int16_t *type, int16_t *bytes, char **val); int32_t tsdbGetTableTagVal(TsdbRepoT *repo, STableId* id, int32_t colId, int16_t *type, int16_t *bytes, char **val);
int32_t tsdbGetTableName(TsdbRepoT *repo, STableId* id, char** name); char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes);
int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg); int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg);
int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId); int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId);

View File

@ -85,8 +85,7 @@ typedef struct SSuperTableObj {
int32_t numOfTables; int32_t numOfTables;
int16_t nextColId; int16_t nextColId;
SSchema * schema; SSchema * schema;
int32_t vgLen; void * vgHash;
int32_t * vgList;
} SSuperTableObj; } SSuperTableObj;
typedef struct { typedef struct {

View File

@ -297,8 +297,10 @@ static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) {
if (pDb != NULL) { if (pDb != NULL) {
mgmtDecDbRef(pDb); mgmtDecDbRef(pDb);
if (pCreate->ignoreExist) { if (pCreate->ignoreExist) {
mTrace("db:%s, already exist, ignore exist is set", pCreate->db);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { } else {
mError("db:%s, is already exist, ignore exist not set", pCreate->db);
return TSDB_CODE_DB_ALREADY_EXIST; return TSDB_CODE_DB_ALREADY_EXIST;
} }
} }
@ -751,6 +753,8 @@ static void mgmtProcessCreateDbMsg(SQueuedMsg *pMsg) {
code = mgmtCreateDb(pMsg->pUser->pAcct, pCreate); code = mgmtCreateDb(pMsg->pUser->pAcct, pCreate);
if (code == TSDB_CODE_SUCCESS) { if (code == TSDB_CODE_SUCCESS) {
mLPrint("db:%s, is created by %s", pCreate->db, pMsg->pUser->user); mLPrint("db:%s, is created by %s", pCreate->db, pMsg->pUser->user);
} else {
mError("db:%s, failed to create, reason:%s", pCreate->db, tstrerror(code));
} }
} }

View File

@ -24,6 +24,7 @@
#include "tname.h" #include "tname.h"
#include "tidpool.h" #include "tidpool.h"
#include "tglobal.h" #include "tglobal.h"
#include "hash.h"
#include "dnode.h" #include "dnode.h"
#include "mgmtDef.h" #include "mgmtDef.h"
#include "mgmtInt.h" #include "mgmtInt.h"
@ -363,39 +364,35 @@ static void mgmtCleanUpChildTables() {
} }
static void mgmtAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) { static void mgmtAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) {
if (pStable->vgLen == 0) {
pStable->vgLen = 8;
pStable->vgList = calloc(pStable->vgLen, sizeof(int32_t));
}
bool find = false;
int32_t pos = 0;
for (pos = 0; pos < pStable->vgLen; ++pos) {
if (pStable->vgList[pos] == 0) break;
if (pStable->vgList[pos] == pCtable->vgId) {
find = true;
break;
}
}
if (!find) {
if (pos >= pStable->vgLen) {
pStable->vgLen *= 2;
pStable->vgList = realloc(pStable->vgList, pStable->vgLen * sizeof(int32_t));
}
pStable->vgList[pos] = pCtable->vgId;
}
pStable->numOfTables++; pStable->numOfTables++;
if (pStable->vgHash == NULL) {
pStable->vgHash = taosHashInit(32, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false);
}
if (pStable->vgHash != NULL) {
taosHashPut(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId), &pCtable->vgId, sizeof(pCtable->vgId));
}
} }
static void mgmtRemoveTableFromStable(SSuperTableObj *pStable, SChildTableObj *pCtable) { static void mgmtRemoveTableFromStable(SSuperTableObj *pStable, SChildTableObj *pCtable) {
pStable->numOfTables--; pStable->numOfTables--;
if (pStable->vgHash == NULL) return;
SVgObj *pVgroup = mgmtGetVgroup(pCtable->vgId);
if (pVgroup != NULL) {
taosHashRemove(pStable->vgHash, (char *)&pCtable->vgId, sizeof(pCtable->vgId));
}
mgmtDecVgroupRef(pVgroup);
} }
static void mgmtDestroySuperTable(SSuperTableObj *pStable) { static void mgmtDestroySuperTable(SSuperTableObj *pStable) {
if (pStable->vgHash != NULL) {
taosHashCleanup(pStable->vgHash);
pStable->vgHash = NULL;
}
tfree(pStable->schema); tfree(pStable->schema);
tfree(pStable->vgList)
tfree(pStable); tfree(pStable);
} }
@ -434,7 +431,7 @@ static int32_t mgmtSuperTableActionUpdate(SSdbOper *pOper) {
void *oldSchema = pTable->schema; void *oldSchema = pTable->schema;
memcpy(pTable, pNew, pOper->rowSize); memcpy(pTable, pNew, pOper->rowSize);
pTable->schema = pNew->schema; pTable->schema = pNew->schema;
free(pNew->vgList); free(pNew->vgHash);
free(pNew); free(pNew);
free(oldSchema); free(oldSchema);
} }
@ -797,26 +794,26 @@ static void mgmtProcessCreateSuperTableMsg(SQueuedMsg *pMsg) {
static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) { static void mgmtProcessDropSuperTableMsg(SQueuedMsg *pMsg) {
SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable; SSuperTableObj *pStable = (SSuperTableObj *)pMsg->pTable;
if (pStable->numOfTables != 0) { if (pStable->numOfTables != 0) {
mgmtDropAllChildTablesInStable(pStable); SHashMutableIterator *pIter = taosHashCreateIter(pStable->vgHash);
for (int32_t vg = 0; vg < pStable->vgLen; ++vg) { while (taosHashIterNext(pIter)) {
int32_t vgId = pStable->vgList[vg]; int32_t *pVgId = taosHashIterGet(pIter);
if (vgId == 0) break; SVgObj *pVgroup = mgmtGetVgroup(*pVgId);
SVgObj *pVgroup = mgmtGetVgroup(vgId);
if (pVgroup == NULL) break; if (pVgroup == NULL) break;
SMDDropSTableMsg *pDrop = rpcMallocCont(sizeof(SMDDropSTableMsg)); SMDDropSTableMsg *pDrop = rpcMallocCont(sizeof(SMDDropSTableMsg));
pDrop->contLen = htonl(sizeof(SMDDropSTableMsg)); pDrop->contLen = htonl(sizeof(SMDDropSTableMsg));
pDrop->vgId = htonl(vgId); pDrop->vgId = htonl(pVgroup->vgId);
pDrop->uid = htobe64(pStable->uid); pDrop->uid = htobe64(pStable->uid);
mgmtExtractTableName(pStable->info.tableId, pDrop->tableId); mgmtExtractTableName(pStable->info.tableId, pDrop->tableId);
mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, vgId); mPrint("stable:%s, send drop stable msg to vgId:%d", pStable->info.tableId, pVgroup->vgId);
SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup); SRpcIpSet ipSet = mgmtGetIpSetFromVgroup(pVgroup);
SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE}; SRpcMsg rpcMsg = {.pCont = pDrop, .contLen = sizeof(SMDDropSTableMsg), .msgType = TSDB_MSG_TYPE_MD_DROP_STABLE};
dnodeSendMsgToDnode(&ipSet, &rpcMsg); dnodeSendMsgToDnode(&ipSet, &rpcMsg);
mgmtDecVgroupRef(pVgroup); mgmtDecVgroupRef(pVgroup);
} }
mgmtDropAllChildTablesInStable(pStable);
} }
SSdbOper oper = { SSdbOper oper = {
@ -1243,59 +1240,58 @@ static void mgmtGetSuperTableMeta(SQueuedMsg *pMsg) {
static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) { static void mgmtProcessSuperTableVgroupMsg(SQueuedMsg *pMsg) {
SCMSTableVgroupMsg *pInfo = pMsg->pCont; SCMSTableVgroupMsg *pInfo = pMsg->pCont;
int32_t numOfTable = htonl(pInfo->numOfTables); int32_t numOfTable = htonl(pInfo->numOfTables);
char* name = (char*) pInfo + sizeof(struct SCMSTableVgroupMsg); // reserve space
SCMSTableVgroupRspMsg *pRsp = NULL; int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + 32 * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo);
for (int32_t i = 0; i < numOfTable; ++i) {
// todo set the initial size to be 10, fix me char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i;
int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + (sizeof(SCMVgroupInfo) * 10 + sizeof(SVgroupsInfo))*numOfTable; SSuperTableObj *pTable = mgmtGetSuperTable(stableName);
if (pTable->vgHash != NULL) {
pRsp = rpcMallocCont(contLen); contLen += (taosHashGetSize(pTable->vgHash) * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo));
}
mgmtDecTableRef(pTable);
}
SCMSTableVgroupRspMsg *pRsp = rpcMallocCont(contLen);
if (pRsp == NULL) { if (pRsp == NULL) {
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY); mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_SERV_OUT_OF_MEMORY);
return; return;
} }
pRsp->numOfTables = htonl(numOfTable); pRsp->numOfTables = htonl(numOfTable);
char* msg = (char*) pRsp + sizeof(SCMSTableVgroupRspMsg); char* msg = (char*) pRsp + sizeof(SCMSTableVgroupRspMsg);
for(int32_t i = 0; i < numOfTable; ++i) { for (int32_t i = 0; i < numOfTable; ++i) {
SSuperTableObj *pTable = mgmtGetSuperTable(name); char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_ID_LEN) * i;
SSuperTableObj *pTable = mgmtGetSuperTable(stableName);
pMsg->pTable = (STableObj *)pTable; SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg;
if (pMsg->pTable == NULL) {
mgmtSendSimpleResp(pMsg->thandle, TSDB_CODE_INVALID_TABLE); SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash);
return; int32_t vgSize = 0;
} while (taosHashIterNext(pIter)) {
int32_t *pVgId = taosHashIterGet(pIter);
SVgroupsInfo* pVgroup = (SVgroupsInfo*) msg; SVgObj * pVgroup = mgmtGetVgroup(*pVgId);
if (pVgroup == NULL) continue;
int32_t vg = 0;
for (; vg < pTable->vgLen; ++vg) { pVgroupInfo->vgroups[vgSize].vgId = htonl(pVgroup->vgId);
int32_t vgId = pTable->vgList[vg]; for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) {
if (vgId == 0) break; SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode;
SVgObj *vgItem = mgmtGetVgroup(vgId);
if (vgItem == NULL) break;
pVgroup->vgroups[vg].vgId = htonl(vgId);
for (int32_t vn = 0; vn < vgItem->numOfVnodes; ++vn) {
SDnodeObj *pDnode = vgItem->vnodeGid[vn].pDnode;
if (pDnode == NULL) break; if (pDnode == NULL) break;
strncpy(pVgroup->vgroups[vg].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn)); strncpy(pVgroupInfo->vgroups[vgSize].ipAddr[vn].fqdn, pDnode->dnodeFqdn, tListLen(pDnode->dnodeFqdn));
pVgroup->vgroups[vg].ipAddr[vn].port = htons(tsDnodeShellPort); pVgroupInfo->vgroups[vgSize].ipAddr[vn].port = htons(tsDnodeShellPort);
pVgroup->vgroups[vg].numOfIps++; pVgroupInfo->vgroups[vgSize].numOfIps++;
} }
mgmtDecVgroupRef(vgItem); vgSize++;
mgmtDecVgroupRef(pVgroup);
} }
pVgroup->numOfVgroups = htonl(vg); pVgroupInfo->numOfVgroups = htonl(vgSize);
// one table is done, try the next table // one table is done, try the next table
msg += sizeof(SVgroupsInfo) + vg * sizeof(SCMVgroupInfo); msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo);
} }
SRpcMsg rpcRsp = {0}; SRpcMsg rpcRsp = {0};

View File

@ -110,6 +110,14 @@ typedef struct STableQueryInfo { // todo merge with the STableQueryInfo struct
SWindowResInfo windowResInfo; SWindowResInfo windowResInfo;
} STableQueryInfo; } STableQueryInfo;
typedef struct SQueryCostSummary {
} SQueryCostSummary;
typedef struct SGroupItem {
STableId id;
STableQueryInfo* info;
} SGroupItem;
typedef struct SQuery { typedef struct SQuery {
int16_t numOfCols; int16_t numOfCols;
int16_t numOfTags; int16_t numOfTags;
@ -131,17 +139,15 @@ typedef struct SQuery {
SColumnInfo* tagColList; SColumnInfo* tagColList;
int32_t numOfFilterCols; int32_t numOfFilterCols;
int64_t* defaultVal; int64_t* defaultVal;
TSKEY lastKey; // TSKEY lastKey;
uint32_t status; // query status uint32_t status; // query status
SResultRec rec; SResultRec rec;
int32_t pos; int32_t pos;
SData** sdata; SData** sdata;
STableQueryInfo* current;
SSingleColumnFilterInfo* pFilterInfo; SSingleColumnFilterInfo* pFilterInfo;
} SQuery; } SQuery;
typedef struct SQueryCostSummary {
} SQueryCostSummary;
typedef struct SQueryRuntimeEnv { typedef struct SQueryRuntimeEnv {
SResultInfo* resultInfo; // todo refactor to merge with SWindowResInfo SResultInfo* resultInfo; // todo refactor to merge with SWindowResInfo
SQuery* pQuery; SQuery* pQuery;

View File

@ -104,7 +104,7 @@ extern "C" {
enum { enum {
MASTER_SCAN = 0x0u, MASTER_SCAN = 0x0u,
SUPPLEMENTARY_SCAN = 0x1u, REVERSE_SCAN = 0x1u,
REPEAT_SCAN = 0x2u, //repeat scan belongs to the master scan REPEAT_SCAN = 0x2u, //repeat scan belongs to the master scan
FIRST_STAGE_MERGE = 0x10u, FIRST_STAGE_MERGE = 0x10u,
SECONDARY_STAGE_MERGE = 0x20u, SECONDARY_STAGE_MERGE = 0x20u,

View File

@ -540,8 +540,11 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) {
static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) { static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) {
SSkipListIterator* iter = NULL; SSkipListIterator* iter = NULL;
SQueryCond cond = {0}; SQueryCond cond = {0};
setQueryCond(pQueryInfo, &cond); if (setQueryCond(pQueryInfo, &cond) != TSDB_CODE_SUCCESS) {
//todo handle error
}
if (cond.start != NULL) { if (cond.start != NULL) {
iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC); iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC);
@ -552,18 +555,18 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr
if (cond.start != NULL) { if (cond.start != NULL) {
int32_t optr = cond.start->optr; int32_t optr = cond.start->optr;
if (optr == TSDB_RELATION_EQUAL) { if (optr == TSDB_RELATION_EQUAL) { // equals
while(tSkipListIterNext(iter)) { while(tSkipListIterNext(iter)) {
SSkipListNode* pNode = tSkipListIterGet(iter); SSkipListNode* pNode = tSkipListIterGet(iter);
int32_t ret = pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v); int32_t ret = pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v);
if (ret == 0) { if (ret != 0) {
taosArrayPush(result, SL_GET_NODE_DATA(pNode));
} else {
break; break;
} }
taosArrayPush(result, SL_GET_NODE_DATA(pNode));
} }
} else if (optr == TSDB_RELATION_GREATER || optr == TSDB_RELATION_GREATER_EQUAL) { } else if (optr == TSDB_RELATION_GREATER || optr == TSDB_RELATION_GREATER_EQUAL) { // greater equal
bool comp = true; bool comp = true;
int32_t ret = 0; int32_t ret = 0;
@ -582,8 +585,33 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr
comp = false; comp = false;
} }
} }
} else if (optr == TSDB_RELATION_NOT_EQUAL) { } else if (optr == TSDB_RELATION_NOT_EQUAL) { // not equal
assert(0); bool comp = true;
while(tSkipListIterNext(iter)) {
SSkipListNode* pNode = tSkipListIterGet(iter);
comp = comp && (pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v) == 0);
if (comp) {
continue;
}
taosArrayPush(result, SL_GET_NODE_DATA(pNode));
}
tSkipListDestroyIter(iter);
comp = true;
iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_DESC);
while(tSkipListIterNext(iter)) {
SSkipListNode* pNode = tSkipListIterGet(iter);
comp = comp && (pQueryInfo->compare(SL_GET_NODE_KEY(pSkipList, pNode), cond.start->v) == 0);
if (comp) {
continue;
}
taosArrayPush(result, SL_GET_NODE_DATA(pNode));
}
} else { } else {
assert(0); assert(0);
} }
@ -773,8 +801,6 @@ static void tSQLBinaryTraverseOnSkipList(tExprNode *pExpr, SArray *pResult, SSki
tSkipListDestroyIter(iter); tSkipListDestroyIter(iter);
} }
static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) { static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) {
SSkipListIterator* iter = tSkipListCreateIter(pSkipList); SSkipListIterator* iter = tSkipListCreateIter(pSkipList);
@ -785,7 +811,7 @@ static void tQueryIndexlessColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo,
char* pTable = SL_GET_NODE_DATA(pNode); char* pTable = SL_GET_NODE_DATA(pNode);
//todo refactor: //todo refactor:
char* name = (*(STable**) pTable)->name; tstr* name = ((STableIndexElem*) pTable)->pTable->name;
// char* name = NULL; // char* name = NULL;
// tsdbGetTableName(tsdb, pTable, &name); // tsdbGetTableName(tsdb, pTable, &name);

File diff suppressed because it is too large Load Diff

View File

@ -389,6 +389,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
return 0; return 0;
} }
// todo handle the error
static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
char tmpBuf[40] = {0}; char tmpBuf[40] = {0};
@ -424,7 +425,12 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
pVariant->wpz = (wchar_t *)tmp; pVariant->wpz = (wchar_t *)tmp;
} else { } else {
taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE, NULL); size_t output = -1;
taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE, &output);
if (pDestSize != NULL) {
*pDestSize = output;
}
} }
return 0; return 0;
@ -779,7 +785,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, char type) {
} }
case TSDB_DATA_TYPE_NCHAR: { case TSDB_DATA_TYPE_NCHAR: {
if (pVariant->nType == TSDB_DATA_TYPE_NULL) { if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
*(uint32_t *)payload = TSDB_DATA_NCHAR_NULL; *(uint32_t *) payload = TSDB_DATA_NCHAR_NULL;
} else { } else {
if (pVariant->nType != TSDB_DATA_TYPE_NCHAR) { if (pVariant->nType != TSDB_DATA_TYPE_NCHAR) {
toNchar(pVariant, &payload, &pVariant->nLen); toNchar(pVariant, &payload, &pVariant->nLen);

View File

@ -55,9 +55,8 @@ typedef struct {
char secret[TSDB_KEY_LEN]; // secret for the link char secret[TSDB_KEY_LEN]; // secret for the link
char ckey[TSDB_KEY_LEN]; // ciphering key char ckey[TSDB_KEY_LEN]; // ciphering key
void (*cfp)(SRpcMsg *); void (*cfp)(SRpcMsg *, SRpcIpSet *);
int (*afp)(char *user, char *spi, char *encrypt, char *secret, char *ckey); int (*afp)(char *user, char *spi, char *encrypt, char *secret, char *ckey);
void (*ufp)(void *ahandle, SRpcIpSet *pIpSet);
void *idPool; // handle to ID pool void *idPool; // handle to ID pool
void *tmrCtrl; // handle to timer void *tmrCtrl; // handle to timer
@ -222,7 +221,6 @@ void *rpcOpen(const SRpcInit *pInit) {
if (pInit->secret) strcpy(pRpc->secret, pInit->secret); if (pInit->secret) strcpy(pRpc->secret, pInit->secret);
if (pInit->ckey) strcpy(pRpc->ckey, pInit->ckey); if (pInit->ckey) strcpy(pRpc->ckey, pInit->ckey);
pRpc->spi = pInit->spi; pRpc->spi = pInit->spi;
pRpc->ufp = pInit->ufp;
pRpc->cfp = pInit->cfp; pRpc->cfp = pInit->cfp;
pRpc->afp = pInit->afp; pRpc->afp = pInit->afp;
@ -900,10 +898,11 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) {
memcpy(pContext->pRsp, pMsg, sizeof(SRpcMsg)); memcpy(pContext->pRsp, pMsg, sizeof(SRpcMsg));
} else { } else {
// for asynchronous API // for asynchronous API
if (pRpc->ufp && (pContext->ipSet.inUse != pContext->oldInUse || pContext->redirect)) SRpcIpSet *pIpSet = NULL;
(*pRpc->ufp)(pContext->ahandle, &pContext->ipSet); // notify the update of ipSet if (pContext->ipSet.inUse != pContext->oldInUse || pContext->redirect)
pIpSet = &pContext->ipSet;
(*pRpc->cfp)(pMsg); (*pRpc->cfp)(pMsg, pIpSet);
} }
// free the request message // free the request message
@ -924,7 +923,7 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
if ( rpcIsReq(pHead->msgType) ) { if ( rpcIsReq(pHead->msgType) ) {
rpcMsg.handle = pConn; rpcMsg.handle = pConn;
taosTmrReset(rpcProcessProgressTimer, tsRpcTimer/2, pConn, pRpc->tmrCtrl, &pConn->pTimer); taosTmrReset(rpcProcessProgressTimer, tsRpcTimer/2, pConn, pRpc->tmrCtrl, &pConn->pTimer);
(*(pRpc->cfp))(&rpcMsg); (*(pRpc->cfp))(&rpcMsg, NULL);
} else { } else {
// it's a response // it's a response
SRpcReqContext *pContext = pConn->pContext; SRpcReqContext *pContext = pConn->pContext;

View File

@ -31,22 +31,16 @@ typedef struct {
void *pRpc; void *pRpc;
} SInfo; } SInfo;
static void processResponse(SRpcMsg *pMsg) { static void processResponse(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SInfo *pInfo = (SInfo *)pMsg->handle; SInfo *pInfo = (SInfo *)pMsg->handle;
tTrace("thread:%d, response is received, type:%d contLen:%d code:0x%x", pInfo->index, pMsg->msgType, pMsg->contLen, pMsg->code); tTrace("thread:%d, response is received, type:%d contLen:%d code:0x%x", pInfo->index, pMsg->msgType, pMsg->contLen, pMsg->code);
if (pIpSet) pInfo->ipSet = *pIpSet;
rpcFreeCont(pMsg->pCont); rpcFreeCont(pMsg->pCont);
sem_post(&pInfo->rspSem); sem_post(&pInfo->rspSem);
} }
static void processUpdateIpSet(void *handle, SRpcIpSet *pIpSet) {
SInfo *pInfo = (SInfo *)handle;
tTrace("thread:%d, ip set is changed, index:%d", pInfo->index, pIpSet->inUse);
pInfo->ipSet = *pIpSet;
}
static int tcount = 0; static int tcount = 0;
static void *sendRequest(void *param) { static void *sendRequest(void *param) {
@ -99,7 +93,6 @@ int main(int argc, char *argv[]) {
rpcInit.label = "APP"; rpcInit.label = "APP";
rpcInit.numOfThreads = 1; rpcInit.numOfThreads = 1;
rpcInit.cfp = processResponse; rpcInit.cfp = processResponse;
rpcInit.ufp = processUpdateIpSet;
rpcInit.sessions = 100; rpcInit.sessions = 100;
rpcInit.idleTime = tsShellActivityTimer*1000; rpcInit.idleTime = tsShellActivityTimer*1000;
rpcInit.user = "michael"; rpcInit.user = "michael";

View File

@ -32,12 +32,6 @@ typedef struct {
void *pRpc; void *pRpc;
} SInfo; } SInfo;
static void processUpdateIpSet(void *handle, SRpcIpSet *pIpSet) {
SInfo *pInfo = (SInfo *)handle;
tTrace("thread:%d, ip set is changed, index:%d", pInfo->index, pIpSet->inUse);
pInfo->ipSet = *pIpSet;
}
static int tcount = 0; static int tcount = 0;
static int terror = 0; static int terror = 0;
@ -100,8 +94,6 @@ int main(int argc, char *argv[]) {
rpcInit.localPort = 0; rpcInit.localPort = 0;
rpcInit.label = "APP"; rpcInit.label = "APP";
rpcInit.numOfThreads = 1; rpcInit.numOfThreads = 1;
// rpcInit.cfp = processResponse;
rpcInit.ufp = processUpdateIpSet;
rpcInit.sessions = 100; rpcInit.sessions = 100;
rpcInit.idleTime = tsShellActivityTimer*1000; rpcInit.idleTime = tsShellActivityTimer*1000;
rpcInit.user = "michael"; rpcInit.user = "michael";

View File

@ -113,7 +113,7 @@ int retrieveAuthInfo(char *meterId, char *spi, char *encrypt, char *secret, char
return ret; return ret;
} }
void processRequestMsg(SRpcMsg *pMsg) { void processRequestMsg(SRpcMsg *pMsg, SRpcIpSet *pIpSet) {
SRpcMsg *pTemp; SRpcMsg *pTemp;
pTemp = taosAllocateQitem(sizeof(SRpcMsg)); pTemp = taosAllocateQitem(sizeof(SRpcMsg));

View File

@ -81,7 +81,6 @@ typedef struct {
// ---------- TSDB TABLE DEFINITION // ---------- TSDB TABLE DEFINITION
typedef struct STable { typedef struct STable {
int8_t type; int8_t type;
char * name;
STableId tableId; STableId tableId;
int64_t superUid; // Super table UID int64_t superUid; // Super table UID
int32_t sversion; int32_t sversion;
@ -96,9 +95,10 @@ typedef struct STable {
TSKEY lastKey; // lastkey inserted in this table, initialized as 0, TODO: make a structure TSKEY lastKey; // lastkey inserted in this table, initialized as 0, TODO: make a structure
struct STable *next; // TODO: remove the next struct STable *next; // TODO: remove the next
struct STable *prev; struct STable *prev;
tstr * name; // NOTE: there a flexible string here
} STable; } STable;
#define TSDB_GET_TABLE_LAST_KEY(pTable) ((pTable)->lastKey) #define TSDB_GET_TABLE_LAST_KEY(tb) ((tb)->lastKey)
void * tsdbEncodeTable(STable *pTable, int *contLen); void * tsdbEncodeTable(STable *pTable, int *contLen);
STable *tsdbDecodeTable(void *cont, int contLen); STable *tsdbDecodeTable(void *cont, int contLen);
@ -121,6 +121,12 @@ typedef struct {
int maxCols; int maxCols;
} STsdbMeta; } STsdbMeta;
// element put in skiplist for each table
typedef struct STableIndexElem {
STsdbMeta* pMeta;
STable* pTable;
} STableIndexElem;
STsdbMeta *tsdbInitMeta(char *rootDir, int32_t maxTables); STsdbMeta *tsdbInitMeta(char *rootDir, int32_t maxTables);
int32_t tsdbFreeMeta(STsdbMeta *pMeta); int32_t tsdbFreeMeta(STsdbMeta *pMeta);
STSchema * tsdbGetTableSchema(STsdbMeta *pMeta, STable *pTable); STSchema * tsdbGetTableSchema(STsdbMeta *pMeta, STable *pTable);
@ -150,7 +156,7 @@ int32_t tsdbDropTableImpl(STsdbMeta *pMeta, STableId tableId);
STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId); STable *tsdbIsValidTableToInsert(STsdbMeta *pMeta, STableId tableId);
// int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable); // int32_t tsdbInsertRowToTableImpl(SSkipListNode *pNode, STable *pTable);
STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid); STable *tsdbGetTableByUid(STsdbMeta *pMeta, int64_t uid);
char * getTupleKey(const void *data); char *getTSTupleKey(const void * data);
typedef struct { typedef struct {
int blockId; int blockId;

View File

@ -809,7 +809,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
if (pTable->mem == NULL) { if (pTable->mem == NULL) {
pTable->mem = (SMemTable *)calloc(1, sizeof(SMemTable)); pTable->mem = (SMemTable *)calloc(1, sizeof(SMemTable));
if (pTable->mem == NULL) return -1; if (pTable->mem == NULL) return -1;
pTable->mem->pData = tSkipListCreate(5, TSDB_DATA_TYPE_TIMESTAMP, TYPE_BYTES[TSDB_DATA_TYPE_TIMESTAMP], 0, 0, 0, getTupleKey); pTable->mem->pData = tSkipListCreate(5, TSDB_DATA_TYPE_TIMESTAMP, TYPE_BYTES[TSDB_DATA_TYPE_TIMESTAMP], 0, 0, 0, getTSTupleKey);
pTable->mem->keyFirst = INT64_MAX; pTable->mem->keyFirst = INT64_MAX;
pTable->mem->keyLast = 0; pTable->mem->keyLast = 0;
} }
@ -832,7 +832,7 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
if (pTable->mem == NULL) { if (pTable->mem == NULL) {
pTable->mem = (SMemTable *)calloc(1, sizeof(SMemTable)); pTable->mem = (SMemTable *)calloc(1, sizeof(SMemTable));
if (pTable->mem == NULL) return -1; if (pTable->mem == NULL) return -1;
pTable->mem->pData = tSkipListCreate(5, TSDB_DATA_TYPE_TIMESTAMP, TYPE_BYTES[TSDB_DATA_TYPE_TIMESTAMP], 0, 0, 0, getTupleKey); pTable->mem->pData = tSkipListCreate(5, TSDB_DATA_TYPE_TIMESTAMP, TYPE_BYTES[TSDB_DATA_TYPE_TIMESTAMP], 0, 0, 0, getTSTupleKey);
pTable->mem->keyFirst = INT64_MAX; pTable->mem->keyFirst = INT64_MAX;
pTable->mem->keyLast = 0; pTable->mem->keyLast = 0;
} }

View File

@ -1,6 +1,4 @@
#include <stdlib.h> #include <stdlib.h>
// #include "taosdef.h"
#include "tskiplist.h" #include "tskiplist.h"
#include "tsdb.h" #include "tsdb.h"
#include "taosdef.h" #include "taosdef.h"
@ -10,6 +8,8 @@
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here #define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
#define TSDB_META_FILE_NAME "META" #define TSDB_META_FILE_NAME "META"
const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; // skip list built based on the first column of tags
static int tsdbFreeTable(STable *pTable); static int tsdbFreeTable(STable *pTable);
static int32_t tsdbCheckTableCfg(STableCfg *pCfg); static int32_t tsdbCheckTableCfg(STableCfg *pCfg);
static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx); static int tsdbAddTableToMeta(STsdbMeta *pMeta, STable *pTable, bool addIdx);
@ -39,11 +39,12 @@ void *tsdbEncodeTable(STable *pTable, int *contLen) {
void *ptr = ret; void *ptr = ret;
T_APPEND_MEMBER(ptr, pTable, STable, type); T_APPEND_MEMBER(ptr, pTable, STable, type);
// Encode name // Encode name, todo refactor
*(int *)ptr = strlen(pTable->name); *(int *)ptr = varDataLen(pTable->name);
ptr = (char *)ptr + sizeof(int); ptr = (char *)ptr + sizeof(int);
memcpy(ptr, pTable->name, strlen(pTable->name)); memcpy(ptr, varDataVal(pTable->name), varDataLen(pTable->name));
ptr = (char *)ptr + strlen(pTable->name); ptr = (char *)ptr + varDataLen(pTable->name);
T_APPEND_MEMBER(ptr, &(pTable->tableId), STableId, uid); T_APPEND_MEMBER(ptr, &(pTable->tableId), STableId, uid);
T_APPEND_MEMBER(ptr, &(pTable->tableId), STableId, tid); T_APPEND_MEMBER(ptr, &(pTable->tableId), STableId, tid);
T_APPEND_MEMBER(ptr, pTable, STable, superUid); T_APPEND_MEMBER(ptr, pTable, STable, superUid);
@ -79,9 +80,12 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
T_READ_MEMBER(ptr, int8_t, pTable->type); T_READ_MEMBER(ptr, int8_t, pTable->type);
int len = *(int *)ptr; int len = *(int *)ptr;
ptr = (char *)ptr + sizeof(int); ptr = (char *)ptr + sizeof(int);
pTable->name = calloc(1, len + 1); pTable->name = calloc(1, len + VARSTR_HEADER_SIZE);
if (pTable->name == NULL) return NULL; if (pTable->name == NULL) return NULL;
memcpy(pTable->name, ptr, len);
varDataSetLen(pTable->name, len);
memcpy(pTable->name->data, ptr, len);
ptr = (char *)ptr + len; ptr = (char *)ptr + len;
T_READ_MEMBER(ptr, int64_t, pTable->tableId.uid); T_READ_MEMBER(ptr, int64_t, pTable->tableId.uid);
T_READ_MEMBER(ptr, int32_t, pTable->tableId.tid); T_READ_MEMBER(ptr, int32_t, pTable->tableId.tid);
@ -105,8 +109,13 @@ void tsdbFreeEncode(void *cont) {
} }
static char* getTagIndexKey(const void* pData) { static char* getTagIndexKey(const void* pData) {
STable* table = *(STable**) pData; STableIndexElem* elem = (STableIndexElem*) pData;
return getTupleKey(table->tagVal);
SDataRow row = elem->pTable->tagVal;
STSchema* pSchema = tsdbGetTableTagSchema(elem->pMeta, elem->pTable);
STColumn* pCol = &pSchema->columns[DEFAULT_TAG_INDEX_COLUMN];
return tdGetRowDataOfCol(row, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset);
} }
int tsdbRestoreTable(void *pHandle, void *cont, int contLen) { int tsdbRestoreTable(void *pHandle, void *cont, int contLen) {
@ -225,36 +234,28 @@ STSchema * tsdbGetTableTagSchema(STsdbMeta *pMeta, STable *pTable) {
} }
} }
// todo refactor table name definition
int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t* type, int16_t* bytes, char** val) { int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t* type, int16_t* bytes, char** val) {
STsdbMeta* pMeta = tsdbGetMeta(repo); STsdbMeta* pMeta = tsdbGetMeta(repo);
STable* pTable = tsdbGetTableByUid(pMeta, id->uid); STable* pTable = tsdbGetTableByUid(pMeta, id->uid);
STSchema* pSchema = tsdbGetTableTagSchema(pMeta, pTable); STSchema* pSchema = tsdbGetTableTagSchema(pMeta, pTable);
STColumn* pCol = NULL; STColumn* pCol = NULL;
int32_t offset = 0;
for(int32_t col = 0; col < schemaNCols(pSchema); ++col) { for(int32_t col = 0; col < schemaNCols(pSchema); ++col) {
STColumn* p = schemaColAt(pSchema, col); STColumn* p = schemaColAt(pSchema, col);
if (p->colId == colId) { if (p->colId == colId) {
pCol = p; pCol = p;
break; break;
} }
if (p->type == TSDB_DATA_TYPE_BINARY || p->type == TSDB_DATA_TYPE_NCHAR) {
offset += sizeof(int32_t);
} else {
offset += p->bytes;
}
} }
if (pCol == NULL) { if (pCol == NULL) {
return -1; // No matched tags. Maybe the modification of tags has not been done yet. return -1; // No matched tags. Maybe the modification of tags has not been done yet.
} }
assert(pCol != NULL);
SDataRow row = (SDataRow)pTable->tagVal; SDataRow row = (SDataRow)pTable->tagVal;
char* d = tdGetRowDataOfCol(row, pCol->type, TD_DATA_ROW_HEAD_SIZE + offset); char* d = tdGetRowDataOfCol(row, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset);
*val = d; *val = d;
*type = pCol->type; *type = pCol->type;
@ -263,15 +264,22 @@ int32_t tsdbGetTableTagVal(TsdbRepoT* repo, STableId* id, int32_t colId, int16_t
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t tsdbGetTableName(TsdbRepoT *repo, STableId* id, char** name) { char* tsdbGetTableName(TsdbRepoT *repo, const STableId* id, int16_t* bytes) {
STsdbMeta* pMeta = tsdbGetMeta(repo); STsdbMeta* pMeta = tsdbGetMeta(repo);
STable* pTable = tsdbGetTableByUid(pMeta, id->uid); STable* pTable = tsdbGetTableByUid(pMeta, id->uid);
*name = strndup(pTable->name, TSDB_TABLE_NAME_LEN); if (pTable == NULL) {
if (*name == NULL) { if (bytes != NULL) {
return -1; *bytes = 0;
}
return NULL;
} else { } else {
return 0; if (bytes != NULL) {
*bytes = varDataLen(pTable->name);
}
return (char*) pTable->name;
} }
} }
@ -296,7 +304,11 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
super->schema = tdDupSchema(pCfg->schema); super->schema = tdDupSchema(pCfg->schema);
super->tagSchema = tdDupSchema(pCfg->tagSchema); super->tagSchema = tdDupSchema(pCfg->tagSchema);
super->tagVal = NULL; super->tagVal = NULL;
super->name = strdup(pCfg->sname);
// todo refactor extract method
size_t size = strnlen(pCfg->sname, TSDB_TABLE_NAME_LEN);
super->name = malloc(size + VARSTR_HEADER_SIZE);
STR_WITH_SIZE_TO_VARSTR(super->name, pCfg->sname, size);
// index the first tag column // index the first tag column
STColumn* pColSchema = schemaColAt(super->tagSchema, 0); STColumn* pColSchema = schemaColAt(super->tagSchema, 0);
@ -322,7 +334,11 @@ int32_t tsdbCreateTableImpl(STsdbMeta *pMeta, STableCfg *pCfg) {
} }
table->tableId = pCfg->tableId; table->tableId = pCfg->tableId;
table->name = strdup(pCfg->name);
size_t size = strnlen(pCfg->name, TSDB_TABLE_NAME_LEN);
table->name = malloc(size + VARSTR_HEADER_SIZE);
STR_WITH_SIZE_TO_VARSTR(table->name, pCfg->name, size);
table->lastKey = 0; table->lastKey = 0;
if (IS_CREATE_STABLE(pCfg)) { // TSDB_CHILD_TABLE if (IS_CREATE_STABLE(pCfg)) { // TSDB_CHILD_TABLE
table->type = TSDB_CHILD_TABLE; table->type = TSDB_CHILD_TABLE;
@ -513,11 +529,14 @@ static int tsdbAddTableIntoIndex(STsdbMeta *pMeta, STable *pTable) {
// NOTE: do not allocate the space for key, since in each skip list node, only keep the pointer to pTable, not the // NOTE: do not allocate the space for key, since in each skip list node, only keep the pointer to pTable, not the
// actual key value, and the key value will be retrieved during query through the pTable and getTagIndexKey function // actual key value, and the key value will be retrieved during query through the pTable and getTagIndexKey function
SSkipListNode* pNode = calloc(1, headSize + POINTER_BYTES); SSkipListNode* pNode = calloc(1, headSize + sizeof(STableIndexElem));
pNode->level = level; pNode->level = level;
SSkipList* list = pSTable->pIndex; SSkipList* list = pSTable->pIndex;
memcpy(SL_GET_NODE_DATA(pNode), &pTable, POINTER_BYTES); STableIndexElem* elem = (STableIndexElem*) (SL_GET_NODE_DATA(pNode));
elem->pTable = pTable;
elem->pMeta = pMeta;
tSkipListPut(list, pNode); tSkipListPut(list, pNode);
return 0; return 0;
@ -529,7 +548,10 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid); STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid);
assert(pSTable != NULL); assert(pSTable != NULL);
char* key = dataRowTuple(pTable->tagVal); // key STSchema* pSchema = tsdbGetTableTagSchema(pMeta, pTable);
STColumn* pCol = &pSchema->columns[DEFAULT_TAG_INDEX_COLUMN];
char* key = tdGetRowDataOfCol(pTable->tagVal, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset);
bool ret = tSkipListRemove(pSTable->pIndex, key); bool ret = tSkipListRemove(pSTable->pIndex, key);
assert(ret); assert(ret);
@ -539,7 +561,7 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
static int tsdbEstimateTableEncodeSize(STable *pTable) { static int tsdbEstimateTableEncodeSize(STable *pTable) {
int size = 0; int size = 0;
size += T_MEMBER_SIZE(STable, type); size += T_MEMBER_SIZE(STable, type);
size += sizeof(int) + strlen(pTable->name); size += sizeof(int) + varDataLen(pTable->name);
size += T_MEMBER_SIZE(STable, tableId); size += T_MEMBER_SIZE(STable, tableId);
size += T_MEMBER_SIZE(STable, superUid); size += T_MEMBER_SIZE(STable, superUid);
size += T_MEMBER_SIZE(STable, sversion); size += T_MEMBER_SIZE(STable, sversion);
@ -556,8 +578,7 @@ static int tsdbEstimateTableEncodeSize(STable *pTable) {
return size; return size;
} }
char *getTupleKey(const void * data) { char *getTSTupleKey(const void * data) {
SDataRow row = (SDataRow)data; SDataRow row = (SDataRow)data;
return POINTER_SHIFT(row, TD_DATA_ROW_HEAD_SIZE); return POINTER_SHIFT(row, TD_DATA_ROW_HEAD_SIZE);
} }

View File

@ -620,9 +620,13 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
if (pCol->info.type != TSDB_DATA_TYPE_BINARY && pCol->info.type != TSDB_DATA_TYPE_NCHAR) { if (pCol->info.type != TSDB_DATA_TYPE_BINARY && pCol->info.type != TSDB_DATA_TYPE_NCHAR) {
memmove(pCol->pData, src->pData + bytes * start, bytes * pQueryHandle->realNumOfRows); memmove(pCol->pData, src->pData + bytes * start, bytes * pQueryHandle->realNumOfRows);
} else { // handle the var-string } else { // handle the var-string
char* dst = pCol->pData;
// todo refactor, only copy one-by-one
for(int32_t k = start; k < pQueryHandle->realNumOfRows + start; ++k) { for(int32_t k = start; k < pQueryHandle->realNumOfRows + start; ++k) {
char* p = tdGetColDataOfRow(src, k); char* p = tdGetColDataOfRow(src, k);
memcpy(pCol->pData + k * bytes, p, varDataTLen(p)); // todo refactor memcpy(dst, p, varDataTLen(p));
dst += bytes;
} }
} }
@ -1076,17 +1080,13 @@ static int tsdbReadRowsFromCache(SSkipListIterator* pIter, STable* pTable, TSKEY
} }
assert(offset != -1); // todo handle error assert(offset != -1); // todo handle error
void *value = tdGetRowDataOfCol(row, pColInfo->info.type, TD_DATA_ROW_HEAD_SIZE + offset);
if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) { if (pColInfo->info.type == TSDB_DATA_TYPE_BINARY || pColInfo->info.type == TSDB_DATA_TYPE_NCHAR) {
void *value = tdGetRowDataOfCol(row, pColInfo->info.type, TD_DATA_ROW_HEAD_SIZE + offset);
memcpy(pData, value, varDataTLen(value)); memcpy(pData, value, varDataTLen(value));
offset += sizeof(int32_t);
} else { } else {
memcpy(pData, dataRowTuple(row) + offset, pColInfo->info.bytes); memcpy(pData, value, pColInfo->info.bytes);
offset += pColInfo->info.bytes;
} }
} }
numOfRows++; numOfRows++;
@ -1225,8 +1225,8 @@ static int32_t getAllTableIdList(STable* pSuperTable, SArray* list) {
while (tSkipListIterNext(iter)) { while (tSkipListIterNext(iter)) {
SSkipListNode* pNode = tSkipListIterGet(iter); SSkipListNode* pNode = tSkipListIterGet(iter);
STable* t = *(STable**)SL_GET_NODE_DATA(pNode); STableIndexElem* elem = (STableIndexElem*)(SL_GET_NODE_DATA((SSkipListNode*) pNode));
taosArrayPush(list, &t->tableId); taosArrayPush(list, &elem->pTable->tableId);
} }
tSkipListDestroyIter(iter); tSkipListDestroyIter(iter);
@ -1235,6 +1235,7 @@ static int32_t getAllTableIdList(STable* pSuperTable, SArray* list) {
/** /**
* convert the result pointer to table id instead of table object pointer * convert the result pointer to table id instead of table object pointer
* todo remove it by using callback function to change the final result in-time.
* @param pRes * @param pRes
*/ */
static void convertQueryResult(SArray* pRes, SArray* pTableList) { static void convertQueryResult(SArray* pRes, SArray* pTableList) {
@ -1244,8 +1245,8 @@ static void convertQueryResult(SArray* pRes, SArray* pTableList) {
size_t size = taosArrayGetSize(pTableList); size_t size = taosArrayGetSize(pTableList);
for (int32_t i = 0; i < size; ++i) { // todo speedup by using reserve space. for (int32_t i = 0; i < size; ++i) { // todo speedup by using reserve space.
STable* pTable = taosArrayGetP(pTableList, i); STableIndexElem* elem = taosArrayGet(pTableList, i);
taosArrayPush(pRes, &pTable->tableId); taosArrayPush(pRes, &elem->pTable->tableId);
} }
} }
@ -1309,7 +1310,12 @@ void filterPrepare(void* expr, void* param) {
pInfo->q = (char*) pCond->arr; pInfo->q = (char*) pCond->arr;
} else { } else {
pInfo->q = calloc(1, pSchema->bytes); pInfo->q = calloc(1, pSchema->bytes);
tVariantDump(pCond, pInfo->q, pSchema->type); if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) {
tVariantDump(pCond, varDataVal(pInfo->q), pSchema->type);
varDataSetLen(pInfo->q, pCond->nLen); // the length may be changed after dump, so assign its value after dump
} else {
tVariantDump(pCond, pInfo->q, pSchema->type);
}
} }
} }
@ -1341,16 +1347,16 @@ int32_t tableGroupComparFn(const void *p1, const void *p2, const void *param) {
int32_t bytes = 0; int32_t bytes = 0;
if (colIndex == TSDB_TBNAME_COLUMN_INDEX) { if (colIndex == TSDB_TBNAME_COLUMN_INDEX) {
f1 = pTable1->name; f1 = (char*) pTable1->name;
f2 = pTable2->name; f2 = (char*) pTable2->name;
type = TSDB_DATA_TYPE_BINARY; type = TSDB_DATA_TYPE_BINARY;
bytes = TSDB_TABLE_NAME_LEN; bytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE;
} else { } else {
f1 = dataRowTuple(pTable1->tagVal); STColumn* pCol = schemaColAt(pTableGroupSupp->pTagSchema, colIndex);
f2 = dataRowTuple(pTable2->tagVal); bytes = pCol->bytes;
type = schemaColAt(pTableGroupSupp->pTagSchema, colIndex)->type; f1 = tdGetRowDataOfCol(pTable1->tagVal, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset);
bytes = schemaColAt(pTableGroupSupp->pTagSchema, colIndex)->bytes; f2 = tdGetRowDataOfCol(pTable2->tagVal, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset);
} }
int32_t ret = doCompare(f1, f2, type, bytes); int32_t ret = doCompare(f1, f2, type, bytes);
@ -1428,24 +1434,20 @@ SArray* createTableGroup(SArray* pTableList, STSchema* pTagSchema, SColIndex* pC
bool tSkipListNodeFilterCallback(const void* pNode, void* param) { bool tSkipListNodeFilterCallback(const void* pNode, void* param) {
tQueryInfo* pInfo = (tQueryInfo*) param; tQueryInfo* pInfo = (tQueryInfo*) param;
STable* pTable = *(STable**)(SL_GET_NODE_DATA((SSkipListNode*)pNode)); STableIndexElem* elem = (STableIndexElem*)(SL_GET_NODE_DATA((SSkipListNode*)pNode));
char* val = NULL; char* val = NULL;
int8_t type = pInfo->sch.type; int8_t type = pInfo->sch.type;
if (pInfo->colIndex == TSDB_TBNAME_COLUMN_INDEX) { if (pInfo->colIndex == TSDB_TBNAME_COLUMN_INDEX) {
val = pTable->name; val = (char*) elem->pTable->name;
type = TSDB_DATA_TYPE_BINARY; type = TSDB_DATA_TYPE_BINARY;
} else { } else {
STSchema* pTSchema = (STSchema*) pInfo->param; // todo table schema is identical to stable schema?? STSchema* pTSchema = (STSchema*) pInfo->param; // todo table schema is identical to stable schema??
int32_t offset = pTSchema->columns[pInfo->colIndex].offset; int32_t offset = pTSchema->columns[pInfo->colIndex].offset;
if (pInfo->sch.type == TSDB_DATA_TYPE_BINARY || pInfo->sch.type == TSDB_DATA_TYPE_NCHAR) { val = tdGetRowDataOfCol(elem->pTable->tagVal, pInfo->sch.type, TD_DATA_ROW_HEAD_SIZE + offset);
val = tdGetRowDataOfCol(pTable->tagVal, pInfo->sch.type, TD_DATA_ROW_HEAD_SIZE + offset);
} else {
val = dataRowTuple(pTable->tagVal) + offset;
}
} }
int32_t ret = 0; int32_t ret = 0;
@ -1456,8 +1458,6 @@ bool tSkipListNodeFilterCallback(const void* pNode, void* param) {
ret = pInfo->compare(val, pInfo->q); ret = pInfo->compare(val, pInfo->q);
} }
} else { } else {
// tVariant t = {0};
// tVariantCreateFromBinary(&t, val, (uint32_t)pInfo->sch.bytes, type);
ret = pInfo->compare(val, pInfo->q); ret = pInfo->compare(val, pInfo->q);
} }
@ -1502,7 +1502,7 @@ static int32_t doQueryTableList(STable* pSTable, SArray* pRes, tExprNode* pExpr)
.pExtInfo = pSTable->tagSchema, .pExtInfo = pSTable->tagSchema,
}; };
SArray* pTableList = taosArrayInit(8, POINTER_BYTES); SArray* pTableList = taosArrayInit(8, sizeof(STableIndexElem));
tExprTreeTraverse(pExpr, pSTable->pIndex, pTableList, &supp); tExprTreeTraverse(pExpr, pSTable->pIndex, pTableList, &supp);
tExprTreeDestroy(&pExpr, destroyHelper); tExprTreeDestroy(&pExpr, destroyHelper);

View File

@ -144,11 +144,11 @@ static void tqsortImpl(void *src, int32_t start, int32_t end, size_t size, const
} }
if (leftPartEnd > start) { if (leftPartEnd > start) {
tqsortImpl(src, size, start, leftPartEnd, param, comparFn, buf); tqsortImpl(src, start, leftPartEnd, size, param, comparFn, buf);
} }
if (rightPartStart < end) { if (rightPartStart < end) {
tqsortImpl(src, size, rightPartStart, end, param, comparFn, buf); tqsortImpl(src, rightPartStart, end, size, param, comparFn, buf);
} }
} }

View File

@ -60,33 +60,36 @@ int32_t compareDoubleVal(const void *pLeft, const void *pRight) {
} }
} }
int32_t compareStrVal(const void *pLeft, const void *pRight) { int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight) {
return (int32_t)strcmp(pLeft, pRight); int32_t len1 = varDataLen(pLeft);
int32_t len2 = varDataLen(pRight);
if (len1 != len2) {
return len1 > len2? 1:-1;
} else {
int32_t ret = strncmp(varDataVal(pLeft), varDataVal(pRight), len1);
if (ret == 0) {
return 0;
} else {
return ret > 0 ? 1:-1;
}
}
} }
int32_t compareWStrVal(const void *pLeft, const void *pRight) { int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight) {
// SSkipListKey *pL = (SSkipListKey *)pLeft; int32_t len1 = varDataLen(pLeft);
// SSkipListKey *pR = (SSkipListKey *)pRight; int32_t len2 = varDataLen(pRight);
//
// if (pL->nLen == 0 && pR->nLen == 0) { if (len1 != len2) {
// return 0; return len1 > len2? 1:-1;
// } } else {
// int32_t ret = wcsncmp(varDataVal(pLeft), varDataVal(pRight), len1);
// // handle only one-side bound compare situation, there is only lower bound or only upper bound if (ret == 0) {
// if (pL->nLen == -1) { return 0;
// return 1; // no lower bound, lower bound is minimum, always return -1; } else {
// } else if (pR->nLen == -1) { return ret > 0 ? 1 : -1;
// return -1; // no upper bound, upper bound is maximum situation, always return 1; }
// } }
//
// int32_t ret = wcscmp(((SSkipListKey *)pLeft)->wpz, ((SSkipListKey *)pRight)->wpz);
//
// if (ret == 0) {
// return 0;
// } else {
// return ret > 0 ? 1 : -1;
// }
return 0;
} }
/* /*
@ -267,7 +270,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
} else if (optr == TSDB_RELATION_IN) { } else if (optr == TSDB_RELATION_IN) {
comparFn = compareFindStrInArray; comparFn = compareFindStrInArray;
} else { /* normal relational comparFn */ } else { /* normal relational comparFn */
comparFn = compareStrVal; comparFn = compareLenPrefixedStr;
} }
break; break;
@ -277,7 +280,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
if (optr == TSDB_RELATION_LIKE) { if (optr == TSDB_RELATION_LIKE) {
comparFn = compareWStrPatternComp; comparFn = compareWStrPatternComp;
} else { } else {
comparFn = compareWStrVal; comparFn = compareLenPrefixedWStr;
} }
break; break;
@ -296,6 +299,7 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) {
switch (keyType) { switch (keyType) {
case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_TINYINT:
case TSDB_DATA_TYPE_BOOL:
comparFn = compareInt8Val; comparFn = compareInt8Val;
break; break;
case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_SMALLINT:
@ -308,21 +312,17 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) {
case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_TIMESTAMP:
comparFn = compareInt64Val; comparFn = compareInt64Val;
break; break;
case TSDB_DATA_TYPE_BOOL:
comparFn = compareInt32Val;
break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT:
case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_DOUBLE:
comparFn = compareDoubleVal; comparFn = compareDoubleVal;
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
comparFn = compareStrVal; comparFn = compareLenPrefixedStr;
break; break;
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
comparFn = compareWStrVal; comparFn = compareLenPrefixedWStr;
break; break;
default: default:
@ -349,13 +349,20 @@ int32_t doCompare(const char* f1, const char* f2, int32_t type, size_t size) {
} }
return (ret < 0) ? -1 : 1; return (ret < 0) ? -1 : 1;
} }
default: { default: { // todo refactor
int32_t ret = strncmp(f1, f2, (size_t)size); tstr* t1 = (tstr*) f1;
if (ret == 0) { tstr* t2 = (tstr*) f2;
return ret;
}
return (ret < 0) ? -1 : 1; if (t1->len != t2->len) {
return t1->len > t2->len? 1:-1;
} else {
int32_t ret = strncmp(t1->data, t2->data, t1->len);
if (ret == 0) {
return 0;
} else {
return ret < 0? -1:1;
}
}
} }
} }
} }

View File

@ -46,16 +46,16 @@ class TDTestCase:
self.maxrows) self.maxrows)
tdLog.info("================= step2") tdLog.info("================= step2")
tdLog.info("import %d sequential data" % (self.maxrows / 2)) tdLog.info("import %d sequential data" % (self.maxrows // 2))
startTime = self.startTime startTime = self.startTime
sqlcmd = ['import into tb1 values'] sqlcmd = ['import into tb1 values']
for rid in range(1, self.maxrows / 2 + 1): for rid in range(1, self.maxrows // 2 + 1):
sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) sqlcmd.append('(%ld, %d)' % (startTime + rid, rid))
tdSql.execute(" ".join(sqlcmd)) tdSql.execute(" ".join(sqlcmd))
tdLog.info("================= step3") tdLog.info("================= step3")
tdSql.query('select * from tb1') tdSql.query('select * from tb1')
tdSql.checkRows(self.maxrows / 2) tdSql.checkRows(self.maxrows // 2)
tdLog.info("================= step4") tdLog.info("================= step4")
tdDnodes.stop(1) tdDnodes.stop(1)
@ -70,7 +70,7 @@ class TDTestCase:
tdLog.info("================= step7") tdLog.info("================= step7")
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.query('select * from tb1 order by ts desc') tdSql.query('select * from tb1 order by ts desc')
tdSql.checkRows(self.maxrows / 2 + 1) tdSql.checkRows(self.maxrows // 2 + 1)
tdLog.info("================= step8") tdLog.info("================= step8")
tdLog.info("import 10 data in batch before") tdLog.info("import 10 data in batch before")
@ -83,7 +83,7 @@ class TDTestCase:
tdLog.info("================= step9") tdLog.info("================= step9")
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.query('select * from tb1 order by ts desc') tdSql.query('select * from tb1 order by ts desc')
tdSql.checkRows(self.maxrows / 2 + 11) tdSql.checkRows(self.maxrows // 2 + 11)
def stop(self): def stop(self):
tdSql.close() tdSql.close()

View File

@ -46,16 +46,17 @@ class TDTestCase:
self.maxrows) self.maxrows)
tdLog.info("================= step2") tdLog.info("================= step2")
tdLog.info("import %d sequential data" % (self.maxrows / 2)) tdLog.info("import %d sequential data" % (self.maxrows // 2))
startTime = self.startTime startTime = self.startTime
sqlcmd = ['import into tb1 values'] sqlcmd = ['import into tb1 values']
for rid in range(1, self.maxrows / 2 + 1): for rid in range(1, self.maxrows // 2 + 1):
sqlcmd.append('(%ld, %d)' % (startTime + rid, rid)) sqlcmd.append('(%ld, %d)' % (startTime + rid, rid))
tdSql.execute(" ".join(sqlcmd)) tdSql.execute(" ".join(sqlcmd))
tdLog.info("================= step3") tdLog.info("================= step3")
tdSql.query('select * from tb1') tdSql.query('select * from tb1')
tdSql.checkRows(self.maxrows / 2) tdSql.checkRows(self.maxrows // 2)
tdLog.info("================= step4") tdLog.info("================= step4")
tdDnodes.stop(1) tdDnodes.stop(1)
@ -73,7 +74,7 @@ class TDTestCase:
tdLog.info("================= step9") tdLog.info("================= step9")
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.query('select * from tb1 order by ts desc') tdSql.query('select * from tb1 order by ts desc')
tdSql.checkRows(self.maxrows / 2) tdSql.checkRows(self.maxrows // 2)
def stop(self): def stop(self):
tdSql.close() tdSql.close()

View File

@ -33,7 +33,7 @@ class TDTestCase:
tdDnodes.start(1) tdDnodes.start(1)
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.execute('create database db cache 512 tables 10') tdSql.execute('create database db cache 512 maxtables 10')
tdSql.execute('use db') tdSql.execute('use db')
tdLog.info("================= step1") tdLog.info("================= step1")

View File

@ -29,88 +29,17 @@ python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/db_table.py python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHeadOverlap.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHeadPartOverlap.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHPORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHRestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importLastSub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1HO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1HPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1H.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1S.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1Sub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1TO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1TPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock1T.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2HO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2HPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2H.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2S.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2Sub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2TO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2TPO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlock2T.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importBlockbetween.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileSub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileT.py python3 ./test.py $1 -f import_merge/importCacheFileT.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastSub.py python3 ./test.py $1 -f import_merge/importDataLastSub.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHead.py python3 ./test.py $1 -f import_merge/importHead.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importLastTO.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importLastT.py python3 ./test.py $1 -f import_merge/importLastT.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importSpan.py python3 ./test.py $1 -f import_merge/importSpan.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importSRestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importSubRestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTailOverlap.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTail.py python3 ./test.py $1 -f import_merge/importTail.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTPORestart.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTRestart.py python3 ./test.py $1 -f import_merge/importTRestart.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1

View File

@ -201,8 +201,8 @@ class TDDnode:
self.running = 1 self.running = 1
tdLog.debug("dnode:%d is running with %s " % (self.index, cmd)) tdLog.debug("dnode:%d is running with %s " % (self.index, cmd))
tdLog.debug("wait 2 seconds for the dnode:%d to start." % (self.index)) tdLog.debug("wait 4 seconds for the dnode:%d to start." % (self.index))
time.sleep(2) time.sleep(4)
def stop(self): def stop(self):
if self.valgrind == 0: if self.valgrind == 0:

45
tests/pytest/valgrind-test.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/bash
python3 ./test.py $1 -f insert/basic.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/int.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/float.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/bigint.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/bool.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/double.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/smallint.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/tinyint.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/binary.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/date.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f insert/nchar.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/column_name.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/column_num.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastSub.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHead.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importLastT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importSpan.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTail.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importTRestart.py
python3 ./test.py $1 -s && sleep 1

View File

@ -1,26 +1,20 @@
#################################
run general/cache/new_metrics.sim run general/cache/new_metrics.sim
run general/compress/compress.sim run general/compress/compress.sim
run general/compute/avg.sim run general/compute/avg.sim
run general/compute/bottom.sim
run general/compute/count.sim run general/compute/count.sim
run general/db/len.sim run general/db/len.sim
run general/db/basic4.sim run general/db/basic4.sim
run general/http/restful_insert.sim run general/http/restful_insert.sim
run general/import/basic.sim run general/import/basic.sim
run general/import/commit.sim run general/import/commit.sim
run general/insert/basic.sim
run general/insert/query_file_memory.sim run general/insert/query_file_memory.sim
run general/parser/binary_escapeCharacter.sim run general/parser/binary_escapeCharacter.sim
run general/parser/columnValue_bigint.sim run general/parser/columnValue_bigint.sim
run general/parser/select_from_cache_disk.sim run general/parser/select_from_cache_disk.sim
run general/table/autocreate.sim run general/table/autocreate.sim
run general/table/basic3.sim
run general/table/column_name.sim run general/table/column_name.sim
run general/table/int.sim run general/table/int.sim
run general/table/vgroup.sim run general/table/vgroup.sim
run general/user/basic1.sim run general/user/basic1.sim
run general/user/pass_alter.sim run general/user/pass_alter.sim
run general/user/user_len.sim
run general/vector/single.sim run general/vector/single.sim
##################################

View File

@ -27,11 +27,15 @@ sql create table $tb using $mt tags( "1" )
sql insert into $tb values (now, 1) sql insert into $tb values (now, 1)
sql select * from $tb sql select * from $tb
print ===>rows $rows, data $data01 #print ===>rows $rows, data $data01
if $rows != 1 then if $rows != 1 then
print expect 1, actual: $rows
return -1 return -1
endi endi
if $data01 != 1 then if $data01 != 1 then
print expect 1 actual: $data01
return -1 return -1
endi endi
@ -66,8 +70,10 @@ sql select * from $tb
print ===>rows $rows, data $data01 print ===>rows $rows, data $data01
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data01 != 1 then if $data01 != 1 then
print expect 1, actual $data01
return -1 return -1
endi endi
@ -80,6 +86,7 @@ if $data01 != 1 then
return -1 return -1
endi endi
if $data02 != 3 then if $data02 != 3 then
print expect 3 actual: $data02
return -1 return -1
endi endi

View File

@ -26,6 +26,7 @@ system sh/cfg.sh -n dnode3 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4 system sh/cfg.sh -n dnode4 -c numOfTotalVnodes -v 4
print ========= start dnodes print ========= start dnodes
sleep 2000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect

View File

@ -1,4 +1,4 @@
run general//db/basic.sim run general/db/basic.sim
run general/db/basic1.sim run general/db/basic1.sim
run general/db/basic2.sim run general/db/basic2.sim
run general/db/basic3.sim run general/db/basic3.sim
@ -13,3 +13,4 @@ run general/db/delete_writing2.sim
run general/db/len.sim run general/db/len.sim
run general/db/repeat.sim run general/db/repeat.sim
run general/db/tables.sim run general/db/tables.sim
run general/db/vnodes.sim

View File

@ -0,0 +1,45 @@
system sh/stop_dnodes.sh
$totalVnodes = 10
$maxTables = 4
$totalRows = $totalVnodes * $maxTables
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $maxTables
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v $totalVnodes
system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000
system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000
system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000
system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000
print ========== prepare data
system sh/exec.sh -n dnode1 -s start
sleep 3000
sql connect
sql create database db blocks 2 cache 1 maxTables $maxTables
sql use db
print ========== step1
sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int)
$x = 0
while $x < $totalRows
$tb = t . $x
sql create table $tb using mt tags( $x )
sql insert into $tb values (now, $x )
$x = $x + 1
endw
print ========== step2
sql select * from mt
if $rows != $totalRows then
return -1
endi
sql select count(*) from mt
if $data00 != $totalRows then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -132,7 +132,9 @@ endi
print =============== step6 print =============== step6
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 100 then print $data10 $data11 $data12 $data13 $data14 $data15 $data16
if $data00 != 100 then
print expect 100, actual $data00
return -1 return -1
endi endi

View File

@ -96,25 +96,25 @@ $ts1 = $ts0 + 1000
$ts2 = $ts0 + 2000 $ts2 = $ts0 + 2000
sql insert into tb_1 using $stb tags (-1) values ( $ts1 , 1,1,1,1,'bin',1,1,1,'涛思数据') ( $ts2 , 2,2,2,2,'binar', 1,1,1,'nchar') sql insert into tb_1 using $stb tags (-1) values ( $ts1 , 1,1,1,1,'bin',1,1,1,'涛思数据') ( $ts2 , 2,2,2,2,'binar', 1,1,1,'nchar')
sql select * from $stb sql select * from $stb
if $rows != 3 then if $rows != 5 then
return -1 return -1
endi endi
if $data19 != 涛思数据 then if $data09 != 涛思数据 then
return -1 return -1
endi endi
if $data11 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data22 != 2 then if $data42 != 2 then
return -2 return -2
endi endi
if $data23 != 2.00000 then if $data43 != 2.00000 then
return -1 return -1
endi endi
if $data25 != binar then if $data45 != binar then
return -1 return -1
endi endi
if $data29 != nchar then if $data49 != nchar then
return -1 return -1
endi endi
sql drop table tb_1 sql drop table tb_1
@ -127,22 +127,22 @@ sql select * from $stb
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
if $data19 != 涛思数据 then if $data09 != 涛思数据 then
return -1 return -1
endi endi
if $data11 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
if $data22 != 2 then if $data42 != 2 then
return -2 return -2
endi endi
if $data23 != 2.00000 then if $data43 != 2.00000 then
return -1 return -1
endi endi
if $data25 != binar then if $data45 != binar then
return -1 return -1
endi endi
if $data29 != nchar then if $data49 != nchar then
return -1 return -1
endi endi
@ -154,13 +154,13 @@ sql show tables
if $rows != 3 then if $rows != 3 then
return -1 return -1
endi endi
if $data00 != tb3 then if $data00 != tb1 then
return -1 return -1
endi endi
if $data10 != tb2 then if $data10 != tb2 then
return -1 return -1
endi endi
if $data20 != tb1 then if $data20 != tb3 then
return -1 return -1
endi endi

View File

@ -43,9 +43,11 @@ if $data07 != 1 then
return -1 return -1
endi endi
if $data08 != BINARY then if $data08 != BINARY then
print expect BINARY actual: $data08
return -1 return -1
endi endi
if $data09 != NCHAR then if $data09 != NCHAR then
print expect NCHAR actual: $data09
return -1 return -1
endi endi

View File

@ -194,8 +194,10 @@ sql reset query cache
sql select * from $mt where tgcol = '1' sql select * from $mt where tgcol = '1'
step2: step2:
if $rows != 100 then if $rows != 100 then
print expect 100, actual: $rows
return -1 return -1
endi endi
sql select * from $mt where tgcol > '0' sql select * from $mt where tgcol > '0'
#print rows = $rows #print rows = $rows
if $rows != 100 then if $rows != 100 then

View File

@ -1,113 +1,98 @@
# run general/parser/alter.sim #run general/parser/alter.sim
# sleep 2000 #sleep 2000
# run general/parser/alter1.sim #run general/parser/alter1.sim
# sleep 2000 #sleep 2000
# run general/parser/alter_stable.sim #run general/parser/alter_stable.sim
# sleep 2000 #sleep 2000
# run general/parser/auto_create_tb.sim #run general/parser/auto_create_tb.sim
# sleep 2000 #sleep 2000
# run general/parser/auto_create_tb_drop_tb.sim #run general/parser/auto_create_tb_drop_tb.sim
# sleep 2000
run general/parser/binary_escapeCharacter.sim
sleep 2000
run general/parser/bug.sim
sleep 2000 sleep 2000
run general/parser/col_arithmetic_operation.sim run general/parser/col_arithmetic_operation.sim
sleep 2000 sleep 2000
run general/parser/columnValue_bigint.sim run general/parser/columnValue.sim
sleep 2000 sleep 2000
run general/parser/columnValue_bool.sim run general/parser/commit.sim
sleep 2000 sleep 2000
run general/parser/columnValue_double.sim run general/parser/create_db.sim
sleep 2000 sleep 2000
run general/parser/columnValue_float.sim run general/parser/create_mt.sim
sleep 2000 sleep 2000
run general/parser/columnValue_int.sim run general/parser/create_tb.sim
sleep 2000
run general/parser/dbtbnameValidate.sim
sleep 2000
run general/parser/import_commit1.sim
sleep 2000
run general/parser/import_commit2.sim
sleep 2000
run general/parser/import_commit3.sim
sleep 2000
run general/parser/insert_tb.sim
sleep 2000
run general/parser/first_last.sim
sleep 2000
run general/parser/import_file.sim
sleep 2000
run general/parser/lastrow.sim
sleep 2000
run general/parser/nchar.sim
sleep 2000
run general/parser/null_char.sim
sleep 2000
run general/parser/fill.sim
sleep 2000
run general/parser/fill_stb.sim
sleep 2000
run general/parser/tags_dynamically_specifiy.sim
sleep 2000
run general/parser/interp.sim
sleep 2000
run general/parser/limit.sim
sleep 2000
run general/parser/limit1.sim
sleep 2000
run general/parser/limit1_tblocks100.sim
sleep 2000
run general/parser/limit2.sim
sleep 2000
run general/parser/mixed_blocks.sim
sleep 2000
run general/parser/selectResNum.sim
sleep 2000
run general/parser/select_across_vnodes.sim
sleep 2000 sleep 2000
# sleep 2000
# run general/parser/col_arithmetic_operation.sim
# sleep 2000
# run general/parser/columnValue.sim
# sleep 2000
# run general/parser/commit.sim
# run general/parser/create_db.sim
# sleep 2000
# run general/parser/create_mt.sim
# sleep 2000
# run general/parser/create_tb.sim
# sleep 2000
# run general/parser/dbtbnameValidate.sim
# sleep 2000
# run general/parser/fill.sim
# sleep 2000
# run general/parser/fill_stb.sim
# sleep 2000
# run general/parser/first_last.sim
# sleep 2000
# run general/parser/import_commit1.sim
# sleep 2000
# run general/parser/import_commit2.sim
# sleep 2000
# run general/parser/import_commit3.sim
# sleep 2000
# run general/parser/import_file.sim
# sleep 2000
# run general/parser/insert_tb.sim
# sleep 2000
# run general/parser/tags_dynamically_specifiy.sim
# sleep 2000
# run general/parser/interp.sim
# run general/parser/lastrow.sim
# sleep 2000
# run general/parser/limit.sim
# sleep 2000
# run general/parser/limit1.sim
# sleep 2000
# run general/parser/limit1_tblocks100.sim
# sleep 2000
# run general/parser/limit2.sim
# sleep 2000
# run general/parser/mixed_blocks.sim
# sleep 2000
# run general/parser/nchar.sim
# sleep 2000
# run general/parser/null_char.sim
# sleep 2000
# run general/parser/selectResNum.sim
# sleep 2000
# run general/parser/select_across_vnodes.sim
# sleep 2000
run general/parser/select_from_cache_disk.sim run general/parser/select_from_cache_disk.sim
sleep 2000 sleep 2000
# run general/parser/set_tag_vals.sim run general/parser/set_tag_vals.sim
# sleep 2000 sleep 2000
# run general/parser/single_row_in_tb.sim run general/parser/single_row_in_tb.sim
# sleep 2000 sleep 2000
# run general/parser/slimit.sim run general/parser/slimit.sim
# sleep 2000 sleep 2000
run general/parser/slimit1.sim run general/parser/slimit1.sim
sleep 2000 sleep 2000
run general/parser/slimit1_query.sim run general/parser/slimit_alter_tags.sim
sleep 2000 sleep 2000
# run general/parser/slimit_alter_tags.sim run general/parser/stream_on_sys.sim
# sleep 2000 sleep 2000
# run general/parser/stream_on_sys.sim run general/parser/stream.sim
# sleep 2000 sleep 2000
# run general/parser/stream.sim run general/parser/tbnameIn.sim
# sleep 2000 sleep 2000
# run general/parser/tbnameIn.sim run general/parser/where.sim
# sleep 2000 sleep 2000
# run general/parser/where.sim #run general/parser/repeatAlter.sim
# sleep 2000 sleep 2000
# #run general/parser/repeatAlter.sim #run general/parser/repeatStream.sim
# sleep 2000 sleep 2000
# #run general/parser/repeatStream.sim run general/parser/join.sim
# sleep 2000 sleep 2000
# run general/parser/join.sim run general/parser/join_multivnode.sim
# run general/parser/join_multivnode.sim sleep 2000
# run general/parser/projection_limit_offset.sim run general/parser/projection_limit_offset.sim
# sleep 2000 sleep 2000
# run general/parser/select_with_tags.sim run general/parser/select_with_tags.sim
# run general/parser/groupby.sim sleep 2000
run general/parser/groupby.sim

View File

@ -42,7 +42,7 @@ sql select count(*), last(ts), min(k), max(k), avg(k) from db.mt where a=0 and t
print =================== step2 print =================== step2
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 10000 sleep 5000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000

View File

@ -122,7 +122,8 @@ if $rows != 100 then
return -1 return -1
endi endi
sql select * from $mt where tgcol = 1 sql select * from $mt where tgcol = 1
if $rows != 100 then if $rows != 100 then
print expect 100, actual:$rows
return -1 return -1
endi endi
sql select * from $mt where tgcol <> 1 sql select * from $mt where tgcol <> 1

View File

@ -122,7 +122,8 @@ endi
print =============== step14 print =============== step14
sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol sql select count(tbcol) as c from $mt where ts > 1000 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 100 then if $data00 != 100 then
print expect 100, actual $data00
return -1 return -1
endi endi

View File

@ -1,9 +1,6 @@
cd ../../debug; cmake .. cd ../../debug; cmake ..
#cd ../../debug; make clean
cd ../../debug; make cd ../../debug; make
cd ../../../debug; cmake .. cd ../../../debug; cmake ..
#cd ../../../debug; make clean
cd ../../../debug; make cd ../../../debug; make
#./test.sh -f general/alter/cached_schema_after_alter.sim #./test.sh -f general/alter/cached_schema_after_alter.sim
@ -15,12 +12,12 @@ cd ../../../debug; make
#./test.sh -f general/alter/table.sim #./test.sh -f general/alter/table.sim
./test.sh -f general/cache/new_metrics.sim ./test.sh -f general/cache/new_metrics.sim
#./test.sh -f general/cache/restart_metrics.sim ./test.sh -f general/cache/restart_metrics.sim
./test.sh -f general/cache/restart_table.sim ./test.sh -f general/cache/restart_table.sim
#./test.sh -f general/column/commit.sim #hongze ./test.sh -f general/column/commit.sim
#./test.sh -f general/column/metrics.sim #hongze ./test.sh -f general/column/metrics.sim
#./test.sh -f general/column/table.sim #hongze ./test.sh -f general/column/table.sim
./test.sh -f general/compress/commitlog.sim ./test.sh -f general/compress/commitlog.sim
./test.sh -f general/compress/compress.sim ./test.sh -f general/compress/compress.sim
@ -31,11 +28,11 @@ cd ../../../debug; make
./test.sh -f general/compute/bottom.sim ./test.sh -f general/compute/bottom.sim
./test.sh -f general/compute/count.sim ./test.sh -f general/compute/count.sim
./test.sh -f general/compute/diff.sim ./test.sh -f general/compute/diff.sim
#./test.sh -f general/compute/diff2.sim # liao./test.sh -f general/compute/diff2.sim
./test.sh -f general/compute/first.sim ./test.sh -f general/compute/first.sim
#./test.sh -f general/compute/interval.sim # liao./test.sh -f general/compute/interval.sim
#./test.sh -f general/compute/last.sim # liao./test.sh -f general/compute/last.sim
#./test.sh -f general/compute/leastsquare.sim # liao./test.sh -f general/compute/leastsquare.sim
./test.sh -f general/compute/max.sim ./test.sh -f general/compute/max.sim
./test.sh -f general/compute/min.sim ./test.sh -f general/compute/min.sim
./test.sh -f general/compute/null.sim ./test.sh -f general/compute/null.sim
@ -53,41 +50,42 @@ cd ../../../debug; make
./test.sh -f general/db/delete_reuse1.sim ./test.sh -f general/db/delete_reuse1.sim
./test.sh -f general/db/delete_reuse2.sim ./test.sh -f general/db/delete_reuse2.sim
./test.sh -f general/db/delete_reusevnode.sim ./test.sh -f general/db/delete_reusevnode.sim
#./test.sh -f general/db/delete_reusevnode2.sim ./test.sh -f general/db/delete_reusevnode2.sim
./test.sh -f general/db/delete_writing1.sim ./test.sh -f general/db/delete_writing1.sim
./test.sh -f general/db/delete_writing2.sim ./test.sh -f general/db/delete_writing2.sim
./test.sh -f general/db/len.sim ./test.sh -f general/db/len.sim
#./test.sh -u -f general/db/vnodes.sim
./test.sh -f general/db/repeat.sim ./test.sh -f general/db/repeat.sim
./test.sh -f general/db/tables.sim ./test.sh -f general/db/tables.sim
#./test.sh -f general/field/2.sim ./test.sh -f general/field/2.sim
#./test.sh -f general/field/3.sim #./test.sh -f general/field/3.sim
#./test.sh -f general/field/4.sim #./test.sh -f general/field/4.sim
#./test.sh -f general/field/5.sim #./test.sh -f general/field/5.sim
#./test.sh -f general/field/6.sim #./test.sh -f general/field/6.sim
##./test.sh -f general/field/bigint.sim ./test.sh -f general/field/bigint.sim
#./test.sh -f general/field/binary.sim # liao./test.sh -f general/field/binary.sim
##./test.sh -f general/field/bool.sim ./test.sh -f general/field/bool.sim
#./test.sh -f general/field/single.sim ./test.sh -f general/field/single.sim
##./test.sh -f general/field/smallint.sim ./test.sh -f general/field/smallint.sim
##./test.sh -f general/field/tinyint.sim ./test.sh -f general/field/tinyint.sim
##./test.sh -f general/http/restful.sim # jeff ./test.sh -f general/http/restful.sim
./test.sh -f general/http/restful_insert.sim ./test.sh -f general/http/restful_insert.sim
./test.sh -f general/http/restful_limit.sim ./test.sh -f general/http/restful_limit.sim
##./test.sh -f general/http/restful_full.sim # jeff ./test.sh -f general/http/restful_full.sim
./test.sh -f general/http/prepare.sim ./test.sh -f general/http/prepare.sim
./test.sh -f general/http/telegraf.sim ./test.sh -f general/http/telegraf.sim
./test.sh -f general/http/grafana_bug.sim ./test.sh -f general/http/grafana_bug.sim
#./test.sh -f general/http/grafana.sim # jeff ./test.sh -f general/http/grafana.sim
./test.sh -f general/import/basic.sim ./test.sh -f general/import/basic.sim
./test.sh -f general/import/commit.sim ./test.sh -f general/import/commit.sim
./test.sh -f general/import/large.sim ./test.sh -f general/import/large.sim
#./test.sh -f general/import/replica1.sim #hongze ./test.sh -f general/import/replica1.sim
./test.sh -f general/insert/basic.sim ./test.sh -f general/insert/basic.sim
#./test.sh -f general/insert/insert_drop.sim #hongze ./test.sh -f general/insert/insert_drop.sim
./test.sh -f general/insert/query_block1_memory.sim ./test.sh -f general/insert/query_block1_memory.sim
./test.sh -f general/insert/query_block2_memory.sim ./test.sh -f general/insert/query_block2_memory.sim
./test.sh -f general/insert/query_block1_file.sim ./test.sh -f general/insert/query_block1_file.sim
@ -96,8 +94,6 @@ cd ../../../debug; make
./test.sh -f general/insert/query_multi_file.sim ./test.sh -f general/insert/query_multi_file.sim
./test.sh -f general/insert/tcp.sim ./test.sh -f general/insert/tcp.sim
#parser
# ./test.sh -f general/parser/alter.sim # ./test.sh -f general/parser/alter.sim
# ./test.sh -f general/parser/alter1.sim # ./test.sh -f general/parser/alter1.sim
# ./test.sh -f general/parser/alter_stable.sim # ./test.sh -f general/parser/alter_stable.sim
@ -112,8 +108,8 @@ cd ../../../debug; make
./test.sh -f general/parser/columnValue_float.sim ./test.sh -f general/parser/columnValue_float.sim
./test.sh -f general/parser/columnValue_int.sim ./test.sh -f general/parser/columnValue_int.sim
# ./test.sh -f general/parser/col_arithmetic_operation.sim # ./test.sh -f general/parser/col_arithmetic_operation.sim
# ./test.sh -f general/parser/columnValue.sim ./test.sh -f general/parser/columnValue.sim
# ./test.sh -f general/parser/commit.sim ./test.sh -f general/parser/commit.sim
# ./test.sh -f general/parser/create_db.sim # ./test.sh -f general/parser/create_db.sim
# ./test.sh -f general/parser/create_mt.sim # ./test.sh -f general/parser/create_mt.sim
# ./test.sh -f general/parser/create_tb.sim # ./test.sh -f general/parser/create_tb.sim
@ -121,9 +117,9 @@ cd ../../../debug; make
# ./test.sh -f general/parser/fill.sim # ./test.sh -f general/parser/fill.sim
# ./test.sh -f general/parser/fill_stb.sim # ./test.sh -f general/parser/fill_stb.sim
# ./test.sh -f general/parser/first_last.sim # ./test.sh -f general/parser/first_last.sim
# ./test.sh -f general/parser/import_commit1.sim ./test.sh -f general/parser/import_commit1.sim
# ./test.sh -f general/parser/import_commit2.sim ./test.sh -f general/parser/import_commit2.sim
# ./test.sh -f general/parser/import_commit3.sim ./test.sh -f general/parser/import_commit3.sim
# ./test.sh -f general/parser/import_file.sim # ./test.sh -f general/parser/import_file.sim
# ./test.sh -f general/parser/insert_tb.sim # ./test.sh -f general/parser/insert_tb.sim
# ./test.sh -f general/parser/tags_dynamically_specifiy.sim # ./test.sh -f general/parser/tags_dynamically_specifiy.sim
@ -160,14 +156,12 @@ cd ../../../debug; make
#./test.sh -f general/stable/disk.sim #./test.sh -f general/stable/disk.sim
#./test.sh -f general/stable/metrics.sim #./test.sh -f general/stable/metrics.sim
#./test.sh -f general/stable/values.sim #./test.sh -f general/stable/values.sim
#./test.sh -f general/stable/vnode3.sim ./test.sh -f general/stable/vnode3.sim
#stream
./test.sh -f general/table/autocreate.sim ./test.sh -f general/table/autocreate.sim
./test.sh -f general/table/basic1.sim ./test.sh -f general/table/basic1.sim
./test.sh -f general/table/basic2.sim ./test.sh -f general/table/basic2.sim
./test.sh -f general/table/basic3.sim #hongze ./test.sh -f general/table/basic3.sim
./test.sh -f general/table/bigint.sim ./test.sh -f general/table/bigint.sim
./test.sh -f general/table/binary.sim ./test.sh -f general/table/binary.sim
./test.sh -f general/table/bool.sim ./test.sh -f general/table/bool.sim
@ -177,17 +171,17 @@ cd ../../../debug; make
./test.sh -f general/table/column2.sim ./test.sh -f general/table/column2.sim
./test.sh -f general/table/date.sim ./test.sh -f general/table/date.sim
./test.sh -f general/table/db.table.sim ./test.sh -f general/table/db.table.sim
#./test.sh -f general/table/delete_reuse1.sim ./test.sh -f general/table/delete_reuse1.sim
#./test.sh -f general/table/delete_reuse2.sim ./test.sh -f general/table/delete_reuse2.sim
#./test.sh -f general/table/delete_writing.sim #hongze ./test.sh -f general/table/delete_writing.sim
#./test.sh -f general/table/describe.sim ./test.sh -f general/table/describe.sim
./test.sh -f general/table/double.sim ./test.sh -f general/table/double.sim
#./test.sh -f general/table/fill.sim ./test.sh -f general/table/fill.sim
./test.sh -f general/table/float.sim ./test.sh -f general/table/float.sim
./test.sh -f general/table/int.sim ./test.sh -f general/table/int.sim
./test.sh -f general/table/limit.sim ./test.sh -f general/table/limit.sim
./test.sh -f general/table/smallint.sim ./test.sh -f general/table/smallint.sim
#./test.sh -f general/table/table_len.sim ./test.sh -f general/table/table_len.sim
./test.sh -f general/table/table.sim ./test.sh -f general/table/table.sim
./test.sh -f general/table/tinyint.sim ./test.sh -f general/table/tinyint.sim
./test.sh -f general/table/vgroup.sim ./test.sh -f general/table/vgroup.sim
@ -197,47 +191,45 @@ cd ../../../debug; make
#./test.sh -f general/tag/5.sim #./test.sh -f general/tag/5.sim
#./test.sh -f general/tag/6.sim #./test.sh -f general/tag/6.sim
#./test.sh -f general/tag/add.sim #./test.sh -f general/tag/add.sim
#./test.sh -f general/tag/bigint.sim ./test.sh -f general/tag/bigint.sim
#./test.sh -f general/tag/binary_binary.sim #./test.sh -f general/tag/binary_binary.sim
#./test.sh -f general/tag/binary.sim #./test.sh -f general/tag/binary.sim
#./test.sh -f general/tag/bool_binary.sim #./test.sh -f general/tag/bool_binary.sim
#./test.sh -f general/tag/bool_int.sim #./test.sh -f general/tag/bool_int.sim
#./test.sh -f general/tag/bool.sim ./test.sh -f general/tag/bool.sim
#./test.sh -f general/tag/change.sim #./test.sh -f general/tag/change.sim
#./test.sh -f general/tag/column.sim #liao ./test.sh -f general/tag/column.sim
#./test.sh -f general/tag/commit.sim #./test.sh -f general/tag/commit.sim
#./test.sh -f general/tag/create.sim #liao ./test.sh -f general/tag/create.sim
#./test.sh -f general/tag/delete.sim #./test.sh -f general/tag/delete.sim
#./test.sh -f general/tag/double.sim #./test.sh -f general/tag/double.sim
#./test.sh -f general/tag/filter.sim ./test.sh -f general/tag/filter.sim
#./test.sh -f general/tag/float.sim #./test.sh -f general/tag/float.sim
#./test.sh -f general/tag/int_binary.sim #./test.sh -f general/tag/int_binary.sim
#./test.sh -f general/tag/int_float.sim #./test.sh -f general/tag/int_float.sim
#./test.sh -f general/tag/int.sim ./test.sh -f general/tag/int.sim
#./test.sh -f general/tag/set.sim #./test.sh -f general/tag/set.sim
#./test.sh -f general/tag/smallint.sim ./test.sh -f general/tag/smallint.sim
#./test.sh -f general/tag/tinyint.sim ./test.sh -f general/tag/tinyint.sim
./test.sh -f general/user/basic1.sim ./test.sh -f general/user/basic1.sim
#./test.sh -f general/user/monitor.sim ./test.sh -f general/user/monitor.sim
./test.sh -f general/user/pass_alter.sim ./test.sh -f general/user/pass_alter.sim
./test.sh -f general/user/pass_len.sim ./test.sh -f general/user/pass_len.sim
./test.sh -f general/user/user_create.sim ./test.sh -f general/user/user_create.sim
./test.sh -f general/user/user_len.sim ./test.sh -f general/user/user_len.sim
#./test.sh -f general/vector/metrics_field.sim ./test.sh -f general/vector/metrics_field.sim
#./test.sh -f general/vector/metrics_mix.sim ./test.sh -f general/vector/metrics_mix.sim
#./test.sh -f general/vector/metrics_query.sim ./test.sh -f general/vector/metrics_query.sim
#./test.sh -f general/vector/metrics_tag.sim ./test.sh -f general/vector/metrics_tag.sim
#./test.sh -f general/vector/metrics_time.sim ./test.sh -f general/vector/metrics_time.sim
#./test.sh -f general/vector/multi.sim #liao ./test.sh -f general/vector/multi.sim
./test.sh -f general/vector/single.sim ./test.sh -f general/vector/single.sim
#./test.sh -f general/vector/table_field.sim ./test.sh -f general/vector/table_field.sim
#./test.sh -f general/vector/table_mix.sim ./test.sh -f general/vector/table_mix.sim
#./test.sh -f general/vector/table_query.sim ./test.sh -f general/vector/table_query.sim
#./test.sh -f general/vector/table_time.sim ./test.sh -f general/vector/table_time.sim
#################################
./test.sh -u -f unique/account/account_create.sim ./test.sh -u -f unique/account/account_create.sim
./test.sh -u -f unique/account/account_delete.sim ./test.sh -u -f unique/account/account_delete.sim
@ -252,8 +244,8 @@ cd ../../../debug; make
./test.sh -u -f unique/account/user_len.sim ./test.sh -u -f unique/account/user_len.sim
#./test.sh -u -f unique/big/balance.sim #./test.sh -u -f unique/big/balance.sim
#./test.sh -u -f unique/big/maxvnodes.sim #slguan ./test.sh -u -f unique/big/maxvnodes.sim
#./test.sh -u -f unique/big/tcp.sim ./test.sh -u -f unique/big/tcp.sim
##./test.sh -u -f unique/cluster/balance1.sim ##./test.sh -u -f unique/cluster/balance1.sim
##./test.sh -u -f unique/cluster/balance2.sim ##./test.sh -u -f unique/cluster/balance2.sim
@ -298,27 +290,22 @@ cd ../../../debug; make
#./test.sh -u -f unique/metrics/replica3_dnode6.sim #./test.sh -u -f unique/metrics/replica3_dnode6.sim
#./test.sh -u -f unique/metrics/replica3_vnode3.sim #./test.sh -u -f unique/metrics/replica3_vnode3.sim
##./test.sh -u -f unique/mnode/mgmt22.sim ./test.sh -u -f unique/mnode/mgmt22.sim
##./test.sh -u -f unique/mnode/mgmt23.sim ./test.sh -u -f unique/mnode/mgmt23.sim
##./test.sh -u -f unique/mnode/mgmt24.sim ./test.sh -u -f unique/mnode/mgmt24.sim
##./test.sh -u -f unique/mnode/mgmt25.sim ./test.sh -u -f unique/mnode/mgmt25.sim
##./test.sh -u -f unique/mnode/mgmt26.sim ./test.sh -u -f unique/mnode/mgmt26.sim
##./test.sh -u -f unique/mnode/mgmt33.sim ./test.sh -u -f unique/mnode/mgmt33.sim
##./test.sh -u -f unique/mnode/mgmt34.sim ./test.sh -u -f unique/mnode/mgmt34.sim
#./test.sh -u -f unique/mnode/mgmtr2.sim #./test.sh -u -f unique/mnode/mgmtr2.sim
#./test.sh -u -f unique/mnode/secondIp.sim #./test.sh -u -f unique/mnode/secondIp.sim
#stream
##./test.sh -u -f unique/table/delete_part.sim ##./test.sh -u -f unique/table/delete_part.sim
##./test.sh -u -f unique/vnode/replica2_basic2.sim
##./test.sh -u -f unique/vnode/replica3_basic.sim
#./test.sh -u -f unique/vnode/commit.sim #./test.sh -u -f unique/vnode/commit.sim
#./test.sh -u -f unique/vnode/many.sim #./test.sh -u -f unique/vnode/many.sim
#./test.sh -u -f unique/vnode/replica2_basic.sim #./test.sh -u -f unique/vnode/replica2_basic.sim
##./test.sh -u -f unique/vnode/replica2_basic2.sim ./test.sh -u -f unique/vnode/replica2_basic2.sim
#./test.sh -u -f unique/vnode/replica2_repeat.sim #./test.sh -u -f unique/vnode/replica2_repeat.sim
##./test.sh -u -f unique/vnode/replica3_basic.sim ##./test.sh -u -f unique/vnode/replica3_basic.sim
#./test.sh -u -f unique/vnode/replica3_repeat.sim #./test.sh -u -f unique/vnode/replica3_repeat.sim

View File

@ -99,7 +99,7 @@ echo "logDir $LOG_DIR" >> $TAOS_CFG
echo "dDebugFlag 199" >> $TAOS_CFG echo "dDebugFlag 199" >> $TAOS_CFG
echo "mDebugFlag 199" >> $TAOS_CFG echo "mDebugFlag 199" >> $TAOS_CFG
echo "sdbDebugFlag 199" >> $TAOS_CFG echo "sdbDebugFlag 199" >> $TAOS_CFG
echo "rpcDebugFlag 135" >> $TAOS_CFG echo "rpcDebugFlag 151" >> $TAOS_CFG
echo "tmrDebugFlag 131" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG
echo "cDebugFlag 135" >> $TAOS_CFG echo "cDebugFlag 135" >> $TAOS_CFG
echo "httpDebugFlag 135" >> $TAOS_CFG echo "httpDebugFlag 135" >> $TAOS_CFG

View File

@ -99,7 +99,8 @@ echo "cDebugFlag 135" >> $TAOS_CFG
echo "httpDebugFlag 135" >> $TAOS_CFG echo "httpDebugFlag 135" >> $TAOS_CFG
echo "monitorDebugFlag 135" >> $TAOS_CFG echo "monitorDebugFlag 135" >> $TAOS_CFG
echo "udebugFlag 135" >> $TAOS_CFG echo "udebugFlag 135" >> $TAOS_CFG
echo "clog 0" >> $TAOS_CFG echo "tablemetakeeptimer 5" >> $TAOS_CFG
echo "wal 0" >> $TAOS_CFG
echo "asyncLog 0" >> $TAOS_CFG echo "asyncLog 0" >> $TAOS_CFG
echo "locale en_US.UTF-8" >> $TAOS_CFG echo "locale en_US.UTF-8" >> $TAOS_CFG
echo " " >> $TAOS_CFG echo " " >> $TAOS_CFG

View File

@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
print ============================ dnode1 start print ============================ dnode1 start

View File

@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
print ============= step1 print ============= step1
sql create account oroot pass 'taosdata' sql create account oroot pass 'taosdata'

View File

@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
$i = 0 $i = 0
$dbPrefix = aldb $dbPrefix = aldb

View File

@ -4,8 +4,8 @@ system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 8
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
print ============= step1 print ============= step1

View File

@ -1,6 +1,7 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sleep 3000
sql connect sql connect
print =============== show accounts print =============== show accounts

View File

@ -1,6 +1,7 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sleep 3000
sql connect sql connect
print =============== show accounts print =============== show accounts

View File

@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
print ============= step1 print ============= step1
sql create user read pass 'taosdata1' sql create user read pass 'taosdata1'

View File

@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
$i = 0 $i = 0
$dbPrefix = apdb $dbPrefix = apdb

View File

@ -1,6 +1,7 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sleep 3000
sql connect sql connect
print =============== show accounts print =============== show accounts

View File

@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
print =============== step1 print =============== step1
sql show users sql show users

View File

@ -3,8 +3,8 @@ system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0 system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sql connect
sleep 3000 sleep 3000
sql connect
$i = 0 $i = 0
$dbPrefix = lm_us_db $dbPrefix = lm_us_db

View File

@ -20,7 +20,7 @@ system sh/cfg.sh -n dnode5 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 1000 system sh/cfg.sh -n dnode5 -c maxtablesPerVnode -v 1000
print =============== prepare data print =============== prepare data
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect
@ -87,7 +87,7 @@ endi
print ========== step1 print ========== step1
sql create dnode $hostname2 sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
$x = 0 $x = 0
show1: show1:
@ -98,12 +98,12 @@ show1:
endi endi
sql show dnodes sql show dnodes
print dnode1 freeVnodes $data3_192.168.0.1 print dnode1 openvnodes $data2_1
print dnode2 freeVnodes $data3_192.168.0.2 print dnode2 openvnodes $data2_2
if $data3_192.168.0.1 != 2 then if $data2_1 != 2 then
goto show1 goto show1
endi endi
if $data3_192.168.0.2 != 2 then if $data2_2 != 2 then
goto show1 goto show1
endi endi
@ -139,7 +139,7 @@ endi
print ========== step2 print ========== step2
sql create dnode $hostname3 sql create dnode $hostname3
system sh/exec.sh -n dnode3 -s start system sh/exec_up.sh -n dnode3 -s start
sleep 10000 sleep 10000
print ========== step3 print ========== step3
@ -154,20 +154,20 @@ show3:
endi endi
sql show dnodes sql show dnodes
print dnode1 freeVnodes $data3_192.168.0.1 print dnode1 freeVnodes $data2_1
print dnode2 freeVnodes $data3_192.168.0.2 print dnode2 freeVnodes $data2_2
print dnode3 freeVnodes $data3_192.168.0.3 print dnode3 freeVnodes $data2_3
if $data3_192.168.0.1 != 2 then if $data2_1 != 2 then
goto show3 goto show3
endi endi
if $data3_192.168.0.2 != NULL then if $data2_2 != NULL then
goto show3 goto show3
endi endi
if $data3_192.168.0.3 != 2 then if $data2_3 != 2 then
goto show3 goto show3
endi endi
system sh/exec.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sql select count(*) from t10 sql select count(*) from t10
print select count(*) from t10 $data00 expect $rowNum print select count(*) from t10 $data00 expect $rowNum
@ -211,16 +211,16 @@ show4:
endi endi
sql show dnodes sql show dnodes
print dnode1 freeVnodes $data3_192.168.0.1 print dnode1 freeVnodes $data2_1
print dnode3 freeVnodes $data3_192.168.0.3 print dnode3 freeVnodes $data2_3
if $data3_192.168.0.1 != 0 then if $data2_1 != 0 then
goto show4 goto show4
endi endi
if $data3_192.168.0.3 != NULL then if $data2_3 != NULL then
goto show4 goto show4
endi endi
system sh/exec.sh -n dnode3 -s stop -x SIGINT system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sql select count(*) from t10 sql select count(*) from t10
print select count(*) from t10 $data00 expect $rowNum print select count(*) from t10 $data00 expect $rowNum
@ -255,7 +255,7 @@ endi
print ========== step5 print ========== step5
sql alter database db replica 2 sql alter database db replica 2
sql create dnode $hostname4 sql create dnode $hostname4
system sh/exec.sh -n dnode4 -s start system sh/exec_up.sh -n dnode4 -s start
$x = 0 $x = 0
show5: show5:
@ -266,12 +266,12 @@ show5:
endi endi
sql show dnodes sql show dnodes
print dnode1 freeVnodes $data3_192.168.0.1 print dnode1 freeVnodes $data2_1
print dnode4 freeVnodes $data3_192.168.0.4 print dnode4 freeVnodes $data2_4
if $data3_192.168.0.1 != 0 then if $data2_1 != 0 then
goto show5 goto show5
endi endi
if $data3_192.168.0.4 != 0 then if $data2_4 != 0 then
goto show5 goto show5
endi endi

View File

@ -1,25 +1,32 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
$totalVnodes = 100
$minVnodes = 48
$maxVnodes = 52
$maxTables = 4
$totalRows = $totalVnodes * $maxTables
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c walLevel -v 0 system sh/cfg.sh -n dnode1 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 100 system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $maxTables
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 256 system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v $totalVnodes
system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000 system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 100000
system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000 system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 100000
system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000 system sh/cfg.sh -n dnode1 -c maxShellConns -v 100000
system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000 system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 100000
print ========== prepare data print ========== prepare data
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sleep 3000
sql connect sql connect
sql create database db sql create database db blocks 2 cache 1 maxTables $maxTables
sql use db sql use db
print ========== step1 print ========== step1
sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int) sql create table mt (ts timestamp, tbcol int) TAGS(tgcol int)
$x = 0 $x = 0
while $x < 25600 while $x < $totalRows
$tb = t . $x $tb = t . $x
sql create table $tb using mt tags( $x ) sql create table $tb using mt tags( $x )
sql insert into $tb values (now, $x ) sql insert into $tb values (now, $x )
@ -28,16 +35,15 @@ endw
print ========== step2 print ========== step2
sql select * from mt sql select * from mt
if $rows != 25600 then if $rows != $totalRows then
return -1 return -1
endi endi
sql select count(*) from mt sql select count(*) from mt
if $data00 != 25600 then if $data00 != $totalRows then
return -1 return -1
endi endi
system sh/deploy.sh -n dnode2 -i 2 system sh/deploy.sh -n dnode2 -i 2
system sh/cfg.sh -n dnode2 -c walLevel -v 0 system sh/cfg.sh -n dnode2 -c walLevel -v 0
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 100 system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 100
@ -49,7 +55,7 @@ system sh/cfg.sh -n dnode2 -c maxMgmtConnections -v 100000
print ========== step2 print ========== step2
sql create dnode $hostname2 sql create dnode $hostname2
system sh/exec.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start
$x = 0 $x = 0
show3: show3:
@ -60,23 +66,23 @@ show3:
endi endi
sql show dnodes sql show dnodes
print dnode1 freeVnodes $data3_192.168.0.1 print dnode1 openvnodes $data2_1
print dnode2 freeVnodes $data3_192.168.0.2 print dnode2 openvnodes $data2_2
if $data3_192.168.0.1 != 126 then if $data2_1 != $minVnodes then
goto show3 goto show3
endi endi
if $data3_192.168.0.2 != 130 then if $data2_2 != $maxVnodes then
goto show3 goto show3
endi endi
print ========== step4 print ========== step4
sql select * from mt sql select * from mt
if $rows != 25600 then if $rows != $totalRows then
return -1 return -1
endi endi
sql select count(*) from mt sql select count(*) from mt
if $data00 != 25600 then if $data00 != $totalRows then
return -1 return -1
endi endi

View File

@ -14,8 +14,8 @@ system sh/cfg.sh -n dnode1 -c adminDebugFlag -v 131
system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135 system sh/cfg.sh -n dnode1 -c httpDebugFlag -v 135
system sh/cfg.sh -n dnode1 -c debugFlag -v 131 system sh/cfg.sh -n dnode1 -c debugFlag -v 131
system sh/exec.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start
sleep 3000
sql connect sql connect
print ======================== dnode1 start print ======================== dnode1 start
@ -52,7 +52,7 @@ while $i < $tbNum
endw endw
$i = 0 $i = 0
while $i < 100 while $i < 10
print =============== step3 $i print =============== step3 $i
sql select count(*) from $mt sql select count(*) from $mt
print ===> $data00 $data01 print ===> $data00 $data01
@ -83,7 +83,7 @@ while $i < $tbNum
endw endw
$i = 0 $i = 0
while $i < 100 while $i < 10
print =============== step5 $i print =============== step5 $i
sql select count(*) from $mt where tgcol < 20200 sql select count(*) from $mt where tgcol < 20200
print ===> $data00 $data01 print ===> $data00 $data01

View File

@ -8,7 +8,7 @@ system sh/cfg.sh -n dnode2 -c numOfMPeers -v 2
system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2 system sh/cfg.sh -n dnode3 -c numOfMPeers -v 2
print ============== step1 print ============== step1
system sh/exec_up.sh -n dnode1 -s start system sh/exec_up.sh -n dnode1 -s start -t
sleep 3000 sleep 3000
sql connect sql connect
@ -20,7 +20,7 @@ if $data2_1 != master then
endi endi
print ============== step2 print ============== step2
system sh/exec_up.sh -n dnode2 -s start system sh/exec_up.sh -n dnode2 -s start -t
sql create dnode $hostname2 sql create dnode $hostname2
$x = 0 $x = 0
@ -41,6 +41,17 @@ if $data2_2 != slave then
goto show2 goto show2
endi endi
system sh/exec_up.sh -n dnode1 -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
system sh/exec_up.sh -n dnode6 -s stop -x SIGINT
system sh/exec_up.sh -n dnode7 -s stop -x SIGINT
system sh/exec_up.sh -n dnode8 -s stop -x SIGINT
return
print ============== step3 print ============== step3
sql_error drop dnode $hostname1 -x error1 sql_error drop dnode $hostname1 -x error1
print should not drop master print should not drop master

View File

@ -59,7 +59,7 @@ endi
if $dnode2Role != slave then if $dnode2Role != slave then
return -1 return -1
endi endi
if $dnode3Role != NULL then if $dnode3Role != null then
return -1 return -1
endi endi
@ -78,7 +78,7 @@ print dnode3 ==> $dnode3Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then
@ -106,7 +106,7 @@ print dnode3 ==> $dnode3Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then

View File

@ -59,7 +59,7 @@ endi
if $dnode2Role != slave then if $dnode2Role != slave then
return -1 return -1
endi endi
if $dnode3Role != NULL then if $dnode3Role != null then
return -1 return -1
endi endi
@ -78,7 +78,7 @@ print dnode3 ==> $dnode3Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then

View File

@ -59,7 +59,7 @@ endi
if $dnode2Role != slave then if $dnode2Role != slave then
return -1 return -1
endi endi
if $dnode3Role != NULL then if $dnode3Role != null then
return -1 return -1
endi endi
@ -79,7 +79,7 @@ print dnode3 ==> $dnode3Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then
@ -106,7 +106,7 @@ print dnode3 ==> $dnode3Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then

View File

@ -18,10 +18,10 @@ print dnode3 ==> $data3_3
if $data2_1 != master then if $data2_1 != master then
return -1 return -1
endi endi
if $data3_2 != NULL then if $data3_2 != null then
return -1 return -1
endi endi
if $data3_3 != NULL then if $data3_3 != null then
return -1 return -1
endi endi
@ -44,7 +44,7 @@ endi
if $dnode2Role != slave then if $dnode2Role != slave then
return -1 return -1
endi endi
if $dnode3Role != NULL then if $dnode3Role != null then
return -1 return -1
endi endi
@ -86,7 +86,7 @@ print dnode3 ==> $dnode3Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then
@ -156,7 +156,7 @@ print dnode1 ==> $dnode1Role
print dnode2 ==> $dnode2Role print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role print dnode3 ==> $dnode3Role
if $dnode1Role != NULL then if $dnode1Role != null then
return -1 return -1
endi endi
#if $dnode2Role != master then #if $dnode2Role != master then

View File

@ -22,10 +22,10 @@ print dnode3 ==> $data3_3
if $data2_1 != master then if $data2_1 != master then
return -1 return -1
endi endi
if $data3_2 != NULL then if $data3_2 != null then
return -1 return -1
endi endi
if $data3_3 != NULL then if $data3_3 != null then
return -1 return -1
endi endi
@ -50,10 +50,10 @@ endi
if $dnode2Role != slave then if $dnode2Role != slave then
return -1 return -1
endi endi
if $dnode3Role != NULL then if $dnode3Role != null then
return -1 return -1
endi endi
if $dnode4Role != NULL then if $dnode4Role != null then
return -1 return -1
endi endi
@ -81,7 +81,7 @@ endi
if $dnode3Role != slave then if $dnode3Role != slave then
return -1 return -1
endi endi
if $dnode4Role != NULL then if $dnode4Role != null then
return -1 return -1
endi endi
@ -110,7 +110,7 @@ endi
if $dnode3Role != slave then if $dnode3Role != slave then
return -1 return -1
endi endi
if $dnode4Role != NULL then if $dnode4Role != null then
return -1 return -1
endi endi
@ -131,7 +131,7 @@ print dnode4 ==> $dnode4Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then
@ -165,7 +165,7 @@ print dnode4 ==> $dnode4Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then
@ -207,7 +207,7 @@ print dnode2 ==> $dnode2Role
print dnode3 ==> $dnode3Role print dnode3 ==> $dnode3Role
print dnode4 ==> $dnode4Role print dnode4 ==> $dnode4Role
if $dnode1Role != NULL then if $dnode1Role != null then
return -1 return -1
endi endi
if $dnode2Role != slave then if $dnode2Role != slave then

View File

@ -21,11 +21,12 @@ fi
echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}" echo -e "${GREEN} ### Total $totalSuccess TSIM case(s) succeed! ### ${NC}"
totalFailed=`grep 'failed\|fault' out.txt | wc -l` totalFailed=`grep 'failed\|fault' out.txt | wc -l`
echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}" # echo -e "${RED} ### Total $totalFailed TSIM case(s) failed! ### ${NC}"
if [ "$totalFailed" -ne "0" ]; then 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
# exit $totalFailed
fi fi
echo "### run Python script ###" echo "### run Python script ###"
@ -46,6 +47,7 @@ fi
totalPyFailed=`grep 'failed\|fault' pytest-out.txt | wc -l` totalPyFailed=`grep 'failed\|fault' pytest-out.txt | wc -l`
if [ "$totalPyFailed" -ne "0" ]; then if [ "$totalPyFailed" -ne "0" ]; then
echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}" echo -e "${RED} ### Total $totalPyFailed python case(s) failed! ### ${NC}"
exit $totalPyFailed # exit $totalPyFailed
fi fi
exit $(($totalFailed + $totalPyFailed))