fix: add show connMode string (#30323)
* fix: add show connMode string * fix: add stdbool.h to pub.h * fix: remove trash file army/output.txt * fix: caseBase.py modify syntax error * fix: restore -R option for taosdump * fix: taosdumpCommandline.py case * fix: native stmt write normal table failed * fix: taosdumpCommandline.py case passed * fix: restore test.py from main branch * fix: taosCli.py check default conn mode * fix: commandline-sml.py case pass * fix: websiteCase.py case passed * fix: connMode.py case * fix: modify default port is 0 * fix: taos_options with config dir not work * fix: websocket.py delete -D timeout options * fix: default_tmq_json.py context move to default_json.py, so delete * fix python kafka bug * chore: improve taos_init in wrapper * chore: add installation path preparation in build workflow * fix connMode bug * fix: fix tmq conf/consumer new error in wrapperFunc.c * fix: correct the spelling toss -> taosGetInstall... * chore: fix compile error in wrapperFunc.c * fix: createConnect fix memory leak * fix: tsim forbid CHECK ODR * modify userOperTest uuse static lib * reverse userOperTest use static lib --------- Co-authored-by: Alex Duan <417921451@qq.com> Co-authored-by: taos-support <it@taosdata.com> Co-authored-by: “chris <“zk662144@163.com”> Co-authored-by: t_max <1172915550@qq.com> Co-authored-by: sheyanjie-qq <249478495@qq.com>
This commit is contained in:
parent
5c03f9e0fa
commit
e273a943ea
|
@ -74,6 +74,11 @@ jobs:
|
|||
snappy \
|
||||
zlib
|
||||
|
||||
- name: prepare install path
|
||||
run: |
|
||||
sudo mkdir -p /usr/local/lib
|
||||
sudo mkdir -p /usr/local/include
|
||||
|
||||
- name: Build and install TDengine
|
||||
run: |
|
||||
mkdir debug && cd debug
|
||||
|
|
|
@ -182,7 +182,7 @@ def test_json_to_taos(consumer: Consumer):
|
|||
'voltage': 105,
|
||||
'phase': 0.02027, }),
|
||||
partition=1, topic='test', serialized_key_size=None, serialized_header_size=None,
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None),
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None, leader_epoch=0),
|
||||
ConsumerRecord(checksum=None, headers=None, offset=1, key=None,
|
||||
value=json.dumps({'table_name': 'd1',
|
||||
'ts': '2022-12-06 15:13:39.643',
|
||||
|
@ -190,7 +190,7 @@ def test_json_to_taos(consumer: Consumer):
|
|||
'voltage': 102,
|
||||
'phase': 0.02027, }),
|
||||
partition=1, topic='test', serialized_key_size=None, serialized_header_size=None,
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None),
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None,leader_epoch=0 ),
|
||||
]
|
||||
]
|
||||
|
||||
|
@ -203,11 +203,11 @@ def test_line_to_taos(consumer: Consumer):
|
|||
ConsumerRecord(checksum=None, headers=None, offset=1, key=None,
|
||||
value="d0 values('2023-01-01 00:00:00.001', 3.49, 109, 0.02737)".encode('utf-8'),
|
||||
partition=1, topic='test', serialized_key_size=None, serialized_header_size=None,
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None),
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None,leader_epoch=0 ),
|
||||
ConsumerRecord(checksum=None, headers=None, offset=1, key=None,
|
||||
value="d1 values('2023-01-01 00:00:00.002', 6.19, 112, 0.09171)".encode('utf-8'),
|
||||
partition=1, topic='test', serialized_key_size=None, serialized_header_size=None,
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None),
|
||||
serialized_value_size=None, timestamp=time.time(), timestamp_type=None,leader_epoch=0 ),
|
||||
]
|
||||
]
|
||||
consumer._line_to_taos(messages=records)
|
||||
|
|
|
@ -129,4 +129,4 @@ add_test(
|
|||
add_test(
|
||||
NAME userOperTest
|
||||
COMMAND userOperTest
|
||||
)
|
||||
)
|
||||
|
|
|
@ -39,7 +39,7 @@ EDriverType tsDriverType = DRIVER_NATIVE;
|
|||
|
||||
void *tsDriver = NULL;
|
||||
|
||||
static int32_t tossGetDevelopPath(char *driverPath, const char *driverName) {
|
||||
static int32_t taosGetDevelopPath(char *driverPath, const char *driverName) {
|
||||
char appPath[PATH_MAX] = {0};
|
||||
int32_t ret = taosAppPath(appPath, PATH_MAX);
|
||||
if (ret == 0) {
|
||||
|
@ -67,7 +67,7 @@ int32_t taosDriverInit(EDriverType driverType) {
|
|||
driverName = DRIVER_WSBSOCKET_NAME;
|
||||
}
|
||||
|
||||
if (tsDriver == NULL && tossGetDevelopPath(driverPath, driverName) == 0) {
|
||||
if (tsDriver == NULL && taosGetDevelopPath(driverPath, driverName) == 0) {
|
||||
tsDriver = taosLoadDll(driverPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
static TdThreadOnce tsDriverOnce = PTHREAD_ONCE_INIT;
|
||||
volatile int32_t tsDriverOnceRet = 0;
|
||||
|
||||
static TdThreadOnce tsInitOnce = PTHREAD_ONCE_INIT;
|
||||
volatile int32_t tsInitOnceRet = 0;
|
||||
|
||||
#define ERR_VOID(code) \
|
||||
terrno = code; \
|
||||
return;
|
||||
|
@ -89,21 +92,25 @@ setConfRet taos_set_config(const char *config) {
|
|||
return (*fp_taos_set_config)(config);
|
||||
}
|
||||
|
||||
static void taos_init_wrapper(void) {
|
||||
static void taos_init_driver(void) {
|
||||
tsDriverOnceRet = taosDriverInit(tsDriverType);
|
||||
if (tsDriverOnceRet != 0) return;
|
||||
|
||||
tsDriverOnceRet = 0;
|
||||
}
|
||||
static void taos_init_wrapper(void) {
|
||||
if (fp_taos_init == NULL) {
|
||||
terrno = TSDB_CODE_DLL_FUNC_NOT_LOAD;
|
||||
tsDriverOnceRet = -1;
|
||||
tsInitOnceRet = -1;
|
||||
} else {
|
||||
tsDriverOnceRet = (*fp_taos_init)();
|
||||
tsInitOnceRet = (*fp_taos_init)();
|
||||
}
|
||||
}
|
||||
|
||||
int taos_init(void) {
|
||||
(void)taosThreadOnce(&tsDriverOnce, taos_init_wrapper);
|
||||
return tsDriverOnceRet;
|
||||
(void)taosThreadOnce(&tsDriverOnce, taos_init_driver);
|
||||
(void)taosThreadOnce(&tsInitOnce, taos_init_wrapper);
|
||||
return tsInitOnceRet;
|
||||
}
|
||||
|
||||
void taos_cleanup(void) {
|
||||
|
@ -126,11 +133,7 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
|
|||
terrno = TSDB_CODE_REPEAT_INIT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (taos_init() != 0) {
|
||||
terrno = TSDB_CODE_DLL_NOT_LOAD;
|
||||
return -1;
|
||||
}
|
||||
(void)taosThreadOnce(&tsDriverOnce, taos_init_driver);
|
||||
|
||||
CHECK_INT(fp_taos_options);
|
||||
return (*fp_taos_options)(option, arg);
|
||||
|
@ -143,7 +146,7 @@ int taos_options_connection(TAOS *taos, TSDB_OPTION_CONNECTION option, const voi
|
|||
|
||||
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
|
||||
if (taos_init() != 0) {
|
||||
terrno = TSDB_CODE_DLL_NOT_LOAD;
|
||||
//terrno = TSDB_CODE_DLL_NOT_LOAD;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -646,6 +649,7 @@ TAOS_RES *taos_schemaless_insert_ttl_with_reqid_tbname_key(TAOS *taos, char *lin
|
|||
}
|
||||
|
||||
tmq_conf_t *tmq_conf_new() {
|
||||
taos_init();
|
||||
CHECK_PTR(fp_tmq_conf_new);
|
||||
return (*fp_tmq_conf_new)();
|
||||
}
|
||||
|
@ -666,6 +670,7 @@ void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_commit_cb *cb, void *para
|
|||
}
|
||||
|
||||
tmq_list_t *tmq_list_new() {
|
||||
taos_init();
|
||||
CHECK_PTR(fp_tmq_list_new);
|
||||
return (*fp_tmq_list_new)();
|
||||
}
|
||||
|
@ -691,6 +696,7 @@ char **tmq_list_to_c_array(const tmq_list_t *tlist) {
|
|||
}
|
||||
|
||||
tmq_t *tmq_consumer_new(tmq_conf_t *conf, char *errstr, int32_t errstrLen) {
|
||||
taos_init();
|
||||
CHECK_PTR(fp_tmq_consumer_new);
|
||||
return (*fp_tmq_consumer_new)(conf, errstr, errstrLen);
|
||||
}
|
||||
|
@ -860,11 +866,13 @@ TSDB_SERVER_STATUS taos_check_server_status(const char *fqdn, int port, char *de
|
|||
}
|
||||
|
||||
void taos_write_crashinfo(int signum, void *sigInfo, void *context) {
|
||||
taos_init();
|
||||
CHECK_VOID(fp_taos_write_crashinfo);
|
||||
(*fp_taos_write_crashinfo)(signum, sigInfo, context);
|
||||
}
|
||||
|
||||
char *getBuildInfo() {
|
||||
taos_init();
|
||||
CHECK_PTR(fp_getBuildInfo);
|
||||
return (*fp_getBuildInfo)();
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ class TDTestCase(TBase):
|
|||
['-a "abc"', "[0x80000357]"],
|
||||
]
|
||||
for arg in args:
|
||||
rlist = self.taos("Z 0 " + arg[0])
|
||||
rlist = self.taos("-Z 0 " + arg[0])
|
||||
if arg[1] != None:
|
||||
self.checkListString(rlist, arg[1])
|
||||
|
||||
|
@ -340,9 +340,14 @@ class TDTestCase(TBase):
|
|||
self.checkExcept(taos + " -s 'show dnodes;' " + option)
|
||||
|
||||
def checkModeVersion(self):
|
||||
|
||||
# check default conn mode
|
||||
#DEFAULT_CONN = "WebSocket"
|
||||
DEFAULT_CONN = "Native"
|
||||
|
||||
# results
|
||||
results = [
|
||||
"WebSocket Client Version",
|
||||
f"{DEFAULT_CONN} Client Version",
|
||||
"2022-10-01 00:01:39.000",
|
||||
"Query OK, 100 row(s) in set"
|
||||
]
|
||||
|
@ -351,8 +356,10 @@ class TDTestCase(TBase):
|
|||
cmd = f"-s 'select ts from test.d0'"
|
||||
rlist = self.taos(cmd, checkRun = True)
|
||||
self.checkManyString(rlist, results)
|
||||
|
||||
# websocket
|
||||
cmd = f"-Z 1 -s 'select ts from test.d0'"
|
||||
results[0] = "WebSocket Client Version"
|
||||
rlist = self.taos(cmd, checkRun = True)
|
||||
self.checkManyString(rlist, results)
|
||||
|
||||
|
|
|
@ -196,9 +196,9 @@ class TBase:
|
|||
tdSql.checkFirstValue(sql, expect)
|
||||
|
||||
# order by desc limit 1 with last
|
||||
sql = f"select first({col}) from {self.db}.{self.db}."
|
||||
sql = f"select first({col}) from {self.db}.{self.stb}"
|
||||
expect = tdSql.getFirstValue(sql)
|
||||
sql = f"select {col} from {self.db}.{self.db}. order by _c0 asc limit 1"
|
||||
sql = f"select {col} from {self.db}.{self.stb} order by _c0 asc limit 1"
|
||||
tdSql.checkFirstValue(sql, expect)
|
||||
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
[02/10 13:52:16.164959] SUCC: created database (test)
|
||||
[02/10 13:52:16.182024] INFO: start creating 1000 table(s) with 8 thread(s)
|
||||
[02/10 13:52:16.396337] SUCC: Spent 0.2140 seconds to create 1000 table(s) with 8 thread(s) speed: 4673 tables/s, already exist 0 table(s), actual 1000 table(s) pre created, 0 table(s) will be auto created
|
||||
[02/10 13:53:05.155428] SUCC: thread[2] progressive mode, completed total inserted rows: 12500000, 339193.01 records/second
|
||||
[02/10 13:53:05.160652] SUCC: thread[7] progressive mode, completed total inserted rows: 12500000, 341816.65 records/second
|
||||
[02/10 13:53:05.207601] SUCC: thread[0] progressive mode, completed total inserted rows: 12500000, 340556.51 records/second
|
||||
[02/10 13:53:05.215370] SUCC: thread[4] progressive mode, completed total inserted rows: 12500000, 338804.97 records/second
|
||||
[02/10 13:53:05.224077] SUCC: thread[5] progressive mode, completed total inserted rows: 12500000, 338596.28 records/second
|
||||
[02/10 13:53:05.249786] SUCC: thread[1] progressive mode, completed total inserted rows: 12500000, 339208.40 records/second
|
||||
[02/10 13:53:05.256970] SUCC: thread[3] progressive mode, completed total inserted rows: 12500000, 339174.04 records/second
|
||||
[02/10 13:53:05.274900] SUCC: thread[6] progressive mode, completed total inserted rows: 12500000, 339551.12 records/second
|
||||
[02/10 13:53:05.275900] SUCC: Spent 48.867685 (real 36.806958) seconds to insert rows: 100000000 with 8 thread(s) into test 2046342.08 (real 2716877.61) records/second
|
||||
[02/10 13:53:05.275909] SUCC: insert delay, min: 11.2580ms, avg: 29.4456ms, p90: 32.7750ms, p95: 34.1120ms, p99: 39.5900ms, max: 70.3780ms
|
||||
[02/12 15:46:06.469780] SUCC: created database (test)
|
||||
[02/12 15:46:06.499844] INFO: start creating 10000 table(s) with 8 thread(s)
|
||||
[02/12 15:46:08.185009] SUCC: Spent 1.6860 seconds to create 10000 table(s) with 8 thread(s) speed: 5931 tables/s, already exist 0 table(s), actual 10000 table(s) pre created, 0 table(s) will be auto created
|
||||
[02/12 15:46:57.356674] SUCC: thread[0] progressive mode, completed total inserted rows: 12500000, 339076.93 records/second
|
||||
[02/12 15:46:57.434553] SUCC: thread[1] progressive mode, completed total inserted rows: 12500000, 338528.52 records/second
|
||||
[02/12 15:46:57.452522] SUCC: thread[2] progressive mode, completed total inserted rows: 12500000, 339844.37 records/second
|
||||
[02/12 15:46:57.452921] SUCC: thread[5] progressive mode, completed total inserted rows: 12500000, 339349.90 records/second
|
||||
[02/12 15:46:57.463726] SUCC: thread[4] progressive mode, completed total inserted rows: 12500000, 339986.37 records/second
|
||||
[02/12 15:46:57.466467] SUCC: thread[3] progressive mode, completed total inserted rows: 12500000, 339785.50 records/second
|
||||
[02/12 15:46:57.499118] SUCC: thread[6] progressive mode, completed total inserted rows: 12500000, 339326.86 records/second
|
||||
[02/12 15:46:57.501694] SUCC: thread[7] progressive mode, completed total inserted rows: 12500000, 338309.30 records/second
|
||||
[02/12 15:46:57.502535] SUCC: Spent 49.309586 (real 36.843268) seconds to insert rows: 100000000 with 8 thread(s) into test 2028003.24 (real 2714200.05) records/second
|
||||
[02/12 15:46:57.502546] SUCC: insert delay, min: 10.9580ms, avg: 29.4746ms, p90: 32.6960ms, p95: 33.8290ms, p99: 36.8390ms, max: 77.9940ms
|
||||
[02/14 15:27:32.543409] SUCC: created database (test)
|
||||
[02/14 15:27:32.568881] INFO: start creating 10000 table(s) with 8 thread(s)
|
||||
[02/14 15:27:34.249759] SUCC: Spent 1.6810 seconds to create 10000 table(s) with 8 thread(s) speed: 5949 tables/s, already exist 0 table(s), actual 10000 table(s) pre created, 0 table(s) will be auto created
|
||||
[02/14 15:28:26.165699] SUCC: thread[0] progressive mode, completed total inserted rows: 12500000, 321266.73 records/second
|
||||
[02/14 15:28:26.281188] SUCC: thread[4] progressive mode, completed total inserted rows: 12500000, 319863.00 records/second
|
||||
[02/14 15:28:26.326975] SUCC: thread[5] progressive mode, completed total inserted rows: 12500000, 321802.51 records/second
|
||||
[02/14 15:28:26.328615] SUCC: thread[6] progressive mode, completed total inserted rows: 12500000, 321804.13 records/second
|
||||
[02/14 15:28:26.379189] SUCC: thread[7] progressive mode, completed total inserted rows: 12500000, 320719.22 records/second
|
||||
[02/14 15:28:26.400891] SUCC: thread[1] progressive mode, completed total inserted rows: 12500000, 321512.59 records/second
|
||||
[02/14 15:28:26.470912] SUCC: thread[2] progressive mode, completed total inserted rows: 12500000, 319026.94 records/second
|
||||
[02/14 15:28:26.565079] SUCC: thread[3] progressive mode, completed total inserted rows: 12500000, 317248.21 records/second
|
||||
[02/14 15:28:26.566013] SUCC: Spent 52.307623 (real 39.013939) seconds to insert rows: 100000000 with 8 thread(s) into test 1911767.24 (real 2563186.45) records/second
|
||||
[02/14 15:28:26.566024] SUCC: insert delay, min: 11.1290ms, avg: 31.2112ms, p90: 35.4900ms, p95: 37.0580ms, p99: 41.5180ms, max: 68.5900ms
|
||||
[02/17 14:09:42.181835] SUCC: created database (test)
|
||||
[02/17 14:09:42.210373] INFO: start creating 10000 table(s) with 8 thread(s)
|
||||
[02/17 14:09:44.199467] SUCC: Spent 1.9890 seconds to create 10000 table(s) with 8 thread(s) speed: 5028 tables/s, already exist 0 table(s), actual 10000 table(s) pre created, 0 table(s) will be auto created
|
||||
[02/17 14:10:32.845475] SUCC: thread[3] progressive mode, completed total inserted rows: 12500000, 338184.62 records/second
|
||||
[02/17 14:10:32.872586] SUCC: thread[4] progressive mode, completed total inserted rows: 12500000, 338445.48 records/second
|
||||
[02/17 14:10:32.873271] SUCC: thread[1] progressive mode, completed total inserted rows: 12500000, 339256.73 records/second
|
||||
[02/17 14:10:32.938231] SUCC: thread[5] progressive mode, completed total inserted rows: 12500000, 338737.29 records/second
|
||||
[02/17 14:10:32.947655] SUCC: thread[2] progressive mode, completed total inserted rows: 12500000, 338938.99 records/second
|
||||
[02/17 14:10:32.952985] SUCC: thread[0] progressive mode, completed total inserted rows: 12500000, 338652.89 records/second
|
||||
[02/17 14:10:32.962370] SUCC: thread[6] progressive mode, completed total inserted rows: 12500000, 338890.00 records/second
|
||||
[02/17 14:10:32.998729] SUCC: thread[7] progressive mode, completed total inserted rows: 12500000, 339216.19 records/second
|
||||
[02/17 14:10:32.999680] SUCC: Spent 48.790057 (real 36.896020) seconds to insert rows: 100000000 with 8 thread(s) into test 2049597.93 (real 2710319.43) records/second
|
||||
[02/17 14:10:32.999696] SUCC: insert delay, min: 10.7720ms, avg: 29.5168ms, p90: 32.6910ms, p95: 33.8370ms, p99: 36.6750ms, max: 76.0590ms
|
|
@ -37,9 +37,6 @@ import taos
|
|||
import taosrest
|
||||
import taosws
|
||||
|
||||
from taos.cinterface import *
|
||||
taos.taos_options(6, "native")
|
||||
|
||||
def checkRunTimeError():
|
||||
import win32gui
|
||||
timeCount = 0
|
||||
|
@ -261,9 +258,8 @@ if __name__ == "__main__":
|
|||
#
|
||||
# do exeCmd command
|
||||
#
|
||||
taosAdapter = True # default is websocket , so must start taosAdapter
|
||||
if not execCmd == "":
|
||||
if taosAdapter or restful or websocket:
|
||||
if taosAdapter or taosAdapter or restful or websocket:
|
||||
tAdapter.init(deployPath)
|
||||
else:
|
||||
tdDnodes.init(deployPath)
|
||||
|
|
|
@ -68,14 +68,10 @@ class TDTestCase(TBase):
|
|||
tdSql.checkData(0, 0, 10*10000)
|
||||
|
||||
# add normal table
|
||||
cmd = "%s -N -I sml -t 2 -n 10000 -y" % binPath
|
||||
tdLog.info("%s" % cmd)
|
||||
os.system("%s" % cmd)
|
||||
|
||||
tdSql.query("select count(*) from test.d0")
|
||||
tdSql.checkData(0, 0, 1*10000)
|
||||
tdSql.query("select count(*) from test.d1")
|
||||
tdSql.checkData(0, 0, 1*10000)
|
||||
cmd = "-N -I sml -t 2 -n 10000 -y"
|
||||
rlist = self.benchmark(cmd, checkRun = False)
|
||||
# expect failed
|
||||
self.checkListString(rlist, "schemaless cannot work without stable")
|
||||
|
||||
def stop(self):
|
||||
tdSql.close()
|
||||
|
|
|
@ -68,12 +68,15 @@ class TDTestCase(TBase):
|
|||
os.environ['TDENGINE_CLOUD_DSN'] = ""
|
||||
|
||||
def checkCommandLine(self):
|
||||
# default CONN_MODE
|
||||
DEFAULT_CONN_MODE = "Native"
|
||||
|
||||
# modes
|
||||
modes = ["", "-Z 1 -B 1", "-Z websocket", "-Z 0", "-Z native -B 2"]
|
||||
# result
|
||||
Rows = "insert rows: 9990"
|
||||
results1 = [
|
||||
["Connect mode is : WebSocket", Rows],
|
||||
[f"Connect mode is : {DEFAULT_CONN_MODE}", Rows],
|
||||
["Connect mode is : WebSocket", Rows],
|
||||
["Connect mode is : WebSocket", Rows],
|
||||
["Connect mode is : Native", Rows],
|
||||
|
@ -112,7 +115,7 @@ class TDTestCase(TBase):
|
|||
# ommand
|
||||
#
|
||||
self.benchmarkCmd("-h 127.0.0.1", 5, 100, 10, ["insert rows: 500"])
|
||||
self.benchmarkCmd("-h 127.0.0.1 -P 6041 -uroot -ptaosdata", 5, 100, 10, ["insert rows: 500"])
|
||||
self.benchmarkCmd("-h 127.0.0.1 -uroot -ptaosdata", 5, 100, 10, ["insert rows: 500"])
|
||||
self.benchmarkCmd("-Z 0 -h 127.0.0.1 -P 6030 -uroot -ptaosdata", 5, 100, 10, ["insert rows: 500"])
|
||||
|
||||
#
|
||||
|
@ -120,7 +123,7 @@ class TDTestCase(TBase):
|
|||
#
|
||||
|
||||
# 6041 is default
|
||||
options = "-h 127.0.0.1 -P 6041 -uroot -ptaosdata"
|
||||
options = "-Z 1 -h 127.0.0.1 -P 6041 -uroot -ptaosdata"
|
||||
json = "tools/benchmark/basic/json/connModePriorityErrHost.json"
|
||||
self.insertBenchJson(json, options, True)
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ class TDTestCase(TBase):
|
|||
def checkTmqJson(self, benchmark, json):
|
||||
OK_RESULT = "Consumed total msgs: 30, total rows: 300000"
|
||||
cmd = benchmark + " -f " + json
|
||||
output,error = frame.eos.run(cmd, 600)
|
||||
output, error, code = frame.eos.run(cmd, 600)
|
||||
if output.find(OK_RESULT) != -1:
|
||||
tdLog.info(f"succ: {cmd} found '{OK_RESULT}'")
|
||||
else:
|
||||
|
|
|
@ -29,7 +29,7 @@ class TDTestCase(TBase):
|
|||
|
||||
def run(self):
|
||||
binPath = etool.benchMarkFile()
|
||||
cmd = "%s -t 1 -n 1 -y -W http://localhost:6041 -D 30" % binPath
|
||||
cmd = "%s -t 1 -n 1 -y -W http://localhost:6041 " % binPath
|
||||
tdLog.info("%s" % cmd)
|
||||
os.system("%s" % cmd)
|
||||
tdSql.execute("reset query cache")
|
||||
|
|
|
@ -158,7 +158,7 @@ class TDTestCase(TBase):
|
|||
def basicCommandLine(self, tmpdir):
|
||||
#command and check result
|
||||
checkItems = [
|
||||
[f"-h 127.0.0.1 -P 6041 -uroot -ptaosdata -A -N -o {tmpdir}", ["OK: Database test dumped"]],
|
||||
[f"-Z 0 -h 127.0.0.1 -P 6030 -uroot -ptaosdata -A -N -o {tmpdir}", ["OK: Database test dumped"]],
|
||||
[f"-r result -a -e test d0 -o {tmpdir}", ["OK: table: d0 dumped", "OK: 100 row(s) dumped out!"]],
|
||||
[f"-n -D test -o {tmpdir}", ["OK: Database test dumped", "OK: 205 row(s) dumped out!"]],
|
||||
[f"-Z 0 -P 6030 -n -D test -o {tmpdir}", ["OK: Database test dumped", "OK: 205 row(s) dumped out!"]],
|
||||
|
@ -348,19 +348,12 @@ class TDTestCase(TBase):
|
|||
self.exceptCommandLine(taosdump, db, stb, tmpdir)
|
||||
tdLog.info("4. except command line ................................. [Passed]")
|
||||
|
||||
json = "./tools/taosdump/native/json/insertOther.json"
|
||||
# insert
|
||||
db, stb, childCount, insertRows = self.insertData(json)
|
||||
# dump in/out
|
||||
self.dumpInOutMode("", db , json, tmpdir)
|
||||
tdLog.info("5. native varbinary geometry ........................... [Passed]")
|
||||
|
||||
#
|
||||
# check connMode
|
||||
#
|
||||
|
||||
self.checkConnMode(db, stb, childCount, insertRows, tmpdir)
|
||||
tdLog.info("6. check conn mode ..................................... [Passed]")
|
||||
tdLog.info("5. check conn mode ..................................... [Passed]")
|
||||
|
||||
|
||||
def stop(self):
|
||||
|
|
|
@ -38,8 +38,6 @@ from util.taosadapter import *
|
|||
import taos
|
||||
import taosrest
|
||||
|
||||
from taos.cinterface import *
|
||||
taos.taos_options(6, "native")
|
||||
|
||||
def checkRunTimeError():
|
||||
import win32gui
|
||||
|
|
|
@ -126,7 +126,7 @@ python3 mockdatasource.py
|
|||
python3 fast_write_example.py
|
||||
|
||||
# 20
|
||||
pip3 install kafka-python
|
||||
pip3 install kafka-python==2.1.2
|
||||
python3 kafka_example_consumer.py
|
||||
|
||||
# 21
|
||||
|
@ -196,4 +196,5 @@ check_transactions || exit 1
|
|||
reset_cache || exit 1
|
||||
python3 tmq_websocket_example.py
|
||||
|
||||
python3 stmt2_native.py
|
||||
python3 stmt2_native.py
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@
|
|||
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/custom_col_tag.py
|
||||
|
||||
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/default_json.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/default_tmq_json.py
|
||||
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/demo.py
|
||||
|
||||
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/csv-export.py
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
set +e
|
||||
#set -x
|
||||
|
||||
export ASAN_OPTIONS=detect_odr_violation=0
|
||||
echo "forbid check ODR violation."
|
||||
|
||||
FILE_NAME=
|
||||
VALGRIND=0
|
||||
TEST=0
|
||||
|
|
|
@ -40,9 +40,6 @@ import taos
|
|||
import taosrest
|
||||
import taosws
|
||||
|
||||
from taos.cinterface import *
|
||||
taos.taos_options(6, "native")
|
||||
|
||||
def checkRunTimeError():
|
||||
import win32gui
|
||||
timeCount = 0
|
||||
|
@ -73,6 +70,7 @@ def get_local_classes_in_order(file_path):
|
|||
def dynamicLoadModule(fileName):
|
||||
moduleName = fileName.replace(".py", "").replace(os.sep, ".")
|
||||
return importlib.import_module(moduleName, package='..')
|
||||
|
||||
#
|
||||
# run case on previous cluster
|
||||
#
|
||||
|
@ -254,9 +252,8 @@ if __name__ == "__main__":
|
|||
#
|
||||
# do exeCmd command
|
||||
#
|
||||
taosAdapter = True # default is websocket , so must start taosAdapter
|
||||
if not execCmd == "":
|
||||
if taosAdapter or restful or websocket:
|
||||
if restful or websocket:
|
||||
tAdapter.init(deployPath)
|
||||
else:
|
||||
tdDnodes.init(deployPath)
|
||||
|
@ -295,7 +292,7 @@ if __name__ == "__main__":
|
|||
if valgrind:
|
||||
time.sleep(2)
|
||||
|
||||
if taosAdapter or restful or websocket:
|
||||
if restful or websocket:
|
||||
toBeKilled = "taosadapter"
|
||||
|
||||
# killCmd = "ps -ef|grep -w %s| grep -v grep | awk '{print $2}' | xargs kill -TERM > /dev/null 2>&1" % toBeKilled
|
||||
|
@ -391,7 +388,7 @@ if __name__ == "__main__":
|
|||
tdDnodes.deploy(1,updateCfgDict)
|
||||
tdDnodes.start(1)
|
||||
tdCases.logSql(logSql)
|
||||
if taosAdapter or restful or websocket:
|
||||
if restful or websocket:
|
||||
tAdapter.deploy(adapter_cfg_dict)
|
||||
tAdapter.start()
|
||||
|
||||
|
@ -431,7 +428,7 @@ if __name__ == "__main__":
|
|||
tdDnodes.starttaosd(dnode.index)
|
||||
tdCases.logSql(logSql)
|
||||
|
||||
if taosAdapter or restful or websocket:
|
||||
if restful or websocket:
|
||||
tAdapter.deploy(adapter_cfg_dict)
|
||||
tAdapter.start()
|
||||
|
||||
|
@ -553,7 +550,7 @@ if __name__ == "__main__":
|
|||
except:
|
||||
pass
|
||||
|
||||
if taosAdapter or restful or websocket:
|
||||
if restful or websocket:
|
||||
tAdapter.init(deployPath, masterIp)
|
||||
tAdapter.stop(force_kill=True)
|
||||
|
||||
|
@ -563,7 +560,7 @@ if __name__ == "__main__":
|
|||
tdDnodes.start(1)
|
||||
tdCases.logSql(logSql)
|
||||
|
||||
if taosAdapter or restful or websocket:
|
||||
if restful or websocket:
|
||||
tAdapter.deploy(adapter_cfg_dict)
|
||||
tAdapter.start()
|
||||
|
||||
|
@ -618,7 +615,7 @@ if __name__ == "__main__":
|
|||
tdDnodes.starttaosd(dnode.index)
|
||||
tdCases.logSql(logSql)
|
||||
|
||||
if taosAdapter or restful or websocket:
|
||||
if restful or websocket:
|
||||
tAdapter.deploy(adapter_cfg_dict)
|
||||
tAdapter.start()
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#define PUB_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
@ -72,10 +73,11 @@ int8_t getConnMode(char *arg);
|
|||
char* strToLowerCopy(const char *str);
|
||||
int32_t parseDsn(char* dsn, char **host, char **port, char **user, char **pwd, char* error);
|
||||
|
||||
int32_t setConnMode(int8_t connMode, char *dsn);
|
||||
int32_t setConnMode(int8_t connMode, char *dsn, bool show);
|
||||
|
||||
uint16_t defaultPort(int8_t connMode, char *dsn);
|
||||
|
||||
int8_t defaultMode(int8_t connMode, char *dsn);
|
||||
// working connect mode
|
||||
int8_t workingMode(int8_t connMode, char *dsn);
|
||||
|
||||
#endif // PUB_H_
|
|
@ -219,9 +219,6 @@ static int32_t shellParseSingleOpt(int32_t key, char *arg) {
|
|||
break;
|
||||
#if defined(LINUX)
|
||||
case 'o':
|
||||
printf(" -o need todo optins.\n");
|
||||
// need todo pass tsLogOutput to engine
|
||||
/*
|
||||
if (strlen(arg) >= PATH_MAX) {
|
||||
printf("failed to set log output since length overflow, max length is %d\r\n", PATH_MAX);
|
||||
return TSDB_CODE_INVALID_CFG;
|
||||
|
@ -235,7 +232,6 @@ static int32_t shellParseSingleOpt(int32_t key, char *arg) {
|
|||
printf("failed to expand log output: '%s' since %s\r\n", arg, tstrerror(terrno));
|
||||
return terrno;
|
||||
}
|
||||
*/
|
||||
break;
|
||||
#endif
|
||||
case 'E':
|
||||
|
|
|
@ -1355,17 +1355,22 @@ TAOS* createConnect(SShellArgs *pArgs) {
|
|||
}
|
||||
|
||||
// connect main
|
||||
TAOS * taos = NULL;
|
||||
if (pArgs->auth) {
|
||||
return taos_connect_auth(host, user, pArgs->auth, pArgs->database, port);
|
||||
taos = taos_connect_auth(host, user, pArgs->auth, pArgs->database, port);
|
||||
} else {
|
||||
return taos_connect(host, user, pwd, pArgs->database, port);
|
||||
taos = taos_connect(host, user, pwd, pArgs->database, port);
|
||||
}
|
||||
|
||||
// host user pointer in dsnc address
|
||||
free(dsnc);
|
||||
return taos;
|
||||
}
|
||||
|
||||
int32_t shellExecute(int argc, char *argv[]) {
|
||||
int32_t code = 0;
|
||||
printf(shell.info.clientVersion, shell.info.cusName,
|
||||
defaultMode(shell.args.connMode, shell.args.dsn) == CONN_MODE_NATIVE ? STR_NATIVE : STR_WEBSOCKET,
|
||||
workingMode(shell.args.connMode, shell.args.dsn) == CONN_MODE_NATIVE ? STR_NATIVE : STR_WEBSOCKET,
|
||||
taos_get_client_info(), shell.info.cusName);
|
||||
fflush(stdout);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ int main(int argc, char *argv[]) {
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (setConnMode(shell.args.connMode, shell.args.dsn)) {
|
||||
if (setConnMode(shell.args.connMode, shell.args.dsn, false)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
}
|
||||
|
||||
// set conn mode
|
||||
int32_t setConnMode(int8_t connMode, char *dsn) {
|
||||
int32_t setConnMode(int8_t connMode, char *dsn, bool show) {
|
||||
// check default
|
||||
if (connMode == CONN_MODE_INVALID) {
|
||||
if (dsn && dsn[0] != 0) {
|
||||
|
@ -109,11 +109,16 @@ int32_t setConnMode(int8_t connMode, char *dsn) {
|
|||
fprintf(stderr, "failed to load driver. since %s [0x%08X]\r\n", taos_errstr(NULL), taos_errno(NULL));
|
||||
return code;
|
||||
}
|
||||
|
||||
if (show) {
|
||||
fprintf(stdout, "\nConnect mode is : %s\n\n", strMode);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// default mode
|
||||
int8_t defaultMode(int8_t connMode, char *dsn) {
|
||||
int8_t workingMode(int8_t connMode, char *dsn) {
|
||||
int8_t mode = connMode;
|
||||
if (connMode == CONN_MODE_INVALID) {
|
||||
// no input from command line or config
|
||||
|
@ -129,10 +134,15 @@ int8_t defaultMode(int8_t connMode, char *dsn) {
|
|||
|
||||
// get default port
|
||||
uint16_t defaultPort(int8_t connMode, char *dsn) {
|
||||
// port 0 is default
|
||||
return 0;
|
||||
|
||||
/*
|
||||
// consistent with setConnMode
|
||||
int8_t mode = defaultMode(connMode, dsn);
|
||||
int8_t mode = workingMode(connMode, dsn);
|
||||
|
||||
// default port
|
||||
return mode == CONN_MODE_NATIVE ? DEFAULT_PORT_NATIVE : DEFAULT_PORT_WS_LOCAL;
|
||||
*/
|
||||
}
|
||||
|
|
@ -256,13 +256,13 @@ char* genPrepareSql(SSuperTable *stbInfo, char* tagData, uint64_t tableSeq, char
|
|||
"INSERT INTO ? USING `%s`.`%s` TAGS (%s) %s VALUES(?,%s)",
|
||||
db, stbInfo->stbName, tagQ, ttl, colQ);
|
||||
} else {
|
||||
if (g_arguments->connMode == CONN_MODE_NATIVE) {
|
||||
if (workingMode(g_arguments->connMode, g_arguments->dsn) == CONN_MODE_NATIVE) {
|
||||
// native
|
||||
n = snprintf(prepare + len, TSDB_MAX_ALLOWED_SQL_LEN - len,
|
||||
"INSERT INTO ? VALUES(?,%s)", colQ);
|
||||
} else {
|
||||
// websocket
|
||||
bool ntb = stbInfo->tags == NULL || stbInfo->tags->size == 0; // nomral table
|
||||
bool ntb = stbInfo->tags == NULL || stbInfo->tags->size == 0; // normal table
|
||||
colNames = genColNames(stbInfo->cols, !ntb);
|
||||
n = snprintf(prepare + len, TSDB_MAX_ALLOWED_SQL_LEN - len,
|
||||
"INSERT INTO `%s`.`%s`(%s) VALUES(%s,%s)", db, stbInfo->stbName, colNames,
|
||||
|
|
|
@ -168,7 +168,7 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
// conn mode
|
||||
if (setConnMode(g_arguments->connMode, g_arguments->dsn) != 0) {
|
||||
if (setConnMode(g_arguments->connMode, g_arguments->dsn, true) != 0) {
|
||||
exitLog();
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ static struct argp_option options[] = {
|
|||
{"inspect", 'I', 0, 0,
|
||||
"inspect avro file content and print on screen", 10},
|
||||
{"no-escape", 'n', 0, 0, "No escape char '`'. Default is using it.", 10},
|
||||
{"restful", 'R', 0, 0, "Use RESTful interface to connect server", 11},
|
||||
{"cloud", 'C', "CLOUD_DSN", 0, OLD_DSN_DESC, 11},
|
||||
{"timeout", 't', "SECONDS", 0, "The timeout seconds for "
|
||||
"websocket to interact."},
|
||||
|
@ -691,7 +692,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
|||
}
|
||||
g_args.thread_num = atoi((const char *)arg);
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
warnPrint("%s\n", "'-R' is not supported, ignore this options.");
|
||||
break;
|
||||
case 'C':
|
||||
case 'X':
|
||||
if (arg) {
|
||||
|
@ -10910,7 +10913,7 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
// conn mode
|
||||
if (setConnMode(g_args.connMode, g_args.dsn) != 0) {
|
||||
if (setConnMode(g_args.connMode, g_args.dsn, true) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue