提交 5b3c019f 编写于 作者: S Shuduo Sang

Merge branch 'develop' into feature/add-testcase-to-test-boundary

...@@ -50,7 +50,7 @@ matrix: ...@@ -50,7 +50,7 @@ matrix:
./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $? ./test-all.sh $TRAVIS_EVENT_TYPE || travis_terminate $?
cd ${TRAVIS_BUILD_DIR}/tests/pytest cd ${TRAVIS_BUILD_DIR}/tests/pytest
./valgrind-test.sh -g 2>&1 | tee mem-error-out.txt ./valgrind-test.sh -g 2>&1 > mem-error-out.txt
sleep 1 sleep 1
# Color setting # Color setting
...@@ -60,7 +60,7 @@ matrix: ...@@ -60,7 +60,7 @@ matrix:
GREEN_UNDERLINE='\033[4;32m' GREEN_UNDERLINE='\033[4;32m'
NC='\033[0m' NC='\033[0m'
grep 'ERROR SUMMARY' mem-error-out.txt|grep -v 'grep'|uniq|tee uniq-mem-error-out.txt grep 'start to execute\|ERROR SUMMARY' mem-error-out.txt|grep -v 'grep'|uniq|tee uniq-mem-error-out.txt
for memError in `cat uniq-mem-error-out.txt | awk '{print $4}'` for memError in `cat uniq-mem-error-out.txt | awk '{print $4}'`
do do
...@@ -73,7 +73,7 @@ matrix: ...@@ -73,7 +73,7 @@ matrix:
fi fi
done done
grep 'definitely lost:' mem-error-out.txt|grep -v 'grep'|uniq|tee uniq-definitely-lost-out.txt grep 'start to execute\|definitely lost:' mem-error-out.txt|grep -v 'grep'|uniq|tee uniq-definitely-lost-out.txt
for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'` for defiMemError in `cat uniq-definitely-lost-out.txt | awk '{print $7}'`
do do
if [ -n "$defiMemError" ]; then if [ -n "$defiMemError" ]; then
......
...@@ -109,6 +109,11 @@ static void monitorStartSystemRetry() { ...@@ -109,6 +109,11 @@ static void monitorStartSystemRetry() {
} }
static void monitorInitConn(void *para, void *unused) { static void monitorInitConn(void *para, void *unused) {
if (dnodeGetDnodeId() <= 0) {
monitorStartSystemRetry();
return;
}
monitorPrint("starting to initialize monitor service .."); monitorPrint("starting to initialize monitor service ..");
tsMonitorConn.state = MONITOR_STATE_INITIALIZING; tsMonitorConn.state = MONITOR_STATE_INITIALIZING;
......
...@@ -31,21 +31,21 @@ extern int tsdbDebugFlag; ...@@ -31,21 +31,21 @@ extern int tsdbDebugFlag;
#define tsdbError(...) \ #define tsdbError(...) \
if (tsdbDebugFlag & DEBUG_ERROR) { \ if (tsdbDebugFlag & DEBUG_ERROR) { \
taosPrintLog("ERROR TSDB ", tsdbDebugFlag, __VA_ARGS__); \ taosPrintLog("ERROR TDB ", tsdbDebugFlag, __VA_ARGS__); \
} }
#define tsdbWarn(...) \ #define tsdbWarn(...) \
if (tsdbDebugFlag & DEBUG_WARN) { \ if (tsdbDebugFlag & DEBUG_WARN) { \
taosPrintLog("WARN TSDB ", tsdbDebugFlag, __VA_ARGS__); \ taosPrintLog("WARN TDB ", tsdbDebugFlag, __VA_ARGS__); \
} }
#define tsdbTrace(...) \ #define tsdbTrace(...) \
if (tsdbDebugFlag & DEBUG_TRACE) { \ if (tsdbDebugFlag & DEBUG_TRACE) { \
taosPrintLog("TSDB ", tsdbDebugFlag, __VA_ARGS__); \ taosPrintLog("TDB ", tsdbDebugFlag, __VA_ARGS__); \
} }
#define tsdbPrint(...) \ #define tsdbPrint(...) \
{ taosPrintLog("TSDB ", 255, __VA_ARGS__); } { taosPrintLog("TDB ", 255, __VA_ARGS__); }
// ------------------------------ TSDB META FILE INTERFACES ------------------------------ // ------------------------------ TSDB META FILE INTERFACES ------------------------------
#define TSDB_META_FILE_NAME "META" #define TSDB_META_FILE_NAME "meta"
#define TSDB_META_HASH_FRACTION 1.1 #define TSDB_META_HASH_FRACTION 1.1
typedef int (*iterFunc)(void *, void *cont, int contLen); typedef int (*iterFunc)(void *, void *cont, int contLen);
......
...@@ -18,7 +18,7 @@ int tsdbDebugFlag = 135; ...@@ -18,7 +18,7 @@ int tsdbDebugFlag = 135;
#define TSDB_MIN_ID 0 #define TSDB_MIN_ID 0
#define TSDB_MAX_ID INT_MAX #define TSDB_MAX_ID INT_MAX
#define TSDB_CFG_FILE_NAME "CONFIG" #define TSDB_CFG_FILE_NAME "config"
#define TSDB_DATA_DIR_NAME "data" #define TSDB_DATA_DIR_NAME "data"
#define TSDB_DEFAULT_FILE_BLOCK_ROW_OPTION 0.7 #define TSDB_DEFAULT_FILE_BLOCK_ROW_OPTION 0.7
#define TSDB_MAX_LAST_FILE_SIZE (1024 * 1024 * 10) // 10M #define TSDB_MAX_LAST_FILE_SIZE (1024 * 1024 * 10) // 10M
...@@ -169,6 +169,7 @@ static int tsdbRestoreInfo(STsdbRepo *pRepo) { ...@@ -169,6 +169,7 @@ static int tsdbRestoreInfo(STsdbRepo *pRepo) {
if (tsdbSetAndOpenHelperFile(&rhelper, pFGroup) < 0) goto _err; if (tsdbSetAndOpenHelperFile(&rhelper, pFGroup) < 0) goto _err;
for (int i = 1; i < pRepo->config.maxTables; i++) { for (int i = 1; i < pRepo->config.maxTables; i++) {
STable * pTable = pMeta->tables[i]; STable * pTable = pMeta->tables[i];
if (pTable == NULL) continue;
SCompIdx *pIdx = &rhelper.pCompIdx[i]; SCompIdx *pIdx = &rhelper.pCompIdx[i];
if (pIdx->offset > 0 && pTable->lastKey < pIdx->maxKey) pTable->lastKey = pIdx->maxKey; if (pIdx->offset > 0 && pTable->lastKey < pIdx->maxKey) pTable->lastKey = pIdx->maxKey;
...@@ -841,8 +842,8 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable ...@@ -841,8 +842,8 @@ static int32_t tdInsertRowToTable(STsdbRepo *pRepo, SDataRow row, STable *pTable
pTable->mem->numOfPoints = tSkipListGetSize(pTable->mem->pData); pTable->mem->numOfPoints = tSkipListGetSize(pTable->mem->pData);
tsdbTrace("vgId:%d, tid:%d, uid:%" PRId64 ", a row is inserted to table! key:%" PRId64, tsdbTrace("vgId:%d, tid:%d, uid:%" PRId64 ", table:%s a row is inserted to table! key:%" PRId64, pRepo->config.tsdbId,
pRepo->config.tsdbId, pTable->tableId.tid, pTable->tableId.uid, dataRowKey(row)); pTable->tableId.tid, pTable->tableId.uid, varDataVal(pTable->name), dataRowKey(row));
return 0; return 0;
} }
...@@ -867,9 +868,9 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY ...@@ -867,9 +868,9 @@ static int32_t tsdbInsertDataToTable(TsdbRepoT *repo, SSubmitBlk *pBlock, TSKEY
tsdbInitSubmitBlkIter(pBlock, &blkIter); tsdbInitSubmitBlkIter(pBlock, &blkIter);
while ((row = tsdbGetSubmitBlkNext(&blkIter)) != NULL) { while ((row = tsdbGetSubmitBlkNext(&blkIter)) != NULL) {
if (dataRowKey(row) < minKey || dataRowKey(row) > maxKey) { if (dataRowKey(row) < minKey || dataRowKey(row) > maxKey) {
tsdbError("vgId:%d, table tid:%d, talbe uid:%ld timestamp is out of range. now:" PRId64 ", maxKey:" PRId64 tsdbError("vgId:%d, table:%s, tid:%d, talbe uid:%ld timestamp is out of range. now:" PRId64 ", maxKey:" PRId64
", minKey:" PRId64, ", minKey:" PRId64,
pRepo->config.tsdbId, pTable->tableId.tid, pTable->tableId.uid, now, minKey, maxKey); pRepo->config.tsdbId, varDataVal(pTable->name), pTable->tableId.tid, pTable->tableId.uid, now, minKey, maxKey);
return TSDB_CODE_TIMESTAMP_OUT_OF_RANGE; return TSDB_CODE_TIMESTAMP_OUT_OF_RANGE;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "tsdbMain.h" #include "tsdbMain.h"
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here #define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
#define TSDB_META_FILE_NAME "META" // #define TSDB_META_FILE_NAME "META"
const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; // skip list built based on the first column of tags const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; // skip list built based on the first column of tags
...@@ -310,7 +310,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { ...@@ -310,7 +310,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
// todo refactor extract method // todo refactor extract method
size_t size = strnlen(pCfg->sname, TSDB_TABLE_NAME_LEN); size_t size = strnlen(pCfg->sname, TSDB_TABLE_NAME_LEN);
super->name = malloc(size + VARSTR_HEADER_SIZE); super->name = calloc(1, size + VARSTR_HEADER_SIZE + 1);
STR_WITH_SIZE_TO_VARSTR(super->name, pCfg->sname, size); STR_WITH_SIZE_TO_VARSTR(super->name, pCfg->sname, size);
// index the first tag column // index the first tag column
...@@ -339,7 +339,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { ...@@ -339,7 +339,7 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
table->tableId = pCfg->tableId; table->tableId = pCfg->tableId;
size_t size = strnlen(pCfg->name, TSDB_TABLE_NAME_LEN); size_t size = strnlen(pCfg->name, TSDB_TABLE_NAME_LEN);
table->name = malloc(size + VARSTR_HEADER_SIZE); table->name = calloc(1, size + VARSTR_HEADER_SIZE + 1);
STR_WITH_SIZE_TO_VARSTR(table->name, pCfg->name, size); STR_WITH_SIZE_TO_VARSTR(table->name, pCfg->name, size);
table->lastKey = 0; table->lastKey = 0;
...@@ -356,12 +356,12 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) { ...@@ -356,12 +356,12 @@ int tsdbCreateTable(TsdbRepoT *repo, STableCfg *pCfg) {
// Register to meta // Register to meta
if (newSuper) { if (newSuper) {
tsdbAddTableToMeta(pMeta, super, true); tsdbAddTableToMeta(pMeta, super, true);
tsdbTrace("vgId:%d, super table is created! uid:%" PRId64, pRepo->config.tsdbId, tsdbTrace("vgId:%d, super table %s is created! uid:%" PRId64, pRepo->config.tsdbId, varDataVal(super->name),
super->tableId.uid); super->tableId.uid);
} }
tsdbAddTableToMeta(pMeta, table, true); tsdbAddTableToMeta(pMeta, table, true);
tsdbTrace("vgId:%d, table is created! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, table->tableId.tid, tsdbTrace("vgId:%d, table %s is created! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(table->name),
table->tableId.uid); table->tableId.tid, table->tableId.uid);
// Write to meta file // Write to meta file
int bufLen = 0; int bufLen = 0;
...@@ -409,7 +409,8 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) { ...@@ -409,7 +409,8 @@ int tsdbDropTable(TsdbRepoT *repo, STableId tableId) {
return -1; return -1;
} }
tsdbTrace("vgId:%d, table is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, tableId.tid, tableId.uid); tsdbTrace("vgId:%d, table %s is dropped! tid:%d, uid:%" PRId64, pRepo->config.tsdbId, varDataVal(pTable->name),
tableId.tid, tableId.uid);
if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1; if (tsdbRemoveTableFromMeta(pMeta, pTable) < 0) return -1;
return 0; return 0;
......
...@@ -174,7 +174,7 @@ void tSkipListNewNodeInfo(SSkipList *pSkipList, int32_t *level, int32_t *headSiz ...@@ -174,7 +174,7 @@ void tSkipListNewNodeInfo(SSkipList *pSkipList, int32_t *level, int32_t *headSiz
SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode); SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode);
/** /**
* get only *one* node of which key is equalled to pKey, even there are more than one nodes are of the same key * get *all* nodes which key are equivalent to pKey
* *
* @param pSkipList * @param pSkipList
* @param pKey * @param pKey
...@@ -234,14 +234,13 @@ SSkipListNode *tSkipListIterGet(SSkipListIterator *iter); ...@@ -234,14 +234,13 @@ SSkipListNode *tSkipListIterGet(SSkipListIterator *iter);
void *tSkipListDestroyIter(SSkipListIterator *iter); void *tSkipListDestroyIter(SSkipListIterator *iter);
/* /*
* remove only one node of the pKey value. * remove nodes of the pKey value.
* If more than one node has the same value, any one will be removed * If more than one node has the same value, all will be removed
* *
* @Return * @Return
* true: one node has been removed * the count of removed nodes
* false: no node has been removed
*/ */
bool tSkipListRemove(SSkipList *pSkipList, SSkipListKey key); uint32_t tSkipListRemove(SSkipList *pSkipList, SSkipListKey key);
/* /*
* remove the specified node in parameters * remove the specified node in parameters
......
...@@ -74,7 +74,47 @@ static void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSk ...@@ -74,7 +74,47 @@ static void tSkipListDoInsert(SSkipList *pSkipList, SSkipListNode **forward, SSk
static SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode); static SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode);
static SSkipListNode* tSkipListPushFront(SSkipList* pSkipList, SSkipListNode *pNode); static SSkipListNode* tSkipListPushFront(SSkipList* pSkipList, SSkipListNode *pNode);
static SSkipListIterator* doCreateSkipListIterator(SSkipList *pSkipList, int32_t order); static SSkipListIterator* doCreateSkipListIterator(SSkipList *pSkipList, int32_t order);
static SSkipListNode* tSkipListDoGet(SSkipList *pSkipList, SSkipListKey key);
// when order is TSDB_ORDER_ASC, return the last node with key less than val
// when order is TSDB_ORDER_DESC, return the first node with key large than val
static SSkipListNode* getPriorNode(SSkipList* pSkipList, const char* val, int32_t order) {
__compar_fn_t comparFn = pSkipList->comparFn;
SSkipListNode *pNode = NULL;
if (order == TSDB_ORDER_ASC) {
pNode = pSkipList->pHead;
for (int32_t i = pSkipList->level - 1; i >= 0; --i) {
SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, i);
while (p != pSkipList->pTail) {
char *key = SL_GET_NODE_KEY(pSkipList, p);
if (comparFn(key, val) < 0) {
pNode = p;
p = SL_GET_FORWARD_POINTER(p, i);
} else {
break;
}
}
}
} else {
pNode = pSkipList->pTail;
for (int32_t i = pSkipList->level - 1; i >= 0; --i) {
SSkipListNode *p = SL_GET_BACKWARD_POINTER(pNode, i);
while (p != pSkipList->pHead) {
char *key = SL_GET_NODE_KEY(pSkipList, p);
if (comparFn(key, val) > 0) {
pNode = p;
p = SL_GET_BACKWARD_POINTER(p, i);
} else {
break;
}
}
}
}
return pNode;
}
static bool initForwardBackwardPtr(SSkipList* pSkipList) { static bool initForwardBackwardPtr(SSkipList* pSkipList) {
uint32_t maxLevel = pSkipList->maxLevel; uint32_t maxLevel = pSkipList->maxLevel;
...@@ -110,7 +150,11 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint8_t keyLen, ui ...@@ -110,7 +150,11 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint8_t keyLen, ui
maxLevel = MAX_SKIP_LIST_LEVEL; maxLevel = MAX_SKIP_LIST_LEVEL;
} }
pSkipList->keyInfo = (SSkipListKeyInfo){.type = keyType, .len = keyLen, .dupKey = dupKey, .freeNode = freeNode}; pSkipList->keyInfo.type = keyType;
pSkipList->keyInfo.len = keyLen;
pSkipList->keyInfo.dupKey = dupKey;
pSkipList->keyInfo.freeNode = freeNode;
pSkipList->keyFn = fn; pSkipList->keyFn = fn;
pSkipList->comparFn = getKeyComparFunc(keyType); pSkipList->comparFn = getKeyComparFunc(keyType);
pSkipList->maxLevel = maxLevel; pSkipList->maxLevel = maxLevel;
...@@ -240,13 +284,37 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode) { ...@@ -240,13 +284,37 @@ SSkipListNode *tSkipListPut(SSkipList *pSkipList, SSkipListNode *pNode) {
return pNode; return pNode;
} }
SArray* tSkipListGet(SSkipList *pSkipList, SSkipListKey key) { SArray* tSkipListGet(SSkipList *pSkipList, SSkipListKey key) {
SArray* sa = taosArrayInit(1, POINTER_BYTES); SArray* sa = taosArrayInit(1, POINTER_BYTES);
SSkipListNode* pNode = tSkipListDoGet(pSkipList, key);
taosArrayPush(sa, &pNode); if (pSkipList->lock) {
pthread_rwlock_wrlock(pSkipList->lock);
}
SSkipListNode* pNode = getPriorNode(pSkipList, key, TSDB_ORDER_ASC);
while (1) {
SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, 0);
if (p == pSkipList->pTail) {
break;
}
if (pSkipList->comparFn(key, SL_GET_NODE_KEY(pSkipList, p)) != 0) {
break;
}
taosArrayPush(sa, &p);
pNode = p;
}
if (pSkipList->lock) {
pthread_rwlock_unlock(pSkipList->lock);
}
return sa; return sa;
} }
size_t tSkipListGetSize(const SSkipList* pSkipList) { size_t tSkipListGetSize(const SSkipList* pSkipList) {
if (pSkipList == NULL) { if (pSkipList == NULL) {
return 0; return 0;
...@@ -375,14 +443,52 @@ size_t tSkipListGetSize(const SSkipList* pSkipList) { ...@@ -375,14 +443,52 @@ size_t tSkipListGetSize(const SSkipList* pSkipList) {
// return true; // return true;
//} //}
bool tSkipListRemove(SSkipList *pSkipList, SSkipListKey key) { uint32_t tSkipListRemove(SSkipList *pSkipList, SSkipListKey key) {
SSkipListNode* pNode = tSkipListDoGet(pSkipList, key); uint32_t count = 0;
if (pNode != NULL) {
tSkipListRemoveNode(pSkipList, pNode); if (pSkipList->lock) {
return true; pthread_rwlock_wrlock(pSkipList->lock);
} }
return false; SSkipListNode* pNode = getPriorNode(pSkipList, key, TSDB_ORDER_ASC);
while (1) {
SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, 0);
if (p == pSkipList->pTail) {
break;
}
if (pSkipList->comparFn(key, SL_GET_NODE_KEY(pSkipList, p)) != 0) {
break;
}
for (int32_t j = p->level - 1; j >= 0; --j) {
SSkipListNode* prev = SL_GET_BACKWARD_POINTER(p, j);
SSkipListNode* next = SL_GET_FORWARD_POINTER(p, j);
SL_GET_FORWARD_POINTER(prev, j) = next;
SL_GET_BACKWARD_POINTER(next, j) = prev;
}
if (pSkipList->keyInfo.freeNode) {
tfree(p);
}
++count;
}
// compress the minimum level of skip list
while (pSkipList->level > 0) {
if (SL_GET_FORWARD_POINTER(pSkipList->pHead, pSkipList->level - 1) != NULL) {
break;
}
pSkipList->level--;
}
pSkipList->size -= count;
if (pSkipList->lock) {
pthread_rwlock_unlock(pSkipList->lock);
}
return count;
} }
void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNode) { void tSkipListRemoveNode(SSkipList *pSkipList, SSkipListNode *pNode) {
...@@ -425,54 +531,25 @@ SSkipListIterator* tSkipListCreateIter(SSkipList *pSkipList) { ...@@ -425,54 +531,25 @@ SSkipListIterator* tSkipListCreateIter(SSkipList *pSkipList) {
} }
SSkipListIterator *tSkipListCreateIterFromVal(SSkipList* pSkipList, const char* val, int32_t type, int32_t order) { SSkipListIterator *tSkipListCreateIterFromVal(SSkipList* pSkipList, const char* val, int32_t type, int32_t order) {
if (pSkipList == NULL) {
return NULL;
}
assert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC); assert(order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC);
assert(pSkipList != NULL);
SSkipListIterator* iter = doCreateSkipListIterator(pSkipList, order);
if (val == NULL) { if (val == NULL) {
return doCreateSkipListIterator(pSkipList, order); return iter;
} else {
SSkipListNode *forward[MAX_SKIP_LIST_LEVEL] = {0};
int32_t ret = -1;
__compar_fn_t filterComparFn = getKeyComparFunc(pSkipList->keyInfo.type);
SSkipListNode* pNode = pSkipList->pHead;
for (int32_t i = pSkipList->level - 1; i >= 0; --i) {
SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, i);
while (p != pSkipList->pTail) {
char *key = SL_GET_NODE_KEY(pSkipList, p);
if ((ret = filterComparFn(key, val)) < 0) {
pNode = p;
p = SL_GET_FORWARD_POINTER(p, i);
} else {
break;
}
} }
forward[i] = pNode; if (pSkipList->lock) {
pthread_rwlock_rdlock(pSkipList->lock);
} }
SSkipListIterator* iter = doCreateSkipListIterator(pSkipList, order); iter->cur = getPriorNode(pSkipList, val, order);
// set the initial position if (pSkipList->lock) {
if (order == TSDB_ORDER_ASC) { pthread_rwlock_unlock(pSkipList->lock);
iter->cur = forward[0]; // greater equals than the value
} else {
iter->cur = SL_GET_FORWARD_POINTER(forward[0], 0);
if (ret == 0) {
assert(iter->cur != pSkipList->pTail);
iter->cur = SL_GET_FORWARD_POINTER(iter->cur, 0);
}
} }
return iter; return iter;
}
} }
bool tSkipListIterNext(SSkipListIterator *iter) { bool tSkipListIterNext(SSkipListIterator *iter) {
...@@ -487,18 +564,10 @@ bool tSkipListIterNext(SSkipListIterator *iter) { ...@@ -487,18 +564,10 @@ bool tSkipListIterNext(SSkipListIterator *iter) {
} }
if (iter->order == TSDB_ORDER_ASC) { // ascending order iterate if (iter->order == TSDB_ORDER_ASC) { // ascending order iterate
if (iter->cur == NULL) {
iter->cur = SL_GET_FORWARD_POINTER(pSkipList->pHead, 0);
} else {
iter->cur = SL_GET_FORWARD_POINTER(iter->cur, 0); iter->cur = SL_GET_FORWARD_POINTER(iter->cur, 0);
}
} else { // descending order iterate } else { // descending order iterate
if (iter->cur == NULL) {
iter->cur = SL_GET_BACKWARD_POINTER(pSkipList->pTail, 0);
} else {
iter->cur = SL_GET_BACKWARD_POINTER(iter->cur, 0); iter->cur = SL_GET_BACKWARD_POINTER(iter->cur, 0);
} }
}
if (pSkipList->lock) { if (pSkipList->lock) {
pthread_rwlock_unlock(pSkipList->lock); pthread_rwlock_unlock(pSkipList->lock);
...@@ -638,57 +707,16 @@ SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode) { ...@@ -638,57 +707,16 @@ SSkipListNode* tSkipListPushBack(SSkipList *pSkipList, SSkipListNode *pNode) {
return pNode; return pNode;
} }
SSkipListNode* tSkipListDoGet(SSkipList *pSkipList, SSkipListKey skey) {
SSkipListNode *pNode = pSkipList->pHead;
SSkipListNode *pRes = NULL;
if (pSkipList->lock) {
pthread_rwlock_rdlock(pSkipList->lock);
}
#if SKIP_LIST_RECORD_PERFORMANCE
pSkipList->state.queryCount++;
#endif
__compar_fn_t cmparFn = getComparFunc(pSkipList->keyInfo.type, 0);
int32_t ret = -1;
for (int32_t i = pSkipList->level - 1; i >= 0; --i) {
SSkipListNode *p = SL_GET_FORWARD_POINTER(pNode, i);
while (p != pSkipList->pTail) {
char *key = SL_GET_NODE_KEY(pSkipList, p);
if ((ret = cmparFn(key, skey)) < 0) {
pNode = p;
p = SL_GET_FORWARD_POINTER(p, i);
} else {
break;
}
}
// find the qualified key
if (ret == 0) {
pRes = SL_GET_FORWARD_POINTER(pNode, i);
break;
// skip list does not allowed duplicated key, abort further retrieve data
// if (!pSkipList->keyInfo.dupKey) {
// break;
// }
}
}
if (pSkipList->lock) {
pthread_rwlock_unlock(pSkipList->lock);
}
return pRes;
}
SSkipListIterator* doCreateSkipListIterator(SSkipList *pSkipList, int32_t order) { SSkipListIterator* doCreateSkipListIterator(SSkipList *pSkipList, int32_t order) {
SSkipListIterator* iter = calloc(1, sizeof(SSkipListIterator)); SSkipListIterator* iter = calloc(1, sizeof(SSkipListIterator));
iter->pSkipList = pSkipList; iter->pSkipList = pSkipList;
iter->order = order; iter->order = order;
if(order == TSDB_ORDER_ASC) {
iter->cur = pSkipList->pHead;
} else {
iter->cur = pSkipList->pTail;
}
return iter; return iter;
} }
\ No newline at end of file
...@@ -281,34 +281,55 @@ void skiplistPerformanceTest() { ...@@ -281,34 +281,55 @@ void skiplistPerformanceTest() {
// todo not support duplicated key yet // todo not support duplicated key yet
void duplicatedKeyTest() { void duplicatedKeyTest() {
#if 0 SSkipList *pSkipList = tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_INT, sizeof(int), true, false, true, getkey);
SSkipListKey key;
key.nType = TSDB_DATA_TYPE_INT;
SSkipListNode **pNodes = NULL;
SSkipList *pSkipList = tSkipListCreate(MAX_SKIP_LIST_LEVEL, TSDB_DATA_TYPE_INT, sizeof(int));
for (int32_t i = 0; i < 10000; ++i) { for (int32_t i = 0; i < 200; ++i) {
for (int32_t j = 0; j < 5; ++j) { for (int32_t j = 0; j < 5; ++j) {
key.i64Key = i; int32_t level, size;
tSkipListPut(pSkipList, "", &key, 1); tSkipListNewNodeInfo(pSkipList, &level, &size);
SSkipListNode* d = (SSkipListNode*)calloc(1, size + sizeof(int32_t));
d->level = level;
int32_t* key = (int32_t*)SL_GET_NODE_KEY(pSkipList, d);
key[0] = i;
tSkipListPut(pSkipList, d);
} }
} }
tSkipListPrint(pSkipList, 1);
for (int32_t i = 0; i < 100; ++i) { for (int32_t i = 0; i < 100; ++i) {
key.i64Key = rand() % 1000; SSkipListKey key;
int32_t size = tSkipListGets(pSkipList, &key, &pNodes); SArray* nodes = tSkipListGet(pSkipList, (char*)(&i));
assert( taosArrayGetSize(nodes) == 5 );
assert(size == 5); taosArrayDestroy(nodes);
}
tfree(pNodes); int32_t key = 101;
uint32_t num = tSkipListRemove(pSkipList, (char*)(&key));
assert(num == 5);
SArray* nodes = tSkipListGet(pSkipList, (char*)(&key));
assert( taosArrayGetSize(nodes) == 0 );
taosArrayDestroy(nodes);
key = 102;
SSkipListIterator* iter = tSkipListCreateIterFromVal(pSkipList, (char*)(&key), TSDB_DATA_TYPE_INT, TSDB_ORDER_ASC);
for(int i = 0; i < 6; i++) {
assert(tSkipListIterNext(iter) == true);
SSkipListNode* node = tSkipListIterGet(iter);
int32_t* val = (int32_t*)SL_GET_NODE_KEY(pSkipList, node);
assert((i < 5) == ((*val) == key));
} }
tSkipListDestroyIter(iter);
iter = tSkipListCreateIterFromVal(pSkipList, (char*)(&key), TSDB_DATA_TYPE_INT, TSDB_ORDER_DESC);
for(int i = 0; i < 6; i++) {
assert(tSkipListIterNext(iter) == true);
SSkipListNode* node = tSkipListIterGet(iter);
int32_t* val = (int32_t*)SL_GET_NODE_KEY(pSkipList, node);
assert((i < 5) == ((*val) == key));
}
tSkipListDestroyIter(iter);
tSkipListDestroy(pSkipList); tSkipListDestroy(pSkipList);
#endif
} }
} // namespace } // namespace
......
...@@ -43,7 +43,7 @@ class TDTestCase: ...@@ -43,7 +43,7 @@ class TDTestCase:
"This test failed: insert wrong data error _not_ catched") "This test failed: insert wrong data error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("insert wrong data error catched") tdLog.info("insert wrong data error catched")
cmd = 'select * from tb order by ts desc' cmd = 'select * from tb order by ts desc'
tdLog.info(cmd) tdLog.info(cmd)
...@@ -82,7 +82,7 @@ class TDTestCase: ...@@ -82,7 +82,7 @@ class TDTestCase:
insert wrong data error _not_ catched") insert wrong data error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("insert wrong data error catched") tdLog.info("insert wrong data error catched")
cmd = "insert into tb values (now+4a, 0)" cmd = "insert into tb values (now+4a, 0)"
tdLog.info(cmd) tdLog.info(cmd)
...@@ -103,7 +103,7 @@ class TDTestCase: ...@@ -103,7 +103,7 @@ class TDTestCase:
"This test failed: insert wrong data error _not_ catched") "This test failed: insert wrong data error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("insert wrong data error catched") tdLog.info("insert wrong data error catched")
cmd = "insert into tb values (now+5a, 2)" cmd = "insert into tb values (now+5a, 2)"
tdLog.info(cmd) tdLog.info(cmd)
...@@ -124,7 +124,7 @@ class TDTestCase: ...@@ -124,7 +124,7 @@ class TDTestCase:
"This test failed: insert wrong data error _not_ catched") "This test failed: insert wrong data error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("insert wrong data error catched") tdLog.info("insert wrong data error catched")
cmd = "insert into tb values (now+6a, 2)" cmd = "insert into tb values (now+6a, 2)"
tdLog.info(cmd) tdLog.info(cmd)
......
...@@ -47,7 +47,7 @@ class TDTestCase: ...@@ -47,7 +47,7 @@ class TDTestCase:
"This test failed: INT data overflow error _not_ catched") "This test failed: INT data overflow error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("INT data overflow error catched") tdLog.info("INT data overflow error catched")
cmd = 'insert into tb values (now+1m, NULL)' cmd = 'insert into tb values (now+1m, NULL)'
tdLog.info(cmd) tdLog.info(cmd)
...@@ -76,7 +76,7 @@ class TDTestCase: ...@@ -76,7 +76,7 @@ class TDTestCase:
"This test failed: INT data overflow error _not_ catched") "This test failed: INT data overflow error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("INT data overflow error catched") tdLog.info("INT data overflow error catched")
cmd = 'insert into tb values (now+3m, NULL)' cmd = 'insert into tb values (now+3m, NULL)'
tdLog.info(cmd) tdLog.info(cmd)
...@@ -96,7 +96,7 @@ class TDTestCase: ...@@ -96,7 +96,7 @@ class TDTestCase:
"This test failed: insert wrong data error _not_ catched") "This test failed: insert wrong data error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("insert wrong data error catched") tdLog.info("insert wrong data error catched")
cmd = 'insert into tb values (now+4m, 0)' cmd = 'insert into tb values (now+4m, 0)'
tdLog.info(cmd) tdLog.info(cmd)
...@@ -116,7 +116,7 @@ class TDTestCase: ...@@ -116,7 +116,7 @@ class TDTestCase:
"This test failed: insert wrong data error _not_ catched") "This test failed: insert wrong data error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("insert wrong data error catched") tdLog.info("insert wrong data error catched")
cmd = 'insert into tb values (now+5m, 2)' cmd = 'insert into tb values (now+5m, 2)'
tdLog.info(cmd) tdLog.info(cmd)
...@@ -135,7 +135,7 @@ class TDTestCase: ...@@ -135,7 +135,7 @@ class TDTestCase:
"This test failed: insert wrong data error _not_ catched") "This test failed: insert wrong data error _not_ catched")
except Exception as e: except Exception as e:
tdLog.info(repr(e)) tdLog.info(repr(e))
tdLog.notice("insert wrong data error catched") tdLog.info("insert wrong data error catched")
cmd = 'insert into tb values (now+6m, 2)' cmd = 'insert into tb values (now+6m, 2)'
tdLog.info(cmd) tdLog.info(cmd)
......
...@@ -29,8 +29,6 @@ python3 ./test.py $1 -s && sleep 1 ...@@ -29,8 +29,6 @@ python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/db_table.py python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastSub.py python3 ./test.py $1 -f import_merge/importDataLastSub.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importHead.py python3 ./test.py $1 -f import_merge/importHead.py
......
...@@ -79,7 +79,8 @@ if __name__ == "__main__": ...@@ -79,7 +79,8 @@ if __name__ == "__main__":
time.sleep(1) time.sleep(1)
processID = subprocess.check_output(psCmd, shell=True) processID = subprocess.check_output(psCmd, shell=True)
tdLog.exit('stop All dnodes') tdLog.info('stop All dnodes')
sys.exit(0)
tdDnodes.init(deployPath) tdDnodes.init(deployPath)
tdDnodes.setTestCluster(testCluster) tdDnodes.setTestCluster(testCluster)
......
...@@ -57,7 +57,7 @@ class TDCases: ...@@ -57,7 +57,7 @@ class TDCases:
runNum += 1 runNum += 1
continue continue
tdLog.notice("total %d Linux test case(s) executed" % (runNum)) tdLog.info("total %d Linux test case(s) executed" % (runNum))
def runOneLinux(self, conn, fileName): def runOneLinux(self, conn, fileName):
testModule = self.__dynamicLoadModule(fileName) testModule = self.__dynamicLoadModule(fileName)
...@@ -76,8 +76,6 @@ class TDCases: ...@@ -76,8 +76,6 @@ class TDCases:
runNum += 1 runNum += 1
continue continue
tdLog.success("total %d Linux test case(s) executed" % (runNum))
def runAllWindows(self, conn): def runAllWindows(self, conn):
# TODO: load all Windows cases here # TODO: load all Windows cases here
runNum = 0 runNum = 0
......
...@@ -202,7 +202,7 @@ class TDDnode: ...@@ -202,7 +202,7 @@ class TDDnode:
if (binPath == ""): if (binPath == ""):
tdLog.exit("taosd not found!s") tdLog.exit("taosd not found!s")
else: else:
tdLog.notice("taosd found in %s" % rootRealPath) tdLog.info("taosd found in %s" % rootRealPath)
if self.deployed == 0: if self.deployed == 0:
tdLog.exit("dnode:%d is not deployed" % (self.index)) tdLog.exit("dnode:%d is not deployed" % (self.index))
...@@ -408,7 +408,7 @@ class TDDnodes: ...@@ -408,7 +408,7 @@ class TDDnodes:
tdLog.exit("index:%d should on a scale of [1, 10]" % (index)) tdLog.exit("index:%d should on a scale of [1, 10]" % (index))
def stopAll(self): def stopAll(self):
tdLog.debug("stop all dnodes") tdLog.info("stop all dnodes")
for i in range(len(self.dnodes)): for i in range(len(self.dnodes)):
self.dnodes[i].stop() self.dnodes[i].stop()
......
...@@ -29,7 +29,5 @@ python3 ./test.py $1 -s && sleep 1 ...@@ -29,7 +29,5 @@ python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f table/db_table.py python3 ./test.py $1 -f table/db_table.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importCacheFileT.py
python3 ./test.py $1 -s && sleep 1
python3 ./test.py $1 -f import_merge/importDataLastSub.py python3 ./test.py $1 -f import_merge/importDataLastSub.py
python3 ./test.py $1 -s && sleep 1 python3 ./test.py $1 -s && sleep 1
...@@ -150,7 +150,7 @@ cd ../../../debug; make ...@@ -150,7 +150,7 @@ cd ../../../debug; make
#./test.sh -f general/parser/bug.sim #./test.sh -f general/parser/bug.sim
./test.sh -f general/stable/disk.sim ./test.sh -f general/stable/disk.sim
#./test.sh -f general/stable/dnode3.sim #liao ./test.sh -f general/stable/dnode3.sim
./test.sh -f general/stable/metrics.sim ./test.sh -f general/stable/metrics.sim
./test.sh -f general/stable/values.sim ./test.sh -f general/stable/values.sim
./test.sh -f general/stable/vnode3.sim ./test.sh -f general/stable/vnode3.sim
...@@ -241,34 +241,34 @@ cd ../../../debug; make ...@@ -241,34 +241,34 @@ cd ../../../debug; make
./test.sh -u -f unique/account/user_create.sim ./test.sh -u -f unique/account/user_create.sim
./test.sh -u -f unique/account/user_len.sim ./test.sh -u -f unique/account/user_len.sim
#./test.sh -u -f unique/big/balance.sim #liao wait ./test.sh -u -f unique/big/balance.sim
#slguan ./test.sh -u -f unique/big/maxvnodes.sim #liao wait ./test.sh -u -f unique/big/maxvnodes.sim
./test.sh -u -f unique/big/tcp.sim ./test.sh -u -f unique/big/tcp.sim
#jeff ./test.sh -u -f unique/cluster/balance1.sim ./test.sh -u -f unique/cluster/balance1.sim
#jeff ./test.sh -u -f unique/cluster/balance2.sim ./test.sh -u -f unique/cluster/balance2.sim
#jeff ./test.sh -u -f unique/cluster/balance3.sim ./test.sh -u -f unique/cluster/balance3.sim
#./test.sh -u -f unique/cluster/cache.sim ./test.sh -u -f unique/cluster/cache.sim
./test.sh -u -f unique/column/replica3.sim ./test.sh -u -f unique/column/replica3.sim
#hongze crash ./test.sh -u -f unique/db/commit.sim #liao wait ./test.sh -u -f unique/db/commit.sim
./test.sh -u -f unique/db/delete.sim ./test.sh -u -f unique/db/delete.sim
./test.sh -u -f unique/db/delete_part.sim ./test.sh -u -f unique/db/delete_part.sim
./test.sh -u -f unique/db/replica_add12.sim ./test.sh -u -f unique/db/replica_add12.sim
#hongze crash ./test.sh -u -f unique/db/replica_add13.sim #hongze ./test.sh -u -f unique/db/replica_add13.sim
#hongze crash ./test.sh -u -f unique/db/replica_add23.sim #hongze wait ./test.sh -u -f unique/db/replica_add23.sim
#hongze crash ./test.sh -u -f unique/db/replica_reduce21.sim #hongze wait ./test.sh -u -f unique/db/replica_reduce21.sim
./test.sh -u -f unique/db/replica_reduce32.sim ./test.sh -u -f unique/db/replica_reduce32.sim
#hongze crash /test.sh -u -f unique/db/replica_reduce31.sim #hongze wait /test.sh -u -f unique/db/replica_reduce31.sim
./test.sh -u -f unique/db/replica_part.sim ./test.sh -u -f unique/db/replica_part.sim
##./test.sh -u -f unique/dnode/balance1.sim ./test.sh -u -f unique/dnode/balance1.sim
##./test.sh -u -f unique/dnode/balance2.sim ./test.sh -u -f unique/dnode/balance2.sim
##./test.sh -u -f unique/dnode/balance3.sim ./test.sh -u -f unique/dnode/balance3.sim
##./test.sh -u -f unique/dnode/balancex.sim ./test.sh -u -f unique/dnode/balancex.sim
##./test.sh -u -f unique/dnode/offline1.sim ./test.sh -u -f unique/dnode/offline1.sim
##./test.sh -u -f unique/dnode/offline2.sim #hongze wait ./test.sh -u -f unique/dnode/offline2.sim
./test.sh -u -f unique/dnode/remove1.sim ./test.sh -u -f unique/dnode/remove1.sim
#hongze ./test.sh -u -f unique/dnode/remove2.sim #hongze ./test.sh -u -f unique/dnode/remove2.sim
./test.sh -u -f unique/dnode/vnode_clean.sim ./test.sh -u -f unique/dnode/vnode_clean.sim
...@@ -276,17 +276,17 @@ cd ../../../debug; make ...@@ -276,17 +276,17 @@ cd ../../../debug; make
./test.sh -u -f unique/http/admin.sim ./test.sh -u -f unique/http/admin.sim
./test.sh -u -f unique/http/opentsdb.sim ./test.sh -u -f unique/http/opentsdb.sim
#./test.sh -u -f unique/import/replica2.sim #liao wait ./test.sh -u -f unique/import/replica2.sim
#./test.sh -u -f unique/import/replica3.sim #liao wait ./test.sh -u -f unique/import/replica3.sim
#./test.sh -u -f unique/stable/balance_replica1.sim #liao wait ./test.sh -u -f unique/stable/balance_replica1.sim
#./test.sh -u -f unique/stable/dnode2_stop.sim #liao wait ./test.sh -u -f unique/stable/dnode2_stop.sim
#./test.sh -u -f unique/stable/dnode2.sim #liao wait ./test.sh -u -f unique/stable/dnode2.sim
#./test.sh -u -f unique/stable/dnode3.sim #liao wait ./test.sh -u -f unique/stable/dnode3.sim
#./test.sh -u -f unique/stable/replica2_dnode4.sim #liao wait ./test.sh -u -f unique/stable/replica2_dnode4.sim
#./test.sh -u -f unique/stable/replica2_vnode3.sim #liao wait ./test.sh -u -f unique/stable/replica2_vnode3.sim
#./test.sh -u -f unique/stable/replica3_dnode6.sim #liao wait ./test.sh -u -f unique/stable/replica3_dnode6.sim
#./test.sh -u -f unique/stable/replica3_vnode3.sim #liao wait ./test.sh -u -f unique/stable/replica3_vnode3.sim
./test.sh -u -f unique/mnode/mgmt22.sim ./test.sh -u -f unique/mnode/mgmt22.sim
./test.sh -u -f unique/mnode/mgmt23.sim ./test.sh -u -f unique/mnode/mgmt23.sim
......
...@@ -77,7 +77,7 @@ print dnode2 $dnode2Vnodes ...@@ -77,7 +77,7 @@ print dnode2 $dnode2Vnodes
if $dnode1Vnodes != 2 then if $dnode1Vnodes != 2 then
return -1 return -1
endi endi
if $dnode2Vnodes != NULL then if $dnode2Vnodes != null then
return -1 return -1
endi endi
...@@ -146,7 +146,7 @@ print dnode2 $dnode2Vnodes ...@@ -146,7 +146,7 @@ print dnode2 $dnode2Vnodes
if $dnode1Vnodes != 3 then if $dnode1Vnodes != 3 then
goto show4 goto show4
endi endi
if $dnode2Vnodes != NULL then if $dnode2Vnodes != null then
goto show4 goto show4
endi endi
...@@ -229,7 +229,7 @@ print dnode3 $dnode3Vnodes ...@@ -229,7 +229,7 @@ print dnode3 $dnode3Vnodes
if $dnode1Vnodes != 3 then if $dnode1Vnodes != 3 then
goto show8 goto show8
endi endi
if $dnode3Vnodes != NULL then if $dnode3Vnodes != null then
goto show8 goto show8
endi endi
...@@ -245,7 +245,7 @@ if $dnode1Role != master then ...@@ -245,7 +245,7 @@ if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode3Role != NULL then if $dnode3Role != null then
return -1 return -1
endi endi
......
...@@ -131,7 +131,7 @@ print dnode3 $dnode3Vnodes ...@@ -131,7 +131,7 @@ print dnode3 $dnode3Vnodes
if $dnode1Vnodes != 3 then if $dnode1Vnodes != 3 then
goto show2 goto show2
endi endi
if $dnode2Vnodes != NULL then if $dnode2Vnodes != null then
goto show2 goto show2
endi endi
if $dnode3Vnodes != 3 then if $dnode3Vnodes != 3 then
...@@ -194,7 +194,7 @@ print dnode4 ==> $dnode4Role ...@@ -194,7 +194,7 @@ print dnode4 ==> $dnode4Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != slave then if $dnode3Role != slave then
...@@ -231,7 +231,7 @@ endi ...@@ -231,7 +231,7 @@ endi
if $dnode4Vnodes != 3 then if $dnode4Vnodes != 3 then
goto show4 goto show4
endi endi
if $dnode3Vnodes != NULL then if $dnode3Vnodes != null then
goto show4 goto show4
endi endi
...@@ -248,10 +248,10 @@ print dnode4 ==> $dnode4Role ...@@ -248,10 +248,10 @@ print dnode4 ==> $dnode4Role
if $dnode1Role != master then if $dnode1Role != master then
return -1 return -1
endi endi
if $dnode2Role != NULL then if $dnode2Role != null then
return -1 return -1
endi endi
if $dnode3Role != NULL then if $dnode3Role != null then
return -1 return -1
endi endi
...@@ -339,7 +339,7 @@ print dnode4 $dnode4Vnodes ...@@ -339,7 +339,7 @@ print dnode4 $dnode4Vnodes
$dnode5Vnodes = $data2_5 $dnode5Vnodes = $data2_5
print dnode5 $dnode5Vnodes print dnode5 $dnode5Vnodes
if $dnode1Vnodes != NULL then if $dnode1Vnodes != null then
goto show6 goto show6
endi endi
if $dnode4Vnodes != 3 then if $dnode4Vnodes != 3 then
......
...@@ -110,7 +110,7 @@ endi ...@@ -110,7 +110,7 @@ endi
if $dnode3Vnodes != 3 then if $dnode3Vnodes != 3 then
goto show1 goto show1
endi endi
if $dnode4Vnodes != NULL then if $dnode4Vnodes != null then
goto show1 goto show1
endi endi
...@@ -166,7 +166,7 @@ print dnode4 $dnode4Vnodes ...@@ -166,7 +166,7 @@ print dnode4 $dnode4Vnodes
if $dnode1Vnodes != 3 then if $dnode1Vnodes != 3 then
goto show3 goto show3
endi endi
if $dnode2Vnodes != NULL then if $dnode2Vnodes != null then
goto show3 goto show3
endi endi
if $dnode3Vnodes != 3 then if $dnode3Vnodes != 3 then
...@@ -232,7 +232,7 @@ endi ...@@ -232,7 +232,7 @@ endi
if $dnode5Vnodes != 3 then if $dnode5Vnodes != 3 then
goto show5 goto show5
endi endi
if $dnode3Vnodes != NULL then if $dnode3Vnodes != null then
goto show5 goto show5
endi endi
if $dnode4Vnodes != 3 then if $dnode4Vnodes != 3 then
...@@ -298,7 +298,7 @@ endi ...@@ -298,7 +298,7 @@ endi
if $dnode6Vnodes != 3 then if $dnode6Vnodes != 3 then
goto show7 goto show7
endi endi
if $dnode4Vnodes != NULL then if $dnode4Vnodes != null then
goto show7 goto show7
endi endi
......
...@@ -9,21 +9,13 @@ system sh/cfg.sh -n dnode2 -c walLevel -v 0 ...@@ -9,21 +9,13 @@ system sh/cfg.sh -n dnode2 -c walLevel -v 0
system sh/cfg.sh -n dnode1 -c httpMaxThreads -v 2 system sh/cfg.sh -n dnode1 -c httpMaxThreads -v 2
system sh/cfg.sh -n dnode2 -c httpMaxThreads -v 2 system sh/cfg.sh -n dnode2 -c httpMaxThreads -v 2
system sh/cfg.sh -n dnode1 -c monitor -v 1 system sh/cfg.sh -n dnode1 -c monitor -v 1
system sh/cfg.sh -n dnode1 -c monitor -v 2
system sh/cfg.sh -n dnode2 -c http -v 1 system sh/cfg.sh -n dnode2 -c http -v 1
system sh/cfg.sh -n dnode1 -c enableHttp -v 1 system sh/cfg.sh -n dnode1 -c enableHttp -v 1
system sh/cfg.sh -n dnode2 -c monitor -v 1 system sh/cfg.sh -n dnode2 -c monitor -v 1
system sh/cfg.sh -n dnode1 -c monitorInterval -v 1 system sh/cfg.sh -n dnode1 -c monitorInterval -v 1
system sh/cfg.sh -n dnode2 -c monitorInterval -v 1 system sh/cfg.sh -n dnode2 -c monitorInterval -v 1
system sh/cfg.sh -n dnode1 -c maxVnodeConnections -v 30000
system sh/cfg.sh -n dnode2 -c maxVnodeConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxMgmtConnections -v 30000
system sh/cfg.sh -n dnode2 -c maxMgmtConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxMeterConnections -v 30000
system sh/cfg.sh -n dnode2 -c maxMeterConnections -v 30000
system sh/cfg.sh -n dnode1 -c maxShellConns -v 30000
system sh/cfg.sh -n dnode2 -c maxShellConns -v 30000
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sleep 3000 sleep 3000
sql connect sql connect
...@@ -45,13 +37,20 @@ sleep 3000 ...@@ -45,13 +37,20 @@ sleep 3000
system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode2 -s start
sql create dnode $hostname2 sql create dnode $hostname2
sleep 20000
sql select * from log.dn_192_168_0_1 sleep 10000
sql show log.tables;
if $rows != 5 then
return -1
endi
sql select * from log.dn1
print ===>rows $rows print ===>rows $rows
print $data00 $data01 $data02 print $data00 $data01 $data02
print $data10 $data11 $data12 print $data10 $data11 $data12
print $data20 $data21 $data22 print $data20 $data21 $data22
if $rows < 20 then if $rows < 10 then
return -1 return -1
endi endi
......
...@@ -47,10 +47,10 @@ sql create table d2.t2 (ts timestamp, i int) ...@@ -47,10 +47,10 @@ sql create table d2.t2 (ts timestamp, i int)
sql create table d3.t3 (ts timestamp, i int) sql create table d3.t3 (ts timestamp, i int)
sql create table d4.t4 (ts timestamp, i int) sql create table d4.t4 (ts timestamp, i int)
sql insert into d1.t1 values(now, 1) sql insert into d1.t1 values(1589529000011, 1)
sql insert into d2.t2 values(now, 1) sql insert into d2.t2 values(1589529000021, 1)
sql insert into d3.t3 values(now, 1) sql insert into d3.t3 values(1589529000031, 1)
sql insert into d4.t4 values(now, 1) sql insert into d4.t4 values(1589529000041, 1)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 1 then if $rows != 1 then
...@@ -111,10 +111,10 @@ if $data2_3 != 4 then ...@@ -111,10 +111,10 @@ if $data2_3 != 4 then
endi endi
print ======== step4 print ======== step4
sql insert into d1.t1 values(now, 2) sql insert into d1.t1 values(1589529000012, 2)
sql insert into d2.t2 values(now, 2) sql insert into d2.t2 values(1589529000022, 2)
sql insert into d3.t3 values(now, 2) sql insert into d3.t3 values(1589529000032, 2)
sql insert into d4.t4 values(now, 2) sql insert into d4.t4 values(1589529000042, 2)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 2 then if $rows != 2 then
...@@ -142,10 +142,10 @@ sleep 1000 ...@@ -142,10 +142,10 @@ sleep 1000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 5000 sleep 5000
sql insert into d1.t1 values(now, 3) sql insert into d1.t1 values(1589529000013, 3)
sql insert into d2.t2 values(now, 3) sql insert into d2.t2 values(1589529000023, 3)
sql insert into d3.t3 values(now, 3) sql insert into d3.t3 values(1589529000033, 3)
sql insert into d4.t4 values(now, 3) sql insert into d4.t4 values(1589529000043, 3)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 3 then if $rows != 3 then
...@@ -173,27 +173,31 @@ sleep 5000 ...@@ -173,27 +173,31 @@ sleep 5000
system sh/exec_up.sh -n dnode3 -s stop -x SIGINT system sh/exec_up.sh -n dnode3 -s stop -x SIGINT
sleep 3000 sleep 3000
sql insert into d1.t1 values(now, 4) sql insert into d1.t1 values(1589529000014, 4)
sql insert into d2.t2 values(now, 4) sql insert into d2.t2 values(1589529000024, 4)
sql insert into d3.t3 values(now, 4) sql insert into d3.t3 values(1589529000034, 4)
sql insert into d4.t4 values(now, 4) sql insert into d4.t4 values(1589529000044, 4)
sql select * from d1.t1 sql select * from d1.t1
print select * from d1.t1 $rows
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
sql select * from d2.t2 sql select * from d2.t2
print select * from d2.t2 $rows
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
sql select * from d3.t3 sql select * from d3.t3
print select * from d3.t3 $rows
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
sql select * from d4.t4 sql select * from d4.t4
print select * from d4.t4 $rows
if $rows != 4 then if $rows != 4 then
return -1 return -1
endi endi
...@@ -204,10 +208,10 @@ sleep 5000 ...@@ -204,10 +208,10 @@ sleep 5000
system sh/exec_up.sh -n dnode4 -s stop -x SIGINT system sh/exec_up.sh -n dnode4 -s stop -x SIGINT
sleep 3000 sleep 3000
sql insert into d1.t1 values(now, 5) sql insert into d1.t1 values(1589529000015, 5)
sql insert into d2.t2 values(now, 5) sql insert into d2.t2 values(1589529000025, 5)
sql insert into d3.t3 values(now, 5) sql insert into d3.t3 values(1589529000035, 5)
sql insert into d4.t4 values(now, 5) sql insert into d4.t4 values(1589529000045, 5)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 5 then if $rows != 5 then
...@@ -235,10 +239,10 @@ sleep 5000 ...@@ -235,10 +239,10 @@ sleep 5000
system sh/exec_up.sh -n dnode2 -s stop -x SIGINT system sh/exec_up.sh -n dnode2 -s stop -x SIGINT
sleep 3000 sleep 3000
sql insert into d1.t1 values(now, 6) sql insert into d1.t1 values(1589529000016, 6)
sql insert into d2.t2 values(now, 6) sql insert into d2.t2 values(1589529000026, 6)
sql insert into d3.t3 values(now, 6) sql insert into d3.t3 values(1589529000036, 6)
sql insert into d4.t4 values(now, 6) sql insert into d4.t4 values(1589529000046, 6)
sql select * from d1.t1 sql select * from d1.t1
if $rows != 6 then if $rows != 6 then
......
...@@ -53,7 +53,7 @@ $x = 0 ...@@ -53,7 +53,7 @@ $x = 0
show2: show2:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -93,7 +93,7 @@ $x = 0 ...@@ -93,7 +93,7 @@ $x = 0
show4: show4:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -103,7 +103,7 @@ print dnode2 openVnodes $data2_2 ...@@ -103,7 +103,7 @@ print dnode2 openVnodes $data2_2
if $data2_1 != 2 then if $data2_1 != 2 then
goto show4 goto show4
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show4 goto show4
endi endi
if $rows != 1 then if $rows != 1 then
...@@ -131,7 +131,7 @@ print dnode3 openVnodes $data2_3 ...@@ -131,7 +131,7 @@ print dnode3 openVnodes $data2_3
if $data2_1 != 0 then if $data2_1 != 0 then
goto show5 goto show5
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show5 goto show5
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -155,7 +155,7 @@ print dnode3 openVnodes $data2_3 ...@@ -155,7 +155,7 @@ print dnode3 openVnodes $data2_3
if $data2_1 != 0 then if $data2_1 != 0 then
return -1 return -1
endi endi
if $data2_2 != NULL then if $data2_2 != null then
return -1 return -1
endi endi
if $data2_3 != 3 then if $data2_3 != 3 then
...@@ -170,7 +170,7 @@ $x = 0 ...@@ -170,7 +170,7 @@ $x = 0
show7: show7:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -182,7 +182,7 @@ print dnode4 openVnodes $data2_4 ...@@ -182,7 +182,7 @@ print dnode4 openVnodes $data2_4
if $data2_1 != 0 then if $data2_1 != 0 then
goto show7 goto show7
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show7 goto show7
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -210,7 +210,7 @@ print dnode4 openVnodes $data2_4 ...@@ -210,7 +210,7 @@ print dnode4 openVnodes $data2_4
if $data2_1 != 0 then if $data2_1 != 0 then
return -1 return -1
endi endi
if $data2_2 != NULL then if $data2_2 != null then
return -1 return -1
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -227,7 +227,7 @@ $x = 0 ...@@ -227,7 +227,7 @@ $x = 0
show9: show9:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -240,10 +240,10 @@ print dnode4 openVnodes $data2_4 ...@@ -240,10 +240,10 @@ print dnode4 openVnodes $data2_4
if $data2_1 != 0 then if $data2_1 != 0 then
goto show9 goto show9
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show9 goto show9
endi endi
if $data2_3 != NULL then if $data2_3 != null then
goto show9 goto show9
endi endi
if $data2_4 != 4 then if $data2_4 != 4 then
......
...@@ -65,7 +65,7 @@ $x = 0 ...@@ -65,7 +65,7 @@ $x = 0
show2: show2:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -76,7 +76,7 @@ print dnode3 openVnodes $data2_3 ...@@ -76,7 +76,7 @@ print dnode3 openVnodes $data2_3
if $data2_1 != 2 then if $data2_1 != 2 then
goto show2 goto show2
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show2 goto show2
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -105,7 +105,7 @@ print dnode4 openVnodes $data2_4 ...@@ -105,7 +105,7 @@ print dnode4 openVnodes $data2_4
if $data2_1 != 0 then if $data2_1 != 0 then
goto show3 goto show3
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show3 goto show3
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -132,7 +132,7 @@ print dnode4 openVnodes $data2_4 ...@@ -132,7 +132,7 @@ print dnode4 openVnodes $data2_4
if $data2_1 != 0 then if $data2_1 != 0 then
return -1 return -1
endi endi
if $data2_2 != NULL then if $data2_2 != null then
return -1 return -1
endi endi
if $data2_3 != 3 then if $data2_3 != 3 then
...@@ -150,7 +150,7 @@ $x = 0 ...@@ -150,7 +150,7 @@ $x = 0
show5: show5:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -163,7 +163,7 @@ print dnode5 openVnodes $data2_5 ...@@ -163,7 +163,7 @@ print dnode5 openVnodes $data2_5
if $data2_1 != 0 then if $data2_1 != 0 then
goto show5 goto show5
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show5 goto show5
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -183,7 +183,7 @@ $x = 0 ...@@ -183,7 +183,7 @@ $x = 0
show6: show6:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -196,10 +196,10 @@ print dnode5 openVnodes $data2_5 ...@@ -196,10 +196,10 @@ print dnode5 openVnodes $data2_5
if $data2_1 != 0 then if $data2_1 != 0 then
goto show6 goto show6
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show6 goto show6
endi endi
if $data2_3 != NULL then if $data2_3 != null then
goto show6 goto show6
endi endi
if $data2_4 != 3 then if $data2_4 != 3 then
......
...@@ -88,7 +88,7 @@ print dnode4 openVnodes $data2_4 ...@@ -88,7 +88,7 @@ print dnode4 openVnodes $data2_4
if $data2_1 != 2 then if $data2_1 != 2 then
goto show2 goto show2
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show2 goto show2
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -122,7 +122,7 @@ print dnode5 openVnodes $data2_5 ...@@ -122,7 +122,7 @@ print dnode5 openVnodes $data2_5
if $data2_1 != 0 then if $data2_1 != 0 then
goto show3 goto show3
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show3 goto show3
endi endi
if $data2_3 != 2 then if $data2_3 != 2 then
...@@ -162,7 +162,7 @@ print dnode5 openVnodes $data2_5 ...@@ -162,7 +162,7 @@ print dnode5 openVnodes $data2_5
if $data2_1 != 0 then if $data2_1 != 0 then
goto show4 goto show4
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show4 goto show4
endi endi
if $data2_3 != 3 then if $data2_3 != 3 then
...@@ -228,7 +228,7 @@ endi ...@@ -228,7 +228,7 @@ endi
if $data2_6 != 3 then if $data2_6 != 3 then
goto show6 goto show6
endi endi
if $data2_3 != NULL then if $data2_3 != null then
goto show6 goto show6
endi endi
if $data2_4 != 3 then if $data2_4 != 3 then
......
...@@ -50,7 +50,7 @@ $x = 0 ...@@ -50,7 +50,7 @@ $x = 0
show2: show2:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
...@@ -77,7 +77,7 @@ $x = 0 ...@@ -77,7 +77,7 @@ $x = 0
show3: show3:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
sql show dnodes sql show dnodes
...@@ -122,7 +122,7 @@ $x = 0 ...@@ -122,7 +122,7 @@ $x = 0
show5: show5:
$x = $x + 1 $x = $x + 1
sleep 2000 sleep 2000
if $x == 30 then if $x == 10 then
return -1 return -1
endi endi
sql show dnodes sql show dnodes
...@@ -132,7 +132,7 @@ print dnode3 openVnodes $data2_3 ...@@ -132,7 +132,7 @@ print dnode3 openVnodes $data2_3
if $data2_1 != 1 then if $data2_1 != 1 then
goto show5 goto show5
endi endi
if $data2_2 != NULL then if $data2_2 != null then
goto show5 goto show5
endi endi
if $data2_3 != 3 then if $data2_3 != 3 then
......
...@@ -63,7 +63,7 @@ print dnode1 $data4_2 ...@@ -63,7 +63,7 @@ print dnode1 $data4_2
if $data4_1 != ready then if $data4_1 != ready then
return -1 return -1
endi endi
if $data4_2 != NULL then if $data4_2 != null then
return -1 return -1
endi endi
......
...@@ -82,15 +82,18 @@ $x = 0 ...@@ -82,15 +82,18 @@ $x = 0
show4: show4:
$x = $x + 1 $x = $x + 1
sleep 5000 sleep 5000
if $x == 50 then if $x == 10 then
return -1 return -1
endi endi
sql show dnodes sql show dnodes
print dnode1 $data4_1
print dnode2 $data4_2
print dnode3 $data4_3
if $data4_1 != ready then if $data4_1 != ready then
goto show4 goto show4
endi endi
if $data4_2 != NULL then if $data4_2 != null then
goto show4 goto show4
endi endi
if $data4_3 != ready then if $data4_3 != ready then
......
...@@ -77,11 +77,11 @@ if $rows != 3 then ...@@ -77,11 +77,11 @@ if $rows != 3 then
endi endi
sql show dnodes sql show dnodes
$dnode1Vnodes = $data3_192.168.0.1 $dnode1Vnodes = $data2_1
print dnode1 $dnode1Vnodes print dnode1 $dnode1Vnodes
$dnode2Vnodes = $data3_192.168.0.2 $dnode2Vnodes = $data2_2
print dnode2 $dnode2Vnodes print dnode2 $dnode2Vnodes
$dnode3Vnodes = $data3_192.168.0.3 $dnode3Vnodes = $data2_3
print dnode3 $dnode3Vnodes print dnode3 $dnode3Vnodes
if $dnode1Vnodes != 3 then if $dnode1Vnodes != 3 then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册