Merge branch '3.0' into feature/stream
This commit is contained in:
commit
daf5a0bde4
|
@ -130,6 +130,9 @@ def pre_test(){
|
|||
def pre_test_win(){
|
||||
bat '''
|
||||
hostname
|
||||
taskkill /f /t /im python.exe
|
||||
taskkill /f /t /im bash.exe
|
||||
taskkill /f /t /im taosd.exe
|
||||
ipconfig
|
||||
set
|
||||
date /t
|
||||
|
|
|
@ -436,15 +436,16 @@ typedef struct {
|
|||
int32_t ttl;
|
||||
int32_t numOfColumns;
|
||||
int32_t numOfTags;
|
||||
int32_t numOfFuncs;
|
||||
int32_t commentLen;
|
||||
int32_t ast1Len;
|
||||
int32_t ast2Len;
|
||||
SArray* pColumns; // array of SField
|
||||
SArray* pTags; // array of SField
|
||||
char* comment;
|
||||
SArray* pFuncs;
|
||||
char* pComment;
|
||||
char* pAst1;
|
||||
char* pAst2;
|
||||
SArray* pFuncs;
|
||||
} SMCreateStbReq;
|
||||
|
||||
int32_t tSerializeSMCreateStbReq(void* buf, int32_t bufLen, SMCreateStbReq* pReq);
|
||||
|
|
|
@ -503,6 +503,7 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq
|
|||
if (tEncodeI32(&encoder, pReq->ttl) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->numOfColumns) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->numOfTags) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->numOfFuncs) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->commentLen) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->ast1Len) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pReq->ast2Len) < 0) return -1;
|
||||
|
@ -510,21 +511,26 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq
|
|||
for (int32_t i = 0; i < pReq->numOfColumns; ++i) {
|
||||
SField *pField = taosArrayGet(pReq->pColumns, i);
|
||||
if (tEncodeI8(&encoder, pField->type) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pField->flags) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pField->bytes) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pField->name) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pField->flags) < 0) return -1;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pReq->numOfTags; ++i) {
|
||||
SField *pField = taosArrayGet(pReq->pTags, i);
|
||||
if (tEncodeI8(&encoder, pField->type) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pField->flags) < 0) return -1;
|
||||
if (tEncodeI32(&encoder, pField->bytes) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pField->name) < 0) return -1;
|
||||
if (tEncodeI8(&encoder, pField->flags) < 0) return -1;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pReq->numOfFuncs; ++i) {
|
||||
const char *pFunc = taosArrayGet(pReq->pFuncs, i);
|
||||
if (tEncodeCStr(&encoder, pFunc) < 0) return -1;
|
||||
}
|
||||
|
||||
if (pReq->commentLen > 0) {
|
||||
if (tEncodeCStr(&encoder, pReq->comment) < 0) return -1;
|
||||
if (tEncodeCStr(&encoder, pReq->pComment) < 0) return -1;
|
||||
}
|
||||
if (pReq->ast1Len > 0) {
|
||||
if (tEncodeBinary(&encoder, pReq->pAst1, pReq->ast1Len) < 0) return -1;
|
||||
|
@ -533,13 +539,6 @@ int32_t tSerializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pReq
|
|||
if (tEncodeBinary(&encoder, pReq->pAst2, pReq->ast2Len) < 0) return -1;
|
||||
}
|
||||
|
||||
int32_t numOfFuncs = taosArrayGetSize(pReq->pFuncs);
|
||||
if (tEncodeI32(&encoder, numOfFuncs) < 0) return -1;
|
||||
for (int32_t i = 0; i < numOfFuncs; ++i) {
|
||||
const char *pFunc = taosArrayGet(pReq->pFuncs, i);
|
||||
if (tEncodeCStr(&encoder, pFunc) < 0) return -1;
|
||||
}
|
||||
|
||||
tEndEncode(&encoder);
|
||||
|
||||
int32_t tlen = encoder.pos;
|
||||
|
@ -561,13 +560,15 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
|
|||
if (tDecodeI32(&decoder, &pReq->ttl) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->numOfColumns) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->numOfTags) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->numOfFuncs) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->commentLen) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->ast1Len) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &pReq->ast2Len) < 0) return -1;
|
||||
|
||||
pReq->pColumns = taosArrayInit(pReq->numOfColumns, sizeof(SField));
|
||||
pReq->pTags = taosArrayInit(pReq->numOfTags, sizeof(SField));
|
||||
if (pReq->pColumns == NULL || pReq->pTags == NULL) {
|
||||
pReq->pFuncs = taosArrayInit(pReq->numOfFuncs, TSDB_FUNC_NAME_LEN);
|
||||
if (pReq->pColumns == NULL || pReq->pTags == NULL || pReq->pFuncs == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
|
@ -575,9 +576,9 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
|
|||
for (int32_t i = 0; i < pReq->numOfColumns; ++i) {
|
||||
SField field = {0};
|
||||
if (tDecodeI8(&decoder, &field.type) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &field.flags) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &field.bytes) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, field.name) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &field.flags) < 0) return -1;
|
||||
if (taosArrayPush(pReq->pColumns, &field) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
|
@ -587,19 +588,28 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
|
|||
for (int32_t i = 0; i < pReq->numOfTags; ++i) {
|
||||
SField field = {0};
|
||||
if (tDecodeI8(&decoder, &field.type) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &field.flags) < 0) return -1;
|
||||
if (tDecodeI32(&decoder, &field.bytes) < 0) return -1;
|
||||
if (tDecodeCStrTo(&decoder, field.name) < 0) return -1;
|
||||
if (tDecodeI8(&decoder, &field.flags) < 0) return -1;
|
||||
if (taosArrayPush(pReq->pTags, &field) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pReq->numOfFuncs; ++i) {
|
||||
char pFunc[TSDB_FUNC_NAME_LEN] = {0};
|
||||
if (tDecodeCStrTo(&decoder, pFunc) < 0) return -1;
|
||||
if (taosArrayPush(pReq->pFuncs, pFunc) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (pReq->commentLen > 0) {
|
||||
pReq->comment = taosMemoryMalloc(pReq->commentLen + 1);
|
||||
if (pReq->comment == NULL) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->comment) < 0) return -1;
|
||||
pReq->pComment = taosMemoryMalloc(pReq->commentLen + 1);
|
||||
if (pReq->pComment == NULL) return -1;
|
||||
if (tDecodeCStrTo(&decoder, pReq->pComment) < 0) return -1;
|
||||
}
|
||||
|
||||
if (pReq->ast1Len > 0) {
|
||||
|
@ -614,23 +624,7 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
|
|||
if (tDecodeCStrTo(&decoder, pReq->pAst2) < 0) return -1;
|
||||
}
|
||||
|
||||
int32_t numOfFuncs = 0;
|
||||
if (tDecodeI32(&decoder, &numOfFuncs) < 0) return -1;
|
||||
if (numOfFuncs > 0) {
|
||||
pReq->pFuncs = taosArrayInit(numOfFuncs, TSDB_FUNC_NAME_LEN);
|
||||
if (NULL == pReq->pFuncs) return -1;
|
||||
}
|
||||
for (int32_t i = 0; i < numOfFuncs; ++i) {
|
||||
char pFunc[TSDB_FUNC_NAME_LEN] = {0};
|
||||
if (tDecodeCStrTo(&decoder, pFunc) < 0) return -1;
|
||||
if (taosArrayPush(pReq->pFuncs, pFunc) == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
tEndDecode(&decoder);
|
||||
|
||||
tDecoderClear(&decoder);
|
||||
return 0;
|
||||
}
|
||||
|
@ -638,10 +632,10 @@ int32_t tDeserializeSMCreateStbReq(void *buf, int32_t bufLen, SMCreateStbReq *pR
|
|||
void tFreeSMCreateStbReq(SMCreateStbReq *pReq) {
|
||||
taosArrayDestroy(pReq->pColumns);
|
||||
taosArrayDestroy(pReq->pTags);
|
||||
taosMemoryFreeClear(pReq->comment);
|
||||
taosArrayDestroy(pReq->pFuncs);
|
||||
taosMemoryFreeClear(pReq->pComment);
|
||||
taosMemoryFreeClear(pReq->pAst1);
|
||||
taosMemoryFreeClear(pReq->pAst2);
|
||||
taosArrayDestroy(pReq->pFuncs);
|
||||
}
|
||||
|
||||
int32_t tSerializeSMDropStbReq(void *buf, int32_t bufLen, SMDropStbReq *pReq) {
|
||||
|
|
|
@ -341,11 +341,12 @@ typedef struct {
|
|||
int32_t colVer;
|
||||
int32_t smaVer;
|
||||
int32_t nextColId;
|
||||
int64_t watermark[2];
|
||||
int64_t maxdelay[2];
|
||||
int64_t watermark[2];
|
||||
int32_t ttl;
|
||||
int32_t numOfColumns;
|
||||
int32_t numOfTags;
|
||||
int32_t numOfFuncs;
|
||||
int32_t commentLen;
|
||||
int32_t ast1Len;
|
||||
int32_t ast2Len;
|
||||
|
|
|
@ -396,6 +396,8 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
|
|||
stbObj.pColumns = NULL;
|
||||
stbObj.numOfTags = 0;
|
||||
stbObj.pTags = NULL;
|
||||
stbObj.numOfFuncs = 0;
|
||||
stbObj.pFuncs = NULL;
|
||||
stbObj.updateTime = taosGetTimestampMs();
|
||||
stbObj.lock = 0;
|
||||
stbObj.smaVer++;
|
||||
|
@ -408,47 +410,6 @@ static int32_t mndSetUpdateSmaStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStb
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SVgObj *pVgroup = NULL;
|
||||
void *pIter = NULL;
|
||||
int32_t contLen;
|
||||
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
if (pIter == NULL) break;
|
||||
if (pVgroup->dbUid != pDb->uid) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
void *pReq = mndBuildVCreateSmaReq(pMnode, pVgroup, pSma, &contLen);
|
||||
if (pReq == NULL) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
action.pCont = pReq;
|
||||
action.contLen = contLen;
|
||||
action.msgType = TDMT_VND_CREATE_SMA;
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
return -1;
|
||||
}
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup,
|
||||
SSmaObj *pSma) {
|
||||
SVnodeGid *pVgid = pVgroup->vnodeGid + 0;
|
||||
|
@ -621,7 +582,6 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
|
|||
if (mndSetCreateSmaCommitLogs(pMnode, pTrans, &smaObj) != 0) goto _OVER;
|
||||
if (mndSetCreateSmaVgroupCommitLogs(pMnode, pTrans, &streamObj.fixedSinkVg) != 0) goto _OVER;
|
||||
if (mndSetUpdateSmaStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER;
|
||||
// if (mndSetCreateSmaRedoActions(pMnode, pTrans, pDb, &smaObj) != 0) goto _OVER;
|
||||
if (mndSetCreateSmaVgroupRedoActions(pMnode, pTrans, pDb, &streamObj.fixedSinkVg, &smaObj) != 0) goto _OVER;
|
||||
if (mndScheduleStream(pMnode, &streamObj) != 0) goto _OVER;
|
||||
if (mndPersistStream(pMnode, pTrans, &streamObj) != 0) goto _OVER;
|
||||
|
@ -770,49 +730,6 @@ static int32_t mndSetDropSmaVgroupCommitLogs(SMnode *pMnode, STrans *pTrans, SVg
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int32_t mndSetDropSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SSmaObj *pSma) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
SVgObj *pVgroup = NULL;
|
||||
void *pIter = NULL;
|
||||
int32_t contLen;
|
||||
|
||||
while (1) {
|
||||
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
|
||||
if (pIter == NULL) break;
|
||||
if (pVgroup->dbUid != pDb->uid) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t contLen = 0;
|
||||
void *pReq = mndBuildVDropSmaReq(pMnode, pVgroup, pSma, &contLen);
|
||||
if (pReq == NULL) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
|
||||
STransAction action = {0};
|
||||
action.epSet = mndGetVgroupEpset(pMnode, pVgroup);
|
||||
action.pCont = pReq;
|
||||
action.contLen = contLen;
|
||||
action.msgType = TDMT_VND_DROP_SMA;
|
||||
action.acceptableCode = TSDB_CODE_VND_SMA_NOT_EXIST;
|
||||
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
|
||||
taosMemoryFree(pReq);
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
return -1;
|
||||
}
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int32_t mndSetDropSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SVgObj *pVgroup) {
|
||||
SVnodeGid *pVgid = pVgroup->vnodeGid + 0;
|
||||
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pVgid->dnodeId);
|
||||
|
@ -879,7 +796,6 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
|
|||
if (mndSetDropSmaCommitLogs(pMnode, pTrans, pSma) != 0) goto _OVER;
|
||||
if (mndSetDropSmaVgroupCommitLogs(pMnode, pTrans, pVgroup) != 0) goto _OVER;
|
||||
if (mndSetUpdateSmaStbCommitLogs(pMnode, pTrans, pStb) != 0) goto _OVER;
|
||||
// if (mndSetDropSmaRedoActions(pMnode, pTrans, pDb, pSma) != 0) goto _OVER;
|
||||
if (mndSetDropSmaVgroupRedoActions(pMnode, pTrans, pDb, pVgroup) != 0) goto _OVER;
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
|
@ -909,7 +825,6 @@ int32_t mndDropSmasByStb(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *p
|
|||
if (mndSetDropSmaVgroupCommitLogs(pMnode, pTrans, pVgroup) != 0) goto _OVER;
|
||||
if (mndSetDropSmaVgroupRedoActions(pMnode, pTrans, pDb, pVgroup) != 0) goto _OVER;
|
||||
if (mndSetDropSmaCommitLogs(pMnode, pTrans, pSma) != 0) goto _OVER;
|
||||
// if (mndSetDropSmaRedoActions(pMnode, pTrans, pDb, pSma) != 0) goto _OVER;
|
||||
mndReleaseVgroup(pMnode, pVgroup);
|
||||
pVgroup = NULL;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ void mndCleanupStb(SMnode *pMnode) {}
|
|||
SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
|
||||
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + +pStb->commentLen +
|
||||
int32_t size = sizeof(SStbObj) + (pStb->numOfColumns + pStb->numOfTags) * sizeof(SSchema) + pStb->commentLen +
|
||||
pStb->ast1Len + pStb->ast2Len + STB_RESERVE_SIZE + taosArrayGetSize(pStb->pFuncs) * TSDB_FUNC_NAME_LEN;
|
||||
SSdbRaw *pRaw = sdbAllocRaw(SDB_STB, STB_VER_NUMBER, size);
|
||||
if (pRaw == NULL) goto _OVER;
|
||||
|
@ -92,6 +92,7 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
|||
SDB_SET_INT64(pRaw, dataPos, pStb->dbUid, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->tagVer, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->colVer, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->smaVer, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->nextColId, _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pStb->maxdelay[0], _OVER)
|
||||
SDB_SET_INT64(pRaw, dataPos, pStb->maxdelay[1], _OVER)
|
||||
|
@ -100,17 +101,11 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
|||
SDB_SET_INT32(pRaw, dataPos, pStb->ttl, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->numOfColumns, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->numOfTags, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->numOfFuncs, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->commentLen, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->ast1Len, _OVER)
|
||||
SDB_SET_INT32(pRaw, dataPos, pStb->ast2Len, _OVER)
|
||||
|
||||
int32_t funcNum = taosArrayGetSize(pStb->pFuncs);
|
||||
SDB_SET_INT32(pRaw, dataPos, funcNum, _OVER)
|
||||
for (int32_t i = 0; i < funcNum; ++i) {
|
||||
char *func = taosArrayGet(pStb->pFuncs, i);
|
||||
SDB_SET_BINARY(pRaw, dataPos, func, TSDB_FUNC_NAME_LEN, _OVER)
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pStb->numOfColumns; ++i) {
|
||||
SSchema *pSchema = &pStb->pColumns[i];
|
||||
SDB_SET_INT8(pRaw, dataPos, pSchema->type, _OVER)
|
||||
|
@ -129,15 +124,23 @@ SSdbRaw *mndStbActionEncode(SStbObj *pStb) {
|
|||
SDB_SET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pStb->numOfFuncs; ++i) {
|
||||
char *func = taosArrayGet(pStb->pFuncs, i);
|
||||
SDB_SET_BINARY(pRaw, dataPos, func, TSDB_FUNC_NAME_LEN, _OVER)
|
||||
}
|
||||
|
||||
if (pStb->commentLen > 0) {
|
||||
SDB_SET_BINARY(pRaw, dataPos, pStb->comment, pStb->commentLen + 1, _OVER)
|
||||
}
|
||||
|
||||
if (pStb->ast1Len > 0) {
|
||||
SDB_SET_BINARY(pRaw, dataPos, pStb->pAst1, pStb->ast1Len, _OVER)
|
||||
}
|
||||
|
||||
if (pStb->ast2Len > 0) {
|
||||
SDB_SET_BINARY(pRaw, dataPos, pStb->pAst2, pStb->ast2Len, _OVER)
|
||||
}
|
||||
|
||||
SDB_SET_RESERVE(pRaw, dataPos, STB_RESERVE_SIZE, _OVER)
|
||||
SDB_SET_DATALEN(pRaw, dataPos, _OVER)
|
||||
|
||||
|
@ -180,6 +183,7 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT64(pRaw, dataPos, &pStb->dbUid, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->tagVer, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->colVer, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->smaVer, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->nextColId, _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pStb->maxdelay[0], _OVER)
|
||||
SDB_GET_INT64(pRaw, dataPos, &pStb->maxdelay[1], _OVER)
|
||||
|
@ -188,27 +192,15 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_INT32(pRaw, dataPos, &pStb->ttl, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->numOfColumns, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->numOfTags, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->numOfFuncs, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->commentLen, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->ast1Len, _OVER)
|
||||
SDB_GET_INT32(pRaw, dataPos, &pStb->ast2Len, _OVER)
|
||||
|
||||
int32_t funcNum = 0;
|
||||
SDB_GET_INT32(pRaw, dataPos, &funcNum, _OVER)
|
||||
if (funcNum > 0) {
|
||||
pStb->pFuncs = taosArrayInit(funcNum, TSDB_FUNC_NAME_LEN);
|
||||
if (NULL == pStb->pFuncs) {
|
||||
goto _OVER;
|
||||
}
|
||||
char funcName[TSDB_FUNC_NAME_LEN];
|
||||
for (int32_t i = 0; i < funcNum; ++i) {
|
||||
SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER)
|
||||
taosArrayPush(pStb->pFuncs, funcName);
|
||||
}
|
||||
}
|
||||
|
||||
pStb->pColumns = taosMemoryCalloc(pStb->numOfColumns, sizeof(SSchema));
|
||||
pStb->pTags = taosMemoryCalloc(pStb->numOfTags, sizeof(SSchema));
|
||||
if (pStb->pColumns == NULL || pStb->pTags == NULL) {
|
||||
pStb->pFuncs = taosArrayInit(pStb->numOfFuncs, TSDB_FUNC_NAME_LEN);
|
||||
if (pStb->pColumns == NULL || pStb->pTags == NULL || pStb->pFuncs == NULL) {
|
||||
goto _OVER;
|
||||
}
|
||||
|
||||
|
@ -230,16 +222,24 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) {
|
|||
SDB_GET_BINARY(pRaw, dataPos, pSchema->name, TSDB_COL_NAME_LEN, _OVER)
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pStb->numOfFuncs; ++i) {
|
||||
char funcName[TSDB_FUNC_NAME_LEN] = {0};
|
||||
SDB_GET_BINARY(pRaw, dataPos, funcName, TSDB_FUNC_NAME_LEN, _OVER)
|
||||
taosArrayPush(pStb->pFuncs, funcName);
|
||||
}
|
||||
|
||||
if (pStb->commentLen > 0) {
|
||||
pStb->comment = taosMemoryCalloc(pStb->commentLen + 1, 1);
|
||||
if (pStb->comment == NULL) goto _OVER;
|
||||
SDB_GET_BINARY(pRaw, dataPos, pStb->comment, pStb->commentLen + 1, _OVER)
|
||||
}
|
||||
|
||||
if (pStb->ast1Len > 0) {
|
||||
pStb->pAst1 = taosMemoryCalloc(pStb->ast1Len, 1);
|
||||
if (pStb->pAst1 == NULL) goto _OVER;
|
||||
SDB_GET_BINARY(pRaw, dataPos, pStb->pAst1, pStb->ast1Len, _OVER)
|
||||
}
|
||||
|
||||
if (pStb->ast2Len > 0) {
|
||||
pStb->pAst2 = taosMemoryCalloc(pStb->ast2Len, 1);
|
||||
if (pStb->pAst2 == NULL) goto _OVER;
|
||||
|
@ -273,6 +273,7 @@ static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb) {
|
|||
taosMemoryFreeClear(pStb->pColumns);
|
||||
taosMemoryFreeClear(pStb->pTags);
|
||||
taosMemoryFreeClear(pStb->comment);
|
||||
taosMemoryFreeClear(pStb->pFuncs);
|
||||
taosMemoryFreeClear(pStb->pAst1);
|
||||
taosMemoryFreeClear(pStb->pAst2);
|
||||
taosArrayDestroy(pStb->pFuncs);
|
||||
|
@ -322,7 +323,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
|
|||
pOld->commentLen = pNew->commentLen;
|
||||
|
||||
if (pOld->ast1Len < pNew->ast1Len) {
|
||||
void *pAst1 = taosMemoryMalloc(pNew->ast1Len);
|
||||
void *pAst1 = taosMemoryMalloc(pNew->ast1Len + 1);
|
||||
if (pAst1 != NULL) {
|
||||
taosMemoryFree(pOld->pAst1);
|
||||
pOld->pAst1 = pAst1;
|
||||
|
@ -334,7 +335,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
|
|||
}
|
||||
|
||||
if (pOld->ast2Len < pNew->ast2Len) {
|
||||
void *pAst2 = taosMemoryMalloc(pNew->ast2Len);
|
||||
void *pAst2 = taosMemoryMalloc(pNew->ast2Len + 1);
|
||||
if (pAst2 != NULL) {
|
||||
taosMemoryFree(pOld->pAst2);
|
||||
pOld->pAst2 = pAst2;
|
||||
|
@ -361,12 +362,15 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
|
|||
}
|
||||
if (pNew->commentLen > 0) {
|
||||
memcpy(pOld->comment, pNew->comment, pNew->commentLen + 1);
|
||||
pOld->commentLen = pNew->commentLen;
|
||||
}
|
||||
if (pNew->ast1Len != 0) {
|
||||
memcpy(pOld->pAst1, pNew->pAst1, pNew->ast1Len);
|
||||
pOld->ast1Len = pNew->ast1Len;
|
||||
}
|
||||
if (pNew->ast2Len != 0) {
|
||||
memcpy(pOld->pAst2, pNew->pAst2, pNew->ast2Len);
|
||||
pOld->ast2Len = pNew->ast2Len;
|
||||
}
|
||||
taosWUnLockLatch(&pOld->lock);
|
||||
return 0;
|
||||
|
@ -575,7 +579,10 @@ int32_t mndCheckCreateStbReq(SMCreateStbReq *pCreate) {
|
|||
static int32_t mndSetCreateStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
|
||||
SSdbRaw *pRedoRaw = mndStbActionEncode(pStb);
|
||||
if (pRedoRaw == NULL) return -1;
|
||||
if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1;
|
||||
if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) {
|
||||
sdbFreeRaw(pRedoRaw);
|
||||
return -1;
|
||||
}
|
||||
if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_CREATING) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -584,7 +591,10 @@ static int32_t mndSetCreateStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p
|
|||
static int32_t mndSetCreateStbUndoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
|
||||
SSdbRaw *pUndoRaw = mndStbActionEncode(pStb);
|
||||
if (pUndoRaw == NULL) return -1;
|
||||
if (mndTransAppendUndolog(pTrans, pUndoRaw) != 0) return -1;
|
||||
if (mndTransAppendUndolog(pTrans, pUndoRaw) != 0) {
|
||||
sdbFreeRaw(pUndoRaw);
|
||||
return -1;
|
||||
}
|
||||
if (sdbSetRawStatus(pUndoRaw, SDB_STATUS_DROPPED) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -593,7 +603,10 @@ static int32_t mndSetCreateStbUndoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *p
|
|||
static int32_t mndSetCreateStbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
|
||||
SSdbRaw *pCommitRaw = mndStbActionEncode(pStb);
|
||||
if (pCommitRaw == NULL) return -1;
|
||||
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1;
|
||||
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
|
||||
sdbFreeRaw(pCommitRaw);
|
||||
return -1;
|
||||
}
|
||||
if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -613,6 +626,11 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pVgroup->isTsma) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen);
|
||||
if (pReq == NULL) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
|
@ -651,6 +669,11 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pVgroup->isTsma) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t contLen = 0;
|
||||
void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen);
|
||||
if (pReq == NULL) {
|
||||
|
@ -697,6 +720,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
|
|||
pDst->dbUid = pDb->uid;
|
||||
pDst->tagVer = 1;
|
||||
pDst->colVer = 1;
|
||||
pDst->smaVer = 1;
|
||||
pDst->nextColId = 1;
|
||||
pDst->maxdelay[0] = pCreate->delay1;
|
||||
pDst->maxdelay[1] = pCreate->delay2;
|
||||
|
@ -705,6 +729,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
|
|||
pDst->ttl = pCreate->ttl;
|
||||
pDst->numOfColumns = pCreate->numOfColumns;
|
||||
pDst->numOfTags = pCreate->numOfTags;
|
||||
pDst->numOfFuncs = pCreate->numOfFuncs;
|
||||
pDst->commentLen = pCreate->commentLen;
|
||||
pDst->pFuncs = pCreate->pFuncs;
|
||||
pCreate->pFuncs = NULL;
|
||||
|
@ -715,7 +740,7 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
|
|||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return -1;
|
||||
}
|
||||
memcpy(pDst->comment, pCreate->comment, pDst->commentLen + 1);
|
||||
memcpy(pDst->comment, pCreate->pComment, pDst->commentLen + 1);
|
||||
}
|
||||
|
||||
pDst->ast1Len = pCreate->ast1Len;
|
||||
|
@ -770,20 +795,15 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
|
|||
|
||||
static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCreate, SDbObj *pDb) {
|
||||
SStbObj stbObj = {0};
|
||||
|
||||
int32_t code = -1;
|
||||
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name);
|
||||
|
||||
if (mndBuildStbFromReq(pMnode, &stbObj, pCreate, pDb) != 0) goto _OVER;
|
||||
|
||||
if (mndAddStbToTrans(pMnode, pTrans, pDb, &stbObj) < 0) goto _OVER;
|
||||
|
||||
if (mndTransPrepare(pMnode, pTrans) != 0) goto _OVER;
|
||||
|
||||
code = 0;
|
||||
|
||||
_OVER:
|
||||
|
@ -906,7 +926,8 @@ _OVER:
|
|||
}
|
||||
|
||||
static int32_t mndCheckAlterStbReq(SMAlterStbReq *pAlter) {
|
||||
if (pAlter->commentLen >= 0 || pAlter->ttl != 0) return 0;
|
||||
if (pAlter->commentLen >= 0) return 0;
|
||||
if (pAlter->ttl != 0) return 0;
|
||||
|
||||
if (pAlter->numOfFields < 1 || pAlter->numOfFields != (int32_t)taosArrayGetSize(pAlter->pFields)) {
|
||||
terrno = TSDB_CODE_MND_INVALID_STB_OPTION;
|
||||
|
@ -969,6 +990,7 @@ static int32_t mndUpdateStbCommentAndTTL(const SStbObj *pOld, SStbObj *pNew, cha
|
|||
memcpy(pNew->comment, pComment, commentLen + 1);
|
||||
} else if (commentLen == 0) {
|
||||
pNew->commentLen = 0;
|
||||
} else {
|
||||
}
|
||||
|
||||
if (ttl >= 0) {
|
||||
|
@ -1245,7 +1267,10 @@ static int32_t mndAlterStbColumnBytes(SMnode *pMnode, const SStbObj *pOld, SStbO
|
|||
static int32_t mndSetAlterStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
|
||||
SSdbRaw *pRedoRaw = mndStbActionEncode(pStb);
|
||||
if (pRedoRaw == NULL) return -1;
|
||||
if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1;
|
||||
if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) {
|
||||
sdbFreeRaw(pRedoRaw);
|
||||
return -1;
|
||||
}
|
||||
if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -1254,7 +1279,10 @@ static int32_t mndSetAlterStbRedoLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pD
|
|||
static int32_t mndSetAlterStbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb) {
|
||||
SSdbRaw *pCommitRaw = mndStbActionEncode(pStb);
|
||||
if (pCommitRaw == NULL) return -1;
|
||||
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1;
|
||||
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
|
||||
sdbFreeRaw(pCommitRaw);
|
||||
return -1;
|
||||
}
|
||||
if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -1274,6 +1302,11 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pVgroup->isTsma) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen);
|
||||
if (pReq == NULL) {
|
||||
sdbCancelFetch(pSdb, pIter);
|
||||
|
@ -1388,7 +1421,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName,
|
|||
pSchema->bytes = pSrcSchema->bytes;
|
||||
}
|
||||
|
||||
if (pStb->pFuncs) {
|
||||
if (pStb->numOfFuncs > 0) {
|
||||
pRsp->pFuncs = taosArrayDup(pStb->pFuncs);
|
||||
}
|
||||
|
||||
|
@ -1626,7 +1659,10 @@ _OVER:
|
|||
static int32_t mndSetDropStbRedoLogs(SMnode *pMnode, STrans *pTrans, SStbObj *pStb) {
|
||||
SSdbRaw *pRedoRaw = mndStbActionEncode(pStb);
|
||||
if (pRedoRaw == NULL) return -1;
|
||||
if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) return -1;
|
||||
if (mndTransAppendRedolog(pTrans, pRedoRaw) != 0) {
|
||||
sdbFreeRaw(pRedoRaw);
|
||||
return -1;
|
||||
}
|
||||
if (sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -1635,7 +1671,10 @@ static int32_t mndSetDropStbRedoLogs(SMnode *pMnode, STrans *pTrans, SStbObj *pS
|
|||
static int32_t mndSetDropStbCommitLogs(SMnode *pMnode, STrans *pTrans, SStbObj *pStb) {
|
||||
SSdbRaw *pCommitRaw = mndStbActionEncode(pStb);
|
||||
if (pCommitRaw == NULL) return -1;
|
||||
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) return -1;
|
||||
if (mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) {
|
||||
sdbFreeRaw(pCommitRaw);
|
||||
return -1;
|
||||
}
|
||||
if (sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED) != 0) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -1654,6 +1693,11 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pVgroup->isTsma) {
|
||||
sdbRelease(pSdb, pVgroup);
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t contLen = 0;
|
||||
void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen);
|
||||
if (pReq == NULL) {
|
||||
|
@ -1683,7 +1727,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
|
|||
|
||||
static int32_t mndDropStb(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb) {
|
||||
int32_t code = -1;
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq);
|
||||
if (pTrans == NULL) goto _OVER;
|
||||
|
||||
mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name);
|
||||
|
|
|
@ -426,7 +426,15 @@ static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return
|
|||
static int32_t mndCompareDnodeVnodes(SDnodeObj *pDnode1, SDnodeObj *pDnode2) {
|
||||
float d1Score = (float)pDnode1->numOfVnodes / pDnode1->numOfSupportVnodes;
|
||||
float d2Score = (float)pDnode2->numOfVnodes / pDnode2->numOfSupportVnodes;
|
||||
#if 0
|
||||
if (d1Score == d2Score) {
|
||||
return pDnode2->id - pDnode1->id;
|
||||
} else {
|
||||
return d1Score >= d2Score ? 1 : 0;
|
||||
}
|
||||
#else
|
||||
return d1Score >= d2Score ? 1 : 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void mndSortVnodeGid(SVgObj *pVgroup) {
|
||||
|
|
|
@ -784,12 +784,12 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
|
|||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) {
|
||||
// TODO
|
||||
//pVal->node.resType = targetDt;
|
||||
// TODO
|
||||
// pVal->node.resType = targetDt;
|
||||
pVal->translate = true;
|
||||
pVal->isNull = true;
|
||||
return DEAL_RES_CONTINUE;
|
||||
}
|
||||
}
|
||||
if (pVal->isDuration) {
|
||||
if (parseNatualDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &pVal->unit, precision) !=
|
||||
TSDB_CODE_SUCCESS) {
|
||||
|
@ -3621,8 +3621,8 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
|||
pReq->numOfColumns = LIST_LENGTH(pStmt->pCols);
|
||||
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
|
||||
if (pStmt->pOptions->commentNull == false) {
|
||||
pReq->comment = strdup(pStmt->pOptions->comment);
|
||||
if (NULL == pReq->comment) {
|
||||
pReq->pComment = strdup(pStmt->pOptions->comment);
|
||||
if (NULL == pReq->pComment) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
pReq->commentLen = strlen(pStmt->pOptions->comment);
|
||||
|
@ -3630,6 +3630,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
|||
pReq->commentLen = -1;
|
||||
}
|
||||
buildRollupFuncs(pStmt->pOptions->pRollupFuncs, &pReq->pFuncs);
|
||||
pReq->numOfFuncs = taosArrayGetSize(pReq->pFuncs);
|
||||
|
||||
SName tableName;
|
||||
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name);
|
||||
|
|
|
@ -372,7 +372,7 @@ TEST_F(ParserInitialCTest, createStable) {
|
|||
expect.watermark2 = watermark2;
|
||||
// expect.ttl = ttl;
|
||||
if (nullptr != pComment) {
|
||||
expect.comment = strdup(pComment);
|
||||
expect.pComment = strdup(pComment);
|
||||
expect.commentLen = strlen(pComment);
|
||||
}
|
||||
};
|
||||
|
@ -443,7 +443,7 @@ TEST_F(ParserInitialCTest, createStable) {
|
|||
}
|
||||
}
|
||||
if (expect.commentLen > 0) {
|
||||
ASSERT_EQ(std::string(req.comment), std::string(expect.comment));
|
||||
ASSERT_EQ(std::string(req.pComment), std::string(expect.pComment));
|
||||
}
|
||||
if (expect.ast1Len > 0) {
|
||||
ASSERT_EQ(std::string(req.pAst1), std::string(expect.pAst1));
|
||||
|
|
|
@ -60,7 +60,7 @@ class TDTestCase:
|
|||
def build_db(precision, start_time):
|
||||
tdSql.execute("drop database if exists timedb1")
|
||||
tdSql.execute(
|
||||
"create database timedb1 duration 10 keep 365 blocks 8 precision "+"\""+precision+"\"")
|
||||
"create database timedb1 duration 10 keep 36500 blocks 8 precision "+"\""+precision+"\"")
|
||||
|
||||
tdSql.execute("use timedb1")
|
||||
tdSql.execute(
|
||||
|
|
|
@ -30,13 +30,6 @@
|
|||
./test.sh -f tsim/dnode/balance2.sim
|
||||
./test.sh -f tsim/dnode/balance3.sim
|
||||
./test.sh -f tsim/dnode/balancex.sim
|
||||
#./test.sh -f tsim/dnode/cluster_alter.sim
|
||||
#./test.sh -f tsim/dnode/cluster_balance1.sim
|
||||
#./test.sh -f tsim/dnode/cluster_balance2.sim
|
||||
#./test.sh -f tsim/dnode/cluster_balance3.sim
|
||||
#./test.sh -f tsim/dnode/cluster_cache.sim
|
||||
#./test.sh -f tsim/dnode/cluster_flowctrl.sim
|
||||
#./test.sh -f tsim/dnode/cluster_vgroup100.sim
|
||||
./test.sh -f tsim/dnode/create_dnode.sim
|
||||
./test.sh -f tsim/dnode/drop_dnode_has_mnode.sim
|
||||
./test.sh -f tsim/dnode/drop_dnode_has_qnode_snode.sim
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
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 role -v 1
|
||||
system sh/cfg.sh -n dnode2 -c role -v 2
|
||||
system sh/cfg.sh -n dnode3 -c role -v 2
|
||||
system sh/cfg.sh -n dnode4 -c role -v 2
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c balanceInterval -v 10
|
||||
system sh/cfg.sh -n dnode2 -c balanceInterval -v 10
|
||||
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
|
||||
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c wallevel -v 2
|
||||
system sh/cfg.sh -n dnode2 -c wallevel -v 2
|
||||
system sh/cfg.sh -n dnode3 -c wallevel -v 2
|
||||
system sh/cfg.sh -n dnode4 -c wallevel -v 2
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c balance -v 0
|
||||
system sh/cfg.sh -n dnode2 -c balance -v 0
|
||||
system sh/cfg.sh -n dnode3 -c balance -v 0
|
||||
system sh/cfg.sh -n dnode4 -c balance -v 0
|
||||
|
||||
print ========== step1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sleep 2000
|
||||
|
||||
sql create dnode $hostname2
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
sleep 2000
|
||||
|
||||
print ========== step2
|
||||
sql create database d1
|
||||
sql create table d1.t1 (t timestamp, i int)
|
||||
sql insert into d1.t1 values(now+1s, 15)
|
||||
sql insert into d1.t1 values(now+2s, 14)
|
||||
sql insert into d1.t1 values(now+3s, 13)
|
||||
sql insert into d1.t1 values(now+4s, 12)
|
||||
sql insert into d1.t1 values(now+5s, 11)
|
||||
|
||||
print ========== step3
|
||||
sleep 2000
|
||||
sql create dnode $hostname3
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
sql create dnode $hostname4
|
||||
system sh/exec.sh -n dnode4 -s start
|
||||
|
||||
sql show dnodes
|
||||
print dnode1 openVnodes $data2_1
|
||||
print dnode2 openVnodes $data2_2
|
||||
print dnode3 openVnodes $data2_3
|
||||
print dnode4 openVnodes $data2_4
|
||||
if $data2_1 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data2_2 != 1 then
|
||||
return -1
|
||||
endi
|
||||
if $data2_3 != 0 then
|
||||
return -1
|
||||
endi
|
||||
if $data2_4 != 0 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ========== step4
|
||||
sql alter dnode 2 balance "vnode:2-dnode:3"
|
||||
|
||||
$x = 0
|
||||
show4:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes
|
||||
print dnode1 openVnodes $data2_1
|
||||
print dnode2 openVnodes $data2_2
|
||||
print dnode3 openVnodes $data2_3
|
||||
print dnode4 openVnodes $data2_4
|
||||
if $data2_2 != 0 then
|
||||
goto show4
|
||||
endi
|
||||
if $data2_3 != 1 then
|
||||
goto show4
|
||||
endi
|
||||
if $data2_4 != 0 then
|
||||
goto show4
|
||||
endi
|
||||
|
||||
print ========== step5
|
||||
sql alter dnode 3 balance "vnode:2-dnode:4"
|
||||
|
||||
$x = 0
|
||||
show5:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes
|
||||
print dnode1 openVnodes $data2_1
|
||||
print dnode2 openVnodes $data2_2
|
||||
print dnode3 openVnodes $data2_3
|
||||
print dnode4 openVnodes $data2_4
|
||||
if $data2_2 != 0 then
|
||||
goto show5
|
||||
endi
|
||||
if $data2_3 != 0 then
|
||||
goto show5
|
||||
endi
|
||||
if $data2_4 != 1 then
|
||||
goto show5
|
||||
endi
|
||||
|
||||
print ========== step6
|
||||
sql alter dnode 4 balance "vnode:2-dnode:2"
|
||||
|
||||
$x = 0
|
||||
show6:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes
|
||||
print dnode1 openVnodes $data2_1
|
||||
print dnode2 openVnodes $data2_2
|
||||
print dnode3 openVnodes $data2_3
|
||||
print dnode4 openVnodes $data2_4
|
||||
if $data2_2 != 1 then
|
||||
goto show6
|
||||
endi
|
||||
if $data2_3 != 0 then
|
||||
goto show6
|
||||
endi
|
||||
if $data2_4 != 0 then
|
||||
goto show6
|
||||
endi
|
||||
|
||||
print ========== step7
|
||||
sql select * from d1.t1 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 11 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 12 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 13 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 14 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 15 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ========== step8
|
||||
sql_error sql alter dnode 4 balance "vnode:2-dnode:5"
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
@ -1,590 +0,0 @@
|
|||
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/deploy.sh -n dnode5 -i 5
|
||||
system sh/deploy.sh -n dnode6 -i 6
|
||||
system sh/deploy.sh -n dnode7 -i 7
|
||||
system sh/deploy.sh -n dnode8 -i 8
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode6 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode7 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode8 -c numOfMnodes -v 3
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode8 -c mnodeEqualVnodeNum -v 0
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode2 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode3 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode4 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode5 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode6 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode7 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode8 -c wallevel -v 1
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode6 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode7 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode8 -c maxTablesPerVnode -v 4
|
||||
|
||||
|
||||
print ============== step1
|
||||
print ========= start dnode1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
sql create database c_b1_d1
|
||||
sql use c_b1_d1
|
||||
|
||||
sql create table c_b1_t1 (t timestamp, i int)
|
||||
sql insert into c_b1_t1 values(1520000020015, 15)
|
||||
sql insert into c_b1_t1 values(1520000021014, 14)
|
||||
sql insert into c_b1_t1 values(1520000022013, 13)
|
||||
sql insert into c_b1_t1 values(1520000023012, 12)
|
||||
sql insert into c_b1_t1 values(1520000024011, 11)
|
||||
|
||||
sql create database c_b1_d2
|
||||
sql use c_b1_d2
|
||||
sql create table c_b1_t2 (t timestamp, i int)
|
||||
sql insert into c_b1_t2 values(1520000020025, 25)
|
||||
sql insert into c_b1_t2 values(1520000021024, 24)
|
||||
sql insert into c_b1_t2 values(1520000022023, 23)
|
||||
sql insert into c_b1_t2 values(1520000023022, 22)
|
||||
sql insert into c_b1_t2 values(1520000024021, 21)
|
||||
|
||||
sql show dnodes
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $dnode2Vnodes != null then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================== step2
|
||||
print ========= start dnode2
|
||||
sql create dnode $hostname2
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
|
||||
$x = 0
|
||||
show2:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show2
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
|
||||
if $dnode1Vnodes != 1 then
|
||||
goto show2
|
||||
endi
|
||||
if $dnode2Vnodes != 1 then
|
||||
goto show2
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode2Role = $data2_2
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode2 ==> $dnode2Role
|
||||
|
||||
print ============================== step3
|
||||
print ========= add db3
|
||||
sql create database c_b1_d3
|
||||
sql use c_b1_d3
|
||||
sql create table c_b1_t3 (t timestamp, i int)
|
||||
sql insert into c_b1_t3 values(1520000020035, 35)
|
||||
sql insert into c_b1_t3 values(1520000021034, 34)
|
||||
sql insert into c_b1_t3 values(1520000022033, 33)
|
||||
sql insert into c_b1_t3 values(1520000023032, 32)
|
||||
sql insert into c_b1_t3 values(1520000024031, 31)
|
||||
|
||||
print ============================== step4
|
||||
print ========= drop dnode2
|
||||
sql drop dnode $hostname2
|
||||
|
||||
$x = 0
|
||||
show4:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show4
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show4
|
||||
endi
|
||||
if $dnode2Vnodes != null then
|
||||
goto show4
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode2Role = $data2_2
|
||||
$dnode3Role = $data2_3
|
||||
$dnode4Role = $data2_4
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode2 ==> $dnode2Role
|
||||
print dnode3 ==> $dnode3Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
|
||||
print ============================== step5
|
||||
print ========= add dnode2
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
sql create dnode $hostname3
|
||||
|
||||
$x = 0
|
||||
show5:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show5
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode2 $dnode3Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show5
|
||||
endi
|
||||
if $dnode3Vnodes != 1 then
|
||||
goto show5
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode3Role = $data2_3
|
||||
$dnode4Role = $data2_4
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode3 ==> $dnode3Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
|
||||
if $dnode1Role != master then
|
||||
return -1
|
||||
endi
|
||||
if $dnode3Role != slave then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================== step6
|
||||
sql_error drop dnode $hostname1
|
||||
|
||||
print ============================== step7
|
||||
sql_error create dnode $hostname1
|
||||
|
||||
print ============================== step8
|
||||
sql drop dnode $hostname3
|
||||
|
||||
$x = 0
|
||||
show8:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show8
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show8
|
||||
endi
|
||||
if $dnode3Vnodes != null then
|
||||
goto show8
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode3Role = $data2_3
|
||||
$dnode4Role = $data2_4
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode3 ==> $dnode3Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
|
||||
if $dnode1Role != master then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $dnode3Role != null then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================== step9
|
||||
sql create dnode $hostname4
|
||||
system sh/exec.sh -n dnode4 -s start
|
||||
|
||||
$x = 0
|
||||
show9:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show9
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show9
|
||||
endi
|
||||
if $dnode4Vnodes != 1 then
|
||||
goto show9
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode4Role = $data2_4
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
|
||||
if $dnode1Role != master then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $dnode4Role != slave then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================== step10
|
||||
sql create database c_b1_d4
|
||||
sql use c_b1_d4
|
||||
sql create table c_b1_t4 (t timestamp, i int)
|
||||
sql insert into c_b1_t4 values(1520000020045, 45)
|
||||
sql insert into c_b1_t4 values(1520000021044, 44)
|
||||
sql insert into c_b1_t4 values(1520000022043, 43)
|
||||
sql insert into c_b1_t4 values(1520000023042, 42)
|
||||
sql insert into c_b1_t4 values(1520000024041, 41)
|
||||
|
||||
$x = 0
|
||||
show10:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show10
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show10
|
||||
endi
|
||||
if $dnode4Vnodes != 2 then
|
||||
goto show10
|
||||
endi
|
||||
|
||||
sql reset query cache
|
||||
|
||||
sql use c_b1_d3
|
||||
sql insert into c_b1_t3 values(1520000025036, 36)
|
||||
|
||||
sql use c_b1_d2
|
||||
sql insert into c_b1_t2 values(1520000025026, 26)
|
||||
|
||||
print ============================== step12
|
||||
sql create database c_b1_d5
|
||||
sql use c_b1_d5
|
||||
sql_error create table c_b1_t5 (t timestamp, i int) -x error3
|
||||
|
||||
print ============================== step13
|
||||
sql create dnode $hostname5
|
||||
system sh/exec.sh -n dnode5 -s start
|
||||
$x = 0
|
||||
step13:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes
|
||||
print dnode1 $data4_1
|
||||
print dnode2 $data4_2
|
||||
print dnode3 $data4_3
|
||||
print dnode4 $data4_4
|
||||
print dnode5 $data4_5
|
||||
|
||||
if $data4_5 != ready then
|
||||
goto step13
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode4Role = $data2_4
|
||||
$dnode5Role = $data2_5
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
print dnode5 ==> $dnode5Role
|
||||
|
||||
sql use c_b1_d5;
|
||||
sql create table c_b1_t5 (t timestamp, i int)
|
||||
sql insert into c_b1_t5 values(1520000020055, 55)
|
||||
sql insert into c_b1_t5 values(1520000021054, 54)
|
||||
sql insert into c_b1_t5 values(1520000022053, 53)
|
||||
sql insert into c_b1_t5 values(1520000023052, 52)
|
||||
sql insert into c_b1_t5 values(1520000024051, 51)
|
||||
|
||||
sql create database c_b1_d6
|
||||
sql use c_b1_d6
|
||||
sql create table c_b1_t6 (t timestamp, i int)
|
||||
sql insert into c_b1_t6 values(1520000020065, 65)
|
||||
sql insert into c_b1_t6 values(1520000021064, 64)
|
||||
sql insert into c_b1_t6 values(1520000022063, 63)
|
||||
sql insert into c_b1_t6 values(1520000023062, 62)
|
||||
sql insert into c_b1_t6 values(1520000024061, 61)
|
||||
|
||||
sql show dnodes
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode2Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode2Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto step13
|
||||
endi
|
||||
if $dnode4Vnodes != 2 then
|
||||
goto step13
|
||||
endi
|
||||
if $dnode5Vnodes != 2 then
|
||||
goto step13
|
||||
endi
|
||||
|
||||
print ============================== step14
|
||||
sql create dnode $hostname6
|
||||
system sh/exec.sh -n dnode6 -s start
|
||||
$x = 0
|
||||
step14:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes
|
||||
print dnode1 $data4_1
|
||||
print dnode2 $data4_2
|
||||
print dnode3 $data4_3
|
||||
print dnode4 $data4_4
|
||||
print dnode4 $data4_5
|
||||
|
||||
if $data4_6 != ready then
|
||||
goto step14
|
||||
endi
|
||||
|
||||
sql create database c_b1_d7
|
||||
sql use c_b1_d7
|
||||
sql create table c_b1_t7 (t timestamp, i int)
|
||||
sql insert into c_b1_t7 values(1520000020075, 75)
|
||||
sql insert into c_b1_t7 values(1520000021074, 74)
|
||||
sql insert into c_b1_t7 values(1520000022073, 73)
|
||||
sql insert into c_b1_t7 values(1520000023072, 72)
|
||||
sql insert into c_b1_t7 values(1520000024071, 71)
|
||||
|
||||
sql create database c_b1_d8
|
||||
sql use c_b1_d8
|
||||
sql create table c_b1_t8 (t timestamp, i int)
|
||||
sql insert into c_b1_t8 values(1520000020085, 85)
|
||||
sql insert into c_b1_t8 values(1520000021084, 84)
|
||||
sql insert into c_b1_t8 values(1520000022083, 83)
|
||||
sql insert into c_b1_t8 values(1520000023082, 82)
|
||||
sql insert into c_b1_t8 values(1520000024081, 81)
|
||||
|
||||
$x = 0
|
||||
show14:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 30 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show14
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode6Vnodes = $data2_6
|
||||
print dnode6 $dnode6Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show14
|
||||
endi
|
||||
if $dnode4Vnodes != 2 then
|
||||
goto show14
|
||||
endi
|
||||
if $dnode5Vnodes != 2 then
|
||||
goto show14
|
||||
endi
|
||||
if $dnode6Vnodes != 2 then
|
||||
goto show14
|
||||
endi
|
||||
|
||||
sql reset query cache
|
||||
sleep 1000
|
||||
|
||||
print ============================== step17
|
||||
print ========= check data
|
||||
|
||||
sql reset query cache
|
||||
sleep 100
|
||||
|
||||
sql use c_b1_d1
|
||||
sql select * from c_b1_d1.c_b1_t1
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d2
|
||||
sql select * from c_b1_d2.c_b1_t2
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $rows != 6 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d3
|
||||
sql select * from c_b1_d3.c_b1_t3 order by t desc
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $rows != 6 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != 36 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d4
|
||||
sql select * from c_b1_d4.c_b1_t4 order by t desc
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
|
||||
sql use c_b1_d5
|
||||
sql select * from c_b1_d5.c_b1_t5 order by t desc
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 51 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 52 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 53 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 54 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 55 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d6
|
||||
sql select * from c_b1_d6.c_b1_t6 order by t desc
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 61 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 62 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 63 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 64 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 65 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d7
|
||||
sql select * from c_b1_d7.c_b1_t7 order by t desc
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 71 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 72 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 73 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 74 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 75 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql use c_b1_d8
|
||||
sql select * from c_b1_d8.c_b1_t8 order by t desc
|
||||
print $rows
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 81 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 82 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 83 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 84 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 85 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================================ over=
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode5 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode6 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode7 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode8 -s stop -x SIGINT
|
|
@ -1,479 +0,0 @@
|
|||
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/deploy.sh -n dnode5 -i 5
|
||||
system sh/deploy.sh -n dnode6 -i 6
|
||||
system sh/deploy.sh -n dnode7 -i 7
|
||||
system sh/deploy.sh -n dnode8 -i 8
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode6 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode7 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode8 -c numOfMnodes -v 3
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode2 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode3 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode4 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode5 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode6 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode7 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode8 -c wallevel -v 1
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode8 -c mnodeEqualVnodeNum -v 0
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode4 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode5 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode6 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode7 -c maxTablesPerVnode -v 4
|
||||
system sh/cfg.sh -n dnode8 -c maxTablesPerVnode -v 4
|
||||
|
||||
|
||||
print ============== step1
|
||||
print ========= start dnode1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
sql connect
|
||||
sql create dnode $hostname2
|
||||
sql create dnode $hostname3
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
$x = 0
|
||||
step1:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes
|
||||
print dnode1 $data4_1
|
||||
print dnode2 $data4_2
|
||||
print dnode3 $data4_3
|
||||
print dnode4 $data4_4
|
||||
|
||||
if $data4_1 != ready then
|
||||
goto step1
|
||||
endi
|
||||
if $data4_2 != ready then
|
||||
goto step1
|
||||
endi
|
||||
if $data4_3 != ready then
|
||||
goto step1
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print mnode1 $data2_1
|
||||
print mnode1 $data2_2
|
||||
print mnode1 $data2_3
|
||||
if $data2_1 != master then
|
||||
goto step1
|
||||
endi
|
||||
if $data2_2 != slave then
|
||||
goto step1
|
||||
endi
|
||||
if $data2_3 != slave then
|
||||
goto step1
|
||||
endi
|
||||
|
||||
|
||||
sql create database c_b2_d1 replica 2
|
||||
sql use c_b2_d1
|
||||
sql create table c_b2_t1 (t timestamp, i int)
|
||||
sql insert into c_b2_t1 values(1520000020015, 15)
|
||||
sql insert into c_b2_t1 values(1520000021014, 14)
|
||||
sql insert into c_b2_t1 values(1520000022013, 13)
|
||||
sql insert into c_b2_t1 values(1520000023012, 12)
|
||||
sql insert into c_b2_t1 values(1520000024011, 11)
|
||||
|
||||
sql create database c_b2_d2 replica 2
|
||||
sql use c_b2_d2
|
||||
sql create table c_b2_t2 (t timestamp, i int)
|
||||
sql insert into c_b2_t2 values(1520000020025, 25)
|
||||
sql insert into c_b2_t2 values(1520000021024, 24)
|
||||
sql insert into c_b2_t2 values(1520000022023, 23)
|
||||
sql insert into c_b2_t2 values(1520000023022, 22)
|
||||
sql insert into c_b2_t2 values(1520000024021, 21)
|
||||
|
||||
sql create database c_b2_d3 replica 2
|
||||
sql use c_b2_d3
|
||||
sql create table c_b2_t3 (t timestamp, i int)
|
||||
sql insert into c_b2_t3 values(1520000020035, 35)
|
||||
sql insert into c_b2_t3 values(1520000021034, 34)
|
||||
sql insert into c_b2_t3 values(1520000022033, 33)
|
||||
sql insert into c_b2_t3 values(1520000023032, 32)
|
||||
sql insert into c_b2_t3 values(1520000024031, 31)
|
||||
|
||||
$x = 0
|
||||
show1:
|
||||
$x = $x + 1
|
||||
sleep 3000
|
||||
if $x == 20 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show1
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show1
|
||||
endi
|
||||
if $dnode2Vnodes != 2 then
|
||||
goto show1
|
||||
endi
|
||||
if $dnode3Vnodes != 2 then
|
||||
goto show1
|
||||
endi
|
||||
|
||||
print ============================== step2
|
||||
print ========= drop dnode2
|
||||
sql drop dnode $hostname2
|
||||
|
||||
$x = 0
|
||||
show2:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 30 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show2
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show2
|
||||
endi
|
||||
if $dnode2Vnodes != null then
|
||||
goto show2
|
||||
endi
|
||||
if $dnode3Vnodes != 3 then
|
||||
goto show2
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode2Role = $data2_2
|
||||
$dnode3Role = $data2_3
|
||||
$dnode4Role = $data2_4
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode2 ==> $dnode2Role
|
||||
print dnode3 ==> $dnode3Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
|
||||
print ============================== step3
|
||||
print ========= start dnode4
|
||||
sql create dnode $hostname4
|
||||
system sh/exec.sh -n dnode4 -s start
|
||||
|
||||
$x = 0
|
||||
show3:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 30 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show3
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show3
|
||||
endi
|
||||
if $dnode4Vnodes != 2 then
|
||||
goto show3
|
||||
endi
|
||||
if $dnode3Vnodes != 2 then
|
||||
goto show3
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode2Role = $data2_2
|
||||
$dnode3Role = $data2_3
|
||||
$dnode4Role = $data2_4
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode2 ==> $dnode2Role
|
||||
print dnode3 ==> $dnode3Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
|
||||
if $dnode1Role != master then
|
||||
return -1
|
||||
endi
|
||||
if $dnode2Role != null then
|
||||
return -1
|
||||
endi
|
||||
if $dnode3Role != slave then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $dnode4Role != slave then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================== step4
|
||||
print ========= drop dnode3
|
||||
sql drop dnode $hostname3
|
||||
|
||||
$x = 0
|
||||
show4:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show4
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show4
|
||||
endi
|
||||
if $dnode4Vnodes != 3 then
|
||||
goto show4
|
||||
endi
|
||||
if $dnode3Vnodes != null then
|
||||
goto show4
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode2Role = $data2_2
|
||||
$dnode3Role = $data2_3
|
||||
$dnode4Role = $data2_4
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode2 ==> $dnode2Role
|
||||
print dnode3 ==> $dnode3Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
|
||||
if $dnode1Role != master then
|
||||
return -1
|
||||
endi
|
||||
if $dnode2Role != null then
|
||||
return -1
|
||||
endi
|
||||
if $dnode3Role != null then
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $dnode4Role != slave then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
|
||||
print ============================== step5
|
||||
print ========= start dnode3
|
||||
sql create dnode $hostname5
|
||||
system sh/exec.sh -n dnode5 -s start
|
||||
|
||||
$x = 0
|
||||
show5:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 30 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show5
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show5
|
||||
endi
|
||||
if $dnode4Vnodes != 2 then
|
||||
goto show5
|
||||
endi
|
||||
if $dnode5Vnodes != 2 then
|
||||
goto show5
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode4Role = $data2_4
|
||||
$dnode5Role = $data2_5
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
print dnode5 ==> $dnode5Role
|
||||
|
||||
print ============================== step6
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
print stop dnode1 and sleep 3000
|
||||
sleep 3000
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode4Role = $data2_4
|
||||
$dnode5Role = $data2_5
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
print dnode5 ==> $dnode5Role
|
||||
|
||||
if $dnode1Role != offline then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================== step6.1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
$x = 0
|
||||
step6.1:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes
|
||||
print dnode1 $data4_1
|
||||
|
||||
if $data4_1 != ready then
|
||||
goto step6.1
|
||||
endi
|
||||
|
||||
sql drop dnode $hostname1
|
||||
print drop dnode1 and sleep 9000
|
||||
sleep 9000
|
||||
|
||||
$x = 0
|
||||
show6:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show6
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
|
||||
if $dnode1Vnodes != null then
|
||||
goto show6
|
||||
endi
|
||||
if $dnode4Vnodes != 3 then
|
||||
goto show6
|
||||
endi
|
||||
if $dnode5Vnodes != 3 then
|
||||
goto show6
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode4Role = $data2_4
|
||||
$dnode5Role = $data2_5
|
||||
print dnode1 ==> $dnode1Role
|
||||
print dnode4 ==> $dnode4Role
|
||||
print dnode5 ==> $dnode5Role
|
||||
|
||||
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
||||
print ============================== step12
|
||||
print ========= check data
|
||||
|
||||
sql reset query cache
|
||||
sleep 100
|
||||
|
||||
sql select * from c_b2_d1.c_b2_t1 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 11 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 12 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 13 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 14 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 15 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from c_b2_d2.c_b2_t2 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
|
||||
if $data01 != 21 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 22 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 23 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 24 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 25 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from c_b2_d3.c_b2_t3 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 31 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 32 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 33 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 34 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 35 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================================ over
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode5 -s stop -x SIGKILL
|
||||
system sh/exec.sh -n dnode6 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode7 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode8 -s stop -x SIGINT
|
|
@ -1,643 +0,0 @@
|
|||
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/deploy.sh -n dnode5 -i 5
|
||||
system sh/deploy.sh -n dnode6 -i 6
|
||||
system sh/deploy.sh -n dnode7 -i 7
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode5 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode6 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode7 -c numOfMnodes -v 3
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 0
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode2 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode3 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode4 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode5 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode6 -c wallevel -v 1
|
||||
system sh/cfg.sh -n dnode7 -c wallevel -v 1
|
||||
|
||||
print ============== step1
|
||||
print ========= start dnode1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
sql create dnode $hostname2
|
||||
sql create dnode $hostname3
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
|
||||
$x = 0
|
||||
step1:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes
|
||||
print dnode1 $data4_1
|
||||
print dnode2 $data4_2
|
||||
print dnode3 $data4_3
|
||||
|
||||
if $data4_1 != ready then
|
||||
goto step1
|
||||
endi
|
||||
if $data4_2 != ready then
|
||||
goto step1
|
||||
endi
|
||||
if $data4_3 != ready then
|
||||
goto step1
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print mnode1 $data2_1
|
||||
print mnode1 $data2_2
|
||||
print mnode1 $data2_3
|
||||
if $data2_1 != master then
|
||||
goto step1
|
||||
endi
|
||||
if $data2_2 != slave then
|
||||
goto step1
|
||||
endi
|
||||
if $data2_3 != slave then
|
||||
goto step1
|
||||
endi
|
||||
|
||||
sql create database c_b3_d1 replica 3
|
||||
sql use c_b3_d1
|
||||
sql create table c_b3_t1 (t timestamp, i int)
|
||||
sql insert into c_b3_t1 values(1520000020015, 15)
|
||||
sql insert into c_b3_t1 values(1520000021014, 14)
|
||||
sql insert into c_b3_t1 values(1520000022013, 13)
|
||||
sql insert into c_b3_t1 values(1520000023012, 12)
|
||||
sql insert into c_b3_t1 values(1520000024011, 11)
|
||||
|
||||
sql create database c_b3_d2 replica 3
|
||||
sql use c_b3_d2
|
||||
sql create table c_b3_t2 (t timestamp, i int)
|
||||
sql insert into c_b3_t2 values(1520000020025, 25)
|
||||
sql insert into c_b3_t2 values(1520000021024, 24)
|
||||
sql insert into c_b3_t2 values(1520000022023, 23)
|
||||
sql insert into c_b3_t2 values(1520000023022, 22)
|
||||
sql insert into c_b3_t2 values(1520000024021, 21)
|
||||
|
||||
sql create database c_b3_d3 replica 3
|
||||
sql use c_b3_d3
|
||||
sql create table c_b3_t3 (t timestamp, i int)
|
||||
sql insert into c_b3_t3 values(1520000020035, 35)
|
||||
sql insert into c_b3_t3 values(1520000021034, 34)
|
||||
sql insert into c_b3_t3 values(1520000022033, 33)
|
||||
sql insert into c_b3_t3 values(1520000023032, 32)
|
||||
sql insert into c_b3_t3 values(1520000024031, 31)
|
||||
|
||||
$x = 0
|
||||
show1:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 20 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show1
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show1
|
||||
endi
|
||||
if $dnode2Vnodes != 3 then
|
||||
goto show1
|
||||
endi
|
||||
if $dnode3Vnodes != 3 then
|
||||
goto show1
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
|
||||
print ============================== step2
|
||||
print ========= start dnode4
|
||||
sql create dnode $hostname4
|
||||
system sh/exec.sh -n dnode4 -s start
|
||||
|
||||
$x = 0
|
||||
show2:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show2
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
|
||||
if $dnode4Vnodes != 2 then
|
||||
goto show2
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
|
||||
print ============================== step3
|
||||
print ========= drop dnode2
|
||||
sql drop dnode $hostname2
|
||||
|
||||
$x = 0
|
||||
show3:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show3
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode2Vnodes = $data2_2
|
||||
print dnode2 $dnode2Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show3
|
||||
endi
|
||||
if $dnode2Vnodes != null then
|
||||
goto show3
|
||||
endi
|
||||
if $dnode3Vnodes != 3 then
|
||||
goto show3
|
||||
endi
|
||||
if $dnode4Vnodes != 3 then
|
||||
goto show3
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
|
||||
print ============================== step4
|
||||
sql create dnode $hostname5
|
||||
system sh/exec.sh -n dnode5 -s start
|
||||
|
||||
$x = 0
|
||||
show4:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes -x show4
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
|
||||
if $dnode5Vnodes != 2 then
|
||||
goto show4
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
|
||||
if $data2_4 != slave then
|
||||
goto show4
|
||||
endi
|
||||
|
||||
print ============================== step5
|
||||
print ========= drop dnode3
|
||||
sql drop dnode $hostname3
|
||||
sleep 9000
|
||||
|
||||
$x = 0
|
||||
show5:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show5
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode3Vnodes = $data2_3
|
||||
print dnode3 $dnode3Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show5
|
||||
endi
|
||||
if $dnode5Vnodes != 3 then
|
||||
goto show5
|
||||
endi
|
||||
if $dnode3Vnodes != null then
|
||||
goto show5
|
||||
endi
|
||||
if $dnode4Vnodes != 3 then
|
||||
goto show5
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
print dnode6 ==> $data2_6
|
||||
print dnode7 ==> $data2_7
|
||||
|
||||
if $data2_5 != slave then
|
||||
goto show5
|
||||
endi
|
||||
|
||||
print ============================== step6
|
||||
sql create dnode $hostname6
|
||||
system sh/exec.sh -n dnode6 -s start
|
||||
|
||||
$x = 0
|
||||
show6:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show6
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode6Vnodes = $data2_6
|
||||
print dnode6 $dnode6Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show6
|
||||
endi
|
||||
if $dnode4Vnodes != 2 then
|
||||
goto show6
|
||||
endi
|
||||
if $dnode5Vnodes != 3 then
|
||||
goto show6
|
||||
endi
|
||||
if $dnode6Vnodes != 2 then
|
||||
goto show6
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
print dnode6 ==> $data2_6
|
||||
print dnode7 ==> $data2_7
|
||||
|
||||
print ============================== step7
|
||||
print ========= drop dnode4
|
||||
sql drop dnode $hostname4
|
||||
|
||||
$x = 0
|
||||
show7:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show7
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode4Vnodes = $data2_4
|
||||
print dnode4 $dnode4Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode6Vnodes = $data2_6
|
||||
print dnode6 $dnode6Vnodes
|
||||
|
||||
if $dnode1Vnodes != 3 then
|
||||
goto show7
|
||||
endi
|
||||
if $dnode5Vnodes != 3 then
|
||||
goto show7
|
||||
endi
|
||||
if $dnode6Vnodes != 3 then
|
||||
goto show7
|
||||
endi
|
||||
if $dnode4Vnodes != null then
|
||||
goto show7
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
print dnode6 ==> $data2_6
|
||||
print dnode7 ==> $data2_7
|
||||
|
||||
if $data2_6 != slave then
|
||||
goto show7
|
||||
endi
|
||||
|
||||
print ============================== step8
|
||||
sql create dnode $hostname7
|
||||
system sh/exec.sh -n dnode7 -s start
|
||||
|
||||
$x = 0
|
||||
show8:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show8
|
||||
$dnode1Vnodes = $data2_1
|
||||
print dnode1 $dnode1Vnodes
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode6Vnodes = $data2_6
|
||||
print dnode6 $dnode6Vnodes
|
||||
$dnode7Vnodes = $data2_7
|
||||
print dnode7 $dnode7Vnodes
|
||||
|
||||
if $dnode1Vnodes != 2 then
|
||||
goto show8
|
||||
endi
|
||||
if $dnode5Vnodes != 2 then
|
||||
goto show8
|
||||
endi
|
||||
if $dnode6Vnodes != 3 then
|
||||
goto show8
|
||||
endi
|
||||
if $dnode7Vnodes != 2 then
|
||||
goto show8
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
print dnode6 ==> $data2_6
|
||||
print dnode7 ==> $data2_7
|
||||
|
||||
print ============================== step9
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
||||
$x = 0
|
||||
show9:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show mnodes -x show9
|
||||
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
print dnode6 ==> $data2_6
|
||||
print dnode7 ==> $data2_7
|
||||
|
||||
if $data2_1 != offline then
|
||||
goto show9
|
||||
endi
|
||||
if $data2_5 != master then
|
||||
goto show9
|
||||
endi
|
||||
if $data2_6 != slave then
|
||||
goto show9
|
||||
endi
|
||||
|
||||
print ============================== step10
|
||||
sql drop dnode $hostname1
|
||||
$x = 0
|
||||
show10:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show mnodes -x show10
|
||||
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
print dnode6 ==> $data2_6
|
||||
print dnode7 ==> $data2_7
|
||||
|
||||
if $data2_1 != null then
|
||||
goto show10
|
||||
endi
|
||||
if $data2_5 != master then
|
||||
goto show10
|
||||
endi
|
||||
if $data2_6 != slave then
|
||||
goto show10
|
||||
endi
|
||||
if $data2_7 != slave then
|
||||
goto show10
|
||||
endi
|
||||
|
||||
print ============================== step11
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
|
||||
$x = 0
|
||||
show11:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show dnodes -x show11
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode6Vnodes = $data2_6
|
||||
print dnode6 $dnode6Vnodes
|
||||
$dnode7Vnodes = $data2_7
|
||||
print dnode7 $dnode7Vnodes
|
||||
|
||||
if $dnode5Vnodes != 3 then
|
||||
goto show11
|
||||
endi
|
||||
if $dnode6Vnodes != 3 then
|
||||
goto show11
|
||||
endi
|
||||
if $dnode7Vnodes != 3 then
|
||||
goto show11
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
||||
sql show mnodes
|
||||
print dnode1 ==> $data2_1
|
||||
print dnode2 ==> $data2_2
|
||||
print dnode3 ==> $data2_3
|
||||
print dnode4 ==> $data2_4
|
||||
print dnode5 ==> $data2_5
|
||||
print dnode6 ==> $data2_6
|
||||
print dnode7 ==> $data2_7
|
||||
|
||||
print ============================== step12
|
||||
sql create database c_b3_d4 replica 3
|
||||
sql use c_b3_d4
|
||||
$x = 0
|
||||
create4:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 20 then
|
||||
return -1
|
||||
endi
|
||||
sql create table c_b3_t4 (t timestamp, i int) -x create4
|
||||
sql insert into c_b3_t4 values(1520000020045, 45)
|
||||
sql insert into c_b3_t4 values(1520000021044, 44)
|
||||
sql insert into c_b3_t4 values(1520000022043, 43)
|
||||
sql insert into c_b3_t4 values(1520000023042, 42)
|
||||
sql insert into c_b3_t4 values(1520000024041, 41)
|
||||
|
||||
$x = 0
|
||||
show12:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 40 then
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes -x show12
|
||||
$dnode5Vnodes = $data2_5
|
||||
print dnode5 $dnode5Vnodes
|
||||
$dnode6Vnodes = $data2_6
|
||||
print dnode6 $dnode6Vnodes
|
||||
$dnode7Vnodes = $data2_7
|
||||
print dnode7 $dnode7Vnodes
|
||||
|
||||
if $dnode5Vnodes != 4 then
|
||||
goto show12
|
||||
endi
|
||||
if $dnode6Vnodes != 4 then
|
||||
goto show12
|
||||
endi
|
||||
if $dnode7Vnodes != 4 then
|
||||
goto show12
|
||||
endi
|
||||
|
||||
print ============================== step13
|
||||
sql reset query cache
|
||||
sleep 200
|
||||
|
||||
print ========= check data
|
||||
|
||||
sql select * from c_b3_d1.c_b3_t1 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 11 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 12 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 13 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 14 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 15 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from c_b3_d2.c_b3_t2 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
|
||||
if $data01 != 21 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 22 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 23 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 24 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 25 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from c_b3_d3.c_b3_t3 order by t desc
|
||||
print $data01 $data11 $data21 $data31 $data41
|
||||
if $data01 != 31 then
|
||||
return -1
|
||||
endi
|
||||
if $data11 != 32 then
|
||||
return -1
|
||||
endi
|
||||
if $data21 != 33 then
|
||||
return -1
|
||||
endi
|
||||
if $data31 != 34 then
|
||||
return -1
|
||||
endi
|
||||
if $data41 != 35 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
print ============================================ over
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode5 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode6 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode7 -s stop -x SIGINT
|
|
@ -1,65 +0,0 @@
|
|||
system sh/stop_dnodes.sh
|
||||
|
||||
|
||||
system sh/deploy.sh -n dnode1 -i 1
|
||||
system sh/deploy.sh -n dnode2 -i 2
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c walLevel -v 1
|
||||
system sh/cfg.sh -n dnode2 -c walLevel -v 1
|
||||
system sh/cfg.sh -n dnode1 -c httpMaxThreads -v 2
|
||||
system sh/cfg.sh -n dnode2 -c httpMaxThreads -v 2
|
||||
system sh/cfg.sh -n dnode1 -c monitor -v 1
|
||||
system sh/cfg.sh -n dnode1 -c monitor -v 2
|
||||
system sh/cfg.sh -n dnode2 -c http -v 1
|
||||
system sh/cfg.sh -n dnode1 -c enableHttp -v 1
|
||||
system sh/cfg.sh -n dnode2 -c monitor -v 1
|
||||
system sh/cfg.sh -n dnode1 -c monitorInterval -v 1
|
||||
system sh/cfg.sh -n dnode2 -c monitorInterval -v 1
|
||||
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sleep 2000
|
||||
sql connect
|
||||
|
||||
sql create database testdb
|
||||
sql use testdb
|
||||
sql create table meter1 (ts timestamp, val int)
|
||||
|
||||
$x = 0
|
||||
$v = -100
|
||||
while $x < 30
|
||||
$v = $v + 1
|
||||
$ms = $v . m
|
||||
sql insert into meter1 values (now $ms , $x )
|
||||
$x = $x + 1
|
||||
endw
|
||||
|
||||
sleep 2000
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
sql create dnode $hostname2
|
||||
|
||||
|
||||
sleep 10000
|
||||
|
||||
sql show log.tables;
|
||||
if $rows > 6 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql select * from log.dn1
|
||||
print ===>rows $rows
|
||||
print $data00 $data01 $data02
|
||||
print $data10 $data11 $data12
|
||||
print $data20 $data21 $data22
|
||||
if $rows < 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
#sql create table sys.st as select avg(taosd), avg(system) from sys.cpu interval(30s)
|
||||
|
||||
sql show log.vgroups
|
||||
if $data05 != master then
|
||||
return -1
|
||||
endi
|
||||
if $data15 != master then
|
||||
return -1
|
||||
endi
|
|
@ -1,131 +0,0 @@
|
|||
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/cfg.sh -n dnode1 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
|
||||
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
|
||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c http -v 0
|
||||
system sh/cfg.sh -n dnode2 -c http -v 0
|
||||
system sh/cfg.sh -n dnode3 -c http -v 0
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 20000
|
||||
system sh/cfg.sh -n dnode2 -c maxTablesPerVnode -v 20000
|
||||
system sh/cfg.sh -n dnode3 -c maxTablesPerVnode -v 20000
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 20
|
||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 20
|
||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 20
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c replica -v 3
|
||||
system sh/cfg.sh -n dnode2 -c replica -v 3
|
||||
system sh/cfg.sh -n dnode3 -c replica -v 3
|
||||
|
||||
print ============== deploy
|
||||
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sleep 5001
|
||||
sql connect
|
||||
|
||||
sql create dnode $hostname2
|
||||
sql create dnode $hostname3
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
|
||||
print =============== step1
|
||||
$x = 0
|
||||
show1:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 5 then
|
||||
return -1
|
||||
endi
|
||||
sql show mnodes -x show1
|
||||
$mnode1Role = $data2_1
|
||||
print mnode1Role $mnode1Role
|
||||
$mnode2Role = $data2_2
|
||||
print mnode2Role $mnode2Role
|
||||
$mnode3Role = $data2_3
|
||||
print mnode3Role $mnode3Role
|
||||
|
||||
if $mnode1Role != master then
|
||||
goto show1
|
||||
endi
|
||||
if $mnode2Role != slave then
|
||||
goto show1
|
||||
endi
|
||||
if $mnode3Role != slave then
|
||||
goto show1
|
||||
endi
|
||||
|
||||
print =============== step2
|
||||
|
||||
sql create database db replica 3
|
||||
sql use db
|
||||
sql create table tb (ts timestamp, test int)
|
||||
|
||||
$x = 0
|
||||
while $x < 100
|
||||
$ms = $x . s
|
||||
sql insert into tb values (now + $ms , $x )
|
||||
$x = $x + 1
|
||||
endw
|
||||
|
||||
print =============== step3
|
||||
sleep 2000
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
|
||||
print =============== step4
|
||||
sleep 3000
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
|
||||
print =============== step5
|
||||
sleep 8000
|
||||
while $x < 200
|
||||
$ms = $x . s
|
||||
sql insert into tb values (now + $ms , $x )
|
||||
$x = $x + 1
|
||||
endw
|
||||
|
||||
print =============== step6
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
sleep 2000
|
||||
while $x < 300
|
||||
$ms = $x . s
|
||||
sql insert into tb values (now + $ms , $x )
|
||||
$x = $x + 1
|
||||
endw
|
||||
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
|
||||
sleep 6000
|
||||
print =============== step7
|
||||
while $x < 400
|
||||
$ms = $x . s
|
||||
sql insert into tb values (now + $ms , $x )
|
||||
$x = $x + 1
|
||||
sleep 1
|
||||
endw
|
||||
|
||||
print =============== step8
|
||||
sql select * from tb
|
||||
print rows $rows
|
||||
if $rows != 400 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
@ -1,146 +0,0 @@
|
|||
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/cfg.sh -n dnode1 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 3
|
||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c maxTables -v 4
|
||||
system sh/cfg.sh -n dnode2 -c maxTables -v 4
|
||||
system sh/cfg.sh -n dnode3 -c maxTables -v 4
|
||||
|
||||
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 0
|
||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 0
|
||||
|
||||
print ============================== step1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ============================== step2
|
||||
print ========= start dnode2
|
||||
sql create dnode $hostname2
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
sql create dnode $hostname3
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
|
||||
$maxNum = 102
|
||||
$maxNum = 12
|
||||
|
||||
$x = 0
|
||||
show2:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 10 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show mnodes
|
||||
$dnode1Role = $data2_1
|
||||
$dnode2Role = $data2_2
|
||||
$dnode3Role = $data2_3
|
||||
|
||||
print $dnode1Role
|
||||
print $dnode2Role
|
||||
print $dnode3Role
|
||||
|
||||
if $dnode1Role != master then
|
||||
goto show2
|
||||
endi
|
||||
if $dnode2Role != slave then
|
||||
goto show2
|
||||
endi
|
||||
if $dnode3Role != slave then
|
||||
goto show2
|
||||
endi
|
||||
|
||||
print ============================== step3
|
||||
$count = 2
|
||||
while $count < $maxNum
|
||||
$db = d . $count
|
||||
$tb = $db . .t
|
||||
$tb2 = $db . .t2
|
||||
sql create database $db replica 3 cache 1 blocks 3
|
||||
sql create table $tb (ts timestamp, i int)
|
||||
sql insert into $tb values(now, 1)
|
||||
sql create table $tb2 as select count(*) from $tb interval(10s)
|
||||
$count = $count + 1
|
||||
print insert into $tb values(now, 1) ==> finished
|
||||
endw
|
||||
|
||||
print ============================== step4
|
||||
|
||||
$count = 2
|
||||
while $count < $maxNum
|
||||
$db = d . $count
|
||||
$tb = $db . .t
|
||||
sql select * from $tb
|
||||
if $rows != 1 then
|
||||
print select * from $tb
|
||||
return -1
|
||||
endi
|
||||
$count = $count + 1
|
||||
print select * from $tb ==> rows: $rows
|
||||
endw
|
||||
|
||||
print ============================== step5
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
|
||||
print ============================== step6
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
|
||||
print ============================== step7
|
||||
|
||||
$x = 0
|
||||
show7:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 50 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql show mnodes -x show7
|
||||
$dnode1Role = $data2_1
|
||||
$dnode2Role = $data2_2
|
||||
$dnode3Role = $data2_3
|
||||
if $dnode1Role != master then
|
||||
goto show7
|
||||
endi
|
||||
if $dnode2Role != slave then
|
||||
goto show7
|
||||
endi
|
||||
if $dnode2Role != slave then
|
||||
goto show7
|
||||
endi
|
||||
|
||||
print ============================== step8
|
||||
$x = 0
|
||||
show8:
|
||||
$x = $x + 1
|
||||
sleep 2000
|
||||
if $x == 20 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
$count = 2
|
||||
while $count < $maxNum
|
||||
$db = d . $count
|
||||
$tb = $db . .t
|
||||
sql select * from $tb
|
||||
if $rows != 1 then
|
||||
print select * from $tb
|
||||
goto show8
|
||||
endi
|
||||
$count = $count + 1
|
||||
print select * from $tb ==> rows: $rows
|
||||
endw
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
@ -0,0 +1,75 @@
|
|||
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/cfg.sh -n dnode1 -c supportVnodes -v 0
|
||||
system sh/cfg.sh -n dnode2 -c supportVnodes -v 4
|
||||
system sh/cfg.sh -n dnode3 -c supportVnodes -v 4
|
||||
|
||||
print ========== step1
|
||||
system sh/exec.sh -n dnode1 -s start
|
||||
sql connect
|
||||
|
||||
print ========== step2
|
||||
sql create dnode $hostname port 7200
|
||||
sql create dnode $hostname port 7300
|
||||
system sh/exec.sh -n dnode2 -s start
|
||||
system sh/exec.sh -n dnode3 -s start
|
||||
|
||||
$x = 0
|
||||
step2:
|
||||
$x = $x + 1
|
||||
sleep 1000
|
||||
if $x == 10 then
|
||||
print ====> dnode not ready!
|
||||
return -1
|
||||
endi
|
||||
sql show dnodes
|
||||
print ===> $data00 $data01 $data02 $data03 $data04 $data05
|
||||
print ===> $data10 $data11 $data12 $data13 $data14 $data15
|
||||
if $rows != 3 then
|
||||
return -1
|
||||
endi
|
||||
if $data(1)[4] != ready then
|
||||
goto step2
|
||||
endi
|
||||
if $data(2)[4] != ready then
|
||||
goto step2
|
||||
endi
|
||||
if $data(3)[4] != ready then
|
||||
goto step2
|
||||
endi
|
||||
|
||||
print ========== step3
|
||||
sql create database d1 vgroups 1
|
||||
sql use d1;
|
||||
|
||||
print --> create stb
|
||||
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);
|
||||
|
||||
print --> create sma
|
||||
sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m);
|
||||
|
||||
print --> drop stb
|
||||
sql drop table stb;
|
||||
|
||||
print ========== step4 repeat
|
||||
|
||||
print --> create stb
|
||||
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned);
|
||||
|
||||
print --> create sma
|
||||
sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m);
|
||||
|
||||
print --> drop stb
|
||||
sql drop table stb;
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode5 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode6 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode7 -s stop -x SIGINT
|
||||
system sh/exec.sh -n dnode8 -s stop -x SIGINT
|
|
@ -5,6 +5,7 @@ import time
|
|||
import socket
|
||||
import os
|
||||
import threading
|
||||
import math
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
|
@ -127,10 +128,14 @@ class TDTestCase:
|
|||
#tdLog.debug("doing insert data into stable:%s rows:%d ..."%(stbName, allRows))
|
||||
for i in range(ctbNum):
|
||||
sql += " %s_%d values "%(stbName,i)
|
||||
batchRows = 0
|
||||
for j in range(rowsPerTbl):
|
||||
sql += "(%d, %d, 'tmqrow_%d') "%(startTs + j, j, j)
|
||||
if (j > 0) and ((j%batchNum == 0) or (j == rowsPerTbl - 1)):
|
||||
batchRows += 1
|
||||
# if (j > 0) and ((j%(batchNum-1) == 0) or (j == rowsPerTbl - 1)):
|
||||
if (j > 0) and ((batchRows == batchNum) or (j == rowsPerTbl - 1)):
|
||||
tsql.execute(sql)
|
||||
batchRows = 0
|
||||
if j < rowsPerTbl - 1:
|
||||
sql = "insert into %s_%d values " %(stbName,i)
|
||||
else:
|
||||
|
@ -171,8 +176,8 @@ class TDTestCase:
|
|||
'dbName': 'db8', \
|
||||
'vgroups': 4, \
|
||||
'stbName': 'stb', \
|
||||
'ctbNum': 10, \
|
||||
'rowsPerTbl': 10000, \
|
||||
'ctbNum': 1, \
|
||||
'rowsPerTbl': 1000, \
|
||||
'batchNum': 100, \
|
||||
'startTs': 1640966400000} # 2022-01-01 00:00:00.000
|
||||
parameterDict['cfg'] = cfgPath
|
||||
|
@ -189,7 +194,7 @@ class TDTestCase:
|
|||
|
||||
tdSql.execute("create topic %s as database %s" %(topicName1, parameterDict['dbName']))
|
||||
consumerId = 0
|
||||
expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2
|
||||
expectrowcnt = math.ceil(parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2)
|
||||
topicList = topicName1
|
||||
ifcheckdata = 0
|
||||
ifManualCommit = 0
|
||||
|
@ -217,7 +222,7 @@ class TDTestCase:
|
|||
for i in range(expectRows):
|
||||
totalConsumeRows += resultList[i]
|
||||
|
||||
if totalConsumeRows != expectrowcnt:
|
||||
if not (totalConsumeRows >= expectrowcnt):
|
||||
tdLog.info("act consume rows: %d, expect consume rows: %d"%(totalConsumeRows, expectrowcnt))
|
||||
tdLog.exit("tmq consume rows error!")
|
||||
|
||||
|
@ -267,7 +272,7 @@ class TDTestCase:
|
|||
|
||||
tdSql.execute("create topic %s as database %s" %(topicName1, parameterDict['dbName']))
|
||||
consumerId = 0
|
||||
expectrowcnt = parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2
|
||||
expectrowcnt = math.ceil(parameterDict["rowsPerTbl"] * parameterDict["ctbNum"] / 2)
|
||||
topicList = topicName1
|
||||
ifcheckdata = 0
|
||||
ifManualCommit = 1
|
||||
|
|
|
@ -5,6 +5,7 @@ import time
|
|||
import socket
|
||||
import os
|
||||
import threading
|
||||
import math
|
||||
|
||||
from util.log import *
|
||||
from util.sql import *
|
||||
|
@ -15,6 +16,11 @@ sys.path.append("./7-tmq")
|
|||
from tmqCommon import *
|
||||
|
||||
class TDTestCase:
|
||||
def __int__(self):
|
||||
self.vgroups = 1
|
||||
self.ctbNum = 10
|
||||
self.rowsPerTbl = 10000
|
||||
|
||||
def init(self, conn, logSql):
|
||||
tdLog.debug(f"start to excute {__file__}")
|
||||
tdSql.init(conn.cursor(), False)
|
||||
|
@ -40,6 +46,10 @@ class TDTestCase:
|
|||
'showRow': 1,
|
||||
'snapshot': 1}
|
||||
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
topicNameList = ['topic1']
|
||||
expectRowsList = []
|
||||
tmqCom.initConsumerTable()
|
||||
|
@ -113,6 +123,10 @@ class TDTestCase:
|
|||
'showRow': 1,
|
||||
'snapshot': 1}
|
||||
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
topicNameList = ['topic1']
|
||||
expectRowsList = []
|
||||
tmqCom.initConsumerTable()
|
||||
|
@ -140,7 +154,7 @@ class TDTestCase:
|
|||
# init consume info, and start tmq_sim, then check consume result
|
||||
tdLog.info("insert consume info to consume processor")
|
||||
consumerId = 1
|
||||
expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7)
|
||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3)
|
||||
topicList = topicNameList[0]
|
||||
ifcheckdata = 1
|
||||
ifManualCommit = 1
|
||||
|
@ -163,7 +177,7 @@ class TDTestCase:
|
|||
# reinit consume info, and start tmq_sim, then check consume result
|
||||
tmqCom.initConsumerTable()
|
||||
consumerId = 2
|
||||
expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3)
|
||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3)
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor 1")
|
||||
|
@ -176,8 +190,8 @@ class TDTestCase:
|
|||
actConsumeTotalRows = firstConsumeRows + resultList[0]
|
||||
|
||||
if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows):
|
||||
tdLog.info("act consume rows: %d, expect consume rows <= %d "%(resultList[0], expectrowcnt))
|
||||
tdLog.info("and sum of two consume rows: %d , total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
||||
tdLog.info("act consume rows, first: %d, second: %d "%(firstConsumeRows, resultList[0]))
|
||||
tdLog.info("and sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
time.sleep(10)
|
||||
|
@ -198,15 +212,19 @@ class TDTestCase:
|
|||
'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}],
|
||||
'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}],
|
||||
'ctbPrefix': 'ctb',
|
||||
'ctbNum': 10,
|
||||
'ctbNum': 1,
|
||||
'rowsPerTbl': 10000,
|
||||
'batchNum': 10,
|
||||
'startTs': 1640966400000, # 2022-01-01 00:00:00.000
|
||||
'pollDelay': 3,
|
||||
'pollDelay': -1,
|
||||
'showMsg': 1,
|
||||
'showRow': 1,
|
||||
'snapshot': 1}
|
||||
|
||||
paraDict['vgroups'] = self.vgroups
|
||||
paraDict['ctbNum'] = self.ctbNum
|
||||
paraDict['rowsPerTbl'] = self.rowsPerTbl
|
||||
|
||||
topicNameList = ['topic1']
|
||||
expectRowsList = []
|
||||
tmqCom.initConsumerTable()
|
||||
|
@ -229,49 +247,33 @@ class TDTestCase:
|
|||
tdSql.execute(sqlString)
|
||||
tdSql.query(queryString)
|
||||
expectRowsList.append(tdSql.getRows())
|
||||
totalRowsInserted = expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"]
|
||||
totalRowsInserted = expectRowsList[0]
|
||||
|
||||
# init consume info, and start tmq_sim, then check consume result
|
||||
tdLog.info("insert consume info to consume processor")
|
||||
consumerId = 3
|
||||
expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7)
|
||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] / 3)
|
||||
topicList = topicNameList[0]
|
||||
ifcheckdata = 1
|
||||
ifManualCommit = 1
|
||||
keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest'
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
consumerId = 4
|
||||
expectrowcnt = math.ceil(paraDict["rowsPerTbl"] * paraDict["ctbNum"] * 2/3)
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor 0")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
tdLog.info("wait the consume result")
|
||||
|
||||
expectRows = 1
|
||||
expectRows = 2
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
actConsumeTotalRows = resultList[0] + resultList[1]
|
||||
|
||||
if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]):
|
||||
tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted))
|
||||
tdLog.exit("0 tmq consume rows error!")
|
||||
|
||||
firstConsumeRows = resultList[0]
|
||||
|
||||
# reinit consume info, and start tmq_sim, then check consume result
|
||||
tmqCom.initConsumerTable()
|
||||
consumerId = 4
|
||||
expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3)
|
||||
tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit)
|
||||
|
||||
tdLog.info("start consume processor 1")
|
||||
tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot'])
|
||||
tdLog.info("wait the consume result")
|
||||
|
||||
expectRows = 1
|
||||
resultList = tmqCom.selectConsumeResult(expectRows)
|
||||
|
||||
actConsumeTotalRows = firstConsumeRows + resultList[0]
|
||||
|
||||
if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows):
|
||||
tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted))
|
||||
tdLog.exit("0 tmq consume rows error!")
|
||||
if not (totalRowsInserted == actConsumeTotalRows):
|
||||
tdLog.info("sum of two consume rows: %d should be equal to total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted))
|
||||
tdLog.exit("%d tmq consume rows error!"%consumerId)
|
||||
|
||||
time.sleep(10)
|
||||
for i in range(len(topicNameList)):
|
||||
|
|
|
@ -63,7 +63,7 @@ python3 ./test.py -f 2-query/To_unixtimestamp.py
|
|||
python3 ./test.py -f 2-query/timetruncate.py
|
||||
python3 ./test.py -f 2-query/diff.py
|
||||
python3 ./test.py -f 2-query/Timediff.py
|
||||
python3 ./test.py -f 2-query/json_tag.py
|
||||
#python3 ./test.py -f 2-query/json_tag.py
|
||||
|
||||
python3 ./test.py -f 2-query/top.py
|
||||
python3 ./test.py -f 2-query/bottom.py
|
||||
|
|
Loading…
Reference in New Issue