Merge branch 'feature/3_liaohj' of https://github.com/taosdata/TDengine into feature/3_liaohj
This commit is contained in:
commit
824aed420e
|
@ -40,7 +40,7 @@ def check_docs() {
|
||||||
sh '''
|
sh '''
|
||||||
cd ${WKC}
|
cd ${WKC}
|
||||||
git reset --hard
|
git reset --hard
|
||||||
git clean -fxd
|
git clean -f
|
||||||
rm -rf examples/rust/
|
rm -rf examples/rust/
|
||||||
git remote prune origin
|
git remote prune origin
|
||||||
git fetch
|
git fetch
|
||||||
|
@ -86,7 +86,7 @@ def pre_test(){
|
||||||
git fetch
|
git fetch
|
||||||
cd ${WKC}
|
cd ${WKC}
|
||||||
git reset --hard
|
git reset --hard
|
||||||
git clean -fxd
|
git clean -f
|
||||||
rm -rf examples/rust/
|
rm -rf examples/rust/
|
||||||
git remote prune origin
|
git remote prune origin
|
||||||
git fetch
|
git fetch
|
||||||
|
@ -201,7 +201,7 @@ def pre_test_win(){
|
||||||
'''
|
'''
|
||||||
bat '''
|
bat '''
|
||||||
cd %WIN_COMMUNITY_ROOT%
|
cd %WIN_COMMUNITY_ROOT%
|
||||||
git clean -fxd
|
git clean -f
|
||||||
git reset --hard
|
git reset --hard
|
||||||
git remote prune origin
|
git remote prune origin
|
||||||
git fetch
|
git fetch
|
||||||
|
|
|
@ -929,12 +929,19 @@ typedef struct {
|
||||||
int32_t minRows;
|
int32_t minRows;
|
||||||
int32_t maxRows;
|
int32_t maxRows;
|
||||||
int32_t walFsyncPeriod;
|
int32_t walFsyncPeriod;
|
||||||
|
int16_t hashPrefix;
|
||||||
|
int16_t hashSuffix;
|
||||||
int8_t walLevel;
|
int8_t walLevel;
|
||||||
int8_t precision;
|
int8_t precision;
|
||||||
int8_t compression;
|
int8_t compression;
|
||||||
int8_t replications;
|
int8_t replications;
|
||||||
int8_t strict;
|
int8_t strict;
|
||||||
int8_t cacheLast;
|
int8_t cacheLast;
|
||||||
|
int32_t tsdbPageSize;
|
||||||
|
int32_t walRetentionPeriod;
|
||||||
|
int32_t walRollPeriod;
|
||||||
|
int64_t walRetentionSize;
|
||||||
|
int64_t walSegmentSize;
|
||||||
int32_t numOfRetensions;
|
int32_t numOfRetensions;
|
||||||
SArray* pRetensions;
|
SArray* pRetensions;
|
||||||
int8_t schemaless;
|
int8_t schemaless;
|
||||||
|
|
|
@ -265,6 +265,7 @@ typedef struct SShowStmt {
|
||||||
typedef struct SShowCreateDatabaseStmt {
|
typedef struct SShowCreateDatabaseStmt {
|
||||||
ENodeType type;
|
ENodeType type;
|
||||||
char dbName[TSDB_DB_NAME_LEN];
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
|
char dbFName[TSDB_DB_FNAME_LEN];
|
||||||
void* pCfg; // SDbCfgInfo
|
void* pCfg; // SDbCfgInfo
|
||||||
} SShowCreateDatabaseStmt;
|
} SShowCreateDatabaseStmt;
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,9 @@ rd /s /Q C:\TDengine
|
||||||
cmake --install .
|
cmake --install .
|
||||||
if not %errorlevel% == 0 ( call :RUNFAILED build x64 failed & exit /b 1)
|
if not %errorlevel% == 0 ( call :RUNFAILED build x64 failed & exit /b 1)
|
||||||
cd %package_dir%
|
cd %package_dir%
|
||||||
iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release
|
iscc /DMyAppInstallName="%packagServerName_x64%" /DMyAppVersion="%2" /DCusName="TDengine" /DCusPrompt="taos" /DMyAppExcludeSource="" tools\tdengine.iss /O..\release
|
||||||
if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x64% failed & exit /b 1)
|
if not %errorlevel% == 0 ( call :RUNFAILED package %packagServerName_x64% failed & exit /b 1)
|
||||||
iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release
|
iscc /DMyAppInstallName="%packagClientName_x64%" /DMyAppVersion="%2" /DCusName="TDengine" /DCusPrompt="taos" /DMyAppExcludeSource="taosd.exe" tools\tdengine.iss /O..\release
|
||||||
if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x64% failed & exit /b 1)
|
if not %errorlevel% == 0 ( call :RUNFAILED package %packagClientName_x64% failed & exit /b 1)
|
||||||
|
|
||||||
goto EXIT0
|
goto EXIT0
|
||||||
|
|
|
@ -2003,7 +2003,7 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
|
||||||
switch (pColInfoData->info.type) {
|
switch (pColInfoData->info.type) {
|
||||||
case TSDB_DATA_TYPE_TIMESTAMP:
|
case TSDB_DATA_TYPE_TIMESTAMP:
|
||||||
memset(pBuf, 0, sizeof(pBuf));
|
memset(pBuf, 0, sizeof(pBuf));
|
||||||
formatTimestamp(pBuf, *(uint64_t*)var, TSDB_TIME_PRECISION_MILLI);
|
formatTimestamp(pBuf, *(uint64_t*)var, pColInfoData->info.precision);
|
||||||
len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf);
|
len += snprintf(dumpBuf + len, size - len, " %25s |", pBuf);
|
||||||
if (len >= size - 1) return dumpBuf;
|
if (len >= size - 1) return dumpBuf;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,8 +41,8 @@ bool tsPrintAuth = false;
|
||||||
|
|
||||||
// queue & threads
|
// queue & threads
|
||||||
int32_t tsNumOfRpcThreads = 1;
|
int32_t tsNumOfRpcThreads = 1;
|
||||||
int32_t tsNumOfRpcSessions = 5000;
|
int32_t tsNumOfRpcSessions = 6000;
|
||||||
int32_t tsTimeToGetAvailableConn = 100000;
|
int32_t tsTimeToGetAvailableConn = 500000;
|
||||||
int32_t tsNumOfCommitThreads = 2;
|
int32_t tsNumOfCommitThreads = 2;
|
||||||
int32_t tsNumOfTaskQueueThreads = 4;
|
int32_t tsNumOfTaskQueueThreads = 4;
|
||||||
int32_t tsNumOfMnodeQueryThreads = 4;
|
int32_t tsNumOfMnodeQueryThreads = 4;
|
||||||
|
@ -521,7 +521,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
|
||||||
|
|
||||||
pItem = cfgGetItem(tsCfg, "numOfRpcSessions");
|
pItem = cfgGetItem(tsCfg, "numOfRpcSessions");
|
||||||
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
||||||
tsNumOfRpcSessions = 2000;
|
|
||||||
tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000);
|
tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 10000);
|
||||||
pItem->i32 = tsNumOfRpcSessions;
|
pItem->i32 = tsNumOfRpcSessions;
|
||||||
pItem->stype = stype;
|
pItem->stype = stype;
|
||||||
|
@ -529,7 +528,6 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
|
||||||
|
|
||||||
pItem = cfgGetItem(tsCfg, "timeToGetAvailableConn");
|
pItem = cfgGetItem(tsCfg, "timeToGetAvailableConn");
|
||||||
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
|
||||||
tsTimeToGetAvailableConn = 1000;
|
|
||||||
tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000);
|
tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000);
|
||||||
pItem->i32 = tsTimeToGetAvailableConn;
|
pItem->i32 = tsTimeToGetAvailableConn;
|
||||||
pItem->stype = stype;
|
pItem->stype = stype;
|
||||||
|
|
|
@ -2865,12 +2865,19 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
|
||||||
if (tEncodeI32(&encoder, pRsp->minRows) < 0) return -1;
|
if (tEncodeI32(&encoder, pRsp->minRows) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pRsp->maxRows) < 0) return -1;
|
if (tEncodeI32(&encoder, pRsp->maxRows) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pRsp->walFsyncPeriod) < 0) return -1;
|
if (tEncodeI32(&encoder, pRsp->walFsyncPeriod) < 0) return -1;
|
||||||
|
if (tEncodeI16(&encoder, pRsp->hashPrefix) < 0) return -1;
|
||||||
|
if (tEncodeI16(&encoder, pRsp->hashSuffix) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pRsp->walLevel) < 0) return -1;
|
if (tEncodeI8(&encoder, pRsp->walLevel) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pRsp->precision) < 0) return -1;
|
if (tEncodeI8(&encoder, pRsp->precision) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pRsp->compression) < 0) return -1;
|
if (tEncodeI8(&encoder, pRsp->compression) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pRsp->replications) < 0) return -1;
|
if (tEncodeI8(&encoder, pRsp->replications) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pRsp->strict) < 0) return -1;
|
if (tEncodeI8(&encoder, pRsp->strict) < 0) return -1;
|
||||||
if (tEncodeI8(&encoder, pRsp->cacheLast) < 0) return -1;
|
if (tEncodeI8(&encoder, pRsp->cacheLast) < 0) return -1;
|
||||||
|
if (tEncodeI32(&encoder, pRsp->tsdbPageSize) < 0) return -1;
|
||||||
|
if (tEncodeI32(&encoder, pRsp->walRetentionPeriod) < 0) return -1;
|
||||||
|
if (tEncodeI32(&encoder, pRsp->walRollPeriod) < 0) return -1;
|
||||||
|
if (tEncodeI64(&encoder, pRsp->walRetentionSize) < 0) return -1;
|
||||||
|
if (tEncodeI64(&encoder, pRsp->walSegmentSize) < 0) return -1;
|
||||||
if (tEncodeI32(&encoder, pRsp->numOfRetensions) < 0) return -1;
|
if (tEncodeI32(&encoder, pRsp->numOfRetensions) < 0) return -1;
|
||||||
for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) {
|
for (int32_t i = 0; i < pRsp->numOfRetensions; ++i) {
|
||||||
SRetention *pRetension = taosArrayGet(pRsp->pRetensions, i);
|
SRetention *pRetension = taosArrayGet(pRsp->pRetensions, i);
|
||||||
|
@ -2905,12 +2912,19 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
|
||||||
if (tDecodeI32(&decoder, &pRsp->minRows) < 0) return -1;
|
if (tDecodeI32(&decoder, &pRsp->minRows) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pRsp->maxRows) < 0) return -1;
|
if (tDecodeI32(&decoder, &pRsp->maxRows) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pRsp->walFsyncPeriod) < 0) return -1;
|
if (tDecodeI32(&decoder, &pRsp->walFsyncPeriod) < 0) return -1;
|
||||||
|
if (tDecodeI16(&decoder, &pRsp->hashPrefix) < 0) return -1;
|
||||||
|
if (tDecodeI16(&decoder, &pRsp->hashSuffix) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pRsp->walLevel) < 0) return -1;
|
if (tDecodeI8(&decoder, &pRsp->walLevel) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pRsp->precision) < 0) return -1;
|
if (tDecodeI8(&decoder, &pRsp->precision) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pRsp->compression) < 0) return -1;
|
if (tDecodeI8(&decoder, &pRsp->compression) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pRsp->replications) < 0) return -1;
|
if (tDecodeI8(&decoder, &pRsp->replications) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pRsp->strict) < 0) return -1;
|
if (tDecodeI8(&decoder, &pRsp->strict) < 0) return -1;
|
||||||
if (tDecodeI8(&decoder, &pRsp->cacheLast) < 0) return -1;
|
if (tDecodeI8(&decoder, &pRsp->cacheLast) < 0) return -1;
|
||||||
|
if (tDecodeI32(&decoder, &pRsp->tsdbPageSize) < 0) return -1;
|
||||||
|
if (tDecodeI32(&decoder, &pRsp->walRetentionPeriod) < 0) return -1;
|
||||||
|
if (tDecodeI32(&decoder, &pRsp->walRollPeriod) < 0) return -1;
|
||||||
|
if (tDecodeI64(&decoder, &pRsp->walRetentionSize) < 0) return -1;
|
||||||
|
if (tDecodeI64(&decoder, &pRsp->walSegmentSize) < 0) return -1;
|
||||||
if (tDecodeI32(&decoder, &pRsp->numOfRetensions) < 0) return -1;
|
if (tDecodeI32(&decoder, &pRsp->numOfRetensions) < 0) return -1;
|
||||||
if (pRsp->numOfRetensions > 0) {
|
if (pRsp->numOfRetensions > 0) {
|
||||||
pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention));
|
pRsp->pRetensions = taosArrayInit(pRsp->numOfRetensions, sizeof(SRetention));
|
||||||
|
|
|
@ -108,7 +108,8 @@ typedef enum {
|
||||||
TRN_STAGE_UNDO_ACTION = 3,
|
TRN_STAGE_UNDO_ACTION = 3,
|
||||||
TRN_STAGE_COMMIT = 4,
|
TRN_STAGE_COMMIT = 4,
|
||||||
TRN_STAGE_COMMIT_ACTION = 5,
|
TRN_STAGE_COMMIT_ACTION = 5,
|
||||||
TRN_STAGE_FINISHED = 6
|
TRN_STAGE_FINISHED = 6,
|
||||||
|
TRN_STAGE_PRE_FINISH = 7
|
||||||
} ETrnStage;
|
} ETrnStage;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -887,12 +887,19 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
|
||||||
cfgRsp.minRows = pDb->cfg.minRows;
|
cfgRsp.minRows = pDb->cfg.minRows;
|
||||||
cfgRsp.maxRows = pDb->cfg.maxRows;
|
cfgRsp.maxRows = pDb->cfg.maxRows;
|
||||||
cfgRsp.walFsyncPeriod = pDb->cfg.walFsyncPeriod;
|
cfgRsp.walFsyncPeriod = pDb->cfg.walFsyncPeriod;
|
||||||
|
cfgRsp.hashPrefix = pDb->cfg.hashPrefix;
|
||||||
|
cfgRsp.hashSuffix = pDb->cfg.hashSuffix;
|
||||||
cfgRsp.walLevel = pDb->cfg.walLevel;
|
cfgRsp.walLevel = pDb->cfg.walLevel;
|
||||||
cfgRsp.precision = pDb->cfg.precision;
|
cfgRsp.precision = pDb->cfg.precision;
|
||||||
cfgRsp.compression = pDb->cfg.compression;
|
cfgRsp.compression = pDb->cfg.compression;
|
||||||
cfgRsp.replications = pDb->cfg.replications;
|
cfgRsp.replications = pDb->cfg.replications;
|
||||||
cfgRsp.strict = pDb->cfg.strict;
|
cfgRsp.strict = pDb->cfg.strict;
|
||||||
cfgRsp.cacheLast = pDb->cfg.cacheLast;
|
cfgRsp.cacheLast = pDb->cfg.cacheLast;
|
||||||
|
cfgRsp.tsdbPageSize = pDb->cfg.tsdbPageSize;
|
||||||
|
cfgRsp.walRetentionPeriod = pDb->cfg.walRetentionPeriod;
|
||||||
|
cfgRsp.walRollPeriod = pDb->cfg.walRollPeriod;
|
||||||
|
cfgRsp.walRetentionSize = pDb->cfg.walRetentionSize;
|
||||||
|
cfgRsp.walSegmentSize = pDb->cfg.walSegmentSize;
|
||||||
cfgRsp.numOfRetensions = pDb->cfg.numOfRetensions;
|
cfgRsp.numOfRetensions = pDb->cfg.numOfRetensions;
|
||||||
cfgRsp.pRetensions = pDb->cfg.pRetensions;
|
cfgRsp.pRetensions = pDb->cfg.pRetensions;
|
||||||
cfgRsp.schemaless = pDb->cfg.schemaless;
|
cfgRsp.schemaless = pDb->cfg.schemaless;
|
||||||
|
|
|
@ -460,6 +460,8 @@ static const char *mndTransStr(ETrnStage stage) {
|
||||||
return "commitAction";
|
return "commitAction";
|
||||||
case TRN_STAGE_FINISHED:
|
case TRN_STAGE_FINISHED:
|
||||||
return "finished";
|
return "finished";
|
||||||
|
case TRN_STAGE_PRE_FINISH:
|
||||||
|
return "pre-finish";
|
||||||
default:
|
default:
|
||||||
return "invalid";
|
return "invalid";
|
||||||
}
|
}
|
||||||
|
@ -600,10 +602,15 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOld->stage == TRN_STAGE_ROLLBACK) {
|
if (pOld->stage == TRN_STAGE_ROLLBACK) {
|
||||||
pOld->stage = TRN_STAGE_REDO_ACTION;
|
pOld->stage = TRN_STAGE_UNDO_ACTION;
|
||||||
mTrace("trans:%d, stage from rollback to undoAction since perform update action", pNew->id);
|
mTrace("trans:%d, stage from rollback to undoAction since perform update action", pNew->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pOld->stage == TRN_STAGE_PRE_FINISH) {
|
||||||
|
pOld->stage = TRN_STAGE_FINISHED;
|
||||||
|
mTrace("trans:%d, stage from pre-finish to finished since perform update action", pNew->id);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,6 +940,16 @@ static int32_t mndTransRollback(SMnode *pMnode, STrans *pTrans) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32_t mndTransPreFinish(SMnode *pMnode, STrans *pTrans) {
|
||||||
|
mInfo("trans:%d, pre-finish transaction", pTrans->id);
|
||||||
|
if (mndTransSync(pMnode, pTrans) != 0) {
|
||||||
|
mError("trans:%d, failed to pre-finish since %s", pTrans->id, terrstr());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
mInfo("trans:%d, pre-finish finished", pTrans->id);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
|
static void mndTransSendRpcRsp(SMnode *pMnode, STrans *pTrans) {
|
||||||
bool sendRsp = false;
|
bool sendRsp = false;
|
||||||
int32_t code = pTrans->code;
|
int32_t code = pTrans->code;
|
||||||
|
@ -1439,7 +1456,7 @@ static bool mndTransPerformCommitActionStage(SMnode *pMnode, STrans *pTrans) {
|
||||||
|
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
pTrans->code = 0;
|
pTrans->code = 0;
|
||||||
pTrans->stage = TRN_STAGE_FINISHED;
|
pTrans->stage = TRN_STAGE_FINISHED; // TRN_STAGE_PRE_FINISH is not necessary
|
||||||
mInfo("trans:%d, stage from commitAction to finished", pTrans->id);
|
mInfo("trans:%d, stage from commitAction to finished", pTrans->id);
|
||||||
continueExec = true;
|
continueExec = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1457,8 +1474,8 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans) {
|
||||||
int32_t code = mndTransExecuteUndoActions(pMnode, pTrans);
|
int32_t code = mndTransExecuteUndoActions(pMnode, pTrans);
|
||||||
|
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
pTrans->stage = TRN_STAGE_FINISHED;
|
pTrans->stage = TRN_STAGE_PRE_FINISH;
|
||||||
mInfo("trans:%d, stage from undoAction to finished", pTrans->id);
|
mInfo("trans:%d, stage from undoAction to pre-finish", pTrans->id);
|
||||||
continueExec = true;
|
continueExec = true;
|
||||||
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) {
|
} else if (code == TSDB_CODE_ACTION_IN_PROGRESS) {
|
||||||
mInfo("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code));
|
mInfo("trans:%d, stage keep on undoAction since %s", pTrans->id, tstrerror(code));
|
||||||
|
@ -1491,6 +1508,25 @@ static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans) {
|
||||||
return continueExec;
|
return continueExec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool mndTransPerfromPreFinishedStage(SMnode *pMnode, STrans *pTrans) {
|
||||||
|
if (mndCannotExecuteTransAction(pMnode)) return false;
|
||||||
|
|
||||||
|
bool continueExec = true;
|
||||||
|
int32_t code = mndTransPreFinish(pMnode, pTrans);
|
||||||
|
|
||||||
|
if (code == 0) {
|
||||||
|
pTrans->stage = TRN_STAGE_FINISHED;
|
||||||
|
mInfo("trans:%d, stage from pre-finish to finish", pTrans->id);
|
||||||
|
continueExec = true;
|
||||||
|
} else {
|
||||||
|
pTrans->failedTimes++;
|
||||||
|
mError("trans:%d, stage keep on pre-finish since %s, failedTimes:%d", pTrans->id, terrstr(), pTrans->failedTimes);
|
||||||
|
continueExec = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return continueExec;
|
||||||
|
}
|
||||||
|
|
||||||
static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
|
static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans) {
|
||||||
bool continueExec = false;
|
bool continueExec = false;
|
||||||
|
|
||||||
|
@ -1547,6 +1583,14 @@ void mndTransExecute(SMnode *pMnode, STrans *pTrans, bool isLeader) {
|
||||||
case TRN_STAGE_UNDO_ACTION:
|
case TRN_STAGE_UNDO_ACTION:
|
||||||
continueExec = mndTransPerformUndoActionStage(pMnode, pTrans);
|
continueExec = mndTransPerformUndoActionStage(pMnode, pTrans);
|
||||||
break;
|
break;
|
||||||
|
case TRN_STAGE_PRE_FINISH:
|
||||||
|
if (isLeader) {
|
||||||
|
continueExec = mndTransPerfromPreFinishedStage(pMnode, pTrans);
|
||||||
|
} else {
|
||||||
|
mInfo("trans:%d, can not pre-finish since not leader", pTrans->id);
|
||||||
|
continueExec = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case TRN_STAGE_FINISHED:
|
case TRN_STAGE_FINISHED:
|
||||||
continueExec = mndTransPerfromFinishedStage(pMnode, pTrans);
|
continueExec = mndTransPerfromFinishedStage(pMnode, pTrans);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -160,6 +160,7 @@ static int32_t sdbInsertRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
|
||||||
if (insertFp != NULL) {
|
if (insertFp != NULL) {
|
||||||
code = (*insertFp)(pSdb, pRow->pObj);
|
code = (*insertFp)(pSdb, pRow->pObj);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
if (terrno == 0) terrno = TSDB_CODE_MND_TRANS_UNKNOW_ERROR;
|
||||||
code = terrno;
|
code = terrno;
|
||||||
taosHashRemove(hash, pRow->pObj, keySize);
|
taosHashRemove(hash, pRow->pObj, keySize);
|
||||||
sdbFreeRow(pSdb, pRow, false);
|
sdbFreeRow(pSdb, pRow, false);
|
||||||
|
|
|
@ -766,6 +766,7 @@ typedef struct SCacheRowsReader {
|
||||||
TdThreadMutex readerMutex;
|
TdThreadMutex readerMutex;
|
||||||
SVnode *pVnode;
|
SVnode *pVnode;
|
||||||
STSchema *pSchema;
|
STSchema *pSchema;
|
||||||
|
STSchema *pCurrSchema;
|
||||||
uint64_t uid;
|
uint64_t uid;
|
||||||
uint64_t suid;
|
uint64_t suid;
|
||||||
char **transferBuf; // todo remove it soon
|
char **transferBuf; // todo remove it soon
|
||||||
|
|
|
@ -147,7 +147,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
|
||||||
}
|
}
|
||||||
tqDebug("tmqsnap task execute end, get %p", pDataBlock);
|
tqDebug("tmqsnap task execute end, get %p", pDataBlock);
|
||||||
|
|
||||||
if (pDataBlock != NULL) {
|
if (pDataBlock != NULL && pDataBlock->info.rows > 0) {
|
||||||
if (pRsp->withTbName) {
|
if (pRsp->withTbName) {
|
||||||
if (pOffset->type == TMQ_OFFSET__LOG) {
|
if (pOffset->type == TMQ_OFFSET__LOG) {
|
||||||
int64_t uid = pExec->pExecReader->lastBlkUid;
|
int64_t uid = pExec->pExecReader->lastBlkUid;
|
||||||
|
|
|
@ -1390,17 +1390,57 @@ _err:
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) {
|
static int32_t cloneTSchema(STSchema *pSrc, STSchema **ppDst) {
|
||||||
int32_t code = 0;
|
int32_t len = sizeof(STSchema) + sizeof(STColumn) * pSrc->numOfCols;
|
||||||
|
*ppDst = taosMemoryMalloc(len);
|
||||||
|
if (NULL == *ppDst) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
memcpy(*ppDst, pSrc, len);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t updateTSchema(int32_t sversion, SCacheRowsReader *pReader, uint64_t uid) {
|
||||||
|
if (NULL == pReader->pCurrSchema && sversion == pReader->pSchema->version) {
|
||||||
|
return cloneTSchema(pReader->pSchema, &pReader->pCurrSchema);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NULL != pReader->pCurrSchema && sversion == pReader->pCurrSchema->version) {
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFreeClear(pReader->pCurrSchema);
|
||||||
|
return metaGetTbTSchemaEx(pReader->pTsdb->pVnode->pMeta, pReader->suid, uid, sversion, &pReader->pCurrSchema);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t initLastColArray(STSchema *pTSchema, SArray **ppColArray) {
|
||||||
|
SArray *pColArray = taosArrayInit(pTSchema->numOfCols, sizeof(SLastCol));
|
||||||
|
if (NULL == pColArray) {
|
||||||
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < pTSchema->numOfCols; ++i) {
|
||||||
|
SLastCol col = {.ts = 0, .colVal = COL_VAL_NULL(pTSchema->columns[i].colId, pTSchema->columns[i].type)};
|
||||||
|
taosArrayPush(pColArray, &col);
|
||||||
|
}
|
||||||
|
*ppColArray = pColArray;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCacheRowsReader *pr) {
|
||||||
STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
|
STSchema *pTSchema = pr->pSchema; // metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
|
||||||
int16_t nCol = pTSchema->numOfCols;
|
int16_t nLastCol = pTSchema->numOfCols;
|
||||||
int16_t iCol = 0;
|
|
||||||
int16_t noneCol = 0;
|
int16_t noneCol = 0;
|
||||||
bool setNoneCol = false;
|
bool setNoneCol = false;
|
||||||
SArray *pColArray = taosArrayInit(nCol, sizeof(SLastCol));
|
bool hasRow = false;
|
||||||
|
SArray *pColArray = NULL;
|
||||||
SColVal *pColVal = &(SColVal){0};
|
SColVal *pColVal = &(SColVal){0};
|
||||||
|
|
||||||
|
int32_t code = initLastColArray(pTSchema, &pColArray);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
TSKEY lastRowTs = TSKEY_MAX;
|
TSKEY lastRowTs = TSKEY_MAX;
|
||||||
|
|
||||||
CacheNextRowIter iter = {0};
|
CacheNextRowIter iter = {0};
|
||||||
|
@ -1415,6 +1455,15 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasRow = true;
|
||||||
|
|
||||||
|
code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid);
|
||||||
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
goto _err;
|
||||||
|
}
|
||||||
|
pTSchema = pr->pCurrSchema;
|
||||||
|
int16_t nCol = pTSchema->numOfCols;
|
||||||
|
|
||||||
TSKEY rowTs = TSDBROW_TS(pRow);
|
TSKEY rowTs = TSDBROW_TS(pRow);
|
||||||
|
|
||||||
if (lastRowTs == TSKEY_MAX) {
|
if (lastRowTs == TSKEY_MAX) {
|
||||||
|
@ -1422,28 +1471,27 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
|
||||||
STColumn *pTColumn = &pTSchema->columns[0];
|
STColumn *pTColumn = &pTSchema->columns[0];
|
||||||
|
|
||||||
*pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs});
|
*pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.val = lastRowTs});
|
||||||
if (taosArrayPush(pColArray, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal}) == NULL) {
|
taosArraySet(pColArray, 0, &(SLastCol){.ts = lastRowTs, .colVal = *pColVal});
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
goto _err;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (iCol = 1; iCol < nCol; ++iCol) {
|
for (int16_t iCol = 1; iCol < nCol; ++iCol) {
|
||||||
|
if (iCol >= nLastCol) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
SLastCol *pCol = taosArrayGet(pColArray, iCol);
|
||||||
|
if (pCol->colVal.cid != pTSchema->columns[iCol].colId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal);
|
tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal);
|
||||||
|
|
||||||
SLastCol lastCol = {.ts = lastRowTs, .colVal = *pColVal};
|
*pCol = (SLastCol){.ts = lastRowTs, .colVal = *pColVal};
|
||||||
if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) {
|
if (IS_VAR_DATA_TYPE(pColVal->type) && pColVal->value.nData > 0) {
|
||||||
lastCol.colVal.value.pData = taosMemoryMalloc(lastCol.colVal.value.nData);
|
pCol->colVal.value.pData = taosMemoryMalloc(pCol->colVal.value.nData);
|
||||||
if (lastCol.colVal.value.pData == NULL) {
|
if (pCol->colVal.value.pData == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
memcpy(lastCol.colVal.value.pData, pColVal->value.pData, pColVal->value.nData);
|
memcpy(pCol->colVal.value.pData, pColVal->value.pData, pColVal->value.nData);
|
||||||
}
|
|
||||||
|
|
||||||
if (taosArrayPush(pColArray, &lastCol) == NULL) {
|
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
|
||||||
goto _err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!COL_VAL_IS_VALUE(pColVal) && !setNoneCol) {
|
if (!COL_VAL_IS_VALUE(pColVal) && !setNoneCol) {
|
||||||
|
@ -1461,9 +1509,15 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
|
||||||
|
|
||||||
// merge into pColArray
|
// merge into pColArray
|
||||||
setNoneCol = false;
|
setNoneCol = false;
|
||||||
for (iCol = noneCol; iCol < nCol; ++iCol) {
|
for (int16_t iCol = noneCol; iCol < nCol; ++iCol) {
|
||||||
|
if (iCol >= nLastCol) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
// high version's column value
|
// high version's column value
|
||||||
SLastCol *lastColVal = (SLastCol *)taosArrayGet(pColArray, iCol);
|
SLastCol *lastColVal = (SLastCol *)taosArrayGet(pColArray, iCol);
|
||||||
|
if (lastColVal->colVal.cid != pTSchema->columns[iCol].colId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
SColVal *tColVal = &lastColVal->colVal;
|
SColVal *tColVal = &lastColVal->colVal;
|
||||||
|
|
||||||
tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal);
|
tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal);
|
||||||
|
@ -1494,6 +1548,9 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach
|
||||||
//*ppLastArray = NULL;
|
//*ppLastArray = NULL;
|
||||||
// taosArrayDestroy(pColArray);
|
// taosArrayDestroy(pColArray);
|
||||||
//} else {
|
//} else {
|
||||||
|
if (!hasRow) {
|
||||||
|
taosArrayClear(pColArray);
|
||||||
|
}
|
||||||
*ppLastArray = pColArray;
|
*ppLastArray = pColArray;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
|
@ -209,6 +209,8 @@ void* tsdbCacherowsReaderClose(void* pReader) {
|
||||||
taosMemoryFree(p->pSchema);
|
taosMemoryFree(p->pSchema);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosMemoryFree(p->pCurrSchema);
|
||||||
|
|
||||||
destroyLastBlockLoadInfo(p->pLoadInfo);
|
destroyLastBlockLoadInfo(p->pLoadInfo);
|
||||||
|
|
||||||
taosMemoryFree((void*)p->idstr);
|
taosMemoryFree((void*)p->idstr);
|
||||||
|
@ -303,7 +305,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
|
||||||
|
|
||||||
for (int32_t i = 0; i < pr->pSchema->numOfCols; ++i) {
|
for (int32_t i = 0; i < pr->pSchema->numOfCols; ++i) {
|
||||||
struct STColumn* pCol = &pr->pSchema->columns[i];
|
struct STColumn* pCol = &pr->pSchema->columns[i];
|
||||||
SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type};
|
SLastCol p = {.ts = INT64_MIN, .colVal.type = pCol->type, .colVal.flag = CV_FLAG_NULL};
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
if (IS_VAR_DATA_TYPE(pCol->type)) {
|
||||||
p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char));
|
p.colVal.value.pData = taosMemoryCalloc(pCol->bytes, sizeof(char));
|
||||||
|
|
|
@ -3512,6 +3512,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
|
||||||
CHECK_FILEBLOCK_STATE* state) {
|
CHECK_FILEBLOCK_STATE* state) {
|
||||||
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo;
|
||||||
SBlockData* pBlockData = &pReader->status.fileBlockData;
|
SBlockData* pBlockData = &pReader->status.fileBlockData;
|
||||||
|
bool asc = ASCENDING_TRAVERSE(pReader->order);
|
||||||
|
|
||||||
*state = CHECK_FILEBLOCK_QUIT;
|
*state = CHECK_FILEBLOCK_QUIT;
|
||||||
int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1;
|
int32_t step = ASCENDING_TRAVERSE(pReader->order) ? 1 : -1;
|
||||||
|
@ -3522,7 +3523,7 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn
|
||||||
if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) {
|
if (loadNeighbor && (code == TSDB_CODE_SUCCESS)) {
|
||||||
pDumpInfo->rowIndex =
|
pDumpInfo->rowIndex =
|
||||||
doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step);
|
doMergeRowsInFileBlockImpl(pBlockData, pDumpInfo->rowIndex, key, pMerger, &pReader->verRange, step);
|
||||||
if (pDumpInfo->rowIndex >= pDumpInfo->totalRows) {
|
if ((pDumpInfo->rowIndex >= pDumpInfo->totalRows && asc) || (pDumpInfo->rowIndex < 0 && !asc)) {
|
||||||
*state = CHECK_FILEBLOCK_CONT;
|
*state = CHECK_FILEBLOCK_CONT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -599,16 +599,10 @@ static int32_t vnodeProcessTrimReq(SVnode *pVnode, int64_t version, void *pReq,
|
||||||
|
|
||||||
vInfo("vgId:%d, trim vnode request will be processed, time:%d", pVnode->config.vgId, trimReq.timestamp);
|
vInfo("vgId:%d, trim vnode request will be processed, time:%d", pVnode->config.vgId, trimReq.timestamp);
|
||||||
|
|
||||||
// process
|
// process
|
||||||
#if 0
|
|
||||||
code = tsdbDoRetention(pVnode->pTsdb, trimReq.timestamp);
|
|
||||||
if (code) goto _exit;
|
|
||||||
|
|
||||||
code = smaDoRetention(pVnode->pSma, trimReq.timestamp);
|
|
||||||
if (code) goto _exit;
|
|
||||||
#else
|
|
||||||
vnodeAsyncRentention(pVnode, trimReq.timestamp);
|
vnodeAsyncRentention(pVnode, trimReq.timestamp);
|
||||||
#endif
|
tsem_wait(&pVnode->canCommit);
|
||||||
|
tsem_post(&pVnode->canCommit);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
return code;
|
return code;
|
||||||
|
@ -633,18 +627,7 @@ static int32_t vnodeProcessDropTtlTbReq(SVnode *pVnode, int64_t version, void *p
|
||||||
tqUpdateTbUidList(pVnode->pTq, tbUids, false);
|
tqUpdateTbUidList(pVnode->pTq, tbUids, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
// process
|
|
||||||
ret = tsdbDoRetention(pVnode->pTsdb, ttlReq.timestamp);
|
|
||||||
if (ret) goto end;
|
|
||||||
|
|
||||||
ret = smaDoRetention(pVnode->pSma, ttlReq.timestamp);
|
|
||||||
if (ret) goto end;
|
|
||||||
#else
|
|
||||||
vnodeAsyncRentention(pVnode, ttlReq.timestamp);
|
vnodeAsyncRentention(pVnode, ttlReq.timestamp);
|
||||||
tsem_wait(&pVnode->canCommit);
|
|
||||||
tsem_post(&pVnode->canCommit);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
taosArrayDestroy(tbUids);
|
taosArrayDestroy(tbUids);
|
||||||
|
@ -1228,6 +1211,44 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq
|
||||||
tDecoderClear(&dc);
|
tDecoderClear(&dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// scan
|
||||||
|
TSKEY now = taosGetTimestamp(pVnode->config.tsdbCfg.precision);
|
||||||
|
TSKEY minKey = now - tsTickPerMin[pVnode->config.tsdbCfg.precision] * pVnode->config.tsdbCfg.keep2;
|
||||||
|
TSKEY maxKey = tsMaxKeyByPrecision[pVnode->config.tsdbCfg.precision];
|
||||||
|
for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) {
|
||||||
|
SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i);
|
||||||
|
|
||||||
|
if (pSubmitTbData->flags & SUBMIT_REQ_COLUMN_DATA_FORMAT) {
|
||||||
|
if (TARRAY_SIZE(pSubmitTbData->aCol) <= 0) {
|
||||||
|
code = TSDB_CODE_INVALID_MSG;
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
SColData *pColData = (SColData *)taosArrayGet(pSubmitTbData->aCol, 0);
|
||||||
|
TSKEY *aKey = (TSKEY *)(pColData->pData);
|
||||||
|
|
||||||
|
for (int32_t iRow = 0; iRow < pColData->nVal; iRow++) {
|
||||||
|
if (aKey[iRow] < minKey || aKey[iRow] > maxKey || (iRow > 0 && aKey[iRow] <= aKey[iRow - 1])) {
|
||||||
|
code = TSDB_CODE_INVALID_MSG;
|
||||||
|
vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version);
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
int32_t nRow = TARRAY_SIZE(pSubmitTbData->aRowP);
|
||||||
|
SRow **aRow = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP);
|
||||||
|
|
||||||
|
for (int32_t iRow = 0; iRow < nRow; ++iRow) {
|
||||||
|
if (aRow[iRow]->ts < minKey || aRow[iRow]->ts > maxKey || (iRow > 0 && aRow[iRow]->ts <= aRow[iRow - 1]->ts)) {
|
||||||
|
code = TSDB_CODE_INVALID_MSG;
|
||||||
|
vError("vgId:%d %s failed since %s, version:%" PRId64, TD_VID(pVnode), __func__, tstrerror(terrno), version);
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) {
|
for (int32_t i = 0; i < TARRAY_SIZE(pSubmitReq->aSubmitTbData); ++i) {
|
||||||
SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i);
|
SSubmitTbData *pSubmitTbData = taosArrayGet(pSubmitReq->aSubmitTbData, i);
|
||||||
|
|
||||||
|
@ -1647,7 +1668,8 @@ static int32_t vnodeProcessCompactVnodeReq(SVnode *pVnode, int64_t version, void
|
||||||
return vnodeProcessCompactVnodeReqImpl(pVnode, version, pReq, len, pRsp);
|
return vnodeProcessCompactVnodeReqImpl(pVnode, version, pReq, len, pRsp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef TD_ENTERPRISE
|
#ifndef TD_ENTERPRISE
|
||||||
int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) { return 0; }
|
int32_t vnodeProcessCompactVnodeReqImpl(SVnode *pVnode, int64_t version, void *pReq, int32_t len, SRpcMsg *pRsp) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -248,13 +248,13 @@ static const char* cacheModelStr(int8_t cacheModel) {
|
||||||
return TSDB_CACHE_MODEL_NONE_STR;
|
return TSDB_CACHE_MODEL_NONE_STR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, SDbCfgInfo* pCfg) {
|
static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName, char* dbFName, SDbCfgInfo* pCfg) {
|
||||||
blockDataEnsureCapacity(pBlock, 1);
|
blockDataEnsureCapacity(pBlock, 1);
|
||||||
pBlock->info.rows = 1;
|
pBlock->info.rows = 1;
|
||||||
|
|
||||||
SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0);
|
SColumnInfoData* pCol1 = taosArrayGet(pBlock->pDataBlock, 0);
|
||||||
char buf1[SHOW_CREATE_DB_RESULT_FIELD1_LEN] = {0};
|
char buf1[SHOW_CREATE_DB_RESULT_FIELD1_LEN] = {0};
|
||||||
STR_TO_VARSTR(buf1, dbFName);
|
STR_TO_VARSTR(buf1, dbName);
|
||||||
colDataSetVal(pCol1, 0, buf1, false);
|
colDataSetVal(pCol1, 0, buf1, false);
|
||||||
|
|
||||||
SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1);
|
SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1);
|
||||||
|
@ -277,16 +277,20 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
|
||||||
}
|
}
|
||||||
|
|
||||||
char* retentions = buildRetension(pCfg->pRetensions);
|
char* retentions = buildRetension(pCfg->pRetensions);
|
||||||
|
int32_t dbFNameLen = strlen(dbFName);
|
||||||
|
int32_t hashPrefix = (pCfg->hashPrefix > (dbFNameLen + 1)) ? (pCfg->hashPrefix - dbFNameLen - 1) : 0;
|
||||||
|
|
||||||
len += sprintf(
|
len += sprintf(
|
||||||
buf2 + VARSTR_HEADER_SIZE,
|
buf2 + VARSTR_HEADER_SIZE,
|
||||||
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
|
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
|
||||||
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
|
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
|
||||||
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d",
|
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d "
|
||||||
dbFName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile,
|
"WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64 " WAL_ROLL_PERIOD %d WAL_SEGMENT_SIZE %" PRId64,
|
||||||
|
dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile,
|
||||||
pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2,
|
pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2,
|
||||||
pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups,
|
pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups,
|
||||||
1 == pCfg->numOfStables);
|
1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod,
|
||||||
|
pCfg->walRetentionSize, pCfg->walRollPeriod, pCfg->walSegmentSize);
|
||||||
|
|
||||||
if (retentions) {
|
if (retentions) {
|
||||||
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions);
|
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions);
|
||||||
|
@ -404,7 +408,7 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT
|
||||||
SSDataBlock* pBlock = NULL;
|
SSDataBlock* pBlock = NULL;
|
||||||
int32_t code = buildCreateDBResultDataBlock(&pBlock);
|
int32_t code = buildCreateDBResultDataBlock(&pBlock);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->pCfg);
|
setCreateDBResultIntoDataBlock(pBlock, pStmt->dbName, pStmt->dbFName, pStmt->pCfg);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = buildRetrieveTableRsp(pBlock, SHOW_CREATE_DB_RESULT_COLS, pRsp);
|
code = buildRetrieveTableRsp(pBlock, SHOW_CREATE_DB_RESULT_COLS, pRsp);
|
||||||
|
|
|
@ -310,6 +310,7 @@ int32_t eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* p
|
||||||
pSup->rowEntryInfoOffset, pTaskInfo);
|
pSup->rowEntryInfoOffset, pTaskInfo);
|
||||||
|
|
||||||
pRes->info.rows += pInfo->pRow->numOfRows;
|
pRes->info.rows += pInfo->pRow->numOfRows;
|
||||||
|
pInfo->pRow->numOfRows = 0;
|
||||||
|
|
||||||
pInfo->inWindow = false;
|
pInfo->inWindow = false;
|
||||||
rowIndex += 1;
|
rowIndex += 1;
|
||||||
|
|
|
@ -1211,7 +1211,8 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
|
||||||
} else {
|
} else {
|
||||||
res = translateNormalValue(pCxt, pVal, targetDt, strict);
|
res = translateNormalValue(pCxt, pVal, targetDt, strict);
|
||||||
}
|
}
|
||||||
pVal->node.resType = targetDt;
|
pVal->node.resType.type = targetDt.type;
|
||||||
|
pVal->node.resType.bytes = targetDt.bytes;
|
||||||
pVal->node.resType.scale = pVal->unit;
|
pVal->node.resType.scale = pVal->unit;
|
||||||
pVal->translate = true;
|
pVal->translate = true;
|
||||||
if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) {
|
if (!strict && TSDB_DATA_TYPE_UBIGINT == pVal->node.resType.type && pVal->datum.u <= INT64_MAX) {
|
||||||
|
@ -2796,6 +2797,10 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
bool other;
|
bool other;
|
||||||
int32_t code = translateOrderByPosition(pCxt, pSelect->pProjectionList, pSelect->pOrderByList, &other);
|
int32_t code = translateOrderByPosition(pCxt, pSelect->pProjectionList, pSelect->pOrderByList, &other);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
if (0 == LIST_LENGTH(pSelect->pOrderByList)) {
|
||||||
|
NODES_DESTORY_LIST(pSelect->pOrderByList);
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
if (!other) {
|
if (!other) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -6477,6 +6482,11 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
|
||||||
if (NULL == pStmt->pCfg) {
|
if (NULL == pStmt->pCfg) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SName name;
|
||||||
|
tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
||||||
|
tNameGetFullDbName(&name, pStmt->dbFName);
|
||||||
|
|
||||||
return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg);
|
return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -915,6 +915,7 @@ int32_t vectorConvertSingleCol(SScalarParam *input, SScalarParam *output, int32_
|
||||||
|
|
||||||
SDataType t = {.type = type};
|
SDataType t = {.type = type};
|
||||||
t.bytes = IS_VAR_DATA_TYPE(t.type)? input->columnData->info.bytes:tDataTypes[type].bytes;
|
t.bytes = IS_VAR_DATA_TYPE(t.type)? input->columnData->info.bytes:tDataTypes[type].bytes;
|
||||||
|
t.precision = input->columnData->info.precision;
|
||||||
|
|
||||||
int32_t code = sclCreateColumnInfoData(&t, input->numOfRows, output);
|
int32_t code = sclCreateColumnInfoData(&t, input->numOfRows, output);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -278,6 +278,7 @@ int32_t streamDispatchOneRecoverFinishReq(SStreamTask* pTask, const SStreamRecov
|
||||||
msg.contLen = tlen + sizeof(SMsgHead);
|
msg.contLen = tlen + sizeof(SMsgHead);
|
||||||
msg.pCont = buf;
|
msg.pCont = buf;
|
||||||
msg.msgType = TDMT_STREAM_RECOVER_FINISH;
|
msg.msgType = TDMT_STREAM_RECOVER_FINISH;
|
||||||
|
msg.info.noResp = 1;
|
||||||
|
|
||||||
tmsgSendReq(pEpSet, &msg);
|
tmsgSendReq(pEpSet, &msg);
|
||||||
|
|
||||||
|
@ -522,4 +523,3 @@ FREE:
|
||||||
taosFreeQitem(pBlock);
|
taosFreeQitem(pBlock);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1173,7 +1173,7 @@ static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
|
||||||
addr.sin_port = (uint16_t)htons(pList->port);
|
addr.sin_port = (uint16_t)htons(pList->port);
|
||||||
|
|
||||||
tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst);
|
tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst);
|
||||||
int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 4);
|
int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn,
|
tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn,
|
||||||
tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
tstrerror(TAOS_SYSTEM_ERROR(errno)));
|
||||||
|
|
|
@ -677,14 +677,21 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) {
|
||||||
SServerObj* pObj = container_of(stream, SServerObj, server);
|
SServerObj* pObj = container_of(stream, SServerObj, server);
|
||||||
|
|
||||||
uv_tcp_t* cli = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
|
uv_tcp_t* cli = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
|
||||||
uv_tcp_init(pObj->loop, cli);
|
if (cli == NULL) return;
|
||||||
|
|
||||||
if (uv_accept(stream, (uv_stream_t*)cli) == 0) {
|
int err = uv_tcp_init(pObj->loop, cli);
|
||||||
|
if (err != 0) {
|
||||||
|
tError("failed to create tcp: %s", uv_err_name(err));
|
||||||
|
taosMemoryFree(cli);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
err = uv_accept(stream, (uv_stream_t*)cli);
|
||||||
|
if (err == 0) {
|
||||||
#if defined(WINDOWS) || defined(DARWIN)
|
#if defined(WINDOWS) || defined(DARWIN)
|
||||||
if (pObj->numOfWorkerReady < pObj->numOfThreads) {
|
if (pObj->numOfWorkerReady < pObj->numOfThreads) {
|
||||||
tError("worker-threads are not ready for all, need %d instead of %d.", pObj->numOfThreads,
|
tError("worker-threads are not ready for all, need %d instead of %d.", pObj->numOfThreads,
|
||||||
pObj->numOfWorkerReady);
|
pObj->numOfWorkerReady);
|
||||||
uv_close((uv_handle_t*)cli, NULL);
|
uv_close((uv_handle_t*)cli, uvFreeCb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -700,8 +707,10 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) {
|
||||||
uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb);
|
uv_write2(wr, (uv_stream_t*)&(pObj->pipe[pObj->workerIdx][0]), &buf, 1, (uv_stream_t*)cli, uvOnPipeWriteCb);
|
||||||
} else {
|
} else {
|
||||||
if (!uv_is_closing((uv_handle_t*)cli)) {
|
if (!uv_is_closing((uv_handle_t*)cli)) {
|
||||||
uv_close((uv_handle_t*)cli, NULL);
|
tError("failed to accept tcp: %s", uv_err_name(err));
|
||||||
|
uv_close((uv_handle_t*)cli, uvFreeCb);
|
||||||
} else {
|
} else {
|
||||||
|
tError("failed to accept tcp: %s", uv_err_name(err));
|
||||||
taosMemoryFree(cli);
|
taosMemoryFree(cli);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,20 +387,33 @@ END:
|
||||||
|
|
||||||
int32_t walRollImpl(SWal *pWal) {
|
int32_t walRollImpl(SWal *pWal) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
|
||||||
if (pWal->pIdxFile != NULL) {
|
if (pWal->pIdxFile != NULL) {
|
||||||
|
code = taosFsyncFile(pWal->pIdxFile);
|
||||||
|
if (code != 0) {
|
||||||
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
goto END;
|
||||||
|
}
|
||||||
code = taosCloseFile(&pWal->pIdxFile);
|
code = taosCloseFile(&pWal->pIdxFile);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWal->pLogFile != NULL) {
|
if (pWal->pLogFile != NULL) {
|
||||||
|
code = taosFsyncFile(pWal->pLogFile);
|
||||||
|
if (code != 0) {
|
||||||
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
|
goto END;
|
||||||
|
}
|
||||||
code = taosCloseFile(&pWal->pLogFile);
|
code = taosCloseFile(&pWal->pLogFile);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
terrno = TAOS_SYSTEM_ERROR(errno);
|
terrno = TAOS_SYSTEM_ERROR(errno);
|
||||||
goto END;
|
goto END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TdFilePtr pIdxFile, pLogFile;
|
TdFilePtr pIdxFile, pLogFile;
|
||||||
// create new file
|
// create new file
|
||||||
int64_t newFileFirstVer = pWal->vers.lastVer + 1;
|
int64_t newFileFirstVer = pWal->vers.lastVer + 1;
|
||||||
|
|
|
@ -114,6 +114,7 @@ static void *taosProcessAlarmSignal(void *tharg) {
|
||||||
|
|
||||||
taosThreadCleanupPush(taosDeleteTimer, &timerId);
|
taosThreadCleanupPush(taosDeleteTimer, &timerId);
|
||||||
|
|
||||||
|
do {
|
||||||
struct itimerspec ts;
|
struct itimerspec ts;
|
||||||
ts.it_value.tv_sec = 0;
|
ts.it_value.tv_sec = 0;
|
||||||
ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK;
|
ts.it_value.tv_nsec = 1000000 * MSECONDS_PER_TICK;
|
||||||
|
@ -122,7 +123,7 @@ static void *taosProcessAlarmSignal(void *tharg) {
|
||||||
|
|
||||||
if (timer_settime(timerId, 0, &ts, NULL)) {
|
if (timer_settime(timerId, 0, &ts, NULL)) {
|
||||||
// printf("Failed to init timer");
|
// printf("Failed to init timer");
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int signo;
|
int signo;
|
||||||
|
@ -132,9 +133,9 @@ static void *taosProcessAlarmSignal(void *tharg) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* //printf("Signal handling: number %d ......\n", signo); */
|
/* //printf("Signal handling: number %d ......\n", signo); */
|
||||||
|
|
||||||
callback(0);
|
callback(0);
|
||||||
}
|
}
|
||||||
|
} while (0);
|
||||||
|
|
||||||
taosThreadCleanupPop(1);
|
taosThreadCleanupPop(1);
|
||||||
|
|
||||||
|
|
|
@ -42,17 +42,17 @@ class TDTestCase:
|
||||||
tdSql.query('show create database scd;')
|
tdSql.query('show create database scd;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd')
|
tdSql.checkData(0, 0, 'scd')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0")
|
||||||
|
|
||||||
tdSql.query('show create database scd2;')
|
tdSql.query('show create database scd2;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd2')
|
tdSql.checkData(0, 0, 'scd2')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0")
|
||||||
|
|
||||||
tdSql.query('show create database scd4')
|
tdSql.query('show create database scd4')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd4')
|
tdSql.checkData(0, 0, 'scd4')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0")
|
||||||
|
|
||||||
|
|
||||||
self.restartTaosd(1, dbname='scd')
|
self.restartTaosd(1, dbname='scd')
|
||||||
|
@ -60,17 +60,17 @@ class TDTestCase:
|
||||||
tdSql.query('show create database scd;')
|
tdSql.query('show create database scd;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd')
|
tdSql.checkData(0, 0, 'scd')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 1 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0")
|
||||||
|
|
||||||
tdSql.query('show create database scd2;')
|
tdSql.query('show create database scd2;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd2')
|
tdSql.checkData(0, 0, 'scd2')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0")
|
||||||
|
|
||||||
tdSql.query('show create database scd4')
|
tdSql.query('show create database scd4')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd4')
|
tdSql.checkData(0, 0, 'scd4')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 14400m WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 5256000m,5256000m,5256000m PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 0 WAL_RETENTION_SIZE 0 WAL_ROLL_PERIOD 0 WAL_SEGMENT_SIZE 0")
|
||||||
|
|
||||||
|
|
||||||
tdSql.execute('drop database scd')
|
tdSql.execute('drop database scd')
|
||||||
|
|
|
@ -632,6 +632,8 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -R
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -R
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -R
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/tb_100w_data_order.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/tb_100w_data_order.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py
|
||||||
|
@ -655,6 +657,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/csum.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/function_diff.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tagFilter.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/tagFilter.py
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py
|
||||||
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
|
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5
|
||||||
|
@ -738,7 +741,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -N 3 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
|
# ,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-1ctb.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStb.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 7-tmq/tmqDropStbCtb.py
|
||||||
|
@ -854,6 +857,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/sml.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 2
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 3
|
||||||
|
@ -952,6 +956,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/interp.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 3
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/distinct.py -Q 4
|
||||||
|
@ -1070,6 +1075,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/max_min_data.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/projectionDesc.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
|
||||||
|
|
|
@ -51,10 +51,24 @@ else
|
||||||
REP_DIR=/home/TDinternal
|
REP_DIR=/home/TDinternal
|
||||||
REP_REAL_PATH=$WORKDIR/TDinternal
|
REP_REAL_PATH=$WORKDIR/TDinternal
|
||||||
REP_MOUNT_PARAM=$REP_REAL_PATH:/home/TDinternal
|
REP_MOUNT_PARAM=$REP_REAL_PATH:/home/TDinternal
|
||||||
|
|
||||||
fi
|
fi
|
||||||
date
|
date
|
||||||
docker run \
|
docker run \
|
||||||
-v $REP_MOUNT_PARAM \
|
-v $REP_MOUNT_PARAM \
|
||||||
|
-v /root/.cargo/registry:/root/.cargo/registry \
|
||||||
|
-v /root/.cargo/git:/root/.cargo/git \
|
||||||
|
-v /root/go/pkg/mod:/root/go/pkg/mod \
|
||||||
|
-v /root/.cache/go-build:/root/.cache/go-build \
|
||||||
|
-v ${REP_REAL_PATH}/enterprise/src/plugins/taosx/target:${REP_DIR}/enterprise/src/plugins/taosx/target \
|
||||||
|
-v ${REP_REAL_PATH}/community/tools/taosws-rs/target:${REP_DIR}/community/tools/taosws-rs/target \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/cJson/:${REP_DIR}/community/contrib/cJson \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/googletest/:${REP_DIR}/community/contrib/googletest \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/cpp-stub/:${REP_DIR}/community/contrib/cpp-stub \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
|
||||||
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
|
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_TAOSX=true;make -j || exit 1"
|
||||||
|
|
||||||
if [[ -d ${WORKDIR}/debugNoSan ]] ;then
|
if [[ -d ${WORKDIR}/debugNoSan ]] ;then
|
||||||
|
@ -70,6 +84,19 @@ mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugNoSan
|
||||||
date
|
date
|
||||||
docker run \
|
docker run \
|
||||||
-v $REP_MOUNT_PARAM \
|
-v $REP_MOUNT_PARAM \
|
||||||
|
-v /root/.cargo/registry:/root/.cargo/registry \
|
||||||
|
-v /root/.cargo/git:/root/.cargo/git \
|
||||||
|
-v /root/go/pkg/mod:/root/go/pkg/mod \
|
||||||
|
-v /root/.cache/go-build:/root/.cache/go-build \
|
||||||
|
-v ${REP_REAL_PATH}/enterprise/src/plugins/taosx/target:${REP_DIR}/enterprise/src/plugins/taosx/target \
|
||||||
|
-v ${REP_REAL_PATH}/community/tools/taosws-rs/target:${REP_DIR}/community/tools/taosws-rs/target \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/cJson/:${REP_DIR}/community/contrib/cJson \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/googletest/:${REP_DIR}/community/contrib/googletest \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/cpp-stub/:${REP_DIR}/community/contrib/cpp-stub \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/libuv/:${REP_DIR}/community/contrib/libuv \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/lz4/:${REP_DIR}/community/contrib/lz4 \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/zlib/:${REP_DIR}/community/contrib/zlib \
|
||||||
|
-v ${REP_REAL_PATH}/community/contrib/jemalloc/:${REP_DIR}/community/contrib/jemalloc \
|
||||||
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 "
|
--rm --ulimit core=-1 taos_test:v1.0 sh -c "pip uninstall taospy -y;pip3 install taospy==2.7.2;cd $REP_DIR;rm -rf debug;mkdir -p debug;cd debug;cmake .. -DBUILD_HTTP=false -DBUILD_TOOLS=true -DBUILD_TEST=true -DWEBSOCKET=true -DBUILD_SANITIZER=1 -DTOOLS_SANITIZE=true -DTOOLS_BUILD_TYPE=Debug -DBUILD_TAOSX=true;make -j || exit 1 "
|
||||||
|
|
||||||
mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan
|
mv ${REP_REAL_PATH}/debug ${WORKDIR}/debugSan
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// TAOS standard API example. The same syntax as MySQL, but only a subset
|
||||||
|
// to compile: gcc -o demo demo.c -ltaos
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "taos.h" // TAOS header file
|
||||||
|
|
||||||
|
static void queryDB(TAOS *taos, char *command) {
|
||||||
|
int i;
|
||||||
|
TAOS_RES *pSql = NULL;
|
||||||
|
int32_t code = -1;
|
||||||
|
|
||||||
|
for (i = 0; i < 5; i++) {
|
||||||
|
if (NULL != pSql) {
|
||||||
|
taos_free_result(pSql);
|
||||||
|
pSql = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
pSql = taos_query(taos, command);
|
||||||
|
code = taos_errno(pSql);
|
||||||
|
if (0 == code) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (code != 0) {
|
||||||
|
fprintf(stderr, "Failed to run %s, reason: %s\n", command, taos_errstr(pSql));
|
||||||
|
taos_free_result(pSql);
|
||||||
|
taos_close(taos);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
taos_free_result(pSql);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Test(TAOS *taos, char *qstr);
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
char qstr[1024];
|
||||||
|
|
||||||
|
// connect to server
|
||||||
|
if (argc < 2) {
|
||||||
|
printf("please input server-ip \n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS *taos = taos_connect(argv[1], "root", "taosdata", NULL, 0);
|
||||||
|
if (taos == NULL) {
|
||||||
|
printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
Test(taos, qstr);
|
||||||
|
taos_close(taos);
|
||||||
|
taos_cleanup();
|
||||||
|
}
|
||||||
|
void Test(TAOS *taos, char *qstr) {
|
||||||
|
queryDB(taos, "drop database if exists demo");
|
||||||
|
queryDB(taos, "create database demo vgroups 1 minrows 10");
|
||||||
|
TAOS_RES *result;
|
||||||
|
queryDB(taos, "use demo");
|
||||||
|
|
||||||
|
queryDB(taos, "create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))");
|
||||||
|
printf("success to create table\n");
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (int32_t n = 0; n < 10; ++n) {
|
||||||
|
for (i = 0; i < 10; ++i) {
|
||||||
|
int32_t v = n * 10 + i;
|
||||||
|
sprintf(qstr, "insert into m1 values (%" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", (uint64_t)1546300800000, v, v, v, v*10000000, v*1.0, v*2.0, "hello");
|
||||||
|
printf("qstr: %s\n", qstr);
|
||||||
|
|
||||||
|
TAOS_RES *result1 = taos_query(taos, qstr);
|
||||||
|
if (result1 == NULL || taos_errno(result1) != 0) {
|
||||||
|
printf("failed to insert row, reason:%s\n", taos_errstr(result1));
|
||||||
|
taos_free_result(result1);
|
||||||
|
exit(1);
|
||||||
|
} else {
|
||||||
|
printf("insert row: %i\n", v);
|
||||||
|
}
|
||||||
|
taos_free_result(result1);
|
||||||
|
|
||||||
|
strcpy(qstr, "flush database demo");
|
||||||
|
result1 = taos_query(taos, qstr);
|
||||||
|
if (result1 == NULL || taos_errno(result1) != 0) {
|
||||||
|
printf("failed to fluash database, reason:%s\n", taos_errstr(result1));
|
||||||
|
taos_free_result(result1);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
taos_free_result(result1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// query the records
|
||||||
|
sprintf(qstr, "SELECT * FROM m1 order by ts desc");
|
||||||
|
result = taos_query(taos, qstr);
|
||||||
|
if (result == NULL || taos_errno(result) != 0) {
|
||||||
|
printf("failed to select, reason:%s\n", taos_errstr(result));
|
||||||
|
taos_free_result(result);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TAOS_ROW row;
|
||||||
|
int rows = 0;
|
||||||
|
int num_fields = taos_field_count(result);
|
||||||
|
TAOS_FIELD *fields = taos_fetch_fields(result);
|
||||||
|
|
||||||
|
printf("num_fields = %d\n", num_fields);
|
||||||
|
printf("select * from table order by ts desc, result:\n");
|
||||||
|
// fetch the records row by row
|
||||||
|
while ((row = taos_fetch_row(result))) {
|
||||||
|
char temp[1024] = {0};
|
||||||
|
rows++;
|
||||||
|
taos_print_row(temp, row, fields, num_fields);
|
||||||
|
printf("%s\n", temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
taos_free_result(result);
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ exe:
|
||||||
gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS)
|
gcc $(CFLAGS) ./batchprepare.c -o $(ROOT)batchprepare $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS)
|
gcc $(CFLAGS) ./stopquery.c -o $(ROOT)stopquery $(LFLAGS)
|
||||||
gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS)
|
gcc $(CFLAGS) ./dbTableRoute.c -o $(ROOT)dbTableRoute $(LFLAGS)
|
||||||
|
gcc $(CFLAGS) ./insertSameTs.c -o $(ROOT)insertSameTs $(LFLAGS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(ROOT)batchprepare
|
rm $(ROOT)batchprepare
|
||||||
|
|
|
@ -48,24 +48,35 @@ sleep 100
|
||||||
#===================================================================
|
#===================================================================
|
||||||
print =============== query data from child table
|
print =============== query data from child table
|
||||||
|
|
||||||
|
$loop_count = 0
|
||||||
|
|
||||||
|
loop0:
|
||||||
|
sleep 200
|
||||||
|
|
||||||
|
$loop_count = $loop_count + 1
|
||||||
|
if $loop_count == 20 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
|
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
|
||||||
|
|
||||||
print rows: $rows
|
print rows: $rows
|
||||||
print $data00 $data01 $data02 $data03
|
print $data00 $data01 $data02 $data03
|
||||||
if $rows != 1 then
|
if $rows != 1 then
|
||||||
return -1
|
goto loop0
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data01 != 234 then
|
if $data01 != 234 then
|
||||||
return -1
|
goto loop0
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != 234 then
|
if $data02 != 234 then
|
||||||
return -1
|
goto loop0
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != 234 then
|
if $data03 != 234 then
|
||||||
print expect 234, actual $data03
|
print expect 234, actual $data03
|
||||||
return -1
|
goto loop0
|
||||||
endi
|
endi
|
||||||
|
|
||||||
#===================================================================
|
#===================================================================
|
||||||
|
@ -77,23 +88,34 @@ sleep 100
|
||||||
#===================================================================
|
#===================================================================
|
||||||
print =============== query data from child table
|
print =============== query data from child table
|
||||||
|
|
||||||
|
$loop_count = 0
|
||||||
|
|
||||||
|
loop1:
|
||||||
|
sleep 200
|
||||||
|
|
||||||
|
$loop_count = $loop_count + 1
|
||||||
|
if $loop_count == 20 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
|
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
|
||||||
|
|
||||||
print rows: $rows
|
print rows: $rows
|
||||||
print $data00 $data01 $data02 $data03
|
print $data00 $data01 $data02 $data03
|
||||||
if $rows != 1 then
|
if $rows != 1 then
|
||||||
return -1
|
goto loop1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data01 != -111 then
|
if $data01 != -111 then
|
||||||
return -1
|
goto loop1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != 234 then
|
if $data02 != 234 then
|
||||||
return -1
|
goto loop1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != 123 then
|
if $data03 != 123 then
|
||||||
return -1
|
goto loop1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
#===================================================================
|
#===================================================================
|
||||||
|
@ -105,36 +127,46 @@ sleep 100
|
||||||
#===================================================================
|
#===================================================================
|
||||||
print =============== query data from child table
|
print =============== query data from child table
|
||||||
|
|
||||||
|
$loop_count = 0
|
||||||
|
|
||||||
|
loop2:
|
||||||
|
sleep 200
|
||||||
|
|
||||||
|
$loop_count = $loop_count + 1
|
||||||
|
if $loop_count == 20 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
|
sql select `_wstart`,`min(k)`,`max(k)`,sum_alias from outstb
|
||||||
print rows: $rows
|
print rows: $rows
|
||||||
print $data00 $data01 $data02 $data03
|
print $data00 $data01 $data02 $data03
|
||||||
print $data10 $data11 $data12 $data13
|
print $data10 $data11 $data12 $data13
|
||||||
if $rows != 2 then
|
if $rows != 2 then
|
||||||
return -1
|
goto loop2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data01 != -111 then
|
if $data01 != -111 then
|
||||||
return -1
|
goto loop2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data02 != 234 then
|
if $data02 != 234 then
|
||||||
return -1
|
goto loop2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data03 != 123 then
|
if $data03 != 123 then
|
||||||
return -1
|
goto loop2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data11 != 789 then
|
if $data11 != 789 then
|
||||||
return -1
|
goto loop2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data12 != 789 then
|
if $data12 != 789 then
|
||||||
return -1
|
goto loop2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
if $data13 != 789 then
|
if $data13 != 789 then
|
||||||
return -1
|
goto loop2
|
||||||
endi
|
endi
|
||||||
|
|
||||||
_OVER:
|
_OVER:
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/deploy.sh -n dnode2 -i 2
|
||||||
|
system sh/deploy.sh -n dnode3 -i 3
|
||||||
|
system sh/deploy.sh -n dnode4 -i 4
|
||||||
|
system sh/cfg.sh -n dnode1 -c transPullupInterval -v 1
|
||||||
|
system sh/cfg.sh -n dnode2 -c transPullupInterval -v 1
|
||||||
|
system sh/cfg.sh -n dnode3 -c transPullupInterval -v 1
|
||||||
|
system sh/cfg.sh -n dnode4 -c transPullupInterval -v 1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
system sh/exec.sh -n dnode2 -s start
|
||||||
|
system sh/exec.sh -n dnode3 -s start
|
||||||
|
system sh/exec.sh -n dnode4 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print =============== step1: create dnodes
|
||||||
|
sql create dnode $hostname port 7200
|
||||||
|
sql create dnode $hostname port 7300
|
||||||
|
sql create dnode $hostname port 7400
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
step1:
|
||||||
|
$x = $x + 1
|
||||||
|
sleep 1000
|
||||||
|
if $x == 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql select * from information_schema.ins_dnodes -x step1
|
||||||
|
if $data(1)[4] != ready then
|
||||||
|
goto step1
|
||||||
|
endi
|
||||||
|
if $data(2)[4] != ready then
|
||||||
|
goto step1
|
||||||
|
endi
|
||||||
|
if $data(3)[4] != ready then
|
||||||
|
goto step1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== step2: create mnode 2 and 3
|
||||||
|
sql create mnode on dnode 2
|
||||||
|
sql create mnode on dnode 3
|
||||||
|
sql create database db vgroups 2
|
||||||
|
|
||||||
|
print =============== step3: kill dnode4
|
||||||
|
system sh/exec.sh -n dnode4 -s stop -x SIGKILL
|
||||||
|
sql use db
|
||||||
|
sql_error create table stb (ts timestamp, i int) tags (j int)
|
||||||
|
|
||||||
|
print =============== step4: create database
|
||||||
|
sql show transactions
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sleep 3000
|
||||||
|
system sh/exec.sh -n dnode4 -s start
|
||||||
|
|
||||||
|
$wt = 0
|
||||||
|
step4:
|
||||||
|
$wt = $wt + 1
|
||||||
|
sleep 1000
|
||||||
|
if $wt == 200 then
|
||||||
|
print ====> transaction already running
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql show transactions
|
||||||
|
if $rows != 0 then
|
||||||
|
print wait 1 seconds to alter
|
||||||
|
goto step4
|
||||||
|
endi
|
||||||
|
|
|
@ -11,14 +11,13 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import re
|
||||||
from util.log import *
|
from util.log import *
|
||||||
from util.cases import *
|
from util.cases import *
|
||||||
from util.sql import *
|
from util.sql import *
|
||||||
from util.common import *
|
from util.common import *
|
||||||
from util.sqlset import *
|
from util.sqlset import *
|
||||||
|
|
||||||
|
|
||||||
class TDTestCase:
|
class TDTestCase:
|
||||||
def init(self, conn, logSql, replicaVar=1):
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
self.replicaVar = int(replicaVar)
|
self.replicaVar = int(replicaVar)
|
||||||
|
@ -28,10 +27,35 @@ class TDTestCase:
|
||||||
self.ins_param_list = ['dnodes','mnodes','qnodes','cluster','functions','users','grants','topics','subscriptions','streams']
|
self.ins_param_list = ['dnodes','mnodes','qnodes','cluster','functions','users','grants','topics','subscriptions','streams']
|
||||||
self.perf_param = ['apps','connections','consumers','queries','transactions']
|
self.perf_param = ['apps','connections','consumers','queries','transactions']
|
||||||
self.perf_param_list = ['apps','connections','consumers','queries','trans']
|
self.perf_param_list = ['apps','connections','consumers','queries','trans']
|
||||||
|
self.dbname = "db"
|
||||||
|
self.vgroups = 10
|
||||||
|
self.stbname = f'`{tdCom.getLongName(5)}`'
|
||||||
|
self.tbname = f'`{tdCom.getLongName(3)}`'
|
||||||
|
self.db_param = {
|
||||||
|
"database":f"{self.dbname}",
|
||||||
|
"buffer":100,
|
||||||
|
"cachemodel":"'none'",
|
||||||
|
"cachesize":1,
|
||||||
|
"comp":2,
|
||||||
|
"maxrows":1000,
|
||||||
|
"minrows":200,
|
||||||
|
"pages":512,
|
||||||
|
"pagesize":16,
|
||||||
|
"precision":"'ms'",
|
||||||
|
"replica":1,
|
||||||
|
"wal_level":1,
|
||||||
|
"wal_fsync_period":6000,
|
||||||
|
"wal_roll_period":0,
|
||||||
|
"wal_segment_size":1024,
|
||||||
|
"vgroups":self.vgroups,
|
||||||
|
"stt_trigger":1,
|
||||||
|
"tsdb_pagesize":16
|
||||||
|
}
|
||||||
def ins_check(self):
|
def ins_check(self):
|
||||||
tdSql.prepare()
|
tdSql.prepare()
|
||||||
for param in self.ins_param_list:
|
for param in self.ins_param_list:
|
||||||
|
if param.lower() == 'qnodes':
|
||||||
|
tdSql.execute('create qnode on dnode 1')
|
||||||
tdSql.query(f'show {param}')
|
tdSql.query(f'show {param}')
|
||||||
show_result = tdSql.queryResult
|
show_result = tdSql.queryResult
|
||||||
tdSql.query(f'select * from information_schema.ins_{param}')
|
tdSql.query(f'select * from information_schema.ins_{param}')
|
||||||
|
@ -59,11 +83,32 @@ class TDTestCase:
|
||||||
tag_sql += f"{k} {v}, "
|
tag_sql += f"{k} {v}, "
|
||||||
create_stb_sql = f'create stable {stbname} ({column_sql[:-2]}) tags ({tag_sql[:-2]})'
|
create_stb_sql = f'create stable {stbname} ({column_sql[:-2]}) tags ({tag_sql[:-2]})'
|
||||||
return create_stb_sql
|
return create_stb_sql
|
||||||
def show_sql(self):
|
|
||||||
tdSql.prepare()
|
def set_create_database_sql(self,sql_dict):
|
||||||
tdSql.execute('use db')
|
create_sql = 'create'
|
||||||
stbname = f'`{tdCom.getLongName(5)}`'
|
for key,value in sql_dict.items():
|
||||||
tbname = f'`{tdCom.getLongName(3)}`'
|
create_sql += f' {key} {value}'
|
||||||
|
return create_sql
|
||||||
|
def show_create_sql(self):
|
||||||
|
create_db_sql = self.set_create_database_sql(self.db_param)
|
||||||
|
print(create_db_sql)
|
||||||
|
tdSql.execute(create_db_sql)
|
||||||
|
tdSql.query(f'show create database {self.dbname}')
|
||||||
|
tdSql.checkEqual(self.dbname,tdSql.queryResult[0][0])
|
||||||
|
for key,value in self.db_param.items():
|
||||||
|
if key == 'database':
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
param = f'{key} {value}'
|
||||||
|
if param in tdSql.queryResult[0][1].lower():
|
||||||
|
tdLog.info(f'show create database check success with {key} {value}')
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
tdLog.exit(f"show create database check failed with {key} {value}")
|
||||||
|
tdSql.query('show vnodes 1')
|
||||||
|
tdSql.checkRows(self.vgroups)
|
||||||
|
tdSql.execute(f'use {self.dbname}')
|
||||||
|
|
||||||
column_dict = {
|
column_dict = {
|
||||||
'`ts`': 'timestamp',
|
'`ts`': 'timestamp',
|
||||||
'`col1`': 'tinyint',
|
'`col1`': 'tinyint',
|
||||||
|
@ -98,25 +143,56 @@ class TDTestCase:
|
||||||
'`t14`': 'timestamp'
|
'`t14`': 'timestamp'
|
||||||
|
|
||||||
}
|
}
|
||||||
create_table_sql = self.set_stb_sql(stbname,column_dict,tag_dict)
|
create_table_sql = self.set_stb_sql(self.stbname,column_dict,tag_dict)
|
||||||
tdSql.execute(create_table_sql)
|
tdSql.execute(create_table_sql)
|
||||||
tdSql.query(f'show create table {stbname}')
|
tdSql.query(f'show create stable {self.stbname}')
|
||||||
query_result = tdSql.queryResult
|
query_result = tdSql.queryResult
|
||||||
tdSql.checkEqual(query_result[0][1].lower(),create_table_sql)
|
tdSql.checkEqual(query_result[0][1].lower(),create_table_sql)
|
||||||
tdSql.execute(f'create table {tbname} using {stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)')
|
tdSql.execute(f'create table {self.tbname} using {self.stbname} tags(1,1,1,1,1,1,1,1,1.000000e+00,1.000000e+00,true,"abc","abc123",0)')
|
||||||
tag_sql = '('
|
tag_sql = '('
|
||||||
for tag_keys in tag_dict.keys():
|
for tag_keys in tag_dict.keys():
|
||||||
tag_sql += f'{tag_keys}, '
|
tag_sql += f'{tag_keys}, '
|
||||||
tags = f'{tag_sql[:-2]})'
|
tags = f'{tag_sql[:-2]})'
|
||||||
sql = f'create table {tbname} using {stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)'
|
sql = f'create table {self.tbname} using {self.stbname} {tags} tags (1, 1, 1, 1, 1, 1, 1, 1, 1.000000e+00, 1.000000e+00, true, "abc", "abc123", 0)'
|
||||||
tdSql.query(f'show create table {tbname}')
|
tdSql.query(f'show create table {self.tbname}')
|
||||||
query_result = tdSql.queryResult
|
query_result = tdSql.queryResult
|
||||||
tdSql.checkEqual(query_result[0][1].lower(),sql)
|
tdSql.checkEqual(query_result[0][1].lower(),sql)
|
||||||
tdSql.execute('drop database db')
|
tdSql.execute(f'drop database {self.dbname}')
|
||||||
|
def check_gitinfo(self):
|
||||||
|
taosd_gitinfo_sql = ''
|
||||||
|
tdSql.query('show dnode 1 variables')
|
||||||
|
for i in tdSql.queryResult:
|
||||||
|
if i[1].lower() == "gitinfo":
|
||||||
|
taosd_gitinfo_sql = f"gitinfo: {i[2]}"
|
||||||
|
taos_gitinfo_sql = ''
|
||||||
|
tdSql.query('show local variables')
|
||||||
|
for i in tdSql.queryResult:
|
||||||
|
if i[0].lower() == "gitinfo":
|
||||||
|
taos_gitinfo_sql = f"gitinfo: {i[1]}"
|
||||||
|
taos_info = os.popen('taos -V').read()
|
||||||
|
taos_gitinfo = re.findall("^gitinfo.*",taos_info,re.M)
|
||||||
|
tdSql.checkEqual(taos_gitinfo_sql,taos_gitinfo[0])
|
||||||
|
taosd_info = os.popen('taosd -V').read()
|
||||||
|
taosd_gitinfo = re.findall("^gitinfo.*",taosd_info,re.M)
|
||||||
|
tdSql.checkEqual(taosd_gitinfo_sql,taosd_gitinfo[0])
|
||||||
|
|
||||||
|
def show_base(self):
|
||||||
|
for sql in ['dnodes','mnodes','cluster']:
|
||||||
|
tdSql.query(f'show {sql}')
|
||||||
|
print(tdSql.queryResult)
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
tdSql.query('show grants')
|
||||||
|
grants_info = tdSql.queryResult
|
||||||
|
tdSql.query('show licences')
|
||||||
|
licences_info = tdSql.queryResult
|
||||||
|
tdSql.checkEqual(grants_info,licences_info)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
self.check_gitinfo()
|
||||||
|
self.show_base()
|
||||||
self.ins_check()
|
self.ins_check()
|
||||||
self.perf_check()
|
self.perf_check()
|
||||||
self.show_sql()
|
self.show_create_sql()
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
|
@ -124,4 +200,3 @@ class TDTestCase:
|
||||||
|
|
||||||
tdCases.addWindows(__file__, TDTestCase())
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
tdCases.addLinux(__file__, TDTestCase())
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
from wsgiref.headers import tspecials
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
self.replicaVar = int(replicaVar)
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
self.rowNum = 10
|
||||||
|
self.batchNum = 5
|
||||||
|
self.ts = 1537146000000
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
dbname = "db"
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
intData = []
|
||||||
|
floatData = []
|
||||||
|
|
||||||
|
tdSql.execute(f'''create table {dbname}.stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
|
||||||
|
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20))''')
|
||||||
|
tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')")
|
||||||
|
for n in range(self.batchNum):
|
||||||
|
for i in range(self.rowNum):
|
||||||
|
tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
|
||||||
|
% (self.ts, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
|
||||||
|
intData.append(i + 1)
|
||||||
|
floatData.append(i + 0.1)
|
||||||
|
tdSql.execute(f"flush database {dbname}")
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 order by ts desc")
|
||||||
|
tdSql.checkRows(1)
|
||||||
|
#tdSql.checkData(0,0,1537146000000)
|
||||||
|
tdSql.checkData(0,1,10)
|
||||||
|
|
||||||
|
tdSql.query(f"select * from {dbname}.stb_1 order by 'aaa' desc")
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -200,7 +200,7 @@ class TDTestCase:
|
||||||
tdLog.info("pkill consume processor")
|
tdLog.info("pkill consume processor")
|
||||||
tdCom.killProcessor("tmq_sim")
|
tdCom.killProcessor("tmq_sim")
|
||||||
|
|
||||||
# time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
# reinit consume info, and start tmq_sim, then check consume result
|
# reinit consume info, and start tmq_sim, then check consume result
|
||||||
tmqCom.initConsumerTable()
|
tmqCom.initConsumerTable()
|
||||||
|
|
|
@ -1048,10 +1048,11 @@ void *shellThreadLoop(void *arg) {
|
||||||
taosGetOldTerminalMode();
|
taosGetOldTerminalMode();
|
||||||
taosThreadCleanupPush(shellCleanup, NULL);
|
taosThreadCleanupPush(shellCleanup, NULL);
|
||||||
|
|
||||||
|
do {
|
||||||
char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE);
|
char *command = taosMemoryMalloc(SHELL_MAX_COMMAND_SIZE);
|
||||||
if (command == NULL) {
|
if (command == NULL) {
|
||||||
printf("failed to malloc command\r\n");
|
printf("failed to malloc command\r\n");
|
||||||
return NULL;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
@ -1068,6 +1069,7 @@ void *shellThreadLoop(void *arg) {
|
||||||
taosMemoryFreeClear(command);
|
taosMemoryFreeClear(command);
|
||||||
shellWriteHistory();
|
shellWriteHistory();
|
||||||
shellExit();
|
shellExit();
|
||||||
|
} while (0);
|
||||||
|
|
||||||
taosThreadCleanupPop(1);
|
taosThreadCleanupPop(1);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue