fix:conflicts
This commit is contained in:
commit
8cfdae7195
|
@ -2,7 +2,7 @@
|
||||||
# taos-tools
|
# taos-tools
|
||||||
ExternalProject_Add(taos-tools
|
ExternalProject_Add(taos-tools
|
||||||
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
GIT_REPOSITORY https://github.com/taosdata/taos-tools.git
|
||||||
GIT_TAG 7e9ce09
|
GIT_TAG 9f587e9
|
||||||
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools"
|
||||||
BINARY_DIR ""
|
BINARY_DIR ""
|
||||||
#BUILD_IN_SOURCE TRUE
|
#BUILD_IN_SOURCE TRUE
|
||||||
|
|
|
@ -174,15 +174,28 @@ typedef struct SColumnDataAgg {
|
||||||
} SColumnDataAgg;
|
} SColumnDataAgg;
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
typedef struct SBlockID {
|
||||||
|
// The uid of table, from which current data block comes. And it is always 0, if current block is the
|
||||||
|
// result of calculation.
|
||||||
|
uint64_t uid;
|
||||||
|
|
||||||
|
// Block id, acquired and assigned from executor, which created according to the hysical planner. Block id is used
|
||||||
|
// to mark the stage of exec task.
|
||||||
|
uint64_t blockId;
|
||||||
|
|
||||||
|
// Generated by group/partition by [value|tags]. Created and assigned by table-scan operator, group-by operator,
|
||||||
|
// and partition by operator.
|
||||||
|
uint64_t groupId;
|
||||||
|
} SBlockID;
|
||||||
|
|
||||||
typedef struct SDataBlockInfo {
|
typedef struct SDataBlockInfo {
|
||||||
STimeWindow window;
|
STimeWindow window;
|
||||||
int32_t rows; // todo hide this attribute
|
|
||||||
int32_t rowSize;
|
int32_t rowSize;
|
||||||
uint64_t uid; // the uid of table, from which current data block comes
|
int32_t rows; // todo hide this attribute
|
||||||
uint16_t blockId; // block id, generated by physical planner
|
|
||||||
uint64_t groupId;
|
|
||||||
int16_t hasVarCol;
|
|
||||||
uint32_t capacity;
|
uint32_t capacity;
|
||||||
|
SBlockID id;
|
||||||
|
int16_t hasVarCol;
|
||||||
|
|
||||||
// TODO: optimize and remove following
|
// TODO: optimize and remove following
|
||||||
int64_t version; // used for stream, and need serialization
|
int64_t version; // used for stream, and need serialization
|
||||||
int32_t childId; // used for stream, do not serialize
|
int32_t childId; // used for stream, do not serialize
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct SMetaData;
|
||||||
typedef struct SStmtCallback {
|
typedef struct SStmtCallback {
|
||||||
TAOS_STMT* pStmt;
|
TAOS_STMT* pStmt;
|
||||||
int32_t (*getTbNameFn)(TAOS_STMT*, char**);
|
int32_t (*getTbNameFn)(TAOS_STMT*, char**);
|
||||||
int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, char*, bool, SHashObj*, SHashObj*, const char*);
|
int32_t (*setInfoFn)(TAOS_STMT*, STableMeta*, void*, SName*, bool, SHashObj*, SHashObj*, const char*);
|
||||||
int32_t (*getExecInfoFn)(TAOS_STMT*, SHashObj**, SHashObj**);
|
int32_t (*getExecInfoFn)(TAOS_STMT*, SHashObj**, SHashObj**);
|
||||||
} SStmtCallback;
|
} SStmtCallback;
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,9 @@ typedef struct SSyncFSM {
|
||||||
// SWal implements it
|
// SWal implements it
|
||||||
typedef struct SSyncLogStore {
|
typedef struct SSyncLogStore {
|
||||||
SLRUCache* pCache;
|
SLRUCache* pCache;
|
||||||
|
int32_t cacheHit;
|
||||||
|
int32_t cacheMiss;
|
||||||
|
|
||||||
void* data;
|
void* data;
|
||||||
|
|
||||||
int32_t (*syncLogUpdateCommitIndex)(struct SSyncLogStore* pLogStore, SyncIndex index);
|
int32_t (*syncLogUpdateCommitIndex)(struct SSyncLogStore* pLogStore, SyncIndex index);
|
||||||
|
|
|
@ -49,7 +49,6 @@ extern "C" {
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,8 @@ extern "C" {
|
||||||
typedef int32_t (*__compar_fn_t)(const void *, const void *);
|
typedef int32_t (*__compar_fn_t)(const void *, const void *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef void *(*FCopy)(void *);
|
typedef void *(*__array_item_dup_fn_t)(void *);
|
||||||
|
|
||||||
typedef void (*FDelete)(void *);
|
typedef void (*FDelete)(void *);
|
||||||
typedef int32_t (*FEncode)(void **buf, const void *dst);
|
typedef int32_t (*FEncode)(void **buf, const void *dst);
|
||||||
typedef void *(*FDecode)(const void *buf, void *dst);
|
typedef void *(*FDecode)(const void *buf, void *dst);
|
||||||
|
@ -41,7 +42,6 @@ typedef void *(*FDecode)(const void *buf, void *dst);
|
||||||
#define elePtrAt(base, size, idx) (void *)((char *)(base) + (size) * (idx))
|
#define elePtrAt(base, size, idx) (void *)((char *)(base) + (size) * (idx))
|
||||||
|
|
||||||
typedef int32_t (*__ext_compar_fn_t)(const void *p1, const void *p2, const void *param);
|
typedef int32_t (*__ext_compar_fn_t)(const void *p1, const void *p2, const void *param);
|
||||||
typedef void (*__ext_swap_fn_t)(void *p1, void *p2, const void *param);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* quick sort, with the compare function requiring additional parameters support
|
* quick sort, with the compare function requiring additional parameters support
|
||||||
|
|
|
@ -205,13 +205,7 @@ SArray* taosArrayFromList(const void* src, size_t size, size_t elemSize);
|
||||||
* clone a new array
|
* clone a new array
|
||||||
* @param pSrc
|
* @param pSrc
|
||||||
*/
|
*/
|
||||||
SArray* taosArrayDup(const SArray* pSrc);
|
SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn);
|
||||||
|
|
||||||
/**
|
|
||||||
* deep copy a new array
|
|
||||||
* @param pSrc
|
|
||||||
*/
|
|
||||||
SArray* taosArrayDeepCopy(const SArray* pSrc, FCopy deepCopy);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clear the array (remove all element)
|
* clear the array (remove all element)
|
||||||
|
|
|
@ -406,7 +406,7 @@ typedef enum ELogicConditionType {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
|
#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
|
||||||
#else
|
#else
|
||||||
#define TSDB_MAX_RPC_THREADS 10
|
#define TSDB_MAX_RPC_THREADS 20
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
|
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
|
||||||
|
|
|
@ -205,6 +205,7 @@ function set_hostname() {
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
read -p "Please enter one hostname(must not be 'localhost'):" newHostname
|
read -p "Please enter one hostname(must not be 'localhost'):" newHostname
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -324,7 +325,9 @@ function local_fqdn_check() {
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
set_ipAsFqdn
|
||||||
echo "Invalid input..."
|
echo "Invalid input..."
|
||||||
|
break
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -51,7 +51,7 @@ Source: taos.bat; DestDir: "{app}\include"; Flags: igNoreversion;
|
||||||
;Source: taosdemo.png; DestDir: "{app}\include"; Flags: igNoreversion;
|
;Source: taosdemo.png; DestDir: "{app}\include"; Flags: igNoreversion;
|
||||||
;Source: taosShell.png; DestDir: "{app}\include"; Flags: igNoreversion;
|
;Source: taosShell.png; DestDir: "{app}\include"; Flags: igNoreversion;
|
||||||
Source: favicon.ico; DestDir: "{app}\include"; Flags: igNoreversion;
|
Source: favicon.ico; DestDir: "{app}\include"; Flags: igNoreversion;
|
||||||
Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: 64bit;Check:IsWin64;
|
Source: {#MyAppSourceDir}{#MyAppDLLName}; DestDir: "{win}\System32"; Flags: igNoreversion recursesubdirs createallsubdirs 64bit;Check:IsWin64;
|
||||||
Source: {#MyAppSourceDir}{#MyAppCfgName}; DestDir: "{app}\cfg"; Flags: igNoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
|
Source: {#MyAppSourceDir}{#MyAppCfgName}; DestDir: "{app}\cfg"; Flags: igNoreversion recursesubdirs createallsubdirs onlyifdoesntexist uninsneveruninstall
|
||||||
Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igNoreversion recursesubdirs createallsubdirs
|
Source: {#MyAppSourceDir}{#MyAppDriverName}; DestDir: "{app}\driver"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||||
;Source: {#MyAppSourceDir}{#MyAppConnectorName}; DestDir: "{app}\connector"; Flags: igNoreversion recursesubdirs createallsubdirs
|
;Source: {#MyAppSourceDir}{#MyAppConnectorName}; DestDir: "{app}\connector"; Flags: igNoreversion recursesubdirs createallsubdirs
|
||||||
|
|
|
@ -131,7 +131,7 @@ STscObj* taos_connect_internal(const char* ip, const char* user, const char* pas
|
||||||
p = taosMemoryCalloc(1, sizeof(struct SAppInstInfo));
|
p = taosMemoryCalloc(1, sizeof(struct SAppInstInfo));
|
||||||
p->mgmtEp = epSet;
|
p->mgmtEp = epSet;
|
||||||
taosThreadMutexInit(&p->qnodeMutex, NULL);
|
taosThreadMutexInit(&p->qnodeMutex, NULL);
|
||||||
p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores);
|
p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores / 2);
|
||||||
p->pAppHbMgr = appHbMgrInit(p, key);
|
p->pAppHbMgr = appHbMgrInit(p, key);
|
||||||
if (NULL == p->pAppHbMgr) {
|
if (NULL == p->pAppHbMgr) {
|
||||||
destroyAppInst(p);
|
destroyAppInst(p);
|
||||||
|
@ -373,7 +373,7 @@ int32_t updateQnodeList(SAppInstInfo* pInfo, SArray* pNodeList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pNodeList) {
|
if (pNodeList) {
|
||||||
pInfo->pQnodeList = taosArrayDup(pNodeList);
|
pInfo->pQnodeList = taosArrayDup(pNodeList, NULL);
|
||||||
taosArraySort(pInfo->pQnodeList, compareQueryNodeLoad);
|
taosArraySort(pInfo->pQnodeList, compareQueryNodeLoad);
|
||||||
tscDebug("QnodeList updated in cluster 0x%" PRIx64 ", num:%ld", pInfo->clusterId,
|
tscDebug("QnodeList updated in cluster 0x%" PRIx64 ", num:%ld", pInfo->clusterId,
|
||||||
taosArrayGetSize(pInfo->pQnodeList));
|
taosArrayGetSize(pInfo->pQnodeList));
|
||||||
|
@ -404,7 +404,7 @@ int32_t getQnodeList(SRequestObj* pRequest, SArray** pNodeList) {
|
||||||
|
|
||||||
taosThreadMutexLock(&pInfo->qnodeMutex);
|
taosThreadMutexLock(&pInfo->qnodeMutex);
|
||||||
if (pInfo->pQnodeList) {
|
if (pInfo->pQnodeList) {
|
||||||
*pNodeList = taosArrayDup(pInfo->pQnodeList);
|
*pNodeList = taosArrayDup(pInfo->pQnodeList, NULL);
|
||||||
}
|
}
|
||||||
taosThreadMutexUnlock(&pInfo->qnodeMutex);
|
taosThreadMutexUnlock(&pInfo->qnodeMutex);
|
||||||
|
|
||||||
|
@ -593,13 +593,13 @@ int32_t buildAsyncExecNodeList(SRequestObj* pRequest, SArray** pNodeList, SArray
|
||||||
if (pRes->code) {
|
if (pRes->code) {
|
||||||
pQnodeList = NULL;
|
pQnodeList = NULL;
|
||||||
} else {
|
} else {
|
||||||
pQnodeList = taosArrayDup((SArray*)pRes->pRes);
|
pQnodeList = taosArrayDup((SArray*)pRes->pRes, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SAppInstInfo* pInst = pRequest->pTscObj->pAppInfo;
|
SAppInstInfo* pInst = pRequest->pTscObj->pAppInfo;
|
||||||
taosThreadMutexLock(&pInst->qnodeMutex);
|
taosThreadMutexLock(&pInst->qnodeMutex);
|
||||||
if (pInst->pQnodeList) {
|
if (pInst->pQnodeList) {
|
||||||
pQnodeList = taosArrayDup(pInst->pQnodeList);
|
pQnodeList = taosArrayDup(pInst->pQnodeList, NULL);
|
||||||
}
|
}
|
||||||
taosThreadMutexUnlock(&pInst->qnodeMutex);
|
taosThreadMutexUnlock(&pInst->qnodeMutex);
|
||||||
}
|
}
|
||||||
|
@ -2293,10 +2293,16 @@ TAOS_RES* taosQueryImpl(TAOS* taos, const char* sql, bool validateOnly) {
|
||||||
|
|
||||||
taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly);
|
taosAsyncQueryImpl(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly);
|
||||||
tsem_wait(¶m->sem);
|
tsem_wait(¶m->sem);
|
||||||
|
|
||||||
|
SRequestObj *pRequest = NULL;
|
||||||
if (param->pRequest != NULL) {
|
if (param->pRequest != NULL) {
|
||||||
param->pRequest->syncQuery = true;
|
param->pRequest->syncQuery = true;
|
||||||
|
pRequest = param->pRequest;
|
||||||
|
} else {
|
||||||
|
taosMemoryFree(param);
|
||||||
}
|
}
|
||||||
return param->pRequest;
|
|
||||||
|
return pRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, int64_t reqid) {
|
TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly, int64_t reqid) {
|
||||||
|
@ -2310,8 +2316,14 @@ TAOS_RES* taosQueryImplWithReqid(TAOS* taos, const char* sql, bool validateOnly,
|
||||||
|
|
||||||
taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid);
|
taosAsyncQueryImplWithReqid(*(int64_t*)taos, sql, syncQueryFn, param, validateOnly, reqid);
|
||||||
tsem_wait(¶m->sem);
|
tsem_wait(¶m->sem);
|
||||||
|
|
||||||
|
SRequestObj *pRequest = NULL;
|
||||||
if (param->pRequest != NULL) {
|
if (param->pRequest != NULL) {
|
||||||
param->pRequest->syncQuery = true;
|
param->pRequest->syncQuery = true;
|
||||||
|
pRequest = param->pRequest;
|
||||||
|
} else {
|
||||||
|
taosMemoryFree(param);
|
||||||
}
|
}
|
||||||
return param->pRequest;
|
|
||||||
|
return pRequest;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,9 +152,12 @@ int32_t stmtRestoreQueryFields(STscStmt* pStmt) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, char* tbFName, const char* sTableName, bool autoCreateTbl) {
|
int32_t stmtUpdateBindInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, SName* tbName, const char* sTableName, bool autoCreateTbl) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||||
|
tNameExtractFullName(tbName, tbFName);
|
||||||
|
|
||||||
|
memcpy(&pStmt->bInfo.sname, tbName, sizeof(*tbName));
|
||||||
strncpy(pStmt->bInfo.tbFName, tbFName, sizeof(pStmt->bInfo.tbFName) - 1);
|
strncpy(pStmt->bInfo.tbFName, tbFName, sizeof(pStmt->bInfo.tbFName) - 1);
|
||||||
pStmt->bInfo.tbFName[sizeof(pStmt->bInfo.tbFName) - 1] = 0;
|
pStmt->bInfo.tbFName[sizeof(pStmt->bInfo.tbFName) - 1] = 0;
|
||||||
|
|
||||||
|
@ -178,11 +181,11 @@ int32_t stmtUpdateExecInfo(TAOS_STMT* stmt, SHashObj* pVgHash, SHashObj* pBlockH
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t stmtUpdateInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, char* tbFName, bool autoCreateTbl,
|
int32_t stmtUpdateInfo(TAOS_STMT* stmt, STableMeta* pTableMeta, void* tags, SName* tbName, bool autoCreateTbl,
|
||||||
SHashObj* pVgHash, SHashObj* pBlockHash, const char* sTableName) {
|
SHashObj* pVgHash, SHashObj* pBlockHash, const char* sTableName) {
|
||||||
STscStmt* pStmt = (STscStmt*)stmt;
|
STscStmt* pStmt = (STscStmt*)stmt;
|
||||||
|
|
||||||
STMT_ERR_RET(stmtUpdateBindInfo(stmt, pTableMeta, tags, tbFName, sTableName, autoCreateTbl));
|
STMT_ERR_RET(stmtUpdateBindInfo(stmt, pTableMeta, tags, tbName, sTableName, autoCreateTbl));
|
||||||
STMT_ERR_RET(stmtUpdateExecInfo(stmt, pVgHash, pBlockHash, autoCreateTbl));
|
STMT_ERR_RET(stmtUpdateExecInfo(stmt, pVgHash, pBlockHash, autoCreateTbl));
|
||||||
|
|
||||||
pStmt->sql.autoCreateTbl = autoCreateTbl;
|
pStmt->sql.autoCreateTbl = autoCreateTbl;
|
||||||
|
@ -773,6 +776,8 @@ int stmtAddBatch(TAOS_STMT* stmt) {
|
||||||
int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
|
int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
|
||||||
tscDebug("stmt start to update tbUid, blockNum: %d", pRsp->nBlocks);
|
tscDebug("stmt start to update tbUid, blockNum: %d", pRsp->nBlocks);
|
||||||
|
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t finalCode = 0;
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
STableDataBlocks** pIter = taosHashIterate(pStmt->exec.pBlockHash, NULL);
|
STableDataBlocks** pIter = taosHashIterate(pStmt->exec.pBlockHash, NULL);
|
||||||
while (pIter) {
|
while (pIter) {
|
||||||
|
@ -809,10 +814,20 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
|
||||||
} else {
|
} else {
|
||||||
tscDebug("table %s not found in submit rsp, will update from catalog", pStmt->bInfo.tbFName);
|
tscDebug("table %s not found in submit rsp, will update from catalog", pStmt->bInfo.tbFName);
|
||||||
if (NULL == pStmt->pCatalog) {
|
if (NULL == pStmt->pCatalog) {
|
||||||
STMT_ERR_RET(catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &pStmt->pCatalog));
|
code = catalogGetHandle(pStmt->taos->pAppInfo->clusterId, &pStmt->pCatalog);
|
||||||
|
if (code) {
|
||||||
|
pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
|
||||||
|
finalCode = code;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
STMT_ERR_RET(stmtCreateRequest(pStmt));
|
code = stmtCreateRequest(pStmt);
|
||||||
|
if (code) {
|
||||||
|
pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
|
||||||
|
finalCode = code;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
STableMeta* pTableMeta = NULL;
|
STableMeta* pTableMeta = NULL;
|
||||||
SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter,
|
SRequestConnInfo conn = {.pTrans = pStmt->taos->pAppInfo->pTransporter,
|
||||||
|
@ -824,19 +839,22 @@ int stmtUpdateTableUid(STscStmt* pStmt, SSubmitRsp* pRsp) {
|
||||||
taos_free_result(pStmt->exec.pRequest);
|
taos_free_result(pStmt->exec.pRequest);
|
||||||
pStmt->exec.pRequest = NULL;
|
pStmt->exec.pRequest = NULL;
|
||||||
|
|
||||||
if (TSDB_CODE_PAR_TABLE_NOT_EXIST == code) {
|
if (code || NULL == pTableMeta) {
|
||||||
tscDebug("tb %s not exist", pStmt->bInfo.tbFName);
|
pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
|
||||||
return TSDB_CODE_SUCCESS;
|
finalCode = code;
|
||||||
|
taosMemoryFree(pTableMeta);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pMeta->uid = pTableMeta->uid;
|
pMeta->uid = pTableMeta->uid;
|
||||||
pStmt->bInfo.tbUid = pTableMeta->uid;
|
pStmt->bInfo.tbUid = pTableMeta->uid;
|
||||||
|
taosMemoryFree(pTableMeta);
|
||||||
}
|
}
|
||||||
|
|
||||||
pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
|
pIter = taosHashIterate(pStmt->exec.pBlockHash, pIter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return finalCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int stmtExec(TAOS_STMT* stmt) {
|
int stmtExec(TAOS_STMT* stmt) {
|
||||||
|
|
|
@ -621,7 +621,7 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
|
||||||
// todo remove this
|
// todo remove this
|
||||||
int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) {
|
int32_t blockDataFromBuf1(SSDataBlock* pBlock, const char* buf, size_t capacity) {
|
||||||
pBlock->info.rows = *(int32_t*)buf;
|
pBlock->info.rows = *(int32_t*)buf;
|
||||||
pBlock->info.groupId = *(uint64_t*)(buf + sizeof(int32_t));
|
pBlock->info.id.groupId = *(uint64_t*)(buf + sizeof(int32_t));
|
||||||
|
|
||||||
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
size_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
|
|
||||||
|
@ -1140,7 +1140,8 @@ void blockDataCleanup(SSDataBlock* pDataBlock) {
|
||||||
SDataBlockInfo* pInfo = &pDataBlock->info;
|
SDataBlockInfo* pInfo = &pDataBlock->info;
|
||||||
|
|
||||||
pInfo->rows = 0;
|
pInfo->rows = 0;
|
||||||
pInfo->groupId = 0;
|
pInfo->id.uid = 0;
|
||||||
|
pInfo->id.groupId = 0;
|
||||||
pInfo->window.ekey = 0;
|
pInfo->window.ekey = 0;
|
||||||
pInfo->window.skey = 0;
|
pInfo->window.skey = 0;
|
||||||
|
|
||||||
|
@ -1334,7 +1335,7 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
|
||||||
SSDataBlock* createSpecialDataBlock(EStreamType type) {
|
SSDataBlock* createSpecialDataBlock(EStreamType type) {
|
||||||
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
SSDataBlock* pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock));
|
||||||
pBlock->info.hasVarCol = false;
|
pBlock->info.hasVarCol = false;
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.id.groupId = 0;
|
||||||
pBlock->info.rows = 0;
|
pBlock->info.rows = 0;
|
||||||
pBlock->info.type = type;
|
pBlock->info.type = type;
|
||||||
pBlock->info.rowSize = sizeof(TSKEY) + sizeof(TSKEY) + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(TSKEY) +
|
pBlock->info.rowSize = sizeof(TSKEY) + sizeof(TSKEY) + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(TSKEY) +
|
||||||
|
@ -1675,7 +1676,7 @@ int32_t blockDataKeepFirstNRows(SSDataBlock* pBlock, size_t n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock) {
|
int32_t tEncodeDataBlock(void** buf, const SSDataBlock* pBlock) {
|
||||||
int64_t tbUid = pBlock->info.uid;
|
int64_t tbUid = pBlock->info.id.uid;
|
||||||
int16_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
int16_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
int16_t hasVarCol = pBlock->info.hasVarCol;
|
int16_t hasVarCol = pBlock->info.hasVarCol;
|
||||||
int32_t rows = pBlock->info.rows;
|
int32_t rows = pBlock->info.rows;
|
||||||
|
@ -1713,7 +1714,7 @@ void* tDecodeDataBlock(const void* buf, SSDataBlock* pBlock) {
|
||||||
|
|
||||||
int16_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
int16_t numOfCols = taosArrayGetSize(pBlock->pDataBlock);
|
||||||
|
|
||||||
buf = taosDecodeFixedU64(buf, &pBlock->info.uid);
|
buf = taosDecodeFixedU64(buf, &pBlock->info.id.uid);
|
||||||
buf = taosDecodeFixedI16(buf, &numOfCols);
|
buf = taosDecodeFixedI16(buf, &numOfCols);
|
||||||
buf = taosDecodeFixedI16(buf, &pBlock->info.hasVarCol);
|
buf = taosDecodeFixedI16(buf, &pBlock->info.hasVarCol);
|
||||||
buf = taosDecodeFixedI32(buf, &pBlock->info.rows);
|
buf = taosDecodeFixedI32(buf, &pBlock->info.rows);
|
||||||
|
@ -1834,7 +1835,7 @@ void blockDebugShowDataBlocks(const SArray* dataBlocks, const char* flag) {
|
||||||
int32_t rows = pDataBlock->info.rows;
|
int32_t rows = pDataBlock->info.rows;
|
||||||
printf("%s |block ver %" PRIi64 " |block type %d |child id %d|group id %" PRIu64 "\n", flag,
|
printf("%s |block ver %" PRIi64 " |block type %d |child id %d|group id %" PRIu64 "\n", flag,
|
||||||
pDataBlock->info.version, (int32_t)pDataBlock->info.type, pDataBlock->info.childId,
|
pDataBlock->info.version, (int32_t)pDataBlock->info.type, pDataBlock->info.childId,
|
||||||
pDataBlock->info.groupId);
|
pDataBlock->info.id.groupId);
|
||||||
for (int32_t j = 0; j < rows; j++) {
|
for (int32_t j = 0; j < rows; j++) {
|
||||||
printf("%s |", flag);
|
printf("%s |", flag);
|
||||||
for (int32_t k = 0; k < numOfCols; k++) {
|
for (int32_t k = 0; k < numOfCols; k++) {
|
||||||
|
@ -1905,8 +1906,8 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
|
||||||
len += snprintf(dumpBuf + len, size - len,
|
len += snprintf(dumpBuf + len, size - len,
|
||||||
"===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%" PRId64
|
"===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%" PRId64
|
||||||
"|rows:%d|version:%" PRIu64 "\n",
|
"|rows:%d|version:%" PRIu64 "\n",
|
||||||
flag, (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId,
|
flag, (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.id.groupId,
|
||||||
pDataBlock->info.uid, pDataBlock->info.rows, pDataBlock->info.version);
|
pDataBlock->info.id.uid, pDataBlock->info.rows, pDataBlock->info.version);
|
||||||
if (len >= size - 1) return dumpBuf;
|
if (len >= size - 1) return dumpBuf;
|
||||||
|
|
||||||
for (int32_t j = 0; j < rows; j++) {
|
for (int32_t j = 0; j < rows; j++) {
|
||||||
|
@ -2035,8 +2036,6 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
|
||||||
for (int32_t i = 0; i < sz; ++i) {
|
for (int32_t i = 0; i < sz; ++i) {
|
||||||
int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock);
|
int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock);
|
||||||
int32_t rows = pDataBlock->info.rows;
|
int32_t rows = pDataBlock->info.rows;
|
||||||
// int32_t rowSize = pDataBlock->info.rowSize;
|
|
||||||
// int64_t groupId = pDataBlock->info.groupId;
|
|
||||||
|
|
||||||
if (colNum <= 1) {
|
if (colNum <= 1) {
|
||||||
// invalid if only with TS col
|
// invalid if only with TS col
|
||||||
|
@ -2049,7 +2048,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SSDataBlock* pDataB
|
||||||
|
|
||||||
SSubmitBlk* pSubmitBlk = POINTER_SHIFT(pDataBuf, msgLen);
|
SSubmitBlk* pSubmitBlk = POINTER_SHIFT(pDataBuf, msgLen);
|
||||||
pSubmitBlk->suid = suid;
|
pSubmitBlk->suid = suid;
|
||||||
pSubmitBlk->uid = pDataBlock->info.groupId;
|
pSubmitBlk->uid = pDataBlock->info.id.groupId;
|
||||||
pSubmitBlk->numOfRows = rows;
|
pSubmitBlk->numOfRows = rows;
|
||||||
pSubmitBlk->sversion = pTSchema->version;
|
pSubmitBlk->sversion = pTSchema->version;
|
||||||
|
|
||||||
|
@ -2292,7 +2291,7 @@ int32_t blockEncode(const SSDataBlock* pBlock, char* data, int32_t numOfCols) {
|
||||||
}
|
}
|
||||||
|
|
||||||
*actualLen = dataLen;
|
*actualLen = dataLen;
|
||||||
*groupId = pBlock->info.groupId;
|
*groupId = pBlock->info.id.groupId;
|
||||||
ASSERT(dataLen > 0);
|
ASSERT(dataLen > 0);
|
||||||
|
|
||||||
uDebug("build data block, actualLen:%d, rows:%d, cols:%d", dataLen, *rows, *cols);
|
uDebug("build data block, actualLen:%d, rows:%d, cols:%d", dataLen, *rows, *cols);
|
||||||
|
@ -2325,7 +2324,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
|
||||||
pStart += sizeof(int32_t);
|
pStart += sizeof(int32_t);
|
||||||
|
|
||||||
// group id sizeof(uint64_t)
|
// group id sizeof(uint64_t)
|
||||||
pBlock->info.groupId = *(uint64_t*)pStart;
|
pBlock->info.id.groupId = *(uint64_t*)pStart;
|
||||||
pStart += sizeof(uint64_t);
|
pStart += sizeof(uint64_t);
|
||||||
|
|
||||||
if (pBlock->pDataBlock == NULL) {
|
if (pBlock->pDataBlock == NULL) {
|
||||||
|
@ -2335,7 +2334,7 @@ const char* blockDecode(SSDataBlock* pBlock, const char* pData) {
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
SColumnInfoData* pColInfoData = taosArrayGet(pBlock->pDataBlock, i);
|
||||||
pColInfoData->info.type = *(int16_t*)pStart;
|
pColInfoData->info.type = *(int8_t*)pStart;
|
||||||
pStart += sizeof(int8_t);
|
pStart += sizeof(int8_t);
|
||||||
|
|
||||||
pColInfoData->info.bytes = *(int32_t*)pStart;
|
pColInfoData->info.bytes = *(int32_t*)pStart;
|
||||||
|
|
|
@ -308,6 +308,9 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
|
||||||
|
|
||||||
tsNumOfTaskQueueThreads = tsNumOfCores / 2;
|
tsNumOfTaskQueueThreads = tsNumOfCores / 2;
|
||||||
tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 4);
|
tsNumOfTaskQueueThreads = TMAX(tsNumOfTaskQueueThreads, 4);
|
||||||
|
if (tsNumOfTaskQueueThreads >= 10) {
|
||||||
|
tsNumOfTaskQueueThreads = 10;
|
||||||
|
}
|
||||||
if (cfgAddInt32(pCfg, "numOfTaskQueueThreads", tsNumOfTaskQueueThreads, 4, 1024, 0) != 0) return -1;
|
if (cfgAddInt32(pCfg, "numOfTaskQueueThreads", tsNumOfTaskQueueThreads, 4, 1024, 0) != 0) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -250,7 +250,7 @@ int32_t dmInitClient(SDnode *pDnode) {
|
||||||
|
|
||||||
SRpcInit rpcInit = {0};
|
SRpcInit rpcInit = {0};
|
||||||
rpcInit.label = "DND-C";
|
rpcInit.label = "DND-C";
|
||||||
rpcInit.numOfThreads = 4;
|
rpcInit.numOfThreads = tsNumOfRpcThreads;
|
||||||
rpcInit.cfp = (RpcCfp)dmProcessRpcMsg;
|
rpcInit.cfp = (RpcCfp)dmProcessRpcMsg;
|
||||||
rpcInit.sessions = 1024;
|
rpcInit.sessions = 1024;
|
||||||
rpcInit.connType = TAOS_CONN_CLIENT;
|
rpcInit.connType = TAOS_CONN_CLIENT;
|
||||||
|
|
|
@ -248,7 +248,7 @@ void dmUpdateEps(SDnodeData *pData, SArray *eps) {
|
||||||
static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
|
static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
|
||||||
if (pData->dnodeEps != dnodeEps) {
|
if (pData->dnodeEps != dnodeEps) {
|
||||||
SArray *tmp = pData->dnodeEps;
|
SArray *tmp = pData->dnodeEps;
|
||||||
pData->dnodeEps = taosArrayDup(dnodeEps);
|
pData->dnodeEps = taosArrayDup(dnodeEps, NULL);
|
||||||
taosArrayDestroy(tmp);
|
taosArrayDestroy(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -219,12 +219,12 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
|
||||||
SDB_GET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER)
|
SDB_GET_RESERVE(pRaw, dataPos, DB_RESERVE_SIZE, _OVER)
|
||||||
taosInitRWLatch(&pDb->lock);
|
taosInitRWLatch(&pDb->lock);
|
||||||
|
|
||||||
if (pDb->cfg.tsdbPageSize <= TSDB_MIN_TSDB_PAGESIZE) {
|
if (pDb->cfg.tsdbPageSize != TSDB_MIN_TSDB_PAGESIZE) {
|
||||||
mInfo("db:%s, tsdbPageSize set from %d to default %d", pDb->name, pDb->cfg.tsdbPageSize,
|
mInfo("db:%s, tsdbPageSize set from %d to default %d", pDb->name, pDb->cfg.tsdbPageSize,
|
||||||
TSDB_DEFAULT_TSDB_PAGESIZE);
|
TSDB_DEFAULT_TSDB_PAGESIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pDb->cfg.sstTrigger <= TSDB_MIN_STT_TRIGGER) {
|
if (pDb->cfg.sstTrigger != TSDB_MIN_STT_TRIGGER) {
|
||||||
mInfo("db:%s, sstTrigger set from %d to default %d", pDb->name, pDb->cfg.sstTrigger, TSDB_DEFAULT_SST_TRIGGER);
|
mInfo("db:%s, sstTrigger set from %d to default %d", pDb->name, pDb->cfg.sstTrigger, TSDB_DEFAULT_SST_TRIGGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -810,7 +810,7 @@ static int32_t mndProcessAlterDbReq(SRpcMsg *pReq) {
|
||||||
|
|
||||||
memcpy(&dbObj, pDb, sizeof(SDbObj));
|
memcpy(&dbObj, pDb, sizeof(SDbObj));
|
||||||
if (dbObj.cfg.pRetensions != NULL) {
|
if (dbObj.cfg.pRetensions != NULL) {
|
||||||
dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions);
|
dbObj.cfg.pRetensions = taosArrayDup(pDb->cfg.pRetensions, NULL);
|
||||||
if (dbObj.cfg.pRetensions == NULL) goto _OVER;
|
if (dbObj.cfg.pRetensions == NULL) goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -361,7 +361,7 @@ SMqConsumerEp *tCloneSMqConsumerEp(const SMqConsumerEp *pConsumerEpOld) {
|
||||||
SMqConsumerEp *pConsumerEpNew = taosMemoryMalloc(sizeof(SMqConsumerEp));
|
SMqConsumerEp *pConsumerEpNew = taosMemoryMalloc(sizeof(SMqConsumerEp));
|
||||||
if (pConsumerEpNew == NULL) return NULL;
|
if (pConsumerEpNew == NULL) return NULL;
|
||||||
pConsumerEpNew->consumerId = pConsumerEpOld->consumerId;
|
pConsumerEpNew->consumerId = pConsumerEpOld->consumerId;
|
||||||
pConsumerEpNew->vgs = taosArrayDeepCopy(pConsumerEpOld->vgs, (FCopy)tCloneSMqVgEp);
|
pConsumerEpNew->vgs = taosArrayDup(pConsumerEpOld->vgs, (__array_item_dup_fn_t)tCloneSMqVgEp);
|
||||||
return pConsumerEpNew;
|
return pConsumerEpNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,11 +440,11 @@ SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) {
|
||||||
pConsumerEp = (SMqConsumerEp *)pIter;
|
pConsumerEp = (SMqConsumerEp *)pIter;
|
||||||
SMqConsumerEp newEp = {
|
SMqConsumerEp newEp = {
|
||||||
.consumerId = pConsumerEp->consumerId,
|
.consumerId = pConsumerEp->consumerId,
|
||||||
.vgs = taosArrayDeepCopy(pConsumerEp->vgs, (FCopy)tCloneSMqVgEp),
|
.vgs = taosArrayDup(pConsumerEp->vgs, (__array_item_dup_fn_t)tCloneSMqVgEp),
|
||||||
};
|
};
|
||||||
taosHashPut(pSubNew->consumerHash, &newEp.consumerId, sizeof(int64_t), &newEp, sizeof(SMqConsumerEp));
|
taosHashPut(pSubNew->consumerHash, &newEp.consumerId, sizeof(int64_t), &newEp, sizeof(SMqConsumerEp));
|
||||||
}
|
}
|
||||||
pSubNew->unassignedVgs = taosArrayDeepCopy(pSub->unassignedVgs, (FCopy)tCloneSMqVgEp);
|
pSubNew->unassignedVgs = taosArrayDup(pSub->unassignedVgs, (__array_item_dup_fn_t)tCloneSMqVgEp);
|
||||||
memcpy(pSubNew->dbName, pSub->dbName, TSDB_DB_FNAME_LEN);
|
memcpy(pSubNew->dbName, pSub->dbName, TSDB_DB_FNAME_LEN);
|
||||||
return pSubNew;
|
return pSubNew;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,7 @@ SMqSubActionLogEntry *tCloneSMqSubActionLogEntry(SMqSubActionLogEntry *pEntry) {
|
||||||
SMqSubActionLogEntry *pEntryNew = taosMemoryMalloc(sizeof(SMqSubActionLogEntry));
|
SMqSubActionLogEntry *pEntryNew = taosMemoryMalloc(sizeof(SMqSubActionLogEntry));
|
||||||
if (pEntryNew == NULL) return NULL;
|
if (pEntryNew == NULL) return NULL;
|
||||||
pEntryNew->epoch = pEntry->epoch;
|
pEntryNew->epoch = pEntry->epoch;
|
||||||
pEntryNew->consumers = taosArrayDeepCopy(pEntry->consumers, (FCopy)tCloneSMqConsumerEp);
|
pEntryNew->consumers = taosArrayDup(pEntry->consumers, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
|
||||||
return pEntryNew;
|
return pEntryNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ SMqSubActionLogObj *tCloneSMqSubActionLogObj(SMqSubActionLogObj *pLog) {
|
||||||
SMqSubActionLogObj *pLogNew = taosMemoryMalloc(sizeof(SMqSubActionLogObj));
|
SMqSubActionLogObj *pLogNew = taosMemoryMalloc(sizeof(SMqSubActionLogObj));
|
||||||
if (pLogNew == NULL) return pLogNew;
|
if (pLogNew == NULL) return pLogNew;
|
||||||
memcpy(pLogNew->key, pLog->key, TSDB_SUBSCRIBE_KEY_LEN);
|
memcpy(pLogNew->key, pLog->key, TSDB_SUBSCRIBE_KEY_LEN);
|
||||||
pLogNew->logs = taosArrayDeepCopy(pLog->logs, (FCopy)tCloneSMqConsumerEp);
|
pLogNew->logs = taosArrayDup(pLog->logs, (__array_item_dup_fn_t)tCloneSMqConsumerEp);
|
||||||
return pLogNew;
|
return pLogNew;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -803,12 +803,12 @@ void mndSetRestored(SMnode *pMnode, bool restored) {
|
||||||
taosThreadRwlockWrlock(&pMnode->lock);
|
taosThreadRwlockWrlock(&pMnode->lock);
|
||||||
pMnode->restored = true;
|
pMnode->restored = true;
|
||||||
taosThreadRwlockUnlock(&pMnode->lock);
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
mTrace("mnode set restored:%d", restored);
|
mInfo("mnode set restored:%d", restored);
|
||||||
} else {
|
} else {
|
||||||
taosThreadRwlockWrlock(&pMnode->lock);
|
taosThreadRwlockWrlock(&pMnode->lock);
|
||||||
pMnode->restored = false;
|
pMnode->restored = false;
|
||||||
taosThreadRwlockUnlock(&pMnode->lock);
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
mTrace("mnode set restored:%d", restored);
|
mInfo("mnode set restored:%d", restored);
|
||||||
while (1) {
|
while (1) {
|
||||||
if (pMnode->rpcRef <= 0) break;
|
if (pMnode->rpcRef <= 0) break;
|
||||||
taosMsleep(3);
|
taosMsleep(3);
|
||||||
|
@ -822,7 +822,7 @@ void mndSetStop(SMnode *pMnode) {
|
||||||
taosThreadRwlockWrlock(&pMnode->lock);
|
taosThreadRwlockWrlock(&pMnode->lock);
|
||||||
pMnode->stopped = true;
|
pMnode->stopped = true;
|
||||||
taosThreadRwlockUnlock(&pMnode->lock);
|
taosThreadRwlockUnlock(&pMnode->lock);
|
||||||
mTrace("mnode set stopped");
|
mInfo("mnode set stopped");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mndGetStop(SMnode *pMnode) { return pMnode->stopped; }
|
bool mndGetStop(SMnode *pMnode) { return pMnode->stopped; }
|
||||||
|
|
|
@ -1684,7 +1684,7 @@ static int32_t mndBuildStbCfgImp(SDbObj *pDb, SStbObj *pStb, const char *tbName,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pStb->numOfFuncs > 0) {
|
if (pStb->numOfFuncs > 0) {
|
||||||
pRsp->pFuncs = taosArrayDup(pStb->pFuncs);
|
pRsp->pFuncs = taosArrayDup(pStb->pFuncs, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosRUnLockLatch(&pStb->lock);
|
taosRUnLockLatch(&pStb->lock);
|
||||||
|
|
|
@ -665,18 +665,23 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
|
||||||
if (i < pVgroup->replica) {
|
if (i < pVgroup->replica) {
|
||||||
colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vnodeGid[i].dnodeId, false);
|
colDataAppend(pColInfo, numOfRows, (const char *)&pVgroup->vnodeGid[i].dnodeId, false);
|
||||||
|
|
||||||
|
bool exist = false;
|
||||||
bool online = false;
|
bool online = false;
|
||||||
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pVgroup->vnodeGid[i].dnodeId);
|
SDnodeObj *pDnode = mndAcquireDnode(pMnode, pVgroup->vnodeGid[i].dnodeId);
|
||||||
if (pDnode != NULL) {
|
if (pDnode != NULL) {
|
||||||
|
exist = true;
|
||||||
online = mndIsDnodeOnline(pDnode, curMs);
|
online = mndIsDnodeOnline(pDnode, curMs);
|
||||||
mndReleaseDnode(pMnode, pDnode);
|
mndReleaseDnode(pMnode, pDnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
char buf1[20] = {0};
|
char buf1[20] = {0};
|
||||||
char role[20] = "offline";
|
char role[20] = "offline";
|
||||||
if (online) {
|
if (!exist) {
|
||||||
|
strcpy(role, "dropping");
|
||||||
|
} else if (online) {
|
||||||
bool show = (pVgroup->vnodeGid[i].syncState == TAOS_SYNC_STATE_LEADER && !pVgroup->vnodeGid[i].syncRestore);
|
bool show = (pVgroup->vnodeGid[i].syncState == TAOS_SYNC_STATE_LEADER && !pVgroup->vnodeGid[i].syncRestore);
|
||||||
snprintf(role, sizeof(role), "%s%s", syncStr(pVgroup->vnodeGid[i].syncState), show ? "*" : "");
|
snprintf(role, sizeof(role), "%s%s", syncStr(pVgroup->vnodeGid[i].syncState), show ? "*" : "");
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->pMeta->pSchemas[cols].bytes);
|
STR_WITH_MAXSIZE_TO_VARSTR(buf1, role, pShow->pMeta->pSchemas[cols].bytes);
|
||||||
|
|
||||||
|
@ -1084,10 +1089,10 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
||||||
if (!force) {
|
if (!force) {
|
||||||
mInfo("vgId:%d, will add 1 vnode", pVgroup->vgId);
|
mInfo("vgId:%d, will add 1 vnode", pVgroup->vgId);
|
||||||
if (mndAddVnodeToVgroup(pMnode, &newVg, pArray) != 0) return -1;
|
if (mndAddVnodeToVgroup(pMnode, &newVg, pArray) != 0) return -1;
|
||||||
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[newVg.replica - 1]) != 0) return -1;
|
|
||||||
for (int32_t i = 0; i < newVg.replica - 1; ++i) {
|
for (int32_t i = 0; i < newVg.replica - 1; ++i) {
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
|
||||||
}
|
}
|
||||||
|
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[newVg.replica - 1]) != 0) return -1;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
|
||||||
|
|
||||||
mInfo("vgId:%d, will remove 1 vnode", pVgroup->vgId);
|
mInfo("vgId:%d, will remove 1 vnode", pVgroup->vgId);
|
||||||
|
@ -1108,12 +1113,12 @@ int32_t mndSetMoveVgroupInfoToTrans(SMnode *pMnode, STrans *pTrans, SDbObj *pDb,
|
||||||
newVg.vnodeGid[vnIndex] = newVg.vnodeGid[newVg.replica];
|
newVg.vnodeGid[vnIndex] = newVg.vnodeGid[newVg.replica];
|
||||||
memset(&newVg.vnodeGid[newVg.replica], 0, sizeof(SVnodeGid));
|
memset(&newVg.vnodeGid[newVg.replica], 0, sizeof(SVnodeGid));
|
||||||
|
|
||||||
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[vnIndex]) != 0) return -1;
|
|
||||||
for (int32_t i = 0; i < newVg.replica; ++i) {
|
for (int32_t i = 0; i < newVg.replica; ++i) {
|
||||||
if (i != vnIndex) {
|
if (i != vnIndex) {
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg, newVg.vnodeGid[i].dnodeId) != 0) return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg, &newVg.vnodeGid[vnIndex]) != 0) return -1;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg) != 0) return -1;
|
||||||
|
|
||||||
if (newVg.replica == 1) {
|
if (newVg.replica == 1) {
|
||||||
|
@ -1190,10 +1195,10 @@ static int32_t mndAddIncVgroupReplicaToTrans(SMnode *pMnode, STrans *pTrans, SDb
|
||||||
pGid->dnodeId = newDnodeId;
|
pGid->dnodeId = newDnodeId;
|
||||||
pGid->syncState = TAOS_SYNC_STATE_ERROR;
|
pGid->syncState = TAOS_SYNC_STATE_ERROR;
|
||||||
|
|
||||||
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, pVgroup, pGid) != 0) return -1;
|
|
||||||
for (int32_t i = 0; i < pVgroup->replica - 1; ++i) {
|
for (int32_t i = 0; i < pVgroup->replica - 1; ++i) {
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, pVgroup, pVgroup->vnodeGid[i].dnodeId) != 0) return -1;
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, pVgroup, pVgroup->vnodeGid[i].dnodeId) != 0) return -1;
|
||||||
}
|
}
|
||||||
|
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, pVgroup, pGid) != 0) return -1;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, pVgroup) != 0) return -1;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, pVgroup) != 0) return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1589,11 +1594,16 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb
|
||||||
pVgroup->vnodeGid[0].dnodeId);
|
pVgroup->vnodeGid[0].dnodeId);
|
||||||
|
|
||||||
if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1;
|
if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1;
|
||||||
if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1;
|
|
||||||
if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[1]) != 0) return -1;
|
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0)
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[1]) != 0) return -1;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
|
||||||
|
|
||||||
|
if (mndAddVnodeToVgroup(pMnode, &newVgroup, pArray) != 0) return -1;
|
||||||
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0)
|
||||||
|
return -1;
|
||||||
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[1].dnodeId) != 0)
|
||||||
|
return -1;
|
||||||
if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[2]) != 0) return -1;
|
if (mndAddCreateVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &newVgroup.vnodeGid[2]) != 0) return -1;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
|
||||||
} else if (newVgroup.replica == 3 && pNewDb->cfg.replications == 1) {
|
} else if (newVgroup.replica == 3 && pNewDb->cfg.replications == 1) {
|
||||||
|
@ -1603,9 +1613,14 @@ int32_t mndBuildAlterVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *pOldDb
|
||||||
SVnodeGid del1 = {0};
|
SVnodeGid del1 = {0};
|
||||||
SVnodeGid del2 = {0};
|
SVnodeGid del2 = {0};
|
||||||
if (mndRemoveVnodeFromVgroup(pMnode, &newVgroup, pArray, &del1) != 0) return -1;
|
if (mndRemoveVnodeFromVgroup(pMnode, &newVgroup, pArray, &del1) != 0) return -1;
|
||||||
if (mndRemoveVnodeFromVgroup(pMnode, &newVgroup, pArray, &del2) != 0) return -1;
|
|
||||||
if (mndAddDropVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &del1, true) != 0) return -1;
|
if (mndAddDropVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &del1, true) != 0) return -1;
|
||||||
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0)
|
||||||
|
return -1;
|
||||||
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[1].dnodeId) != 0)
|
||||||
|
return -1;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pNewDb, &newVgroup) != 0) return -1;
|
||||||
|
|
||||||
|
if (mndRemoveVnodeFromVgroup(pMnode, &newVgroup, pArray, &del2) != 0) return -1;
|
||||||
if (mndAddDropVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &del2, true) != 0) return -1;
|
if (mndAddDropVnodeAction(pMnode, pTrans, pNewDb, &newVgroup, &del2, true) != 0) return -1;
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0)
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pNewDb, &newVgroup, newVgroup.vnodeGid[0].dnodeId) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1662,15 +1677,15 @@ static int32_t mndSplitVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SVgObj
|
||||||
|
|
||||||
if (newVg1.replica == 1) {
|
if (newVg1.replica == 1) {
|
||||||
if (mndAddVnodeToVgroup(pMnode, &newVg1, pArray) != 0) goto _OVER;
|
if (mndAddVnodeToVgroup(pMnode, &newVg1, pArray) != 0) goto _OVER;
|
||||||
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg1, &newVg1.vnodeGid[1]) != 0) goto _OVER;
|
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER;
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER;
|
||||||
|
if (mndAddCreateVnodeAction(pMnode, pTrans, pDb, &newVg1, &newVg1.vnodeGid[1]) != 0) goto _OVER;
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
|
||||||
} else if (newVg1.replica == 3) {
|
} else if (newVg1.replica == 3) {
|
||||||
SVnodeGid del1 = {0};
|
SVnodeGid del1 = {0};
|
||||||
if (mndRemoveVnodeFromVgroup(pMnode, &newVg1, pArray, &del1) != 0) goto _OVER;
|
if (mndRemoveVnodeFromVgroup(pMnode, &newVg1, pArray, &del1) != 0) goto _OVER;
|
||||||
|
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg1, &del1, true) != 0) goto _OVER;
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER;
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[0].dnodeId) != 0) goto _OVER;
|
||||||
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[1].dnodeId) != 0) goto _OVER;
|
if (mndAddAlterVnodeReplicaAction(pMnode, pTrans, pDb, &newVg1, newVg1.vnodeGid[1].dnodeId) != 0) goto _OVER;
|
||||||
if (mndAddDropVnodeAction(pMnode, pTrans, pDb, &newVg1, &del1, true) != 0) goto _OVER;
|
|
||||||
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
|
if (mndAddAlterVnodeConfirmAction(pMnode, pTrans, pDb, &newVg1) != 0) goto _OVER;
|
||||||
} else {
|
} else {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
|
|
|
@ -708,7 +708,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
|
||||||
#endif
|
#endif
|
||||||
for (int32_t i = 0; i < taosArrayGetSize(pResList); ++i) {
|
for (int32_t i = 0; i < taosArrayGetSize(pResList); ++i) {
|
||||||
SSDataBlock *output = taosArrayGetP(pResList, i);
|
SSDataBlock *output = taosArrayGetP(pResList, i);
|
||||||
smaDebug("result block, uid:%" PRIu64 ", groupid:%" PRIu64 ", rows:%d", output->info.uid, output->info.groupId,
|
smaDebug("result block, uid:%" PRIu64 ", groupid:%" PRIu64 ", rows:%d", output->info.id.uid, output->info.id.groupId,
|
||||||
output->info.rows);
|
output->info.rows);
|
||||||
|
|
||||||
STsdb *sinkTsdb = (pItem->level == TSDB_RETENTION_L1 ? pSma->pRSmaTsdb[0] : pSma->pRSmaTsdb[1]);
|
STsdb *sinkTsdb = (pItem->level == TSDB_RETENTION_L1 ? pSma->pRSmaTsdb[0] : pSma->pRSmaTsdb[1]);
|
||||||
|
@ -718,7 +718,7 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
|
||||||
if (buildSubmitReqFromDataBlock(&pReq, output, pTSchema, SMA_VID(pSma), suid) < 0) {
|
if (buildSubmitReqFromDataBlock(&pReq, output, pTSchema, SMA_VID(pSma), suid) < 0) {
|
||||||
smaError("vgId:%d, build submit req for rsma table suid:%" PRIu64 ", uid:%" PRIu64 ", level %" PRIi8
|
smaError("vgId:%d, build submit req for rsma table suid:%" PRIu64 ", uid:%" PRIu64 ", level %" PRIi8
|
||||||
" failed since %s",
|
" failed since %s",
|
||||||
SMA_VID(pSma), suid, output->info.groupId, pItem->level, terrstr());
|
SMA_VID(pSma), suid, output->info.id.groupId, pItem->level, terrstr());
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,13 +726,13 @@ static int32_t tdRSmaExecAndSubmitResult(SSma *pSma, qTaskInfo_t taskInfo, SRSma
|
||||||
taosMemoryFreeClear(pReq);
|
taosMemoryFreeClear(pReq);
|
||||||
smaError("vgId:%d, process submit req for rsma suid:%" PRIu64 ", uid:%" PRIu64 " level %" PRIi8
|
smaError("vgId:%d, process submit req for rsma suid:%" PRIu64 ", uid:%" PRIu64 " level %" PRIi8
|
||||||
" failed since %s",
|
" failed since %s",
|
||||||
SMA_VID(pSma), suid, output->info.groupId, pItem->level, terrstr());
|
SMA_VID(pSma), suid, output->info.id.groupId, pItem->level, terrstr());
|
||||||
goto _err;
|
goto _err;
|
||||||
}
|
}
|
||||||
|
|
||||||
smaDebug("vgId:%d, process submit req for rsma suid:%" PRIu64 ",uid:%" PRIu64 ", level %" PRIi8 " ver %" PRIi64
|
smaDebug("vgId:%d, process submit req for rsma suid:%" PRIu64 ",uid:%" PRIu64 ", level %" PRIi8 " ver %" PRIi64
|
||||||
" len %" PRIu32,
|
" len %" PRIu32,
|
||||||
SMA_VID(pSma), suid, output->info.groupId, pItem->level, output->info.version,
|
SMA_VID(pSma), suid, output->info.id.groupId, pItem->level, output->info.version,
|
||||||
htonl(pReq->header.contLen));
|
htonl(pReq->header.contLen));
|
||||||
|
|
||||||
taosMemoryFreeClear(pReq);
|
taosMemoryFreeClear(pReq);
|
||||||
|
|
|
@ -530,7 +530,7 @@ int32_t tqRetrieveDataBlock(SSDataBlock* pBlock, STqReader* pReader) {
|
||||||
|
|
||||||
tInitSubmitBlkIter(&pReader->msgIter, pReader->pBlock, &pReader->blkIter);
|
tInitSubmitBlkIter(&pReader->msgIter, pReader->pBlock, &pReader->blkIter);
|
||||||
|
|
||||||
pBlock->info.uid = pReader->msgIter.uid;
|
pBlock->info.id.uid = pReader->msgIter.uid;
|
||||||
pBlock->info.rows = pReader->msgIter.numOfRows;
|
pBlock->info.rows = pReader->msgIter.numOfRows;
|
||||||
pBlock->info.version = pReader->pMsg->version;
|
pBlock->info.version = pReader->pMsg->version;
|
||||||
|
|
||||||
|
@ -649,7 +649,7 @@ int32_t tqRetrieveTaosxBlock(STqReader* pReader, SArray* blocks, SArray* schemas
|
||||||
}
|
}
|
||||||
|
|
||||||
SSDataBlock* pBlock = taosArrayGetLast(blocks);
|
SSDataBlock* pBlock = taosArrayGetLast(blocks);
|
||||||
pBlock->info.uid = pReader->msgIter.uid;
|
pBlock->info.id.uid = pReader->msgIter.uid;
|
||||||
pBlock->info.rows = 0;
|
pBlock->info.rows = 0;
|
||||||
pBlock->info.version = pReader->pMsg->version;
|
pBlock->info.version = pReader->pMsg->version;
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
|
||||||
// STagVal tagVal = {
|
// STagVal tagVal = {
|
||||||
// .cid = pTagSchemaWrapper->pSchema[j].colId,
|
// .cid = pTagSchemaWrapper->pSchema[j].colId,
|
||||||
// .type = pTagSchemaWrapper->pSchema[j].type,
|
// .type = pTagSchemaWrapper->pSchema[j].type,
|
||||||
// .i64 = (int64_t)pDataBlock->info.groupId,
|
// .i64 = (int64_t)pDataBlock->info.id.groupId,
|
||||||
// };
|
// };
|
||||||
// taosArrayPush(tagArray, &tagVal);
|
// taosArrayPush(tagArray, &tagVal);
|
||||||
// taosArrayPush(tagName, pTagSchemaWrapper->pSchema[j].name);
|
// taosArrayPush(tagName, pTagSchemaWrapper->pSchema[j].name);
|
||||||
|
@ -134,7 +134,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
|
||||||
STagVal tagVal = {
|
STagVal tagVal = {
|
||||||
.cid = taosArrayGetSize(pDataBlock->pDataBlock) + 1,
|
.cid = taosArrayGetSize(pDataBlock->pDataBlock) + 1,
|
||||||
.type = TSDB_DATA_TYPE_UBIGINT,
|
.type = TSDB_DATA_TYPE_UBIGINT,
|
||||||
.i64 = (int64_t)pDataBlock->info.groupId,
|
.i64 = (int64_t)pDataBlock->info.id.groupId,
|
||||||
};
|
};
|
||||||
taosArrayPush(tagArray, &tagVal);
|
taosArrayPush(tagArray, &tagVal);
|
||||||
createTbReq.ctb.tagNum = taosArrayGetSize(tagArray);
|
createTbReq.ctb.tagNum = taosArrayGetSize(tagArray);
|
||||||
|
@ -161,7 +161,7 @@ SSubmitReq* tqBlockToSubmit(SVnode* pVnode, const SArray* pBlocks, const STSchem
|
||||||
if (pDataBlock->info.parTbName[0]) {
|
if (pDataBlock->info.parTbName[0]) {
|
||||||
createTbReq.name = strdup(pDataBlock->info.parTbName);
|
createTbReq.name = strdup(pDataBlock->info.parTbName);
|
||||||
} else {
|
} else {
|
||||||
createTbReq.name = buildCtbNameByGroupId(stbFullName, pDataBlock->info.groupId);
|
createTbReq.name = buildCtbNameByGroupId(stbFullName, pDataBlock->info.id.groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save schema len
|
// save schema len
|
||||||
|
@ -358,7 +358,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
|
||||||
if (pDataBlock->info.parTbName[0]) {
|
if (pDataBlock->info.parTbName[0]) {
|
||||||
ctbName = strdup(pDataBlock->info.parTbName);
|
ctbName = strdup(pDataBlock->info.parTbName);
|
||||||
} else {
|
} else {
|
||||||
ctbName = buildCtbNameByGroupId(stbFullName, pDataBlock->info.groupId);
|
ctbName = buildCtbNameByGroupId(stbFullName, pDataBlock->info.id.groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t schemaLen = 0;
|
int32_t schemaLen = 0;
|
||||||
|
@ -390,7 +390,7 @@ void tqSinkToTablePipeline(SStreamTask* pTask, void* vnode, int64_t ver, void* d
|
||||||
STagVal tagVal = {
|
STagVal tagVal = {
|
||||||
.cid = taosArrayGetSize(pDataBlock->pDataBlock) + 1,
|
.cid = taosArrayGetSize(pDataBlock->pDataBlock) + 1,
|
||||||
.type = TSDB_DATA_TYPE_UBIGINT,
|
.type = TSDB_DATA_TYPE_UBIGINT,
|
||||||
.i64 = (int64_t)pDataBlock->info.groupId,
|
.i64 = (int64_t)pDataBlock->info.id.groupId,
|
||||||
};
|
};
|
||||||
taosArrayPush(tagArray, &tagVal);
|
taosArrayPush(tagArray, &tagVal);
|
||||||
createTbReq.ctb.tagNum = taosArrayGetSize(tagArray);
|
createTbReq.ctb.tagNum = taosArrayGetSize(tagArray);
|
||||||
|
|
|
@ -1624,7 +1624,7 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo*
|
||||||
int32_t code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->capacity, pReader);
|
int32_t code = buildDataBlockFromBufImpl(pBlockScanInfo, endKey, pReader->capacity, pReader);
|
||||||
|
|
||||||
blockDataUpdateTsWindow(pBlock, 0);
|
blockDataUpdateTsWindow(pBlock, 0);
|
||||||
pBlock->info.uid = pBlockScanInfo->uid;
|
pBlock->info.id.uid = pBlockScanInfo->uid;
|
||||||
|
|
||||||
setComposedBlockFlag(pReader, true);
|
setComposedBlockFlag(pReader, true);
|
||||||
|
|
||||||
|
@ -2494,7 +2494,7 @@ static int32_t buildComposedDataBlock(STsdbReader* pReader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_end:
|
_end:
|
||||||
pResBlock->info.uid = (pBlockScanInfo != NULL) ? pBlockScanInfo->uid : 0;
|
pResBlock->info.id.uid = (pBlockScanInfo != NULL) ? pBlockScanInfo->uid : 0;
|
||||||
blockDataUpdateTsWindow(pResBlock, 0);
|
blockDataUpdateTsWindow(pResBlock, 0);
|
||||||
|
|
||||||
setComposedBlockFlag(pReader, true);
|
setComposedBlockFlag(pReader, true);
|
||||||
|
@ -2506,7 +2506,7 @@ _end:
|
||||||
if (pResBlock->info.rows > 0) {
|
if (pResBlock->info.rows > 0) {
|
||||||
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
|
tsdbDebug("%p uid:%" PRIu64 ", composed data block created, brange:%" PRIu64 "-%" PRIu64
|
||||||
" rows:%d, elapsed time:%.2f ms %s",
|
" rows:%d, elapsed time:%.2f ms %s",
|
||||||
pReader, pResBlock->info.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
|
pReader, pResBlock->info.id.uid, pResBlock->info.window.skey, pResBlock->info.window.ekey,
|
||||||
pResBlock->info.rows, el, pReader->idStr);
|
pResBlock->info.rows, el, pReader->idStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2830,7 +2830,7 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) {
|
||||||
} else { // whole block is required, return it directly
|
} else { // whole block is required, return it directly
|
||||||
SDataBlockInfo* pInfo = &pReader->pResBlock->info;
|
SDataBlockInfo* pInfo = &pReader->pResBlock->info;
|
||||||
pInfo->rows = pBlock->nRow;
|
pInfo->rows = pBlock->nRow;
|
||||||
pInfo->uid = pScanInfo->uid;
|
pInfo->id.uid = pScanInfo->uid;
|
||||||
pInfo->window = (STimeWindow){.skey = pBlock->minKey.ts, .ekey = pBlock->maxKey.ts};
|
pInfo->window = (STimeWindow){.skey = pBlock->minKey.ts, .ekey = pBlock->maxKey.ts};
|
||||||
setComposedBlockFlag(pReader, false);
|
setComposedBlockFlag(pReader, false);
|
||||||
setBlockAllDumped(&pStatus->fBlockDumpInfo, pBlock->maxKey.ts, pReader->order);
|
setBlockAllDumped(&pStatus->fBlockDumpInfo, pBlock->maxKey.ts, pReader->order);
|
||||||
|
@ -4020,7 +4020,7 @@ bool tsdbTableNextDataBlock(STsdbReader* pReader, uint64_t uid) {
|
||||||
static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) {
|
static void setBlockInfo(const STsdbReader* pReader, int32_t* rows, uint64_t* uid, STimeWindow* pWindow) {
|
||||||
ASSERT(pReader != NULL);
|
ASSERT(pReader != NULL);
|
||||||
*rows = pReader->pResBlock->info.rows;
|
*rows = pReader->pResBlock->info.rows;
|
||||||
*uid = pReader->pResBlock->info.uid;
|
*uid = pReader->pResBlock->info.id.uid;
|
||||||
*pWindow = pReader->pResBlock->info.window;
|
*pWindow = pReader->pResBlock->info.window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
|
||||||
pDataBlock->pBlockAgg = NULL;
|
pDataBlock->pBlockAgg = NULL;
|
||||||
taosArrayGetSize(pDataBlock->pDataBlock) = tSmaNumOfCols;
|
taosArrayGetSize(pDataBlock->pDataBlock) = tSmaNumOfCols;
|
||||||
pDataBlock->info.rows = tSmaNumOfRows;
|
pDataBlock->info.rows = tSmaNumOfRows;
|
||||||
pDataBlock->info.groupId = tSmaGroupId + g;
|
pDataBlock->info.id.groupId = tSmaGroupId + g;
|
||||||
|
|
||||||
pDataBlock->pDataBlock = taosArrayInit(tSmaNumOfCols, sizeof(SColumnInfoData *));
|
pDataBlock->pDataBlock = taosArrayInit(tSmaNumOfCols, sizeof(SColumnInfoData *));
|
||||||
EXPECT_NE(pDataBlock->pDataBlock, nullptr);
|
EXPECT_NE(pDataBlock->pDataBlock, nullptr);
|
||||||
|
|
|
@ -1205,7 +1205,7 @@ int32_t ctgHandleGetTbMetasRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBu
|
||||||
stbCtx.pName = &stbName;
|
stbCtx.pName = &stbName;
|
||||||
|
|
||||||
STableMeta* stbMeta = NULL;
|
STableMeta* stbMeta = NULL;
|
||||||
ctgReadTbMetaFromCache(pCtg, &stbCtx, &stbMeta);
|
(void)ctgReadTbMetaFromCache(pCtg, &stbCtx, &stbMeta);
|
||||||
if (stbMeta && stbMeta->sversion >= pOut->tbMeta->sversion) {
|
if (stbMeta && stbMeta->sversion >= pOut->tbMeta->sversion) {
|
||||||
ctgDebug("use cached stb meta, tbName:%s", tNameGetTableName(pName));
|
ctgDebug("use cached stb meta, tbName:%s", tNameGetTableName(pName));
|
||||||
exist = 1;
|
exist = 1;
|
||||||
|
|
|
@ -1188,7 +1188,7 @@ SName* ctgGetFetchName(SArray* pNames, SCtgFetch* pFetch) {
|
||||||
return (SName*)taosArrayGet(pReq->pTables, pFetch->tbIdx);
|
return (SName*)taosArrayGet(pReq->pTables, pFetch->tbIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* ctgCloneDbVgroup(void* pSrc) { return taosArrayDup((const SArray*)pSrc); }
|
static void* ctgCloneDbVgroup(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); }
|
||||||
|
|
||||||
static void ctgFreeDbVgroup(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
static void ctgFreeDbVgroup(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
||||||
|
|
||||||
|
@ -1238,7 +1238,7 @@ static void* ctgCloneVgroupInfo(void* pSrc) {
|
||||||
|
|
||||||
static void ctgFreeVgroupInfo(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); }
|
static void ctgFreeVgroupInfo(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); }
|
||||||
|
|
||||||
static void* ctgCloneTableIndices(void* pSrc) { return taosArrayDup((const SArray*)pSrc); }
|
static void* ctgCloneTableIndices(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); }
|
||||||
|
|
||||||
static void ctgFreeTableIndices(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
static void ctgFreeTableIndices(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
||||||
|
|
||||||
|
@ -1275,7 +1275,7 @@ static void* ctgCloneUserAuth(void* pSrc) {
|
||||||
|
|
||||||
static void ctgFreeUserAuth(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); }
|
static void ctgFreeUserAuth(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); }
|
||||||
|
|
||||||
static void* ctgCloneQnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc); }
|
static void* ctgCloneQnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); }
|
||||||
|
|
||||||
static void ctgFreeQnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
static void ctgFreeQnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
||||||
|
|
||||||
|
@ -1290,11 +1290,11 @@ static void* ctgCloneTableCfg(void* pSrc) {
|
||||||
|
|
||||||
static void ctgFreeTableCfg(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); }
|
static void ctgFreeTableCfg(void* p) { taosMemoryFree(((SMetaRes*)p)->pRes); }
|
||||||
|
|
||||||
static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc); }
|
static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*)pSrc, NULL); }
|
||||||
|
|
||||||
static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); }
|
||||||
|
|
||||||
static int32_t ctgCloneMetaDataArray(SArray* pSrc, FCopy copyFunc, SArray** pDst) {
|
static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFunc, SArray** pDst) {
|
||||||
if (NULL == pSrc) {
|
if (NULL == pSrc) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,10 +270,10 @@ static void setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbFName, S
|
||||||
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
|
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %dm "
|
||||||
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
|
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d KEEP %dm,%dm,%dm PAGES %d PAGESIZE %d PRECISION '%s' REPLICA %d "
|
||||||
"STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d",
|
"STRICT '%s' WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d",
|
||||||
dbFName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile, pCfg->walFsyncPeriod,
|
dbFName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, pCfg->daysPerFile,
|
||||||
pCfg->maxRows, pCfg->minRows, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2, pCfg->pages,
|
pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->daysToKeep0, pCfg->daysToKeep1, pCfg->daysToKeep2,
|
||||||
pCfg->pageSize, prec, pCfg->replications, strictStr(pCfg->strict), pCfg->walLevel, pCfg->numOfVgroups,
|
pCfg->pages, pCfg->pageSize, prec, pCfg->replications, strictStr(pCfg->strict), pCfg->walLevel,
|
||||||
1 == pCfg->numOfStables);
|
pCfg->numOfVgroups, 1 == pCfg->numOfStables);
|
||||||
|
|
||||||
if (retentions) {
|
if (retentions) {
|
||||||
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions);
|
len += sprintf(buf2 + VARSTR_HEADER_SIZE + len, " RETENTIONS %s", retentions);
|
||||||
|
@ -691,9 +691,15 @@ static int32_t createSelectResultDataBlock(SNodeList* pProjects, SSDataBlock** p
|
||||||
|
|
||||||
SNode* pProj = NULL;
|
SNode* pProj = NULL;
|
||||||
FOREACH(pProj, pProjects) {
|
FOREACH(pProj, pProjects) {
|
||||||
|
SExprNode* pExpr = (SExprNode*)pProj;
|
||||||
SColumnInfoData infoData = {0};
|
SColumnInfoData infoData = {0};
|
||||||
infoData.info.type = ((SExprNode*)pProj)->resType.type;
|
if (TSDB_DATA_TYPE_NULL == pExpr->resType.type) {
|
||||||
infoData.info.bytes = ((SExprNode*)pProj)->resType.bytes;
|
infoData.info.type = TSDB_DATA_TYPE_VARCHAR;
|
||||||
|
infoData.info.bytes = 0;
|
||||||
|
} else {
|
||||||
|
infoData.info.type = pExpr->resType.type;
|
||||||
|
infoData.info.bytes = pExpr->resType.bytes;
|
||||||
|
}
|
||||||
blockDataAppendColInfo(pBlock, &infoData);
|
blockDataAppendColInfo(pBlock, &infoData);
|
||||||
}
|
}
|
||||||
*pOutput = pBlock;
|
*pOutput = pBlock;
|
||||||
|
|
|
@ -782,13 +782,18 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
|
||||||
}
|
}
|
||||||
case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: {
|
case QUERY_NODE_PHYSICAL_PLAN_EXCHANGE: {
|
||||||
SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode;
|
SExchangePhysiNode *pExchNode = (SExchangePhysiNode *)pNode;
|
||||||
|
int32_t nodeNum = 0;
|
||||||
|
for (int32_t i = pExchNode->srcStartGroupId; i <= pExchNode->srcEndGroupId; ++i) {
|
||||||
SExplainGroup *group = taosHashGet(ctx->groupHash, &pExchNode->srcStartGroupId, sizeof(pExchNode->srcStartGroupId));
|
SExplainGroup *group = taosHashGet(ctx->groupHash, &pExchNode->srcStartGroupId, sizeof(pExchNode->srcStartGroupId));
|
||||||
if (NULL == group) {
|
if (NULL == group) {
|
||||||
qError("exchange src group %d not in groupHash", pExchNode->srcStartGroupId);
|
qError("exchange src group %d not in groupHash", pExchNode->srcStartGroupId);
|
||||||
QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
QRY_ERR_RET(TSDB_CODE_QRY_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->singleChannel ? 1 : group->nodeNum);
|
nodeNum += group->nodeNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPLAIN_ROW_NEW(level, EXPLAIN_EXCHANGE_FORMAT, pExchNode->singleChannel ? 1 : nodeNum);
|
||||||
EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT);
|
EXPLAIN_ROW_APPEND(EXPLAIN_LEFT_PARENTHESIS_FORMAT);
|
||||||
if (pResNode->pExecInfo) {
|
if (pResNode->pExecInfo) {
|
||||||
QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen));
|
QRY_ERR_RET(qExplainBufAppendExecInfo(pResNode->pExecInfo, tbuf, &tlen));
|
||||||
|
@ -819,7 +824,9 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QRY_ERR_RET(qExplainAppendGroupResRows(ctx, pExchNode->srcStartGroupId, level + 1, pExchNode->singleChannel));
|
for (int32_t i = pExchNode->srcStartGroupId; i <= pExchNode->srcEndGroupId; ++i) {
|
||||||
|
QRY_ERR_RET(qExplainAppendGroupResRows(ctx, i, level + 1, pExchNode->singleChannel));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QUERY_NODE_PHYSICAL_PLAN_SORT: {
|
case QUERY_NODE_PHYSICAL_PLAN_SORT: {
|
||||||
|
|
|
@ -185,7 +185,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pRes->info.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, pInfo->indexOfBufferedRes);
|
pRes->info.id.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, pInfo->indexOfBufferedRes);
|
||||||
pRes->info.rows = 1;
|
pRes->info.rows = 1;
|
||||||
|
|
||||||
SExprSupp* pSup = &pInfo->pseudoExprSup;
|
SExprSupp* pSup = &pInfo->pseudoExprSup;
|
||||||
|
@ -196,7 +196,7 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pRes->info.groupId = getTableGroupId(pTableList, pRes->info.uid);
|
pRes->info.id.groupId = getTableGroupId(pTableList, pRes->info.id.uid);
|
||||||
pInfo->indexOfBufferedRes += 1;
|
pInfo->indexOfBufferedRes += 1;
|
||||||
return pRes;
|
return pRes;
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,12 +232,12 @@ SSDataBlock* doScanCache(SOperatorInfo* pOperator) {
|
||||||
SExprSupp* pSup = &pInfo->pseudoExprSup;
|
SExprSupp* pSup = &pInfo->pseudoExprSup;
|
||||||
|
|
||||||
STableKeyInfo* pKeyInfo = &((STableKeyInfo*)pList)[0];
|
STableKeyInfo* pKeyInfo = &((STableKeyInfo*)pList)[0];
|
||||||
pInfo->pRes->info.groupId = pKeyInfo->groupId;
|
pInfo->pRes->info.id.groupId = pKeyInfo->groupId;
|
||||||
|
|
||||||
if (taosArrayGetSize(pInfo->pUidList) > 0) {
|
if (taosArrayGetSize(pInfo->pUidList) > 0) {
|
||||||
ASSERT((pInfo->retrieveType & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW);
|
ASSERT((pInfo->retrieveType & CACHESCAN_RETRIEVE_LAST_ROW) == CACHESCAN_RETRIEVE_LAST_ROW);
|
||||||
|
|
||||||
pInfo->pRes->info.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, 0);
|
pInfo->pRes->info.id.uid = *(tb_uid_t*)taosArrayGet(pInfo->pUidList, 0);
|
||||||
code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes, pInfo->pRes->info.rows,
|
code = addTagPseudoColumnData(&pInfo->readHandle, pSup->pExprInfo, pSup->numOfExprs, pInfo->pRes, pInfo->pRes->info.rows,
|
||||||
GET_TASKID(pTaskInfo), NULL);
|
GET_TASKID(pTaskInfo), NULL);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -717,10 +717,10 @@ int32_t prepareLoadRemoteData(SOperatorInfo* pOperator) {
|
||||||
int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDataBlock* pBlock, bool holdDataInBuf) {
|
int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDataBlock* pBlock, bool holdDataInBuf) {
|
||||||
if (pLimitInfo->remainGroupOffset > 0) {
|
if (pLimitInfo->remainGroupOffset > 0) {
|
||||||
if (pLimitInfo->currentGroupId == 0) { // it is the first group
|
if (pLimitInfo->currentGroupId == 0) { // it is the first group
|
||||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
|
||||||
blockDataCleanup(pBlock);
|
blockDataCleanup(pBlock);
|
||||||
return PROJECT_RETRIEVE_CONTINUE;
|
return PROJECT_RETRIEVE_CONTINUE;
|
||||||
} else if (pLimitInfo->currentGroupId != pBlock->info.groupId) {
|
} else if (pLimitInfo->currentGroupId != pBlock->info.id.groupId) {
|
||||||
// now it is the data from a new group
|
// now it is the data from a new group
|
||||||
pLimitInfo->remainGroupOffset -= 1;
|
pLimitInfo->remainGroupOffset -= 1;
|
||||||
|
|
||||||
|
@ -732,11 +732,11 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
|
||||||
}
|
}
|
||||||
|
|
||||||
// set current group id of the project operator
|
// set current group id of the project operator
|
||||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// here check for a new group data, we need to handle the data of the previous group.
|
// here check for a new group data, we need to handle the data of the previous group.
|
||||||
if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) {
|
if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.id.groupId) {
|
||||||
pLimitInfo->numOfOutputGroups += 1;
|
pLimitInfo->numOfOutputGroups += 1;
|
||||||
if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
|
if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
|
||||||
pOperator->status = OP_EXEC_DONE;
|
pOperator->status = OP_EXEC_DONE;
|
||||||
|
@ -758,7 +758,7 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
|
||||||
// here we reach the start position, according to the limit/offset requirements.
|
// here we reach the start position, according to the limit/offset requirements.
|
||||||
|
|
||||||
// set current group id
|
// set current group id
|
||||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
|
||||||
|
|
||||||
if (pLimitInfo->remainOffset >= pBlock->info.rows) {
|
if (pLimitInfo->remainOffset >= pBlock->info.rows) {
|
||||||
pLimitInfo->remainOffset -= pBlock->info.rows;
|
pLimitInfo->remainOffset -= pBlock->info.rows;
|
||||||
|
|
|
@ -213,7 +213,7 @@ SSDataBlock* createDataBlockFromDescNode(SDataBlockDescNode* pNode) {
|
||||||
|
|
||||||
SSDataBlock* pBlock = createDataBlock();
|
SSDataBlock* pBlock = createDataBlock();
|
||||||
|
|
||||||
pBlock->info.blockId = pNode->dataBlockId;
|
pBlock->info.id.blockId = pNode->dataBlockId;
|
||||||
pBlock->info.type = STREAM_INVALID;
|
pBlock->info.type = STREAM_INVALID;
|
||||||
pBlock->info.calWin = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX};
|
pBlock->info.calWin = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX};
|
||||||
pBlock->info.watermark = INT64_MIN;
|
pBlock->info.watermark = INT64_MIN;
|
||||||
|
|
|
@ -447,7 +447,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int
|
||||||
pCtx[i].scanFlag = scanFlag;
|
pCtx[i].scanFlag = scanFlag;
|
||||||
|
|
||||||
SInputColumnInfoData* pInput = &pCtx[i].input;
|
SInputColumnInfoData* pInput = &pCtx[i].input;
|
||||||
pInput->uid = pBlock->info.uid;
|
pInput->uid = pBlock->info.id.uid;
|
||||||
pInput->colDataSMAIsSet = false;
|
pInput->colDataSMAIsSet = false;
|
||||||
|
|
||||||
SExprInfo* pOneExpr = &pExprSup->pExprInfo[i];
|
SExprInfo* pOneExpr = &pExprSup->pExprInfo[i];
|
||||||
|
@ -506,184 +506,6 @@ static int32_t doAggregateImpl(SOperatorInfo* pOperator, SqlFunctionCtx* pCtx) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPseudoOutputColInfo(SSDataBlock* pResult, SqlFunctionCtx* pCtx, SArray* pPseudoList) {
|
|
||||||
size_t num = (pPseudoList != NULL) ? taosArrayGetSize(pPseudoList) : 0;
|
|
||||||
for (int32_t i = 0; i < num; ++i) {
|
|
||||||
pCtx[i].pOutput = taosArrayGet(pResult->pDataBlock, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx,
|
|
||||||
int32_t numOfOutput, SArray* pPseudoList) {
|
|
||||||
setPseudoOutputColInfo(pResult, pCtx, pPseudoList);
|
|
||||||
|
|
||||||
if (pSrcBlock == NULL) {
|
|
||||||
for (int32_t k = 0; k < numOfOutput; ++k) {
|
|
||||||
int32_t outputSlotId = pExpr[k].base.resSchema.slotId;
|
|
||||||
|
|
||||||
ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE);
|
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
|
||||||
|
|
||||||
int32_t type = pExpr[k].base.pParam[0].param.nType;
|
|
||||||
if (TSDB_DATA_TYPE_NULL == type) {
|
|
||||||
colDataAppendNNULL(pColInfoData, 0, 1);
|
|
||||||
} else {
|
|
||||||
colDataAppend(pColInfoData, 0, taosVariantGet(&pExpr[k].base.pParam[0].param, type), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pResult->info.rows = 1;
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pResult != pSrcBlock) {
|
|
||||||
pResult->info.groupId = pSrcBlock->info.groupId;
|
|
||||||
memcpy(pResult->info.parTbName, pSrcBlock->info.parTbName, TSDB_TABLE_NAME_LEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the source equals to the destination, it is to create a new column as the result of scalar
|
|
||||||
// function or some operators.
|
|
||||||
bool createNewColModel = (pResult == pSrcBlock);
|
|
||||||
if (createNewColModel) {
|
|
||||||
blockDataEnsureCapacity(pResult, pResult->info.rows);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t numOfRows = 0;
|
|
||||||
|
|
||||||
for (int32_t k = 0; k < numOfOutput; ++k) {
|
|
||||||
int32_t outputSlotId = pExpr[k].base.resSchema.slotId;
|
|
||||||
SqlFunctionCtx* pfCtx = &pCtx[k];
|
|
||||||
SInputColumnInfoData* pInputData = &pfCtx->input;
|
|
||||||
|
|
||||||
if (pExpr[k].pExpr->nodeType == QUERY_NODE_COLUMN) { // it is a project query
|
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
|
||||||
if (pResult->info.rows > 0 && !createNewColModel) {
|
|
||||||
colDataMergeCol(pColInfoData, pResult->info.rows, (int32_t*)&pResult->info.capacity, pInputData->pData[0],
|
|
||||||
pInputData->numOfRows);
|
|
||||||
} else {
|
|
||||||
colDataAssign(pColInfoData, pInputData->pData[0], pInputData->numOfRows, &pResult->info);
|
|
||||||
}
|
|
||||||
|
|
||||||
numOfRows = pInputData->numOfRows;
|
|
||||||
} else if (pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE) {
|
|
||||||
SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
|
||||||
|
|
||||||
int32_t offset = createNewColModel ? 0 : pResult->info.rows;
|
|
||||||
|
|
||||||
int32_t type = pExpr[k].base.pParam[0].param.nType;
|
|
||||||
if (TSDB_DATA_TYPE_NULL == type) {
|
|
||||||
colDataAppendNNULL(pColInfoData, offset, pSrcBlock->info.rows);
|
|
||||||
} else {
|
|
||||||
for (int32_t i = 0; i < pSrcBlock->info.rows; ++i) {
|
|
||||||
colDataAppend(pColInfoData, i + offset, taosVariantGet(&pExpr[k].base.pParam[0].param, type), false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
numOfRows = pSrcBlock->info.rows;
|
|
||||||
} else if (pExpr[k].pExpr->nodeType == QUERY_NODE_OPERATOR) {
|
|
||||||
SArray* pBlockList = taosArrayInit(4, POINTER_BYTES);
|
|
||||||
taosArrayPush(pBlockList, &pSrcBlock);
|
|
||||||
|
|
||||||
SColumnInfoData* pResColData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
|
||||||
SColumnInfoData idata = {.info = pResColData->info, .hasNull = true};
|
|
||||||
|
|
||||||
SScalarParam dest = {.columnData = &idata};
|
|
||||||
int32_t code = scalarCalculate(pExpr[k].pExpr->_optrRoot.pRootNode, pBlockList, &dest);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
taosArrayDestroy(pBlockList);
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
|
||||||
ASSERT(pResult->info.capacity > 0);
|
|
||||||
|
|
||||||
colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows);
|
|
||||||
colDataDestroy(&idata);
|
|
||||||
|
|
||||||
numOfRows = dest.numOfRows;
|
|
||||||
taosArrayDestroy(pBlockList);
|
|
||||||
} else if (pExpr[k].pExpr->nodeType == QUERY_NODE_FUNCTION) {
|
|
||||||
// _rowts/_c0, not tbname column
|
|
||||||
if (fmIsPseudoColumnFunc(pfCtx->functionId) && (!fmIsScanPseudoColumnFunc(pfCtx->functionId))) {
|
|
||||||
// do nothing
|
|
||||||
} else if (fmIsIndefiniteRowsFunc(pfCtx->functionId)) {
|
|
||||||
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pfCtx);
|
|
||||||
pfCtx->fpSet.init(pfCtx, pResInfo);
|
|
||||||
|
|
||||||
pfCtx->pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
|
||||||
pfCtx->offset = createNewColModel ? 0 : pResult->info.rows; // set the start offset
|
|
||||||
|
|
||||||
// set the timestamp(_rowts) output buffer
|
|
||||||
if (taosArrayGetSize(pPseudoList) > 0) {
|
|
||||||
int32_t* outputColIndex = taosArrayGet(pPseudoList, 0);
|
|
||||||
pfCtx->pTsOutput = (SColumnInfoData*)pCtx[*outputColIndex].pOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
// link pDstBlock to set selectivity value
|
|
||||||
if (pfCtx->subsidiaries.num > 0) {
|
|
||||||
pfCtx->pDstBlock = pResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t code = pfCtx->fpSet.process(pfCtx);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
numOfRows = pResInfo->numOfRes;
|
|
||||||
} else if (fmIsAggFunc(pfCtx->functionId)) {
|
|
||||||
// selective value output should be set during corresponding function execution
|
|
||||||
if (fmIsSelectValueFunc(pfCtx->functionId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// _group_key function for "partition by tbname" + csum(col_name) query
|
|
||||||
SColumnInfoData* pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
|
||||||
int32_t slotId = pfCtx->param[0].pCol->slotId;
|
|
||||||
|
|
||||||
// todo handle the json tag
|
|
||||||
SColumnInfoData* pInput = taosArrayGet(pSrcBlock->pDataBlock, slotId);
|
|
||||||
for (int32_t f = 0; f < pSrcBlock->info.rows; ++f) {
|
|
||||||
bool isNull = colDataIsNull_s(pInput, f);
|
|
||||||
if (isNull) {
|
|
||||||
colDataAppendNULL(pOutput, pResult->info.rows + f);
|
|
||||||
} else {
|
|
||||||
char* data = colDataGetData(pInput, f);
|
|
||||||
colDataAppend(pOutput, pResult->info.rows + f, data, isNull);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
SArray* pBlockList = taosArrayInit(4, POINTER_BYTES);
|
|
||||||
taosArrayPush(pBlockList, &pSrcBlock);
|
|
||||||
|
|
||||||
SColumnInfoData* pResColData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
|
||||||
SColumnInfoData idata = {.info = pResColData->info, .hasNull = true};
|
|
||||||
|
|
||||||
SScalarParam dest = {.columnData = &idata};
|
|
||||||
int32_t code = scalarCalculate((SNode*)pExpr[k].pExpr->_function.pFunctNode, pBlockList, &dest);
|
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
|
||||||
taosArrayDestroy(pBlockList);
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
|
||||||
ASSERT(pResult->info.capacity > 0);
|
|
||||||
colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows);
|
|
||||||
colDataDestroy(&idata);
|
|
||||||
|
|
||||||
numOfRows = dest.numOfRows;
|
|
||||||
taosArrayDestroy(pBlockList);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return TSDB_CODE_OPS_NOT_SUPPORT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!createNewColModel) {
|
|
||||||
pResult->info.rows += numOfRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool functionNeedToExecute(SqlFunctionCtx* pCtx) {
|
bool functionNeedToExecute(SqlFunctionCtx* pCtx) {
|
||||||
struct SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
struct SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
||||||
|
|
||||||
|
@ -862,7 +684,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
|
||||||
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
|
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
|
||||||
pTableScanInfo->rowEntryInfoOffset);
|
pTableScanInfo->rowEntryInfoOffset);
|
||||||
} else {
|
} else {
|
||||||
if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.uid, &win, masterScan, &pResult, groupId,
|
if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.id.uid, &win, masterScan, &pResult, groupId,
|
||||||
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
|
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
|
||||||
pTableScanInfo->rowEntryInfoOffset) != TSDB_CODE_SUCCESS) {
|
pTableScanInfo->rowEntryInfoOffset) != TSDB_CODE_SUCCESS) {
|
||||||
T_LONG_JMP(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
|
T_LONG_JMP(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||||
|
@ -913,7 +735,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
|
||||||
TSKEY k = ascQuery? pBlock->info.window.skey : pBlock->info.window.ekey;
|
TSKEY k = ascQuery? pBlock->info.window.skey : pBlock->info.window.ekey;
|
||||||
|
|
||||||
STimeWindow win = getActiveTimeWindow(pTableScanInfo->pResultRowInfo, k, pQueryAttr);
|
STimeWindow win = getActiveTimeWindow(pTableScanInfo->pResultRowInfo, k, pQueryAttr);
|
||||||
if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.uid, &win, masterScan, &pResult, groupId,
|
if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.id.uid, &win, masterScan, &pResult, groupId,
|
||||||
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
|
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
|
||||||
pTableScanInfo->rowEntryInfoOffset) != TSDB_CODE_SUCCESS) {
|
pTableScanInfo->rowEntryInfoOffset) != TSDB_CODE_SUCCESS) {
|
||||||
T_LONG_JMP(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
|
T_LONG_JMP(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||||
|
@ -1245,11 +1067,11 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBlock->info.groupId == 0) {
|
if (pBlock->info.id.groupId == 0) {
|
||||||
pBlock->info.groupId = pPos->groupId;
|
pBlock->info.id.groupId = pPos->groupId;
|
||||||
} else {
|
} else {
|
||||||
// current value belongs to different group, it can't be packed into one datablock
|
// current value belongs to different group, it can't be packed into one datablock
|
||||||
if (pBlock->info.groupId != pPos->groupId) {
|
if (pBlock->info.id.groupId != pPos->groupId) {
|
||||||
releaseBufPage(pBuf, page);
|
releaseBufPage(pBuf, page);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1269,7 +1091,7 @@ int32_t doCopyToSDataBlock(SExecTaskInfo* pTaskInfo, SSDataBlock* pBlock, SExprS
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("%s result generated, rows:%d, groupId:%" PRIu64, GET_TASKID(pTaskInfo), pBlock->info.rows,
|
qDebug("%s result generated, rows:%d, groupId:%" PRIu64, GET_TASKID(pTaskInfo), pBlock->info.rows,
|
||||||
pBlock->info.groupId);
|
pBlock->info.id.groupId);
|
||||||
|
|
||||||
blockDataUpdateTsWindow(pBlock, 0);
|
blockDataUpdateTsWindow(pBlock, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1289,12 +1111,12 @@ void doBuildStreamResBlock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SGr
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the existed group id
|
// clear the existed group id
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.id.groupId = 0;
|
||||||
ASSERT(!pbInfo->mergeResultBlock);
|
ASSERT(!pbInfo->mergeResultBlock);
|
||||||
doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo);
|
doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo);
|
||||||
|
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.groupId, &tbname) < 0) {
|
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname) < 0) {
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
|
@ -1316,7 +1138,7 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the existed group id
|
// clear the existed group id
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.id.groupId = 0;
|
||||||
if (!pbInfo->mergeResultBlock) {
|
if (!pbInfo->mergeResultBlock) {
|
||||||
doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo);
|
doCopyToSDataBlock(pTaskInfo, pBlock, &pOperator->exprSupp, pBuf, pGroupResInfo);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1327,11 +1149,11 @@ void doBuildResultDatablock(SOperatorInfo* pOperator, SOptrBasicInfo* pbInfo, SG
|
||||||
}
|
}
|
||||||
|
|
||||||
// clearing group id to continue to merge data that belong to different groups
|
// clearing group id to continue to merge data that belong to different groups
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.id.groupId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the group id info in SSDataBlock, since the client does not need it
|
// clear the group id info in SSDataBlock, since the client does not need it
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.id.groupId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1635,7 +1457,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// the pDataBlock are always the same one, no need to call this again
|
// the pDataBlock are always the same one, no need to call this again
|
||||||
setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.groupId);
|
setExecutionContext(pOperator, pOperator->exprSupp.numOfExprs, pBlock->info.id.groupId);
|
||||||
setInputDataBlock(pSup, pBlock, order, scanFlag, true);
|
setInputDataBlock(pSup, pBlock, order, scanFlag, true);
|
||||||
code = doAggregateImpl(pOperator, pSup->pCtx);
|
code = doAggregateImpl(pOperator, pSup->pCtx);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
|
@ -1712,7 +1534,7 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo* pOperator, SFillOp
|
||||||
int32_t numOfResultRows = pResultInfo->capacity - pResBlock->info.rows;
|
int32_t numOfResultRows = pResultInfo->capacity - pResBlock->info.rows;
|
||||||
taosFillResultDataBlock(pInfo->pFillInfo, pResBlock, numOfResultRows);
|
taosFillResultDataBlock(pInfo->pFillInfo, pResBlock, numOfResultRows);
|
||||||
|
|
||||||
pInfo->curGroupId = pInfo->existNewGroupBlock->info.groupId;
|
pInfo->curGroupId = pInfo->existNewGroupBlock->info.id.groupId;
|
||||||
pInfo->existNewGroupBlock = NULL;
|
pInfo->existNewGroupBlock = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1721,7 +1543,7 @@ static void doHandleRemainBlockFromNewGroup(SOperatorInfo* pOperator, SFillOpera
|
||||||
if (taosFillHasMoreResults(pInfo->pFillInfo)) {
|
if (taosFillHasMoreResults(pInfo->pFillInfo)) {
|
||||||
int32_t numOfResultRows = pResultInfo->capacity - pInfo->pFinalRes->info.rows;
|
int32_t numOfResultRows = pResultInfo->capacity - pInfo->pFinalRes->info.rows;
|
||||||
taosFillResultDataBlock(pInfo->pFillInfo, pInfo->pFinalRes, numOfResultRows);
|
taosFillResultDataBlock(pInfo->pFillInfo, pInfo->pFinalRes, numOfResultRows);
|
||||||
pInfo->pRes->info.groupId = pInfo->curGroupId;
|
pInfo->pRes->info.id.groupId = pInfo->curGroupId;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1743,7 +1565,7 @@ static void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlo
|
||||||
setInputDataBlock(pNoFillSupp, pBlock, order, scanFlag, false);
|
setInputDataBlock(pNoFillSupp, pBlock, order, scanFlag, false);
|
||||||
|
|
||||||
projectApplyFunctions(pNoFillSupp->pExprInfo, pInfo->pRes, pBlock, pNoFillSupp->pCtx, pNoFillSupp->numOfExprs, NULL);
|
projectApplyFunctions(pNoFillSupp->pExprInfo, pInfo->pRes, pBlock, pNoFillSupp->pCtx, pNoFillSupp->numOfExprs, NULL);
|
||||||
pInfo->pRes->info.groupId = pBlock->info.groupId;
|
pInfo->pRes->info.id.groupId = pBlock->info.id.groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
|
@ -1761,7 +1583,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
doHandleRemainBlockFromNewGroup(pOperator, pInfo, pResultInfo, pTaskInfo);
|
doHandleRemainBlockFromNewGroup(pOperator, pInfo, pResultInfo, pTaskInfo);
|
||||||
if (pResBlock->info.rows > 0) {
|
if (pResBlock->info.rows > 0) {
|
||||||
pResBlock->info.groupId = pInfo->curGroupId;
|
pResBlock->info.id.groupId = pInfo->curGroupId;
|
||||||
return pResBlock;
|
return pResBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1783,8 +1605,8 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
blockDataEnsureCapacity(pInfo->pFinalRes, pBlock->info.rows);
|
blockDataEnsureCapacity(pInfo->pFinalRes, pBlock->info.rows);
|
||||||
doApplyScalarCalculation(pOperator, pBlock, order, scanFlag);
|
doApplyScalarCalculation(pOperator, pBlock, order, scanFlag);
|
||||||
|
|
||||||
if (pInfo->curGroupId == 0 || pInfo->curGroupId == pInfo->pRes->info.groupId) {
|
if (pInfo->curGroupId == 0 || pInfo->curGroupId == pInfo->pRes->info.id.groupId) {
|
||||||
pInfo->curGroupId = pInfo->pRes->info.groupId; // the first data block
|
pInfo->curGroupId = pInfo->pRes->info.id.groupId; // the first data block
|
||||||
pInfo->totalInputRows += pInfo->pRes->info.rows;
|
pInfo->totalInputRows += pInfo->pRes->info.rows;
|
||||||
|
|
||||||
if (order == pInfo->pFillInfo->order) {
|
if (order == pInfo->pFillInfo->order) {
|
||||||
|
@ -1793,7 +1615,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
taosFillSetStartInfo(pInfo->pFillInfo, pInfo->pRes->info.rows, pBlock->info.window.skey);
|
taosFillSetStartInfo(pInfo->pFillInfo, pInfo->pRes->info.rows, pBlock->info.window.skey);
|
||||||
}
|
}
|
||||||
taosFillSetInputDataBlock(pInfo->pFillInfo, pInfo->pRes);
|
taosFillSetInputDataBlock(pInfo->pFillInfo, pInfo->pRes);
|
||||||
} else if (pInfo->curGroupId != pBlock->info.groupId) { // the new group data block
|
} else if (pInfo->curGroupId != pBlock->info.id.groupId) { // the new group data block
|
||||||
pInfo->existNewGroupBlock = pBlock;
|
pInfo->existNewGroupBlock = pBlock;
|
||||||
|
|
||||||
// Fill the previous group data block, before handle the data block of new group.
|
// Fill the previous group data block, before handle the data block of new group.
|
||||||
|
@ -1810,13 +1632,13 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
// 1. The result in current group not reach the threshold of output result, continue
|
// 1. The result in current group not reach the threshold of output result, continue
|
||||||
// 2. If multiple group results existing in one SSDataBlock is not allowed, return immediately
|
// 2. If multiple group results existing in one SSDataBlock is not allowed, return immediately
|
||||||
if (pResBlock->info.rows > pResultInfo->threshold || pBlock == NULL || pInfo->existNewGroupBlock != NULL) {
|
if (pResBlock->info.rows > pResultInfo->threshold || pBlock == NULL || pInfo->existNewGroupBlock != NULL) {
|
||||||
pResBlock->info.groupId = pInfo->curGroupId;
|
pResBlock->info.id.groupId = pInfo->curGroupId;
|
||||||
return pResBlock;
|
return pResBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
doHandleRemainBlockFromNewGroup(pOperator, pInfo, pResultInfo, pTaskInfo);
|
doHandleRemainBlockFromNewGroup(pOperator, pInfo, pResultInfo, pTaskInfo);
|
||||||
if (pResBlock->info.rows >= pOperator->resultInfo.threshold || pBlock == NULL) {
|
if (pResBlock->info.rows >= pOperator->resultInfo.threshold || pBlock == NULL) {
|
||||||
pResBlock->info.groupId = pInfo->curGroupId;
|
pResBlock->info.id.groupId = pInfo->curGroupId;
|
||||||
return pResBlock;
|
return pResBlock;
|
||||||
}
|
}
|
||||||
} else if (pInfo->existNewGroupBlock) { // try next group
|
} else if (pInfo->existNewGroupBlock) { // try next group
|
||||||
|
@ -1826,7 +1648,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
doHandleRemainBlockForNewGroupImpl(pOperator, pInfo, pResultInfo, pTaskInfo);
|
doHandleRemainBlockForNewGroupImpl(pOperator, pInfo, pResultInfo, pTaskInfo);
|
||||||
if (pResBlock->info.rows > pResultInfo->threshold) {
|
if (pResBlock->info.rows > pResultInfo->threshold) {
|
||||||
pResBlock->info.groupId = pInfo->curGroupId;
|
pResBlock->info.id.groupId = pInfo->curGroupId;
|
||||||
return pResBlock;
|
return pResBlock;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2533,10 +2355,12 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < tableListGetSize(pTableListInfo); ++i) {
|
size_t num = taosArrayGetSize(pList);
|
||||||
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
STableKeyInfo* p = taosArrayGet(pList, i);
|
STableKeyInfo* p = taosArrayGet(pList, i);
|
||||||
tableListAddTableInfo(pTableListInfo, p->uid, 0);
|
tableListAddTableInfo(pTableListInfo, p->uid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
taosArrayDestroy(pList);
|
taosArrayDestroy(pList);
|
||||||
} else { // Create group with only one table
|
} else { // Create group with only one table
|
||||||
tableListAddTableInfo(pTableListInfo, pBlockNode->uid, 0);
|
tableListAddTableInfo(pTableListInfo, pBlockNode->uid, 0);
|
||||||
|
@ -2967,10 +2791,10 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBlock->info.groupId == 0) {
|
if (pBlock->info.id.groupId == 0) {
|
||||||
pBlock->info.groupId = pPos->groupId;
|
pBlock->info.id.groupId = pPos->groupId;
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.groupId, &tbname) < 0) {
|
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname) < 0) {
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
|
@ -2978,7 +2802,7 @@ int32_t buildDataBlockFromGroupRes(SOperatorInfo* pOperator, SStreamState* pStat
|
||||||
tdbFree(tbname);
|
tdbFree(tbname);
|
||||||
} else {
|
} else {
|
||||||
// current value belongs to different group, it can't be packed into one datablock
|
// current value belongs to different group, it can't be packed into one datablock
|
||||||
if (pBlock->info.groupId != pPos->groupId) {
|
if (pBlock->info.id.groupId != pPos->groupId) {
|
||||||
releaseOutputBuf(pState, &key, pRow);
|
releaseOutputBuf(pState, &key, pRow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3058,11 +2882,11 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBlock->info.groupId == 0) {
|
if (pBlock->info.id.groupId == 0) {
|
||||||
pBlock->info.groupId = pKey->groupId;
|
pBlock->info.id.groupId = pKey->groupId;
|
||||||
|
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.groupId, &tbname) < 0) {
|
if (streamStateGetParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname) < 0) {
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
|
@ -3070,7 +2894,7 @@ int32_t buildSessionResultDataBlock(SOperatorInfo* pOperator, SStreamState* pSta
|
||||||
tdbFree(tbname);
|
tdbFree(tbname);
|
||||||
} else {
|
} else {
|
||||||
// current value belongs to different group, it can't be packed into one datablock
|
// current value belongs to different group, it can't be packed into one datablock
|
||||||
if (pBlock->info.groupId != pKey->groupId) {
|
if (pBlock->info.id.groupId != pKey->groupId) {
|
||||||
releaseOutputBuf(pState, NULL, pRow);
|
releaseOutputBuf(pState, NULL, pRow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
|
||||||
|
|
||||||
len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
|
len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
|
||||||
int32_t ret = setGroupResultOutputBuf(pOperator, &(pInfo->binfo), pOperator->exprSupp.numOfExprs, pInfo->keyBuf,
|
int32_t ret = setGroupResultOutputBuf(pOperator, &(pInfo->binfo), pOperator->exprSupp.numOfExprs, pInfo->keyBuf,
|
||||||
len, pBlock->info.groupId, pInfo->aggSup.pResultBuf, &pInfo->aggSup);
|
len, pBlock->info.id.groupId, pInfo->aggSup.pResultBuf, &pInfo->aggSup);
|
||||||
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
|
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
|
||||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
|
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
|
len = buildGroupKeys(pInfo->keyBuf, pInfo->pGroupColVals);
|
||||||
int32_t ret = setGroupResultOutputBuf(pOperator, &(pInfo->binfo), pOperator->exprSupp.numOfExprs, pInfo->keyBuf,
|
int32_t ret = setGroupResultOutputBuf(pOperator, &(pInfo->binfo), pOperator->exprSupp.numOfExprs, pInfo->keyBuf,
|
||||||
len, pBlock->info.groupId, pInfo->aggSup.pResultBuf, &pInfo->aggSup);
|
len, pBlock->info.id.groupId, pInfo->aggSup.pResultBuf, &pInfo->aggSup);
|
||||||
if (ret != TSDB_CODE_SUCCESS) {
|
if (ret != TSDB_CODE_SUCCESS) {
|
||||||
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
|
T_LONG_JMP(pTaskInfo->env, TSDB_CODE_QRY_APP_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -697,7 +697,7 @@ static SSDataBlock* buildPartitionResult(SOperatorInfo* pOperator) {
|
||||||
releaseBufPage(pInfo->pBuf, page);
|
releaseBufPage(pInfo->pBuf, page);
|
||||||
|
|
||||||
blockDataUpdateTsWindow(pInfo->binfo.pRes, 0);
|
blockDataUpdateTsWindow(pInfo->binfo.pRes, 0);
|
||||||
pInfo->binfo.pRes->info.groupId = pGroupInfo->groupId;
|
pInfo->binfo.pRes->info.id.groupId = pGroupInfo->groupId;
|
||||||
|
|
||||||
pOperator->resultInfo.totalRows += pInfo->binfo.pRes->info.rows;
|
pOperator->resultInfo.totalRows += pInfo->binfo.pRes->info.rows;
|
||||||
return pInfo->binfo.pRes;
|
return pInfo->binfo.pRes;
|
||||||
|
@ -952,7 +952,7 @@ static SSDataBlock* buildStreamPartitionResult(SOperatorInfo* pOperator) {
|
||||||
taosArrayDestroy(pParInfo->rowIds);
|
taosArrayDestroy(pParInfo->rowIds);
|
||||||
pParInfo->rowIds = NULL;
|
pParInfo->rowIds = NULL;
|
||||||
blockDataUpdateTsWindow(pDest, pInfo->tsColIndex);
|
blockDataUpdateTsWindow(pDest, pInfo->tsColIndex);
|
||||||
pDest->info.groupId = pParInfo->groupId;
|
pDest->info.id.groupId = pParInfo->groupId;
|
||||||
pOperator->resultInfo.totalRows += pDest->info.rows;
|
pOperator->resultInfo.totalRows += pDest->info.rows;
|
||||||
pInfo->parIte = taosHashIterate(pInfo->pPartitions, pInfo->parIte);
|
pInfo->parIte = taosHashIterate(pInfo->pPartitions, pInfo->parIte);
|
||||||
ASSERT(pDest->info.rows > 0);
|
ASSERT(pDest->info.rows > 0);
|
||||||
|
|
|
@ -185,7 +185,7 @@ static void mergeJoinJoinLeftRight(struct SOperatorInfo* pOperator, SSDataBlock*
|
||||||
int32_t rowIndex = -1;
|
int32_t rowIndex = -1;
|
||||||
|
|
||||||
SColumnInfoData* pSrc = NULL;
|
SColumnInfoData* pSrc = NULL;
|
||||||
if (pLeftBlock->info.blockId == blockId) {
|
if (pLeftBlock->info.id.blockId == blockId) {
|
||||||
pSrc = taosArrayGet(pLeftBlock->pDataBlock, slotId);
|
pSrc = taosArrayGet(pLeftBlock->pDataBlock, slotId);
|
||||||
rowIndex = leftPos;
|
rowIndex = leftPos;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -138,13 +138,13 @@ _error:
|
||||||
static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo) {
|
static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo) {
|
||||||
if (pLimitInfo->remainGroupOffset > 0) {
|
if (pLimitInfo->remainGroupOffset > 0) {
|
||||||
// it is the first group
|
// it is the first group
|
||||||
if (pLimitInfo->currentGroupId == 0 || pLimitInfo->currentGroupId == pBlock->info.groupId) {
|
if (pLimitInfo->currentGroupId == 0 || pLimitInfo->currentGroupId == pBlock->info.id.groupId) {
|
||||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
|
||||||
return PROJECT_RETRIEVE_CONTINUE;
|
return PROJECT_RETRIEVE_CONTINUE;
|
||||||
} else if (pLimitInfo->currentGroupId != pBlock->info.groupId) {
|
} else if (pLimitInfo->currentGroupId != pBlock->info.id.groupId) {
|
||||||
// now it is the data from a new group
|
// now it is the data from a new group
|
||||||
pLimitInfo->remainGroupOffset -= 1;
|
pLimitInfo->remainGroupOffset -= 1;
|
||||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
|
||||||
|
|
||||||
// ignore data block in current group
|
// ignore data block in current group
|
||||||
if (pLimitInfo->remainGroupOffset > 0) {
|
if (pLimitInfo->remainGroupOffset > 0) {
|
||||||
|
@ -153,7 +153,7 @@ static int32_t discardGroupDataBlock(SSDataBlock* pBlock, SLimitInfo* pLimitInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// set current group id of the project operator
|
// set current group id of the project operator
|
||||||
pLimitInfo->currentGroupId = pBlock->info.groupId;
|
pLimitInfo->currentGroupId = pBlock->info.id.groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PROJECT_RETRIEVE_DONE;
|
return PROJECT_RETRIEVE_DONE;
|
||||||
|
@ -164,7 +164,7 @@ static int32_t setInfoForNewGroup(SSDataBlock* pBlock, SLimitInfo* pLimitInfo, S
|
||||||
// here check for a new group data, we need to handle the data of the previous group.
|
// here check for a new group data, we need to handle the data of the previous group.
|
||||||
ASSERT(pLimitInfo->remainGroupOffset == 0 || pLimitInfo->remainGroupOffset == -1);
|
ASSERT(pLimitInfo->remainGroupOffset == 0 || pLimitInfo->remainGroupOffset == -1);
|
||||||
|
|
||||||
if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.groupId) {
|
if (pLimitInfo->currentGroupId != 0 && pLimitInfo->currentGroupId != pBlock->info.id.groupId) {
|
||||||
pLimitInfo->numOfOutputGroups += 1;
|
pLimitInfo->numOfOutputGroups += 1;
|
||||||
if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
|
if ((pLimitInfo->slimit.limit > 0) && (pLimitInfo->slimit.limit <= pLimitInfo->numOfOutputGroups)) {
|
||||||
setOperatorCompleted(pOperator);
|
setOperatorCompleted(pOperator);
|
||||||
|
@ -306,7 +306,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
||||||
T_LONG_JMP(pTaskInfo->env, code);
|
T_LONG_JMP(pTaskInfo->env, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
status = doIngroupLimitOffset(pLimitInfo, pBlock->info.groupId, pInfo->pRes, pOperator);
|
status = doIngroupLimitOffset(pLimitInfo, pBlock->info.id.groupId, pInfo->pRes, pOperator);
|
||||||
if (status == PROJECT_RETRIEVE_CONTINUE) {
|
if (status == PROJECT_RETRIEVE_CONTINUE) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
if (pProjectInfo->mergeDataBlocks) {
|
if (pProjectInfo->mergeDataBlocks) {
|
||||||
if (pRes->info.rows > 0) {
|
if (pRes->info.rows > 0) {
|
||||||
pFinalRes->info.groupId = pRes->info.groupId;
|
pFinalRes->info.id.groupId = pRes->info.id.groupId;
|
||||||
pFinalRes->info.version = pRes->info.version;
|
pFinalRes->info.version = pRes->info.version;
|
||||||
|
|
||||||
// continue merge data, ignore the group id
|
// continue merge data, ignore the group id
|
||||||
|
@ -511,11 +511,11 @@ SSDataBlock* doApplyIndefinitFunction(SOperatorInfo* pOperator) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pIndefInfo->groupId == 0 && pBlock->info.groupId != 0) {
|
if (pIndefInfo->groupId == 0 && pBlock->info.id.groupId != 0) {
|
||||||
pIndefInfo->groupId = pBlock->info.groupId; // this is the initial group result
|
pIndefInfo->groupId = pBlock->info.id.groupId; // this is the initial group result
|
||||||
} else {
|
} else {
|
||||||
if (pIndefInfo->groupId != pBlock->info.groupId) { // reset output buffer and computing status
|
if (pIndefInfo->groupId != pBlock->info.id.groupId) { // reset output buffer and computing status
|
||||||
pIndefInfo->groupId = pBlock->info.groupId;
|
pIndefInfo->groupId = pBlock->info.id.groupId;
|
||||||
pIndefInfo->pNextGroupRes = pBlock;
|
pIndefInfo->pNextGroupRes = pBlock;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -643,3 +643,182 @@ SSDataBlock* doGenerateSourceData(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
return (pRes->info.rows > 0) ? pRes : NULL;
|
return (pRes->info.rows > 0) ? pRes : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void setPseudoOutputColInfo(SSDataBlock* pResult, SqlFunctionCtx* pCtx, SArray* pPseudoList) {
|
||||||
|
size_t num = (pPseudoList != NULL) ? taosArrayGetSize(pPseudoList) : 0;
|
||||||
|
for (int32_t i = 0; i < num; ++i) {
|
||||||
|
pCtx[i].pOutput = taosArrayGet(pResult->pDataBlock, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBlock* pSrcBlock, SqlFunctionCtx* pCtx,
|
||||||
|
int32_t numOfOutput, SArray* pPseudoList) {
|
||||||
|
setPseudoOutputColInfo(pResult, pCtx, pPseudoList);
|
||||||
|
|
||||||
|
if (pSrcBlock == NULL) {
|
||||||
|
for (int32_t k = 0; k < numOfOutput; ++k) {
|
||||||
|
int32_t outputSlotId = pExpr[k].base.resSchema.slotId;
|
||||||
|
|
||||||
|
ASSERT(pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE);
|
||||||
|
SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
||||||
|
|
||||||
|
int32_t type = pExpr[k].base.pParam[0].param.nType;
|
||||||
|
if (TSDB_DATA_TYPE_NULL == type) {
|
||||||
|
colDataAppendNNULL(pColInfoData, 0, 1);
|
||||||
|
} else {
|
||||||
|
colDataAppend(pColInfoData, 0, taosVariantGet(&pExpr[k].base.pParam[0].param, type), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pResult->info.rows = 1;
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pResult != pSrcBlock) {
|
||||||
|
pResult->info.id.groupId = pSrcBlock->info.id.groupId;
|
||||||
|
memcpy(pResult->info.parTbName, pSrcBlock->info.parTbName, TSDB_TABLE_NAME_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the source equals to the destination, it is to create a new column as the result of scalar
|
||||||
|
// function or some operators.
|
||||||
|
bool createNewColModel = (pResult == pSrcBlock);
|
||||||
|
if (createNewColModel) {
|
||||||
|
blockDataEnsureCapacity(pResult, pResult->info.rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t numOfRows = 0;
|
||||||
|
|
||||||
|
for (int32_t k = 0; k < numOfOutput; ++k) {
|
||||||
|
int32_t outputSlotId = pExpr[k].base.resSchema.slotId;
|
||||||
|
SqlFunctionCtx* pfCtx = &pCtx[k];
|
||||||
|
SInputColumnInfoData* pInputData = &pfCtx->input;
|
||||||
|
|
||||||
|
if (pExpr[k].pExpr->nodeType == QUERY_NODE_COLUMN) { // it is a project query
|
||||||
|
SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
||||||
|
if (pResult->info.rows > 0 && !createNewColModel) {
|
||||||
|
colDataMergeCol(pColInfoData, pResult->info.rows, (int32_t*)&pResult->info.capacity, pInputData->pData[0],
|
||||||
|
pInputData->numOfRows);
|
||||||
|
} else {
|
||||||
|
colDataAssign(pColInfoData, pInputData->pData[0], pInputData->numOfRows, &pResult->info);
|
||||||
|
}
|
||||||
|
|
||||||
|
numOfRows = pInputData->numOfRows;
|
||||||
|
} else if (pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE) {
|
||||||
|
SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
||||||
|
|
||||||
|
int32_t offset = createNewColModel ? 0 : pResult->info.rows;
|
||||||
|
|
||||||
|
int32_t type = pExpr[k].base.pParam[0].param.nType;
|
||||||
|
if (TSDB_DATA_TYPE_NULL == type) {
|
||||||
|
colDataAppendNNULL(pColInfoData, offset, pSrcBlock->info.rows);
|
||||||
|
} else {
|
||||||
|
char* p = taosVariantGet(&pExpr[k].base.pParam[0].param, type);
|
||||||
|
for (int32_t i = 0; i < pSrcBlock->info.rows; ++i) {
|
||||||
|
colDataAppend(pColInfoData, i + offset, p, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
numOfRows = pSrcBlock->info.rows;
|
||||||
|
} else if (pExpr[k].pExpr->nodeType == QUERY_NODE_OPERATOR) {
|
||||||
|
SArray* pBlockList = taosArrayInit(4, POINTER_BYTES);
|
||||||
|
taosArrayPush(pBlockList, &pSrcBlock);
|
||||||
|
|
||||||
|
SColumnInfoData* pResColData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
||||||
|
SColumnInfoData idata = {.info = pResColData->info, .hasNull = true};
|
||||||
|
|
||||||
|
SScalarParam dest = {.columnData = &idata};
|
||||||
|
int32_t code = scalarCalculate(pExpr[k].pExpr->_optrRoot.pRootNode, pBlockList, &dest);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
taosArrayDestroy(pBlockList);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
||||||
|
ASSERT(pResult->info.capacity > 0);
|
||||||
|
|
||||||
|
colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows);
|
||||||
|
colDataDestroy(&idata);
|
||||||
|
|
||||||
|
numOfRows = dest.numOfRows;
|
||||||
|
taosArrayDestroy(pBlockList);
|
||||||
|
} else if (pExpr[k].pExpr->nodeType == QUERY_NODE_FUNCTION) {
|
||||||
|
// _rowts/_c0, not tbname column
|
||||||
|
if (fmIsPseudoColumnFunc(pfCtx->functionId) && (!fmIsScanPseudoColumnFunc(pfCtx->functionId))) {
|
||||||
|
// do nothing
|
||||||
|
} else if (fmIsIndefiniteRowsFunc(pfCtx->functionId)) {
|
||||||
|
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pfCtx);
|
||||||
|
pfCtx->fpSet.init(pfCtx, pResInfo);
|
||||||
|
|
||||||
|
pfCtx->pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
||||||
|
pfCtx->offset = createNewColModel ? 0 : pResult->info.rows; // set the start offset
|
||||||
|
|
||||||
|
// set the timestamp(_rowts) output buffer
|
||||||
|
if (taosArrayGetSize(pPseudoList) > 0) {
|
||||||
|
int32_t* outputColIndex = taosArrayGet(pPseudoList, 0);
|
||||||
|
pfCtx->pTsOutput = (SColumnInfoData*)pCtx[*outputColIndex].pOutput;
|
||||||
|
}
|
||||||
|
|
||||||
|
// link pDstBlock to set selectivity value
|
||||||
|
if (pfCtx->subsidiaries.num > 0) {
|
||||||
|
pfCtx->pDstBlock = pResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t code = pfCtx->fpSet.process(pfCtx);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
numOfRows = pResInfo->numOfRes;
|
||||||
|
} else if (fmIsAggFunc(pfCtx->functionId)) {
|
||||||
|
// selective value output should be set during corresponding function execution
|
||||||
|
if (fmIsSelectValueFunc(pfCtx->functionId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// _group_key function for "partition by tbname" + csum(col_name) query
|
||||||
|
SColumnInfoData* pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
||||||
|
int32_t slotId = pfCtx->param[0].pCol->slotId;
|
||||||
|
|
||||||
|
// todo handle the json tag
|
||||||
|
SColumnInfoData* pInput = taosArrayGet(pSrcBlock->pDataBlock, slotId);
|
||||||
|
for (int32_t f = 0; f < pSrcBlock->info.rows; ++f) {
|
||||||
|
bool isNull = colDataIsNull_s(pInput, f);
|
||||||
|
if (isNull) {
|
||||||
|
colDataAppendNULL(pOutput, pResult->info.rows + f);
|
||||||
|
} else {
|
||||||
|
char* data = colDataGetData(pInput, f);
|
||||||
|
colDataAppend(pOutput, pResult->info.rows + f, data, isNull);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
SArray* pBlockList = taosArrayInit(4, POINTER_BYTES);
|
||||||
|
taosArrayPush(pBlockList, &pSrcBlock);
|
||||||
|
|
||||||
|
SColumnInfoData* pResColData = taosArrayGet(pResult->pDataBlock, outputSlotId);
|
||||||
|
SColumnInfoData idata = {.info = pResColData->info, .hasNull = true};
|
||||||
|
|
||||||
|
SScalarParam dest = {.columnData = &idata};
|
||||||
|
int32_t code = scalarCalculate((SNode*)pExpr[k].pExpr->_function.pFunctNode, pBlockList, &dest);
|
||||||
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
taosArrayDestroy(pBlockList);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
||||||
|
ASSERT(pResult->info.capacity > 0);
|
||||||
|
colDataMergeCol(pResColData, startOffset, (int32_t*)&pResult->info.capacity, &idata, dest.numOfRows);
|
||||||
|
colDataDestroy(&idata);
|
||||||
|
|
||||||
|
numOfRows = dest.numOfRows;
|
||||||
|
taosArrayDestroy(pBlockList);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return TSDB_CODE_OPS_NOT_SUPPORT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!createNewColModel) {
|
||||||
|
pResult->info.rows += numOfRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TSDB_CODE_SUCCESS;
|
||||||
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ static int32_t doDynamicPruneDataBlock(SOperatorInfo* pOperator, SDataBlockInfo*
|
||||||
SExprSupp* pSup1 = pTableScanInfo->base.pdInfo.pExprSup;
|
SExprSupp* pSup1 = pTableScanInfo->base.pdInfo.pExprSup;
|
||||||
|
|
||||||
SFilePage* pPage = NULL;
|
SFilePage* pPage = NULL;
|
||||||
SResultRow* pRow = getTableGroupOutputBuf(pOperator, pBlockInfo->groupId, &pPage);
|
SResultRow* pRow = getTableGroupOutputBuf(pOperator, pBlockInfo->id.groupId, &pPage);
|
||||||
|
|
||||||
if (pRow == NULL) {
|
if (pRow == NULL) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
@ -484,13 +484,13 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
// 1. check if it is existed in meta cache
|
// 1. check if it is existed in meta cache
|
||||||
if (pCache == NULL) {
|
if (pCache == NULL) {
|
||||||
metaReaderInit(&mr, pHandle->meta, 0);
|
metaReaderInit(&mr, pHandle->meta, 0);
|
||||||
code = metaGetTableEntryByUidCache(&mr, pBlock->info.uid);
|
code = metaGetTableEntryByUidCache(&mr, pBlock->info.id.uid);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
||||||
qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid,
|
qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid,
|
||||||
tstrerror(terrno), idStr);
|
tstrerror(terrno), idStr);
|
||||||
} else {
|
} else {
|
||||||
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno), idStr);
|
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno), idStr);
|
||||||
}
|
}
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
return terrno;
|
return terrno;
|
||||||
|
@ -505,16 +505,16 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
} else {
|
} else {
|
||||||
pCache->metaFetch += 1;
|
pCache->metaFetch += 1;
|
||||||
|
|
||||||
h = taosLRUCacheLookup(pCache->pTableMetaEntryCache, &pBlock->info.uid, sizeof(pBlock->info.uid));
|
h = taosLRUCacheLookup(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(pBlock->info.id.uid));
|
||||||
if (h == NULL) {
|
if (h == NULL) {
|
||||||
metaReaderInit(&mr, pHandle->meta, 0);
|
metaReaderInit(&mr, pHandle->meta, 0);
|
||||||
code = metaGetTableEntryByUidCache(&mr, pBlock->info.uid);
|
code = metaGetTableEntryByUidCache(&mr, pBlock->info.id.uid);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
if (terrno == TSDB_CODE_PAR_TABLE_NOT_EXIST) {
|
||||||
qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s",
|
qWarn("failed to get table meta, table may have been dropped, uid:0x%" PRIx64 ", code:%s, %s",
|
||||||
pBlock->info.uid, tstrerror(terrno), idStr);
|
pBlock->info.id.uid, tstrerror(terrno), idStr);
|
||||||
} else {
|
} else {
|
||||||
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.uid, tstrerror(terrno),
|
qError("failed to get table meta, uid:0x%" PRIx64 ", code:%s, %s", pBlock->info.id.uid, tstrerror(terrno),
|
||||||
idStr);
|
idStr);
|
||||||
}
|
}
|
||||||
metaReaderClear(&mr);
|
metaReaderClear(&mr);
|
||||||
|
@ -528,7 +528,7 @@ int32_t addTagPseudoColumnData(SReadHandle* pHandle, const SExprInfo* pExpr, int
|
||||||
val = *pVal;
|
val = *pVal;
|
||||||
freeReader = true;
|
freeReader = true;
|
||||||
|
|
||||||
int32_t ret = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.uid, sizeof(uint64_t), pVal,
|
int32_t ret = taosLRUCacheInsert(pCache->pTableMetaEntryCache, &pBlock->info.id.uid, sizeof(uint64_t), pVal,
|
||||||
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW);
|
sizeof(STableCachedVal), freeCachedMetaItem, NULL, TAOS_LRU_PRIORITY_LOW);
|
||||||
if (ret != TAOS_LRU_STATUS_OK) {
|
if (ret != TAOS_LRU_STATUS_OK) {
|
||||||
qError("failed to put meta into lru cache, code:%d, %s", ret, idStr);
|
qError("failed to put meta into lru cache, code:%d, %s", ret, idStr);
|
||||||
|
@ -642,13 +642,13 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
|
||||||
SDataBlockInfo* pBInfo = &pBlock->info;
|
SDataBlockInfo* pBInfo = &pBlock->info;
|
||||||
|
|
||||||
int32_t rows = 0;
|
int32_t rows = 0;
|
||||||
tsdbRetrieveDataBlockInfo(pTableScanInfo->base.dataReader, &rows, &pBInfo->uid, &pBInfo->window);
|
tsdbRetrieveDataBlockInfo(pTableScanInfo->base.dataReader, &rows, &pBInfo->id.uid, &pBInfo->window);
|
||||||
|
|
||||||
blockDataEnsureCapacity(pBlock, rows); // todo remove it latter
|
blockDataEnsureCapacity(pBlock, rows); // todo remove it latter
|
||||||
pBInfo->rows = rows;
|
pBInfo->rows = rows;
|
||||||
|
|
||||||
ASSERT(pBInfo->uid != 0);
|
ASSERT(pBInfo->id.uid != 0);
|
||||||
pBlock->info.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.uid);
|
pBlock->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.id.uid);
|
||||||
|
|
||||||
uint32_t status = 0;
|
uint32_t status = 0;
|
||||||
int32_t code = loadDataBlock(pOperator, &pTableScanInfo->base, pBlock, &status);
|
int32_t code = loadDataBlock(pOperator, &pTableScanInfo->base, pBlock, &status);
|
||||||
|
@ -668,13 +668,13 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
|
||||||
pOperator->cost.totalCost = pTableScanInfo->base.readRecorder.elapsedTime;
|
pOperator->cost.totalCost = pTableScanInfo->base.readRecorder.elapsedTime;
|
||||||
|
|
||||||
// todo refactor
|
// todo refactor
|
||||||
/*pTableScanInfo->lastStatus.uid = pBlock->info.uid;*/
|
/*pTableScanInfo->lastStatus.uid = pBlock->info.id.uid;*/
|
||||||
/*pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey;*/
|
/*pTableScanInfo->lastStatus.ts = pBlock->info.window.ekey;*/
|
||||||
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
||||||
pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.uid;
|
pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
|
||||||
pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
|
pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
|
||||||
|
|
||||||
ASSERT(pBlock->info.uid != 0);
|
ASSERT(pBlock->info.id.uid != 0);
|
||||||
return pBlock;
|
return pBlock;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -786,7 +786,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
SSDataBlock* result = doGroupedTableScan(pOperator);
|
SSDataBlock* result = doGroupedTableScan(pOperator);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
ASSERT(result->info.uid != 0);
|
ASSERT(result->info.id.uid != 0);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,7 +1009,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
|
||||||
SDataBlockInfo* pBInfo = &pBlock->info;
|
SDataBlockInfo* pBInfo = &pBlock->info;
|
||||||
|
|
||||||
int32_t rows = 0;
|
int32_t rows = 0;
|
||||||
tsdbRetrieveDataBlockInfo(pReader, &rows, &pBInfo->uid, &pBInfo->window);
|
tsdbRetrieveDataBlockInfo(pReader, &rows, &pBInfo->id.uid, &pBInfo->window);
|
||||||
|
|
||||||
SArray* pCols = tsdbRetrieveDataBlock(pReader, NULL);
|
SArray* pCols = tsdbRetrieveDataBlock(pReader, NULL);
|
||||||
blockDataEnsureCapacity(pBlock, rows);
|
blockDataEnsureCapacity(pBlock, rows);
|
||||||
|
@ -1018,7 +1018,7 @@ static SSDataBlock* readPreVersionData(SOperatorInfo* pTableScanOp, uint64_t tbU
|
||||||
relocateColumnData(pBlock, pTableScanInfo->base.matchInfo.pList, pCols, true);
|
relocateColumnData(pBlock, pTableScanInfo->base.matchInfo.pList, pCols, true);
|
||||||
doSetTagColumnData(&pTableScanInfo->base, pBlock, pTaskInfo, rows);
|
doSetTagColumnData(&pTableScanInfo->base, pBlock, pTaskInfo, rows);
|
||||||
|
|
||||||
pBlock->info.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBInfo->uid);
|
pBlock->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBInfo->id.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
tsdbReaderClose(pReader);
|
tsdbReaderClose(pReader);
|
||||||
|
@ -1175,7 +1175,7 @@ static SSDataBlock* doRangeScan(SStreamScanInfo* pInfo, SSDataBlock* pSDB, int32
|
||||||
pResult->info.calWin = pInfo->updateWin;
|
pResult->info.calWin = pInfo->updateWin;
|
||||||
return pResult;
|
return pResult;
|
||||||
}
|
}
|
||||||
} else if (pResult->info.groupId == pInfo->groupId) {
|
} else if (pResult->info.id.groupId == pInfo->groupId) {
|
||||||
pResult->info.calWin = pInfo->updateWin;
|
pResult->info.calWin = pInfo->updateWin;
|
||||||
return pResult;
|
return pResult;
|
||||||
}
|
}
|
||||||
|
@ -1366,7 +1366,7 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
|
||||||
if (pBlock == NULL || pBlock->info.rows == 0) return;
|
if (pBlock == NULL || pBlock->info.rows == 0) return;
|
||||||
|
|
||||||
void* tbname = NULL;
|
void* tbname = NULL;
|
||||||
if (streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, pBlock->info.groupId, &tbname) < 0) {
|
if (streamStateGetParName(pInfo->pStreamScanOp->pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, &tbname) < 0) {
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
memcpy(pBlock->info.parTbName, tbname, TSDB_TABLE_NAME_LEN);
|
||||||
|
@ -1399,8 +1399,8 @@ void calBlockTbName(SStreamScanInfo* pInfo, SSDataBlock* pBlock) {
|
||||||
pBlock->info.parTbName[0] = 0;
|
pBlock->info.parTbName[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pBlock->info.groupId && pBlock->info.parTbName[0]) {
|
if (pBlock->info.id.groupId && pBlock->info.parTbName[0]) {
|
||||||
streamStatePutParName(pState, pBlock->info.groupId, pBlock->info.parTbName);
|
streamStatePutParName(pState, pBlock->info.id.groupId, pBlock->info.parTbName);
|
||||||
}
|
}
|
||||||
|
|
||||||
blockDataDestroy(pSrcBlock);
|
blockDataDestroy(pSrcBlock);
|
||||||
|
@ -1434,7 +1434,7 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
|
||||||
SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex);
|
SColumnInfoData* pColDataInfo = taosArrayGet(pBlock->pDataBlock, pInfo->primaryTsIndex);
|
||||||
ASSERT(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP);
|
ASSERT(pColDataInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP);
|
||||||
TSKEY* tsCol = (TSKEY*)pColDataInfo->pData;
|
TSKEY* tsCol = (TSKEY*)pColDataInfo->pData;
|
||||||
bool tableInserted = updateInfoIsTableInserted(pInfo->pUpdateInfo, pBlock->info.uid);
|
bool tableInserted = updateInfoIsTableInserted(pInfo->pUpdateInfo, pBlock->info.id.uid);
|
||||||
for (int32_t rowId = 0; rowId < pBlock->info.rows; rowId++) {
|
for (int32_t rowId = 0; rowId < pBlock->info.rows; rowId++) {
|
||||||
SResultRowInfo dumyInfo;
|
SResultRowInfo dumyInfo;
|
||||||
dumyInfo.cur.pageId = -1;
|
dumyInfo.cur.pageId = -1;
|
||||||
|
@ -1445,18 +1445,18 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
|
||||||
isClosed = isCloseWindow(&win, &pInfo->twAggSup);
|
isClosed = isCloseWindow(&win, &pInfo->twAggSup);
|
||||||
}
|
}
|
||||||
// must check update info first.
|
// must check update info first.
|
||||||
bool update = updateInfoIsUpdated(pInfo->pUpdateInfo, pBlock->info.uid, tsCol[rowId]);
|
bool update = updateInfoIsUpdated(pInfo->pUpdateInfo, pBlock->info.id.uid, tsCol[rowId]);
|
||||||
bool closedWin = isClosed && isSignleIntervalWindow(pInfo) &&
|
bool closedWin = isClosed && isSignleIntervalWindow(pInfo) &&
|
||||||
isDeletedStreamWindow(&win, pBlock->info.groupId,
|
isDeletedStreamWindow(&win, pBlock->info.id.groupId,
|
||||||
pInfo->pTableScanOp->pTaskInfo->streamInfo.pState, &pInfo->twAggSup);
|
pInfo->pTableScanOp->pTaskInfo->streamInfo.pState, &pInfo->twAggSup);
|
||||||
if ((update || closedWin) && out) {
|
if ((update || closedWin) && out) {
|
||||||
qDebug("stream update check not pass, update %d, closedWin %d", update, closedWin);
|
qDebug("stream update check not pass, update %d, closedWin %d", update, closedWin);
|
||||||
uint64_t gpId = 0;
|
uint64_t gpId = 0;
|
||||||
appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.uid, &gpId,
|
appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.id.uid, &gpId,
|
||||||
NULL);
|
NULL);
|
||||||
if (closedWin && pInfo->partitionSup.needCalc) {
|
if (closedWin && pInfo->partitionSup.needCalc) {
|
||||||
gpId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pBlock, rowId);
|
gpId = calGroupIdByData(&pInfo->partitionSup, pInfo->pPartScalarSup, pBlock, rowId);
|
||||||
appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.uid, &gpId,
|
appendOneRowToStreamSpecialBlock(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.id.uid, &gpId,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1476,11 +1476,11 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
|
||||||
blockDataEnsureCapacity(pInfo->pRes, pBlock->info.rows);
|
blockDataEnsureCapacity(pInfo->pRes, pBlock->info.rows);
|
||||||
|
|
||||||
pInfo->pRes->info.rows = pBlock->info.rows;
|
pInfo->pRes->info.rows = pBlock->info.rows;
|
||||||
pInfo->pRes->info.uid = pBlock->info.uid;
|
pInfo->pRes->info.id.uid = pBlock->info.id.uid;
|
||||||
pInfo->pRes->info.type = STREAM_NORMAL;
|
pInfo->pRes->info.type = STREAM_NORMAL;
|
||||||
pInfo->pRes->info.version = pBlock->info.version;
|
pInfo->pRes->info.version = pBlock->info.version;
|
||||||
|
|
||||||
pInfo->pRes->info.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.uid);
|
pInfo->pRes->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.id.uid);
|
||||||
|
|
||||||
// todo extract method
|
// todo extract method
|
||||||
for (int32_t i = 0; i < taosArrayGetSize(pInfo->matchInfo.pList); ++i) {
|
for (int32_t i = 0; i < taosArrayGetSize(pInfo->matchInfo.pList); ++i) {
|
||||||
|
@ -1807,8 +1807,8 @@ FETCH_NEXT_BLOCK:
|
||||||
|
|
||||||
int32_t current = pInfo->validBlockIndex++;
|
int32_t current = pInfo->validBlockIndex++;
|
||||||
SSDataBlock* pBlock = taosArrayGetP(pInfo->pBlockLists, current);
|
SSDataBlock* pBlock = taosArrayGetP(pInfo->pBlockLists, current);
|
||||||
if (pBlock->info.groupId && pBlock->info.parTbName[0]) {
|
if (pBlock->info.id.groupId && pBlock->info.parTbName[0]) {
|
||||||
streamStatePutParName(pTaskInfo->streamInfo.pState, pBlock->info.groupId, pBlock->info.parTbName);
|
streamStatePutParName(pTaskInfo->streamInfo.pState, pBlock->info.id.groupId, pBlock->info.parTbName);
|
||||||
}
|
}
|
||||||
// TODO move into scan
|
// TODO move into scan
|
||||||
pBlock->info.calWin.skey = INT64_MIN;
|
pBlock->info.calWin.skey = INT64_MIN;
|
||||||
|
@ -1960,7 +1960,7 @@ FETCH_NEXT_BLOCK:
|
||||||
|
|
||||||
setBlockIntoRes(pInfo, &block, false);
|
setBlockIntoRes(pInfo, &block, false);
|
||||||
|
|
||||||
if (updateInfoIgnore(pInfo->pUpdateInfo, &pInfo->pRes->info.window, pInfo->pRes->info.groupId,
|
if (updateInfoIgnore(pInfo->pUpdateInfo, &pInfo->pRes->info.window, pInfo->pRes->info.id.groupId,
|
||||||
pInfo->pRes->info.version)) {
|
pInfo->pRes->info.version)) {
|
||||||
printDataBlock(pInfo->pRes, "stream scan ignore");
|
printDataBlock(pInfo->pRes, "stream scan ignore");
|
||||||
blockDataCleanup(pInfo->pRes);
|
blockDataCleanup(pInfo->pRes);
|
||||||
|
@ -2050,7 +2050,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t rows = 0;
|
int32_t rows = 0;
|
||||||
tsdbRetrieveDataBlockInfo(pInfo->dataReader, &rows, &pBlock->info.uid, &pBlock->info.window);
|
tsdbRetrieveDataBlockInfo(pInfo->dataReader, &rows, &pBlock->info.id.uid, &pBlock->info.window);
|
||||||
pBlock->info.rows = rows;
|
pBlock->info.rows = rows;
|
||||||
|
|
||||||
SArray* pCols = tsdbRetrieveDataBlock(pInfo->dataReader, NULL);
|
SArray* pCols = tsdbRetrieveDataBlock(pInfo->dataReader, NULL);
|
||||||
|
@ -2059,9 +2059,9 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
|
||||||
longjmp(pTaskInfo->env, terrno);
|
longjmp(pTaskInfo->env, terrno);
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("tmqsnap doRawScan get data uid:%" PRId64 "", pBlock->info.uid);
|
qDebug("tmqsnap doRawScan get data uid:%" PRId64 "", pBlock->info.id.uid);
|
||||||
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
pTaskInfo->streamInfo.lastStatus.type = TMQ_OFFSET__SNAPSHOT_DATA;
|
||||||
pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.uid;
|
pTaskInfo->streamInfo.lastStatus.uid = pBlock->info.id.uid;
|
||||||
pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
|
pTaskInfo->streamInfo.lastStatus.ts = pBlock->info.window.ekey;
|
||||||
return pBlock;
|
return pBlock;
|
||||||
}
|
}
|
||||||
|
@ -2555,7 +2555,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
|
||||||
blockDataCleanup(pBlock);
|
blockDataCleanup(pBlock);
|
||||||
|
|
||||||
int32_t rows = 0;
|
int32_t rows = 0;
|
||||||
tsdbRetrieveDataBlockInfo(reader, &rows, &pBlock->info.uid, &pBlock->info.window);
|
tsdbRetrieveDataBlockInfo(reader, &rows, &pBlock->info.id.uid, &pBlock->info.window);
|
||||||
blockDataEnsureCapacity(pBlock, rows);
|
blockDataEnsureCapacity(pBlock, rows);
|
||||||
pBlock->info.rows = rows;
|
pBlock->info.rows = rows;
|
||||||
|
|
||||||
|
@ -2577,7 +2577,7 @@ static SSDataBlock* getTableDataBlockImpl(void* param) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pBlock->info.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.uid);
|
pBlock->info.id.groupId = getTableGroupId(pTaskInfo->pTableInfoList, pBlock->info.id.uid);
|
||||||
|
|
||||||
pOperator->resultInfo.totalRows += pBlock->info.rows;
|
pOperator->resultInfo.totalRows += pBlock->info.rows;
|
||||||
pTableScanInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0;
|
pTableScanInfo->base.readRecorder.elapsedTime += (taosGetTimestampUs() - st) / 1000.0;
|
||||||
|
@ -2773,7 +2773,7 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
|
||||||
pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pInfo->pResBlock, pOperator->resultInfo.capacity,
|
pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pInfo->pResBlock, pOperator->resultInfo.capacity,
|
||||||
pOperator);
|
pOperator);
|
||||||
if (pBlock != NULL) {
|
if (pBlock != NULL) {
|
||||||
pBlock->info.groupId = pInfo->groupId;
|
pBlock->info.id.groupId = pInfo->groupId;
|
||||||
pOperator->resultInfo.totalRows += pBlock->info.rows;
|
pOperator->resultInfo.totalRows += pBlock->info.rows;
|
||||||
return pBlock;
|
return pBlock;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -359,7 +359,7 @@ SSDataBlock* fetchNextGroupSortDataBlock(void* param) {
|
||||||
SOperatorInfo* childOp = source->childOpInfo;
|
SOperatorInfo* childOp = source->childOpInfo;
|
||||||
SSDataBlock* block = childOp->fpSet.getNextFn(childOp);
|
SSDataBlock* block = childOp->fpSet.getNextFn(childOp);
|
||||||
if (block != NULL) {
|
if (block != NULL) {
|
||||||
if (block->info.groupId == grpSortOpInfo->currGroupId) {
|
if (block->info.id.groupId == grpSortOpInfo->currGroupId) {
|
||||||
grpSortOpInfo->childOpStatus = CHILD_OP_SAME_GROUP;
|
grpSortOpInfo->childOpStatus = CHILD_OP_SAME_GROUP;
|
||||||
return block;
|
return block;
|
||||||
} else {
|
} else {
|
||||||
|
@ -439,7 +439,7 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
|
||||||
setOperatorCompleted(pOperator);
|
setOperatorCompleted(pOperator);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pInfo->currGroupId = pInfo->prefetchedSortInput->info.groupId;
|
pInfo->currGroupId = pInfo->prefetchedSortInput->info.id.groupId;
|
||||||
pInfo->childOpStatus = CHILD_OP_NEW_GROUP;
|
pInfo->childOpStatus = CHILD_OP_NEW_GROUP;
|
||||||
beginSortGroup(pOperator);
|
beginSortGroup(pOperator);
|
||||||
}
|
}
|
||||||
|
@ -451,13 +451,13 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
|
||||||
pBlock = getGroupSortedBlockData(pInfo->pCurrSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity,
|
pBlock = getGroupSortedBlockData(pInfo->pCurrSortHandle, pInfo->binfo.pRes, pOperator->resultInfo.capacity,
|
||||||
pInfo->matchInfo.pList, pInfo);
|
pInfo->matchInfo.pList, pInfo);
|
||||||
if (pBlock != NULL) {
|
if (pBlock != NULL) {
|
||||||
pBlock->info.groupId = pInfo->currGroupId;
|
pBlock->info.id.groupId = pInfo->currGroupId;
|
||||||
pOperator->resultInfo.totalRows += pBlock->info.rows;
|
pOperator->resultInfo.totalRows += pBlock->info.rows;
|
||||||
return pBlock;
|
return pBlock;
|
||||||
} else {
|
} else {
|
||||||
if (pInfo->childOpStatus == CHILD_OP_NEW_GROUP) {
|
if (pInfo->childOpStatus == CHILD_OP_NEW_GROUP) {
|
||||||
finishSortGroup(pOperator);
|
finishSortGroup(pOperator);
|
||||||
pInfo->currGroupId = pInfo->prefetchedSortInput->info.groupId;
|
pInfo->currGroupId = pInfo->prefetchedSortInput->info.id.groupId;
|
||||||
beginSortGroup(pOperator);
|
beginSortGroup(pOperator);
|
||||||
} else if (pInfo->childOpStatus == CHILD_OP_FINISHED) {
|
} else if (pInfo->childOpStatus == CHILD_OP_FINISHED) {
|
||||||
finishSortGroup(pOperator);
|
finishSortGroup(pOperator);
|
||||||
|
@ -691,10 +691,10 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
|
||||||
|
|
||||||
pInfo->limitInfo.numOfOutputRows += p->info.rows;
|
pInfo->limitInfo.numOfOutputRows += p->info.rows;
|
||||||
pDataBlock->info.rows = p->info.rows;
|
pDataBlock->info.rows = p->info.rows;
|
||||||
pDataBlock->info.groupId = pInfo->groupId;
|
pDataBlock->info.id.groupId = pInfo->groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("%s get sorted block, groupId:0x%" PRIx64 " rows:%d", GET_TASKID(pTaskInfo), pDataBlock->info.groupId,
|
qDebug("%s get sorted block, groupId:0x%" PRIx64 " rows:%d", GET_TASKID(pTaskInfo), pDataBlock->info.id.groupId,
|
||||||
pDataBlock->info.rows);
|
pDataBlock->info.rows);
|
||||||
|
|
||||||
return (pDataBlock->info.rows > 0) ? pDataBlock : NULL;
|
return (pDataBlock->info.rows > 0) ? pDataBlock : NULL;
|
||||||
|
|
|
@ -918,8 +918,11 @@ void setDeleteFillValueInfo(TSKEY start, TSKEY end, SStreamFillSupporter* pFillS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TSKEY realStart = taosTimeAdd(pFillSup->prev.key, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
|
||||||
|
pFillSup->interval.precision);
|
||||||
|
|
||||||
pFillInfo->needFill = true;
|
pFillInfo->needFill = true;
|
||||||
pFillInfo->start = start;
|
pFillInfo->start = realStart;
|
||||||
pFillInfo->current = pFillInfo->start;
|
pFillInfo->current = pFillInfo->start;
|
||||||
pFillInfo->end = end;
|
pFillInfo->end = end;
|
||||||
pFillInfo->pos = FILL_POS_INVALID;
|
pFillInfo->pos = FILL_POS_INVALID;
|
||||||
|
@ -1092,7 +1095,7 @@ static bool checkResult(SStreamFillSupporter* pFillSup, TSKEY ts, uint64_t group
|
||||||
}
|
}
|
||||||
|
|
||||||
static void buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFillSup, TSKEY ts, SSDataBlock* pBlock) {
|
static void buildFillResult(SResultRowData* pResRow, SStreamFillSupporter* pFillSup, TSKEY ts, SSDataBlock* pBlock) {
|
||||||
uint64_t groupId = pBlock->info.groupId;
|
uint64_t groupId = pBlock->info.id.groupId;
|
||||||
if (pFillSup->hasDelete && !checkResult(pFillSup, ts, groupId)) {
|
if (pFillSup->hasDelete && !checkResult(pFillSup, ts, groupId)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1131,7 +1134,7 @@ static void doStreamFillNormal(SStreamFillSupporter* pFillSup, SStreamFillInfo*
|
||||||
|
|
||||||
static void doStreamFillLinear(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) {
|
static void doStreamFillLinear(SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo, SSDataBlock* pBlock) {
|
||||||
while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) {
|
while (hasRemainCalc(pFillInfo) && pBlock->info.rows < pBlock->info.capacity) {
|
||||||
uint64_t groupId = pBlock->info.groupId;
|
uint64_t groupId = pBlock->info.id.groupId;
|
||||||
SWinKey key = {.groupId = groupId, .ts = pFillInfo->current};
|
SWinKey key = {.groupId = groupId, .ts = pFillInfo->current};
|
||||||
if (pFillSup->hasDelete && !checkResult(pFillSup, pFillInfo->current, groupId)) {
|
if (pFillSup->hasDelete && !checkResult(pFillSup, pFillInfo->current, groupId)) {
|
||||||
pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
|
pFillInfo->current = taosTimeAdd(pFillInfo->current, pFillSup->interval.sliding, pFillSup->interval.slidingUnit,
|
||||||
|
@ -1230,7 +1233,7 @@ void keepBlockRowInDiscBuf(SOperatorInfo* pOperator, SStreamFillInfo* pFillInfo,
|
||||||
|
|
||||||
static void doFillResults(SOperatorInfo* pOperator, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo,
|
static void doFillResults(SOperatorInfo* pOperator, SStreamFillSupporter* pFillSup, SStreamFillInfo* pFillInfo,
|
||||||
SSDataBlock* pBlock, TSKEY* tsCol, int32_t rowId, SSDataBlock* pRes) {
|
SSDataBlock* pBlock, TSKEY* tsCol, int32_t rowId, SSDataBlock* pRes) {
|
||||||
uint64_t groupId = pBlock->info.groupId;
|
uint64_t groupId = pBlock->info.id.groupId;
|
||||||
getWindowFromDiscBuf(pOperator, tsCol[rowId], groupId, pFillSup);
|
getWindowFromDiscBuf(pOperator, tsCol[rowId], groupId, pFillSup);
|
||||||
if (pFillSup->prev.key == pFillInfo->preRowKey) {
|
if (pFillSup->prev.key == pFillInfo->preRowKey) {
|
||||||
resetFillWindow(&pFillSup->prev);
|
resetFillWindow(&pFillSup->prev);
|
||||||
|
@ -1245,9 +1248,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
|
||||||
SStreamFillSupporter* pFillSup = pInfo->pFillSup;
|
SStreamFillSupporter* pFillSup = pInfo->pFillSup;
|
||||||
SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
|
SStreamFillInfo* pFillInfo = pInfo->pFillInfo;
|
||||||
SSDataBlock* pBlock = pInfo->pSrcBlock;
|
SSDataBlock* pBlock = pInfo->pSrcBlock;
|
||||||
uint64_t groupId = pBlock->info.groupId;
|
uint64_t groupId = pBlock->info.id.groupId;
|
||||||
SSDataBlock* pRes = pInfo->pRes;
|
SSDataBlock* pRes = pInfo->pRes;
|
||||||
pRes->info.groupId = groupId;
|
pRes->info.id.groupId = groupId;
|
||||||
if (hasRemainCalc(pFillInfo)) {
|
if (hasRemainCalc(pFillInfo)) {
|
||||||
doStreamFillRange(pFillInfo, pFillSup, pRes);
|
doStreamFillRange(pFillInfo, pFillSup, pRes);
|
||||||
}
|
}
|
||||||
|
@ -1282,7 +1285,9 @@ static void doStreamFillImpl(SOperatorInfo* pOperator) {
|
||||||
blockDataCleanup(pInfo->pSrcBlock);
|
blockDataCleanup(pInfo->pSrcBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void buildDeleteRange(TSKEY start, TSKEY end, uint64_t groupId, SSDataBlock* delRes) {
|
static void buildDeleteRange(SOperatorInfo* pOp, TSKEY start, TSKEY end, uint64_t groupId, SSDataBlock* delRes) {
|
||||||
|
SStreamState* pState = pOp->pTaskInfo->streamInfo.pState;
|
||||||
|
|
||||||
SSDataBlock* pBlock = delRes;
|
SSDataBlock* pBlock = delRes;
|
||||||
SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
|
SColumnInfoData* pStartCol = taosArrayGet(pBlock->pDataBlock, START_TS_COLUMN_INDEX);
|
||||||
SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
|
SColumnInfoData* pEndCol = taosArrayGet(pBlock->pDataBlock, END_TS_COLUMN_INDEX);
|
||||||
|
@ -1290,25 +1295,42 @@ static void buildDeleteRange(TSKEY start, TSKEY end, uint64_t groupId, SSDataBlo
|
||||||
SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
|
SColumnInfoData* pGroupCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX);
|
||||||
SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
|
SColumnInfoData* pCalStartCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_START_TS_COLUMN_INDEX);
|
||||||
SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
|
SColumnInfoData* pCalEndCol = taosArrayGet(pBlock->pDataBlock, CALCULATE_END_TS_COLUMN_INDEX);
|
||||||
|
SColumnInfoData* pTbNameCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
||||||
colDataAppend(pStartCol, pBlock->info.rows, (const char*)&start, false);
|
colDataAppend(pStartCol, pBlock->info.rows, (const char*)&start, false);
|
||||||
colDataAppend(pEndCol, pBlock->info.rows, (const char*)&end, false);
|
colDataAppend(pEndCol, pBlock->info.rows, (const char*)&end, false);
|
||||||
colDataAppendNULL(pUidCol, pBlock->info.rows);
|
colDataAppendNULL(pUidCol, pBlock->info.rows);
|
||||||
colDataAppend(pGroupCol, pBlock->info.rows, (const char*)&groupId, false);
|
colDataAppend(pGroupCol, pBlock->info.rows, (const char*)&groupId, false);
|
||||||
colDataAppendNULL(pCalStartCol, pBlock->info.rows);
|
colDataAppendNULL(pCalStartCol, pBlock->info.rows);
|
||||||
colDataAppendNULL(pCalEndCol, pBlock->info.rows);
|
colDataAppendNULL(pCalEndCol, pBlock->info.rows);
|
||||||
|
|
||||||
|
SColumnInfoData* pTableCol = taosArrayGet(pBlock->pDataBlock, TABLE_NAME_COLUMN_INDEX);
|
||||||
|
|
||||||
|
void* tbname = NULL;
|
||||||
|
streamStateGetParName(pOp->pTaskInfo->streamInfo.pState, groupId, &tbname);
|
||||||
|
if (tbname == NULL) {
|
||||||
|
colDataAppendNULL(pTableCol, pBlock->info.rows);
|
||||||
|
} else {
|
||||||
|
char parTbName[VARSTR_HEADER_SIZE + TSDB_TABLE_NAME_LEN];
|
||||||
|
STR_WITH_MAXSIZE_TO_VARSTR(parTbName, tbname, sizeof(parTbName));
|
||||||
|
colDataAppend(pTableCol, pBlock->info.rows, (const char*)parTbName, false);
|
||||||
|
}
|
||||||
|
tdbFree(tbname);
|
||||||
|
|
||||||
pBlock->info.rows++;
|
pBlock->info.rows++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void buildDeleteResult(SStreamFillSupporter* pFillSup, TSKEY startTs, TSKEY endTs, uint64_t groupId,
|
static void buildDeleteResult(SOperatorInfo* pOperator, TSKEY startTs, TSKEY endTs, uint64_t groupId,
|
||||||
SSDataBlock* delRes) {
|
SSDataBlock* delRes) {
|
||||||
|
SStreamFillOperatorInfo* pInfo = pOperator->info;
|
||||||
|
SStreamFillSupporter* pFillSup = pInfo->pFillSup;
|
||||||
if (hasPrevWindow(pFillSup)) {
|
if (hasPrevWindow(pFillSup)) {
|
||||||
TSKEY start = getNextWindowTs(pFillSup->prev.key, &pFillSup->interval);
|
TSKEY start = getNextWindowTs(pFillSup->prev.key, &pFillSup->interval);
|
||||||
buildDeleteRange(start, endTs, groupId, delRes);
|
buildDeleteRange(pOperator, start, endTs, groupId, delRes);
|
||||||
} else if (hasNextWindow(pFillSup)) {
|
} else if (hasNextWindow(pFillSup)) {
|
||||||
TSKEY end = getPrevWindowTs(pFillSup->next.key, &pFillSup->interval);
|
TSKEY end = getPrevWindowTs(pFillSup->next.key, &pFillSup->interval);
|
||||||
buildDeleteRange(startTs, end, groupId, delRes);
|
buildDeleteRange(pOperator, startTs, end, groupId, delRes);
|
||||||
} else {
|
} else {
|
||||||
buildDeleteRange(startTs, endTs, groupId, delRes);
|
buildDeleteRange(pOperator, startTs, endTs, groupId, delRes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1319,7 +1341,7 @@ static void doDeleteFillResultImpl(SOperatorInfo* pOperator, TSKEY startTs, TSKE
|
||||||
SWinKey key = {.ts = startTs, .groupId = groupId};
|
SWinKey key = {.ts = startTs, .groupId = groupId};
|
||||||
if (!pInfo->pFillInfo->needFill) {
|
if (!pInfo->pFillInfo->needFill) {
|
||||||
streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
|
streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
|
||||||
buildDeleteResult(pInfo->pFillSup, startTs, endTs, groupId, pInfo->pDelRes);
|
buildDeleteResult(pOperator, startTs, endTs, groupId, pInfo->pDelRes);
|
||||||
} else {
|
} else {
|
||||||
STimeRange tw = {
|
STimeRange tw = {
|
||||||
.skey = startTs,
|
.skey = startTs,
|
||||||
|
@ -1342,14 +1364,14 @@ static void doDeleteFillFinalize(SOperatorInfo* pOperator) {
|
||||||
tSimpleHashClear(pInfo->pFillSup->pResMap);
|
tSimpleHashClear(pInfo->pFillSup->pResMap);
|
||||||
for (; pFillInfo->delIndex < size; pFillInfo->delIndex++) {
|
for (; pFillInfo->delIndex < size; pFillInfo->delIndex++) {
|
||||||
STimeRange* range = taosArrayGet(pFillInfo->delRanges, pFillInfo->delIndex);
|
STimeRange* range = taosArrayGet(pFillInfo->delRanges, pFillInfo->delIndex);
|
||||||
if (pInfo->pRes->info.groupId != 0 && pInfo->pRes->info.groupId != range->groupId) {
|
if (pInfo->pRes->info.id.groupId != 0 && pInfo->pRes->info.id.groupId != range->groupId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getWindowFromDiscBuf(pOperator, range->skey, range->groupId, pInfo->pFillSup);
|
getWindowFromDiscBuf(pOperator, range->skey, range->groupId, pInfo->pFillSup);
|
||||||
setDeleteFillValueInfo(range->skey, range->ekey, pInfo->pFillSup, pInfo->pFillInfo);
|
setDeleteFillValueInfo(range->skey, range->ekey, pInfo->pFillSup, pInfo->pFillInfo);
|
||||||
if (pInfo->pFillInfo->needFill) {
|
if (pInfo->pFillInfo->needFill) {
|
||||||
doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
|
doStreamFillRange(pInfo->pFillInfo, pInfo->pFillSup, pInfo->pRes);
|
||||||
pInfo->pRes->info.groupId = range->groupId;
|
pInfo->pRes->info.id.groupId = range->groupId;
|
||||||
}
|
}
|
||||||
SWinKey key = {.ts = range->skey, .groupId = range->groupId};
|
SWinKey key = {.ts = range->skey, .groupId = range->groupId};
|
||||||
streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
|
streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &key);
|
||||||
|
@ -1399,9 +1421,13 @@ static void doDeleteFillResult(SOperatorInfo* pOperator) {
|
||||||
if (code == TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_SUCCESS) {
|
||||||
code = streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextLen);
|
code = streamStateGetGroupKVByCur(pCur, &nextKey, (const void**)&nextVal, &nextLen);
|
||||||
}
|
}
|
||||||
|
// ts will be deleted later
|
||||||
if (delTs != ts) {
|
if (delTs != ts) {
|
||||||
streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &delKey);
|
streamStateFillDel(pOperator->pTaskInfo->streamInfo.pState, &delKey);
|
||||||
|
streamStateFreeCur(pCur);
|
||||||
|
pCur = streamStateGetAndCheckCur(pOperator->pTaskInfo->streamInfo.pState, &nextKey);
|
||||||
}
|
}
|
||||||
|
endTs = nextKey.ts - 1;
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1435,7 +1461,7 @@ static void doApplyStreamScalarCalculation(SOperatorInfo* pOperator, SSDataBlock
|
||||||
pSup = &pInfo->pFillSup->notFillExprSup;
|
pSup = &pInfo->pFillSup->notFillExprSup;
|
||||||
setInputDataBlock(pSup, pSrcBlock, TSDB_ORDER_ASC, MAIN_SCAN, false);
|
setInputDataBlock(pSup, pSrcBlock, TSDB_ORDER_ASC, MAIN_SCAN, false);
|
||||||
projectApplyFunctions(pSup->pExprInfo, pDstBlock, pSrcBlock, pSup->pCtx, pSup->numOfExprs, NULL);
|
projectApplyFunctions(pSup->pExprInfo, pDstBlock, pSrcBlock, pSup->pCtx, pSup->numOfExprs, NULL);
|
||||||
pDstBlock->info.groupId = pSrcBlock->info.groupId;
|
pDstBlock->info.id.groupId = pSrcBlock->info.id.groupId;
|
||||||
|
|
||||||
blockDataUpdateTsWindow(pDstBlock, pInfo->primaryTsCol);
|
blockDataUpdateTsWindow(pDstBlock, pInfo->primaryTsCol);
|
||||||
}
|
}
|
||||||
|
@ -1715,9 +1741,9 @@ SOperatorInfo* createStreamFillOperatorInfo(SOperatorInfo* downstream, SStreamFi
|
||||||
}
|
}
|
||||||
|
|
||||||
pInfo->srcRowIndex = 0;
|
pInfo->srcRowIndex = 0;
|
||||||
setOperatorInfo(pOperator, "StreamFillOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, false, OP_NOT_OPENED, pInfo, pTaskInfo);
|
setOperatorInfo(pOperator, "StreamFillOperator", QUERY_NODE_PHYSICAL_PLAN_STREAM_FILL, false, OP_NOT_OPENED, pInfo,
|
||||||
pOperator->fpSet =
|
pTaskInfo);
|
||||||
createOperatorFpSet(operatorDummyOpenFn, doStreamFill, NULL, destroyStreamFillOperatorInfo, NULL);
|
pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doStreamFill, NULL, destroyStreamFillOperatorInfo, NULL);
|
||||||
|
|
||||||
code = appendDownstream(pOperator, &downstream, 1);
|
code = appendDownstream(pOperator, &downstream, 1);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
|
|
|
@ -655,7 +655,7 @@ static void doInterpUnclosedTimeWindow(SOperatorInfo* pOperatorInfo, int32_t num
|
||||||
|
|
||||||
SGroupKeys* pTsKey = taosArrayGet(pInfo->pPrevValues, 0);
|
SGroupKeys* pTsKey = taosArrayGet(pInfo->pPrevValues, 0);
|
||||||
int64_t prevTs = *(int64_t*)pTsKey->pData;
|
int64_t prevTs = *(int64_t*)pTsKey->pData;
|
||||||
if (groupId == pBlock->info.groupId) {
|
if (groupId == pBlock->info.id.groupId) {
|
||||||
doTimeWindowInterpolation(pInfo->pPrevValues, pBlock->pDataBlock, prevTs, -1, tsCols[startPos], startPos, w.ekey,
|
doTimeWindowInterpolation(pInfo->pPrevValues, pBlock->pDataBlock, prevTs, -1, tsCols[startPos], startPos, w.ekey,
|
||||||
RESULT_ROW_END_INTERP, pSup);
|
RESULT_ROW_END_INTERP, pSup);
|
||||||
}
|
}
|
||||||
|
@ -927,7 +927,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
|
||||||
int32_t startPos = 0;
|
int32_t startPos = 0;
|
||||||
int32_t numOfOutput = pSup->numOfExprs;
|
int32_t numOfOutput = pSup->numOfExprs;
|
||||||
int64_t* tsCols = extractTsCol(pBlock, pInfo);
|
int64_t* tsCols = extractTsCol(pBlock, pInfo);
|
||||||
uint64_t tableGroupId = pBlock->info.groupId;
|
uint64_t tableGroupId = pBlock->info.id.groupId;
|
||||||
bool ascScan = (pInfo->inputOrder == TSDB_ORDER_ASC);
|
bool ascScan = (pInfo->inputOrder == TSDB_ORDER_ASC);
|
||||||
TSKEY ts = getStartTsKey(&pBlock->info.window, tsCols);
|
TSKEY ts = getStartTsKey(&pBlock->info.window, tsCols);
|
||||||
SResultRow* pResult = NULL;
|
SResultRow* pResult = NULL;
|
||||||
|
@ -1112,7 +1112,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
|
||||||
SExprSupp* pSup = &pOperator->exprSupp;
|
SExprSupp* pSup = &pOperator->exprSupp;
|
||||||
|
|
||||||
SColumnInfoData* pStateColInfoData = taosArrayGet(pBlock->pDataBlock, pInfo->stateCol.slotId);
|
SColumnInfoData* pStateColInfoData = taosArrayGet(pBlock->pDataBlock, pInfo->stateCol.slotId);
|
||||||
int64_t gid = pBlock->info.groupId;
|
int64_t gid = pBlock->info.id.groupId;
|
||||||
|
|
||||||
bool masterScan = true;
|
bool masterScan = true;
|
||||||
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
||||||
|
@ -1829,7 +1829,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSessionAggOperator
|
||||||
|
|
||||||
bool masterScan = true;
|
bool masterScan = true;
|
||||||
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
||||||
int64_t gid = pBlock->info.groupId;
|
int64_t gid = pBlock->info.id.groupId;
|
||||||
|
|
||||||
int64_t gap = pInfo->gap;
|
int64_t gap = pInfo->gap;
|
||||||
|
|
||||||
|
@ -2333,7 +2333,7 @@ void doBuildResult(SOperatorInfo* pOperator, SStreamState* pState, SSDataBlock*
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the existed group id
|
// clear the existed group id
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.id.groupId = 0;
|
||||||
buildDataBlockFromGroupRes(pOperator, pState, pBlock, &pOperator->exprSupp, pGroupResInfo);
|
buildDataBlockFromGroupRes(pOperator, pState, pBlock, &pOperator->exprSupp, pGroupResInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2573,7 +2573,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL);
|
projectApplyFunctions(pExprSup->pExprInfo, pBlock, pBlock, pExprSup->pCtx, pExprSup->numOfExprs, NULL);
|
||||||
}
|
}
|
||||||
setInputDataBlock(pSup, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true);
|
setInputDataBlock(pSup, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true);
|
||||||
doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.groupId, pUpdatedMap);
|
doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pUpdatedMap);
|
||||||
if (IS_FINAL_OP(pInfo)) {
|
if (IS_FINAL_OP(pInfo)) {
|
||||||
int32_t chIndex = getChildIndex(pBlock);
|
int32_t chIndex = getChildIndex(pBlock);
|
||||||
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
int32_t size = taosArrayGetSize(pInfo->pChildren);
|
||||||
|
@ -2591,7 +2591,7 @@ static SSDataBlock* doStreamFinalIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, chIndex);
|
SOperatorInfo* pChildOp = taosArrayGetP(pInfo->pChildren, chIndex);
|
||||||
SStreamIntervalOperatorInfo* pChInfo = pChildOp->info;
|
SStreamIntervalOperatorInfo* pChInfo = pChildOp->info;
|
||||||
setInputDataBlock(&pChildOp->exprSupp, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true);
|
setInputDataBlock(&pChildOp->exprSupp, pBlock, TSDB_ORDER_ASC, MAIN_SCAN, true);
|
||||||
doStreamIntervalAggImpl(pChildOp, pBlock, pBlock->info.groupId, NULL);
|
doStreamIntervalAggImpl(pChildOp, pBlock, pBlock->info.id.groupId, NULL);
|
||||||
}
|
}
|
||||||
maxTs = TMAX(maxTs, pBlock->info.window.ekey);
|
maxTs = TMAX(maxTs, pBlock->info.window.ekey);
|
||||||
maxTs = TMAX(maxTs, pBlock->info.watermark);
|
maxTs = TMAX(maxTs, pBlock->info.watermark);
|
||||||
|
@ -3086,7 +3086,7 @@ static void doStreamSessionAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSData
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
|
SStreamSessionAggOperatorInfo* pInfo = pOperator->info;
|
||||||
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
||||||
uint64_t groupId = pSDataBlock->info.groupId;
|
uint64_t groupId = pSDataBlock->info.id.groupId;
|
||||||
int64_t code = TSDB_CODE_SUCCESS;
|
int64_t code = TSDB_CODE_SUCCESS;
|
||||||
SResultRow* pResult = NULL;
|
SResultRow* pResult = NULL;
|
||||||
int32_t rows = pSDataBlock->info.rows;
|
int32_t rows = pSDataBlock->info.rows;
|
||||||
|
@ -3377,7 +3377,7 @@ void doBuildSessionResult(SOperatorInfo* pOperator, SStreamState* pState, SGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the existed group id
|
// clear the existed group id
|
||||||
pBlock->info.groupId = 0;
|
pBlock->info.id.groupId = 0;
|
||||||
buildSessionResultDataBlock(pOperator, pState, pBlock, &pOperator->exprSupp, pGroupResInfo);
|
buildSessionResultDataBlock(pOperator, pState, pBlock, &pOperator->exprSupp, pGroupResInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3854,7 +3854,7 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl
|
||||||
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
|
||||||
SStreamStateAggOperatorInfo* pInfo = pOperator->info;
|
SStreamStateAggOperatorInfo* pInfo = pOperator->info;
|
||||||
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
|
||||||
int64_t groupId = pSDataBlock->info.groupId;
|
int64_t groupId = pSDataBlock->info.id.groupId;
|
||||||
int64_t code = TSDB_CODE_SUCCESS;
|
int64_t code = TSDB_CODE_SUCCESS;
|
||||||
TSKEY* tsCols = NULL;
|
TSKEY* tsCols = NULL;
|
||||||
SResultRow* pResult = NULL;
|
SResultRow* pResult = NULL;
|
||||||
|
@ -4178,7 +4178,7 @@ static void doMergeAlignedIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultR
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanupAfterGroupResultGen(SMergeAlignedIntervalAggOperatorInfo* pMiaInfo, SSDataBlock* pRes) {
|
static void cleanupAfterGroupResultGen(SMergeAlignedIntervalAggOperatorInfo* pMiaInfo, SSDataBlock* pRes) {
|
||||||
pRes->info.groupId = pMiaInfo->groupId;
|
pRes->info.id.groupId = pMiaInfo->groupId;
|
||||||
pMiaInfo->curTs = INT64_MIN;
|
pMiaInfo->curTs = INT64_MIN;
|
||||||
pMiaInfo->groupId = 0;
|
pMiaInfo->groupId = 0;
|
||||||
}
|
}
|
||||||
|
@ -4203,7 +4203,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
pBlock = pMiaInfo->prefetchedBlock;
|
pBlock = pMiaInfo->prefetchedBlock;
|
||||||
pMiaInfo->prefetchedBlock = NULL;
|
pMiaInfo->prefetchedBlock = NULL;
|
||||||
|
|
||||||
pMiaInfo->groupId = pBlock->info.groupId;
|
pMiaInfo->groupId = pBlock->info.id.groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no data exists, all query processing is done
|
// no data exists, all query processing is done
|
||||||
|
@ -4220,12 +4220,12 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMiaInfo->groupId == 0) {
|
if (pMiaInfo->groupId == 0) {
|
||||||
if (pMiaInfo->groupId != pBlock->info.groupId) {
|
if (pMiaInfo->groupId != pBlock->info.id.groupId) {
|
||||||
pMiaInfo->groupId = pBlock->info.groupId;
|
pMiaInfo->groupId = pBlock->info.id.groupId;
|
||||||
pRes->info.groupId = pMiaInfo->groupId;
|
pRes->info.id.groupId = pMiaInfo->groupId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pMiaInfo->groupId != pBlock->info.groupId) {
|
if (pMiaInfo->groupId != pBlock->info.id.groupId) {
|
||||||
// if there are unclosed time window, close it firstly.
|
// if there are unclosed time window, close it firstly.
|
||||||
ASSERT(pMiaInfo->curTs != INT64_MIN);
|
ASSERT(pMiaInfo->curTs != INT64_MIN);
|
||||||
finalizeResultRows(pIaInfo->aggSup.pResultBuf, &pResultRowInfo->cur, pSup, pRes, pTaskInfo);
|
finalizeResultRows(pIaInfo->aggSup.pResultBuf, &pResultRowInfo->cur, pSup, pRes, pTaskInfo);
|
||||||
|
@ -4236,7 +4236,7 @@ static void doMergeAlignedIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// continue
|
// continue
|
||||||
pRes->info.groupId = pMiaInfo->groupId;
|
pRes->info.id.groupId = pMiaInfo->groupId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4443,7 +4443,7 @@ static void doMergeIntervalAggImpl(SOperatorInfo* pOperatorInfo, SResultRowInfo*
|
||||||
int32_t startPos = 0;
|
int32_t startPos = 0;
|
||||||
int32_t numOfOutput = pExprSup->numOfExprs;
|
int32_t numOfOutput = pExprSup->numOfExprs;
|
||||||
int64_t* tsCols = extractTsCol(pBlock, iaInfo);
|
int64_t* tsCols = extractTsCol(pBlock, iaInfo);
|
||||||
uint64_t tableGroupId = pBlock->info.groupId;
|
uint64_t tableGroupId = pBlock->info.id.groupId;
|
||||||
bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC);
|
bool ascScan = (iaInfo->inputOrder == TSDB_ORDER_ASC);
|
||||||
TSKEY blockStartTs = getStartTsKey(&pBlock->info.window, tsCols);
|
TSKEY blockStartTs = getStartTsKey(&pBlock->info.window, tsCols);
|
||||||
SResultRow* pResult = NULL;
|
SResultRow* pResult = NULL;
|
||||||
|
@ -4549,7 +4549,7 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
pBlock = downstream->fpSet.getNextFn(downstream);
|
pBlock = downstream->fpSet.getNextFn(downstream);
|
||||||
} else {
|
} else {
|
||||||
pBlock = miaInfo->prefetchedBlock;
|
pBlock = miaInfo->prefetchedBlock;
|
||||||
miaInfo->groupId = pBlock->info.groupId;
|
miaInfo->groupId = pBlock->info.id.groupId;
|
||||||
miaInfo->prefetchedBlock = NULL;
|
miaInfo->prefetchedBlock = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4561,8 +4561,8 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
if (!miaInfo->hasGroupId) {
|
if (!miaInfo->hasGroupId) {
|
||||||
miaInfo->hasGroupId = true;
|
miaInfo->hasGroupId = true;
|
||||||
miaInfo->groupId = pBlock->info.groupId;
|
miaInfo->groupId = pBlock->info.id.groupId;
|
||||||
} else if (miaInfo->groupId != pBlock->info.groupId) {
|
} else if (miaInfo->groupId != pBlock->info.id.groupId) {
|
||||||
miaInfo->prefetchedBlock = pBlock;
|
miaInfo->prefetchedBlock = pBlock;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4576,7 +4576,7 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pRes->info.groupId = miaInfo->groupId;
|
pRes->info.id.groupId = miaInfo->groupId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (miaInfo->inputBlocksFinished) {
|
if (miaInfo->inputBlocksFinished) {
|
||||||
|
@ -4585,7 +4585,7 @@ static SSDataBlock* doMergeIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
if (listNode != NULL) {
|
if (listNode != NULL) {
|
||||||
SGroupTimeWindow* grpWin = (SGroupTimeWindow*)(listNode->data);
|
SGroupTimeWindow* grpWin = (SGroupTimeWindow*)(listNode->data);
|
||||||
// finalizeWindowResult(pOperator, grpWin->groupId, &grpWin->window, pRes);
|
// finalizeWindowResult(pOperator, grpWin->groupId, &grpWin->window, pRes);
|
||||||
pRes->info.groupId = grpWin->groupId;
|
pRes->info.id.groupId = grpWin->groupId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4744,7 +4744,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) {
|
||||||
maxTs = TMAX(maxTs, pBlock->info.window.ekey);
|
maxTs = TMAX(maxTs, pBlock->info.window.ekey);
|
||||||
minTs = TMIN(minTs, pBlock->info.window.skey);
|
minTs = TMIN(minTs, pBlock->info.window.skey);
|
||||||
|
|
||||||
doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.groupId, pUpdatedMap);
|
doStreamIntervalAggImpl(pOperator, pBlock, pBlock->info.id.groupId, pUpdatedMap);
|
||||||
}
|
}
|
||||||
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs);
|
pInfo->twAggSup.maxTs = TMAX(pInfo->twAggSup.maxTs, maxTs);
|
||||||
pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, minTs);
|
pInfo->twAggSup.minTs = TMIN(pInfo->twAggSup.minTs, minTs);
|
||||||
|
|
|
@ -116,7 +116,10 @@ void tsortClearOrderdSource(SArray *pOrderedSource) {
|
||||||
if (NULL == *pSource) {
|
if (NULL == *pSource) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// release pageIdList
|
||||||
|
if ((*pSource)->pageIdList) {
|
||||||
|
taosArrayDestroy((*pSource)->pageIdList);
|
||||||
|
}
|
||||||
if ((*pSource)->param && !(*pSource)->onlyRef) {
|
if ((*pSource)->param && !(*pSource)->onlyRef) {
|
||||||
taosMemoryFree((*pSource)->param);
|
taosMemoryFree((*pSource)->param);
|
||||||
}
|
}
|
||||||
|
@ -417,8 +420,8 @@ int32_t msortComparFn(const void* pLeft, const void* pRight, void* param) {
|
||||||
SSDataBlock* pRightBlock = pRightSource->src.pBlock;
|
SSDataBlock* pRightBlock = pRightSource->src.pBlock;
|
||||||
|
|
||||||
if (pParam->cmpGroupId) {
|
if (pParam->cmpGroupId) {
|
||||||
if (pLeftBlock->info.groupId != pRightBlock->info.groupId) {
|
if (pLeftBlock->info.id.groupId != pRightBlock->info.id.groupId) {
|
||||||
return pLeftBlock->info.groupId < pRightBlock->info.groupId ? -1 : 1;
|
return pLeftBlock->info.id.groupId < pRightBlock->info.id.groupId ? -1 : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -826,7 +829,7 @@ void* tsortGetValue(STupleHandle* pVHandle, int32_t colIndex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t tsortGetGroupId(STupleHandle* pVHandle) { return pVHandle->pBlock->info.groupId; }
|
uint64_t tsortGetGroupId(STupleHandle* pVHandle) { return pVHandle->pBlock->info.id.groupId; }
|
||||||
|
|
||||||
SSortExecInfo tsortGetSortExecInfo(SSortHandle* pHandle) {
|
SSortExecInfo tsortGetSortExecInfo(SSortHandle* pHandle) {
|
||||||
SSortExecInfo info = {0};
|
SSortExecInfo info = {0};
|
||||||
|
|
|
@ -1499,7 +1499,7 @@ int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
|
|
||||||
param12 /= param[1][1];
|
param12 /= param[1][1];
|
||||||
|
|
||||||
char buf[64] = {0};
|
char buf[512] = {0};
|
||||||
size_t len =
|
size_t len =
|
||||||
snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{slop:%.6lf, intercept:%.6lf}", param02, param12);
|
snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{slop:%.6lf, intercept:%.6lf}", param02, param12);
|
||||||
varDataSetLen(buf, len);
|
varDataSetLen(buf, len);
|
||||||
|
@ -3613,6 +3613,7 @@ bool histogramFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultIn
|
||||||
char* binDesc = strndup(varDataVal(pCtx->param[2].param.pz), varDataLen(pCtx->param[2].param.pz));
|
char* binDesc = strndup(varDataVal(pCtx->param[2].param.pz), varDataLen(pCtx->param[2].param.pz));
|
||||||
int64_t normalized = pCtx->param[3].param.i;
|
int64_t normalized = pCtx->param[3].param.i;
|
||||||
if (normalized != 0 && normalized != 1) {
|
if (normalized != 0 && normalized != 1) {
|
||||||
|
taosMemoryFree(binDesc);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!getHistogramBinDesc(pInfo, binDesc, binType, (bool)normalized)) {
|
if (!getHistogramBinDesc(pInfo, binDesc, binType, (bool)normalized)) {
|
||||||
|
|
|
@ -1096,7 +1096,7 @@ int32_t udfAggProcess(struct SqlFunctionCtx *pCtx) {
|
||||||
|
|
||||||
SSDataBlock *pTempBlock = createDataBlock();
|
SSDataBlock *pTempBlock = createDataBlock();
|
||||||
pTempBlock->info.rows = pInput->totalRows;
|
pTempBlock->info.rows = pInput->totalRows;
|
||||||
pTempBlock->info.uid = pInput->uid;
|
pTempBlock->info.id.uid = pInput->uid;
|
||||||
for (int32_t i = 0; i < numOfCols; ++i) {
|
for (int32_t i = 0; i < numOfCols; ++i) {
|
||||||
blockDataAppendColInfo(pTempBlock, pInput->pData[i]);
|
blockDataAppendColInfo(pTempBlock, pInput->pData[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ void sifAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *sl
|
||||||
blockDataEnsureCapacity(res, rows);
|
blockDataEnsureCapacity(res, rows);
|
||||||
|
|
||||||
*dataBlockId = taosArrayGetSize(pBlockList) - 1;
|
*dataBlockId = taosArrayGetSize(pBlockList) - 1;
|
||||||
res->info.blockId = *dataBlockId;
|
res->info.id.blockId = *dataBlockId;
|
||||||
*slotId = 0;
|
*slotId = 0;
|
||||||
} else {
|
} else {
|
||||||
SSDataBlock *res = *(SSDataBlock **)taosArrayGetLast(pBlockList);
|
SSDataBlock *res = *(SSDataBlock **)taosArrayGetLast(pBlockList);
|
||||||
|
|
|
@ -36,7 +36,7 @@ void monRecordLog(int64_t ts, ELogLevel level, const char *content) {
|
||||||
|
|
||||||
int32_t monGetLogs(SMonLogs *logs) {
|
int32_t monGetLogs(SMonLogs *logs) {
|
||||||
taosThreadMutexLock(&tsMonitor.lock);
|
taosThreadMutexLock(&tsMonitor.lock);
|
||||||
logs->logs = taosArrayDup(tsMonitor.logs);
|
logs->logs = taosArrayDup(tsMonitor.logs, NULL);
|
||||||
logs->numOfInfoLogs = tsNumOfInfoLogs;
|
logs->numOfInfoLogs = tsNumOfInfoLogs;
|
||||||
logs->numOfErrorLogs = tsNumOfErrorLogs;
|
logs->numOfErrorLogs = tsNumOfErrorLogs;
|
||||||
logs->numOfDebugLogs = tsNumOfDebugLogs;
|
logs->numOfDebugLogs = tsNumOfDebugLogs;
|
||||||
|
|
|
@ -654,7 +654,7 @@ cgroup_name(A) ::= NK_ID(B).
|
||||||
|
|
||||||
/************************************************ expression **********************************************************/
|
/************************************************ expression **********************************************************/
|
||||||
expr_or_subquery(A) ::= expression(B). { A = B; }
|
expr_or_subquery(A) ::= expression(B). { A = B; }
|
||||||
expr_or_subquery(A) ::= subquery(B). { A = B; }
|
//expr_or_subquery(A) ::= subquery(B). { A = createTempTableNode(pCxt, releaseRawExprNode(pCxt, B), NULL); }
|
||||||
|
|
||||||
expression(A) ::= literal(B). { A = B; }
|
expression(A) ::= literal(B). { A = B; }
|
||||||
expression(A) ::= pseudo_column(B). { A = B; }
|
expression(A) ::= pseudo_column(B). { A = B; }
|
||||||
|
|
|
@ -1407,7 +1407,7 @@ SNode* createShowTableTagsStmt(SAstCreateContext* pCxt, SNode* pTbName, SNode* p
|
||||||
|
|
||||||
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) {
|
SNode* createCreateUserStmt(SAstCreateContext* pCxt, SToken* pUserName, const SToken* pPassword, int8_t sysinfo) {
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
char password[TSDB_USET_PASSWORD_LEN] = {0};
|
char password[TSDB_USET_PASSWORD_LEN + 3] = {0};
|
||||||
if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) {
|
if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ static int32_t calcConstStmtCondition(SCalcConstContext* pCxt, SNode** pCond, bo
|
||||||
static int32_t calcConstProject(SNode* pProject, bool dual, SNode** pNew) {
|
static int32_t calcConstProject(SNode* pProject, bool dual, SNode** pNew) {
|
||||||
SArray* pAssociation = NULL;
|
SArray* pAssociation = NULL;
|
||||||
if (NULL != ((SExprNode*)pProject)->pAssociation) {
|
if (NULL != ((SExprNode*)pProject)->pAssociation) {
|
||||||
pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation);
|
pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation, NULL);
|
||||||
if (NULL == pAssociation) {
|
if (NULL == pAssociation) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -372,14 +372,42 @@ static bool isEmptyResultQuery(SNode* pStmt) {
|
||||||
return isEmptyResult;
|
return isEmptyResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void resetProjectNullTypeImpl(SNodeList* pProjects) {
|
||||||
|
SNode* pProj = NULL;
|
||||||
|
FOREACH(pProj, pProjects) {
|
||||||
|
SExprNode* pExpr = (SExprNode*)pProj;
|
||||||
|
if (TSDB_DATA_TYPE_NULL == pExpr->resType.type) {
|
||||||
|
pExpr->resType.type = TSDB_DATA_TYPE_VARCHAR;
|
||||||
|
pExpr->resType.bytes = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void resetProjectNullType(SNode* pStmt) {
|
||||||
|
switch (nodeType(pStmt)) {
|
||||||
|
case QUERY_NODE_SELECT_STMT:
|
||||||
|
resetProjectNullTypeImpl(((SSelectStmt*)pStmt)->pProjectionList);
|
||||||
|
break;
|
||||||
|
case QUERY_NODE_SET_OPERATOR: {
|
||||||
|
resetProjectNullTypeImpl(((SSetOperator*)pStmt)->pProjectionList);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery) {
|
int32_t calculateConstant(SParseContext* pParseCxt, SQuery* pQuery) {
|
||||||
SCalcConstContext cxt = {.pParseCxt = pParseCxt,
|
SCalcConstContext cxt = {.pParseCxt = pParseCxt,
|
||||||
.msgBuf.buf = pParseCxt->pMsg,
|
.msgBuf.buf = pParseCxt->pMsg,
|
||||||
.msgBuf.len = pParseCxt->msgLen,
|
.msgBuf.len = pParseCxt->msgLen,
|
||||||
.code = TSDB_CODE_SUCCESS};
|
.code = TSDB_CODE_SUCCESS};
|
||||||
int32_t code = calcConstQuery(&cxt, pQuery->pRoot, false);
|
int32_t code = calcConstQuery(&cxt, pQuery->pRoot, false);
|
||||||
if (TSDB_CODE_SUCCESS == code && isEmptyResultQuery(pQuery->pRoot)) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
resetProjectNullType(pQuery->pRoot);
|
||||||
|
if (isEmptyResultQuery(pQuery->pRoot)) {
|
||||||
pQuery->execMode = QUERY_EXEC_MODE_EMPTY_RESULT;
|
pQuery->execMode = QUERY_EXEC_MODE_EMPTY_RESULT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1529,9 +1529,7 @@ static int32_t setStmtInfo(SInsertParseContext* pCxt, SVnodeModifOpStmt* pStmt)
|
||||||
memcpy(tags, &pCxt->tags, sizeof(pCxt->tags));
|
memcpy(tags, &pCxt->tags, sizeof(pCxt->tags));
|
||||||
|
|
||||||
SStmtCallback* pStmtCb = pCxt->pComCxt->pStmtCb;
|
SStmtCallback* pStmtCb = pCxt->pComCxt->pStmtCb;
|
||||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
int32_t code = (*pStmtCb->setInfoFn)(pStmtCb->pStmt, pStmt->pTableMeta, tags, &pStmt->targetTableName, pStmt->usingTableProcessing,
|
||||||
tNameExtractFullName(&pStmt->targetTableName, tbFName);
|
|
||||||
int32_t code = (*pStmtCb->setInfoFn)(pStmtCb->pStmt, pStmt->pTableMeta, tags, tbFName, pStmt->usingTableProcessing,
|
|
||||||
pStmt->pVgroupsHashObj, pStmt->pTableBlockHashObj, pStmt->usingTableName.tname);
|
pStmt->pVgroupsHashObj, pStmt->pTableBlockHashObj, pStmt->usingTableName.tname);
|
||||||
|
|
||||||
memset(&pCxt->tags, 0, sizeof(pCxt->tags));
|
memset(&pCxt->tags, 0, sizeof(pCxt->tags));
|
||||||
|
|
|
@ -857,7 +857,7 @@ void insBuildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTag, i
|
||||||
pTbReq->ctb.tagNum = tagNum;
|
pTbReq->ctb.tagNum = tagNum;
|
||||||
if (sname) pTbReq->ctb.stbName = strdup(sname);
|
if (sname) pTbReq->ctb.stbName = strdup(sname);
|
||||||
pTbReq->ctb.pTag = (uint8_t*)pTag;
|
pTbReq->ctb.pTag = (uint8_t*)pTag;
|
||||||
pTbReq->ctb.tagName = taosArrayDup(tagName);
|
pTbReq->ctb.tagName = taosArrayDup(tagName, NULL);
|
||||||
pTbReq->ttl = TSDB_DEFAULT_TABLE_TTL;
|
pTbReq->ttl = TSDB_DEFAULT_TABLE_TTL;
|
||||||
pTbReq->commentLen = -1;
|
pTbReq->commentLen = -1;
|
||||||
|
|
||||||
|
|
|
@ -6625,7 +6625,7 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, S
|
||||||
req.ctb.tagNum = tagNum;
|
req.ctb.tagNum = tagNum;
|
||||||
req.ctb.stbName = strdup(sTableNmae);
|
req.ctb.stbName = strdup(sTableNmae);
|
||||||
req.ctb.pTag = (uint8_t*)pTag;
|
req.ctb.pTag = (uint8_t*)pTag;
|
||||||
req.ctb.tagName = taosArrayDup(tagName);
|
req.ctb.tagName = taosArrayDup(tagName, NULL);
|
||||||
if (pStmt->ignoreExists) {
|
if (pStmt->ignoreExists) {
|
||||||
req.flags |= TD_CREATE_IF_NOT_EXISTS;
|
req.flags |= TD_CREATE_IF_NOT_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -844,7 +844,7 @@ int32_t getDbVgInfoFromCache(SParseMetaCache* pMetaCache, const char* pDbFName,
|
||||||
int32_t code = getMetaDataFromHash(pDbFName, strlen(pDbFName), pMetaCache->pDbVgroup, (void**)&pVgList);
|
int32_t code = getMetaDataFromHash(pDbFName, strlen(pDbFName), pMetaCache->pDbVgroup, (void**)&pVgList);
|
||||||
// pVgList is null, which is a legal value, indicating that the user DB has not been created
|
// pVgList is null, which is a legal value, indicating that the user DB has not been created
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pVgList) {
|
if (TSDB_CODE_SUCCESS == code && NULL != pVgList) {
|
||||||
*pVgInfo = taosArrayDup(pVgList);
|
*pVgInfo = taosArrayDup(pVgList, NULL);
|
||||||
if (NULL == *pVgInfo) {
|
if (NULL == *pVgInfo) {
|
||||||
code = TSDB_CODE_OUT_OF_MEMORY;
|
code = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -961,7 +961,7 @@ int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFun
|
||||||
static void destroySmaIndex(void* p) { taosMemoryFree(((STableIndexInfo*)p)->expr); }
|
static void destroySmaIndex(void* p) { taosMemoryFree(((STableIndexInfo*)p)->expr); }
|
||||||
|
|
||||||
static SArray* smaIndexesDup(SArray* pSrc) {
|
static SArray* smaIndexesDup(SArray* pSrc) {
|
||||||
SArray* pDst = taosArrayDup(pSrc);
|
SArray* pDst = taosArrayDup(pSrc, NULL);
|
||||||
if (NULL == pDst) {
|
if (NULL == pDst) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1011,7 +1011,7 @@ STableCfg* tableCfgDup(STableCfg* pCfg) {
|
||||||
memcpy(pNew->pComment, pCfg->pComment, pNew->commentLen);
|
memcpy(pNew->pComment, pCfg->pComment, pNew->commentLen);
|
||||||
}
|
}
|
||||||
if (NULL != pNew->pFuncs) {
|
if (NULL != pNew->pFuncs) {
|
||||||
pNew->pFuncs = taosArrayDup(pNew->pFuncs);
|
pNew->pFuncs = taosArrayDup(pNew->pFuncs, NULL);
|
||||||
}
|
}
|
||||||
if (NULL != pNew->pTags) {
|
if (NULL != pNew->pTags) {
|
||||||
pNew->pTags = taosMemoryCalloc(pNew->tagsLen + 1, 1);
|
pNew->pTags = taosMemoryCalloc(pNew->tagsLen + 1, 1);
|
||||||
|
@ -1053,7 +1053,7 @@ int32_t getDnodeListFromCache(SParseMetaCache* pMetaCache, SArray** pDnodes) {
|
||||||
return pRes->code;
|
return pRes->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pDnodes = taosArrayDup((SArray*)pRes->pRes);
|
*pDnodes = taosArrayDup((SArray*)pRes->pRes, NULL);
|
||||||
if (NULL == *pDnodes) {
|
if (NULL == *pDnodes) {
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -580,15 +580,19 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect,
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the output
|
// set the output
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pOutputGroupKeys) {
|
|
||||||
code = createColumnByRewriteExprs(pOutputGroupKeys, &pAgg->node.pTargets);
|
|
||||||
}
|
|
||||||
nodesDestroyList(pOutputGroupKeys);
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code && NULL != pAgg->pAggFuncs) {
|
if (TSDB_CODE_SUCCESS == code && NULL != pAgg->pAggFuncs) {
|
||||||
code = createColumnByRewriteExprs(pAgg->pAggFuncs, &pAgg->node.pTargets);
|
code = createColumnByRewriteExprs(pAgg->pAggFuncs, &pAgg->node.pTargets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
if (NULL != pOutputGroupKeys) {
|
||||||
|
code = createColumnByRewriteExprs(pOutputGroupKeys, &pAgg->node.pTargets);
|
||||||
|
} else if (NULL == pAgg->node.pTargets && NULL != pAgg->pGroupKeys) {
|
||||||
|
code = createColumnByRewriteExprs(pAgg->pGroupKeys, &pAgg->node.pTargets);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodesDestroyList(pOutputGroupKeys);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
*pLogicNode = (SLogicNode*)pAgg;
|
*pLogicNode = (SLogicNode*)pAgg;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -378,7 +378,7 @@ int32_t sclInitParam(SNode *node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
for (int32_t i = 0; i < taosArrayGetSize(ctx->pBlockList); ++i) {
|
for (int32_t i = 0; i < taosArrayGetSize(ctx->pBlockList); ++i) {
|
||||||
SSDataBlock *pb = taosArrayGetP(ctx->pBlockList, i);
|
SSDataBlock *pb = taosArrayGetP(ctx->pBlockList, i);
|
||||||
if (pb->info.blockId == ref->dataBlockId) {
|
if (pb->info.id.blockId == ref->dataBlockId) {
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1384,7 +1384,7 @@ EDealRes sclWalkTarget(SNode *pNode, SScalarCtx *ctx) {
|
||||||
int32_t index = -1;
|
int32_t index = -1;
|
||||||
for (int32_t i = 0; i < taosArrayGetSize(ctx->pBlockList); ++i) {
|
for (int32_t i = 0; i < taosArrayGetSize(ctx->pBlockList); ++i) {
|
||||||
SSDataBlock *pb = taosArrayGetP(ctx->pBlockList, i);
|
SSDataBlock *pb = taosArrayGetP(ctx->pBlockList, i);
|
||||||
if (pb->info.blockId == target->dataBlockId) {
|
if (pb->info.id.blockId == target->dataBlockId) {
|
||||||
index = i;
|
index = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1543,8 +1543,10 @@ void vectorBitOr(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut,
|
||||||
int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t startIndex,
|
int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarParam *pOut, int32_t startIndex,
|
||||||
int32_t numOfRows, int32_t step, __compar_fn_t fp, int32_t optr) {
|
int32_t numOfRows, int32_t step, __compar_fn_t fp, int32_t optr) {
|
||||||
int32_t num = 0;
|
int32_t num = 0;
|
||||||
|
bool * pRes = (bool *)pOut->columnData->pData;
|
||||||
|
|
||||||
for (int32_t i = startIndex; i < numOfRows && i >= 0; i += step) {
|
if (GET_PARAM_TYPE(pLeft) == TSDB_DATA_TYPE_JSON || GET_PARAM_TYPE(pRight) == TSDB_DATA_TYPE_JSON) {
|
||||||
|
for (int32_t i = startIndex; i < numOfRows && i >= startIndex; i += step) {
|
||||||
int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i;
|
int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i;
|
||||||
int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i;
|
int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i;
|
||||||
|
|
||||||
|
@ -1554,8 +1556,8 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pLeftData = colDataGetData(pLeft->columnData, leftIndex);
|
char * pLeftData = colDataGetData(pLeft->columnData, leftIndex);
|
||||||
char *pRightData = colDataGetData(pRight->columnData, rightIndex);
|
char * pRightData = colDataGetData(pRight->columnData, rightIndex);
|
||||||
int64_t leftOut = 0;
|
int64_t leftOut = 0;
|
||||||
int64_t rightOut = 0;
|
int64_t rightOut = 0;
|
||||||
bool freeLeft = false;
|
bool freeLeft = false;
|
||||||
|
@ -1590,6 +1592,26 @@ int32_t doVectorCompareImpl(SScalarParam *pLeft, SScalarParam *pRight, SScalarPa
|
||||||
taosMemoryFreeClear(pRightData);
|
taosMemoryFreeClear(pRightData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (int32_t i = startIndex; i < numOfRows && i >= 0; i += step) {
|
||||||
|
int32_t leftIndex = (i >= pLeft->numOfRows) ? 0 : i;
|
||||||
|
int32_t rightIndex = (i >= pRight->numOfRows) ? 0 : i;
|
||||||
|
|
||||||
|
if (colDataIsNull_s(pLeft->columnData, leftIndex) ||
|
||||||
|
colDataIsNull_s(pRight->columnData, rightIndex)) {
|
||||||
|
pRes[i] = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *pLeftData = colDataGetData(pLeft->columnData, leftIndex);
|
||||||
|
char *pRightData = colDataGetData(pRight->columnData, rightIndex);
|
||||||
|
|
||||||
|
pRes[i] = filterDoCompare(fp, optr, pLeftData, pRightData);
|
||||||
|
if (pRes[i]) {
|
||||||
|
++num;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ void scltAppendReservedSlot(SArray *pBlockList, int16_t *dataBlockId, int16_t *s
|
||||||
|
|
||||||
taosArrayPush(pBlockList, &res);
|
taosArrayPush(pBlockList, &res);
|
||||||
*dataBlockId = taosArrayGetSize(pBlockList) - 1;
|
*dataBlockId = taosArrayGetSize(pBlockList) - 1;
|
||||||
res->info.blockId = *dataBlockId;
|
res->info.id.blockId = *dataBlockId;
|
||||||
*slotId = 0;
|
*slotId = 0;
|
||||||
} else {
|
} else {
|
||||||
SSDataBlock *res = *(SSDataBlock **)taosArrayGetLast(pBlockList);
|
SSDataBlock *res = *(SSDataBlock **)taosArrayGetLast(pBlockList);
|
||||||
|
|
|
@ -721,7 +721,7 @@ int32_t schInitJob(int64_t *pJobId, SSchedulerReq *pReq) {
|
||||||
if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) {
|
if (pReq->pNodeList == NULL || taosArrayGetSize(pReq->pNodeList) <= 0) {
|
||||||
qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId);
|
qDebug("QID:0x%" PRIx64 " input exec nodeList is empty", pReq->pDag->queryId);
|
||||||
} else {
|
} else {
|
||||||
pJob->nodeList = taosArrayDup(pReq->pNodeList);
|
pJob->nodeList = taosArrayDup(pReq->pNodeList, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
pJob->taskList = taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false,
|
pJob->taskList = taosHashInit(pReq->pDag->numOfSubplans, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UBIGINT), false,
|
||||||
|
|
|
@ -463,7 +463,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streamSearchAndAddBlock(pTask, pReqs, pDataBlock, vgSz, pDataBlock->info.groupId) < 0) {
|
if (streamSearchAndAddBlock(pTask, pReqs, pDataBlock, vgSz, pDataBlock->info.id.groupId) < 0) {
|
||||||
goto FAIL_SHUFFLE_DISPATCH;
|
goto FAIL_SHUFFLE_DISPATCH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ bool updateInfoIsTableInserted(SUpdateInfo *pInfo, int64_t tbUid) {
|
||||||
TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol) {
|
TSKEY updateInfoFillBlockData(SUpdateInfo *pInfo, SSDataBlock *pBlock, int32_t primaryTsCol) {
|
||||||
if (pBlock == NULL || pBlock->info.rows == 0) return INT64_MIN;
|
if (pBlock == NULL || pBlock->info.rows == 0) return INT64_MIN;
|
||||||
TSKEY maxTs = INT64_MIN;
|
TSKEY maxTs = INT64_MIN;
|
||||||
int64_t tbUid = pBlock->info.uid;
|
int64_t tbUid = pBlock->info.id.uid;
|
||||||
|
|
||||||
SColumnInfoData *pColDataInfo = taosArrayGet(pBlock->pDataBlock, primaryTsCol);
|
SColumnInfoData *pColDataInfo = taosArrayGet(pBlock->pDataBlock, primaryTsCol);
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,10 @@ typedef struct SSyncNode {
|
||||||
int64_t leaderTime;
|
int64_t leaderTime;
|
||||||
int64_t lastReplicateTime;
|
int64_t lastReplicateTime;
|
||||||
|
|
||||||
|
int32_t electNum;
|
||||||
|
int32_t becomeLeaderNum;
|
||||||
|
int32_t configChangeNum;
|
||||||
|
|
||||||
bool isStart;
|
bool isStart;
|
||||||
|
|
||||||
} SSyncNode;
|
} SSyncNode;
|
||||||
|
|
|
@ -205,9 +205,11 @@ int32_t syncNodeOnAppendEntries(SSyncNode* ths, const SRpcMsg* pRpcMsg) {
|
||||||
pLocalEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, hLocal);
|
pLocalEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, hLocal);
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
|
ths->pLogStore->cacheHit++;
|
||||||
sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", appendIndex, pLocalEntry->bytes, pLocalEntry);
|
sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", appendIndex, pLocalEntry->bytes, pLocalEntry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
ths->pLogStore->cacheMiss++;
|
||||||
sNTrace(ths, "miss cache index:%" PRId64, appendIndex);
|
sNTrace(ths, "miss cache index:%" PRId64, appendIndex);
|
||||||
|
|
||||||
code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, appendIndex, &pLocalEntry);
|
code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, appendIndex, &pLocalEntry);
|
||||||
|
|
|
@ -117,9 +117,11 @@ void syncMaybeAdvanceCommitIndex(SSyncNode* pSyncNode) {
|
||||||
if (h) {
|
if (h) {
|
||||||
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
||||||
|
|
||||||
|
pSyncNode->pLogStore->cacheHit++;
|
||||||
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", index, pEntry->bytes, pEntry);
|
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", index, pEntry->bytes, pEntry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
pSyncNode->pLogStore->cacheMiss++;
|
||||||
sNTrace(pSyncNode, "miss cache index:%" PRId64, index);
|
sNTrace(pSyncNode, "miss cache index:%" PRId64, index);
|
||||||
|
|
||||||
int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index, &pEntry);
|
int32_t code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, index, &pEntry);
|
||||||
|
|
|
@ -61,7 +61,8 @@ static int32_t syncNodeRequestVotePeers(SSyncNode* pNode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t syncNodeElect(SSyncNode* pSyncNode) {
|
int32_t syncNodeElect(SSyncNode* pSyncNode) {
|
||||||
sNTrace(pSyncNode, "begin election");
|
sNInfo(pSyncNode, "begin election");
|
||||||
|
pSyncNode->electNum++;
|
||||||
|
|
||||||
int32_t ret = 0;
|
int32_t ret = 0;
|
||||||
if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) {
|
if (pSyncNode->state == TAOS_SYNC_STATE_FOLLOWER) {
|
||||||
|
@ -98,7 +99,6 @@ int32_t syncNodeElect(SSyncNode* pSyncNode) {
|
||||||
syncNodeCandidate2Leader(pSyncNode);
|
syncNodeCandidate2Leader(pSyncNode);
|
||||||
pSyncNode->pVotesGranted->toLeader = true;
|
pSyncNode->pVotesGranted->toLeader = true;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = syncNodeRequestVotePeers(pSyncNode);
|
ret = syncNodeRequestVotePeers(pSyncNode);
|
||||||
|
|
|
@ -410,9 +410,11 @@ bool syncIsReadyForRead(int64_t rid) {
|
||||||
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
|
pSyncNode->pLogStore->cacheHit++;
|
||||||
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", lastIndex, pEntry->bytes, pEntry);
|
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", lastIndex, pEntry->bytes, pEntry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
pSyncNode->pLogStore->cacheMiss++;
|
||||||
sNTrace(pSyncNode, "miss cache index:%" PRId64, lastIndex);
|
sNTrace(pSyncNode, "miss cache index:%" PRId64, lastIndex);
|
||||||
|
|
||||||
code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, lastIndex, &pEntry);
|
code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, lastIndex, &pEntry);
|
||||||
|
@ -1008,6 +1010,10 @@ SSyncNode* syncNodeOpen(SSyncInfo* pSyncInfo) {
|
||||||
atomic_store_64(&pSyncNode->snapshottingIndex, SYNC_INDEX_INVALID);
|
atomic_store_64(&pSyncNode->snapshottingIndex, SYNC_INDEX_INVALID);
|
||||||
|
|
||||||
pSyncNode->isStart = true;
|
pSyncNode->isStart = true;
|
||||||
|
pSyncNode->electNum = 0;
|
||||||
|
pSyncNode->becomeLeaderNum = 0;
|
||||||
|
pSyncNode->configChangeNum = 0;
|
||||||
|
|
||||||
sNTrace(pSyncNode, "sync open, node:%p", pSyncNode);
|
sNTrace(pSyncNode, "sync open, node:%p", pSyncNode);
|
||||||
|
|
||||||
return pSyncNode;
|
return pSyncNode;
|
||||||
|
@ -1158,7 +1164,7 @@ int32_t syncNodeStartElectTimer(SSyncNode* pSyncNode, int32_t ms) {
|
||||||
pSyncNode->electTimerParam.pSyncNode = pSyncNode;
|
pSyncNode->electTimerParam.pSyncNode = pSyncNode;
|
||||||
pSyncNode->electTimerParam.pData = NULL;
|
pSyncNode->electTimerParam.pData = NULL;
|
||||||
|
|
||||||
taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, pSyncNode, syncEnv()->pTimerManager,
|
taosTmrReset(pSyncNode->FpElectTimerCB, pSyncNode->electTimerMS, (void*)(pSyncNode->rid), syncEnv()->pTimerManager,
|
||||||
&pSyncNode->pElectTimer);
|
&pSyncNode->pElectTimer);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1340,6 +1346,8 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde
|
||||||
pSyncNode->pRaftCfg->cfg = *pNewConfig;
|
pSyncNode->pRaftCfg->cfg = *pNewConfig;
|
||||||
pSyncNode->pRaftCfg->lastConfigIndex = lastConfigChangeIndex;
|
pSyncNode->pRaftCfg->lastConfigIndex = lastConfigChangeIndex;
|
||||||
|
|
||||||
|
pSyncNode->configChangeNum++;
|
||||||
|
|
||||||
bool IamInOld = syncNodeInConfig(pSyncNode, &oldConfig);
|
bool IamInOld = syncNodeInConfig(pSyncNode, &oldConfig);
|
||||||
bool IamInNew = syncNodeInConfig(pSyncNode, pNewConfig);
|
bool IamInNew = syncNodeInConfig(pSyncNode, pNewConfig);
|
||||||
|
|
||||||
|
@ -1363,7 +1371,7 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde
|
||||||
char newCfgStr[1024] = {0};
|
char newCfgStr[1024] = {0};
|
||||||
syncCfg2SimpleStr(&oldConfig, oldCfgStr, sizeof(oldCfgStr));
|
syncCfg2SimpleStr(&oldConfig, oldCfgStr, sizeof(oldCfgStr));
|
||||||
syncCfg2SimpleStr(pNewConfig, oldCfgStr, sizeof(oldCfgStr));
|
syncCfg2SimpleStr(pNewConfig, oldCfgStr, sizeof(oldCfgStr));
|
||||||
sNTrace(pSyncNode, "begin do config change, from %s to %s", oldCfgStr, oldCfgStr);
|
sNInfo(pSyncNode, "begin do config change, from %s to %s", oldCfgStr, oldCfgStr);
|
||||||
|
|
||||||
if (IamInNew) {
|
if (IamInNew) {
|
||||||
pSyncNode->pRaftCfg->isStandBy = 0; // change isStandBy to normal
|
pSyncNode->pRaftCfg->isStandBy = 0; // change isStandBy to normal
|
||||||
|
@ -1495,13 +1503,13 @@ void syncNodeDoConfigChange(SSyncNode* pSyncNode, SSyncCfg* pNewConfig, SyncInde
|
||||||
} else {
|
} else {
|
||||||
// persist cfg
|
// persist cfg
|
||||||
raftCfgPersist(pSyncNode->pRaftCfg);
|
raftCfgPersist(pSyncNode->pRaftCfg);
|
||||||
sNTrace(pSyncNode, "do not config change from %d to %d, index:%" PRId64 ", %s --> %s", oldConfig.replicaNum,
|
sNInfo(pSyncNode, "do not config change from %d to %d, index:%" PRId64 ", %s --> %s", oldConfig.replicaNum,
|
||||||
pNewConfig->replicaNum, lastConfigChangeIndex, oldCfgStr, newCfgStr);
|
pNewConfig->replicaNum, lastConfigChangeIndex, oldCfgStr, newCfgStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
_END:
|
_END:
|
||||||
// log end config change
|
// log end config change
|
||||||
sNTrace(pSyncNode, "end do config change, from %s to %s", oldCfgStr, newCfgStr);
|
sNInfo(pSyncNode, "end do config change, from %s to %s", oldCfgStr, newCfgStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// raft state change --------------
|
// raft state change --------------
|
||||||
|
@ -1598,6 +1606,8 @@ void syncNodeBecomeFollower(SSyncNode* pSyncNode, const char* debugStr) {
|
||||||
void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
|
void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
|
||||||
pSyncNode->leaderTime = taosGetTimestampMs();
|
pSyncNode->leaderTime = taosGetTimestampMs();
|
||||||
|
|
||||||
|
pSyncNode->becomeLeaderNum++;
|
||||||
|
|
||||||
// reset restoreFinish
|
// reset restoreFinish
|
||||||
pSyncNode->restoreFinish = false;
|
pSyncNode->restoreFinish = false;
|
||||||
|
|
||||||
|
@ -1666,7 +1676,7 @@ void syncNodeBecomeLeader(SSyncNode* pSyncNode, const char* debugStr) {
|
||||||
pSyncNode->minMatchIndex = SYNC_INDEX_INVALID;
|
pSyncNode->minMatchIndex = SYNC_INDEX_INVALID;
|
||||||
|
|
||||||
// trace log
|
// trace log
|
||||||
sNTrace(pSyncNode, "become leader %s", debugStr);
|
sNInfo(pSyncNode, "become leader %s", debugStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void syncNodeCandidate2Leader(SSyncNode* pSyncNode) {
|
void syncNodeCandidate2Leader(SSyncNode* pSyncNode) {
|
||||||
|
@ -1842,9 +1852,11 @@ SyncTerm syncNodeGetPreTerm(SSyncNode* pSyncNode, SyncIndex index) {
|
||||||
pPreEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
pPreEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
|
pSyncNode->pLogStore->cacheHit++;
|
||||||
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", preIndex, pPreEntry->bytes, pPreEntry);
|
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", preIndex, pPreEntry->bytes, pPreEntry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
pSyncNode->pLogStore->cacheMiss++;
|
||||||
sNTrace(pSyncNode, "miss cache index:%" PRId64, preIndex);
|
sNTrace(pSyncNode, "miss cache index:%" PRId64, preIndex);
|
||||||
|
|
||||||
code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preIndex, &pPreEntry);
|
code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, preIndex, &pPreEntry);
|
||||||
|
@ -1916,13 +1928,21 @@ static void syncNodeEqPingTimer(void* param, void* tmrId) {
|
||||||
static void syncNodeEqElectTimer(void* param, void* tmrId) {
|
static void syncNodeEqElectTimer(void* param, void* tmrId) {
|
||||||
if (!syncIsInit()) return;
|
if (!syncIsInit()) return;
|
||||||
|
|
||||||
SSyncNode* pNode = (SSyncNode*)param;
|
int64_t rid = (int64_t)param;
|
||||||
|
SSyncNode* pNode = syncNodeAcquire(rid);
|
||||||
|
|
||||||
if (pNode == NULL) return;
|
if (pNode == NULL) return;
|
||||||
if (pNode->syncEqMsg == NULL) return;
|
|
||||||
|
if (pNode->syncEqMsg == NULL) {
|
||||||
|
syncNodeRelease(pNode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t tsNow = taosGetTimestampMs();
|
int64_t tsNow = taosGetTimestampMs();
|
||||||
if (tsNow < pNode->electTimerParam.executeTime) return;
|
if (tsNow < pNode->electTimerParam.executeTime) {
|
||||||
|
syncNodeRelease(pNode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SRpcMsg rpcMsg = {0};
|
SRpcMsg rpcMsg = {0};
|
||||||
int32_t code =
|
int32_t code =
|
||||||
|
@ -1930,7 +1950,7 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
|
||||||
|
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
sError("failed to build elect msg");
|
sError("failed to build elect msg");
|
||||||
|
syncNodeRelease(pNode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1941,9 +1961,11 @@ static void syncNodeEqElectTimer(void* param, void* tmrId) {
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
sError("failed to sync enqueue elect msg since %s", terrstr());
|
sError("failed to sync enqueue elect msg since %s", terrstr());
|
||||||
rpcFreeCont(rpcMsg.pCont);
|
rpcFreeCont(rpcMsg.pCont);
|
||||||
|
syncNodeRelease(pNode);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
syncNodeRelease(pNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
|
static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
|
||||||
|
@ -1961,7 +1983,7 @@ static void syncNodeEqHeartbeatTimer(void* param, void* tmrId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sTrace("enqueue heartbeat timer");
|
sTrace("vgId:%d, enqueue heartbeat timer", pNode->vgId);
|
||||||
code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg);
|
code = pNode->syncEqMsg(pNode->msgcb, &rpcMsg);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
sError("failed to enqueue heartbeat msg since %s", terrstr());
|
sError("failed to enqueue heartbeat msg since %s", terrstr());
|
||||||
|
@ -2516,9 +2538,11 @@ int32_t syncNodeDoCommit(SSyncNode* ths, SyncIndex beginIndex, SyncIndex endInde
|
||||||
if (h) {
|
if (h) {
|
||||||
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
||||||
|
|
||||||
|
ths->pLogStore->cacheHit++;
|
||||||
sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", i, pEntry->bytes, pEntry);
|
sNTrace(ths, "hit cache index:%" PRId64 ", bytes:%u, %p", i, pEntry->bytes, pEntry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
ths->pLogStore->cacheMiss++;
|
||||||
sNTrace(ths, "miss cache index:%" PRId64, i);
|
sNTrace(ths, "miss cache index:%" PRId64, i);
|
||||||
|
|
||||||
code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry);
|
code = ths->pLogStore->syncLogGetEntry(ths->pLogStore, i, &pEntry);
|
||||||
|
|
|
@ -45,6 +45,9 @@ SSyncLogStore* logStoreCreate(SSyncNode* pSyncNode) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pLogStore->cacheHit = 0;
|
||||||
|
pLogStore->cacheMiss = 0;
|
||||||
|
|
||||||
taosLRUCacheSetStrictCapacity(pLogStore->pCache, false);
|
taosLRUCacheSetStrictCapacity(pLogStore->pCache, false);
|
||||||
|
|
||||||
pLogStore->data = taosMemoryMalloc(sizeof(SSyncLogStoreData));
|
pLogStore->data = taosMemoryMalloc(sizeof(SSyncLogStoreData));
|
||||||
|
|
|
@ -80,9 +80,11 @@ int32_t syncNodeReplicateOne(SSyncNode* pSyncNode, SRaftId* pDestId, bool snapsh
|
||||||
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
pEntry = (SSyncRaftEntry*)taosLRUCacheValue(pCache, h);
|
||||||
code = 0;
|
code = 0;
|
||||||
|
|
||||||
|
pSyncNode->pLogStore->cacheHit++;
|
||||||
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", nextIndex, pEntry->bytes, pEntry);
|
sNTrace(pSyncNode, "hit cache index:%" PRId64 ", bytes:%u, %p", nextIndex, pEntry->bytes, pEntry);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
pSyncNode->pLogStore->cacheMiss++;
|
||||||
sNTrace(pSyncNode, "miss cache index:%" PRId64, nextIndex);
|
sNTrace(pSyncNode, "miss cache index:%" PRId64, nextIndex);
|
||||||
|
|
||||||
code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry);
|
code = pSyncNode->pLogStore->syncLogGetEntry(pSyncNode->pLogStore, nextIndex, &pEntry);
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void syncNodeCleanConfigIndex(SSyncNode* ths) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t syncNodeTimerRoutine(SSyncNode* ths) {
|
static int32_t syncNodeTimerRoutine(SSyncNode* ths) {
|
||||||
sNTrace(ths, "timer routines");
|
sNInfo(ths, "timer routines");
|
||||||
|
|
||||||
// timer replicate
|
// timer replicate
|
||||||
syncNodeReplicate(ths);
|
syncNodeReplicate(ths);
|
||||||
|
|
|
@ -242,6 +242,9 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
|
||||||
logBeginIndex = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
|
logBeginIndex = pNode->pLogStore->syncLogBeginIndex(pNode->pLogStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t cacheHit = pNode->pLogStore->cacheHit;
|
||||||
|
int32_t cacheMiss = pNode->pLogStore->cacheMiss;
|
||||||
|
|
||||||
char cfgStr[1024];
|
char cfgStr[1024];
|
||||||
if (pNode->pRaftCfg != NULL) {
|
if (pNode->pRaftCfg != NULL) {
|
||||||
syncCfg2SimpleStr(&(pNode->pRaftCfg->cfg), cfgStr, sizeof(cfgStr));
|
syncCfg2SimpleStr(&(pNode->pRaftCfg->cfg), cfgStr, sizeof(cfgStr));
|
||||||
|
@ -275,18 +278,18 @@ void syncPrintNodeLog(const char* flags, ELogLevel level, int32_t dflag, SSyncNo
|
||||||
terrno = errCode;
|
terrno = errCode;
|
||||||
|
|
||||||
if (pNode != NULL && pNode->pRaftCfg != NULL) {
|
if (pNode != NULL && pNode->pRaftCfg != NULL) {
|
||||||
taosPrintLog(flags, level, dflag,
|
taosPrintLog(
|
||||||
|
flags, level, dflag,
|
||||||
"vgId:%d, sync %s "
|
"vgId:%d, sync %s "
|
||||||
"%s"
|
"%s"
|
||||||
", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64
|
", tm:%" PRIu64 ", cmt:%" PRId64 ", fst:%" PRId64 ", lst:%" PRId64 ", min:%" PRId64 ", snap:%" PRId64
|
||||||
", snap-tm:%" PRIu64 ", sby:%d, aq:%d, snaping:%" PRId64 ", r-num:%d, lcfg:%" PRId64
|
", snap-tm:%" PRIu64 ", elt-num:%d, bl-num:%d, cc-num:%d, hit:%d, mis:%d, aq:%d, snaping:%" PRId64
|
||||||
", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s, %s, %s",
|
", r-num:%d, lcfg:%" PRId64 ", chging:%d, rsto:%d, dquorum:%d, elt:%" PRId64 ", hb:%" PRId64 ", %s, %s, %s, %s",
|
||||||
pNode->vgId, syncStr(pNode->state), eventLog, currentTerm, pNode->commitIndex, logBeginIndex,
|
pNode->vgId, syncStr(pNode->state), eventLog, currentTerm, pNode->commitIndex, logBeginIndex, logLastIndex,
|
||||||
logLastIndex, pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm,
|
pNode->minMatchIndex, snapshot.lastApplyIndex, snapshot.lastApplyTerm, pNode->electNum, pNode->becomeLeaderNum,
|
||||||
pNode->pRaftCfg->isStandBy, aqItems, pNode->snapshottingIndex, pNode->replicaNum,
|
pNode->configChangeNum, cacheHit, cacheMiss, aqItems, pNode->snapshottingIndex, pNode->replicaNum,
|
||||||
pNode->pRaftCfg->lastConfigIndex, pNode->changing, pNode->restoreFinish, quorum,
|
pNode->pRaftCfg->lastConfigIndex, pNode->changing, pNode->restoreFinish, quorum, pNode->electTimerLogicClock,
|
||||||
pNode->electTimerLogicClock, pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr, hbTimeStr,
|
pNode->heartbeatTimerLogicClockUser, peerStr, cfgStr, hbTimeStr, hbrTimeStr);
|
||||||
hbrTimeStr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +441,8 @@ void syncLogRecvAppendEntriesReply(SSyncNode* pSyncNode, const SyncAppendEntries
|
||||||
host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->lastSendIndex, pMsg->matchIndex, s);
|
host, port, pMsg->term, pMsg->privateTerm, pMsg->success, pMsg->lastSendIndex, pMsg->matchIndex, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void syncLogSendHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, bool printX, int64_t timerElapsed, int64_t execTime) {
|
void syncLogSendHeartbeat(SSyncNode* pSyncNode, const SyncHeartbeat* pMsg, bool printX, int64_t timerElapsed,
|
||||||
|
int64_t execTime) {
|
||||||
if (!(sDebugFlag & DEBUG_TRACE)) return;
|
if (!(sDebugFlag & DEBUG_TRACE)) return;
|
||||||
|
|
||||||
char host[64];
|
char host[64];
|
||||||
|
|
|
@ -349,6 +349,8 @@ static void tdbPCacheUnpinPage(SPCache *pCache, SPage *pPage) {
|
||||||
|
|
||||||
ASSERT(pPage->pLruNext == NULL);
|
ASSERT(pPage->pLruNext == NULL);
|
||||||
|
|
||||||
|
tdbDebug("pCache:%p unpin page %p/%d/%d, nPages:%d", pCache, pPage, TDB_PAGE_PGNO(pPage), pPage->id, pCache->nPages);
|
||||||
|
if (pPage->id < pCache->nPages) {
|
||||||
pPage->pLruPrev = &(pCache->lru);
|
pPage->pLruPrev = &(pCache->lru);
|
||||||
pPage->pLruNext = pCache->lru.pLruNext;
|
pPage->pLruNext = pCache->lru.pLruNext;
|
||||||
pCache->lru.pLruNext->pLruPrev = pPage;
|
pCache->lru.pLruNext->pLruPrev = pPage;
|
||||||
|
@ -358,6 +360,12 @@ static void tdbPCacheUnpinPage(SPCache *pCache, SPage *pPage) {
|
||||||
|
|
||||||
// printf("unpin page %d pgno %d pPage %p\n", pPage->id, TDB_PAGE_PGNO(pPage), pPage);
|
// printf("unpin page %d pgno %d pPage %p\n", pPage->id, TDB_PAGE_PGNO(pPage), pPage);
|
||||||
tdbDebug("pcache/unpin page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
|
tdbDebug("pcache/unpin page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
|
||||||
|
} else {
|
||||||
|
tdbDebug("pcache destroy page: %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
|
||||||
|
|
||||||
|
tdbPCacheRemovePageFromHash(pCache, pPage);
|
||||||
|
tdbPageDestroy(pPage, tdbDefaultFree, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tdbPCacheRemovePageFromHash(SPCache *pCache, SPage *pPage) {
|
static void tdbPCacheRemovePageFromHash(SPCache *pCache, SPage *pPage) {
|
||||||
|
@ -443,10 +451,18 @@ static int tdbPCacheOpenImpl(SPCache *pCache) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tdbPCacheCloseImpl(SPCache *pCache) {
|
static int tdbPCacheCloseImpl(SPCache *pCache) {
|
||||||
for (i32 iPage = 0; iPage < pCache->nPages; iPage++) {
|
// free free page
|
||||||
if (pCache->aPage[iPage]) {
|
for (SPage *pPage = pCache->pFree; pPage;) {
|
||||||
tdbPageDestroy(pCache->aPage[iPage], tdbDefaultFree, NULL);
|
SPage *pPageT = pPage->pFreeNext;
|
||||||
pCache->aPage[iPage] = NULL;
|
tdbPageDestroy(pPage, tdbDefaultFree, NULL);
|
||||||
|
pPage = pPageT;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32_t iBucket = 0; iBucket < pCache->nHash; iBucket++) {
|
||||||
|
for (SPage *pPage = pCache->pgHash[iBucket]; pPage;) {
|
||||||
|
SPage *pPageT = pPage->pHashNext;
|
||||||
|
tdbPageDestroy(pPage, tdbDefaultFree, NULL);
|
||||||
|
pPage = pPageT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,6 +210,7 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
|
||||||
ret = tdbGetFileSize(pPager->fd, pPager->pageSize, &(pPager->dbOrigSize));
|
ret = tdbGetFileSize(pPager->fd, pPager->pageSize, &(pPager->dbOrigSize));
|
||||||
pPager->dbFileSize = pPager->dbOrigSize;
|
pPager->dbFileSize = pPager->dbOrigSize;
|
||||||
|
|
||||||
|
tdbTrace("pager/open reset dirty tree: %p", &pPager->rbt);
|
||||||
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
||||||
|
|
||||||
*ppPager = pPager;
|
*ppPager = pPager;
|
||||||
|
@ -296,7 +297,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
|
||||||
|
|
||||||
// ref page one more time so the page will not be release
|
// ref page one more time so the page will not be release
|
||||||
tdbRefPage(pPage);
|
tdbRefPage(pPage);
|
||||||
tdbDebug("pcache/mdirty page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
|
tdbDebug("pager/mdirty page %p/%d/%d", pPage, TDB_PAGE_PGNO(pPage), pPage->id);
|
||||||
|
|
||||||
// Set page as dirty
|
// Set page as dirty
|
||||||
pPage->isDirty = 1;
|
pPage->isDirty = 1;
|
||||||
|
@ -316,6 +317,7 @@ int tdbPagerWrite(SPager *pPager, SPage *pPage) {
|
||||||
pPage->pDirtyNext = *ppPage;
|
pPage->pDirtyNext = *ppPage;
|
||||||
*ppPage = pPage;
|
*ppPage = pPage;
|
||||||
*/
|
*/
|
||||||
|
tdbTrace("put page: %p %d to dirty tree: %p", pPage, TDB_PAGE_PGNO(pPage), &pPager->rbt);
|
||||||
tRBTreePut(&pPager->rbt, (SRBTreeNode *)pPage);
|
tRBTreePut(&pPager->rbt, (SRBTreeNode *)pPage);
|
||||||
|
|
||||||
// Write page to journal if neccessary
|
// Write page to journal if neccessary
|
||||||
|
@ -373,6 +375,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
|
||||||
SRBTreeNode *pNode = NULL;
|
SRBTreeNode *pNode = NULL;
|
||||||
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
|
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
|
||||||
pPage = (SPage *)pNode;
|
pPage = (SPage *)pNode;
|
||||||
|
|
||||||
ASSERT(pPage->nOverflow == 0);
|
ASSERT(pPage->nOverflow == 0);
|
||||||
ret = tdbPagerWritePageToDB(pPager, pPage);
|
ret = tdbPagerWritePageToDB(pPager, pPage);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
@ -398,6 +401,7 @@ int tdbPagerCommit(SPager *pPager, TXN *pTxn) {
|
||||||
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tdbTrace("pager/commit reset dirty tree: %p", &pPager->rbt);
|
||||||
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
||||||
|
|
||||||
// sync the db file
|
// sync the db file
|
||||||
|
@ -471,6 +475,7 @@ int tdbPagerPrepareAsyncCommit(SPager *pPager, TXN *pTxn) {
|
||||||
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
tdbTrace("reset dirty tree: %p", &pPager->rbt);
|
||||||
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
||||||
|
|
||||||
// sync the db file
|
// sync the db file
|
||||||
|
@ -566,6 +571,7 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
|
||||||
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tdbTrace("reset dirty tree: %p", &pPager->rbt);
|
||||||
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
||||||
|
|
||||||
// 4, remove the journal file
|
// 4, remove the journal file
|
||||||
|
@ -580,6 +586,8 @@ int tdbPagerAbort(SPager *pPager, TXN *pTxn) {
|
||||||
|
|
||||||
int tdbPagerFlushPage(SPager *pPager, TXN *pTxn) {
|
int tdbPagerFlushPage(SPager *pPager, TXN *pTxn) {
|
||||||
SPage *pPage;
|
SPage *pPage;
|
||||||
|
i32 nRef;
|
||||||
|
SPgno maxPgno = pPager->dbOrigSize;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
// loop to write the dirty pages to file
|
// loop to write the dirty pages to file
|
||||||
|
@ -587,29 +595,52 @@ int tdbPagerFlushPage(SPager *pPager, TXN *pTxn) {
|
||||||
SRBTreeNode *pNode = NULL;
|
SRBTreeNode *pNode = NULL;
|
||||||
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
|
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
|
||||||
pPage = (SPage *)pNode;
|
pPage = (SPage *)pNode;
|
||||||
|
nRef = tdbGetPageRef(pPage);
|
||||||
|
if (nRef > 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPgno pgno = TDB_PAGE_PGNO(pPage);
|
||||||
|
if (pgno > maxPgno) {
|
||||||
|
maxPgno = pgno;
|
||||||
|
}
|
||||||
ret = tdbPagerWritePageToDB(pPager, pPage);
|
ret = tdbPagerWritePageToDB(pPager, pPage);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
tdbError("failed to write page to db since %s", tstrerror(terrno));
|
tdbError("failed to write page to db since %s", tstrerror(terrno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
tdbTrace("tdbttl commit:%p, %d/%d", pPager, pPager->dbOrigSize, pPager->dbFileSize);
|
tdbTrace("tdb/flush:%p, %d/%d/%d", pPager, pPager->dbOrigSize, pPager->dbFileSize, maxPgno);
|
||||||
pPager->dbOrigSize = pPager->dbFileSize;
|
pPager->dbOrigSize = maxPgno;
|
||||||
|
|
||||||
|
pPage->isDirty = 0;
|
||||||
|
|
||||||
|
tdbTrace("pager/flush drop page: %p %d from dirty tree: %p", pPage, TDB_PAGE_PGNO(pPage), &pPager->rbt);
|
||||||
|
tRBTreeDrop(&pPager->rbt, (SRBTreeNode *)pPage);
|
||||||
|
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
tdbTrace("tdb/flush:%p, %d/%d/%d", pPager, pPager->dbOrigSize, pPager->dbFileSize, maxPgno);
|
||||||
|
pPager->dbOrigSize = maxPgno;
|
||||||
|
|
||||||
// release the page
|
// release the page
|
||||||
iter = tRBTreeIterCreate(&pPager->rbt, 1);
|
iter = tRBTreeIterCreate(&pPager->rbt, 1);
|
||||||
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
|
while ((pNode = tRBTreeIterNext(&iter)) != NULL) {
|
||||||
pPage = (SPage *)pNode;
|
pPage = (SPage *)pNode;
|
||||||
|
nRef = tdbGetPageRef(pPage);
|
||||||
|
if (nRef > 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
pPage->isDirty = 0;
|
pPage->isDirty = 0;
|
||||||
|
|
||||||
|
tdbTrace("pager/flush drop page: %p %d from dirty tree: %p", pPage, TDB_PAGE_PGNO(pPage), &pPager->rbt);
|
||||||
tRBTreeDrop(&pPager->rbt, (SRBTreeNode *)pPage);
|
tRBTreeDrop(&pPager->rbt, (SRBTreeNode *)pPage);
|
||||||
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
tdbPCacheRelease(pPager->pCache, pPage, pTxn);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
tRBTreeCreate(&pPager->rbt, pageCmpFn);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,9 @@ void* rpcOpen(const SRpcInit* pInit) {
|
||||||
pRpc->destroyFp = pInit->dfp;
|
pRpc->destroyFp = pInit->dfp;
|
||||||
|
|
||||||
pRpc->numOfThreads = pInit->numOfThreads > TSDB_MAX_RPC_THREADS ? TSDB_MAX_RPC_THREADS : pInit->numOfThreads;
|
pRpc->numOfThreads = pInit->numOfThreads > TSDB_MAX_RPC_THREADS ? TSDB_MAX_RPC_THREADS : pInit->numOfThreads;
|
||||||
|
if (pRpc->numOfThreads <= 0) {
|
||||||
|
pRpc->numOfThreads = 1;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t ip = 0;
|
uint32_t ip = 0;
|
||||||
if (pInit->connType == TAOS_CONN_SERVER) {
|
if (pInit->connType == TAOS_CONN_SERVER) {
|
||||||
|
|
|
@ -656,6 +656,7 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) {
|
||||||
conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
|
conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
|
||||||
uv_tcp_init(pThrd->loop, (uv_tcp_t*)(conn->stream));
|
uv_tcp_init(pThrd->loop, (uv_tcp_t*)(conn->stream));
|
||||||
conn->stream->data = conn;
|
conn->stream->data = conn;
|
||||||
|
transSetConnOption((uv_tcp_t*)conn->stream);
|
||||||
|
|
||||||
uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL;
|
uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL;
|
||||||
if (timer == NULL) {
|
if (timer == NULL) {
|
||||||
|
|
|
@ -202,9 +202,8 @@ bool transReadComplete(SConnBuffer* connBuf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int transSetConnOption(uv_tcp_t* stream) {
|
int transSetConnOption(uv_tcp_t* stream) {
|
||||||
uv_tcp_nodelay(stream, 0);
|
return uv_tcp_nodelay(stream, 1);
|
||||||
int ret = uv_tcp_keepalive(stream, 5, 60);
|
// int ret = uv_tcp_keepalive(stream, 5, 60);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SAsyncPool* transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb) {
|
SAsyncPool* transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb) {
|
||||||
|
|
|
@ -846,7 +846,7 @@ static bool addHandleToAcceptloop(void* arg) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void* transWorkerThread(void* arg) {
|
void* transWorkerThread(void* arg) {
|
||||||
setThreadName("trans-worker");
|
setThreadName("trans-svr-work");
|
||||||
SWorkThrd* pThrd = (SWorkThrd*)arg;
|
SWorkThrd* pThrd = (SWorkThrd*)arg;
|
||||||
uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
uv_run(pThrd->loop, UV_RUN_DEFAULT);
|
||||||
|
|
||||||
|
|
|
@ -205,6 +205,9 @@ void* taosArrayPop(SArray* pArray) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* taosArrayGet(const SArray* pArray, size_t index) {
|
void* taosArrayGet(const SArray* pArray, size_t index) {
|
||||||
|
if (NULL == pArray) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
assert(index < pArray->size);
|
assert(index < pArray->size);
|
||||||
return TARRAY_GET_ELEM(pArray, index);
|
return TARRAY_GET_ELEM(pArray, index);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +305,7 @@ SArray* taosArrayFromList(const void* src, size_t size, size_t elemSize) {
|
||||||
return pDst;
|
return pDst;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* taosArrayDup(const SArray* pSrc) {
|
SArray* taosArrayDup(const SArray* pSrc, __array_item_dup_fn_t fn) {
|
||||||
assert(pSrc != NULL);
|
assert(pSrc != NULL);
|
||||||
|
|
||||||
if (pSrc->size == 0) { // empty array list
|
if (pSrc->size == 0) { // empty array list
|
||||||
|
@ -311,8 +314,19 @@ SArray* taosArrayDup(const SArray* pSrc) {
|
||||||
|
|
||||||
SArray* dst = taosArrayInit(pSrc->size, pSrc->elemSize);
|
SArray* dst = taosArrayInit(pSrc->size, pSrc->elemSize);
|
||||||
|
|
||||||
|
if (fn == NULL) {
|
||||||
memcpy(dst->pData, pSrc->pData, pSrc->elemSize * pSrc->size);
|
memcpy(dst->pData, pSrc->pData, pSrc->elemSize * pSrc->size);
|
||||||
|
} else {
|
||||||
|
ASSERT(pSrc->elemSize == sizeof(void*));
|
||||||
|
|
||||||
|
for(int32_t i = 0; i < pSrc->size; ++i) {
|
||||||
|
void* p = fn(taosArrayGetP(pSrc, i));
|
||||||
|
memcpy(((char*)dst->pData )+ i * dst->elemSize, &p, dst->elemSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dst->size = pSrc->size;
|
dst->size = pSrc->size;
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,19 +478,6 @@ static void taosArrayInsertSort(SArray* pArray, __ext_compar_fn_t fn, const void
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* taosArrayDeepCopy(const SArray* pSrc, FCopy deepCopy) {
|
|
||||||
if (NULL == pSrc) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
ASSERT(pSrc->elemSize == sizeof(void*));
|
|
||||||
SArray* pArray = taosArrayInit(pSrc->size, sizeof(void*));
|
|
||||||
for (int32_t i = 0; i < pSrc->size; i++) {
|
|
||||||
void* clone = deepCopy(taosArrayGetP(pSrc, i));
|
|
||||||
taosArrayPush(pArray, &clone);
|
|
||||||
}
|
|
||||||
return pArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode) {
|
int32_t taosEncodeArray(void** buf, const SArray* pArray, FEncode encode) {
|
||||||
int32_t tlen = 0;
|
int32_t tlen = 0;
|
||||||
int32_t sz = pArray->size;
|
int32_t sz = pArray->size;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#define LOG_MAX_LINE_SIZE (1024)
|
#define LOG_MAX_LINE_SIZE (1024)
|
||||||
#define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 3)
|
#define LOG_MAX_LINE_BUFFER_SIZE (LOG_MAX_LINE_SIZE + 3)
|
||||||
#define LOG_MAX_LINE_DUMP_SIZE (65 * 1024)
|
#define LOG_MAX_LINE_DUMP_SIZE (1024 * 1024)
|
||||||
#define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 3)
|
#define LOG_MAX_LINE_DUMP_BUFFER_SIZE (LOG_MAX_LINE_DUMP_SIZE + 3)
|
||||||
|
|
||||||
#define LOG_FILE_NAME_LEN 300
|
#define LOG_FILE_NAME_LEN 300
|
||||||
|
@ -496,7 +496,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
|
||||||
if (!osLogSpaceAvailable()) return;
|
if (!osLogSpaceAvailable()) return;
|
||||||
if (!(dflag & DEBUG_FILE) && !(dflag & DEBUG_SCREEN)) return;
|
if (!(dflag & DEBUG_FILE) && !(dflag & DEBUG_SCREEN)) return;
|
||||||
|
|
||||||
char buffer[LOG_MAX_LINE_DUMP_BUFFER_SIZE];
|
char *buffer = taosMemoryMalloc(LOG_MAX_LINE_DUMP_BUFFER_SIZE);
|
||||||
int32_t len = taosBuildLogHead(buffer, flags);
|
int32_t len = taosBuildLogHead(buffer, flags);
|
||||||
|
|
||||||
va_list argpointer;
|
va_list argpointer;
|
||||||
|
@ -509,6 +509,7 @@ void taosPrintLongString(const char *flags, ELogLevel level, int32_t dflag, cons
|
||||||
buffer[len] = 0;
|
buffer[len] = 0;
|
||||||
|
|
||||||
taosPrintLogImp(level, dflag, buffer, len);
|
taosPrintLogImp(level, dflag, buffer, len);
|
||||||
|
taosMemoryFree(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosDumpData(unsigned char *msg, int32_t len) {
|
void taosDumpData(unsigned char *msg, int32_t len) {
|
||||||
|
|
|
@ -104,61 +104,6 @@ static void tRBTreeTransplant(SRBTree *pTree, SRBTreeNode *u, SRBTreeNode *v) {
|
||||||
v->parent = u->parent;
|
v->parent = u->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tRBTreeDropFix(SRBTree *pTree, SRBTreeNode *x) {
|
|
||||||
while (x != pTree->root && x->color == BLACK) {
|
|
||||||
if (x == x->parent->left) {
|
|
||||||
SRBTreeNode *w = x->parent->right;
|
|
||||||
if (w->color == RED) {
|
|
||||||
w->color = BLACK;
|
|
||||||
x->parent->color = RED;
|
|
||||||
tRBTreeRotateLeft(pTree, x->parent);
|
|
||||||
w = x->parent->right;
|
|
||||||
}
|
|
||||||
if (w->left->color == BLACK && w->right->color == BLACK) {
|
|
||||||
w->color = RED;
|
|
||||||
x = x->parent;
|
|
||||||
} else {
|
|
||||||
if (w->right->color == BLACK) {
|
|
||||||
w->left->color = BLACK;
|
|
||||||
w->color = RED;
|
|
||||||
tRBTreeRotateRight(pTree, w);
|
|
||||||
w = x->parent->right;
|
|
||||||
}
|
|
||||||
w->color = x->parent->color;
|
|
||||||
x->parent->color = BLACK;
|
|
||||||
w->right->color = BLACK;
|
|
||||||
tRBTreeRotateLeft(pTree, x->parent);
|
|
||||||
x = pTree->root;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
SRBTreeNode *w = x->parent->left;
|
|
||||||
if (w->color == RED) {
|
|
||||||
w->color = BLACK;
|
|
||||||
x->parent->color = RED;
|
|
||||||
tRBTreeRotateRight(pTree, x->parent);
|
|
||||||
w = x->parent->left;
|
|
||||||
}
|
|
||||||
if (w->right->color == BLACK && w->left->color == BLACK) {
|
|
||||||
w->color = RED;
|
|
||||||
x = x->parent;
|
|
||||||
} else {
|
|
||||||
if (w->left->color == BLACK) {
|
|
||||||
w->right->color = BLACK;
|
|
||||||
w->color = RED;
|
|
||||||
tRBTreeRotateLeft(pTree, w);
|
|
||||||
w = x->parent->left;
|
|
||||||
}
|
|
||||||
w->color = x->parent->color;
|
|
||||||
x->parent->color = BLACK;
|
|
||||||
w->left->color = BLACK;
|
|
||||||
tRBTreeRotateRight(pTree, x->parent);
|
|
||||||
x = pTree->root;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
x->color = BLACK;
|
|
||||||
}
|
|
||||||
|
|
||||||
static SRBTreeNode *tRBTreeSuccessor(SRBTree *pTree, SRBTreeNode *pNode) {
|
static SRBTreeNode *tRBTreeSuccessor(SRBTree *pTree, SRBTreeNode *pNode) {
|
||||||
if (pNode->right != pTree->NIL) {
|
if (pNode->right != pTree->NIL) {
|
||||||
pNode = pNode->right;
|
pNode = pNode->right;
|
||||||
|
@ -255,11 +200,205 @@ SRBTreeNode *tRBTreePut(SRBTree *pTree, SRBTreeNode *z) {
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z) {
|
#define RBTREE_NULL rbtree->NIL
|
||||||
SRBTreeNode *y = z;
|
#define rbtree_t SRBTree
|
||||||
SRBTreeNode *x;
|
#define rbnode_t SRBTreeNode
|
||||||
ECOLOR y_orignal_color = y->color;
|
#define rbtree_rotate_left tRBTreeRotateLeft
|
||||||
|
#define rbtree_rotate_right tRBTreeRotateRight
|
||||||
|
|
||||||
|
static void rbtree_delete_fixup(rbtree_t *rbtree, rbnode_t *child, rbnode_t *child_parent) {
|
||||||
|
rbnode_t *sibling;
|
||||||
|
int go_up = 1;
|
||||||
|
|
||||||
|
/* determine sibling to the node that is one-black short */
|
||||||
|
if (child_parent->right == child)
|
||||||
|
sibling = child_parent->left;
|
||||||
|
else
|
||||||
|
sibling = child_parent->right;
|
||||||
|
|
||||||
|
while (go_up) {
|
||||||
|
if (child_parent == RBTREE_NULL) {
|
||||||
|
/* removed parent==black from root, every path, so ok */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sibling->color == RED) { /* rotate to get a black sibling */
|
||||||
|
child_parent->color = RED;
|
||||||
|
sibling->color = BLACK;
|
||||||
|
if (child_parent->right == child)
|
||||||
|
rbtree_rotate_right(rbtree, child_parent);
|
||||||
|
else
|
||||||
|
rbtree_rotate_left(rbtree, child_parent);
|
||||||
|
/* new sibling after rotation */
|
||||||
|
if (child_parent->right == child)
|
||||||
|
sibling = child_parent->left;
|
||||||
|
else
|
||||||
|
sibling = child_parent->right;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child_parent->color == BLACK && sibling->color == BLACK && sibling->left->color == BLACK &&
|
||||||
|
sibling->right->color == BLACK) { /* fixup local with recolor of sibling */
|
||||||
|
if (sibling != RBTREE_NULL) sibling->color = RED;
|
||||||
|
|
||||||
|
child = child_parent;
|
||||||
|
child_parent = child_parent->parent;
|
||||||
|
/* prepare to go up, new sibling */
|
||||||
|
if (child_parent->right == child)
|
||||||
|
sibling = child_parent->left;
|
||||||
|
else
|
||||||
|
sibling = child_parent->right;
|
||||||
|
} else
|
||||||
|
go_up = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (child_parent->color == RED && sibling->color == BLACK && sibling->left->color == BLACK &&
|
||||||
|
sibling->right->color == BLACK) {
|
||||||
|
/* move red to sibling to rebalance */
|
||||||
|
if (sibling != RBTREE_NULL) sibling->color = RED;
|
||||||
|
child_parent->color = BLACK;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert(sibling != RBTREE_NULL);
|
||||||
|
|
||||||
|
/* get a new sibling, by rotating at sibling. See which child
|
||||||
|
of sibling is red */
|
||||||
|
if (child_parent->right == child && sibling->color == BLACK && sibling->right->color == RED &&
|
||||||
|
sibling->left->color == BLACK) {
|
||||||
|
sibling->color = RED;
|
||||||
|
sibling->right->color = BLACK;
|
||||||
|
rbtree_rotate_left(rbtree, sibling);
|
||||||
|
/* new sibling after rotation */
|
||||||
|
if (child_parent->right == child)
|
||||||
|
sibling = child_parent->left;
|
||||||
|
else
|
||||||
|
sibling = child_parent->right;
|
||||||
|
} else if (child_parent->left == child && sibling->color == BLACK && sibling->left->color == RED &&
|
||||||
|
sibling->right->color == BLACK) {
|
||||||
|
sibling->color = RED;
|
||||||
|
sibling->left->color = BLACK;
|
||||||
|
rbtree_rotate_right(rbtree, sibling);
|
||||||
|
/* new sibling after rotation */
|
||||||
|
if (child_parent->right == child)
|
||||||
|
sibling = child_parent->left;
|
||||||
|
else
|
||||||
|
sibling = child_parent->right;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now we have a black sibling with a red child. rotate and exchange colors. */
|
||||||
|
sibling->color = child_parent->color;
|
||||||
|
child_parent->color = BLACK;
|
||||||
|
if (child_parent->right == child) {
|
||||||
|
assert(sibling->left->color == RED);
|
||||||
|
sibling->left->color = BLACK;
|
||||||
|
rbtree_rotate_right(rbtree, child_parent);
|
||||||
|
} else {
|
||||||
|
assert(sibling->right->color == RED);
|
||||||
|
sibling->right->color = BLACK;
|
||||||
|
rbtree_rotate_left(rbtree, child_parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** helpers for delete: swap node colours */
|
||||||
|
static void swap_int8(ECOLOR *x, ECOLOR *y) {
|
||||||
|
ECOLOR t = *x;
|
||||||
|
*x = *y;
|
||||||
|
*y = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** helpers for delete: swap node pointers */
|
||||||
|
static void swap_np(rbnode_t **x, rbnode_t **y) {
|
||||||
|
rbnode_t *t = *x;
|
||||||
|
*x = *y;
|
||||||
|
*y = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Update parent pointers of child trees of 'parent' */
|
||||||
|
static void change_parent_ptr(rbtree_t *rbtree, rbnode_t *parent, rbnode_t *old, rbnode_t *new) {
|
||||||
|
if (parent == RBTREE_NULL) {
|
||||||
|
assert(rbtree->root == old);
|
||||||
|
if (rbtree->root == old) rbtree->root = new;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert(parent->left == old || parent->right == old || parent->left == new || parent->right == new);
|
||||||
|
if (parent->left == old) parent->left = new;
|
||||||
|
if (parent->right == old) parent->right = new;
|
||||||
|
}
|
||||||
|
/** Update parent pointer of a node 'child' */
|
||||||
|
static void change_child_ptr(rbtree_t *rbtree, rbnode_t *child, rbnode_t *old, rbnode_t *new) {
|
||||||
|
if (child == RBTREE_NULL) return;
|
||||||
|
assert(child->parent == old || child->parent == new);
|
||||||
|
if (child->parent == old) child->parent = new;
|
||||||
|
}
|
||||||
|
|
||||||
|
rbnode_t *rbtree_delete(rbtree_t *rbtree, void *key) {
|
||||||
|
rbnode_t *to_delete = key;
|
||||||
|
rbnode_t *child;
|
||||||
|
|
||||||
|
/* make sure we have at most one non-leaf child */
|
||||||
|
if (to_delete->left != RBTREE_NULL && to_delete->right != RBTREE_NULL) {
|
||||||
|
/* swap with smallest from right subtree (or largest from left) */
|
||||||
|
rbnode_t *smright = to_delete->right;
|
||||||
|
while (smright->left != RBTREE_NULL) smright = smright->left;
|
||||||
|
/* swap the smright and to_delete elements in the tree,
|
||||||
|
* but the rbnode_t is first part of user data struct
|
||||||
|
* so cannot just swap the keys and data pointers. Instead
|
||||||
|
* readjust the pointers left,right,parent */
|
||||||
|
|
||||||
|
/* swap colors - colors are tied to the position in the tree */
|
||||||
|
swap_int8(&to_delete->color, &smright->color);
|
||||||
|
|
||||||
|
/* swap child pointers in parents of smright/to_delete */
|
||||||
|
change_parent_ptr(rbtree, to_delete->parent, to_delete, smright);
|
||||||
|
if (to_delete->right != smright) change_parent_ptr(rbtree, smright->parent, smright, to_delete);
|
||||||
|
|
||||||
|
/* swap parent pointers in children of smright/to_delete */
|
||||||
|
change_child_ptr(rbtree, smright->left, smright, to_delete);
|
||||||
|
change_child_ptr(rbtree, smright->left, smright, to_delete);
|
||||||
|
change_child_ptr(rbtree, smright->right, smright, to_delete);
|
||||||
|
change_child_ptr(rbtree, smright->right, smright, to_delete);
|
||||||
|
change_child_ptr(rbtree, to_delete->left, to_delete, smright);
|
||||||
|
if (to_delete->right != smright) change_child_ptr(rbtree, to_delete->right, to_delete, smright);
|
||||||
|
if (to_delete->right == smright) {
|
||||||
|
/* set up so after swap they work */
|
||||||
|
to_delete->right = to_delete;
|
||||||
|
smright->parent = smright;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* swap pointers in to_delete/smright nodes */
|
||||||
|
swap_np(&to_delete->parent, &smright->parent);
|
||||||
|
swap_np(&to_delete->left, &smright->left);
|
||||||
|
swap_np(&to_delete->right, &smright->right);
|
||||||
|
|
||||||
|
/* now delete to_delete (which is at the location where the smright previously was) */
|
||||||
|
}
|
||||||
|
assert(to_delete->left == RBTREE_NULL || to_delete->right == RBTREE_NULL);
|
||||||
|
|
||||||
|
if (to_delete->left != RBTREE_NULL)
|
||||||
|
child = to_delete->left;
|
||||||
|
else
|
||||||
|
child = to_delete->right;
|
||||||
|
|
||||||
|
/* unlink to_delete from the tree, replace to_delete with child */
|
||||||
|
change_parent_ptr(rbtree, to_delete->parent, to_delete, child);
|
||||||
|
change_child_ptr(rbtree, child, to_delete, to_delete->parent);
|
||||||
|
|
||||||
|
if (to_delete->color == RED) {
|
||||||
|
/* if node is red then the child (black) can be swapped in */
|
||||||
|
} else if (child->color == RED) {
|
||||||
|
/* change child to BLACK, removing a RED node is no problem */
|
||||||
|
if (child != RBTREE_NULL) child->color = BLACK;
|
||||||
|
} else
|
||||||
|
rbtree_delete_fixup(rbtree, child, to_delete->parent);
|
||||||
|
|
||||||
|
/* unlink completely */
|
||||||
|
to_delete->parent = RBTREE_NULL;
|
||||||
|
to_delete->left = RBTREE_NULL;
|
||||||
|
to_delete->right = RBTREE_NULL;
|
||||||
|
to_delete->color = BLACK;
|
||||||
|
return to_delete;
|
||||||
|
}
|
||||||
|
|
||||||
|
void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z) {
|
||||||
// update min/max node
|
// update min/max node
|
||||||
if (pTree->min == z) {
|
if (pTree->min == z) {
|
||||||
pTree->min = tRBTreeSuccessor(pTree, pTree->min);
|
pTree->min = tRBTreeSuccessor(pTree, pTree->min);
|
||||||
|
@ -268,34 +407,8 @@ void tRBTreeDrop(SRBTree *pTree, SRBTreeNode *z) {
|
||||||
pTree->max = tRBTreePredecessor(pTree, pTree->max);
|
pTree->max = tRBTreePredecessor(pTree, pTree->max);
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop impl
|
rbtree_delete(pTree, z);
|
||||||
if (z->left == pTree->NIL) {
|
|
||||||
x = z->right;
|
|
||||||
tRBTreeTransplant(pTree, z, z->right);
|
|
||||||
} else if (z->right == pTree->NIL) {
|
|
||||||
x = z->left;
|
|
||||||
tRBTreeTransplant(pTree, z, z->left);
|
|
||||||
} else {
|
|
||||||
y = tRBTreeSuccessor(pTree, z);
|
|
||||||
y_orignal_color = y->color;
|
|
||||||
x = y->right;
|
|
||||||
if (y->parent == z) {
|
|
||||||
x->parent = z;
|
|
||||||
} else {
|
|
||||||
tRBTreeTransplant(pTree, y, y->right);
|
|
||||||
y->right = z->right;
|
|
||||||
y->right->parent = y;
|
|
||||||
}
|
|
||||||
tRBTreeTransplant(pTree, z, y);
|
|
||||||
y->left = z->left;
|
|
||||||
y->left->parent = y;
|
|
||||||
y->color = z->color;
|
|
||||||
}
|
|
||||||
|
|
||||||
// fix
|
|
||||||
if (y_orignal_color == BLACK) {
|
|
||||||
tRBTreeDropFix(pTree, x);
|
|
||||||
}
|
|
||||||
pTree->n--;
|
pTree->n--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -417,7 +417,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_control.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/user_control.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/fsync.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 0-others/fsync.py
|
||||||
,,n,system-test,python3 ./test.py -f 0-others/compatibility.py
|
,,n,system-test,python3 ./test.py -f 0-others/compatibility.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/alter_database.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_database.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py
|
||||||
|
@ -425,7 +425,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_stable.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_table.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/alter_table.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/boundary.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/boundary.py
|
||||||
,,n,system-test,python3 ./test.py -f 1-insert/insertWithMoreVgroup.py
|
,,n,system-test,python3 ./test.py -f 1-insert/insertWithMoreVgroup.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/table_comment.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/table_comment.py
|
||||||
,,n,system-test,python3 ./test.py -f 1-insert/time_range_wise.py
|
,,n,system-test,python3 ./test.py -f 1-insert/time_range_wise.py
|
||||||
|
@ -612,7 +612,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/case_when.py -R
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/update_data.py
|
||||||
,,,system-test,python3 ./test.py -f 1-insert/tb_100w_data_order.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/tb_100w_data_order.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_stable.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_childtable.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_childtable.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_normaltable.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 1-insert/delete_normaltable.py
|
||||||
|
@ -658,7 +658,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -N 6 -M 3 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 -n 3
|
||||||
,,,system-test,python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -N 5 -M 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -N 5 -M 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3
|
||||||
|
@ -1016,6 +1016,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py -Q 2
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py -Q 2
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py -Q 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py -Q 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py -Q 4
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_select.py -Q 4
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
|
||||||
|
|
||||||
#develop test
|
#develop test
|
||||||
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
|
,,n,develop-test,python3 ./test.py -f 5-taos-tools/taosbenchmark/auto_create_table_json.py
|
||||||
|
|
|
@ -1,199 +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 2
|
|
||||||
system sh/cfg.sh -n dnode1 -c mnodeEqualVnodeNum -v 4
|
|
||||||
system sh/cfg.sh -n dnode1 -c offlineThreshold -v 8
|
|
||||||
system sh/cfg.sh -n dnode1 -c statusInterval -v 3
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
#system sh/cfg.sh -n dnode1 -c timezone -v ""
|
|
||||||
#system sh/cfg.sh -n dnode1 -c locale -v ""
|
|
||||||
#system sh/cfg.sh -n dnode1 -c charset -v ""
|
|
||||||
system sh/cfg.sh -n dnode1 -c balanceInterval -v 3
|
|
||||||
|
|
||||||
######## dnode 2 the same with dnode1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 2
|
|
||||||
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 4
|
|
||||||
system sh/cfg.sh -n dnode2 -c offlineThreshold -v 8
|
|
||||||
system sh/cfg.sh -n dnode2 -c statusInterval -v 3
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
#system sh/cfg.sh -n dnode2 -c timezone -v ""
|
|
||||||
#system sh/cfg.sh -n dnode2 -c locale -v ""
|
|
||||||
#system sh/cfg.sh -n dnode2 -c charset -v ""
|
|
||||||
system sh/cfg.sh -n dnode2 -c balanceInterval -v 3
|
|
||||||
|
|
||||||
######## dnode 3 one para no same with dnode1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 3
|
|
||||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 4
|
|
||||||
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 8
|
|
||||||
system sh/cfg.sh -n dnode3 -c statusInterval -v 3
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
#system sh/cfg.sh -n dnode3 -c timezone -v ""
|
|
||||||
#system sh/cfg.sh -n dnode3 -c locale -v ""
|
|
||||||
#system sh/cfg.sh -n dnode3 -c charset -v ""
|
|
||||||
system sh/cfg.sh -n dnode3 -c balanceInterval -v 3
|
|
||||||
|
|
||||||
######## dnode 4 one para no same with dnode1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 2
|
|
||||||
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 5
|
|
||||||
system sh/cfg.sh -n dnode4 -c offlineThreshold -v 8
|
|
||||||
system sh/cfg.sh -n dnode4 -c statusInterval -v 3
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
#system sh/cfg.sh -n dnode4 -c timezone -v ""
|
|
||||||
#system sh/cfg.sh -n dnode4 -c locale -v ""
|
|
||||||
#system sh/cfg.sh -n dnode4 -c charset -v ""
|
|
||||||
system sh/cfg.sh -n dnode4 -c balanceInterval -v 3
|
|
||||||
|
|
||||||
######## dnode 5 one para no same with dnode1
|
|
||||||
system sh/cfg.sh -n dnode5 -c numOfMnodes -v 2
|
|
||||||
system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 4
|
|
||||||
system sh/cfg.sh -n dnode5 -c offlineThreshold -v 7
|
|
||||||
system sh/cfg.sh -n dnode5 -c statusInterval -v 3
|
|
||||||
system sh/cfg.sh -n dnode5 -c arbitrator -v $arbitrator
|
|
||||||
#system sh/cfg.sh -n dnode5 -c timezone -v ""
|
|
||||||
#system sh/cfg.sh -n dnode5 -c locale -v ""
|
|
||||||
#system sh/cfg.sh -n dnode5 -c charset -v ""
|
|
||||||
system sh/cfg.sh -n dnode5 -c balanceInterval -v 3
|
|
||||||
|
|
||||||
|
|
||||||
######## dnode 6 one para no same with dnode1
|
|
||||||
system sh/cfg.sh -n dnode6 -c numOfMnodes -v 2
|
|
||||||
system sh/cfg.sh -n dnode6 -c mnodeEqualVnodeNum -v 4
|
|
||||||
system sh/cfg.sh -n dnode6 -c offlineThreshold -v 8
|
|
||||||
system sh/cfg.sh -n dnode6 -c statusInterval -v 2
|
|
||||||
system sh/cfg.sh -n dnode6 -c arbitrator -v $arbitrator
|
|
||||||
#system sh/cfg.sh -n dnode6 -c timezone -v ""
|
|
||||||
#system sh/cfg.sh -n dnode6 -c locale -v ""
|
|
||||||
#system sh/cfg.sh -n dnode6 -c charset -v ""
|
|
||||||
system sh/cfg.sh -n dnode6 -c balanceInterval -v 3
|
|
||||||
|
|
||||||
|
|
||||||
######## dnode 7 one para no same with dnode1
|
|
||||||
system sh/cfg.sh -n dnode7 -c numOfMnodes -v 2
|
|
||||||
system sh/cfg.sh -n dnode7 -c mnodeEqualVnodeNum -v 4
|
|
||||||
system sh/cfg.sh -n dnode7 -c offlineThreshold -v 8
|
|
||||||
system sh/cfg.sh -n dnode7 -c statusInterval -v 3
|
|
||||||
system sh/cfg.sh -n dnode7 -c arbitrator -v "plum-VirtualBox:8001"
|
|
||||||
#system sh/cfg.sh -n dnode7 -c timezone -v ""
|
|
||||||
#system sh/cfg.sh -n dnode7 -c locale -v ""
|
|
||||||
#system sh/cfg.sh -n dnode7 -c charset -v ""
|
|
||||||
system sh/cfg.sh -n dnode7 -c balanceInterval -v 3
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2~7 and add into cluster
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
system sh/exec.sh -n dnode5 -s start
|
|
||||||
system sh/exec.sh -n dnode6 -s start
|
|
||||||
system sh/exec.sh -n dnode7 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sql create dnode $hostname5
|
|
||||||
sql create dnode $hostname6
|
|
||||||
sql create dnode $hostname7
|
|
||||||
sleep 10000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode_created:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 8 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode_created
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
$dnode5Status = $data4_5
|
|
||||||
$dnode6Status = $data4_6
|
|
||||||
$dnode7Status = $data4_7
|
|
||||||
|
|
||||||
if $dnode1Status != ready then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode4Status != offline then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode5Status != offline then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode6Status != offline then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode7Status != offline then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sleep 10000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode_offline_overtime_dropped:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 20 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode_offline_overtime_dropped
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
print $data0_7 $data1_7 $data2_7 $data3_7 $data4_7
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
$dnode5Status = $data4_5
|
|
||||||
$dnode6Status = $data4_6
|
|
||||||
$dnode7Status = $data4_7
|
|
||||||
|
|
||||||
if $dnode1Status != ready then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
return -1
|
|
||||||
endi
|
|
|
@ -1,222 +0,0 @@
|
||||||
# Test case describe: dnode1 is only mnode, dnode2/dnode3 are only vnode
|
|
||||||
# step 1: start dnode1
|
|
||||||
# step 2: start dnode2 and dnode3, and all added into cluster (Suppose dnode2 is master-vnode)
|
|
||||||
# step 2: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841)
|
|
||||||
# step 3: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc
|
|
||||||
# step 4: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2
|
|
||||||
# step 5: insert two data rows: now-21d, now-41d
|
|
||||||
# step 6: restart dnode2, waiting sync end
|
|
||||||
# expect: in dnode2, the files 1837 and 1839 will be removed
|
|
||||||
|
|
||||||
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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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 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 dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 1
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2 cache 1
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 double) tags(t1 int)
|
|
||||||
$rowNum = 130000
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1577808000000 # 2020-01-01 00:00:00.000
|
|
||||||
|
|
||||||
# insert over 2M data in order to falling disc, generate one file
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
# $ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( now + 0s , $x ) ( now + 1s , $x ) ( now + 2s , $x ) ( now + 3s , $x ) ( now + 4s , $x ) ( now + 5s , $x ) ( now + 6s , $x ) ( now + 7s , $x ) ( now + 8s , $x ) ( now + 9s , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print rows:$rows data00:$data00
|
|
||||||
if $rows != 1 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
if $data00 == 0 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
$totalRows = $data00
|
|
||||||
|
|
||||||
print ============== step3: insert old data(now-15d) and new data(now+15d), control data rows in order to save in cache, not falling disc
|
|
||||||
sql insert into $tb values ( now - 20d , -20 )
|
|
||||||
sql insert into $tb values ( now - 40d , -40 )
|
|
||||||
$totalRows = $totalRows + 2
|
|
||||||
|
|
||||||
print ============== step4: stop dnode3, so date rows falling disc, generate two new files in dnode3
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
#$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
sleep $sleepTimer # waitting for move master vnode of dnode2 to dnode3
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ---->dnode3 data files: $system_content expect: 9
|
|
||||||
if $system_content != 9 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: insert two data rows: now-16d, now+16d,
|
|
||||||
sql insert into $tb values ( now - 21d , -21 )
|
|
||||||
sql insert into $tb values ( now - 41d , -41 )
|
|
||||||
$totalRows = $totalRows + 2
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ---->dnode2 data files: $system_content expect: 3
|
|
||||||
if $system_content != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step7: restart dnode3, waiting sync end
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_ready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ---->dnode2 data files: $system_content expect: 3
|
|
||||||
if $system_content != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ---->dnode3 data files: $system_content expect: 3
|
|
||||||
if $system_content != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
|
@ -1,52 +0,0 @@
|
||||||
# Test case describe: dnode1 is only mnode, dnode2/dnode3 are only vnode
|
|
||||||
# step 1: start dnode1
|
|
||||||
# step 2: start dnode2 and dnode3, and all added into cluster (Suppose dnode2 is master-vnode)
|
|
||||||
# step 3: create db, table, insert data, and Falling disc into file (control only one file, e.g. 1841)
|
|
||||||
# step 4: insert old data(now-20d) and new data(now-40d), control data rows in order to save in cache, not falling disc
|
|
||||||
# step 5: stop dnode2, so date rows falling disc, generate two new files 1840, 1842 in dnode2
|
|
||||||
# step 6: insert two data rows: now-21d, now-41d
|
|
||||||
# step 7: restart dnode2, waiting sync end
|
|
||||||
# expect: in dnode2, the files 1837 and 1839 will be removed
|
|
||||||
|
|
||||||
sql connect
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
print ============== step7: restart dnode2, waiting sync end
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
wait_dnode2_ready:
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_ready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
#$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_ready
|
|
||||||
endi
|
|
||||||
|
|
||||||
sleep 1000
|
|
||||||
# check using select
|
|
||||||
$db = db
|
|
||||||
$stb = stb
|
|
||||||
sql use $db
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00, should equal to dn2_mn1_cache_file_sync.sim output
|
|
||||||
#if $data00 != $totalRows then
|
|
||||||
# return -1
|
|
||||||
#endi
|
|
||||||
|
|
||||||
print ============== step8: please check there should be 1 file in sim/dnode2/data/vnode/vnode2/tsdb/data/, and 1 file sim/dnode3/data/vnode/vnode2/tsdb/data/
|
|
|
@ -1,101 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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 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 dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table to max tables
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 16
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 3
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 10
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step3: create one table, should return error for not more vnode
|
|
||||||
sql_error create table tbm using $stb tags( 10000 )
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,102 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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 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 dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table to max tables
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 16
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 3
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 10
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step3: drop dnode4, should return error for not more dnode
|
|
||||||
sql_error drop dnode $hostname4
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,310 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 3
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 10
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: drop the middle table 5
|
|
||||||
sql drop table tb5
|
|
||||||
$totalRows = $totalRows - 10
|
|
||||||
sleep 6000
|
|
||||||
|
|
||||||
print ============== step4: insert data into other tables
|
|
||||||
$tsStart = 1420041610000
|
|
||||||
$i = 0
|
|
||||||
$tblNum = 5
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
$i = 6
|
|
||||||
$tblNum = 10
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step5: create the middle table 5 and insert data
|
|
||||||
sql create table tb5 using $stb tags( 5 )
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$tsStart = 1420041620000
|
|
||||||
$i = 5
|
|
||||||
$tblNum = 6
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from tb5
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step6: drop the first table 0
|
|
||||||
sql drop table tb0
|
|
||||||
$totalRows = $totalRows - 20
|
|
||||||
sleep 6000
|
|
||||||
|
|
||||||
print ============== step7: insert data into other tables
|
|
||||||
$tsStart = 1420041630000
|
|
||||||
$i = 1
|
|
||||||
$tblNum = 10
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select count(*) from tb5
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != 20 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step8: create the first table 0 and insert data
|
|
||||||
sql create table tb0 using $stb tags( 0 )
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$tsStart = 1420041640000
|
|
||||||
$i = 0
|
|
||||||
$tblNum = 10
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from tb0
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step9: drop the last table 9
|
|
||||||
sql drop table tb9
|
|
||||||
$totalRows = $totalRows - 40
|
|
||||||
sleep 6000
|
|
||||||
|
|
||||||
print ============== step10: insert data into other tables
|
|
||||||
$tsStart = 1420041650000
|
|
||||||
$i = 0
|
|
||||||
$tblNum = 9
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step11: create the last table 9 and insert data
|
|
||||||
sql create table tb9 using $stb tags( 9 )
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$tsStart = 1420041660000
|
|
||||||
$i = 0
|
|
||||||
$tblNum = 10
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from tb9
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
|
@ -1,160 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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 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 arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode4 -c offlineThreshold -v 10
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster, then create database, create table , and insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$rowNum = 10
|
|
||||||
$tblNum = 16
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
print info: select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
sql reset query cache
|
|
||||||
sleep 1000
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode4, after timerout dnode4 will be auto-dropped.
|
|
||||||
### The script using down port to stop the network is invalid, so temp it stops the service instead
|
|
||||||
system sh/exec.sh -n dnode4 -s stop
|
|
||||||
#system sh/port.sh -p 7400 -s down
|
|
||||||
sleep 12000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_dropped:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: restart dnode4, but there no dnode4 in cluster
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
|
@ -1,358 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sleep 3000
|
|
||||||
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode3, and remove its vnodeX subdirector
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
#sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode3Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode2Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system rm -rf ../../../sim/dnode3/data
|
|
||||||
#system rm -rf ../../../sim/dnode3/data/vnode/*
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: restart dnode3, waiting sync end
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
#sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode2Vtatus: $dnode3Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode3Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode2Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode2, and remove its vnode
|
|
||||||
sleep 3000
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system rm -rf ../../../sim/dnode2/data
|
|
||||||
#system rm -rf ../../../sim/dnode2/data/vnode/*
|
|
||||||
#system rm -rf ../../../sim/dnode3/data/vnode/*
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step6: restart dnode2, and check rows
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
#sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_reready
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode2Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
|
@ -1,409 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 3
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode4, and remove its vnodeX subdirector
|
|
||||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode4Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode4Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system rm -rf ../../../sim/dnode4/data
|
|
||||||
#system rm -rf ../../../sim/dnode4/data/vnode/*
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: restart dnode4, waiting sync end
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
#sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode3/dnode2, and remove its vnode
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode23_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system rm -rf ../../../sim/dnode2/data
|
|
||||||
system rm -rf ../../../sim/dnode3/data
|
|
||||||
#system rm -rf ../../../sim/dnode2/data/vnode/*
|
|
||||||
#system rm -rf ../../../sim/dnode3/data/vnode/*
|
|
||||||
|
|
||||||
print ============== step6: restart dnode2/dnode3, and check rows
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode23_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_master:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step7: stop dnode3/dnode2, and cluster unable to provide services
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep 2000
|
|
||||||
sql select count(*) from $stb -x s71
|
|
||||||
s71:
|
|
||||||
|
|
||||||
print ============== step8: restart dnode2, and cluster Still unable to provide services
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql select count(*) from $stb -x s81
|
|
||||||
s81:
|
|
||||||
|
|
||||||
print ============== step9: restart dnode3, and cluster Resume service delivery
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_master_2:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master_2
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master_2
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master_2
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
|
@ -1,367 +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/cfg.sh -n dnode1 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode5 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 dnode5 -c balanceInterval -v 10
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 16
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 16
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 16
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 16
|
|
||||||
system sh/cfg.sh -n dnode5 -c maxVgroupsPerDb -v 16
|
|
||||||
|
|
||||||
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 dnode1 -c mnodeEqualVnodeNum -v 200
|
|
||||||
system sh/cfg.sh -n dnode2 -c mnodeEqualVnodeNum -v 200
|
|
||||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 200
|
|
||||||
system sh/cfg.sh -n dnode4 -c mnodeEqualVnodeNum -v 200
|
|
||||||
system sh/cfg.sh -n dnode5 -c mnodeEqualVnodeNum -v 200
|
|
||||||
|
|
||||||
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 dnode5 -c role -v 2
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode5 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode2 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode4 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode5 -c offlineThreshold -v 10
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode5 -c enableCoreFile -v 1
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster, then create database replica 2, create table , and insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = 16
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
print info: select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
sql reset query cache
|
|
||||||
sleep 1000
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: add one new dnode4 expect auto balancing
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 10000
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step4: stop dnode3, after offlineThreshold, dnode3 will be dropped for cluster
|
|
||||||
system sh/exec.sh -n dnode3 -s stop
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
#sleep 2000
|
|
||||||
#sql select * from information_schema.ins_dnodes
|
|
||||||
#print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
#print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
#print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
#$dnode2Status = $data4_2
|
|
||||||
#$dnode3Status = $data4_3
|
|
||||||
#$dnode4Status = $data4_4
|
|
||||||
#
|
|
||||||
#if $dnode1Status != ready then
|
|
||||||
# return -1
|
|
||||||
#endi
|
|
||||||
#if $dnode2Status != ready then
|
|
||||||
# return -1
|
|
||||||
#endi
|
|
||||||
#if $dnode3Status != offline then
|
|
||||||
# return -1
|
|
||||||
#endi
|
|
||||||
#if $dnode4Status != ready then
|
|
||||||
# return -1
|
|
||||||
#endi
|
|
||||||
|
|
||||||
sleep 15000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_drop:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_drop
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode1Status != ready then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode3Status != null then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4-1: restart dnode3, adn add into cluster
|
|
||||||
system rm -rf ../../../sim/dnode3
|
|
||||||
sleep 1000
|
|
||||||
|
|
||||||
system sh/deploy.sh -n dnode3 -i 3
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c walLevel -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c balanceInterval -v 10
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 4
|
|
||||||
system sh/cfg.sh -n dnode3 -c mnodeEqualVnodeNum -v 200
|
|
||||||
system sh/cfg.sh -n dnode3 -c role -v 2
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 10
|
|
||||||
system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 16
|
|
||||||
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_ready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print rows: $rows
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode1Status != ready then
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
if $dnode3Status != null then
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
if $dnode5Status != ready then
|
|
||||||
goto wait_dnode3_ready
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: start dnode5 and add into cluster , drop database
|
|
||||||
sql drop database $db
|
|
||||||
sleep 1000
|
|
||||||
system sh/exec.sh -n dnode5 -s start
|
|
||||||
sql create dnode $hostname5
|
|
||||||
sleep 2000
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode5:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode5
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
$dnode5Status = $data4_5
|
|
||||||
$dnode6Status = $data4_6
|
|
||||||
|
|
||||||
if $dnode1Status != ready then
|
|
||||||
goto wait_dnode5
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
goto wait_dnode5
|
|
||||||
endi
|
|
||||||
if $dnode3Status != null then
|
|
||||||
goto wait_dnode5
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
goto wait_dnode5
|
|
||||||
endi
|
|
||||||
if $dnode5Status != ready then
|
|
||||||
goto wait_dnode5
|
|
||||||
endi
|
|
||||||
if $dnode6Status != ready then
|
|
||||||
goto wait_dnode5
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step6: create database and table until not free vnodes
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = 32
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$db = db1
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
print info: select count(*) from $stb
|
|
||||||
sleep 2000
|
|
||||||
sql reset query cache
|
|
||||||
sleep 2000
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step7: drop dnode $hostname5, system should prompt "DB error: no enough dnodes"
|
|
||||||
sql_error drop dnode $hostname5
|
|
||||||
print error: $error
|
|
||||||
print ============== step8: create table tb_more using $stb tags( 1000 ), system should prompt 'DB error: no enough dnodes'
|
|
||||||
sql_error create table tb_more using $stb tags( 1000 )
|
|
||||||
print error: $error
|
|
|
@ -1,358 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2 and add into cluster , then create database with replica 1, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
step1:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print dnode1 $data4_1
|
|
||||||
print dnode2 $data4_2
|
|
||||||
|
|
||||||
if $data4_1 != ready then
|
|
||||||
goto step1
|
|
||||||
endi
|
|
||||||
if $data4_2 != ready then
|
|
||||||
goto step1
|
|
||||||
endi
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 1
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step2-1: stop dnode2 for falling disc, then restart dnode2, and check rows
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
a0:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 1 then
|
|
||||||
goto a0
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: start dnode3 and add into cluster , then alter replica from 1 to 2, and waiting sync
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sql create dnode $hostname3
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
step2:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print dnode1 $data4_1
|
|
||||||
print dnode2 $data4_2
|
|
||||||
print dnode3 $data4_3
|
|
||||||
|
|
||||||
if $data4_3 != ready then
|
|
||||||
goto step2
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql alter database $db replica 2
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
a1:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 2 then
|
|
||||||
goto a1
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: stop dnode2 for checking if sync ok
|
|
||||||
system sh/exec.sh -n dnode2 -s stop
|
|
||||||
$x = 0
|
|
||||||
a2:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 1 then
|
|
||||||
goto a2
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: restart dnode2
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
$x = 0
|
|
||||||
a3:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 2 then
|
|
||||||
goto a3
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step6: start dnode4 and add into cluster , then alter replica from 2 to 3, and waiting sync
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname4
|
|
||||||
$x = 0
|
|
||||||
step6:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print dnode1 $data4_1
|
|
||||||
print dnode2 $data4_2
|
|
||||||
print dnode3 $data4_3
|
|
||||||
print dnode4 $data4_4
|
|
||||||
|
|
||||||
if $data4_4 != ready then
|
|
||||||
goto step6
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql alter database $db replica 3
|
|
||||||
$x = 0
|
|
||||||
a4:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 3 then
|
|
||||||
goto a4
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step7: alter replica from 3 to 2, and waiting sync
|
|
||||||
sql alter database $db replica 2
|
|
||||||
$x = 0
|
|
||||||
a5:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 2 then
|
|
||||||
goto a5
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step8: alter replica from 2 to 1, and waiting sync
|
|
||||||
sql alter database $db replica 1
|
|
||||||
$x = 0
|
|
||||||
a6:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 1 then
|
|
||||||
goto a6
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step9: drop dnode2/dnode3
|
|
||||||
sql drop dnode $hostname2
|
|
||||||
sql drop dnode $hostname3
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
step9:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
goto step9
|
|
||||||
endi
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
a7:
|
|
||||||
$x = $x + 1
|
|
||||||
sleep 1000
|
|
||||||
if $x == 40 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print online vnodes $data03
|
|
||||||
if $data03 != 1 then
|
|
||||||
goto a7
|
|
||||||
endi
|
|
||||||
|
|
||||||
sleep $sleepTimer #waiting move vnode from dnode3/dnode3 to dnode4
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows 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
|
|
||||||
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,150 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
$sleepTimer = 10000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: drop dnode4, then check rows
|
|
||||||
#system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
||||||
sql drop dnode $hostname4
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_dropped:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql reset query cache
|
|
||||||
sql select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows 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
|
|
||||||
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,222 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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 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 arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c offlineThreshold -v 5
|
|
||||||
system sh/cfg.sh -n dnode2 -c offlineThreshold -v 5
|
|
||||||
system sh/cfg.sh -n dnode3 -c offlineThreshold -v 5
|
|
||||||
system sh/cfg.sh -n dnode4 -c offlineThreshold -v 5
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c enableCoreFile -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster, then create database, create table , and insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$rowNum = 10
|
|
||||||
$tblNum = 16
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x )
|
|
||||||
$x = $x + 10
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
print info: select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
sql reset query cache
|
|
||||||
sleep 1000
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode4, after timerout dnode4 will be auto-dropped.
|
|
||||||
system sh/exec.sh -n dnode4 -s stop
|
|
||||||
sleep 12000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_dropped:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_dropped
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: restart dnode4, but there are not dnode4 in cluster
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: recreate dnode4 into cluster, result should fail
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 12000
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: remove dnode4 director, then recreate dnode4 into cluster, result should ok
|
|
||||||
system sh/exec.sh -n dnode4 -s stop
|
|
||||||
system rm -rf ../../../sim/dnode4
|
|
||||||
|
|
||||||
system sh/deploy.sh -n dnode4 -i 4
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c walLevel -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c balanceInterval -v 10
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 4
|
|
||||||
system sh/cfg.sh -n dnode4 -c role -v 2
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c offlineThreshold -v 5
|
|
||||||
system sh/cfg.sh -n dnode4 -c enableCoreFile -v 1
|
|
||||||
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 6000
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_ready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_ready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_6
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_ready
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_ready
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_ready
|
|
||||||
endi
|
|
|
@ -1,319 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
|
|
||||||
print ============== step3: stop dnode4, then destroy the contents of its data file
|
|
||||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode4Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
wait_dnode4_vgroup_offline:
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode4Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system echo "haha, nothing......" > ../../../sim/dnode4/data/vnode/vnode2/tsdb/data/v2f1643.data
|
|
||||||
#system rm -rf ../../../sim/dnode4/data/vnode/*
|
|
||||||
sleep 1000
|
|
||||||
|
|
||||||
print ============== step3-1: insert new data
|
|
||||||
sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: restart dnode4, waiting sync end
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode3/dnode2, and check rows
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode23_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_master:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_master
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
|
@ -1,435 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
#system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
#sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode3 for falling disc, then corrupt vnode data file in dnode3
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode3Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode2Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
#$expectCnt = 3 . :
|
|
||||||
#print expectCnt: [ $expectCnt ]
|
|
||||||
#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':'
|
|
||||||
#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':'
|
|
||||||
#print --2-->dnode3 data files: [ $system_content ]
|
|
||||||
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n'
|
|
||||||
print ---->dnode2 data files: $system_content expect: 0
|
|
||||||
if $system_content != 0 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n'
|
|
||||||
print ---->dnode3 data files: $system_content expect: 3
|
|
||||||
if $system_content != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v2f1643.data
|
|
||||||
|
|
||||||
print ============== step3-1: insert some news data for let version changed
|
|
||||||
sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x )
|
|
||||||
sql insert into $tb values ( now + 10a , $x ) ( now + 11a , $x ) ( now + 12a , $x )
|
|
||||||
$totalRows = $totalRows + 6
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: restart dnode3, and run query
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ----> dnode2 data files: $system_content expect: 0
|
|
||||||
if $system_content != 0 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ----> dnode3 data files: $system_content expect: 0
|
|
||||||
if $system_content != 0 then
|
|
||||||
print there should be no data file in dnode3 after sync
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode2, and check if dnode3 sync ok
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_master:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step6: stop dnode3 for falling disck
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step7: restart dnode3, and run query
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode23_reready_2:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready_2
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready_2
|
|
||||||
endi
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready_2
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode23_vgroup_ok:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_vgroup_ok
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus == offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_vgroup_ok
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus == offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_vgroup_ok
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,354 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data to can fall disc
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
#system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
#sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 4
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db cache 1 replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 128 * 1024
|
|
||||||
$tblNum = 1
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
$tsLast = $ts + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: corrupt vnode data file in dnode3, not stop dnode3
|
|
||||||
system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v2f1643.data
|
|
||||||
sleep 1000
|
|
||||||
|
|
||||||
print ============== step4: insert new data, and run query
|
|
||||||
sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print select * from information_schema.ins_dnodes
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
|
|
||||||
print show vgroups
|
|
||||||
sql show vgroups
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
|
|
||||||
|
|
||||||
$tsStart = $tsLast + 1
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
#sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
$tsLast = $ts + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode2, and check if dnode3 sync ok
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_master:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step6: stop dnode3 for falling disc
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step7: restart dnode2/dnode3, and run query
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_master_1:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master_1
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master_1
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master_1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,316 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
#system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
#sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: corrupt vnode data file in dnode3, not stop dnode3
|
|
||||||
system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/v2f1643.data
|
|
||||||
sleep 1000
|
|
||||||
|
|
||||||
print ============== step4: insert new data, and run query
|
|
||||||
sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode2, and check if dnode3 sync ok
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_master:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step6: stop dnode3 for falling disc
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step7: restart dnode2/dnode3, and run query
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 3 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_master_1:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master_1
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master_1
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master_1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,458 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 3
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode4, and remove its vnodeX subdirector
|
|
||||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode4Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode4Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system rm -rf ../../../sim/dnode4/data/vnode/*
|
|
||||||
|
|
||||||
print ============== step4: restart dnode4, waiting sync end
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode3, and remove its vnodeX subdirector
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system rm -rf ../../../sim/dnode3/data/vnode/*
|
|
||||||
|
|
||||||
print ============== step6: restart dnode3, and check rows
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step7: stop dnode2, and remove its vnodeX subdirector
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline
|
|
||||||
endi
|
|
||||||
if $dnode4Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
system rm -rf ../../../sim/dnode2/data/vnode/*
|
|
||||||
|
|
||||||
print ============== step8: restart dnode2, and check rows
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_reready
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
print dnode4Vtatus: $dnode4Vtatus
|
|
||||||
print dnode3Vtatus: $dnode3Vtatus
|
|
||||||
if $dnode4Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
# check using select
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql insert into $tb values ( now , 20000 ) ( now + 1a, 20001 ) ( now + 2a, 20002 )
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,434 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v $totalTableNum
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3 and add into cluster , then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
#system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
#sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
sleep 1000
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode3 for falling disc, then corrupt vnode data file in dnode3
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode3Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode2Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
#$expectCnt = 3 . :
|
|
||||||
#print expectCnt: [ $expectCnt ]
|
|
||||||
#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':'
|
|
||||||
#system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr '\n' ':'
|
|
||||||
#print --2-->dnode3 data files: [ $system_content ]
|
|
||||||
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n'
|
|
||||||
print ---->dnode2 data files: $system_content expect: 0
|
|
||||||
if $system_content != 0 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l | grep "^-" | wc -l | tr -d '\n'
|
|
||||||
print ---->dnode3 data files: $system_content expect: 3
|
|
||||||
if $system_content != 3 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
#system echo "haha, nothing......" > ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/f1643.data
|
|
||||||
|
|
||||||
print ============== step3-1: insert some news data for let version changed
|
|
||||||
sql insert into $tb values ( now + 0a , $x ) ( now + 1a , $x ) ( now + 2a , $x )
|
|
||||||
sql insert into $tb values ( now + 10a , $x ) ( now + 11a , $x ) ( now + 12a , $x )
|
|
||||||
$totalRows = $totalRows + 6
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step4: restart dnode3, and run query
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_reready:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_reready
|
|
||||||
endi
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_slave:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != slave then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_slave
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode2/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ----> dnode2 data files: $system_content expect: 0
|
|
||||||
if $system_content != 0 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
system_content ls ../../../sim/dnode3/data/vnode/vnode2/tsdb/data/ -l |grep "^-"|wc -l | tr -d '\n'
|
|
||||||
print ----> dnode3 data files: $system_content expect: 0
|
|
||||||
if $system_content != 0 then
|
|
||||||
print there should be no data file in dnode3 after sync
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode2, and check if dnode3 sync ok
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_vgroup_master:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_vgroup_master
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step6: stop dnode3 for falling disck
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
|
|
||||||
|
|
||||||
print ============== step7: restart dnode2/dnode3, and run query
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode23_reready_2:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 4 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready_2
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready_2
|
|
||||||
endi
|
|
||||||
if $dnode3Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_reready_2
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode23_vgroup_ok:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_vgroup_ok
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode2Vtatus = $data7_2
|
|
||||||
$dnode3Vtatus = $data5_2
|
|
||||||
|
|
||||||
if $dnode2Vtatus == offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_vgroup_ok
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus == offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode23_vgroup_ok
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,299 +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 numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c numOfMnodes -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c numOfMnodes -v 1
|
|
||||||
|
|
||||||
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 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 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 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
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxtablesPerVnode -v 20
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxtablesPerVnode -v 20
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxtablesPerVnode -v 20
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxtablesPerVnode -v 20
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode2 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode3 -c maxVgroupsPerDb -v 1
|
|
||||||
system sh/cfg.sh -n dnode4 -c maxVgroupsPerDb -v 1
|
|
||||||
|
|
||||||
system sh/cfg.sh -n dnode1 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode2 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode3 -c arbitrator -v $arbitrator
|
|
||||||
system sh/cfg.sh -n dnode4 -c arbitrator -v $arbitrator
|
|
||||||
|
|
||||||
print ============== step0: start tarbitrator
|
|
||||||
system sh/exec_tarbitrator.sh -s start
|
|
||||||
|
|
||||||
print ============== step1: start dnode1, only deploy mnode
|
|
||||||
system sh/exec.sh -n dnode1 -s start
|
|
||||||
sleep 2000
|
|
||||||
sql connect
|
|
||||||
|
|
||||||
print ============== step2: start dnode2/dnode3/dnode4 and add into cluster , then create database with replica 3, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
system sh/exec.sh -n dnode3 -s start
|
|
||||||
system sh/exec.sh -n dnode4 -s start
|
|
||||||
sql create dnode $hostname2
|
|
||||||
sql create dnode $hostname3
|
|
||||||
sql create dnode $hostname4
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db
|
|
||||||
sql create database $db replica 3
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step3: stop dnode4/dnode2
|
|
||||||
system sh/exec.sh -n dnode4 -s stop -x SIGINT
|
|
||||||
system sh/exec.sh -n dnode2 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
#print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
#print $data0_5 $data1_5 $data2_5 $data3_5 $data4_5
|
|
||||||
#print $data0_6 $data1_6 $data2_6 $data3_6 $data4_6
|
|
||||||
#$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
#$dnode5Status = $data4_5
|
|
||||||
|
|
||||||
if $dnode4Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
if $dnode2Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode4_vgroup_offline:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode4Vtatus = $data5_2
|
|
||||||
$dnode3Vtatus = $data7_2
|
|
||||||
|
|
||||||
if $dnode4Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
if $dnode3Vtatus != unsynced then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode4_vgroup_offline
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql select count(*) from $stb -x s31
|
|
||||||
s31:
|
|
||||||
#sql_error insert into $tb values (now, 9988) -x s32
|
|
||||||
#s32:
|
|
||||||
|
|
||||||
print ============== step4: restart dnode2, then create database with replica 2, and create table, insert data
|
|
||||||
system sh/exec.sh -n dnode2 -s start
|
|
||||||
sleep 2000
|
|
||||||
|
|
||||||
$totalTableNum = 10
|
|
||||||
$sleepTimer = 3000
|
|
||||||
|
|
||||||
$db = db1
|
|
||||||
sql create database $db replica 2
|
|
||||||
sql use $db
|
|
||||||
|
|
||||||
# create table , insert data
|
|
||||||
$stb = stb
|
|
||||||
sql create table $stb (ts timestamp, c1 int) tags(t1 int)
|
|
||||||
$rowNum = 100
|
|
||||||
$tblNum = $totalTableNum
|
|
||||||
$totalRows = 0
|
|
||||||
$tsStart = 1420041600000
|
|
||||||
|
|
||||||
$i = 0
|
|
||||||
while $i < $tblNum
|
|
||||||
$tb = tb . $i
|
|
||||||
sql create table $tb using $stb tags( $i )
|
|
||||||
|
|
||||||
$x = 0
|
|
||||||
while $x < $rowNum
|
|
||||||
$ts = $tsStart + $x
|
|
||||||
sql insert into $tb values ( $ts + 0a , $x ) ( $ts + 1a , $x ) ( $ts + 2a , $x ) ( $ts + 3a , $x ) ( $ts + 4a , $x ) ( $ts + 5a , $x ) ( $ts + 6a , $x ) ( $ts + 7a , $x ) ( $ts + 8a , $x ) ( $ts + 9a , $x ) ( $ts + 10a , $x ) ( $ts + 11a , $x ) ( $ts + 12a , $x ) ( $ts + 13a , $x ) ( $ts + 14a , $x ) ( $ts + 15a , $x ) ( $ts + 16a , $x ) ( $ts + 17a , $x ) ( $ts + 18a , $x ) ( $ts + 19a , $x ) ( $ts + 20a , $x ) ( $ts + 21a , $x ) ( $ts + 22a , $x ) ( $ts + 23a , $x ) ( $ts + 24a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 25a , $x ) ( $ts + 26a , $x ) ( $ts + 27a , $x ) ( $ts + 28a , $x ) ( $ts + 29a , $x ) ( $ts + 30a , $x ) ( $ts + 31a , $x ) ( $ts + 32a , $x ) ( $ts + 33a , $x ) ( $ts + 34a , $x ) ( $ts + 35a , $x ) ( $ts + 36a , $x ) ( $ts + 37a , $x ) ( $ts + 38a , $x ) ( $ts + 39a , $x ) ( $ts + 40a , $x ) ( $ts + 41a , $x ) ( $ts + 42a , $x ) ( $ts + 43a , $x ) ( $ts + 44a , $x ) ( $ts + 45a , $x ) ( $ts + 46a , $x ) ( $ts + 47a , $x ) ( $ts + 48a , $x ) ( $ts + 49a , $x ) ( $ts + 50a , $x ) ( $ts + 51a , $x ) ( $ts + 52a , $x ) ( $ts + 53a , $x ) ( $ts + 54a , $x ) ( $ts + 55a , $x ) ( $ts + 56a , $x ) ( $ts + 57a , $x ) ( $ts + 58a , $x ) ( $ts + 59a , $x )
|
|
||||||
$x = $x + 60
|
|
||||||
endw
|
|
||||||
$totalRows = $totalRows + $x
|
|
||||||
print info: inserted $x rows into $tb and totalRows: $totalRows
|
|
||||||
$i = $i + 1
|
|
||||||
endw
|
|
||||||
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
print ============== step5: stop dnode3
|
|
||||||
system sh/exec.sh -n dnode3 -s stop -x SIGINT
|
|
||||||
sleep $sleepTimer
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode3_offline_0:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql select * from information_schema.ins_dnodes
|
|
||||||
if $rows != 5 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3
|
|
||||||
print $data0_4 $data1_4 $data2_4 $data3_4 $data4_4
|
|
||||||
|
|
||||||
$dnode1Status = $data4_1
|
|
||||||
$dnode2Status = $data4_2
|
|
||||||
$dnode3Status = $data4_3
|
|
||||||
$dnode4Status = $data4_4
|
|
||||||
print dnode1Status $dnode1Status
|
|
||||||
print dnode2Status $dnode2Status
|
|
||||||
print dnode3Status $dnode3Status
|
|
||||||
print dnode4Status $dnode4Status
|
|
||||||
|
|
||||||
if $dnode3Status != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
if $dnode2Status != ready then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode3_offline_0
|
|
||||||
endi
|
|
||||||
|
|
||||||
$loopCnt = 0
|
|
||||||
wait_dnode2_vgroup_master:
|
|
||||||
$loopCnt = $loopCnt + 1
|
|
||||||
if $loopCnt == 10 then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
sql show vgroups
|
|
||||||
if $rows != 1 then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_master
|
|
||||||
endi
|
|
||||||
print show vgroups:
|
|
||||||
print $data0_1 $data1_1 $data2_1 $data3_1 $data4_1 $data5_1 $data6_1 $data7_1 $data8_1 $data9_1
|
|
||||||
print $data0_2 $data1_2 $data2_2 $data3_2 $data4_2 $data5_2 $data6_2 $data7_2 $data8_2 $data9_2
|
|
||||||
print $data0_3 $data1_3 $data2_3 $data3_3 $data4_3 $data5_3 $data6_3 $data7_3 $data8_3 $data9_3
|
|
||||||
$dnode3Vtatus = $data5_3
|
|
||||||
$dnode2Vtatus = $data7_3
|
|
||||||
|
|
||||||
if $dnode3Vtatus != offline then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_master
|
|
||||||
endi
|
|
||||||
if $dnode2Vtatus != master then
|
|
||||||
sleep 2000
|
|
||||||
goto wait_dnode2_vgroup_master
|
|
||||||
endi
|
|
||||||
|
|
||||||
sql insert into $tb values (now, 9000) (now + 1s, 9001) (now + 2s, 9002)
|
|
||||||
$totalRows = $totalRows + 3
|
|
||||||
sql select count(*) from $stb
|
|
||||||
print data00 $data00
|
|
||||||
if $data00 != $totalRows then
|
|
||||||
return -1
|
|
||||||
endi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue