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

Hotfix/sangshuduo/td 3317 for master (#5921)

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

patch for master.

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

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>
上级 ec7b4f22
......@@ -252,7 +252,7 @@ typedef struct SSuperTable_S {
int maxSqlLen; //
int insertInterval; // insert interval, will override global insert interval
int64_t insertRows; // 0: no limit
int64_t insertRows;
int timeStampStep;
char startTimestamp[MAX_TB_NAME_SIZE];
char sampleFormat[MAX_TB_NAME_SIZE]; // csv, json
......@@ -4868,6 +4868,8 @@ static int generateInterlaceDataBuffer(
pstr += dataLen;
*pRemainderBufLen -= dataLen;
} else {
debugPrint("%s() LN%d, generated data tail: %d, not equal batch per table: %d\n",
__func__, __LINE__, k, batchPerTbl);
pstr -= headLen;
pstr[0] = '\0';
k = 0;
......@@ -4925,10 +4927,24 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
debugPrint("[%d] %s() LN%d: ### interlace write\n",
pThreadInfo->threadID, __func__, __LINE__);
int64_t insertRows;
int interlaceRows;
SSuperTable* superTblInfo = pThreadInfo->superTblInfo;
int64_t insertRows = (superTblInfo)?superTblInfo->insertRows:g_args.num_of_DPT;
int interlaceRows = superTblInfo?superTblInfo->interlaceRows:g_args.interlace_rows;
if (superTblInfo) {
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)
interlaceRows = insertRows;
......@@ -5063,15 +5079,15 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if (generatedRecPerTbl >= insertRows)
break;
int remainRows = insertRows - generatedRecPerTbl;
if ((remainRows > 0) && (batchPerTbl > remainRows))
batchPerTbl = remainRows;
if (pThreadInfo->ntables * batchPerTbl < g_args.num_of_RPR)
break;
}
}
int remainRows = insertRows - generatedRecPerTbl;
if ((remainRows > 0) && (batchPerTbl > remainRows))
batchPerTbl = remainRows;
verbosePrint("[%d] %s() LN%d generatedRecPerTbl=%d insertRows=%"PRId64"\n",
pThreadInfo->threadID, __func__, __LINE__,
generatedRecPerTbl, insertRows);
......@@ -5294,7 +5310,18 @@ static void* syncWrite(void *sarg) {
threadInfo *pThreadInfo = (threadInfo *)sarg;
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) {
// interlace mode
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册