Skip to content

Commit

Permalink
Merge pull request #670 from taosdata/buildFix
Browse files Browse the repository at this point in the history
fix: build error for windows
  • Loading branch information
plum-lihui committed Jun 2, 2023
2 parents 2c8ad99 + c1c66c1 commit 28b8b9f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/benchInsert.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ static int startMultiThreadCreateChildTable(
}
int64_t b = ntables % threads;

int threadCnt = 0;
for (uint32_t i = 0; (i < threads && !g_arguments->terminate); i++) {
threadInfo *pThreadInfo = infos + i;
pThreadInfo->threadID = i;
Expand All @@ -1000,9 +1001,10 @@ static int startMultiThreadCreateChildTable(
tableFrom = pThreadInfo->end_table_to + 1;
pThreadInfo->tables_created = 0;
pthread_create(pids + i, NULL, createTable, pThreadInfo);
threadCnt ++;
}

for (int i = 0; (i < threads && pids[i] !=0); i++) {
for (int i = 0; i < threadCnt; i++) {
pthread_join(pids[i], NULL);
}

Expand Down
8 changes: 4 additions & 4 deletions src/benchJsonOpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,13 +1177,13 @@ static int getMetaFromInsertJsonFile(tools_cJSON *json) {
if (numRecPerReq && numRecPerReq->type == tools_cJSON_Number) {
g_arguments->reqPerReq = (uint32_t)numRecPerReq->valueint;
if ((int32_t)g_arguments->reqPerReq <= 0) {
errorPrint(" num_of_records_per_req item in json config must over zero. current = %d\n", g_arguments->reqPerReq);
goto PARSE_OVER;
infoPrint("waring: num_of_records_per_req item in json config must over zero, current = %d. now reset to default. \n", g_arguments->reqPerReq);
g_arguments->reqPerReq = DEFAULT_REQ_PER_REQ;
}

if (g_arguments->reqPerReq > 32768) {
errorPrint(" num_of_records_per_req item in json config need less than 32768. current = %d\n", g_arguments->reqPerReq);
goto PARSE_OVER;
infoPrint("warning: num_of_records_per_req item in json config need less than 32768. current = %d. now reset to default.\n", g_arguments->reqPerReq);
g_arguments->reqPerReq = DEFAULT_REQ_PER_REQ;
}

}
Expand Down
4 changes: 3 additions & 1 deletion src/benchQuery.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) {
SSQL *sql = benchArrayGet(g_queryInfo.specifiedQueryInfo.sqls, i);

// create threads
int threadCnt = 0;
for (int j = 0; j < nConcurrent; j++) {
threadInfo *pThreadInfo = infos + j;
pThreadInfo->threadID = i * nConcurrent + j;
Expand All @@ -470,6 +471,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) {
}

pthread_create(pids + j, NULL, specifiedTableQuery, pThreadInfo);
threadCnt++;
}

// if failed, set termainte flag true like ctrl+c exit
Expand All @@ -479,7 +481,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) {
}

// wait threads execute finished one by one
for (int j = 0; (j < nConcurrent && pids[j] > 0) ; j++) {
for (int j = 0; j < threadCnt ; j++) {
pthread_join(pids[j], NULL);
threadInfo *pThreadInfo = infos + j;
if (iface == REST_IFACE) {
Expand Down

0 comments on commit 28b8b9f

Please sign in to comment.