From 16d7fcc2a275910b94e657b77320ad14e2670bc5 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Fri, 2 Apr 2021 09:35:02 +0800 Subject: [PATCH] [TD-3641] : fix interlace timestamp step issue. (#5654) Co-authored-by: Shuduo Sang --- src/kit/taosdemo/taosdemo.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index df1c7bee26..7eb55acda8 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -506,7 +506,7 @@ static int taosRandom() #endif -static int createDatabases(); +static int createDatabasesAndStables(); static void createChildTables(); static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet); @@ -2416,7 +2416,7 @@ static int createSuperTable(TAOS * taos, char* dbName, return 0; } -static int createDatabases() { +static int createDatabasesAndStables() { TAOS * taos = NULL; int ret = 0; taos = taos_connect(g_Dbs.host, g_Dbs.user, g_Dbs.password, NULL, g_Dbs.port); @@ -4682,6 +4682,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { for (int i = 0; i < batchPerTblTimes; i ++) { getTableName(tableName, pThreadInfo, tableSeq); + if (0 == strlen(tableName)) { + errorPrint("[%d] %s() LN%d, getTableName return null\n", + pThreadInfo->threadID, __func__, __LINE__); + return NULL; + exit(-1); + } int headLen; if (i == 0) { @@ -4728,7 +4734,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { remainderBufLen -= dataLen; recOfBatch += batchPerTbl; - startTime += batchPerTbl * superTblInfo->timeStampStep; +// startTime += batchPerTbl * superTblInfo->timeStampStep; pThreadInfo->totalInsertRows += batchPerTbl; verbosePrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n", pThreadInfo->threadID, __func__, __LINE__, @@ -4738,9 +4744,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { if (insertMode == INTERLACE_INSERT_MODE) { if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { // turn to first table - startTime += batchPerTbl * superTblInfo->timeStampStep; tableSeq = pThreadInfo->start_table_from; generatedRecPerTbl += batchPerTbl; + + startTime = pThreadInfo->start_time + + generatedRecPerTbl * superTblInfo->timeStampStep; + flagSleep = true; if (generatedRecPerTbl >= insertRows) break; @@ -5490,7 +5499,7 @@ static int insertTestProcess() { init_rand_data(); // create database and super tables - if(createDatabases() != 0) { + if(createDatabasesAndStables() != 0) { fclose(g_fpOfInsertResult); return -1; } -- GitLab