From 6d748239c188db3d2293ae31196ed7ed76a40f38 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 28 Jun 2024 09:23:25 +0800 Subject: [PATCH 1/2] fix: batch num is invalid --- src/benchData.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/benchData.c b/src/benchData.c index b3fd211b..4da0f0ad 100644 --- a/src/benchData.c +++ b/src/benchData.c @@ -1991,6 +1991,20 @@ uint32_t bindParamBatch(threadInfo *pThreadInfo, } } + /* + 1. The last batch size may be smaller than the previous batch size. + 2. When inserting another table, the batch size reset again(bigger than lastBatchSize) + */ + int lastBatchSize = ((TAOS_MULTI_BIND *) pThreadInfo->bindParams)->num; + if (batch != lastBatchSize) { + for (int c = 0; c < columnCount + 1; c++) { + TAOS_MULTI_BIND *param = + (TAOS_MULTI_BIND *) (pThreadInfo->bindParams + + sizeof(TAOS_MULTI_BIND) * c); + param->num = batch; + } + } + int64_t start = toolsGetTimestampUs(); if (taos_stmt_bind_param_batch( stmt, (TAOS_MULTI_BIND *)pThreadInfo->bindParams)) { From 5531da99ff394099db8c83032129d218c9d79058 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 28 Jun 2024 15:35:12 +0800 Subject: [PATCH 2/2] fix: if multi-stable set stmt singleSingleStb false --- src/benchInsert.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/benchInsert.c b/src/benchInsert.c index 009cf7d3..2797fcfb 100644 --- a/src/benchInsert.c +++ b/src/benchInsert.c @@ -2495,7 +2495,7 @@ void *syncWriteProgressive(void *sarg) { int64_t delay3 = 0; if (stmt) { taos_stmt_close(pThreadInfo->conn->stmt); - if(stbInfo->autoTblCreating) { + if(stbInfo->autoTblCreating || database->superTbls->size > 1) { pThreadInfo->conn->stmt = taos_stmt_init(pThreadInfo->conn->taos); } else { TAOS_STMT_OPTIONS op; @@ -3431,7 +3431,7 @@ int32_t initInsertThread(SDataBase* database, SSuperTable* stbInfo, int32_t nthr goto END; } taos_stmt_close(pThreadInfo->conn->stmt); - if(stbInfo->autoTblCreating) { + if (stbInfo->autoTblCreating || database->superTbls->size > 1) { pThreadInfo->conn->stmt = taos_stmt_init(pThreadInfo->conn->taos); } else { TAOS_STMT_OPTIONS op;