Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows build error and per_req set default #669

Merged
merged 3 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading