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

[TD-3683]<fix>: reduce buffer size for more stable table creation. (#5719)

Co-authored-by: NShuduo Sang <sdsang@taosdata.com>
上级 5fec22e9
...@@ -2573,10 +2573,7 @@ static void* createTable(void *sarg) ...@@ -2573,10 +2573,7 @@ static void* createTable(void *sarg)
int64_t lastPrintTime = taosGetTimestampMs(); int64_t lastPrintTime = taosGetTimestampMs();
int buff_len; int buff_len;
if (superTblInfo) buff_len = BUFFER_SIZE / 8;
buff_len = superTblInfo->maxSqlLen;
else
buff_len = BUFFER_SIZE;
char *buffer = calloc(buff_len, 1); char *buffer = calloc(buff_len, 1);
if (buffer == NULL) { if (buffer == NULL) {
...@@ -2624,7 +2621,7 @@ static void* createTable(void *sarg) ...@@ -2624,7 +2621,7 @@ static void* createTable(void *sarg)
return NULL; return NULL;
} }
len += snprintf(buffer + len, len += snprintf(buffer + len,
superTblInfo->maxSqlLen - len, buff_len - len,
"if not exists %s.%s%d using %s.%s tags %s ", "if not exists %s.%s%d using %s.%s tags %s ",
winfo->db_name, superTblInfo->childTblPrefix, winfo->db_name, superTblInfo->childTblPrefix,
i, winfo->db_name, i, winfo->db_name,
...@@ -2632,7 +2629,7 @@ static void* createTable(void *sarg) ...@@ -2632,7 +2629,7 @@ static void* createTable(void *sarg)
free(tagsValBuf); free(tagsValBuf);
batchNum++; batchNum++;
if ((batchNum < superTblInfo->batchCreateTableNum) if ((batchNum < superTblInfo->batchCreateTableNum)
&& ((superTblInfo->maxSqlLen - len) && ((buff_len - len)
>= (superTblInfo->lenOfTagOfOneRow + 256))) { >= (superTblInfo->lenOfTagOfOneRow + 256))) {
continue; continue;
} }
...@@ -5174,8 +5171,8 @@ static void startMultiThreadInsertData(int threads, char* db_name, ...@@ -5174,8 +5171,8 @@ static void startMultiThreadInsertData(int threads, char* db_name,
if ((superTblInfo->childTblExists == TBL_ALREADY_EXISTS) if ((superTblInfo->childTblExists == TBL_ALREADY_EXISTS)
&& (superTblInfo->childTblOffset >= 0)) { && (superTblInfo->childTblOffset >= 0)) {
if ((superTblInfo->childTblLimit < 0) if ((superTblInfo->childTblLimit < 0)
|| ((superTblInfo->childTblOffset + superTblInfo->childTblLimit) || ((superTblInfo->childTblOffset + superTblInfo->childTblLimit)
> (superTblInfo->childTblCount))) { > (superTblInfo->childTblCount))) {
superTblInfo->childTblLimit = superTblInfo->childTblLimit =
superTblInfo->childTblCount - superTblInfo->childTblOffset; superTblInfo->childTblCount - superTblInfo->childTblOffset;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册