未验证 提交 16d7fcc2 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

[TD-3641] <fix>: fix interlace timestamp step issue. (#5654)

Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 76ed44f6
...@@ -506,7 +506,7 @@ static int taosRandom() ...@@ -506,7 +506,7 @@ static int taosRandom()
#endif #endif
static int createDatabases(); static int createDatabasesAndStables();
static void createChildTables(); static void createChildTables();
static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet); static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet);
...@@ -2416,7 +2416,7 @@ static int createSuperTable(TAOS * taos, char* dbName, ...@@ -2416,7 +2416,7 @@ static int createSuperTable(TAOS * taos, char* dbName,
return 0; return 0;
} }
static int createDatabases() { static int createDatabasesAndStables() {
TAOS * taos = NULL; TAOS * taos = NULL;
int ret = 0; int ret = 0;
taos = taos_connect(g_Dbs.host, g_Dbs.user, g_Dbs.password, NULL, g_Dbs.port); 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) { ...@@ -4682,6 +4682,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
for (int i = 0; i < batchPerTblTimes; i ++) { for (int i = 0; i < batchPerTblTimes; i ++) {
getTableName(tableName, pThreadInfo, tableSeq); 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; int headLen;
if (i == 0) { if (i == 0) {
...@@ -4728,7 +4734,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -4728,7 +4734,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
remainderBufLen -= dataLen; remainderBufLen -= dataLen;
recOfBatch += batchPerTbl; recOfBatch += batchPerTbl;
startTime += batchPerTbl * superTblInfo->timeStampStep; // startTime += batchPerTbl * superTblInfo->timeStampStep;
pThreadInfo->totalInsertRows += batchPerTbl; pThreadInfo->totalInsertRows += batchPerTbl;
verbosePrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n", verbosePrint("[%d] %s() LN%d batchPerTbl=%d recOfBatch=%d\n",
pThreadInfo->threadID, __func__, __LINE__, pThreadInfo->threadID, __func__, __LINE__,
...@@ -4738,9 +4744,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -4738,9 +4744,12 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if (insertMode == INTERLACE_INSERT_MODE) { if (insertMode == INTERLACE_INSERT_MODE) {
if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) { if (tableSeq == pThreadInfo->start_table_from + pThreadInfo->ntables) {
// turn to first table // turn to first table
startTime += batchPerTbl * superTblInfo->timeStampStep;
tableSeq = pThreadInfo->start_table_from; tableSeq = pThreadInfo->start_table_from;
generatedRecPerTbl += batchPerTbl; generatedRecPerTbl += batchPerTbl;
startTime = pThreadInfo->start_time
+ generatedRecPerTbl * superTblInfo->timeStampStep;
flagSleep = true; flagSleep = true;
if (generatedRecPerTbl >= insertRows) if (generatedRecPerTbl >= insertRows)
break; break;
...@@ -5490,7 +5499,7 @@ static int insertTestProcess() { ...@@ -5490,7 +5499,7 @@ static int insertTestProcess() {
init_rand_data(); init_rand_data();
// create database and super tables // create database and super tables
if(createDatabases() != 0) { if(createDatabasesAndStables() != 0) {
fclose(g_fpOfInsertResult); fclose(g_fpOfInsertResult);
return -1; return -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册