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

Feature/sangshuduo/td 3317 taosdemo interlace (#5922)

* [TD-3316] <fix>: add testcase for taosdemo limit and offset.

check offset 0.

* [TD-3316] <fix>: add testcase for taosdemo limit and offset.

fix sample file import bug.

* [TD-3316] <fix>: add test case for limit and offset. fix sample data issue.

* [TD-3327] <fix>: fix taosdemo segfault when import data from sample data file.

* [TD-3317] <feature>: make taosdemo support interlace mode.

json parameter rows_per_tbl support.

* [TD-3317] <feature>: support interlace mode.

refactor

* [TD-3317] <feature>: support interlace mode.

refactor

* [TD-3317] <feature>: support interlace mode insertion.

refactor.

* [TD-3317] <feature>: support interlace mode insertion.

change json file.

* [TD-3317] <feature>: support interlace mode insertion.

fix multithread create table regression.

* [TD-3317] <feature>: support interlace mode insertion.

working but not perfect.

* [TD-3317] <feature>: support interlace mode insertion.

rename lowaTest with taosdemoTestWithJson

* [TD-3317] <feature>: support interlace mode insertion.

perfect

* [TD-3317] <feature>: support interlace mode insertion.

cleanup.

* [TD-3317] <feature>: support interlace mode insertion.

adjust algorithm of loop times.

* [TD-3317] <feature>: support interlace mode insertion.

fix delay time bug.

* [TD-3317] <feature>: support interlace mode insertion.

fix progressive timestamp bug.

* [TD-3317] <feature>: support interlace mode insertion.

add an option for performance print.

* [TD-3317] <feature>: support interlace mode insertion.

change json test case with less table for acceleration.

* [TD-3317] <feature>: support interlace mode insertion.

change progressive mode timestamp step and testcase.

* [TD-3197] <fix>: fix taosdemo coverity scan issues.

* [TD-3197] <fix>: fix taosdemo coverity scan issue.

fix subscribeTest pids uninitialized.

* [TD-3317] <feature>: support interlace mode insertion.

add time shift for no sleep time.

* [TD-3317] <feature>: support interlace insert.

rework timestamp.

* [TD-3317] <feature>: support interlace mode insertion.

change rows_per_tbl to interlace_rows.

* [TD-3317] <feature>: taosdemo suppoert interlace mode.

remove trailing spaces.

* [TD-3317] <feature>: taosdemo support interlace insertion.

prompt if interlace > num_of_records_per_req

* fill insert-into early to buffer.

* fix buffer overflow issue.

* change rows_per_tbl to interlace_rows to align with taosdemo.

* adjust remainder rows logic.

* [TD-3317]<fix>: taosdemo support interlace mode.

fix global and stable interlace rows logic.

* [TD-3317]<fix>: taosdemo support interlace mode.

fix 'interlaceRows' is used uninitialized
Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 cb220d65
...@@ -252,7 +252,7 @@ typedef struct SSuperTable_S { ...@@ -252,7 +252,7 @@ typedef struct SSuperTable_S {
int maxSqlLen; // int maxSqlLen; //
int insertInterval; // insert interval, will override global insert interval int insertInterval; // insert interval, will override global insert interval
int64_t insertRows; // 0: no limit int64_t insertRows;
int timeStampStep; int timeStampStep;
char startTimestamp[MAX_TB_NAME_SIZE]; char startTimestamp[MAX_TB_NAME_SIZE];
char sampleFormat[MAX_TB_NAME_SIZE]; // csv, json char sampleFormat[MAX_TB_NAME_SIZE]; // csv, json
...@@ -535,11 +535,11 @@ SArguments g_args = { ...@@ -535,11 +535,11 @@ SArguments g_args = {
"127.0.0.1", // host "127.0.0.1", // host
6030, // port 6030, // port
"root", // user "root", // user
#ifdef _TD_POWER_ #ifdef _TD_POWER_
"powerdb", // password "powerdb", // password
#else #else
"taosdata", // password "taosdata", // password
#endif #endif
"test", // database "test", // database
1, // replica 1, // replica
"t", // tb_prefix "t", // tb_prefix
...@@ -3256,7 +3256,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile( ...@@ -3256,7 +3256,7 @@ static bool getColumnAndTagTypeFromInsertJsonFile(
} }
ret = true; ret = true;
PARSE_OVER: PARSE_OVER:
return ret; return ret;
} }
...@@ -3926,7 +3926,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) { ...@@ -3926,7 +3926,7 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
ret = true; ret = true;
PARSE_OVER: PARSE_OVER:
return ret; return ret;
} }
...@@ -4310,7 +4310,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) { ...@@ -4310,7 +4310,7 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
ret = true; ret = true;
PARSE_OVER: PARSE_OVER:
return ret; return ret;
} }
...@@ -4371,7 +4371,7 @@ static bool getInfoFromJsonFile(char* file) { ...@@ -4371,7 +4371,7 @@ static bool getInfoFromJsonFile(char* file) {
goto PARSE_OVER; goto PARSE_OVER;
} }
PARSE_OVER: PARSE_OVER:
free(content); free(content);
cJSON_Delete(root); cJSON_Delete(root);
fclose(fp); fclose(fp);
...@@ -4868,6 +4868,8 @@ static int generateInterlaceDataBuffer( ...@@ -4868,6 +4868,8 @@ static int generateInterlaceDataBuffer(
pstr += dataLen; pstr += dataLen;
*pRemainderBufLen -= dataLen; *pRemainderBufLen -= dataLen;
} else { } else {
debugPrint("%s() LN%d, generated data tail: %d, not equal batch per table: %d\n",
__func__, __LINE__, k, batchPerTbl);
pstr -= headLen; pstr -= headLen;
pstr[0] = '\0'; pstr[0] = '\0';
k = 0; k = 0;
...@@ -4925,10 +4927,24 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -4925,10 +4927,24 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
debugPrint("[%d] %s() LN%d: ### interlace write\n", debugPrint("[%d] %s() LN%d: ### interlace write\n",
pThreadInfo->threadID, __func__, __LINE__); pThreadInfo->threadID, __func__, __LINE__);
int64_t insertRows;
int interlaceRows;
SSuperTable* superTblInfo = pThreadInfo->superTblInfo; SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
int64_t insertRows = (superTblInfo)?superTblInfo->insertRows:g_args.num_of_DPT; if (superTblInfo) {
int interlaceRows = superTblInfo?superTblInfo->interlaceRows:g_args.interlace_rows; insertRows = superTblInfo->insertRows;
if ((superTblInfo->interlaceRows == 0)
&& (g_args.interlace_rows > 0)) {
interlaceRows = g_args.interlace_rows;
} else {
interlaceRows = superTblInfo->interlaceRows;
}
} else {
insertRows = g_args.num_of_DPT;
interlaceRows = g_args.interlace_rows;
}
if (interlaceRows > insertRows) if (interlaceRows > insertRows)
interlaceRows = insertRows; interlaceRows = insertRows;
...@@ -5063,15 +5079,15 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -5063,15 +5079,15 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if (generatedRecPerTbl >= insertRows) if (generatedRecPerTbl >= insertRows)
break; break;
int remainRows = insertRows - generatedRecPerTbl;
if ((remainRows > 0) && (batchPerTbl > remainRows))
batchPerTbl = remainRows;
if (pThreadInfo->ntables * batchPerTbl < g_args.num_of_RPR) if (pThreadInfo->ntables * batchPerTbl < g_args.num_of_RPR)
break; break;
} }
} }
int remainRows = insertRows - generatedRecPerTbl;
if ((remainRows > 0) && (batchPerTbl > remainRows))
batchPerTbl = remainRows;
verbosePrint("[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"PRId64"\n", verbosePrint("[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"PRId64"\n",
pThreadInfo->threadID, __func__, __LINE__, pThreadInfo->threadID, __func__, __LINE__,
generatedRecPerTbl, insertRows); generatedRecPerTbl, insertRows);
...@@ -5133,7 +5149,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -5133,7 +5149,7 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
} }
} }
free_and_statistics_interlace: free_and_statistics_interlace:
tmfree(buffer); tmfree(buffer);
printf("====thread[%d] completed total inserted rows: %"PRId64 ", total affected rows: %"PRId64 "====\n", printf("====thread[%d] completed total inserted rows: %"PRId64 ", total affected rows: %"PRId64 "====\n",
...@@ -5279,7 +5295,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { ...@@ -5279,7 +5295,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
} }
} // tableSeq } // tableSeq
free_and_statistics_2: free_and_statistics_2:
tmfree(buffer); tmfree(buffer);
printf("====thread[%d] completed total inserted rows: %"PRId64 ", total affected rows: %"PRId64 "====\n", printf("====thread[%d] completed total inserted rows: %"PRId64 ", total affected rows: %"PRId64 "====\n",
...@@ -5294,7 +5310,18 @@ static void* syncWrite(void *sarg) { ...@@ -5294,7 +5310,18 @@ static void* syncWrite(void *sarg) {
threadInfo *pThreadInfo = (threadInfo *)sarg; threadInfo *pThreadInfo = (threadInfo *)sarg;
SSuperTable* superTblInfo = pThreadInfo->superTblInfo; SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
int interlaceRows = superTblInfo?superTblInfo->interlaceRows:g_args.interlace_rows; int interlaceRows;
if (superTblInfo) {
if ((superTblInfo->interlaceRows == 0)
&& (g_args.interlace_rows > 0)) {
interlaceRows = g_args.interlace_rows;
} else {
interlaceRows = superTblInfo->interlaceRows;
}
} else {
interlaceRows = g_args.interlace_rows;
}
if (interlaceRows > 0) { if (interlaceRows > 0) {
// interlace mode // interlace mode
...@@ -5981,7 +6008,6 @@ static void *specifiedTableQuery(void *sarg) { ...@@ -5981,7 +6008,6 @@ static void *specifiedTableQuery(void *sarg) {
totalQueried ++; totalQueried ++;
g_queryInfo.specifiedQueryInfo.totalQueried ++; g_queryInfo.specifiedQueryInfo.totalQueried ++;
et = taosGetTimestampMs(); et = taosGetTimestampMs();
int64_t currentPrintTime = taosGetTimestampMs(); int64_t currentPrintTime = taosGetTimestampMs();
...@@ -5993,9 +6019,9 @@ static void *specifiedTableQuery(void *sarg) { ...@@ -5993,9 +6019,9 @@ static void *specifiedTableQuery(void *sarg) {
pThreadInfo->threadID, pThreadInfo->threadID,
totalQueried, totalQueried,
(double)(totalQueried/((endTs-startTs)/1000.0))); (double)(totalQueried/((endTs-startTs)/1000.0)));
}
lastPrintTime = currentPrintTime; lastPrintTime = currentPrintTime;
} }
}
return NULL; return NULL;
} }
...@@ -6079,10 +6105,10 @@ static void *superTableQuery(void *sarg) { ...@@ -6079,10 +6105,10 @@ static void *superTableQuery(void *sarg) {
pThreadInfo->threadID, pThreadInfo->threadID,
totalQueried, totalQueried,
(double)(totalQueried/((endTs-startTs)/1000.0))); (double)(totalQueried/((endTs-startTs)/1000.0)));
}
lastPrintTime = currentPrintTime; lastPrintTime = currentPrintTime;
} }
} }
}
et = taosGetTimestampMs(); et = taosGetTimestampMs();
printf("####thread[%"PRId64"] complete all sqls to allocate all sub-tables[%d - %d] once queries duration:%.4fs\n\n", printf("####thread[%"PRId64"] complete all sqls to allocate all sub-tables[%d - %d] once queries duration:%.4fs\n\n",
taosGetSelfPthreadId(), taosGetSelfPthreadId(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册