Skip to content

Commit

Permalink
Merge pull request #766 from taosdata/merge/to3.0
Browse files Browse the repository at this point in the history
fix: invalid message with stmt insert
  • Loading branch information
DuanKuanJun committed Jun 28, 2024
2 parents 00cb835 + 5531da9 commit 6793c7a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/benchData.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions src/benchInsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6793c7a

Please sign in to comment.