diff --git a/.github/workflows/3.0-alpine.yml b/.github/workflows/3.0-alpine.yml index c8e3608c..eee92133 100644 --- a/.github/workflows/3.0-alpine.yml +++ b/.github/workflows/3.0-alpine.yml @@ -96,7 +96,7 @@ jobs: || github.event_name == 'push' shell: alpine.sh --root {0} run: | - git clone --branch fix/sangshuduo/TD-23043-windows-socket-close --depth 1 https://github.com/taosdata/TDengine > /dev/null || exit 1 + git clone --branch fix/sangshuduo/TS-2902-taosbenchmark-query-times --depth 1 https://github.com/taosdata/TDengine > /dev/null || exit 1 cd TDengine && mkdir debug && cd debug && cmake .. -DBUILD_TOOLS=true -DTOOLS_BUILD_TYPE=${{env.TOOLS_BUILD_TYPE}} -DBUILD_HTTP=false && make -j8 && make install if [[ ! -f /usr/local/taos/bin/taosd ]] || [[ ! -f /usr/local/taos/bin/taos ]] then diff --git a/.github/workflows/3.0-windows-build.yml b/.github/workflows/3.0-windows-build.yml index 28de8506..04b01127 100644 --- a/.github/workflows/3.0-windows-build.yml +++ b/.github/workflows/3.0-windows-build.yml @@ -62,7 +62,7 @@ jobs: with: repository: 'taosdata/TDengine' path: 'TDengine' - ref: 'chore/sangshuduo/TD-19593-gcc12-support' + ref: 'fix/sangshuduo/TS-2902-taosbenchmark-query-times' - name: create debug directory if: | diff --git a/src/benchQuery.c b/src/benchQuery.c index 21b016fc..87096796 100644 --- a/src/benchQuery.c +++ b/src/benchQuery.c @@ -456,7 +456,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) { return -1; } uint64_t query_times = g_queryInfo.specifiedQueryInfo.queryTimes; - uint64_t total_query_times = query_times * nConcurrent; + uint64_t totalQueryTimes = query_times * nConcurrent; double avg_delay = 0.0; for (int j = 0; j < nConcurrent; j++) { uint64_t seq = i * nConcurrent + j; @@ -470,7 +470,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) { tmfree(pThreadInfo->query_delay_list); } avg_delay /= nConcurrent; - qsort(sql->delay_list, total_query_times, + qsort(sql->delay_list, g_queryInfo.specifiedQueryInfo.queryTimes, sizeof(uint64_t), compare); infoPrintNoTimestamp("complete query with %d threads and %"PRIu64 " query delay " @@ -485,14 +485,13 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) { nConcurrent, query_times, avg_delay/1E6, /* avg */ sql->delay_list[0]/1E6, /* min */ - sql->delay_list[(int32_t) - total_query_times - 1]/1E6, /* max */ - sql->delay_list[(int32_t) - (total_query_times * 0.90)]/1E6, /* p90 */ - sql->delay_list[(int32_t) - (total_query_times * 0.95)]/1E6, /* p95 */ - sql->delay_list[(int32_t) - (total_query_times * 0.99)]/1E6, /* p88 */ + sql->delay_list[totalQueryTimes - 1]/1E6, /* max */ + /* p90 */ + sql->delay_list[(uint64_t)(totalQueryTimes * 0.90)]/1E6, + /* p95 */ + sql->delay_list[(uint64_t)(totalQueryTimes * 0.95)]/1E6, + /* p99 */ + sql->delay_list[(uint64_t)(totalQueryTimes * 0.99)]/1E6, sql->command); infoPrintNoTimestampToFile(g_arguments->fpOfInsertResult, "complete query with %d threads and %"PRIu64 @@ -508,20 +507,21 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) { nConcurrent, query_times, avg_delay/1E6, /* avg */ sql->delay_list[0]/1E6, /* min */ - sql->delay_list[(int32_t) - total_query_times - 1]/1E6, /* max */ - sql->delay_list[(int32_t) - (total_query_times * 0.90)]/1E6, /* p90 */ - sql->delay_list[(int32_t) - (total_query_times * 0.95)]/1E6, /* p95 */ - sql->delay_list[(int32_t) - (total_query_times * 0.99)]/1E6, /* p88 */ + sql->delay_list[totalQueryTimes - 1]/1E6, /* max */ + /* p90 */ + sql->delay_list[(uint64_t)(totalQueryTimes * 0.90)]/1E6, + /* p95 */ + sql->delay_list[(uint64_t)(totalQueryTimes * 0.95)]/1E6, + /* p99 */ + sql->delay_list[(uint64_t)(totalQueryTimes * 0.99)]/1E6, sql->command); } } else { return 0; } + g_queryInfo.specifiedQueryInfo.totalQueried = + g_queryInfo.specifiedQueryInfo.queryTimes * nConcurrent; tmfree((char *)pids); tmfree((char *)infos); for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqls->size; ++i) { @@ -777,9 +777,7 @@ int queryTestProcess() { } closeBenchConn(conn); } - uint64_t startTs = toolsGetTimestampMs(); - if (g_queryInfo.specifiedQueryInfo.mixed_query) { if (multi_thread_specified_mixed_query(g_queryInfo.iface, g_queryInfo.dbName)) { @@ -791,21 +789,22 @@ int queryTestProcess() { return -1; } } - if (multi_thread_super_table_query(g_queryInfo.iface, g_queryInfo.dbName)) { return -1; } - - // // workaround to use separate taos connection; + // workaround to use separate taos connection; uint64_t endTs = toolsGetTimestampMs(); - - uint64_t totalQueried = g_queryInfo.specifiedQueryInfo.totalQueried - + g_queryInfo.superQueryInfo.totalQueried; - int64_t t = endTs - startTs; double tInS = (double)t / 1000.0; - + if (g_queryInfo.specifiedQueryInfo.totalQueried) + infoPrint("Total specified queries: %" PRIu64 "\n", + g_queryInfo.specifiedQueryInfo.totalQueried); + if (g_queryInfo.superQueryInfo.totalQueried) + infoPrint("Total super queries: %" PRIu64 "\n", + g_queryInfo.superQueryInfo.totalQueried); + uint64_t totalQueried = g_queryInfo.specifiedQueryInfo.totalQueried + + g_queryInfo.superQueryInfo.totalQueried; infoPrint( "Spend %.4f second completed total queries: %" PRIu64 ", the QPS of all threads: %10.3f\n\n", @@ -814,6 +813,5 @@ int queryTestProcess() { "Spend %.4f second completed total queries: %" PRIu64 ", the QPS of all threads: %10.3f\n\n", tInS, totalQueried, (double)totalQueried / tInS); - return 0; }