提交 24023301 编写于 作者: sangshuduo's avatar sangshuduo

Merge branch 'master' into hotfix/sangshuduo/TD-7790-taosdump-stb-dump-for-master

Subproject commit 32e2c97a4cf7bedaa99f5d6dd8cb036e7f4470df Subproject commit 016d8e82a24d72779be0ab0090580a372b4fffca
...@@ -111,6 +111,7 @@ static void *shellCheckThreadFp(void *arg) { ...@@ -111,6 +111,7 @@ static void *shellCheckThreadFp(void *arg) {
int32_t start = pThread->threadIndex * interval; int32_t start = pThread->threadIndex * interval;
int32_t end = (pThread->threadIndex + 1) * interval; int32_t end = (pThread->threadIndex + 1) * interval;
if (start >= tbNum) return NULL;
if (end > tbNum) end = tbNum + 1; if (end > tbNum) end = tbNum + 1;
char file[32] = {0}; char file[32] = {0};
...@@ -193,9 +194,11 @@ void shellCheck(TAOS *con, SShellArguments *_args) { ...@@ -193,9 +194,11 @@ void shellCheck(TAOS *con, SShellArguments *_args) {
return; return;
} }
fprintf(stdout, "total %d tables will be checked by %d threads\n", tbNum, _args->threadNum); if (tbNum > 0) {
shellRunCheckThreads(con, _args); fprintf(stdout, "total %d tables will be checked by %d threads\n", tbNum, _args->threadNum);
shellRunCheckThreads(con, _args);
}
int64_t end = taosGetTimestampMs(); int64_t end = taosGetTimestampMs();
fprintf(stdout, "total %d tables checked, failed:%d, time spent %.2f seconds\n", checkedNum, errorNum, fprintf(stdout, "total %d tables checked, failed:%d, time spent %.2f seconds\n", checkedNum, errorNum,
(end - start) / 1000.0); (end - start) / 1000.0);
......
...@@ -420,16 +420,16 @@ static void printVersion() { ...@@ -420,16 +420,16 @@ static void printVersion() {
} }
} }
UNUSED_FUNC void errorWrongValue(char *program, char *wrong_arg, char *wrong_value) void errorWrongValue(char *program, char *wrong_arg, char *wrong_value)
{ {
fprintf(stderr, "%s %s: %s is an invalid value\n", program, wrong_arg, wrong_value); fprintf(stderr, "%s %s: %s is an invalid value\n", program, wrong_arg, wrong_value);
fprintf(stderr, "Try `taosdemo --help' or `taosdemo --usage' for more information.\n"); fprintf(stderr, "Try `taosdump --help' or `taosdump --usage' for more information.\n");
} }
static void errorUnrecognized(char *program, char *wrong_arg) static void errorUnrecognized(char *program, char *wrong_arg)
{ {
fprintf(stderr, "%s: unrecognized options '%s'\n", program, wrong_arg); fprintf(stderr, "%s: unrecognized options '%s'\n", program, wrong_arg);
fprintf(stderr, "Try `taosdemo --help' or `taosdemo --usage' for more information.\n"); fprintf(stderr, "Try `taosdump --help' or `taosdump --usage' for more information.\n");
} }
static void errorPrintReqArg(char *program, char *wrong_arg) static void errorPrintReqArg(char *program, char *wrong_arg)
...@@ -438,7 +438,7 @@ static void errorPrintReqArg(char *program, char *wrong_arg) ...@@ -438,7 +438,7 @@ static void errorPrintReqArg(char *program, char *wrong_arg)
"%s: option requires an argument -- '%s'\n", "%s: option requires an argument -- '%s'\n",
program, wrong_arg); program, wrong_arg);
fprintf(stderr, fprintf(stderr,
"Try `taosdemo --help' or `taosdemo --usage' for more information.\n"); "Try `taosdump --help' or `taosdump --usage' for more information.\n");
} }
static void errorPrintReqArg2(char *program, char *wrong_arg) static void errorPrintReqArg2(char *program, char *wrong_arg)
...@@ -447,7 +447,7 @@ static void errorPrintReqArg2(char *program, char *wrong_arg) ...@@ -447,7 +447,7 @@ static void errorPrintReqArg2(char *program, char *wrong_arg)
"%s: option requires a number argument '-%s'\n", "%s: option requires a number argument '-%s'\n",
program, wrong_arg); program, wrong_arg);
fprintf(stderr, fprintf(stderr,
"Try `taosdemo --help' or `taosdemo --usage' for more information.\n"); "Try `taosdump --help' or `taosdump --usage' for more information.\n");
} }
static void errorPrintReqArg3(char *program, char *wrong_arg) static void errorPrintReqArg3(char *program, char *wrong_arg)
...@@ -456,7 +456,7 @@ static void errorPrintReqArg3(char *program, char *wrong_arg) ...@@ -456,7 +456,7 @@ static void errorPrintReqArg3(char *program, char *wrong_arg)
"%s: option '%s' requires an argument\n", "%s: option '%s' requires an argument\n",
program, wrong_arg); program, wrong_arg);
fprintf(stderr, fprintf(stderr,
"Try `taosdemo --help' or `taosdemo --usage' for more information.\n"); "Try `taosdump --help' or `taosdump --usage' for more information.\n");
} }
/* Parse a single option. */ /* Parse a single option. */
...@@ -483,7 +483,14 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -483,7 +483,14 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
errorPrintReqArg2("taosdump", "P"); errorPrintReqArg2("taosdump", "P");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
g_args.port = atoi(arg);
uint64_t port = atoi(arg);
if (port > 65535) {
errorWrongValue("taosdump", "-P or --port", arg);
exit(EXIT_FAILURE);
}
g_args.port = (uint16_t)port;
break; break;
case 'q': case 'q':
g_args.mysqlFlag = atoi(arg); g_args.mysqlFlag = atoi(arg);
...@@ -493,23 +500,38 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -493,23 +500,38 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
errorPrint("Invalid path %s\n", arg); errorPrint("Invalid path %s\n", arg);
return -1; return -1;
} }
tstrncpy(g_args.outpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN); if (full_path.we_wordv[0]) {
wordfree(&full_path); tstrncpy(g_args.outpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN);
wordfree(&full_path);
} else {
errorPrintReqArg3("taosdump", "-o or --outpath");
exit(EXIT_FAILURE);
}
break; break;
case 'g': case 'g':
g_args.debug_print = true; g_args.debug_print = true;
break; break;
case 'i': case 'i':
g_args.isDumpIn = true; g_args.isDumpIn = true;
if (wordexp(arg, &full_path, 0) != 0) { if (wordexp(arg, &full_path, 0) != 0) {
errorPrint("Invalid path %s\n", arg); errorPrint("Invalid path %s\n", arg);
return -1; return -1;
} }
tstrncpy(g_args.inpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN); if (full_path.we_wordv[0]) {
wordfree(&full_path); tstrncpy(g_args.inpath, full_path.we_wordv[0],
MAX_FILE_NAME_LEN);
wordfree(&full_path);
} else {
errorPrintReqArg3("taosdump", "-i or --inpath");
exit(EXIT_FAILURE);
}
break; break;
case 'r': case 'r':
g_args.resultFile = arg; g_args.resultFile = arg;
break; break;
...@@ -2776,41 +2798,41 @@ int main(int argc, char *argv[]) { ...@@ -2776,41 +2798,41 @@ int main(int argc, char *argv[]) {
} }
printf("====== arguments config ======\n"); printf("====== arguments config ======\n");
{
printf("host: %s\n", g_args.host); printf("host: %s\n", g_args.host);
printf("user: %s\n", g_args.user); printf("user: %s\n", g_args.user);
printf("password: %s\n", g_args.password); printf("password: %s\n", g_args.password);
printf("port: %u\n", g_args.port); printf("port: %u\n", g_args.port);
printf("mysqlFlag: %d\n", g_args.mysqlFlag); printf("mysqlFlag: %d\n", g_args.mysqlFlag);
printf("outpath: %s\n", g_args.outpath); printf("outpath: %s\n", g_args.outpath);
printf("inpath: %s\n", g_args.inpath); printf("inpath: %s\n", g_args.inpath);
printf("resultFile: %s\n", g_args.resultFile); printf("resultFile: %s\n", g_args.resultFile);
printf("encode: %s\n", g_args.encode); printf("encode: %s\n", g_args.encode);
printf("all_databases: %s\n", g_args.all_databases?"true":"false"); printf("all_databases: %s\n", g_args.all_databases?"true":"false");
printf("databases: %d\n", g_args.databases); printf("databases: %d\n", g_args.databases);
printf("databasesSeq: %s\n", g_args.databasesSeq); printf("databasesSeq: %s\n", g_args.databasesSeq);
printf("schemaonly: %s\n", g_args.schemaonly?"true":"false"); printf("schemaonly: %s\n", g_args.schemaonly?"true":"false");
printf("with_property: %s\n", g_args.with_property?"true":"false"); printf("with_property: %s\n", g_args.with_property?"true":"false");
printf("avro format: %s\n", g_args.avro?"true":"false"); printf("avro format: %s\n", g_args.avro?"true":"false");
printf("start_time: %" PRId64 "\n", g_args.start_time); printf("start_time: %" PRId64 "\n", g_args.start_time);
printf("human readable start time: %s \n", g_args.humanStartTime); printf("human readable start time: %s \n", g_args.humanStartTime);
printf("end_time: %" PRId64 "\n", g_args.end_time); printf("end_time: %" PRId64 "\n", g_args.end_time);
printf("human readable end time: %s \n", g_args.humanEndTime); printf("human readable end time: %s \n", g_args.humanEndTime);
printf("precision: %s\n", g_args.precision); printf("precision: %s\n", g_args.precision);
printf("data_batch: %d\n", g_args.data_batch); printf("data_batch: %d\n", g_args.data_batch);
printf("max_sql_len: %d\n", g_args.max_sql_len); printf("max_sql_len: %d\n", g_args.max_sql_len);
printf("table_batch: %d\n", g_args.table_batch); printf("table_batch: %d\n", g_args.table_batch);
printf("thread_num: %d\n", g_args.thread_num); printf("thread_num: %d\n", g_args.thread_num);
printf("allow_sys: %d\n", g_args.allow_sys); printf("allow_sys: %d\n", g_args.allow_sys);
printf("abort: %d\n", g_args.abort); printf("abort: %d\n", g_args.abort);
printf("isDumpIn: %d\n", g_args.isDumpIn); printf("isDumpIn: %d\n", g_args.isDumpIn);
printf("arg_list_len: %d\n", g_args.arg_list_len); printf("arg_list_len: %d\n", g_args.arg_list_len);
printf("debug_print: %d\n", g_args.debug_print); printf("debug_print: %d\n", g_args.debug_print);
for (int32_t i = 0; i < g_args.arg_list_len; i++) { for (int32_t i = 0; i < g_args.arg_list_len; i++) {
printf("arg_list[%d]: %s\n", i, g_args.arg_list[i]); printf("arg_list[%d]: %s\n", i, g_args.arg_list[i]);
}
} }
printf("==============================\n"); printf("==============================\n");
if (checkParam(&g_args) < 0) { if (checkParam(&g_args) < 0) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
...@@ -2824,39 +2846,38 @@ int main(int argc, char *argv[]) { ...@@ -2824,39 +2846,38 @@ int main(int argc, char *argv[]) {
fprintf(g_fpOfResult, "#############################################################################\n"); fprintf(g_fpOfResult, "#############################################################################\n");
fprintf(g_fpOfResult, "============================== arguments config =============================\n"); fprintf(g_fpOfResult, "============================== arguments config =============================\n");
{
fprintf(g_fpOfResult, "host: %s\n", g_args.host); fprintf(g_fpOfResult, "host: %s\n", g_args.host);
fprintf(g_fpOfResult, "user: %s\n", g_args.user); fprintf(g_fpOfResult, "user: %s\n", g_args.user);
fprintf(g_fpOfResult, "password: %s\n", g_args.password); fprintf(g_fpOfResult, "password: %s\n", g_args.password);
fprintf(g_fpOfResult, "port: %u\n", g_args.port); fprintf(g_fpOfResult, "port: %u\n", g_args.port);
fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag); fprintf(g_fpOfResult, "mysqlFlag: %d\n", g_args.mysqlFlag);
fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath); fprintf(g_fpOfResult, "outpath: %s\n", g_args.outpath);
fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath); fprintf(g_fpOfResult, "inpath: %s\n", g_args.inpath);
fprintf(g_fpOfResult, "resultFile: %s\n", g_args.resultFile); fprintf(g_fpOfResult, "resultFile: %s\n", g_args.resultFile);
fprintf(g_fpOfResult, "encode: %s\n", g_args.encode); fprintf(g_fpOfResult, "encode: %s\n", g_args.encode);
fprintf(g_fpOfResult, "all_databases: %s\n", g_args.all_databases?"true":"false"); fprintf(g_fpOfResult, "all_databases: %s\n", g_args.all_databases?"true":"false");
fprintf(g_fpOfResult, "databases: %d\n", g_args.databases); fprintf(g_fpOfResult, "databases: %d\n", g_args.databases);
fprintf(g_fpOfResult, "databasesSeq: %s\n", g_args.databasesSeq); fprintf(g_fpOfResult, "databasesSeq: %s\n", g_args.databasesSeq);
fprintf(g_fpOfResult, "schemaonly: %s\n", g_args.schemaonly?"true":"false"); fprintf(g_fpOfResult, "schemaonly: %s\n", g_args.schemaonly?"true":"false");
fprintf(g_fpOfResult, "with_property: %s\n", g_args.with_property?"true":"false"); fprintf(g_fpOfResult, "with_property: %s\n", g_args.with_property?"true":"false");
fprintf(g_fpOfResult, "avro format: %s\n", g_args.avro?"true":"false"); fprintf(g_fpOfResult, "avro format: %s\n", g_args.avro?"true":"false");
fprintf(g_fpOfResult, "start_time: %" PRId64 "\n", g_args.start_time); fprintf(g_fpOfResult, "start_time: %" PRId64 "\n", g_args.start_time);
fprintf(g_fpOfResult, "human readable start time: %s \n", g_args.humanStartTime); fprintf(g_fpOfResult, "human readable start time: %s \n", g_args.humanStartTime);
fprintf(g_fpOfResult, "end_time: %" PRId64 "\n", g_args.end_time); fprintf(g_fpOfResult, "end_time: %" PRId64 "\n", g_args.end_time);
fprintf(g_fpOfResult, "human readable end time: %s \n", g_args.humanEndTime); fprintf(g_fpOfResult, "human readable end time: %s \n", g_args.humanEndTime);
fprintf(g_fpOfResult, "precision: %s\n", g_args.precision); fprintf(g_fpOfResult, "precision: %s\n", g_args.precision);
fprintf(g_fpOfResult, "data_batch: %d\n", g_args.data_batch); fprintf(g_fpOfResult, "data_batch: %d\n", g_args.data_batch);
fprintf(g_fpOfResult, "max_sql_len: %d\n", g_args.max_sql_len); fprintf(g_fpOfResult, "max_sql_len: %d\n", g_args.max_sql_len);
fprintf(g_fpOfResult, "table_batch: %d\n", g_args.table_batch); fprintf(g_fpOfResult, "table_batch: %d\n", g_args.table_batch);
fprintf(g_fpOfResult, "thread_num: %d\n", g_args.thread_num); fprintf(g_fpOfResult, "thread_num: %d\n", g_args.thread_num);
fprintf(g_fpOfResult, "allow_sys: %d\n", g_args.allow_sys); fprintf(g_fpOfResult, "allow_sys: %d\n", g_args.allow_sys);
fprintf(g_fpOfResult, "abort: %d\n", g_args.abort); fprintf(g_fpOfResult, "abort: %d\n", g_args.abort);
fprintf(g_fpOfResult, "isDumpIn: %d\n", g_args.isDumpIn); fprintf(g_fpOfResult, "isDumpIn: %d\n", g_args.isDumpIn);
fprintf(g_fpOfResult, "arg_list_len: %d\n", g_args.arg_list_len); fprintf(g_fpOfResult, "arg_list_len: %d\n", g_args.arg_list_len);
for (int32_t i = 0; i < g_args.arg_list_len; i++) { for (int32_t i = 0; i < g_args.arg_list_len; i++) {
fprintf(g_fpOfResult, "arg_list[%d]: %s\n", i, g_args.arg_list[i]); fprintf(g_fpOfResult, "arg_list[%d]: %s\n", i, g_args.arg_list[i]);
}
} }
g_numOfCores = (int32_t)sysconf(_SC_NPROCESSORS_ONLN); g_numOfCores = (int32_t)sysconf(_SC_NPROCESSORS_ONLN);
......
...@@ -8,7 +8,7 @@ if "%severIp%"=="" (set severIp=127.0.0.1) ...@@ -8,7 +8,7 @@ if "%severIp%"=="" (set severIp=127.0.0.1)
if "%serverPort%"=="" (set serverPort=6030) if "%serverPort%"=="" (set serverPort=6030)
go env -w GO111MODULE=on go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct go env -w GOPROXY=https://goproxy.cn,direct
cd case001 cd case001
case001.bat %severIp% %serverPort% case001.bat %severIp% %serverPort%
......
...@@ -14,7 +14,7 @@ if [ ! -n "$serverPort" ]; then ...@@ -14,7 +14,7 @@ if [ ! -n "$serverPort" ]; then
fi fi
go env -w GO111MODULE=on go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct go env -w GOPROXY=https://goproxy.cn,direct
bash ./case001/case001.sh $severIp $serverPort bash ./case001/case001.sh $severIp $serverPort
bash ./case002/case002.sh $severIp $serverPort bash ./case002/case002.sh $severIp $serverPort
......
@echo off @echo off
echo ==== start run cases001.go echo ==== start run cases002.go
del go.* del go.*
go mod init demotest go mod init demotest
......
...@@ -43,10 +43,9 @@ func main() { ...@@ -43,10 +43,9 @@ func main() {
os.Exit(1) os.Exit(1)
} }
defer db.Close() defer db.Close()
db.Exec("drop if exists database test") db.Exec("drop database if exists test")
db.Exec("create if not exists database test") db.Exec("create database if not exists test")
db.Exec("use test") db.Exec("use test")
db.Exec("drop if exists database test")
db.Exec("create table test (ts timestamp ,level int)") db.Exec("create table test (ts timestamp ,level int)")
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
sqlcmd := fmt.Sprintf("insert into test values(%d,%d)", ts+i, i) sqlcmd := fmt.Sprintf("insert into test values(%d,%d)", ts+i, i)
......
#!/bin/bash #!/bin/bash
echo "==== start run cases001.go" echo "==== start run cases002.go"
set +e set +e
#set -x #set -x
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys, shutil
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import subprocess
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
def getBuildPath(self) -> str:
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosd" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/debug/build/bin")]
break
return buildPath
def check_coredump(self, res_log):
build_path = self.getBuildPath() + "/debug/build/bin"
cmd = build_path + "/" + "taos -d test -k 1 > res.txt 2>&1"
print(res_log)
out = subprocess.check_output(cmd, shell=True).decode("utf-8")
print(out)
def execute_cmd(self,cmd):
out = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,stderr=subprocess.PIPE).stderr.read().decode("utf-8")
if out.find("error:") >=0:
print(cmd)
print(out)
def run(self):
tdSql.prepare()
build_path = self.getBuildPath() + "/debug/build/bin"
tdLog.info("====== check tables use taos -d -k ========")
tdSql.execute("drop database if exists test")
tdSql.execute("drop database if exists dumptest")
tdSql.execute("create database if not exists test")
# self.check_coredump("====== only create database test ==== ")
tdSql.execute("use test")
tdSql.execute("create stable st (ts timestamp , id int , val double , str binary(20) ) tags (ind int)")
tdSql.execute("create table tb1 using st tags(1)")
self.check_coredump("======= only create one table =======")
tdSql.execute("create table tb2 using st tags(2)")
tdSql.execute("create table tb3 using st tags(3)")
# self.check_coredump("======= only create three table =======")
tdSql.execute("create table tb4 using st tags(4)")
tdSql.execute("create table tb5 using st tags(5)")
self.check_coredump("======= only create five table =======")
start_time = 1604298064000
rows = 10
tb_nums = 5
tdLog.info("====== start insert rows ========")
for i in range(1, tb_nums + 1):
for j in range(rows):
start_time += 10
tdSql.execute(
"insert into tb%d values(%d, %d,%f,%s) " % (i, start_time, j, float(j), "'str" + str(j) + "'"))
tdSql.query("select count(*) from st")
tdSql.checkData(0, 0, 50)
for i in range(1, tb_nums + 1):
tdSql.execute("select * from test.tb%s" % (str(i)))
tdLog.info("====== check taos -D filedir ========")
if not os.path.exists("./dumpdata"):
os.mkdir("./dumpdata")
else:
shutil.rmtree("./dumpdata")
os.mkdir("./dumpdata")
os.system(build_path + "/" + "taosdump -D test -o ./dumpdata")
sleep(2)
os.system("cd ./dumpdata && mv dbs.sql tables.sql")
os.system('sed -i "s/test/dumptest/g" `grep test -rl ./dumpdata`')
os.system(build_path + "/" + "taos -D ./dumpdata")
tdSql.query("select count(*) from dumptest.st")
tdSql.checkData(0, 0, 50)
tdLog.info("========test other file name about tables.sql========")
os.system("rm -rf ./dumpdata/*")
os.system(build_path + "/" + "taosdump -D test -o ./dumpdata")
sleep(2)
os.system("cd ./dumpdata && mv dbs.sql table.sql")
os.system('sed -i "s/test/tt/g" `grep test -rl ./dumpdata`')
os.system(build_path + "/" + "taos -D ./dumpdata")
tdLog.info("====== check taos shell params ========")
tdLog.info("====== step 1 : insert data with some unicode ========")
sqls = ["drop database if exists dbst",
"create database dbst",
"use dbst",
"create stable dbst.st (ts timestamp , id int , val double , str binary(200) ,char nchar(200) ) tags (ind int)",
"create table dbst.tb1 using dbst.st tags(1)",
"create table dbst.tb2 using dbst.st tags(2)",
"insert into dbst.tb1 values('2021-07-14T10:40:00.006+0800' , 1 , 1.0 , 'binary_1','中文-1') ",
"insert into dbst.tb1 values('2021-07-14T10:40:00.006Z' , 1 , 1.0 , 'binary\\'1','中文?-1')",
"insert into dbst.tb1 values('2021-07-14 10:40:00.000',1,1.0,'!@#¥%……&*', '中文12&%#@!*')",
"insert into dbst.tb1 values(now ,1,1.0,'(){}[];./?&*\n', '中文&%#@!*34')",
"insert into dbst.tb1 values(now ,1,1.0,'\\t\\0', '中文_\\t\\0')",
# "insert into dbst.tb1 values(now ,1,1.0,'\t\"', '中文_\t\\')",
"CREATE STABLE dbst.stb (TS TIMESTAMP , ID INT , VAL DOUBLE , STR BINARY(200) ,CHAR NCHAR(200) ) TAGS (IND INT)",
"CREATE TABLE dbst.tbb1 USING dbst.STB TAGS(1)",
"CREATE TABLE dbst.tbb2 USING dbst.STB TAGS(2)",
"INSERT INTO dbst.TBB1 VALUES('2021-07-14T10:40:00.006+0800' , 1 , 1.0 , 'BINARY_1','中文-1')",
"INSERT INTO dbst.TBB1 VALUES('2021-07-14T10:40:00.006Z' , 1 , 1.0 , 'BINARY1','中文?-1')",
"INSERT INTO dbst.TBB1 VALUES('2021-07-14 10:40:00.000',1,1.0,'!@#¥%……&*', '中文12&%#@!*');"]
for sql in sqls:
cmd = build_path + "/" + "taos -s \""+sql+"\""
self.execute_cmd(cmd)
basic_code = ['!' ,'#', '$', '%', '&', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
'2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', '@', 'A',
'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M','N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\',']' ,'^', '_', '`', 'a', 'b', 'c',
'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r','s', 't', 'u',
'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~']
for code in basic_code:
if not code=='\\':
cmd = build_path + "/" + "taos -s \" insert into dbst.tb2 values(now ,2,2.0,'"+code+"','汉字"+code+"\')\""
else:
cmd = build_path + "/" + "taos -s \" insert into dbst.tb2 values(now ,2,2.0," +r'"\\"'+",'中文"+r'\\'+ "')\""
self.execute_cmd(cmd)
tdLog.info("====== step 2 : query result of results ========")
querys = ["select count(*) from dbst.tb2",
"show dbst.tables",
"show dbst.tables like tb_",
"show dbst.tables like 't%'",
"select * from dbst.stb",
"select avg(val),max(id),min(id) from dbst.st ",
"select last_row(*) from dbst.st",
"select * from dbst.st where ts >'2021-07-14T10:40:00.006+0800' and ind = 1 ",
"select max(val) from dbst.st where ts >'2021-07-14T10:40:00.006+0800' group by tbname",
"select count(*) from dbst.st interval(1s) group by tbname",
"show queries ",
"show connections",
"show functions",
"select * from dbst.tb2 where str like 'a'",
"select bottom(id, 3) from dbst.st; ",
"select _block_dist() from dbst.st;",
"select 5 from dbst.tb1;",
"select id , val from dbst.st",
"describe dbst.st",
"alter stable dbst.st modify column str binary(205);" ]
for query in querys:
cmd = build_path + "/" + "taos -s \""+query+"\""
self.execute_cmd(cmd)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -18213,4 +18213,21 @@ ...@@ -18213,4 +18213,21 @@
obj:/usr/bin/python3.8 obj:/usr/bin/python3.8
fun:PyVectorcall_Call fun:PyVectorcall_Call
fun:_PyEval_EvalFrameDefault fun:_PyEval_EvalFrameDefault
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_buffer_get_info
fun:array_getbuffer
fun:__Pyx__GetBufferAndValidate.constprop.64
fun:__pyx_f_5numpy_6random_13bit_generator_12SeedSequence_mix_entropy
fun:__pyx_pw_5numpy_6random_13bit_generator_12SeedSequence_1__init__
obj:/usr/bin/python3.8
fun:__Pyx__PyObject_CallOneArg
fun:__Pyx_PyObject_CallOneArg
fun:__pyx_pw_5numpy_6random_13bit_generator_12BitGenerator_1__init__
obj:/usr/bin/python3.8
obj:/usr/bin/python3.8
} }
\ No newline at end of file
...@@ -263,7 +263,7 @@ python3 ./test.py -f query/nestedQuery/queryInterval.py ...@@ -263,7 +263,7 @@ python3 ./test.py -f query/nestedQuery/queryInterval.py
python3 ./test.py -f query/queryStateWindow.py python3 ./test.py -f query/queryStateWindow.py
# python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py # python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py
python3 ./test.py -f query/nestquery_last_row.py python3 ./test.py -f query/nestquery_last_row.py
#python3 ./test.py -f query/nestedQuery/nestedQuery.py python3 ./test.py -f query/nestedQuery/nestedQuery.py
python3 ./test.py -f query/queryCnameDisplay.py python3 ./test.py -f query/queryCnameDisplay.py
python3 ./test.py -f query/operator_cost.py python3 ./test.py -f query/operator_cost.py
python3 test.py -f query/nestedQuery/queryWithSpread.py python3 test.py -f query/nestedQuery/queryWithSpread.py
...@@ -293,6 +293,7 @@ python3 ./test.py -f client/client.py ...@@ -293,6 +293,7 @@ python3 ./test.py -f client/client.py
python3 ./test.py -f client/version.py python3 ./test.py -f client/version.py
python3 ./test.py -f client/alterDatabase.py python3 ./test.py -f client/alterDatabase.py
python3 ./test.py -f client/noConnectionErrorTest.py python3 ./test.py -f client/noConnectionErrorTest.py
python3 ./test.py -f client/taoshellCheckCase.py
# python3 test.py -f client/change_time_1_1.py # python3 test.py -f client/change_time_1_1.py
# python3 test.py -f client/change_time_1_2.py # python3 test.py -f client/change_time_1_2.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册