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)) { 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;