diff --git a/src/benchInsert.c b/src/benchInsert.c index e565ea60..b5a4948e 100644 --- a/src/benchInsert.c +++ b/src/benchInsert.c @@ -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; @@ -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); } diff --git a/src/benchJsonOpt.c b/src/benchJsonOpt.c index c48e6b28..c1365de0 100644 --- a/src/benchJsonOpt.c +++ b/src/benchJsonOpt.c @@ -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; } } diff --git a/src/benchQuery.c b/src/benchQuery.c index 63816b81..3688dae8 100644 --- a/src/benchQuery.c +++ b/src/benchQuery.c @@ -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; @@ -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 @@ -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) {