Skip to content

Commit

Permalink
Merge pull request #837 from taosdata/merge/3.0tomain_0107
Browse files Browse the repository at this point in the history
taos-tools 3.0 merge to main branch
  • Loading branch information
zitsen authored Jan 7, 2025
2 parents ff0c356 + f7a7840 commit 85e3589
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 12 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ name: "CodeQL"
on:
push:
branches:
- develop
- 3.0
- main
pull_request:
# The branches below must be a subset of the branches above
branches:
- develop
- 3.0
- main
schedule:
Expand Down Expand Up @@ -67,8 +65,8 @@ jobs:
libjansson-dev libsnappy-dev liblzma-dev libz-dev pkg-config \
libssl-dev > /dev/null
echo "clone TDengine ${{ github.event.pull_request.base.ref }} on ${{ steps.setup.outputs.uname }}"
git clone --branch ${{ github.event.pull_request.base.ref }} --depth 1 https://github.com/taosdata/TDengine > /dev/null || exit 1
echo "clone TDengine ${{ github.base_ref }} on ${{ steps.setup.outputs.uname }}"
git clone --branch ${{ github.base_ref }} --depth 1 https://github.com/taosdata/TDengine > /dev/null || exit 1
echo "build TDengine 3.0"
cd TDengine || exit 1
Expand Down
2 changes: 0 additions & 2 deletions example/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"query_times": 10,
"query_mode": "taosc",
"specified_table_query": {
"query_interval": 1,
"concurrent": 3,
"sqls": [
{
Expand All @@ -26,7 +25,6 @@
},
"super_table_query": {
"stblname": "meters",
"query_interval": 1,
"threads": 3,
"sqls": [
{
Expand Down
23 changes: 17 additions & 6 deletions src/benchQuery.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ static int multi_thread_specified_table_query(uint16_t iface, char* dbName) {
}

g_queryInfo.specifiedQueryInfo.totalQueried =
g_queryInfo.specifiedQueryInfo.queryTimes * nConcurrent;
nSqlCount * g_queryInfo.specifiedQueryInfo.queryTimes * nConcurrent;
tmfree((char *)pids);
tmfree((char *)infos);

Expand Down Expand Up @@ -661,7 +661,7 @@ static int multi_thread_specified_mixed_query(uint16_t iface, char* dbName) {
if (delay_list->size) {
infoPrint(
"spend %.6fs using "
"%d threads complete query %d times,cd "
"%d threads complete query %d times, "
"min delay: %.6fs, "
"avg delay: %.6fs, "
"p90: %.6fs, "
Expand All @@ -686,6 +686,9 @@ static int multi_thread_specified_mixed_query(uint16_t iface, char* dbName) {
}
benchArrayDestroy(delay_list);
code = 0;
g_queryInfo.specifiedQueryInfo.totalQueried =
g_queryInfo.specifiedQueryInfo.sqls->size * g_queryInfo.specifiedQueryInfo.queryTimes * thread;

OVER:
tmfree(pids);
tmfree(infos);
Expand Down Expand Up @@ -856,12 +859,20 @@ int queryTestProcess() {
uint64_t endTs = toolsGetTimestampMs();
int64_t t = endTs - startTs;
double tInS = (double)t / 1000.0;
if (g_queryInfo.specifiedQueryInfo.totalQueried)

// specifiedQuery
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);
}

// superQuery
if (g_queryInfo.superQueryInfo.totalQueried) {
infoPrint("Total super queries: %" PRIu64 "\n",
g_queryInfo.superQueryInfo.totalQueried);
}

// total QPS
uint64_t totalQueried = g_queryInfo.specifiedQueryInfo.totalQueried
+ g_queryInfo.superQueryInfo.totalQueried;
infoPrint(
Expand Down
20 changes: 20 additions & 0 deletions tests/taosbenchmark/bugs.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ def getPath(self, tool="taosBenchmark"):
tdLog.info("taosBenchmark found in %s" % paths[0])
return paths[0]

def benchmarkQuery(self, benchmark, jsonFile, keys, options=""):
# exe insert
result = "query.log"
os.system(f"rm -f {result}")
cmd = f"{benchmark} {options} -f {jsonFile} >> {result}"
os.system(cmd)
tdLog.info(cmd)
with open(result) as file:
content = file.read()
for key in keys:
if content.find(key) == -1:
tdLog.exit(f"not found key: {key} in content={content}")
else:
tdLog.info(f"found key:{key} successful.")


def testBenchmarkJson(self, benchmark, jsonFile, options="", checkStep=False):
# exe insert
cmd = f"{benchmark} {options} -f {jsonFile}"
Expand Down Expand Up @@ -137,6 +153,10 @@ def bugsTS(self, benchmark):
self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-1.json")
self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-2.json")
self.testBenchmarkJson(benchmark, "./taosbenchmark/json/TS-5234-3.json")
# TS-5846
keys = ["completed total queries: 40"]
self.benchmarkQuery(benchmark, "./taosbenchmark/json/TS-5846-Query.json", keys)
self.benchmarkQuery(benchmark, "./taosbenchmark/json/TS-5846-Mixed-Query.json", keys)

# bugs td
def bugsTD(self, benchmark):
Expand Down
25 changes: 25 additions & 0 deletions tests/taosbenchmark/json/TS-5846-Mixed-Query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"filetype": "query",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"confirm_parameter_prompt": "no",
"continue_if_fail": "yes",
"databases": "test",
"query_times": 10,
"query_mode": "taosc",
"specified_table_query": {
"threads": 2,
"mixed_query": "yes",
"sqls": [
{
"sql": "select count(*) from test.meters"
},
{
"sql": "select * from test.d0 limit 10"
}
]
}
}
25 changes: 25 additions & 0 deletions tests/taosbenchmark/json/TS-5846-Query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"filetype": "query",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"confirm_parameter_prompt": "no",
"continue_if_fail": "yes",
"databases": "test",
"query_times": 10,
"query_mode": "taosc",
"specified_table_query": {
"threads": 2,
"mixed_query": "no",
"sqls": [
{
"sql": "select count(*) from test.meters"
},
{
"sql": "select * from test.d0 limit 10"
}
]
}
}

0 comments on commit 85e3589

Please sign in to comment.