diff --git a/.travis.yml b/.travis.yml index 6e49709c85e9d26d89cd7d7ab8ec8fa78297ef96..eb69370418a9c83c7b8bfe5daa1d6ead19150243 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,8 @@ matrix: - python3-setuptools - valgrind - psmisc + - unixodbc + - unixodbc-dev before_script: - export TZ=Asia/Harbin @@ -54,6 +56,7 @@ matrix: py3ver=`python3 --version|awk '{print $2}'|cut -d "." -f 1,2` && apt install python$py3ver-dev pip3 install psutil + pip3 install guppy3 pip3 install --user ${TRAVIS_BUILD_DIR}/src/connector/python/linux/python3/ cd ${TRAVIS_BUILD_DIR}/tests diff --git a/Jenkinsfile b/Jenkinsfile index 53798c8db90f96c92744cca3f1de6969e7fae6bb..08b6121f12916a8be712dbc4585f167d4dc679f0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,70 +1,143 @@ pipeline { - agent any - stages { - stage('build TDengine') { - steps { - sh '''cd ${WORKSPACE} -export TZ=Asia/Harbin -date -rm -rf ${WORKSPACE}/debug -mkdir debug -cd debug -cmake .. > /dev/null -make > /dev/null -cd ${WORKSPACE}/debug''' - } - } + agent none + environment{ + WK = '/var/lib/jenkins/workspace/TDinternal' + WKC= '/var/lib/jenkins/workspace/TDinternal/community' + } - stage('test_tsim') { + stages { + stage('Parallel test stage') { parallel { - stage('test') { + stage('pytest') { + agent{label 'master'} steps { - sh '''cd ${WORKSPACE}/tests -#./test-all.sh smoke -sudo ./test-all.sh full''' + sh ''' + date + cd ${WKC} + git checkout develop + git pull + git submodule update + cd ${WK} + git checkout develop + git pull + export TZ=Asia/Harbin + date + rm -rf ${WK}/debug + mkdir debug + cd debug + cmake .. > /dev/null + make > /dev/null + cd ${WKC}/tests + #./test-all.sh smoke + ./test-all.sh pytest + date''' + } + } + stage('test_b1') { + agent{label '184'} + steps { + sh ''' + cd ${WKC} + git checkout develop + git pull + + git submodule update + cd ${WK} + git checkout develop + git pull + export TZ=Asia/Harbin + date + rm -rf ${WK}/debug + mkdir debug + cd debug + cmake .. > /dev/null + make > /dev/null + cd ${WKC}/tests + #./test-all.sh smoke + ./test-all.sh b1 + date''' } } stage('test_crash_gen') { + agent{label "185"} steps { - sh '''cd ${WORKSPACE}/tests/pytest -sudo ./crash_gen.sh -a -p -t 4 -s 2000''' + sh ''' + cd ${WKC} + git checkout develop + git pull + + git submodule update + cd ${WK} + git checkout develop + git pull + export TZ=Asia/Harbin + + rm -rf ${WK}/debug + mkdir debug + cd debug + cmake .. > /dev/null + make > /dev/null + cd ${WKC}/tests/pytest + ./crash_gen.sh -a -p -t 4 -s 2000 + date + cd ${WKC}/tests + ./test-all.sh b2 + date + ''' } } stage('test_valgrind') { - steps { - sh '''cd ${WORKSPACE}/tests/pytest -sudo ./valgrind-test.sh 2>&1 > mem-error-out.log -grep \'start to execute\\|ERROR SUMMARY\' mem-error-out.log|grep -v \'grep\'|uniq|tee uniq-mem-error-out.log + agent{label "186"} -for memError in `grep \'ERROR SUMMARY\' uniq-mem-error-out.log | awk \'{print $4}\'` -do - if [ -n "$memError" ]; then - if [ "$memError" -gt 12 ]; then - echo -e "${RED} ## Memory errors number valgrind reports is $memError.\\ - More than our threshold! ## ${NC}" - travis_terminate $memError - fi - fi -done - -grep \'start to execute\\|definitely lost:\' mem-error-out.log|grep -v \'grep\'|uniq|tee uniq-definitely-lost-out.log -for defiMemError in `grep \'definitely lost:\' uniq-definitely-lost-out.log | awk \'{print $7}\'` -do - if [ -n "$defiMemError" ]; then - if [ "$defiMemError" -gt 13 ]; then - echo -e "${RED} ## Memory errors number valgrind reports \\ - Definitely lost is $defiMemError. More than our threshold! ## ${NC}" - travis_terminate $defiMemError - fi - fi -done''' + steps { + sh ''' + cd ${WKC} + git checkout develop + git pull + + git submodule update + cd ${WK} + git checkout develop + git pull + export TZ=Asia/Harbin + date + rm -rf ${WK}/debug + mkdir debug + cd debug + cmake .. > /dev/null + make > /dev/null + cd ${WKC}/tests/pytest + ./valgrind-test.sh 2>&1 > mem-error-out.log + ./handle_val_log.sh + + date + cd ${WKC}/tests + ./test-all.sh b3 + date''' } } + stage('connector'){ + agent{label "release"} + steps{ + sh''' + cd ${WORKSPACE} + git checkout develop + cd tests/gotest + bash batchtest.sh + cd ${WORKSPACE}/tests/examples/JDBC/JDBCDemo/ + mvn clean package assembly:single >/dev/null + java -jar target/jdbcChecker-SNAPSHOT-jar-with-dependencies.jar -host 127.0.0.1 + cd ${WORKSPACE}/tests/examples/python/PYTHONConnectorChecker + python3 PythonChecker.py + ''' + } + } } } } + } \ No newline at end of file diff --git a/cmake/env.inc b/cmake/env.inc index 67b934119d0e2de95c2ec60741cc4b78b7dbb267..18a6fea51d7ab4c6a4068efafc478360737df9be 100755 --- a/cmake/env.inc +++ b/cmake/env.inc @@ -45,7 +45,7 @@ IF (${CMAKE_BUILD_TYPE} MATCHES "Debug") ELSEIF (${CMAKE_BUILD_TYPE} MATCHES "Release") MESSAGE(STATUS "Build Release Version") ELSE () - IF (TD_WINDOWS_64) + IF (TD_WINDOWS) SET(CMAKE_BUILD_TYPE "Release") MESSAGE(STATUS "Build Release Version in Windows as default") ELSE () diff --git a/cmake/install.inc b/cmake/install.inc index f5e01e2f1d79f1c2e7fa32552cbe93677de6338d..dfca758b9362c96bec0ce45aa385d54a4e75a9e5 100755 --- a/cmake/install.inc +++ b/cmake/install.inc @@ -16,6 +16,7 @@ ELSEIF (TD_WINDOWS) INSTALL(DIRECTORY ${TD_COMMUNITY_DIR}/tests/examples DESTINATION .) INSTALL(DIRECTORY ${TD_COMMUNITY_DIR}/packaging/cfg DESTINATION .) INSTALL(FILES ${TD_COMMUNITY_DIR}/src/inc/taos.h DESTINATION include) + INSTALL(FILES ${TD_COMMUNITY_DIR}/src/inc/taoserror.h DESTINATION include) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos.lib DESTINATION driver) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos.exp DESTINATION driver) INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos.dll DESTINATION driver) @@ -30,7 +31,7 @@ ELSEIF (TD_WINDOWS) #INSTALL(TARGETS taos RUNTIME DESTINATION driver) #INSTALL(TARGETS shell RUNTIME DESTINATION .) IF (TD_MVN_INSTALLED) - INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.0-dist.jar DESTINATION connector/jdbc) + INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/taos-jdbcdriver-2.0.8-dist.jar DESTINATION connector/jdbc) ENDIF () ELSEIF (TD_DARWIN) SET(TD_MAKE_INSTALL_SH "${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh") diff --git a/cmake/version.inc b/cmake/version.inc index ce2b960eeabc2de65d9abb14dd41d25f95c5d26b..a248f76f48ede5f1f483943c08fce6604756b6d4 100644 --- a/cmake/version.inc +++ b/cmake/version.inc @@ -4,7 +4,7 @@ PROJECT(TDengine) IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "2.0.5.1") + SET(TD_VER_NUMBER "2.0.6.0") ENDIF () IF (DEFINED VERCOMPATIBLE) diff --git a/deps/zlib-1.2.11/inc/zconf.h b/deps/zlib-1.2.11/inc/zconf.h index 9b83d3a898662f8802154e4bd600cc2dde545756..b056fc5cf45fc34818827449b649ca48f62b216b 100644 --- a/deps/zlib-1.2.11/inc/zconf.h +++ b/deps/zlib-1.2.11/inc/zconf.h @@ -472,7 +472,7 @@ typedef uint64_t z_crc_t; #endif #ifndef Z_SOLO #if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -#if (_WIN64) +#if defined(_WIN64) || defined(_WIN32) #include #include #else diff --git a/deps/zlib-1.2.11/src/zconf.h b/deps/zlib-1.2.11/src/zconf.h index 361c098281905400d304372852df52989d51f463..937d2b70ca7c303bae39f938d09b193d335b06e0 100644 --- a/deps/zlib-1.2.11/src/zconf.h +++ b/deps/zlib-1.2.11/src/zconf.h @@ -472,7 +472,7 @@ typedef uLong FAR uLongf; #endif #ifndef Z_SOLO # if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -#if (_WIN64) +#if defined(_WIN64) || defined(_WIN32) #include #include #else diff --git a/documentation/tdenginedocs-cn/advanced-features/index.html b/documentation/tdenginedocs-cn/advanced-features/index.html index 9a1b908cd5bae690f747c27e46416e12e110480e..b4953b4dd482341ce937f56b806b682ff7145409 100644 --- a/documentation/tdenginedocs-cn/advanced-features/index.html +++ b/documentation/tdenginedocs-cn/advanced-features/index.html @@ -51,8 +51,8 @@ INTERVAL(1M)
  • mseconds:查询数据库更新的时间间隔,单位为毫秒。一般设置为1000毫秒。返回值为指向TDengine_SUB 结构的指针,如果返回为空,表示失败。

  • TAOS_ROW taos_consume(TAOS_SUB *tsub)

    该函数用来获取订阅的结果,用户应用程序将其置于一个无限循环语句。如果数据库有新记录到达,该API将返回该最新的记录。如果没有新的记录,该API将阻塞。如果返回值为空,说明系统出错。参数说明:

    • tsub:taos_subscribe的结构体指针。

  • void taos_unsubscribe(TAOS_SUB *tsub)

    取消订阅。应用程序退出时,务必调用该函数以避免资源泄露。

  • -
  • int taos_num_subfields(TAOS_SUB *tsub)

    获取返回的一行记录中数据包含多少列。

  • -
  • TAOS_FIELD *taos_fetch_subfields(TAOS_SUB *tsub)

    获取每列数据的属性(数据类型、名字、长度),与taos_num_subfileds配合使用,可解析返回的每行数据。

  • +
  • int taos_num_fields(TAOS_SUB *tsub)

    获取返回的一行记录中数据包含多少列。

  • +
  • TAOS_FIELD *taos_fetch_fields(TAOS_SUB *tsub)

    获取每列数据的属性(数据类型、名字、长度),与taos_num_subfileds配合使用,可解析返回的每行数据。

  • 示例代码:请看安装包中的的示范程序

    缓存 (Cache)

    TDengine采用时间驱动缓存管理策略(First-In-First-Out,FIFO),又称为写驱动的缓存管理机制。这种策略有别于读驱动的数据缓存模式(Least-Recent-Use,LRU),直接将最近写入的数据保存在系统的缓存中。当缓存达到临界值的时候,将最早的数据批量写入磁盘。一般意义上来说,对于物联网数据的使用,用户最为关心最近产生的数据,即当前状态。TDengine充分利用了这一特性,将最近到达的(当前状态)数据保存在缓存中。

    diff --git a/documentation/tdenginedocs-cn/connector/index.html b/documentation/tdenginedocs-cn/connector/index.html index 3167c1521f099f8acd7ae237cc37bd5867ee209a..34ea19813fbd7a9f70074ff109308b37ba7b647a 100644 --- a/documentation/tdenginedocs-cn/connector/index.html +++ b/documentation/tdenginedocs-cn/connector/index.html @@ -64,9 +64,9 @@

    该API用来获取最新消息,应用程序一般会将其置于一个无限循环语句中。其中参数tsub是taos_subscribe的返回值。如果数据库有新的记录,该API将返回,返回参数是一行记录。如果没有新的记录,该API将阻塞。如果返回值为空,说明系统出错,需要检查系统是否还在正常运行。

  • void taos_unsubscribe(TAOS_SUB *tsub)

    该API用于取消订阅,参数tsub是taos_subscribe的返回值。应用程序退出时,需要调用该API,否则有资源泄露。

  • -
  • int taos_num_subfields(TAOS_SUB *tsub)

    +
  • int taos_num_fields(TAOS_SUB *tsub)

    该API用来获取返回的一排数据中数据的列数

  • -
  • TAOS_FIELD *taos_fetch_subfields(TAOS_RES *res)

    +
  • TAOS_FIELD *taos_fetch_fields(TAOS_RES *res)

    该API用来获取每列数据的属性(数据类型、名字、字节数),与taos_num_subfileds配合使用,可用来解析返回的一排数据。

  • Java Connector

    @@ -259,4 +259,4 @@ conn.close() _ "taosSql" )

    taosSql驱动包内采用cgo模式,调用了TDengine的C/C++同步接口,与TDengine进行交互,因此,在数据库操作执行完成之前,客户端应用将处于阻塞状态。单个数据库连接,在同一时刻只能有一个线程调用API。客户应用可以建立多个连接,进行多线程的数据写入或查询处理。

    -

    更多使用的细节,请参考下载目录中的示例源码。

    回去 \ No newline at end of file +

    更多使用的细节,请参考下载目录中的示例源码。

    回去 diff --git a/documentation/tdenginedocs-en/connector/index.html b/documentation/tdenginedocs-en/connector/index.html index 0f9e6b4717c1c32716046a38bef18268cc2e0408..ea1f75ae00300a84560b93156853152ac8f77398 100644 --- a/documentation/tdenginedocs-en/connector/index.html +++ b/documentation/tdenginedocs-en/connector/index.html @@ -72,9 +72,9 @@ The API is used to start a subscription session by given a handle. The parameter The API used to get the new data from a TDengine server. It should be put in an infinite loop. The parameter tsub is the handle returned by taos_subscribe. If new data are updated, the API will return a row of the result. Otherwise, the API is blocked until new data arrives. If NULL pointer is returned, it means an error occurs.

  • void taos_unsubscribe(TAOS_SUB *tsub) Stop a subscription session by the handle returned by taos_subscribe.

  • -
  • int taos_num_subfields(TAOS_SUB *tsub) +

  • int taos_num_fields(TAOS_SUB *tsub) The API used to get the number of fields in a row.

  • -
  • TAOS_FIELD *taos_fetch_subfields(TAOS_RES *res) +

  • TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) The API used to get the description of each column.

  • Java Connector

    @@ -351,4 +351,4 @@ promise2.then(function(result) { })

    Example

    An example of using the NodeJS connector to create a table with weather data and create and execute queries can be found here (The preferred method for using the connector)

    -

    An example of using the NodeJS connector to achieve the same things but without all the object wrappers that wrap around the data returned to achieve higher functionality can be found here

    Back \ No newline at end of file +

    An example of using the NodeJS connector to achieve the same things but without all the object wrappers that wrap around the data returned to achieve higher functionality can be found here

    Back diff --git a/documentation20/webdocs/markdowndocs/Evaluation-ch.md b/documentation20/webdocs/markdowndocs/Evaluation-ch.md index 7d09d0dd33a332d4b74dd16bd64cb4e9503fd07d..9e7e0ec6aa8b60bfa9dbe603a45a265a1d1eba00 100644 --- a/documentation20/webdocs/markdowndocs/Evaluation-ch.md +++ b/documentation20/webdocs/markdowndocs/Evaluation-ch.md @@ -11,7 +11,7 @@ TDengine的模块之一是时序数据库。但除此之外,为减少研发的 * __全栈时序数据处理引擎__:将数据库、消息队列、缓存、流式计算等功能融为一体,应用无需再集成Kafka/Redis/HBase/Spark/HDFS等软件,大幅降低应用开发和维护的复杂度成本。 * __强大的分析功能__:无论是十年前还是一秒钟前的数据,指定时间范围即可查询。数据可在时间轴上或多个设备上进行聚合。即席查询可通过Shell, Python, R, Matlab随时进行。 * __与第三方工具无缝连接__:不用一行代码,即可与Telegraf, Grafana, EMQ, Prometheus, Matlab, R等集成。后续将支持OPC, Hadoop, Spark等, BI工具也将无缝连接。 -* __零运维成本、零学习成本__:安装、集群一秒搞定,无需分库分表,实时备份。标准SQL,支持JDBC, RESTful, 支持Python/Java/C/C++/Go, 与MySQL相似,零学习成本。 +* __零运维成本、零学习成本__:安装集群简单快捷,无需分库分表,实时备份。类似标准SQL,支持RESTful, 支持Python/Java/C/C++/C#/Go/Node.js, 与MySQL相似,零学习成本。 采用TDengine,可将典型的物联网、车联网、工业互联网大数据平台的总拥有成本大幅降低。但需要指出的是,因充分利用了物联网时序数据的特点,它无法用来处理网络爬虫、微博、微信、电商、ERP、CRM等通用型数据。 diff --git a/documentation20/webdocs/markdowndocs/Getting Started-ch.md b/documentation20/webdocs/markdowndocs/Getting Started-ch.md index 0e751d8cd59603ddaf85330b0fe309f4373e5c09..beb0c639ae7f5d6b5535b194f70d806305208492 100644 --- a/documentation20/webdocs/markdowndocs/Getting Started-ch.md +++ b/documentation20/webdocs/markdowndocs/Getting Started-ch.md @@ -30,13 +30,13 @@ TDengine软件分为服务器、客户端和报警模块三部分,目前2.0版 - TDengine-alert-2.0.0-Linux-x64.tar.gz (8.1M) -目前,TDengine只支持在使用[`systemd`](https://en.wikipedia.org/wiki/Systemd)做进程服务管理的linux系统上安装。其他linux系统的支持正在开发中。用`which`命令来检测系统中是否存在`systemd`: +目前,TDengine只支持在使用[`systemd`](https://en.wikipedia.org/wiki/Systemd)做进程服务管理的linux系统上安装。其他linux系统的支持正在开发中。用`which systemctl`命令来检测系统中是否存在`systemd`包: ```cmd -which systemd +which systemctl ``` -如果系统中不存在`systemd`命令,请考虑[通过源码安装](#通过源码安装)TDengine。 +如果系统中不存在`systemd`包,请考虑[通过源码安装](#通过源码安装)TDengine。 具体的安装过程,请参见TDengine多种安装包的安装和卸载。 diff --git a/documentation20/webdocs/markdowndocs/Getting Started.md b/documentation20/webdocs/markdowndocs/Getting Started.md index 00d97d3d9cd3d2ce8317938eb9e46ae74b48dab1..4d34cb49f4a84ac6c9d63e47bc8230c150b9013e 100644 --- a/documentation20/webdocs/markdowndocs/Getting Started.md +++ b/documentation20/webdocs/markdowndocs/Getting Started.md @@ -16,13 +16,13 @@ Three different packages are provided, please pick up the one you like.
  • TDengine DEB package (1.7M)
  • TDengine Tarball (3.0M)
  • -For the time being, TDengine only supports installation on Linux systems using [`systemd`](https://en.wikipedia.org/wiki/Systemd) as the service manager. To check if your system has *systemd*, use the _which_ command. +For the time being, TDengine only supports installation on Linux systems using [`systemd`](https://en.wikipedia.org/wiki/Systemd) as the service manager. To check if your system has *systemd* package, use the _which systemctl_ command. ```cmd -which systemd +which systemctl ``` -If the `systemd` command is not found, please [install from source code](#Install-from-Source). +If the `systemd` package is not found, please [install from source code](#Install-from-Source). ### Running TDengine diff --git a/documentation20/webdocs/markdowndocs/Queries-ch.md b/documentation20/webdocs/markdowndocs/Queries-ch.md index 1394338f5420d9b2e2dbc2206879ac36a5c52cf8..960bb39e6323fe590905de62d2a1021adb19d176 100644 --- a/documentation20/webdocs/markdowndocs/Queries-ch.md +++ b/documentation20/webdocs/markdowndocs/Queries-ch.md @@ -29,23 +29,9 @@ Query OK, 2 row(s) in set (0.001100s) 具体的查询语法请看TAOS SQL 。 ## 多表聚合查询 +物联网场景中,往往同一个类型的数据采集点有多个。TDengine采用超级表(STable)的概念来描述某一个类型的数据采集点,一张普通的表来描述一个具体的数据采集点。同时TDengine使用标签来描述数据采集点的静态属性,一个具体的数据采集点有具体的标签值。通过指定标签的过滤条件,TDengine提供了一高效的方法将超级表(某一类型的数据采集点)所属的子表进行聚合查询。对普通表的聚合函数以及绝大部分操作都适用于超级表,语法完全一样。 -TDengine对每个数据采集点单独建表,但在实际应用中经常需要对不同的采集点数据进行聚合。为高效的进行聚合操作,TDengine引入超级表(STable)的概念。超级表用来代表一特定类型的数据采集点,它是包含多张表的表集合,集合里每张表的模式(schema)完全一致,但每张表都带有自己的静态标签,标签可以多个,可以随时增加、删除和修改。 - -应用可通过指定标签的过滤条件,对一个STable下的全部或部分表进行聚合或统计操作,这样大大简化应用的开发。其具体流程如下图所示: - -
    - -
    多表聚合查询原理图
    - -1:应用将一个查询条件发往系统;2: taosc将超级表的名字发往 Meta Node(管理节点);3:管理节点将超级表所拥有的 vnode 列表发回 taosc;4:taosc将计算的请求连同标签过滤条件发往这些vnode对应的多个数据节点;5:每个vnode先在内存里查找出自己节点里符合标签过滤条件的表的集合,然后扫描存储的时序数据,完成相应的聚合计算,将结果返回给taosc;6:taosc将多个数据节点返回的结果做最后的聚合,将其返回给应用。 - -由于TDengine在vnode内将标签数据与时序数据分离存储,通过先在内存里过滤标签数据,将需要扫描的数据集大幅减少,大幅提升聚合计算速度。同时,由于数据分布在多个vnode/dnode,聚合计算操作在多个vnode里并发进行,又进一步提升了聚合的速度。 - -对普通表的聚合函数以及绝大部分操作都适用于超级表,语法完全一样,细节请看 TAOS SQL。 - -比如:在TAOS Shell,查找所有智能电表采集的电压平均值,并按照location分组 - +**示例1**:在TAOS Shell,查找北京所有智能电表采集的电压平均值,并按照location分组 ```mysql taos> SELECT AVG(voltage) FROM meters GROUP BY location; avg(voltage) | location | @@ -55,6 +41,18 @@ taos> SELECT AVG(voltage) FROM meters GROUP BY location; Query OK, 2 row(s) in set (0.002136s) ``` +**示例2**:在TAOS shell, 查找groupId为2的所有智能电表过去24小时的记录条数,电流的最大值 + +```mysql +taos> SELECT count(*), max(current) FROM meters where groupId = 2 and ts > now - 24h; + cunt(*) | max(current) | +================================== + 5 | 13.4 | +Query OK, 1 row(s) in set (0.002136s) +``` + +TDengine仅容许对属于同一个超级表的表之间进行聚合查询,不同超级表之间的聚合查询不支持。在TAOS SQL 一章,查询类操作都会注明是否支持超级表。 + ## 降采样查询、插值 物联网场景里,经常需要通过降采样(down sampling)将采集的数据按时间段进行聚合。TDengine 提供了一个简便的关键词 interval 让按照时间窗口的查询操作变得极为简单。比如,将智能电表 d1001 采集的电流值每10秒钟求和 @@ -66,9 +64,9 @@ taos> SELECT sum(current) FROM d1001 INTERVAL(10s); 2018-10-03 14:38:10.000 | 24.900000572 | Query OK, 2 row(s) in set (0.000883s) ``` -降采样操作也适用于超级表,比如:将所有智能电表采集的电流值每秒钟求和 +降采样操作也适用于超级表,比如:将北京所有智能电表采集的电流值每秒钟求和 ```mysql -taos> SELECT SUM(current) FROM meters INTERVAL(1s); +taos> SELECT SUM(current) FROM meters where location like "Beijing%" INTERVAL(1s); ts | sum(current) | ====================================================== 2018-10-03 14:38:04.000 | 10.199999809 | diff --git a/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md b/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md index 66d17c6aa686a7ed07ff1b865000f7b4a43f3834..4082d72f112e8ff62d2e8b2c8b15391dd6f39d8a 100644 --- a/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md +++ b/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md @@ -124,7 +124,8 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic 说明: 1) 表的第一个字段必须是TIMESTAMP,并且系统自动将其设为主键; 2) 表名最大长度为193; - 3) 表的每行长度不能超过16k个字符; + 3) 表的每行长度不能超过16k个字符; + 4) 子表名只能由字母、数字和下划线组成,且不能以数字开头 5) 使用数据类型binary或nchar,需指定其最长的字节数,如binary(20),表示20字节; - **删除数据表** diff --git a/documentation20/webdocs/markdowndocs/administrator-ch.md b/documentation20/webdocs/markdowndocs/administrator-ch.md index cc1beb10423ec4f09ce92d90daf3a8a76d8e8a8a..4b274e05e6e392879fc887ec1137968270a8e4b8 100644 --- a/documentation20/webdocs/markdowndocs/administrator-ch.md +++ b/documentation20/webdocs/markdowndocs/administrator-ch.md @@ -82,8 +82,7 @@ TDengine系统后台服务由taosd提供,可以在配置文件taos.cfg里修 下面仅仅列出一些重要的配置参数,更多的参数请看配置文件里的说明。各个参数的详细介绍及作用请看前述章节,而且这些参数的缺省配置都是工作的,一般无需设置。**注意:配置修改后,需要重启*taosd*服务才能生效。** -- firstEp: taosd启动时,主动连接的集群中第一个dnode的end point, 默认值为localhost:6030。 -- secondEp: taosd启动时,如果first连接不上,尝试连接集群中第二个dnode的end point, 默认值为空。 +- firstEp: taosd启动时,主动连接的集群中首个dnode的end point, 默认值为localhost:6030。 - fqdn:数据节点的FQDN,缺省为操作系统配置的第一个hostname。如果习惯IP地址访问,可设置为该节点的IP地址。 - serverPort:taosd启动后,对外服务的端口号,默认值为6030。 - httpPort: RESTful服务使用的端口号,所有的HTTP请求(TCP)都需要向该接口发起查询/写入请求, 默认值为6041。 @@ -156,76 +155,80 @@ TDengine系统的前台交互客户端应用程序为taos,它与taosd共享同 客户端配置参数 - firstEp: taos启动时,主动连接的集群中第一个taosd实例的end point, 缺省值为 localhost:6030。 -- secondEp: taos启动时,如果first连接不上,尝试连接集群中第二个taosd实例的end point, 缺省值为空。 - locale - > 默认值:系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置 + 默认值:系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置 -TDengine为存储中文、日文、韩文等非ASCII编码的宽字符,提供一种专门的字段类型nchar。写入nchar字段的数据将统一采用UCS4-LE格式进行编码并发送到服务器。需要注意的是,编码正确性是客户端来保证。因此,如果用户想要正常使用nchar字段来存储诸如中文、日文、韩文等非ASCII字符,需要正确设置客户端的编码格式。 + TDengine为存储中文、日文、韩文等非ASCII编码的宽字符,提供一种专门的字段类型nchar。写入nchar字段的数据将统一采用UCS4-LE格式进行编码并发送到服务器。需要注意的是,编码正确性是客户端来保证。因此,如果用户想要正常使用nchar字段来存储诸如中文、日文、韩文等非ASCII字符,需要正确设置客户端的编码格式。 -客户端的输入的字符均采用操作系统当前默认的编码格式,在Linux系统上多为UTF-8,部分中文系统编码则可能是GB18030或GBK等。在docker环境中默认的编码是POSIX。在中文版Windows系统中,编码则是CP936。客户端需要确保正确设置自己所使用的字符集,即客户端运行的操作系统当前编码字符集,才能保证nchar中的数据正确转换为UCS4-LE编码格式。 + 客户端的输入的字符均采用操作系统当前默认的编码格式,在Linux系统上多为UTF-8,部分中文系统编码则可能是GB18030或GBK等。在docker环境中默认的编码是POSIX。在中文版Windows系统中,编码则是CP936。客户端需要确保正确设置自己所使用的字符集,即客户端运行的操作系统当前编码字符集,才能保证nchar中的数据正确转换为UCS4-LE编码格式。 -在 Linux 中 locale 的命名规则为: <语言>_<地区>.<字符集编码> 如:zh_CN.UTF-8,zh代表中文,CN代表大陆地区,UTF-8表示字符集。字符集编码为客户端正确解析本地字符串提供编码转换的说明。Linux系统与 Mac OSX 系统可以通过设置locale来确定系统的字符编码,由于Windows使用的locale中不是POSIX标准的locale格式,因此在Windows下需要采用另一个配置参数charset来指定字符编码。在Linux 系统中也可以使用charset来指定字符编码。 + 在 Linux 中 locale 的命名规则为: <语言>_<地区>.<字符集编码> 如:zh_CN.UTF-8,zh代表中文,CN代表大陆地区,UTF-8表示字符集。字符集编码为客户端正确解析本地字符串提供编码转换的说明。Linux系统与 Mac OSX 系统可以通过设置locale来确定系统的字符编码,由于Windows使用的locale中不是POSIX标准的locale格式,因此在Windows下需要采用另一个配置参数charset来指定字符编码。在Linux 系统中也可以使用charset来指定字符编码。 - charset - > 默认值:系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置 + 默认值:系统中动态获取,如果自动获取失败,需要用户在配置文件设置或通过API设置 -如果配置文件中不设置charset,在Linux系统中,taos在启动时候,自动读取系统当前的locale信息,并从locale信息中解析提取charset编码格式。如果自动读取locale信息失败,则尝试读取charset配置,如果读取charset配置也失败,则中断启动过程。 + 如果配置文件中不设置charset,在Linux系统中,taos在启动时候,自动读取系统当前的locale信息,并从locale信息中解析提取charset编码格式。如果自动读取locale信息失败,则尝试读取charset配置,如果读取charset配置也失败,则中断启动过程。 -在Linux系统中,locale信息包含了字符编码信息,因此正确设置了Linux系统locale以后可以不用再单独设置charset。例如: -``` + 在Linux系统中,locale信息包含了字符编码信息,因此正确设置了Linux系统locale以后可以不用再单独设置charset。例如: + ``` locale zh_CN.UTF-8 -``` -在Windows系统中,无法从locale获取系统当前编码。如果无法从配置文件中读取字符串编码信息,taos默认设置为字符编码为CP936。其等效在配置文件中添加如下配置: -``` + ``` + 在Windows系统中,无法从locale获取系统当前编码。如果无法从配置文件中读取字符串编码信息,taos默认设置为字符编码为CP936。其等效在配置文件中添加如下配置: + ``` charset CP936 -``` -如果需要调整字符编码,请查阅当前操作系统使用的编码,并在配置文件中正确设置。 + ``` + 如果需要调整字符编码,请查阅当前操作系统使用的编码,并在配置文件中正确设置。 -在Linux系统中,如果用户同时设置了locale和字符集编码charset,并且locale和charset的不一致,后设置的值将覆盖前面设置的值。 -``` + 在Linux系统中,如果用户同时设置了locale和字符集编码charset,并且locale和charset的不一致,后设置的值将覆盖前面设置的值。 + ``` locale zh_CN.UTF-8 charset GBK -``` -则charset的有效值是GBK。 -``` + ``` + 则charset的有效值是GBK。 + ``` charset GBK locale zh_CN.UTF-8 -``` -charset的有效值是UTF-8。 + ``` + charset的有效值是UTF-8。 -日志的配置参数,与server 的配置参数完全一样。 + 日志的配置参数,与server 的配置参数完全一样。 - timezone 默认值:从系统中动态获取当前的时区设置 -客户端运行系统所在的时区。为应对多时区的数据写入和查询问题,TDengine 采用 Unix 时间戳(Unix Timestamp)来记录和存储时间戳。Unix 时间戳的特点决定了任一时刻不论在任何时区,产生的时间戳均一致。需要注意的是,Unix时间戳是在客户端完成转换和记录。为了确保客户端其他形式的时间转换为正确的 Unix 时间戳,需要设置正确的时区。 + 客户端运行系统所在的时区。为应对多时区的数据写入和查询问题,TDengine 采用 Unix 时间戳(Unix Timestamp)来记录和存储时间戳。Unix 时间戳的特点决定了任一时刻不论在任何时区,产生的时间戳均一致。需要注意的是,Unix时间戳是在客户端完成转换和记录。为了确保客户端其他形式的时间转换为正确的 Unix 时间戳,需要设置正确的时区。 -在Linux系统中,客户端会自动读取系统设置的时区信息。用户也可以采用多种方式在配置文件设置时区。例如: -``` + 在Linux系统中,客户端会自动读取系统设置的时区信息。用户也可以采用多种方式在配置文件设置时区。例如: + ``` timezone UTC-8 timezone GMT-8 timezone Asia/Shanghai -``` -均是合法的设置东八区时区的格式。 + ``` + 均是合法的设置东八区时区的格式。 -时区的设置对于查询和写入SQL语句中非Unix时间戳的内容(时间戳字符串、关键词now的解析)产生影响。例如: -``` + 时区的设置对于查询和写入SQL语句中非Unix时间戳的内容(时间戳字符串、关键词now的解析)产生影响。例如: + ``` SELECT count(*) FROM table_name WHERE TS<'2019-04-11 12:01:08'; -``` -在东八区,SQL语句等效于 -``` + ``` + 在东八区,SQL语句等效于 + ``` SELECT count(*) FROM table_name WHERE TS<1554955268000; -``` -在UTC时区,SQL语句等效于 -``` + ``` + 在UTC时区,SQL语句等效于 + ``` SELECT count(*) FROM table_name WHERE TS<1554984068000; -``` -为了避免使用字符串时间格式带来的不确定性,也可以直接使用Unix时间戳。此外,还可以在SQL语句中使用带有时区的时间戳字符串,例如:RFC3339格式的时间戳字符串,2013-04-12T15:52:01.123+08:00或者ISO-8601格式时间戳字符串2013-04-12T15:52:01.123+0800。上述两个字符串转化为Unix时间戳不受系统所在时区的影响。 + ``` + 为了避免使用字符串时间格式带来的不确定性,也可以直接使用Unix时间戳。此外,还可以在SQL语句中使用带有时区的时间戳字符串,例如:RFC3339格式的时间戳字符串,2013-04-12T15:52:01.123+08:00或者ISO-8601格式时间戳字符串2013-04-12T15:52:01.123+0800。上述两个字符串转化为Unix时间戳不受系统所在时区的影响。 + + 启动taos时,也可以从命令行指定一个taosd实例的end point,否则就从taos.cfg读取。 + +- maxBinaryDisplayWidth -启动taos时,也可以从命令行指定一个taosd实例的end point,否则就从taos.cfg读取。 + Shell中binary 和 nchar字段的显示宽度上限,超过此限制的部分将被隐藏。默认值:30。可在 shell 中通过命令 set max_binary_display_width nn 动态修改此选项。 + ## 用户管理 @@ -378,7 +381,7 @@ KILL STREAM ; ## 系统监控 -TDengine启动后,会自动创建一个监测数据库SYS,并自动将服务器的CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度、慢查询等信息定时写入该数据库。TDengine还将重要的系统操作(比如登录、创建、删除数据库等)日志以及各种错误报警信息记录下来存放在SYS库里。系统管理员可以从CLI直接查看这个数据库,也可以在WEB通过图形化界面查看这些监测信息。 +TDengine启动后,会自动创建一个监测数据库log,并自动将服务器的CPU、内存、硬盘空间、带宽、请求数、磁盘读写速度、慢查询等信息定时写入该数据库。TDengine还将重要的系统操作(比如登录、创建、删除数据库等)日志以及各种错误报警信息记录下来存放在log库里。系统管理员可以从CLI直接查看这个数据库,也可以在WEB通过图形化界面查看这些监测信息。 这些监测信息的采集缺省是打开的,但可以修改配置文件里的选项enableMonitor将其关闭或打开。 @@ -408,5 +411,4 @@ TDengine的所有可执行文件默认存放在 _/usr/local/taos/bin_ 目录下 您可以通过修改系统配置文件taos.cfg来配置不同的数据目录和日志目录。 -## diff --git a/documentation20/webdocs/markdowndocs/architecture-ch.md b/documentation20/webdocs/markdowndocs/architecture-ch.md index c7f3eba9efa7ff34cafef9b52b32dec5b113da60..ba45bc4796e6f0fb544f7383f74528ee486d94e5 100644 --- a/documentation20/webdocs/markdowndocs/architecture-ch.md +++ b/documentation20/webdocs/markdowndocs/architecture-ch.md @@ -65,24 +65,24 @@ TDengine 的设计是基于单个硬件、软件系统不可靠,基于任何 TDengine 分布式架构的逻辑结构图如下:
    图 1 TDengine架构示意图
    -一个完整的 TDengine 系统是运行在一到多个物理节点上的,逻辑上,它包含数据节点(dnode)、TDengine客户端(taosc)以及应用(app)。系统中存在一到多个数据节点,这些数据节点组成一个集群(cluster)。应用通过taosc的API与TDengine集群进行互动。下面对每个逻辑单元进行简要介绍。 +一个完整的 TDengine 系统是运行在一到多个物理节点上的,逻辑上,它包含数据节点(dnode)、TDengine应用驱动(taosc)以及应用(app)。系统中存在一到多个数据节点,这些数据节点组成一个集群(cluster)。应用通过taosc的API与TDengine集群进行互动。下面对每个逻辑单元进行简要介绍。 -**物理节点(pnode):** pnode是一独立运行、拥有自己的计算、存储和网络能力的计算机,可以是安装有OS的物理机、虚拟机或容器。物理节点由其配置的 FQDN(Fully Qualified Domain Name)来标识。TDengine完全依赖FQDN来进行网络通讯,如果不了解FQDN,请看博文《[一篇文章说清楚TDengine的FQDN](https://www.taosdata.com/blog/2020/09/11/1824.html)》。 +**物理节点(pnode):** pnode是一独立运行、拥有自己的计算、存储和网络能力的计算机,可以是安装有OS的物理机、虚拟机或Docker容器。物理节点由其配置的 FQDN(Fully Qualified Domain Name)来标识。TDengine完全依赖FQDN来进行网络通讯,如果不了解FQDN,请看博文《[一篇文章说清楚TDengine的FQDN](https://www.taosdata.com/blog/2020/09/11/1824.html)》。 **数据节点(dnode):** dnode 是 TDengine 服务器侧执行代码 taosd 在物理节点上的一个运行实例,一个工作的系统必须有至少一个数据节点。dnode包含零到多个逻辑的虚拟节点(VNODE),零或者至多一个逻辑的管理节点(mnode)。dnode在系统中的唯一标识由实例的End Point (EP )决定。EP是dnode所在物理节点的FQDN (Fully Qualified Domain Name)和系统所配置的网络端口号(Port)的组合。通过配置不同的端口,一个物理节点(一台物理机、虚拟机或容器)可以运行多个实例,或有多个数据节点。 -**虚拟节点(vnode)**: 为更好的支持数据分片、负载均衡,防止数据过热或倾斜,数据节点被虚拟化成多个虚拟节点(vnode,图中V2, V3, V4等)。每个 vnode 都是一个相对独立的工作单元,是时序数据存储的基本单元,具有独立的运行线程、内存空间与持久化存储的路径。一个 vnode 包含一定数量的表(数据采集点)。当创建一张新表时,系统会检查是否需要创建新的 vnode。一个数据节点上能创建的 vnode 的数量取决于该数据节点所在物理节点的硬件资源。一个 vnode 只属于一个DB,但一个DB可以有多个 vnode。一个 vnode 除存储的时序数据外,也保存有所包含的表的SCHEMA、标签值等。一个虚拟节点由所属的数据节点的EP,以及所属的VGroup ID在系统内唯一标识,由管理节点创建并管理。 +**虚拟节点(vnode)**: 为更好的支持数据分片、负载均衡,防止数据过热或倾斜,数据节点被虚拟化成多个虚拟节点(vnode,图中V2, V3, V4等)。每个 vnode 都是一个相对独立的工作单元,是时序数据存储的基本单元,具有独立的运行线程、内存空间与持久化存储的路径。一个 vnode 包含一定数量的表(数据采集点)。当创建一张新表时,系统会检查是否需要创建新的 vnode。一个数据节点上能创建的 vnode 的数量取决于该数据节点所在物理节点的硬件资源。一个 vnode 只属于一个DB,但一个DB可以有多个 vnode。一个 vnode 除存储的时序数据外,也保存有所包含的表的schema、标签值等。一个虚拟节点由所属的数据节点的EP,以及所属的VGroup ID在系统内唯一标识,由管理节点创建并管理。 **管理节点(mnode):** 一个虚拟的逻辑单元,负责所有数据节点运行状态的监控和维护,以及节点之间的负载均衡(图中M)。同时,管理节点也负责元数据(包括用户、数据库、表、静态标签等)的存储和管理,因此也称为 Meta Node。TDengine 集群中可配置多个(最多不超过5个) mnode,它们自动构建成为一个虚拟管理节点组(图中M0, M1, M2)。mnode 间采用 master/slave 的机制进行管理,而且采取强一致方式进行数据同步, 任何数据更新操作只能在 Master 上进行。mnode 集群的创建由系统自动完成,无需人工干预。每个dnode上至多有一个mnode,由所属的数据节点的EP来唯一标识。每个dnode通过内部消息交互自动获取整个集群中所有 mnode 所在的 dnode 的EP。 **虚拟节点组(VGroup):** 不同数据节点上的 vnode 可以组成一个虚拟节点组(vnode group)来保证系统的高可靠。虚拟节点组内采取master/slave的方式进行管理。写操作只能在 master vnode 上进行,系统采用异步复制的方式将数据同步到 slave vnode,这样确保了一份数据在多个物理节点上有拷贝。一个 vgroup 里虚拟节点个数就是数据的副本数。如果一个DB的副本数为N,系统必须有至少N个数据节点。副本数在创建DB时通过参数 replica 可以指定,缺省为1。使用 TDengine 的多副本特性,可以不再需要昂贵的磁盘阵列等存储设备,就可以获得同样的数据高可靠性。虚拟节点组由管理节点创建、管理,并且由管理节点分配一个系统唯一的ID,VGroup ID。如果两个虚拟节点的vnode group ID相同,说明他们属于同一个组,数据互为备份。虚拟节点组里虚拟节点的个数是可以动态改变的,容许只有一个,也就是没有数据复制。VGroup ID是永远不变的,即使一个虚拟节点组被删除,它的ID也不会被收回重复利用。 -**TAOSC:** taosc是TDengine给应用提供的驱动程序(driver),负责处理应用与集群的接口交互,内嵌于JDBC、ODBC driver中,或者C、Python、Go语言连接库里。应用都是通过taosc而不是直接连接集群中的数据节点与整个集群进行交互的。这个模块负责获取并缓存元数据;将插入、查询等请求转发到正确的数据节点;在把结果返回给应用时,还需要负责最后一级的聚合、排序、过滤等操作。对于JDBC, ODBC, C/C++接口而言,这个模块是在应用所处的物理节点上运行,但消耗的资源很小。同时,为支持全分布式的RESTful接口,taosc在TDengine集群的每个dnode上都有一运行实例。 +**TAOSC:** taosc是TDengine给应用提供的驱动程序(driver),负责处理应用与集群的接口交互,提供C/C++语言原生接口,内嵌于JDBC、C#、Python、Go、Node.js语言连接库里。应用都是通过taosc而不是直接连接集群中的数据节点与整个集群进行交互的。这个模块负责获取并缓存元数据;将插入、查询等请求转发到正确的数据节点;在把结果返回给应用时,还需要负责最后一级的聚合、排序、过滤等操作。对于JDBC, C/C++/C#/Python/Go/Node.js接口而言,这个模块是在应用所处的物理节点上运行。同时,为支持全分布式的RESTful接口,taosc在TDengine集群的每个dnode上都有一运行实例。 ### 节点之间的通讯 -**通讯方式:**TDengine系统的各个节点之间的通讯是通过TCP/UDP进行的。因为考虑到物联网场景,数据写入的包一般不大,因此TDengine 除采用TCP做传输之外,还采用UDP方式,因为UDP 更加高效,而且不受连接数的限制。TDengine实现了自己的超时、重传、确认等机制,以确保UDP的可靠传输。对于数据量不到15K的数据包,采取UDP的方式进行传输,超过15K的,或者是查询类的操作,自动采取TCP的方式进行传输。同时,TDengine根据配置和数据包,会自动对数据进行压缩/解压缩,数字签名/认证等处理。对于数据节点之间的数据复制,只采用TCP方式进行数据传输。 +**通讯方式:**TDengine系统的各个数据节点之间,以及应用驱动与各数据节点之间的通讯是通过TCP/UDP进行的。因为考虑到物联网场景,数据写入的包一般不大,因此TDengine 除采用TCP做传输之外,还采用UDP方式,因为UDP 更加高效,而且不受连接数的限制。TDengine实现了自己的超时、重传、确认等机制,以确保UDP的可靠传输。对于数据量不到15K的数据包,采取UDP的方式进行传输,超过15K的,或者是查询类的操作,自动采取TCP的方式进行传输。同时,TDengine根据配置和数据包,会自动对数据进行压缩/解压缩,数字签名/认证等处理。对于数据节点之间的数据复制,只采用TCP方式进行数据传输。 -**FQDN配置**:一个数据节点有一个或多个FQDN,可以在系统配置文件taos.cfg通过参数“fqdn"进行指定,如果没有指定,系统将自动获取FQDN。如果节点没有配置FQDN,可以直接将该节点的配置参数fqdn设置为它的IP地址。但不建议使用IP,因为IP地址可变,一旦变化,将让集群无法正常工作。一个数据节点的EP(End Point)由FQDN + Port组成。采用FQDN,需要保证DNS服务正常工作,或者在节点以及应用所在的节点配置好hosts文件。 +**FQDN配置**:一个数据节点有一个或多个FQDN,可以在系统配置文件taos.cfg通过参数“fqdn"进行指定,如果没有指定,系统将自动获取计算机的hostname作为其FQDN。如果节点没有配置FQDN,可以直接将该节点的配置参数fqdn设置为它的IP地址。但不建议使用IP,因为IP地址可变,一旦变化,将让集群无法正常工作。一个数据节点的EP(End Point)由FQDN + Port组成。采用FQDN,需要保证DNS服务正常工作,或者在节点以及应用所在的节点配置好hosts文件。 **端口配置:**一个数据节点对外的端口由TDengine的系统配置参数serverPort决定,对集群内部通讯的端口是serverPort+5。集群内数据节点之间的数据复制操作还占有一个TCP端口,是serverPort+10. 为支持多线程高效的处理UDP数据,每个对内和对外的UDP连接,都需要占用5个连续的端口。因此一个数据节点总的端口范围为serverPort到serverPort + 10,总共11个TCP/UDP端口。使用时,需要确保防火墙将这些端口打开。每个数据节点可以配置不同的serverPort。 @@ -153,6 +153,7 @@ TDengine除vnode分片之外,还对时序数据按照时间段进行分区。 当新的数据节点被添加进集群,因为新的计算和存储被添加进来,系统也将自动启动负载均衡流程。 负载均衡过程无需任何人工干预,应用也无需重启,将自动连接新的节点,完全透明。 +**提示:负载均衡由参数balance控制,决定开启/关闭自动负载均衡。** ## 数据写入与复制流程 如果一个数据库有N个副本,那一个虚拟节点组就有N个虚拟节点,但是只有一个是Master,其他都是slave。当应用将新的记录写入系统时,只有Master vnode能接受写的请求。如果slave vnode收到写的请求,系统将通知taosc需要重新定向。 @@ -192,7 +193,8 @@ Master Vnode遵循下面的写入流程: 理论上,只要是异步复制,就无法保证100%不丢失。但是这个窗口极小,mater与slave要同时发生故障,而且发生在刚给应用确认写入成功之后。 -注:异地容灾、IDC无中断迁移,仅仅企业版支持 +注:异地容灾、IDC无中断迁移,仅仅企业版支持。 +**提示:该功能暂未提供** ### 主从选择 Vnode会保持一个数据版本号(Version),对内存数据进行持久化存储时,对该版本号也进行持久化存储。每个数据更新操作,无论是采集的时序数据还是元数据,这个版本号将增一。 @@ -259,6 +261,7 @@ dataDir /mnt/disk6/taos 2 挂载的盘也可以是非本地的网络盘,只要系统能访问即可。 注:多级存储功能仅企业版支持 +**提示:该功能暂未提供** ## 数据查询 TDengine提供了多种多样针对表和超级表的查询处理功能,除了常规的聚合查询之外,还提供针对时序数据的窗口查询、统计聚合等功能。TDengine的查询处理需要客户端、vnode, mnode节点协同完成。 @@ -289,11 +292,18 @@ select count(*) from d1001 interval(1h) fill(prev); 针对d1001设备采集数据统计每小时记录数,如果某一个小时不存在数据,这返回之前一个小时的统计数据。TDengine提供前向插值(prev)、线性插值(linear)、NULL值填充(NULL)、特定值填充(value)。 ### 多表聚合查询 -多表聚合查询与单表查询的整体流程相同,但是存在如下的差异: - -- 由于多表可能分布在不同的节点(dnode),因此多表的聚合查询需要首先获得表所在的全部数据节点的信息,并且同时向相关的dnode发出查询请求。 -- 每个vnode的计算获得的中间结果(partial results)需要进行第二阶段的聚合才能形成最终结果,第二阶段的聚合过程在客户端完成。 -- 由于表标签信息存储在vnode中,因此针对标签信息的查询也需要vnode完成。客户端将标签的过滤表达式封装在查询请求结构体中发送给vnode,由vnode的查询执行线程从中抽取出标签查询条件,然后执行查询。标签查询与过滤是在针对表的查询之前完成。标签查询完成以后,将符合条件的表纳入到接下来的查询处理流程中。 +TDengine对每个数据采集点单独建表,但在实际应用中经常需要对不同的采集点数据进行聚合。为高效的进行聚合操作,TDengine引入超级表(STable)的概念。超级表用来代表一特定类型的数据采集点,它是包含多张表的表集合,集合里每张表的模式(schema)完全一致,但每张表都带有自己的静态标签,标签可以多个,可以随时增加、删除和修改。 应用可通过指定标签的过滤条件,对一个STable下的全部或部分表进行聚合或统计操作,这样大大简化应用的开发。其具体流程如下图所示: +
    + +
    图 5 多表聚合查询原理图
    +1:应用将一个查询条件发往系统; +2: taosc将超级表的名字发往 Meta Node(管理节点); +3:管理节点将超级表所拥有的 vnode 列表发回 taosc; +4:taosc将计算的请求连同标签过滤条件发往这些vnode对应的多个数据节点; +5:每个vnode先在内存里查找出自己节点里符合标签过滤条件的表的集合,然后扫描存储的时序数据,完成相应的聚合计算,将结果返回给taosc; +6:taosc将多个数据节点返回的结果做最后的聚合,将其返回给应用。 + +由于TDengine在vnode内将标签数据与时序数据分离存储,通过在内存里过滤标签数据,先找到需要参与聚合操作的表的集合,将需要扫描的数据集大幅减少,大幅提升聚合计算速度。同时,由于数据分布在多个vnode/dnode,聚合计算操作在多个vnode里并发进行,又进一步提升了聚合的速度。 对普通表的聚合函数以及绝大部分操作都适用于超级表,语法完全一样,细节请看 TAOS SQL。 ### 预计算 为有效提升查询处理的性能,针对物联网数据的不可更改的特点,在数据块头部记录该数据块中存储数据的统计信息:包括最大值、最小值、和。我们称之为预计算单元。如果查询处理涉及整个数据块的全部数据,直接使用预计算结果,完全不需要读取数据块的内容。由于预计算数据量远小于磁盘上存储的数据块数据的大小,对于磁盘IO为瓶颈的查询处理,使用预计算结果可以极大地减小读取IO压力,加速查询处理的流程。预计算机制与Postgre SQL的索引BRIN(block range index)有异曲同工之妙。 diff --git a/documentation20/webdocs/markdowndocs/cluster-ch.md b/documentation20/webdocs/markdowndocs/cluster-ch.md index 13b773b3e302185009a07d4aa20db620ef702631..10c28c284c870d1a522a178beb5303901f079a5a 100644 --- a/documentation20/webdocs/markdowndocs/cluster-ch.md +++ b/documentation20/webdocs/markdowndocs/cluster-ch.md @@ -8,7 +8,7 @@ TDengine的集群管理极其简单,除添加和删除节点需要人工干预 ## 准备工作 -**第零步**:如果没有部署DNS服务,请规划集群所有物理节点的FQDN,然后按照《[一篇文章说清楚TDengine的FQDN](https://www.taosdata.com/blog/2020/09/11/1824.html)》里的步骤,将所有集群物理节点的IP与FQDN的对应关系添加好。 +**第零步**:规划集群所有物理节点的FQDN,将规划好的FQDN分别添加到每个物理节点的/etc/hostname;修改每个物理节点的/etc/hosts,将所有集群物理节点的IP与FQDN的对应添加好。【如部署了DNS,请联系网络管理员在DNS上做好相关配置】 **第一步**:如果搭建集群的物理节点中,存有之前的测试数据、装过1.X的版本,或者装过其他版本的TDengine,请先将其删除,并清空所有数据,具体步骤请参考博客[《TDengine多种安装包的安装和卸载》](https://www.taosdata.com/blog/2019/08/09/566.html ) **注意1:**因为FQDN的信息会写进文件,如果之前没有配置或者更改FQDN,且启动了TDengine。请一定在确保数据无用或者备份的前提下,清理一下之前的数据(rm -rf /var/lib/taos/); @@ -16,9 +16,9 @@ TDengine的集群管理极其简单,除添加和删除节点需要人工干预 **第二步**:建议关闭所有物理节点的防火墙,至少保证端口:6030 - 6042的TCP和UDP端口都是开放的。**强烈建议**先关闭防火墙,集群搭建完毕之后,再来配置端口; -**第三步**:在所有节点安装TDengine,且版本必须是一致的,**但不要启动taosd**。安装时,提示输入是否要加入一个已经存在的TDengine集群时,第一个物理节点直接回车创建新集群,后续物理节点则输入该集群任何一个在线的物理节点的FQDN:端口号(默认6030); +**第三步**:在所有物理节点安装TDengine,且版本必须是一致的,**但不要启动taosd**。安装时,提示输入是否要加入一个已经存在的TDengine集群时,第一个物理节点直接回车创建新集群,后续物理节点则输入该集群任何一个在线的物理节点的FQDN:端口号(默认6030); -**第四步**:检查所有数据节点,以及应用所在物理节点的网络设置: +**第四步**:检查所有数据节点,以及应用程序所在物理节点的网络设置: 1. 每个物理节点上执行命令`hostname -f`,查看和确认所有节点的hostname是不相同的(应用驱动所在节点无需做此项检查); 2. 每个物理节点上执行`ping host`, 其中host是其他物理节点的hostname, 看能否ping通其它物理节点; 如果不能ping通,需要检查网络设置, 或/etc/hosts文件(Windows系统默认路径为C:\Windows\system32\drivers\etc\hosts),或DNS的配置。如果无法ping通,是无法组成集群的; @@ -213,6 +213,6 @@ SHOW MNODES; ## Arbitrator的使用 -如果副本数为偶数,当一个vnode group里一半或超过一半的vnode不工作时,是无法从中选出master的。同理,一半或超过一半的mnode不工作时,是无法选出mnode的master的,因为存在“split brain”问题。为解决这个问题,TDengine引入了arbitrator的概念。Arbitrator模拟一个vnode或mnode在工作,但只简单的负责网络连接,不处理任何数据插入或访问。只要包含arbitrator在内,超过半数的vnode或mnode工作,那么该vnode group或mnode组就可以正常的提供数据插入或查询服务。比如对于副本数为2的情形,如果一个节点A离线,但另外一个节点B正常,而且能连接到arbitrator, 那么节点B就能正常工作。 +如果副本数为偶数,当一个vnode group里一半vnode不工作时,是无法从中选出master的。同理,一半mnode不工作时,是无法选出mnode的master的,因为存在“split brain”问题。为解决这个问题,TDengine引入了arbitrator的概念。Arbitrator模拟一个vnode或mnode在工作,但只简单的负责网络连接,不处理任何数据插入或访问。只要包含arbitrator在内,超过半数的vnode或mnode工作,那么该vnode group或mnode组就可以正常的提供数据插入或查询服务。比如对于副本数为2的情形,如果一个节点A离线,但另外一个节点B正常,而且能连接到arbitrator, 那么节点B就能正常工作。 -TDengine安装包里带有一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6042。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为arbitrator的End Point。如果该参数配置了,当副本数为偶数数,系统将自动连接配置的arbitrator。 +TDengine提供一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。请点击[安装包下载](https://www.taosdata.com/cn/all-downloads/),在TDengine Arbitrator Linux一节中,选择适合的版本下载并安装。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6042。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为arbitrator的End Point。如果该参数配置了,当副本数为偶数数,系统将自动连接配置的arbitrator。如果副本数为奇数,即使配置了arbitrator, 系统也不会去建立连接。 diff --git a/documentation20/webdocs/markdowndocs/connector-java-ch.md b/documentation20/webdocs/markdowndocs/connector-java-ch.md index f6da7ff4033c6da1679961404247bce9ab69ed86..e3743f4f9de727f396e343abac6234f10265cd78 100644 --- a/documentation20/webdocs/markdowndocs/connector-java-ch.md +++ b/documentation20/webdocs/markdowndocs/connector-java-ch.md @@ -72,38 +72,34 @@ maven 项目中使用如下 pom.xml 配置即可: ### 获取连接 -如下所示配置即可获取 TDengine Connection: +#### 通过JdbcUrl获取连接 + +通过指定的jdbcUrl获取连接,如下所示: ```java Class.forName("com.taosdata.jdbc.TSDBDriver"); -String jdbcUrl = "jdbc:TAOS://127.0.0.1:6030/log?user=root&password=taosdata"; +String jdbcUrl = "jdbc:TAOS://taosdemo.com:6030/test?user=root&password=taosdata"; Connection conn = DriverManager.getConnection(jdbcUrl); ``` -> 端口 6030 为默认连接端口,JDBC URL 中的 log 为系统本身的监控数据库。 +以上示例,建立了到hostname为taosdemo.com,端口为6030(TDengine的默认端口),数据库名为test的连接。这个url中指定用户名(user)为root,密码(password)为taosdata。 TDengine 的 JDBC URL 规范格式为: -`jdbc:TAOS://{host_ip}:{port}/[database_name]?[user={user}|&password={password}|&charset={charset}|&cfgdir={config_dir}|&locale={locale}|&timezone={timezone}]` - -其中,`{}` 中的内容必须,`[]` 中为可选。配置参数说明如下: - +`jdbc:TAOS://[host_name]:[port]/[database_name]?[user={user}|&password={password}|&charset={charset}|&cfgdir={config_dir}|&locale={locale}|&timezone={timezone}]` +url中的配置参数如下: * user:登录 TDengine 用户名,默认值 root。 * password:用户登录密码,默认值 taosdata。 -* charset:客户端使用的字符集,默认值为系统字符集。 * cfgdir:客户端配置文件目录路径,Linux OS 上默认值 /etc/taos ,Windows OS 上默认值 C:/TDengine/cfg。 +* charset:客户端使用的字符集,默认值为系统字符集。 * locale:客户端语言环境,默认值系统当前 locale。 * timezone:客户端使用的时区,默认值为系统当前时区。 -以上参数可以在 3 处配置,`优先级由高到低`分别如下: -1. JDBC URL 参数 - 如上所述,可以在 JDBC URL 的参数中指定。 -2. java.sql.DriverManager.getConnection(String jdbcUrl, Properties connProps) +#### 使用JdbcUrl和Properties获取连接 + +除了通过指定的jdbcUrl获取连接,还可以使用Properties指定建立连接时的参数,如下所示: ```java public Connection getConn() throws Exception{ Class.forName("com.taosdata.jdbc.TSDBDriver"); - String jdbcUrl = "jdbc:TAOS://127.0.0.1:0/log?user=root&password=taosdata"; + String jdbcUrl = "jdbc:TAOS://taosdemo.com:6030/test?user=root&password=taosdata"; Properties connProps = new Properties(); - connProps.setProperty(TSDBDriver.PROPERTY_KEY_USER, "root"); - connProps.setProperty(TSDBDriver.PROPERTY_KEY_PASSWORD, "taosdata"); - connProps.setProperty(TSDBDriver.PROPERTY_KEY_CONFIG_DIR, "/etc/taos"); connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); @@ -111,16 +107,39 @@ public Connection getConn() throws Exception{ return conn; } ``` +以上示例,建立一个到hostname为taosdemo.com,端口为6030,数据库名为test的连接。这个连接在url中指定了用户名(user)为root,密码(password)为taosdata,并在connProps中指定了使用的字符集、语言环境、时区等信息。 + +properties中的配置参数如下: +* TSDBDriver.PROPERTY_KEY_USER:登录 TDengine 用户名,默认值 root。 +* TSDBDriver.PROPERTY_KEY_PASSWORD:用户登录密码,默认值 taosdata。 +* TSDBDriver.PROPERTY_KEY_CONFIG_DIR:客户端配置文件目录路径,Linux OS 上默认值 /etc/taos ,Windows OS 上默认值 C:/TDengine/cfg。 +* TSDBDriver.PROPERTY_KEY_CHARSET:客户端使用的字符集,默认值为系统字符集。 +* TSDBDriver.PROPERTY_KEY_LOCALE:客户端语言环境,默认值系统当前 locale。 +* TSDBDriver.PROPERTY_KEY_TIME_ZONE:客户端使用的时区,默认值为系统当前时区。 + +#### 使用客户端配置文件建立连接 +当使用JDBC连接TDengine集群时,可以使用客户端配置文件,在客户端配置文件中指定集群的firstEp、secondEp参数。 +如下所示: +1. 在java中不指定hostname和port +```java +public Connection getConn() throws Exception{ + Class.forName("com.taosdata.jdbc.TSDBDriver"); + String jdbcUrl = "jdbc:TAOS://:/test?user=root&password=taosdata"; + Properties connProps = new Properties(); + connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); + connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); + connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); + Connection conn = DriverManager.getConnection(jdbcUrl, connProps); + return conn; +} +``` +2. 在配置文件中指定firstEp和secondEp +``` +# first fully qualified domain name (FQDN) for TDengine system +firstEp cluster_node1:6030 -3. 客户端配置文件 taos.cfg - - linux 系统默认配置文件为 /var/lib/taos/taos.cfg,windows 系统默认配置文件路径为 C:\TDengine\cfg\taos.cfg。 -```properties -# client default username -# defaultUser root - -# client default password -# defaultPass taosdata +# second fully qualified domain name (FQDN) for TDengine system, for cluster only +secondEp cluster_node2:6030 # default system charset # charset UTF-8 @@ -128,6 +147,19 @@ public Connection getConn() throws Exception{ # system locale # locale en_US.UTF-8 ``` + +以上示例,jdbc会使用客户端的配置文件,建立到hostname为cluster_node1,端口为6030,数据库名为test的连接。当集群中firstEp节点失效时,JDBC会尝试使用secondEp连接集群。 +TDengine中,只要保证firstEp和secondEp中一个节点有效,就可以正常建立到集群的连接。 + +> 注意:这里的配置文件指的是调用JDBC Connector的应用程序所在机器上的配置文件,Linux OS 上默认值 /etc/taos/taos.cfg ,Windows OS 上默认值 C://TDengine/cfg/taos.cfg。 + +#### 配置参数的优先级 +通过以上3种方式获取连接,如果配置参数在url、Properties、客户端配置文件中有重复,则参数的`优先级由高到低`分别如下: +1. JDBC URL 参数,如上所述,可以在 JDBC URL 的参数中指定。 +2. Properties connProps +3. 客户端配置文件 taos.cfg +例如:在url中指定了password为taosdata,在Properties中指定了password为taosdemo,那么,JDBC会使用url中的password建立连接。 + > 更多详细配置请参考[客户端配置][13] ### 创建数据库和表 diff --git a/documentation20/webdocs/markdowndocs/insert-ch.md b/documentation20/webdocs/markdowndocs/insert-ch.md index a84b577622b450089b22a961d6e5fe71627930c6..fa53cbd62b17169c0f54877a62da8c48ac21edcf 100644 --- a/documentation20/webdocs/markdowndocs/insert-ch.md +++ b/documentation20/webdocs/markdowndocs/insert-ch.md @@ -22,7 +22,7 @@ INSERT INTO d1001 VALUES (1538548685000, 10.3, 219, 0.31) (1538548695000, 12.6, **Tips:** -- 要提高写入效率,需要批量写入。一批写入的记录条数越多,插入效率就越高。但一条记录不能超过16K,一条SQL语句总长度不能超过64K(可通过参数maxSQLLength配置,最大可配置为8M)。 +- 要提高写入效率,需要批量写入。一批写入的记录条数越多,插入效率就越高。但一条记录不能超过16K,一条SQL语句总长度不能超过64K(可通过参数maxSQLLength配置,最大可配置为1M)。 - TDengine支持多线程同时写入,要进一步提高写入速度,一个客户端需要打开20个以上的线程同时写。但线程数达到一定数量后,无法再提高,甚至还会下降,因为线程切频繁切换,带来额外开销。 - 对同一张表,如果新插入记录的时间戳已经存在,新记录将被直接抛弃,也就是说,在一张表里,时间戳必须是唯一的。如果应用自动生成记录,很有可能生成的时间戳是一样的,这样,成功插入的记录条数会小于应用插入的记录条数。 - 写入的数据的时间戳必须大于当前时间减去配置参数keep的时间。如果keep配置为3650天,那么无法写入比3650天还老的数据。写入数据的时间戳也不能大于当前时间加配置参数days。如果days配置为2,那么无法写入比当前时间还晚2天的数据。 diff --git a/documentation20/webdocs/markdowndocs/taosd-ch.md b/documentation20/webdocs/markdowndocs/taosd-ch.md index e90bc2233ffb3efc62a39ca5239bd590136b4125..08be0c163e7076b58f03ff8ea3165e902a80fe64 100644 --- a/documentation20/webdocs/markdowndocs/taosd-ch.md +++ b/documentation20/webdocs/markdowndocs/taosd-ch.md @@ -61,7 +61,7 @@ vnode与其子模块是通过API直接调用,而不是通过消息队列传递 mnode是整个系统的大脑,负责整个系统的资源调度,负责meta data的管理与存储。 -一个运行的系统里,只有一个mnode,但它有多个副本(由系统配置参数numOfMpeers控制)。这些副本分布在不同的dnode里,目的是保证系统的高可靠运行。副本之间的数据复制是采用同步而非异步的方式,以确保数据的一致性,确保数据不会丢失。这些副本会自动选举一个Master,其他副本是slave。所有数据更新类的操作,都只能在master上进行,而查询类的可以在slave节点上进行。代码实现上,同步模块与vnode共享,但mnode被分配一个特殊的vgroup ID: 1,而且quorum大于1。整个集群系统是由多个dnode组成的,运行的mnode的副本数不可能超过dnode的个数,但不会超过配置的副本数。如果某个mnode副本宕机一段时间,只要超过半数的mnode副本仍在运行,运行的mnode会自动根据整个系统的资源情况,在其他dnode里再启动一个mnode, 以保证运行的副本数。 +一个运行的系统里,只有一个mnode,但它有多个副本(由系统配置参数numOfMnodes控制)。这些副本分布在不同的dnode里,目的是保证系统的高可靠运行。副本之间的数据复制是采用同步而非异步的方式,以确保数据的一致性,确保数据不会丢失。这些副本会自动选举一个Master,其他副本是slave。所有数据更新类的操作,都只能在master上进行,而查询类的可以在slave节点上进行。代码实现上,同步模块与vnode共享,但mnode被分配一个特殊的vgroup ID: 1,而且quorum大于1。整个集群系统是由多个dnode组成的,运行的mnode的副本数不可能超过dnode的个数,但不会超过配置的副本数。如果某个mnode副本宕机一段时间,只要超过半数的mnode副本仍在运行,运行的mnode会自动根据整个系统的资源情况,在其他dnode里再启动一个mnode, 以保证运行的副本数。 各个dnode通过信息交换,保存有mnode各个副本的End Point列表,并向其中的master节点定时(间隔由系统配置参数statusInterval控制)发送status消息,消息体里包含该dnode的CPU、内存、剩余存储空间、vnode个数,以及各个vnode的状态(存储空间、原始数据大小、记录条数、角色等)。这样mnode就了解整个系统的资源情况,如果用户创建新的表,就可以决定需要在哪个dnode创建;如果增加或删除dnode, 或者监测到某dnode数据过热、或离线太长,就可以决定需要挪动那些vnode,以实现负载均衡。 diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg index fdb846670656b189d12368c519348367ec4d2974..974b2b05c12f9fd5a482ef0072a9dacc2d1f09dc 100644 --- a/packaging/cfg/taos.cfg +++ b/packaging/cfg/taos.cfg @@ -6,73 +6,76 @@ ######################################################## # first fully qualified domain name (FQDN) for TDengine system -# firstEp hostname1:6030 - -# second fully qualified domain name (FQDN) for TDengine system, for cluster only -# secondEp cluster_hostname2:6030 +# firstEp hostname:6030 # local fully qualified domain name (FQDN) -# fqdn hostname +# fqdn hostname # first port number for the connection (12 continuous UDP/TCP port number are used) -# serverPort 6030 +# serverPort 6030 # log file's directory -# logDir /var/log/taos +# logDir /var/log/taos # data file's directory -# dataDir /var/lib/taos +# dataDir /var/lib/taos # the arbitrator's fully qualified domain name (FQDN) for TDengine system, for cluster only -# arbitrator arbitrator_hostname:6042 +# arbitrator arbitrator_hostname:6042 # number of threads per CPU core -# numOfThreadsPerCore 1.0 +# numOfThreadsPerCore 1.0 + +# the proportion of total threads responsible for query +# ratioOfQueryThreads 0.5 # number of management nodes in the system -# numOfMnodes 3 +# numOfMnodes 3 # enable/disable backuping vnode directory when removing dnode -# vnodeBak 1 +# vnodeBak 1 + +# if report installation / use information +# telemetryReporting 1 # enable/disable load balancing -# balance 1 +# balance 1 # role for dnode. 0 - any, 1 - mnode, 2 - dnode -# role 0 +# role 0 # max timer control blocks -# maxTmrCtrl 512 +# maxTmrCtrl 512 # time interval of system monitor, seconds -# monitorInterval 30 +# monitorInterval 30 # number of seconds allowed for a dnode to be offline, for cluster only -# offlineThreshold 8640000 +# offlineThreshold 8640000 # RPC re-try timer, millisecond -# rpcTimer 300 +# rpcTimer 300 # RPC maximum time for ack, seconds. -# rpcMaxTime 600 +# rpcMaxTime 600 # time interval of dnode status reporting to mnode, seconds, for cluster only -# statusInterval 1 +# statusInterval 1 # time interval of heart beat from shell to dnode, seconds -# shellActivityTimer 3 +# shellActivityTimer 3 # time of keeping table meta data in cache, seconds -# tableMetaKeepTimer 7200 +# tableMetaKeepTimer 7200 # minimum sliding window time, milli-second -# minSlidingTime 10 +# minSlidingTime 10 # minimum time window, milli-second -# minIntervalTime 10 +# minIntervalTime 10 # maximum delay before launching a stream compution, milli-second -# maxStreamCompDelay 20000 +# maxStreamCompDelay 20000 # maximum delay before launching a stream computation for the first time, milli-second # maxFirstStreamCompDelay 10000 @@ -89,9 +92,6 @@ # max number of tables per vnode # maxTablesPerVnode 1000000 -# step size of increasing table number in a vnode -# tableIncStepPerVnode 1000 - # cache block size (Mbyte) # cache 16 @@ -110,6 +110,9 @@ # maximum rows of records in file block # maxRows 4096 +# the number of acknowledgments required for successful data writing +# quorum 1 + # enable/disable compression # comp 2 @@ -122,15 +125,6 @@ # number of replications, for cluster only # replica 1 -# mqtt hostname -# mqttHostName test.mosquitto.org - -# mqtt port -# mqttPort 1883 - -# mqtt topic -# mqttTopic /test - # the compressed rpc message, option: # -1 (no compression) # 0 (all message compressed), @@ -167,12 +161,12 @@ # stop writing data when the disk size of the log folder is less than this value # minimalDataDirGB 0.1 +# One mnode is equal to the number of vnode consumed +# mnodeEqualVnodeNum 4 + # enbale/disable http service # http 1 -# enable/disable muqq service -# mqtt 0 - # enable/disable system monitor # monitor 1 @@ -189,11 +183,12 @@ # max number of rows per log filters # numOfLogLines 10000000 +# enable/disable async log +# asyncLog 1 + # time of keeping log files, days # logKeepDays 0 -# enable/disable async log -# asyncLog 1 # The following parameters are used for debug purpose only. # debugFlag 8 bits mask: FILE-SCREEN-UNUSED-HeartBeat-DUMP-TRACE_WARN-ERROR @@ -231,18 +226,12 @@ # debug flag for JNI # jniDebugflag 131 -# debug flag for ODBC -# odbcDebugflag 131 - # debug flag for storage # uDebugflag 131 # debug flag for http server # httpDebugFlag 131 -# debug flag for mqtt -# mqttDebugFlag 131 - # debug flag for monitor # monitorDebugFlag 131 @@ -255,6 +244,9 @@ # debug flag for http server # tsdbDebugFlag 131 +# debug flag for continue query +# cqDebugFlag 131 + # enable/disable recording the SQL in taos client # tscEnableRecordSql 0 diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index b4497e210ff470e4f95894ec8f61e8b968f7b80a..44ccafd04460c8beef0a4b2f5ae715033328f807 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM centos:7 +FROM ubuntu:20.04 WORKDIR /root @@ -7,7 +7,7 @@ RUN echo $version COPY tdengine.tar.gz /root/ RUN tar -zxf tdengine.tar.gz WORKDIR /root/TDengine-server-$version/ -RUN sh install.sh -e no +RUN /bin/bash install.sh -e no ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib" diff --git a/packaging/docker/dockerbuild-aarch64.sh b/packaging/docker/dockerbuild-aarch64.sh new file mode 100755 index 0000000000000000000000000000000000000000..795eaed5491834cf5601e567440a314d6e1f9629 --- /dev/null +++ b/packaging/docker/dockerbuild-aarch64.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -x +docker build --rm -f "Dockerfile" -t tdengine/tdengine-aarch64:$1 "." --build-arg version=$1 +docker login -u tdengine -p $2 #replace the docker registry username and password +docker push tdengine/tdengine-aarch64:$1 diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 1cbb3ead9cee61c44f4b311f730f8f23458e72af..aedfb0a6834afbf3c0c8c822b056ea5705f8d2ff 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -272,6 +272,29 @@ function install_config() { break fi done + + # user email + #EMAIL_PATTERN='^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$' + #EMAIL_PATTERN='^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$' + #EMAIL_PATTERN="^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$" + echo + echo -e -n "${GREEN}Enter your email address for priority support or enter empty to skip${NC}: " + read emailAddr + while true; do + if [ ! -z "$emailAddr" ]; then + # check the format of the emailAddr + #if [[ "$emailAddr" =~ $EMAIL_PATTERN ]]; then + # Write the email address to temp file + email_file="${install_main_dir}/email" + ${csudo} bash -c "echo $emailAddr > ${email_file}" + break + #else + # read -p "Please enter the correct email address: " emailAddr + #fi + else + break + fi + done } diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index d55be5b8c0e08bb5b0f6745b41328f07d37a7e90..b0d8d8983bab473b8711d19805cea0fef2f10ee7 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: tdengine base: core18 -version: 'RELEASE_VERSION' +version: '2.0.5.1' icon: snap/gui/t-dengine.svg summary: an open-source big data platform designed and optimized for IoT. description: | @@ -72,7 +72,7 @@ parts: - usr/bin/taosd - usr/bin/taos - usr/bin/taosdemo - - usr/lib/libtaos.so.RELEASE_VERSION + - usr/lib/libtaos.so.2.0.5.1 - usr/lib/libtaos.so.1 - usr/lib/libtaos.so diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 898b7cb032846cb85e4cc8767ed6090b35f41e1a..f619edd221c005a8d8e707afa5271072b032f74a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,4 +20,6 @@ ADD_SUBDIRECTORY(tsdb) ADD_SUBDIRECTORY(wal) ADD_SUBDIRECTORY(cq) ADD_SUBDIRECTORY(dnode) +ADD_SUBDIRECTORY(connector/odbc) ADD_SUBDIRECTORY(connector/jdbc) + diff --git a/src/balance/src/balance.c b/src/balance/src/balance.c index 3b9af741c39d9f5dcae6031f6f120ba56df9c972..0e9bb85b25defd169fea8711d3e0b40304500de4 100644 --- a/src/balance/src/balance.c +++ b/src/balance/src/balance.c @@ -126,6 +126,8 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) { balanceAccquireDnodeList(); + mDebug("db:%s, try alloc %d vnodes to vgroup, dnodes total:%d, avail:%d", pVgroup->dbName, pVgroup->numOfVnodes, + mnodeGetDnodesNum(), tsBalanceDnodeListSize); for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { for (; dnode < tsBalanceDnodeListSize; ++dnode) { SDnodeObj *pDnode = tsBalanceDnodeList[dnode]; @@ -135,17 +137,33 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) { pVnodeGid->pDnode = pDnode; dnode++; vnodes++; + mDebug("dnode:%d, is selected, vnodeIndex:%d", pDnode->dnodeId, i); break; + } else { + mDebug("dnode:%d, is not selected, status:%s vnodes:%d disk:%fGB role:%d", pDnode->dnodeId, + mnodeGetDnodeStatusStr(pDnode->status), pDnode->openVnodes, pDnode->diskAvailable, + pDnode->alternativeRole); } } } if (vnodes != pVgroup->numOfVnodes) { - mDebug("vgId:%d, db:%s need vnodes:%d, but alloc:%d, free them", pVgroup->vgId, pVgroup->dbName, - pVgroup->numOfVnodes, vnodes); balanceReleaseDnodeList(); balanceUnLock(); + mDebug("db:%s, need vnodes:%d, but alloc:%d", pVgroup->dbName, pVgroup->numOfVnodes, vnodes); + + void * pIter = NULL; + SDnodeObj *pDnode = NULL; + while (1) { + pIter = mnodeGetNextDnode(pIter, &pDnode); + if (pDnode == NULL) break; + mDebug("dnode:%d, status:%s vnodes:%d disk:%fGB role:%d", pDnode->dnodeId, mnodeGetDnodeStatusStr(pDnode->status), + pDnode->openVnodes, pDnode->diskAvailable, pDnode->alternativeRole); + mnodeDecDnodeRef(pDnode); + } + sdbFreeIter(pIter); + if (mnodeGetOnlineDnodesNum() == 0) { return TSDB_CODE_MND_NOT_READY; } else { @@ -198,8 +216,8 @@ static bool balanceCheckVgroupReady(SVgObj *pVgroup, SVnodeGid *pRmVnode) { SVnodeGid *pVnode = pVgroup->vnodeGid + i; if (pVnode == pRmVnode) continue; - mTrace("vgId:%d, change vgroup status, dnode:%d status:%d", pVgroup->vgId, pVnode->pDnode->dnodeId, - pVnode->pDnode->status); + mTrace("vgId:%d, check vgroup status, dnode:%d status:%d, vnode role:%s", pVgroup->vgId, pVnode->pDnode->dnodeId, + pVnode->pDnode->status, syncRole[pVnode->role]); if (pVnode->pDnode->status == TAOS_DN_STATUS_DROPPING) continue; if (pVnode->pDnode->status == TAOS_DN_STATUS_OFFLINE) continue; @@ -553,7 +571,8 @@ static void balanceCheckDnodeAccess() { if (pDnode->status != TAOS_DN_STATUS_DROPPING && pDnode->status != TAOS_DN_STATUS_OFFLINE) { pDnode->status = TAOS_DN_STATUS_OFFLINE; pDnode->offlineReason = TAOS_DN_OFF_STATUS_MSG_TIMEOUT; - mInfo("dnode:%d, set to offline state", pDnode->dnodeId); + mInfo("dnode:%d, set to offline state, access seq:%d, last seq:%d", pDnode->dnodeId, tsAccessSquence, + pDnode->lastAccess); balanceSetVgroupOffline(pDnode); } } @@ -937,6 +956,7 @@ static int32_t balanceRetrieveScores(SShowObj *pShow, char *data, int32_t rows, mnodeDecDnodeRef(pDnode); } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; } @@ -957,11 +977,16 @@ static void balanceMonitorDnodeModule() { continue; } - mLInfo("dnode:%d, numOfMnodes:%d expect:%d, add mnode in this dnode", pDnode->dnodeId, numOfMnodes, tsNumOfMnodes); - mnodeAddMnode(pDnode->dnodeId); - + mLInfo("dnode:%d, numOfMnodes:%d expect:%d, create mnode in this dnode", pDnode->dnodeId, numOfMnodes, tsNumOfMnodes); + mnodeCreateMnode(pDnode->dnodeId, pDnode->dnodeEp, true); + +#if 0 + // Only create one mnode each time + return; +#else numOfMnodes = mnodeGetMnodesNum(); if (numOfMnodes >= tsNumOfMnodes) return; +#endif } } diff --git a/src/client/inc/tscLocalMerge.h b/src/client/inc/tscLocalMerge.h index 4e579b0729431b0fc00d69431a304c4546f02fb0..5baa66a9e0229f35c431cea7a0d2dbb9e2ffb0e2 100644 --- a/src/client/inc/tscLocalMerge.h +++ b/src/client/inc/tscLocalMerge.h @@ -72,17 +72,10 @@ typedef struct SLocalReducer { bool orderPrjOnSTable; // projection query on stable } SLocalReducer; -typedef struct SSubqueryState { - int32_t numOfRemain; // the number of remain unfinished subquery - int32_t numOfTotal; // the number of total sub-queries - uint64_t numOfRetrievedRows; // total number of points in this query -} SSubqueryState; - typedef struct SRetrieveSupport { tExtMemBuffer ** pExtMemBuffer; // for build loser tree tOrderDescriptor *pOrderDescriptor; SColumnModel * pFinalColModel; // colModel for final result - SSubqueryState * pState; int32_t subqueryIndex; // index of current vnode in vnode list SSqlObj * pParentSql; tFilePage * localBuffer; // temp buffer, there is a buffer for each vnode to diff --git a/src/client/inc/tscSubquery.h b/src/client/inc/tscSubquery.h index 07e05803979c93f00312e17da0fbd6822b2a522b..bc01de110345e4c90cf5c15d3d7f6b010cb7308d 100644 --- a/src/client/inc/tscSubquery.h +++ b/src/client/inc/tscSubquery.h @@ -28,7 +28,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql); void tscSetupOutputColumnIndex(SSqlObj* pSql); void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code); -SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index); +SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, int32_t index); void tscHandleMasterJoinQuery(SSqlObj* pSql); @@ -39,7 +39,7 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql); int32_t tscHandleInsertRetry(SSqlObj* pSql); void tscBuildResFromSubqueries(SSqlObj *pSql); -void **doSetResultRowData(SSqlObj *pSql, bool finalResult); +TAOS_ROW doSetResultRowData(SSqlObj *pSql, bool finalResult); #ifdef __cplusplus } diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h index 0323434a992ae25b9f3fe54fb596b56e865bdf55..3df493349e387c1dd33a945886389218f7f7cf0f 100644 --- a/src/client/inc/tscUtil.h +++ b/src/client/inc/tscUtil.h @@ -66,7 +66,6 @@ typedef struct STidTags { #pragma pack(pop) typedef struct SJoinSupporter { - SSubqueryState* pState; SSqlObj* pObj; // parent SqlObj int32_t subqueryIndex; // index of sub query SInterval interval; @@ -110,7 +109,6 @@ SParamInfo* tscAddParamToDataBlock(STableDataBlocks* pDataBlock, char type, uint void* tscDestroyBlockArrayList(SArray* pDataBlockList); int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock); -void tscFreeUnusedDataBlocks(SArray* pDataBlockList); int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SArray* pDataList); int32_t tscGetDataBlockFromList(void* pHashList, SArray* pDataBlockList, int64_t id, int32_t size, int32_t startOffset, int32_t rowSize, const char* tableId, STableMeta* pTableMeta, @@ -151,14 +149,13 @@ int tscAllocPayload(SSqlCmd* pCmd, int size); TAOS_FIELD tscCreateField(int8_t type, const char* name, int16_t bytes); -SFieldSupInfo* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField); -SFieldSupInfo* tscFieldInfoInsert(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* field); +SInternalField* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField); +SInternalField* tscFieldInfoInsert(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* field); -SFieldSupInfo* tscFieldInfoGetSupp(SFieldInfo* pFieldInfo, int32_t index); +SInternalField* tscFieldInfoGetInternalField(SFieldInfo* pFieldInfo, int32_t index); TAOS_FIELD* tscFieldInfoGetField(SFieldInfo* pFieldInfo, int32_t index); void tscFieldInfoUpdateOffset(SQueryInfo* pQueryInfo); -void tscFieldInfoCopy(SFieldInfo* dst, const SFieldInfo* src); void tscFieldInfoUpdateOffsetForInterResult(SQueryInfo* pQueryInfo); int16_t tscFieldInfoGetOffset(SQueryInfo* pQueryInfo, int32_t index); @@ -207,8 +204,6 @@ void tscTagCondRelease(STagCond* pCond); void tscGetSrcColumnInfo(SSrcColumnInfo* pColInfo, SQueryInfo* pQueryInfo); -void tscSetFreeHeatBeat(STscObj* pObj); -bool tscShouldFreeHeartBeat(SSqlObj* pHb); bool tscShouldBeFreed(SSqlObj* pSql); STableMetaInfo* tscGetTableMetaInfoFromCmd(SSqlCmd *pCmd, int32_t subClauseIndex, int32_t tableIndex); @@ -235,10 +230,11 @@ int tscGetTableMeta(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo); int tscGetMeterMetaEx(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, bool createIfNotExists); void tscResetForNextRetrieve(SSqlRes* pRes); - -void tscAddTimestampColumn(SQueryInfo* pQueryInfo, int16_t functionId, int16_t tableIndex); void tscDoQuery(SSqlObj* pSql); +SVgroupsInfo* tscVgroupInfoClone(SVgroupsInfo *pInfo); +void* tscVgroupInfoClear(SVgroupsInfo *pInfo); +void tscSCMVgroupInfoCopy(SCMVgroupInfo* dst, const SCMVgroupInfo* src); /** * The create object function must be successful expect for the out of memory issue. * diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 046bea2c27df8bbe1cc012d1511980f691ff60a5..fa215db2702f63aff4c704f8393255a94987d681 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -80,6 +80,8 @@ enum { DATA_FROM_DATA_FILE = 2, }; +typedef void (*__async_cb_func_t)(void *param, TAOS_RES *tres, int32_t numOfRows); + typedef struct STableComInfo { uint8_t numOfTags; uint8_t precision; @@ -88,10 +90,10 @@ typedef struct STableComInfo { } STableComInfo; typedef struct SCMCorVgroupInfo { - int32_t version; - int8_t inUse; - int8_t numOfEps; - SEpAddr epAddr[TSDB_MAX_REPLICA]; + int32_t version; + int8_t inUse; + int8_t numOfEps; + SEpAddr1 epAddr[TSDB_MAX_REPLICA]; } SCMCorVgroupInfo; typedef struct STableMeta { @@ -140,16 +142,17 @@ typedef struct SColumnIndex { int16_t columnIndex; } SColumnIndex; -typedef struct SFieldSupInfo { +typedef struct SInternalField { + TAOS_FIELD field; bool visible; SExprInfo *pArithExprInfo; SSqlExpr *pSqlExpr; -} SFieldSupInfo; +} SInternalField; typedef struct SFieldInfo { - int16_t numOfOutput; // number of column in result - SArray *pFields; // SArray - SArray *pSupportInfo; // SArray + int16_t numOfOutput; // number of column in result + TAOS_FIELD* final; + SArray *internalField; // SArray } SFieldInfo; typedef struct SColumn { @@ -226,7 +229,7 @@ typedef struct STableDataBlocks { typedef struct SQueryInfo { int16_t command; // the command may be different for each subclause, so keep it seperately. uint32_t type; // query/insert type - // TODO refactor + STimeWindow window; // query time window SInterval interval; @@ -306,7 +309,7 @@ typedef struct { int32_t numOfGroups; SResRec * pGroupRec; char * data; - void ** tsrow; + TAOS_ROW tsrow; int32_t* length; // length for each field for current row char ** buffer; // Buffer used to put multibytes encoded using unicode (wchar_t) SColumnIndex * pColumnIndex; @@ -334,6 +337,12 @@ typedef struct STscObj { T_REF_DECLARE() } STscObj; +typedef struct SSubqueryState { + int32_t numOfRemain; // the number of remain unfinished subquery + int32_t numOfSub; // the number of total sub-queries + uint64_t numOfRetrievedRows; // total number of points in this query +} SSubqueryState; + typedef struct SSqlObj { void *signature; pthread_t owner; // owner of sql object, by which it is executed @@ -355,10 +364,11 @@ typedef struct SSqlObj { tsem_t rspSem; SSqlCmd cmd; SSqlRes res; - uint16_t numOfSubs; + + SSubqueryState subState; struct SSqlObj **pSubs; - struct SSqlObj * prev, *next; + struct SSqlObj *prev, *next; struct SSqlObj **self; } SSqlObj; @@ -433,19 +443,20 @@ void tscPartiallyFreeSqlObj(SSqlObj *pSql); * @param pObj */ void tscFreeSqlObj(SSqlObj *pSql); - -void tscFreeSqlObjInCache(void *pSql); +void tscFreeRegisteredSqlObj(void *pSql); +void tscFreeTableMetaHelper(void *pTableMeta); void tscCloseTscObj(STscObj *pObj); +// todo move to taos? or create a new file: taos_internal.h TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int), - void *param, void **taos); -void waitForQueryRsp(void *param, TAOS_RES *tres, int code) ; + void *param, TAOS **taos); +TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, TAOS_RES** res); +void waitForQueryRsp(void *param, TAOS_RES *tres, int code); -void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, void (*fp)(), void *param, const char *sqlstr, size_t sqlLen); +void doAsyncQuery(STscObj *pObj, SSqlObj *pSql, __async_cb_func_t fp, void *param, const char *sqlstr, size_t sqlLen); void tscProcessMultiVnodesImportFromFile(SSqlObj *pSql); -void tscKillSTableQuery(SSqlObj *pSql); void tscInitResObjForLocalQuery(SSqlObj *pObj, int32_t numOfRes, int32_t rowLen); bool tscIsUpdateQuery(SSqlObj* pSql); bool tscHasReachLimitation(SQueryInfo *pQueryInfo, SSqlRes *pRes); @@ -458,7 +469,7 @@ int32_t tscSQLSyntaxErrMsg(char* msg, const char* additionalInfo, const char* s int32_t tscToSQLCmd(SSqlObj *pSql, struct SSqlInfo *pInfo); static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pFieldInfo, int32_t columnIndex) { - SFieldSupInfo* pInfo = (SFieldSupInfo*) TARRAY_GET_ELEM(pFieldInfo->pSupportInfo, columnIndex); + SInternalField* pInfo = (SInternalField*) TARRAY_GET_ELEM(pFieldInfo->internalField, columnIndex); assert(pInfo->pSqlExpr != NULL); int32_t type = pInfo->pSqlExpr->resType; @@ -471,11 +482,11 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField if (type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BINARY) { pData = pInfo->pSqlExpr->param[1].pz; pRes->length[columnIndex] = pInfo->pSqlExpr->param[1].nLen; - pRes->tsrow[columnIndex] = (pInfo->pSqlExpr->param[1].nType == TSDB_DATA_TYPE_NULL) ? NULL : pData; + pRes->tsrow[columnIndex] = (pInfo->pSqlExpr->param[1].nType == TSDB_DATA_TYPE_NULL) ? NULL : (unsigned char*)pData; } else { assert(bytes == tDataTypeDesc[type].nSize); - pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : &pInfo->pSqlExpr->param[1].i64Key; + pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : (unsigned char*)&pInfo->pSqlExpr->param[1].i64Key; pRes->length[columnIndex] = bytes; } } else { @@ -483,7 +494,7 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField int32_t realLen = varDataLen(pData); assert(realLen <= bytes - VARSTR_HEADER_SIZE); - pRes->tsrow[columnIndex] = (isNull(pData, type)) ? NULL : ((tstr *)pData)->data; + pRes->tsrow[columnIndex] = (isNull(pData, type)) ? NULL : (unsigned char*)((tstr *)pData)->data; if (realLen < pInfo->pSqlExpr->resBytes - VARSTR_HEADER_SIZE) { // todo refactor *(pData + realLen + VARSTR_HEADER_SIZE) = 0; } @@ -492,7 +503,7 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField } else { assert(bytes == tDataTypeDesc[type].nSize); - pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : pData; + pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : (unsigned char*)pData; pRes->length[columnIndex] = bytes; } } @@ -510,8 +521,6 @@ extern SRpcCorEpSet tscMgmtEpSet; extern int (*tscBuildMsg[TSDB_SQL_MAX])(SSqlObj *pSql, SSqlInfo *pInfo); -typedef void (*__async_cb_func_t)(void *param, TAOS_RES *tres, int numOfRows); - int32_t tscCompareTidTags(const void* p1, const void* p2); void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArray* tables); diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 400613595b605bae4e5c7c23353aa4243a0eb933..c996bb2a76ff505fca4e09cd8763b324e5c4cb8d 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -40,7 +40,7 @@ static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRo static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows); static void tscAsyncFetchSingleRowProxy(void *param, TAOS_RES *tres, int numOfRows); -void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, void (*fp)(), void* param, const char* sqlstr, size_t sqlLen) { +void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* param, const char* sqlstr, size_t sqlLen) { SSqlCmd* pCmd = &pSql->cmd; pSql->signature = pSql; @@ -327,7 +327,7 @@ void tscAsyncFetchSingleRowProxy(void *param, TAOS_RES *tres, int numOfRows) { } for (int i = 0; i < pCmd->numOfCols; ++i){ - SFieldSupInfo* pSup = taosArrayGet(pQueryInfo->fieldsInfo.pSupportInfo, i); + SInternalField* pSup = taosArrayGet(pQueryInfo->fieldsInfo.internalField, i); if (pSup->pSqlExpr != NULL) { // pRes->tsrow[i] = TSC_GET_RESPTR_BASE(pRes, pQueryInfo, i) + pSup->pSqlExpr->resBytes * pRes->row; } else { @@ -348,7 +348,7 @@ void tscProcessFetchRow(SSchedMsg *pMsg) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); for (int i = 0; i < pCmd->numOfCols; ++i) { - SFieldSupInfo* pSup = taosArrayGet(pQueryInfo->fieldsInfo.pSupportInfo, i); + SInternalField* pSup = taosArrayGet(pQueryInfo->fieldsInfo.internalField, i); if (pSup->pSqlExpr != NULL) { tscGetResultColumnChr(pRes, &pQueryInfo->fieldsInfo, i); @@ -361,15 +361,6 @@ void tscProcessFetchRow(SSchedMsg *pMsg) { (*pSql->fetchFp)(pSql->param, pSql, pRes->tsrow); } -void tscProcessAsyncRes(SSchedMsg *pMsg) { - SSqlObj *pSql = (SSqlObj *)pMsg->ahandle; - SSqlRes *pRes = &pSql->res; - assert(pSql->fp != NULL && pSql->fetchFp != NULL); - - pSql->fp = pSql->fetchFp; - (*pSql->fp)(pSql->param, pSql, pRes->code); -} - // this function will be executed by queue task threads, so the terrno is not valid static void tscProcessAsyncError(SSchedMsg *pMsg) { void (*fp)() = pMsg->ahandle; @@ -393,22 +384,15 @@ void tscQueueAsyncRes(SSqlObj *pSql) { if (pSql == NULL || pSql->signature != pSql) { tscDebug("%p SqlObj is freed, not add into queue async res", pSql); return; - } else { - tscError("%p add into queued async res, code:%s", pSql, tstrerror(pSql->res.code)); } - SSchedMsg schedMsg = { 0 }; - schedMsg.fp = tscProcessAsyncRes; - schedMsg.ahandle = pSql; - schedMsg.thandle = (void *)1; - schedMsg.msg = NULL; - taosScheduleTask(tscQhandle, &schedMsg); -} + tscError("%p add into queued async res, code:%s", pSql, tstrerror(pSql->res.code)); -void tscProcessAsyncFree(SSchedMsg *pMsg) { - SSqlObj *pSql = (SSqlObj *)pMsg->ahandle; - tscDebug("%p sql is freed", pSql); - taos_free_result(pSql); + SSqlRes *pRes = &pSql->res; + assert(pSql->fp != NULL && pSql->fetchFp != NULL); + + pSql->fp = pSql->fetchFp; + (*pSql->fp)(pSql->param, pSql, pRes->code); } int tscSendMsgToServer(SSqlObj *pSql); @@ -421,11 +405,11 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) { SSqlRes *pRes = &pSql->res; pRes->code = code; + const char* msg = (pCmd->command == TSDB_SQL_STABLEVGROUP)? "vgroup-list":"table-meta"; if (code != TSDB_CODE_SUCCESS) { - tscError("%p get tableMeta failed, code:%s", pSql, tstrerror(code)); + tscError("%p get %s failed, code:%s", pSql, msg, tstrerror(code)); goto _error; } else { - const char* msg = (pCmd->command == TSDB_SQL_STABLEVGROUP)? "vgroup-list":"table-meta"; tscDebug("%p get %s successfully", pSql, msg); } diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c index 60e9596ec41ce41f5d727d3016663b752dc32fd0..1b4f92d3fc9fc78951e23eaec4c438d7522bf7f1 100644 --- a/src/client/src/tscFunctionImpl.c +++ b/src/client/src/tscFunctionImpl.c @@ -2445,8 +2445,8 @@ static bool percentile_function_setup(SQLFunctionCtx *pCtx) { // in the first round, get the min-max value of all involved data SResultInfo *pResInfo = GET_RES_INFO(pCtx); SPercentileInfo *pInfo = pResInfo->interResultBuf; - pInfo->minval = DBL_MAX; - pInfo->maxval = -DBL_MAX; + SET_DOUBLE_VAL(&pInfo->minval, DBL_MAX); + SET_DOUBLE_VAL(&pInfo->maxval, -DBL_MAX); pInfo->numOfElems = 0; return true; @@ -2461,12 +2461,12 @@ static void percentile_function(SQLFunctionCtx *pCtx) { // the first stage, only acquire the min/max value if (pInfo->stage == 0) { if (pCtx->preAggVals.isSet) { - if (pInfo->minval > pCtx->preAggVals.statis.min) { - pInfo->minval = (double)pCtx->preAggVals.statis.min; + if (GET_DOUBLE_VAL(&pInfo->minval) > pCtx->preAggVals.statis.min) { + SET_DOUBLE_VAL(&pInfo->minval, (double)pCtx->preAggVals.statis.min); } - if (pInfo->maxval < pCtx->preAggVals.statis.max) { - pInfo->maxval = (double)pCtx->preAggVals.statis.max; + if (GET_DOUBLE_VAL(&pInfo->maxval) < pCtx->preAggVals.statis.max) { + SET_DOUBLE_VAL(&pInfo->maxval, (double)pCtx->preAggVals.statis.max); } pInfo->numOfElems += (pCtx->size - pCtx->preAggVals.statis.numOfNull); @@ -2500,12 +2500,12 @@ static void percentile_function(SQLFunctionCtx *pCtx) { break; } - if (v < pInfo->minval) { - pInfo->minval = v; + if (v < GET_DOUBLE_VAL(&pInfo->minval)) { + SET_DOUBLE_VAL(&pInfo->minval, v); } - if (v > pInfo->maxval) { - pInfo->maxval = v; + if (v > GET_DOUBLE_VAL(&pInfo->maxval)) { + SET_DOUBLE_VAL(&pInfo->maxval, v); } pInfo->numOfElems += 1; @@ -2564,12 +2564,12 @@ static void percentile_function_f(SQLFunctionCtx *pCtx, int32_t index) { break; } - if (v < pInfo->minval) { - pInfo->minval = v; + if (v < GET_DOUBLE_VAL(&pInfo->minval)) { + SET_DOUBLE_VAL(&pInfo->minval, v); } - if (v > pInfo->maxval) { - pInfo->maxval = v; + if (v > GET_DOUBLE_VAL(&pInfo->maxval)) { + SET_DOUBLE_VAL(&pInfo->maxval, v); } pInfo->numOfElems += 1; @@ -2609,7 +2609,7 @@ static void percentile_next_step(SQLFunctionCtx *pCtx) { } pInfo->stage += 1; - pInfo->pMemBucket = tMemBucketCreate(pCtx->inputBytes, pCtx->inputType, pInfo->minval, pInfo->maxval); + pInfo->pMemBucket = tMemBucketCreate(pCtx->inputBytes, pCtx->inputType, GET_DOUBLE_VAL(&pInfo->minval), GET_DOUBLE_VAL(&pInfo->maxval)); } else { pResInfo->complete = true; } diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index a15673bdb1edf97fda23d879ab69839fd500549e..b4c3f3549b1576b3ff83300d4f10d9e07778530d 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -239,7 +239,7 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols, TAOS_FIELD f = {.type = TSDB_DATA_TYPE_BINARY, .bytes = (TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE}; tstrncpy(f.name, "Field", sizeof(f.name)); - SFieldSupInfo* pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + SInternalField* pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, (TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE, (TSDB_COL_NAME_LEN - 1), false); @@ -296,7 +296,7 @@ static int32_t tscProcessDescribeTable(SSqlObj *pSql) { return tscSetValueToResObj(pSql, rowLen); } static int32_t tscGetNthFieldResult(TAOS_ROW row, TAOS_FIELD* fields, int *lengths, int idx, char *result) { - const char *val = row[idx]; + const char *val = (const char*)row[idx]; if (val == NULL) { sprintf(result, "%s", TSDB_DATA_NULL_STR); return -1; @@ -485,7 +485,7 @@ static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const tstrncpy(f.name, "Database", sizeof(f.name)); } - SFieldSupInfo* pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); + SInternalField* pInfo = tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, TSDB_DATA_TYPE_BINARY, f.bytes, f.bytes - VARSTR_HEADER_SIZE, false); @@ -922,19 +922,17 @@ void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnNa pQueryInfo->order.order = TSDB_ORDER_ASC; tscFieldInfoClear(&pQueryInfo->fieldsInfo); - pQueryInfo->fieldsInfo.pFields = taosArrayInit(1, sizeof(TAOS_FIELD)); - pQueryInfo->fieldsInfo.pSupportInfo = taosArrayInit(1, sizeof(SFieldSupInfo)); + pQueryInfo->fieldsInfo.internalField = taosArrayInit(1, sizeof(SInternalField)); TAOS_FIELD f = tscCreateField((int8_t)type, columnName, (int16_t)valueLength); tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f); tscInitResObjForLocalQuery(pSql, 1, (int32_t)valueLength); - TAOS_FIELD *pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 0); - SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, 0); + SInternalField* pInfo = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, 0); pInfo->pSqlExpr = taosArrayGetP(pQueryInfo->exprList, 0); - memcpy(pRes->data, val, pField->bytes); + memcpy(pRes->data, val, pInfo->field.bytes); } int tscProcessLocalCmd(SSqlObj *pSql) { diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c index 19abbe32e5ce67b626dd94c3db9574d6a3afe6e8..44ccb2471aa980d789c8557aca7981b6981df02f 100644 --- a/src/client/src/tscLocalMerge.c +++ b/src/client/src/tscLocalMerge.c @@ -510,7 +510,8 @@ void tscDestroyLocalReducer(SSqlObj *pSql) { taosTFree(pLocalReducer->pResultBuf); if (pLocalReducer->pResInfo != NULL) { - for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) { + size_t num = tscSqlExprNumOfExprs(pQueryInfo); + for (int32_t i = 0; i < num; ++i) { taosTFree(pLocalReducer->pResInfo[i].interResultBuf); } @@ -554,27 +555,48 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SSqlCmd *pCm numOfGroupByCols++; } - int32_t *orderIdx = (int32_t *)calloc(numOfGroupByCols, sizeof(int32_t)); - if (orderIdx == NULL) { + int32_t *orderColIndexList = (int32_t *)calloc(numOfGroupByCols, sizeof(int32_t)); + if (orderColIndexList == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } if (numOfGroupByCols > 0) { - int32_t startCols = pQueryInfo->fieldsInfo.numOfOutput - pQueryInfo->groupbyExpr.numOfGroupCols; - // tags value locate at the last columns - for (int32_t i = 0; i < pQueryInfo->groupbyExpr.numOfGroupCols; ++i) { - orderIdx[i] = startCols++; - } + if (pQueryInfo->groupbyExpr.numOfGroupCols > 0) { + int32_t startCols = pQueryInfo->fieldsInfo.numOfOutput - pQueryInfo->groupbyExpr.numOfGroupCols; + + // the last "pQueryInfo->groupbyExpr.numOfGroupCols" columns are order-by columns + for (int32_t i = 0; i < pQueryInfo->groupbyExpr.numOfGroupCols; ++i) { + orderColIndexList[i] = startCols++; + } + + if (pQueryInfo->interval.interval != 0) { + // the first column is the timestamp, handles queries like "interval(10m) group by tags" + orderColIndexList[numOfGroupByCols - 1] = PRIMARYKEY_TIMESTAMP_COL_INDEX; //TODO ??? + } + } else { + /* + * 1. the orderby ts asc/desc projection query for the super table + * 2. interval query without groupby clause + */ + if (pQueryInfo->interval.interval != 0) { + orderColIndexList[0] = PRIMARYKEY_TIMESTAMP_COL_INDEX; + } else { + size_t size = tscSqlExprNumOfExprs(pQueryInfo); + for (int32_t i = 0; i < size; ++i) { + SSqlExpr *pExpr = tscSqlExprGet(pQueryInfo, i); + if (pExpr->functionId == TSDB_FUNC_PRJ && pExpr->colInfo.colId == PRIMARYKEY_TIMESTAMP_COL_INDEX) { + orderColIndexList[0] = i; + } + } + } - if (pQueryInfo->interval.interval != 0) { - // the first column is the timestamp, handles queries like "interval(10m) group by tags" - orderIdx[numOfGroupByCols - 1] = PRIMARYKEY_TIMESTAMP_COL_INDEX; + assert(pQueryInfo->order.orderColId == PRIMARYKEY_TIMESTAMP_COL_INDEX); } } - *pOrderDesc = tOrderDesCreate(orderIdx, numOfGroupByCols, pModel, pQueryInfo->order.order); - taosTFree(orderIdx); + *pOrderDesc = tOrderDesCreate(orderColIndexList, numOfGroupByCols, pModel, pQueryInfo->order.order); + taosTFree(orderColIndexList); if (*pOrderDesc == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -588,7 +610,6 @@ bool isSameGroup(SSqlCmd *pCmd, SLocalReducer *pReducer, char *pPrev, tFilePage // disable merge procedure for column projection query int16_t functionId = pReducer->pCtx[0].functionId; - assert(functionId != TSDB_FUNC_ARITHM); if (pReducer->orderPrjOnSTable) { return true; } @@ -606,7 +627,7 @@ bool isSameGroup(SSqlCmd *pCmd, SLocalReducer *pReducer, char *pPrev, tFilePage return true; } - if (orderInfo->pData[numOfCols - 1] == PRIMARYKEY_TIMESTAMP_COL_INDEX) { + if (orderInfo->colIndex[numOfCols - 1] == PRIMARYKEY_TIMESTAMP_COL_INDEX) { /* * super table interval query * if the order columns is the primary timestamp, all result data belongs to one group @@ -620,7 +641,7 @@ bool isSameGroup(SSqlCmd *pCmd, SLocalReducer *pReducer, char *pPrev, tFilePage } // only one row exists - int32_t index = orderInfo->pData[0]; + int32_t index = orderInfo->colIndex[0]; int32_t offset = (pOrderDesc->pColumnModel)->pFields[index].offset; int32_t ret = memcmp(pPrev + offset, tmpBuffer->data + offset, pOrderDesc->pColumnModel->rowSize - offset); @@ -639,7 +660,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr SQueryInfo * pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - (*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * pSql->numOfSubs); + (*pMemBuffer) = (tExtMemBuffer **)malloc(POINTER_BYTES * pSql->subState.numOfSub); if (*pMemBuffer == NULL) { tscError("%p failed to allocate memory", pSql); pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY; @@ -661,7 +682,6 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr pSchema[i].bytes = pExpr->resBytes; pSchema[i].type = (int8_t)pExpr->resType; - rlen += pExpr->resBytes; } @@ -701,12 +721,8 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr int16_t type = -1; int16_t bytes = 0; - // if ((pExpr->functionId >= TSDB_FUNC_FIRST_DST && pExpr->functionId <= TSDB_FUNC_LAST_DST) || - // (pExpr->functionId >= TSDB_FUNC_SUM && pExpr->functionId <= TSDB_FUNC_MAX) || - // pExpr->functionId == TSDB_FUNC_LAST_ROW) { // the final result size and type in the same as query on single table. // so here, set the flag to be false; - int32_t functionId = pExpr->functionId; if (functionId >= TSDB_FUNC_TS && functionId <= TSDB_FUNC_DIFF) { type = pModel->pFields[i].field.type; @@ -742,6 +758,7 @@ void tscLocalReducerEnvDestroy(tExtMemBuffer **pMemBuffer, tOrderDescriptor *pDe int32_t numOfVnodes) { destroyColumnModel(pFinalModel); tOrderDescDestroy(pDesc); + for (int32_t i = 0; i < numOfVnodes; ++i) { pMemBuffer[i] = destoryExtMemBuffer(pMemBuffer[i]); } diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index b3bb4566be10cdeab19bcd1436f59a9bae2f6e9f..1739e4348ca2d1e90e4cdc292a14c7dcc5dde2da 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -139,7 +139,7 @@ static int normalStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) { return TSDB_CODE_TSC_INVALID_VALUE; } } - + return TSDB_CODE_SUCCESS; } @@ -213,7 +213,7 @@ static char* normalStmtBuildSql(STscStmt* stmt) { case TSDB_DATA_TYPE_NULL: taosStringBuilderAppendNull(&sb); break; - + case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_SMALLINT: @@ -266,6 +266,388 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) { return TSDB_CODE_SUCCESS; } + if (1) { + // allow user bind param data with different type + short size = 0; + union { + int8_t v1; + int16_t v2; + int32_t v4; + int64_t v8; + float f4; + double f8; + unsigned char buf[32*1024]; + } u; + switch (param->type) { + case TSDB_DATA_TYPE_BOOL: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BOOL: { + u.v1 = *(int8_t*)bind->buffer; + if (u.v1==0 || u.v1==1) break; + } break; + case TSDB_DATA_TYPE_TINYINT: { + u.v1 = *(int8_t*)bind->buffer; + if (u.v1==0 || u.v1==1) break; + } break; + case TSDB_DATA_TYPE_SMALLINT: { + u.v1 = (int8_t)*(int16_t*)bind->buffer; + if (u.v1==0 || u.v1==1) break; + } break; + case TSDB_DATA_TYPE_INT: { + u.v1 = (int8_t)*(int32_t*)bind->buffer; + if (u.v1==0 || u.v1==1) break; + } break; + case TSDB_DATA_TYPE_BIGINT: { + u.v1 = (int8_t)*(int64_t*)bind->buffer; + if (u.v1==0 || u.v1==1) break; + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + // "0", "1" convertible + if (strncmp((const char*)bind->buffer, "0", *bind->length)==0) { + u.v1 = 0; + break; + } + if (strncmp((const char*)bind->buffer, "1", *bind->length)==0) { + u.v1 = 1; + break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + memcpy(data + param->offset, &u.v1, sizeof(u.v1)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_TINYINT: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: { + int8_t v = *(int8_t*)bind->buffer; + u.v1 = v; + if (v >= SCHAR_MIN && v <= SCHAR_MAX) break; + } break; + case TSDB_DATA_TYPE_SMALLINT: { + int16_t v = *(int16_t*)bind->buffer; + u.v1 = (int8_t)v; + if (v >= SCHAR_MIN && v <= SCHAR_MAX) break; + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_INT: { + int32_t v = *(int32_t*)bind->buffer; + u.v1 = (int8_t)v; + if (v >= SCHAR_MIN && v <= SCHAR_MAX) break; + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_BIGINT: { + int64_t v = *(int64_t*)bind->buffer; + u.v1 = (int8_t)v; + if (v >= SCHAR_MIN && v <= SCHAR_MAX) break; + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + int64_t v; + int n,r; + r = sscanf((const char*)bind->buffer, "%" PRId64 "%n", &v, &n); + if (r==1 && n==strlen((const char*)bind->buffer)) { + u.v1 = (int8_t)v; + if (v >= SCHAR_MIN && v <= SCHAR_MAX) break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + memcpy(data + param->offset, &u.v1, sizeof(u.v1)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_SMALLINT: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: { + int v = *(int16_t*)bind->buffer; + u.v2 = (int16_t)v; + } break; + case TSDB_DATA_TYPE_INT: { + int32_t v = *(int32_t*)bind->buffer; + u.v2 = (int16_t)v; + if (v >= SHRT_MIN && v <= SHRT_MAX) break; + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_BIGINT: { + int64_t v = *(int64_t*)bind->buffer; + u.v2 = (int16_t)v; + if (v >= SHRT_MIN && v <= SHRT_MAX) break; + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + int64_t v; + int n,r; + r = sscanf((const char*)bind->buffer, "%" PRId64 "%n", &v, &n); + if (r==1 && n==strlen((const char*)bind->buffer)) { + u.v2 = (int16_t)v; + if (v >= SHRT_MIN && v <= SHRT_MAX) break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + memcpy(data + param->offset, &u.v2, sizeof(u.v2)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_INT: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: { + u.v4 = *(int32_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_BIGINT: { + int64_t v = *(int64_t*)bind->buffer; + u.v4 = (int32_t)v; + if (v >= INT_MIN && v <= INT_MAX) break; + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + int64_t v; + int n,r; + r = sscanf((const char*)bind->buffer, "%" PRId64 "%n", &v, &n); + if (r==1 && n==strlen((const char*)bind->buffer)) { + u.v4 = (int32_t)v; + if (v >= INT_MIN && v <= INT_MAX) break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + memcpy(data + param->offset, &u.v2, sizeof(u.v2)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_FLOAT: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: { + u.f4 = *(int8_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_SMALLINT: { + u.f4 = *(int16_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_INT: { + u.f4 = (float)*(int32_t*)bind->buffer; + // shall we check equality? + } break; + case TSDB_DATA_TYPE_BIGINT: { + u.f4 = (float)*(int64_t*)bind->buffer; + // shall we check equality? + } break; + case TSDB_DATA_TYPE_FLOAT: { + u.f4 = *(float*)bind->buffer; + } break; + case TSDB_DATA_TYPE_DOUBLE: { + u.f4 = *(float*)bind->buffer; + // shall we check equality? + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + float v; + int n,r; + r = sscanf((const char*)bind->buffer, "%f%n", &v, &n); + if (r==1 && n==strlen((const char*)bind->buffer)) { + u.f4 = v; + break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_TIMESTAMP: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + memcpy(data + param->offset, &u.f4, sizeof(u.f4)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_BIGINT: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: { + u.v8 = *(int8_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_SMALLINT: { + u.v8 = *(int16_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_INT: { + u.v8 = *(int32_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_BIGINT: { + u.v8 = *(int64_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + int64_t v; + int n,r; + r = sscanf((const char*)bind->buffer, "%" PRId64 "%n", &v, &n); + if (r==1 && n==strlen((const char*)bind->buffer)) { + u.v8 = v; + break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + memcpy(data + param->offset, &u.v8, sizeof(u.v8)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_DOUBLE: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: { + u.f8 = *(int8_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_SMALLINT: { + u.f8 = *(int16_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_INT: { + u.f8 = *(int32_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_BIGINT: { + u.f8 = (double)*(int64_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_FLOAT: { + u.f8 = *(float*)bind->buffer; + } break; + case TSDB_DATA_TYPE_DOUBLE: { + u.f8 = *(double*)bind->buffer; + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + double v; + int n,r; + r = sscanf((const char*)bind->buffer, "%lf%n", &v, &n); + if (r==1 && n==strlen((const char*)bind->buffer)) { + u.f8 = v; + break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_TIMESTAMP: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } break; + memcpy(data + param->offset, &u.f8, sizeof(u.f8)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_TIMESTAMP: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_TIMESTAMP: { + u.v8 = *(int64_t*)bind->buffer; + } break; + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + // is this the correct way to call taosParseTime? + int32_t len = (int32_t)*bind->length; + if (taosParseTime(bind->buffer, &u.v8, len, 3, tsDaylight) == TSDB_CODE_SUCCESS) { + break; + } + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_DOUBLE: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } break; + memcpy(data + param->offset, &u.v8, sizeof(u.v8)); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_BINARY: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_BINARY: { + if ((*bind->length) > (uintptr_t)param->bytes) { + return TSDB_CODE_TSC_INVALID_VALUE; + } + size = (short)*bind->length; + STR_WITH_SIZE_TO_VARSTR(data + param->offset, bind->buffer, size); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_NCHAR: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + } break; + case TSDB_DATA_TYPE_NCHAR: { + switch (bind->buffer_type) { + case TSDB_DATA_TYPE_NCHAR: { + size_t output = 0; + if (!taosMbsToUcs4(bind->buffer, *bind->length, varDataVal(data + param->offset), param->bytes - VARSTR_HEADER_SIZE, &output)) { + return TSDB_CODE_TSC_INVALID_VALUE; + } + varDataSetLen(data + param->offset, output); + return TSDB_CODE_SUCCESS; + } break; + case TSDB_DATA_TYPE_BOOL: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_SMALLINT: + case TSDB_DATA_TYPE_INT: + case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_BINARY: + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + } break; + default: { + return TSDB_CODE_TSC_INVALID_VALUE; + } break; + } + } + if (bind->buffer_type != param->type) { return TSDB_CODE_TSC_INVALID_VALUE; } @@ -299,12 +681,12 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) { size = (short)*bind->length; STR_WITH_SIZE_TO_VARSTR(data + param->offset, bind->buffer, size); return TSDB_CODE_SUCCESS; - + case TSDB_DATA_TYPE_NCHAR: { size_t output = 0; if (!taosMbsToUcs4(bind->buffer, *bind->length, varDataVal(data + param->offset), param->bytes - VARSTR_HEADER_SIZE, &output)) { return TSDB_CODE_TSC_INVALID_VALUE; - } + } varDataSetLen(data + param->offset, output); return TSDB_CODE_SUCCESS; } @@ -358,7 +740,7 @@ static int insertStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) { } // actual work of all data blocks is done, update block size and numOfRows. - // note we don't do this block by block during the binding process, because + // note we don't do this block by block during the binding process, because // we cannot recover if something goes wrong. pCmd->batchSize = binded * 2 + 1; @@ -405,7 +787,7 @@ static int insertStmtReset(STscStmt* pStmt) { } } pCmd->batchSize = 0; - + STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); pTableMetaInfo->vgroupIndex = 0; return TSDB_CODE_SUCCESS; @@ -447,7 +829,7 @@ static int insertStmtExecute(STscStmt* stmt) { pRes->numOfRows = 0; pRes->numOfTotal = 0; pRes->numOfClauseTotal = 0; - + pRes->qhandle = 0; pSql->cmd.insertType = 0; @@ -508,35 +890,35 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { SSqlObj* pSql = pStmt->pSql; size_t sqlLen = strlen(sql); - + SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; pSql->param = (void*) pSql; pSql->fp = waitForQueryRsp; pSql->cmd.insertType = TSDB_QUERY_TYPE_STMT_INSERT; - + if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE)) { tscError("%p failed to malloc payload buffer", pSql); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - + pSql->sqlstr = realloc(pSql->sqlstr, sqlLen + 1); - + if (pSql->sqlstr == NULL) { tscError("%p failed to malloc sql string buffer", pSql); free(pCmd->payload); return TSDB_CODE_TSC_OUT_OF_MEMORY; } - + pRes->qhandle = 0; pRes->numOfRows = 1; - + strtolower(pSql->sqlstr, sql); tscDebugL("%p SQL: %s", pSql, pSql->sqlstr); - if (tscIsInsertData(pSql->sqlstr)) { + if (tscIsInsertData(pSql->sqlstr)) { pStmt->isInsert = true; - + pSql->cmd.numOfParams = 0; pSql->cmd.batchSize = 0; @@ -548,7 +930,7 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) { tsem_wait(&pSql->rspSem); return pSql->res.code; } - + return code; } @@ -637,3 +1019,80 @@ TAOS_RES *taos_stmt_use_result(TAOS_STMT* stmt) { pStmt->pSql = NULL; return result; } + +int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert) { + STscStmt* pStmt = (STscStmt*)stmt; + + if (stmt == NULL || pStmt->taos == NULL || pStmt->pSql == NULL) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + return TSDB_CODE_TSC_DISCONNECTED; + } + + if (insert) *insert = pStmt->isInsert; + + return TSDB_CODE_SUCCESS; +} + +int taos_stmt_num_params(TAOS_STMT *stmt, int *nums) { + STscStmt* pStmt = (STscStmt*)stmt; + + if (stmt == NULL || pStmt->taos == NULL || pStmt->pSql == NULL) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + return TSDB_CODE_TSC_DISCONNECTED; + } + + if (pStmt->isInsert) { + SSqlObj* pSql = pStmt->pSql; + SSqlCmd *pCmd = &pSql->cmd; + *nums = pCmd->numOfParams; + return TSDB_CODE_SUCCESS; + } else { + SNormalStmt* normal = &pStmt->normal; + *nums = normal->numParams; + return TSDB_CODE_SUCCESS; + } +} + +int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes) { + STscStmt* pStmt = (STscStmt*)stmt; + + if (stmt == NULL || pStmt->taos == NULL || pStmt->pSql == NULL) { + terrno = TSDB_CODE_TSC_DISCONNECTED; + return TSDB_CODE_TSC_DISCONNECTED; + } + + if (pStmt->isInsert) { + SSqlObj* pSql = pStmt->pSql; + SSqlCmd *pCmd = &pSql->cmd; + STableDataBlocks* pBlock = taosArrayGetP(pCmd->pDataBlocks, 0); + + assert(pCmd->numOfParams == pBlock->numOfParams); + if (idx < 0 || idx >= pBlock->numOfParams) return -1; + + SParamInfo* param = pBlock->params + idx; + if (type) *type = param->type; + if (bytes) *bytes = param->bytes; + + return TSDB_CODE_SUCCESS; + } else { + return TSDB_CODE_TSC_APP_ERROR; + } +} + +const char *taos_data_type(int type) { + switch (type) { + case TSDB_DATA_TYPE_NULL: return "TSDB_DATA_TYPE_NULL"; + case TSDB_DATA_TYPE_BOOL: return "TSDB_DATA_TYPE_BOOL"; + case TSDB_DATA_TYPE_TINYINT: return "TSDB_DATA_TYPE_TINYINT"; + case TSDB_DATA_TYPE_SMALLINT: return "TSDB_DATA_TYPE_SMALLINT"; + case TSDB_DATA_TYPE_INT: return "TSDB_DATA_TYPE_INT"; + case TSDB_DATA_TYPE_BIGINT: return "TSDB_DATA_TYPE_BIGINT"; + case TSDB_DATA_TYPE_FLOAT: return "TSDB_DATA_TYPE_FLOAT"; + case TSDB_DATA_TYPE_DOUBLE: return "TSDB_DATA_TYPE_DOUBLE"; + case TSDB_DATA_TYPE_BINARY: return "TSDB_DATA_TYPE_BINARY"; + case TSDB_DATA_TYPE_TIMESTAMP: return "TSDB_DATA_TYPE_TIMESTAMP"; + case TSDB_DATA_TYPE_NCHAR: return "TSDB_DATA_TYPE_NCHAR"; + default: return "UNKNOWN"; + } +} + diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c index f2f997a59494ab7ab4e8da31edb4b819730e30c4..eb6843b0e4fd844c9d13da7f55dca47008f62a79 100644 --- a/src/client/src/tscProfile.c +++ b/src/client/src/tscProfile.c @@ -20,8 +20,10 @@ #include "tutil.h" #include "taosmsg.h" +#include "taos.h" + void tscSaveSlowQueryFp(void *handle, void *tmrId); -void *tscSlowQueryConn = NULL; +TAOS *tscSlowQueryConn = NULL; bool tscSlowQueryConnInitialized = false; void tscInitConnCb(void *param, TAOS_RES *result, int code) { @@ -151,10 +153,12 @@ void tscKillQuery(STscObj *pObj, uint32_t killId) { pthread_mutex_unlock(&pObj->mutex); - if (pSql == NULL) return; - - tscDebug("%p query is killed, queryId:%d", pSql, killId); - taos_stop_query(pSql); + if (pSql == NULL) { + tscError("failed to kill query, id:%d, it may have completed/terminated", killId); + } else { + tscDebug("%p query is killed, queryId:%d", pSql, killId); + taos_stop_query(pSql); + } } void tscAddIntoStreamList(SSqlStream *pStream) { @@ -242,6 +246,7 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) { pQdesc->stime = htobe64(pSql->stime); pQdesc->queryId = htonl(pSql->queryId); pQdesc->useconds = htobe64(pSql->res.useconds); + pQdesc->qHandle = htobe64(pSql->res.qhandle); pHeartbeat->numOfQueries++; pQdesc++; diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index b65d7b7112f27358bab82308d4891b99c6f8daa3..e2573f7e19303966e9f17a2731444bf9fca7ab87 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -122,7 +122,7 @@ static int32_t doCheckForCreateTable(SSqlObj* pSql, int32_t subClauseIndex, SSql static int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo); static int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo); static int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index); -static int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pSqlExpr, SArray* pExprInfo, SQueryInfo* pQueryInfo, SArray* pCols); +static int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pSqlExpr, SQueryInfo* pQueryInfo, SArray* pCols, int64_t *uid); /* * Used during parsing query sql. Since the query sql usually small in length, error position @@ -190,7 +190,8 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) { SSqlRes* pRes = &pSql->res; int32_t code = TSDB_CODE_SUCCESS; - if (!pInfo->valid) { + if (!pInfo->valid || terrno == TSDB_CODE_TSC_SQL_SYNTAX_ERROR) { + terrno = TSDB_CODE_SUCCESS; // clear the error number return tscSQLSyntaxErrMsg(tscGetErrorMsgPayload(pCmd), NULL, pInfo->pzErrMsg); } @@ -626,6 +627,11 @@ int32_t parseIntervalClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQ return TSDB_CODE_SUCCESS; } + // orderby column not set yet, set it to be the primary timestamp column + if (pQueryInfo->order.orderColId == INT32_MIN) { + pQueryInfo->order.orderColId = PRIMARYKEY_TIMESTAMP_COL_INDEX; + } + // interval is not null SStrToken* t = &pQuerySql->interval; if (parseNatualDuration(t->z, t->n, &pQueryInfo->interval.interval, &pQueryInfo->interval.intervalUnit) != TSDB_CODE_SUCCESS) { @@ -1200,6 +1206,10 @@ int32_t setObjFullName(char* fullName, const char* account, SStrToken* pDB, SStr return (totalLen < TSDB_TABLE_FNAME_LEN) ? TSDB_CODE_SUCCESS : TSDB_CODE_TSC_INVALID_SQL; } +static void tscInsertPrimaryTSSourceColumn(SQueryInfo* pQueryInfo, SColumnIndex* pIndex) { + SColumnIndex tsCol = {.tableIndex = pIndex->tableIndex, .columnIndex = PRIMARYKEY_TIMESTAMP_COL_INDEX}; + tscColumnListInsert(pQueryInfo->colList, &tsCol); +} static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t exprIndex, tSQLExprItem* pItem) { const char* msg1 = "invalid column name, or illegal column type"; const char* msg2 = "invalid arithmetic expression in select clause"; @@ -1240,7 +1250,7 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t tExprNode* pNode = NULL; SArray* colList = taosArrayInit(10, sizeof(SColIndex)); - int32_t ret = exprTreeFromSqlExpr(pCmd, &pNode, pItem->pNode, pQueryInfo->exprList, pQueryInfo, colList); + int32_t ret = exprTreeFromSqlExpr(pCmd, &pNode, pItem->pNode, pQueryInfo, colList, NULL); if (ret != TSDB_CODE_SUCCESS) { taosArrayDestroy(colList); tExprTreeDestroy(&pNode, NULL); @@ -1275,6 +1285,8 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t addExprParams(pExpr, c, TSDB_DATA_TYPE_BINARY, (int32_t)len, index.tableIndex); insertResultField(pQueryInfo, exprIndex, &columnList, sizeof(double), TSDB_DATA_TYPE_DOUBLE, pExpr->aliasName, pExpr); + // add ts column + tscInsertPrimaryTSSourceColumn(pQueryInfo, &index); tbufCloseWriter(&bw); taosArrayDestroy(colList); @@ -1294,17 +1306,17 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t insertResultField(pQueryInfo, exprIndex, &columnList, sizeof(double), TSDB_DATA_TYPE_DOUBLE, aliasName, NULL); int32_t slot = tscNumOfFields(pQueryInfo) - 1; - SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, slot); + SInternalField* pInfo = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, slot); if (pInfo->pSqlExpr == NULL) { SExprInfo* pArithExprInfo = calloc(1, sizeof(SExprInfo)); // arithmetic expression always return result in the format of double float - pArithExprInfo->bytes = sizeof(double); + pArithExprInfo->bytes = sizeof(double); pArithExprInfo->interBytes = sizeof(double); - pArithExprInfo->type = TSDB_DATA_TYPE_DOUBLE; + pArithExprInfo->type = TSDB_DATA_TYPE_DOUBLE; - int32_t ret = exprTreeFromSqlExpr(pCmd, &pArithExprInfo->pExpr, pItem->pNode, pQueryInfo->exprList, pQueryInfo, NULL); + int32_t ret = exprTreeFromSqlExpr(pCmd, &pArithExprInfo->pExpr, pItem->pNode, pQueryInfo, NULL, &pArithExprInfo->uid); if (ret != TSDB_CODE_SUCCESS) { tExprTreeDestroy(&pArithExprInfo->pExpr, NULL); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), "invalid expression in select clause"); @@ -1317,10 +1329,6 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t return TSDB_CODE_SUCCESS; } -static void tscInsertPrimaryTSSourceColumn(SQueryInfo* pQueryInfo, SColumnIndex* pIndex) { - SColumnIndex tsCol = {.tableIndex = pIndex->tableIndex, .columnIndex = PRIMARYKEY_TIMESTAMP_COL_INDEX}; - tscColumnListInsert(pQueryInfo->colList, &tsCol); -} static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumnIndex* pIndex, tSQLExprItem* pItem) { SSqlExpr* pExpr = doAddProjectCol(pQueryInfo, startPos, pIndex->columnIndex, pIndex->tableIndex); @@ -1345,6 +1353,32 @@ static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumn insertResultField(pQueryInfo, startPos, &ids, pExpr->resBytes, (int8_t)pExpr->resType, pExpr->aliasName, pExpr); } +static void addPrimaryTsColIntoResult(SQueryInfo* pQueryInfo) { + // primary timestamp column has been added already + size_t size = tscSqlExprNumOfExprs(pQueryInfo); + for (int32_t i = 0; i < size; ++i) { + SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i); + if (pExpr->functionId == TSDB_FUNC_PRJ && pExpr->colInfo.colId == PRIMARYKEY_TIMESTAMP_COL_INDEX) { + return; + } + } + + SColumnIndex index = {0}; + + // set the constant column value always attached to first table. + STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, PRIMARYKEY_TIMESTAMP_COL_INDEX); + + // add the timestamp column into the output columns + int32_t numOfCols = (int32_t)tscSqlExprNumOfExprs(pQueryInfo); + tscAddSpecialColumnForSelect(pQueryInfo, numOfCols, TSDB_FUNC_PRJ, &index, pSchema, TSDB_COL_NORMAL); + + SInternalField* pSupInfo = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, numOfCols); + pSupInfo->visible = false; + + pQueryInfo->type |= TSDB_QUERY_TYPE_PROJECTION_QUERY; +} + int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSelection, bool isSTable, bool joinQuery) { assert(pSelection != NULL && pCmd != NULL); @@ -1398,20 +1432,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, tSQLExprList* pSel // there is only one user-defined column in the final result field, add the timestamp column. size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList); if (numOfSrcCols <= 0 && !tscQueryTags(pQueryInfo)) { - SColumnIndex index = {0}; - - // set the constant column value always attached to first table. - STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, clauseIndex, 0); - SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, PRIMARYKEY_TIMESTAMP_COL_INDEX); - - // add the timestamp column into the output columns - int32_t numOfCols = (int32_t)tscSqlExprNumOfExprs(pQueryInfo); - tscAddSpecialColumnForSelect(pQueryInfo, numOfCols, TSDB_FUNC_PRJ, &index, pSchema, TSDB_COL_NORMAL); - - SFieldSupInfo* pSupInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, numOfCols); - pSupInfo->visible = false; - - pQueryInfo->type |= TSDB_QUERY_TYPE_PROJECTION_QUERY; + addPrimaryTsColIntoResult(pQueryInfo); } if (!functionCompatibleCheck(pQueryInfo, joinQuery)) { @@ -1449,7 +1470,7 @@ int32_t insertResultField(SQueryInfo* pQueryInfo, int32_t outputIndex, SColumnLi } TAOS_FIELD f = tscCreateField(type, fieldName, bytes); - SFieldSupInfo* pInfo = tscFieldInfoInsert(&pQueryInfo->fieldsInfo, outputIndex, &f); + SInternalField* pInfo = tscFieldInfoInsert(&pQueryInfo->fieldsInfo, outputIndex, &f); pInfo->pSqlExpr = pSqlExpr; return TSDB_CODE_SUCCESS; @@ -1603,8 +1624,8 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t return TSDB_CODE_SUCCESS; } -static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSchema* pSchema, SConvertFunc cvtFunc, char* aliasName, - int32_t resColIdx, SColumnIndex* pColIndex) { +static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSchema* pSchema, SConvertFunc cvtFunc, + char* aliasName, int32_t resColIdx, SColumnIndex* pColIndex, bool finalResult) { const char* msg1 = "not support column types"; int16_t type = 0; @@ -1650,8 +1671,13 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS SColumnIndex index = {.tableIndex = pColIndex->tableIndex, .columnIndex = PRIMARYKEY_TIMESTAMP_COL_INDEX}; tscColumnListInsert(pQueryInfo->colList, &index); + // if it is not in the final result, do not add it SColumnList ids = getColumnList(1, pColIndex->tableIndex, pColIndex->columnIndex); - insertResultField(pQueryInfo, resColIdx, &ids, bytes, (int8_t)type, columnName, pExpr); + if (finalResult) { + insertResultField(pQueryInfo, resColIdx, &ids, bytes, (int8_t)type, columnName, pExpr); + } else { + tscColumnListInsert(pQueryInfo->colList, &(ids.ids[0])); + } return TSDB_CODE_SUCCESS; } @@ -1926,7 +1952,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col for (int32_t j = 0; j < tscGetNumOfColumns(pTableMetaInfo->pTableMeta); ++j) { index.columnIndex = j; - if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, pItem->aliasName, colIndex++, &index) != 0) { + if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, pItem->aliasName, colIndex++, &index, finalResult) != 0) { return TSDB_CODE_TSC_INVALID_SQL; } } @@ -1943,7 +1969,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col if ((index.columnIndex >= tscGetNumOfColumns(pTableMetaInfo->pTableMeta)) || (index.columnIndex < 0)) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg6); } - if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, pItem->aliasName, colIndex + i, &index) != 0) { + + if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, pItem->aliasName, colIndex + i, &index, finalResult) != 0) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -1980,7 +2007,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col for (int32_t i = 0; i < tscGetNumOfColumns(pTableMetaInfo->pTableMeta); ++i) { SColumnIndex index = {.tableIndex = j, .columnIndex = i}; - if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, pItem->aliasName, colIndex, &index) != 0) { + if (setExprInfoForFunctions(pCmd, pQueryInfo, pSchema, cvtFunc, pItem->aliasName, colIndex, &index, finalResult) != 0) { return TSDB_CODE_TSC_INVALID_SQL; } @@ -3358,10 +3385,26 @@ static int32_t validateSQLExpr(SSqlCmd* pCmd, tSQLExpr* pExpr, SQueryInfo* pQuer tSQLExprItem item = {.pNode = pExpr, .aliasName = NULL}; - // sql function in selection clause, append sql function info in pSqlCmd structure sequentially + // sql function list in selection clause. + // Append the sqlExpr into exprList of pQueryInfo structure sequentially if (addExprAndResultField(pCmd, pQueryInfo, outputIndex, &item, false) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_SQL; } + + // It is invalid in case of more than one sqlExpr, such as first(ts, k) - last(ts, k) + int32_t inc = (int32_t) tscSqlExprNumOfExprs(pQueryInfo) - outputIndex; + if (inc > 1) { + return TSDB_CODE_TSC_INVALID_SQL; + } + + // Not supported data type in arithmetic expression + for(int32_t i = 0; i < inc; ++i) { + SSqlExpr* p1 = tscSqlExprGet(pQueryInfo, i + outputIndex); + int16_t t = p1->resType; + if (t == TSDB_DATA_TYPE_BINARY || t == TSDB_DATA_TYPE_NCHAR || t == TSDB_DATA_TYPE_BOOL || t == TSDB_DATA_TYPE_TIMESTAMP) { + return TSDB_CODE_TSC_INVALID_SQL; + } + } } return TSDB_CODE_SUCCESS; @@ -4036,7 +4079,7 @@ static int32_t getTagQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondE tExprNode* p = NULL; SArray* colList = taosArrayInit(10, sizeof(SColIndex)); - ret = exprTreeFromSqlExpr(pCmd, &p, p1, NULL, pQueryInfo, colList); + ret = exprTreeFromSqlExpr(pCmd, &p, p1, pQueryInfo, colList, NULL); SBufferWriter bw = tbufInitWriter(NULL, false); TRY(0) { @@ -4363,14 +4406,13 @@ int32_t parseFillClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQuery static void setDefaultOrderInfo(SQueryInfo* pQueryInfo) { /* set default timestamp order information for all queries */ - pQueryInfo->order.order = TSDB_ORDER_ASC; STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); + pQueryInfo->order.order = TSDB_ORDER_ASC; if (isTopBottomQuery(pQueryInfo)) { - pQueryInfo->order.order = TSDB_ORDER_ASC; pQueryInfo->order.orderColId = PRIMARYKEY_TIMESTAMP_COL_INDEX; - } else { - pQueryInfo->order.orderColId = -1; + } else { // in case of select tbname from super_table, the defualt order column can not be the primary ts column + pQueryInfo->order.orderColId = INT32_MIN; } /* for super table query, set default ascending order for group output */ @@ -4474,6 +4516,11 @@ int32_t parseOrderbyClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQu } else { pQueryInfo->order.order = pSortorder->a[0].sortOrder; pQueryInfo->order.orderColId = PRIMARYKEY_TIMESTAMP_COL_INDEX; + + // orderby ts query on super table + if (tscOrderedProjectionQueryOnSTable(pQueryInfo, 0)) { + addPrimaryTsColIntoResult(pQueryInfo); + } } } @@ -4703,7 +4750,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { // validate the length of binary if ((pTagsSchema->type == TSDB_DATA_TYPE_BINARY || pTagsSchema->type == TSDB_DATA_TYPE_NCHAR) && - (pVarList->a[1].pVar.nLen + VARSTR_HEADER_SIZE) > pTagsSchema->bytes) { + varDataTLen(pAlterSQL->tagData.data) > pTagsSchema->bytes) { return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg14); } @@ -5229,26 +5276,6 @@ int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDBInfo* pCreateDbSql) { return TSDB_CODE_SUCCESS; } -//void tscAddTimestampColumn(SQueryInfo* pQueryInfo, int16_t functionId, int16_t tableIndex) { -// // the first column not timestamp column, add it -// SSqlExpr* pExpr = NULL; -// if (tscSqlExprNumOfExprs(pQueryInfo) > 0) { -// pExpr = tscSqlExprGet(pQueryInfo, 0); -// } -// -// if (pExpr == NULL || pExpr->colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX || pExpr->functionId != functionId) { -// SColumnIndex index = {tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX}; -// -// pExpr = tscSqlExprInsert(pQueryInfo, 0, functionId, &index, TSDB_DATA_TYPE_TIMESTAMP, TSDB_KEYSIZE, TSDB_KEYSIZE, false); -// pExpr->colInfo.flag = TSDB_COL_NORMAL; -// -// // NOTE: tag column does not add to source column list -// SColumnList ids = getColumnList(1, tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX); -// -// insertResultField(pQueryInfo, 0, &ids, TSDB_KEYSIZE, TSDB_DATA_TYPE_TIMESTAMP, "ts", pExpr); -// } -//} - void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClauseIndex, int32_t tableIndex) { SQueryInfo* pParentQueryInfo = tscGetQueryInfoDetail(&pParentObj->cmd, subClauseIndex); @@ -5305,7 +5332,7 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex) { tscAddSpecialColumnForSelect(pQueryInfo, (int32_t)size, TSDB_FUNC_PRJ, &colIndex, pSchema, TSDB_COL_NORMAL); - SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, (int32_t)size); + SInternalField* pInfo = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, (int32_t)size); doLimitOutputNormalColOfGroupby(pInfo->pSqlExpr); pInfo->visible = false; } @@ -6269,6 +6296,11 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { return TSDB_CODE_TSC_INVALID_SQL; } + // set order by info + if (parseOrderbyClause(pCmd, pQueryInfo, pQuerySql, tscGetTableSchema(pTableMetaInfo->pTableMeta)) != TSDB_CODE_SUCCESS) { + return TSDB_CODE_TSC_INVALID_SQL; + } + // set interval value if (parseIntervalClause(pCmd, pQueryInfo, pQuerySql) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_SQL; @@ -6279,11 +6311,6 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { } } - // set order by info - if (parseOrderbyClause(pCmd, pQueryInfo, pQuerySql, tscGetTableSchema(pTableMetaInfo->pTableMeta)) != TSDB_CODE_SUCCESS) { - return TSDB_CODE_TSC_INVALID_SQL; - } - // user does not specified the query time window, twa is not allowed in such case. if ((pQueryInfo->window.skey == INT64_MIN || pQueryInfo->window.ekey == INT64_MAX || (pQueryInfo->window.ekey == INT64_MAX / 1000 && tinfo.precision == TSDB_TIME_PRECISION_MILLI)) && tscIsTWAQuery(pQueryInfo)) { @@ -6350,19 +6377,19 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) { return TSDB_CODE_SUCCESS; // Does not build query message here } -int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pSqlExpr, SArray* pExprInfo, SQueryInfo* pQueryInfo, SArray* pCols) { +int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pSqlExpr, SQueryInfo* pQueryInfo, SArray* pCols, int64_t *uid) { tExprNode* pLeft = NULL; tExprNode* pRight= NULL; if (pSqlExpr->pLeft != NULL) { - int32_t ret = exprTreeFromSqlExpr(pCmd, &pLeft, pSqlExpr->pLeft, pExprInfo, pQueryInfo, pCols); + int32_t ret = exprTreeFromSqlExpr(pCmd, &pLeft, pSqlExpr->pLeft, pQueryInfo, pCols, uid); if (ret != TSDB_CODE_SUCCESS) { return ret; } } if (pSqlExpr->pRight != NULL) { - int32_t ret = exprTreeFromSqlExpr(pCmd, &pRight, pSqlExpr->pRight, pExprInfo, pQueryInfo, pCols); + int32_t ret = exprTreeFromSqlExpr(pCmd, &pRight, pSqlExpr->pRight, pQueryInfo, pCols, uid); if (ret != TSDB_CODE_SUCCESS) { return ret; } @@ -6389,14 +6416,19 @@ int32_t exprTreeFromSqlExpr(SSqlCmd* pCmd, tExprNode **pExpr, const tSQLExpr* pS strncpy((*pExpr)->pSchema->name, pSqlExpr->operand.z, pSqlExpr->operand.n); // set the input column data byte and type. - size_t size = taosArrayGetSize(pExprInfo); + size_t size = taosArrayGetSize(pQueryInfo->exprList); for (int32_t i = 0; i < size; ++i) { - SSqlExpr* p1 = taosArrayGetP(pExprInfo, i); + SSqlExpr* p1 = taosArrayGetP(pQueryInfo->exprList, i); if (strcmp((*pExpr)->pSchema->name, p1->aliasName) == 0) { - (*pExpr)->pSchema->type = (uint8_t)p1->resType; + (*pExpr)->pSchema->type = (uint8_t)p1->resType; (*pExpr)->pSchema->bytes = p1->resBytes; + + if (uid != NULL) { + *uid = p1->uid; + } + break; } } diff --git a/src/client/src/tscSchemaUtil.c b/src/client/src/tscSchemaUtil.c index 1e841c68fdad040e53b41ca749dd686c4cbb5e2e..dfd707344c5ab3ec42b49859937f604fa477fe10 100644 --- a/src/client/src/tscSchemaUtil.c +++ b/src/client/src/tscSchemaUtil.c @@ -145,10 +145,11 @@ static void tscInitCorVgroupInfo(SCMCorVgroupInfo *corVgroupInfo, SCMVgroupInfo corVgroupInfo->inUse = 0; corVgroupInfo->numOfEps = vgroupInfo->numOfEps; for (int32_t i = 0; i < corVgroupInfo->numOfEps; i++) { - strncpy(corVgroupInfo->epAddr[i].fqdn, vgroupInfo->epAddr[i].fqdn, TSDB_FQDN_LEN); + corVgroupInfo->epAddr[i].fqdn = strdup(vgroupInfo->epAddr[i].fqdn); corVgroupInfo->epAddr[i].port = vgroupInfo->epAddr[i].port; } } + STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size) { assert(pTableMetaMsg != NULL); @@ -162,9 +163,19 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size .numOfColumns = pTableMetaMsg->numOfColumns, }; - pTableMeta->id.tid = pTableMetaMsg->sid; + pTableMeta->id.tid = pTableMetaMsg->tid; pTableMeta->id.uid = pTableMetaMsg->uid; - pTableMeta->vgroupInfo = pTableMetaMsg->vgroup; + + SCMVgroupInfo* pVgroupInfo = &pTableMeta->vgroupInfo; + pVgroupInfo->numOfEps = pTableMetaMsg->vgroup.numOfEps; + pVgroupInfo->vgId = pTableMetaMsg->vgroup.vgId; + + for(int32_t i = 0; i < pVgroupInfo->numOfEps; ++i) { + SEpAddrMsg* pEpMsg = &pTableMetaMsg->vgroup.epAddr[i]; + + pVgroupInfo->epAddr[i].fqdn = strndup(pEpMsg->fqdn, tListLen(pEpMsg->fqdn)); + pVgroupInfo->epAddr[i].port = pEpMsg->port; + } tscInitCorVgroupInfo(&pTableMeta->corVgroupInfo, &pTableMeta->vgroupInfo); diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index d3c02011690fd20e0cb7d7aaf7b98877581bbb42..a0841fa2344682facb4a6dc8666716e38a31ea1d 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -24,7 +24,6 @@ #include "tschemautil.h" #include "tsclient.h" #include "ttimer.h" -#include "tutil.h" #include "tlockfree.h" SRpcCorEpSet tscMgmtEpSet; @@ -125,9 +124,11 @@ static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcEpSet *pEpSet) { pVgroupInfo->inUse = pEpSet->inUse; pVgroupInfo->numOfEps = pEpSet->numOfEps; for (int32_t i = 0; i < pVgroupInfo->numOfEps; i++) { - tstrncpy(pVgroupInfo->epAddr[i].fqdn, pEpSet->fqdn[i], TSDB_FQDN_LEN); + taosTFree(pVgroupInfo->epAddr[i].fqdn); + pVgroupInfo->epAddr[i].fqdn = strndup(pEpSet->fqdn[i], tListLen(pEpSet->fqdn[i])); pVgroupInfo->epAddr[i].port = pEpSet->port[i]; } + tscDebug("after: EndPoint in use: %d", pVgroupInfo->inUse); taosCorEndWrite(&pVgroupInfo->version); } @@ -198,15 +199,19 @@ void tscProcessActivityTimer(void *handle, void *tmrId) { return; } - if (tscShouldFreeHeartBeat(pHB)) { - tscDebug("%p free HB object and release connection", pHB); - pObj->pHb = 0; - taos_free_result(pHB); - } else { - int32_t code = tscProcessSql(pHB); - if (code != TSDB_CODE_SUCCESS) { - tscError("%p failed to sent HB to server, reason:%s", pHB, tstrerror(code)); - } + void** p = taosCacheAcquireByKey(tscObjCache, &pHB, sizeof(TSDB_CACHE_PTR_TYPE)); + if (p == NULL) { + tscWarn("%p HB object has been released already", pHB); + return; + } + + assert(*pHB->self == pHB); + + int32_t code = tscProcessSql(pHB); + taosCacheRelease(tscObjCache, (void**) &p, false); + + if (code != TSDB_CODE_SUCCESS) { + tscError("%p failed to sent HB to server, reason:%s", pHB, tstrerror(code)); } } @@ -464,35 +469,6 @@ int tscProcessSql(SSqlObj *pSql) { return doProcessSql(pSql); } -void tscKillSTableQuery(SSqlObj *pSql) { - SSqlCmd* pCmd = &pSql->cmd; - - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - if (!tscIsTwoStageSTableQuery(pQueryInfo, 0)) { - return; - } - - pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED; - - for (int i = 0; i < pSql->numOfSubs; ++i) { - // NOTE: pSub may have been released already here - SSqlObj *pSub = pSql->pSubs[i]; - if (pSub == NULL) { - continue; - } - - pSub->res.code = TSDB_CODE_TSC_QUERY_CANCELLED; - if (pSub->pRpcCtx != NULL) { - rpcCancelRequest(pSub->pRpcCtx); - pSub->pRpcCtx = NULL; - } - - tscQueueAsyncRes(pSub); // async res? not other functions? - } - - tscDebug("%p super table query cancelled", pSql); -} - int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SRetrieveTableMsg *pRetrieveMsg = (SRetrieveTableMsg *) pSql->cmd.payload; pRetrieveMsg->qhandle = htobe64(pSql->res.qhandle); @@ -1392,7 +1368,7 @@ static int tscSetResultPointer(SQueryInfo *pQueryInfo, SSqlRes *pRes) { for (int i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) { int16_t offset = tscFieldInfoGetOffset(pQueryInfo, i); - pRes->tsrow[i] = ((char*) pRes->data + offset * pRes->numOfRows); + pRes->tsrow[i] = (unsigned char*)((char*) pRes->data + offset * pRes->numOfRows); } return 0; @@ -1451,7 +1427,7 @@ int tscProcessLocalRetrieveRsp(SSqlObj *pSql) { int tscProcessRetrieveLocalMergeRsp(SSqlObj *pSql) { SSqlRes *pRes = &pSql->res; - SSqlCmd *pCmd = &pSql->cmd; + SSqlCmd* pCmd = &pSql->cmd; int32_t code = pRes->code; if (pRes->code != TSDB_CODE_SUCCESS) { @@ -1494,6 +1470,7 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SCMConnectMsg *pConnect = (SCMConnectMsg*)pCmd->payload; + // TODO refactor full_name char *db; // ugly code to move the space db = strstr(pObj->db, TS_PATH_DELIMITER); db = (db == NULL) ? pObj->db : db + 1; @@ -1501,6 +1478,9 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) { tstrncpy(pConnect->clientVersion, version, sizeof(pConnect->clientVersion)); tstrncpy(pConnect->msgVersion, "", sizeof(pConnect->msgVersion)); + pConnect->pid = htonl(taosGetPId()); + taosGetCurrentAPPName(pConnect->appName, NULL); + return TSDB_CODE_SUCCESS; } @@ -1653,6 +1633,10 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) { SCMHeartBeatMsg *pHeartbeat = (SCMHeartBeatMsg *)pCmd->payload; pHeartbeat->numOfQueries = numOfQueries; pHeartbeat->numOfStreams = numOfStreams; + + pHeartbeat->pid = htonl(taosGetPId()); + taosGetCurrentAPPName(pHeartbeat->appName, NULL); + int msgLen = tscBuildQueryStreamDesc(pHeartbeat, pObj); pthread_mutex_unlock(&pObj->mutex); @@ -1666,7 +1650,7 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscProcessTableMetaRsp(SSqlObj *pSql) { STableMetaMsg *pMetaMsg = (STableMetaMsg *)pSql->res.pRsp; - pMetaMsg->sid = htonl(pMetaMsg->sid); + pMetaMsg->tid = htonl(pMetaMsg->tid); pMetaMsg->sversion = htons(pMetaMsg->sversion); pMetaMsg->tversion = htons(pMetaMsg->tversion); pMetaMsg->vgroup.vgId = htonl(pMetaMsg->vgroup.vgId); @@ -1676,9 +1660,9 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { pMetaMsg->numOfColumns = htons(pMetaMsg->numOfColumns); if ((pMetaMsg->tableType != TSDB_SUPER_TABLE) && - (pMetaMsg->sid <= 0 || pMetaMsg->vgroup.vgId < 2 || pMetaMsg->vgroup.numOfEps <= 0)) { + (pMetaMsg->tid <= 0 || pMetaMsg->vgroup.vgId < 2 || pMetaMsg->vgroup.numOfEps <= 0)) { tscError("invalid value in table numOfEps:%d, vgId:%d tid:%d, name:%s", pMetaMsg->vgroup.numOfEps, pMetaMsg->vgroup.vgId, - pMetaMsg->sid, pMetaMsg->tableId); + pMetaMsg->tid, pMetaMsg->tableId); return TSDB_CODE_TSC_INVALID_VALUE; } @@ -1857,22 +1841,30 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) { SSqlCmd* pCmd = &parent->cmd; for(int32_t i = 0; i < pStableVgroup->numOfTables; ++i) { STableMetaInfo *pInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, i); - SVgroupsInfo * pVgroupInfo = (SVgroupsInfo *)pMsg; - pVgroupInfo->numOfVgroups = htonl(pVgroupInfo->numOfVgroups); - size_t size = sizeof(SCMVgroupInfo) * pVgroupInfo->numOfVgroups + sizeof(SVgroupsInfo); - pInfo->vgroupList = calloc(1, size); + SVgroupsMsg * pVgroupMsg = (SVgroupsMsg *) pMsg; + pVgroupMsg->numOfVgroups = htonl(pVgroupMsg->numOfVgroups); + + size_t size = sizeof(SCMVgroupMsg) * pVgroupMsg->numOfVgroups + sizeof(SVgroupsMsg); + + size_t vgroupsz = sizeof(SCMVgroupInfo) * pVgroupMsg->numOfVgroups + sizeof(SVgroupsInfo); + pInfo->vgroupList = calloc(1, vgroupsz); assert(pInfo->vgroupList != NULL); - memcpy(pInfo->vgroupList, pVgroupInfo, size); + pInfo->vgroupList->numOfVgroups = pVgroupMsg->numOfVgroups; for (int32_t j = 0; j < pInfo->vgroupList->numOfVgroups; ++j) { //just init, no need to lock SCMVgroupInfo *pVgroups = &pInfo->vgroupList->vgroups[j]; - pVgroups->vgId = htonl(pVgroups->vgId); - assert(pVgroups->numOfEps >= 1); + + SCMVgroupMsg *vmsg = &pVgroupMsg->vgroups[j]; + pVgroups->vgId = htonl(vmsg->vgId); + pVgroups->numOfEps = vmsg->numOfEps; + + assert(pVgroups->numOfEps >= 1 && pVgroups->vgId >= 1); for (int32_t k = 0; k < pVgroups->numOfEps; ++k) { - pVgroups->epAddr[k].port = htons(pVgroups->epAddr[k].port); + pVgroups->epAddr[k].port = htons(vmsg->epAddr[k].port); + pVgroups->epAddr[k].fqdn = strndup(vmsg->epAddr[k].fqdn, tListLen(vmsg->epAddr[k].fqdn)); } } @@ -1908,7 +1900,7 @@ int tscProcessShowRsp(SSqlObj *pSql) { pMetaMsg->numOfColumns = ntohs(pMetaMsg->numOfColumns); pSchema = pMetaMsg->schema; - pMetaMsg->sid = ntohs(pMetaMsg->sid); + pMetaMsg->tid = ntohs(pMetaMsg->tid); for (int i = 0; i < pMetaMsg->numOfColumns; ++i) { pSchema->bytes = htons(pSchema->bytes); pSchema++; @@ -1942,7 +1934,7 @@ int tscProcessShowRsp(SSqlObj *pSql) { tscColumnListInsert(pQueryInfo->colList, &index); TAOS_FIELD f = tscCreateField(pSchema->type, pSchema->name, pSchema->bytes); - SFieldSupInfo* pInfo = tscFieldInfoAppend(pFieldInfo, &f); + SInternalField* pInfo = tscFieldInfoAppend(pFieldInfo, &f); pInfo->pSqlExpr = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TS_DUMMY, &index, pTableSchema[i].type, pTableSchema[i].bytes, pTableSchema[i].bytes, false); diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index acc38ac8ed5be82d0c0df19445e98bb47128589f..8cac9b3398a0bc4569b52acc7858bbc1e50de542 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -26,7 +26,9 @@ #include "tsclient.h" #include "ttokendef.h" #include "tutil.h" +#include "ttimer.h" #include "tscProfile.h" +#include "ttimer.h" static bool validImpl(const char* str, size_t maxsize) { if (str == NULL) { @@ -49,8 +51,8 @@ static bool validPassword(const char* passwd) { return validImpl(passwd, TSDB_PASSWORD_LEN - 1); } -SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, const char *auth, const char *db, - uint16_t port, void (*fp)(void *, TAOS_RES *, int), void *param, void **taos) { +static SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, const char *auth, const char *db, + uint16_t port, void (*fp)(void *, TAOS_RES *, int), void *param, TAOS **taos) { taos_init(); if (!validUserName(user)) { @@ -241,25 +243,39 @@ static void asyncConnCallback(void *param, TAOS_RES *tres, int code) { } TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int), - void *param, void **taos) { - SSqlObj* pSql = taosConnectImpl(ip, user, pass, NULL, db, port, asyncConnCallback, param, taos); + void *param, TAOS **taos) { + STscObj *pObj = NULL; + SSqlObj *pSql = taosConnectImpl(ip, user, pass, NULL, db, port, asyncConnCallback, param, (void **)&pObj); if (pSql == NULL) { return NULL; } - + + if (taos) *taos = pObj; + pSql->fetchFp = fp; pSql->res.code = tscProcessSql(pSql); tscDebug("%p DB async connection is opening", taos); - return taos; + return pObj; } void taos_close(TAOS *taos) { STscObj *pObj = (STscObj *)taos; - if (pObj == NULL || pObj->signature != pObj) { + if (pObj == NULL) { + tscDebug("(null) try to free tscObj and close dnodeConn"); + return; + } + + tscDebug("%p try to free tscObj and close dnodeConn:%p", pObj, pObj->pDnodeConn); + if (pObj->signature != pObj) { + tscDebug("%p already closed or invalid tscObj", pObj); return; } + // make sure that the close connection can only be executed once. + pObj->signature = NULL; + taosTmrStopA(&(pObj->pTimer)); + SSqlObj* pHb = pObj->pHb; if (pHb != NULL && atomic_val_compare_exchange_ptr(&pObj->pHb, pHb, 0) == pHb) { if (pHb->pRpcCtx != NULL) { // wait for rsp from dnode @@ -295,7 +311,7 @@ static void waitForRetrieveRsp(void *param, TAOS_RES *tres, int numOfRows) { tsem_post(&pSql->rspSem); } -TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen) { +TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, TAOS_RES** res) { STscObj *pObj = (STscObj *)taos; if (pObj == NULL || pObj->signature != pObj) { terrno = TSDB_CODE_TSC_DISCONNECTED; @@ -320,12 +336,20 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen) { tsem_init(&pSql->rspSem, 0, 0); doAsyncQuery(pObj, pSql, waitForQueryRsp, taos, sqlstr, sqlLen); + if (res != NULL) { + *res = pSql; + } + tsem_wait(&pSql->rspSem); return pSql; } TAOS_RES* taos_query(TAOS *taos, const char *sqlstr) { - return taos_query_c(taos, sqlstr, (uint32_t)strlen(sqlstr)); + return taos_query_c(taos, sqlstr, (uint32_t)strlen(sqlstr), NULL); +} + +TAOS_RES* taos_query_h(TAOS* taos, const char *sqlstr, TAOS_RES** res) { + return taos_query_c(taos, sqlstr, (uint32_t) strlen(sqlstr), res); } int taos_result_precision(TAOS_RES *res) { @@ -349,7 +373,7 @@ int taos_num_fields(TAOS_RES *res) { size_t numOfCols = tscNumOfFields(pQueryInfo); for(int32_t i = 0; i < numOfCols; ++i) { - SFieldSupInfo* pInfo = taosArrayGet(pQueryInfo->fieldsInfo.pSupportInfo, i); + SInternalField* pInfo = taosArrayGet(pQueryInfo->fieldsInfo.internalField, i); if (pInfo->visible) { num++; } @@ -385,8 +409,24 @@ TAOS_FIELD *taos_fetch_fields(TAOS_RES *res) { if (numOfCols == 0) { return NULL; } - - return pQueryInfo->fieldsInfo.pFields->pData; + + SFieldInfo *pFieldInfo = &pQueryInfo->fieldsInfo; + + if (pFieldInfo->final == NULL) { + TAOS_FIELD* f = calloc(pFieldInfo->numOfOutput, sizeof(TAOS_FIELD)); + + int32_t j = 0; + for(int32_t i = 0; i < pFieldInfo->numOfOutput; ++i) { + SInternalField* pField = tscFieldInfoGetInternalField(pFieldInfo, i); + if (pField->visible) { + f[j++] = pField->field; + } + } + + pFieldInfo->final = f; + } + + return pFieldInfo->final; } int taos_retrieve(TAOS_RES *res) { @@ -459,6 +499,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) { SSqlRes *pRes = &pSql->res; if (pRes->qhandle == 0 || + pRes->code == TSDB_CODE_TSC_QUERY_CANCELLED || pCmd->command == TSDB_SQL_RETRIEVE_EMPTY_RESULT || pCmd->command == TSDB_SQL_INSERT) { return NULL; @@ -522,7 +563,7 @@ int taos_fetch_block(TAOS_RES *res, TAOS_ROW *rows) { pRes->numOfClauseTotal = 0; pRes->rspType = 0; - pSql->numOfSubs = 0; + pSql->subState.numOfSub = 0; taosTFree(pSql->pSubs); assert(pSql->fp == NULL); @@ -566,7 +607,8 @@ static UNUSED_FUNC bool tscKillQueryInDnode(SSqlObj* pSql) { return true; } - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); + SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0); + if ((pQueryInfo == NULL) || tscIsTwoStageSTableQuery(pQueryInfo, 0)) { return true; } @@ -676,6 +718,46 @@ int* taos_fetch_lengths(TAOS_RES *res) { char *taos_get_client_info() { return version; } +static void tscKillSTableQuery(SSqlObj *pSql) { + SSqlCmd* pCmd = &pSql->cmd; + + SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); + + if (!tscIsTwoStageSTableQuery(pQueryInfo, 0)) { + return; + } + + // set the master sqlObj flag to cancel query + pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED; + + for (int i = 0; i < pSql->subState.numOfSub; ++i) { + // NOTE: pSub may have been released already here + SSqlObj *pSub = pSql->pSubs[i]; + if (pSub == NULL) { + continue; + } + + void** p = taosCacheAcquireByKey(tscObjCache, &pSub, sizeof(TSDB_CACHE_PTR_TYPE)); + if (p == NULL) { + continue; + } + + SSqlObj* pSubObj = (SSqlObj*) (*p); + assert(pSubObj->self == (SSqlObj**) p); + + pSubObj->res.code = TSDB_CODE_TSC_QUERY_CANCELLED; + if (pSubObj->pRpcCtx != NULL) { + rpcCancelRequest(pSubObj->pRpcCtx); + pSubObj->pRpcCtx = NULL; + } + + tscQueueAsyncRes(pSubObj); + taosCacheRelease(tscObjCache, (void**) &p, false); + } + + tscDebug("%p super table query cancelled", pSql); +} + void taos_stop_query(TAOS_RES *res) { SSqlObj *pSql = (SSqlObj *)res; if (pSql == NULL || pSql->signature != pSql) { @@ -685,23 +767,27 @@ void taos_stop_query(TAOS_RES *res) { tscDebug("%p start to cancel query", res); SSqlCmd *pCmd = &pSql->cmd; - // TODO there are multi-thread problem. - // It may have been released by the other thread already. - // The ref count may fix this problem. - SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - // set the error code for master pSqlObj firstly pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED; + SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); + if (tscIsTwoStageSTableQuery(pQueryInfo, 0)) { assert(pSql->pRpcCtx == NULL); tscKillSTableQuery(pSql); } else { if (pSql->cmd.command < TSDB_SQL_LOCAL) { + /* + * There is multi-thread problem here, since pSql->pRpcCtx may have been + * reset and freed in the processMsgFromServer function, and causes the invalid + * write problem for rpcCancelRequest. + */ if (pSql->pRpcCtx != NULL) { rpcCancelRequest(pSql->pRpcCtx); pSql->pRpcCtx = NULL; } + + tscQueueAsyncRes(pSql); } } @@ -814,7 +900,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) { if (pSql->sqlstr == NULL) { pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY; tscError("%p failed to malloc sql string buffer", pSql); - tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj); + tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(pSql), pObj); taosTFree(pSql); return pRes->code; } @@ -830,6 +916,8 @@ int taos_validate_sql(TAOS *taos, const char *sql) { pSql->fp = asyncCallback; pSql->fetchFp = asyncCallback; pSql->param = pSql; + + registerSqlObj(pSql); int code = tsParseSql(pSql, true); if (code == TSDB_CODE_TSC_ACTION_IN_PROGRESS) { tsem_wait(&pSql->rspSem); @@ -837,7 +925,7 @@ int taos_validate_sql(TAOS *taos, const char *sql) { } if (code != TSDB_CODE_SUCCESS) { - tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, code, taos_errstr(taos), pObj); + tscDebug("%p Valid SQL result:%d, %s pObj:%p", pSql, code, taos_errstr(pSql), pObj); } taos_free_result(pSql); @@ -981,7 +1069,7 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) { tscDoQuery(pSql); - tscDebug("%p load multi table meta result:%d %s pObj:%p", pSql, pRes->code, taos_errstr(taos), pObj); + tscDebug("%p load multi table meta result:%d %s pObj:%p", pSql, pRes->code, taos_errstr(pSql), pObj); if ((code = pRes->code) != TSDB_CODE_SUCCESS) { tscFreeSqlObj(pSql); } diff --git a/src/client/src/tscStream.c b/src/client/src/tscStream.c index d01ede279aaad882e26bada0c8a6bb7069747406..0f67911bbea992503979e5de019e4e10d3bf3c14 100644 --- a/src/client/src/tscStream.c +++ b/src/client/src/tscStream.c @@ -168,8 +168,8 @@ static void tscProcessStreamQueryCallback(void *param, TAOS_RES *tres, int numOf STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pStream->pSql->cmd, 0, 0); taosCacheRelease(tscMetaCache, (void**)&(pTableMetaInfo->pTableMeta), true); - taosTFree(pTableMetaInfo->vgroupList); - + pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList); + tscSetRetryTimer(pStream, pStream->pSql, retryDelay); return; } @@ -274,8 +274,8 @@ static void tscProcessStreamRetrieveResult(void *param, TAOS_RES *res, int numOf taosCacheRelease(tscMetaCache, (void**)&(pTableMetaInfo->pTableMeta), false); tscFreeSqlResult(pSql); taosTFree(pSql->pSubs); - pSql->numOfSubs = 0; - taosTFree(pTableMetaInfo->vgroupList); + pSql->subState.numOfSub = 0; + pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList); tscSetNextLaunchTimer(pStream, pSql); } } diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 390c3ca92d3b8398d6ca88f11d0c6e45f3f77010..6b615c3a9b14f97f57013f476b60acc0db53db53 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -26,7 +26,6 @@ #include "tscSubquery.h" typedef struct SInsertSupporter { - SSubqueryState* pState; SSqlObj* pSql; int32_t index; } SInsertSupporter; @@ -167,14 +166,13 @@ static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJ } // todo handle failed to create sub query -SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, SSubqueryState* pState, int32_t index) { +SJoinSupporter* tscCreateJoinSupporter(SSqlObj* pSql, int32_t index) { SJoinSupporter* pSupporter = calloc(1, sizeof(SJoinSupporter)); if (pSupporter == NULL) { return NULL; } pSupporter->pObj = pSql; - pSupporter->pState = pState; pSupporter->subqueryIndex = index; SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex); @@ -250,7 +248,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { SJoinSupporter* pSupporter = NULL; //If the columns are not involved in the final select clause, the corresponding query will not be issued. - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { pSupporter = pSql->pSubs[i]->param; if (taosArrayGetSize(pSupporter->exprList) > 0) { ++numOfSub; @@ -260,16 +258,15 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { assert(numOfSub > 0); // scan all subquery, if one sub query has only ts, ignore it - tscDebug("%p start to launch secondary subqueries, total:%d, only:%d needs to query", pSql, pSql->numOfSubs, numOfSub); + tscDebug("%p start to launch secondary subqueries, %d out of %d needs to query", pSql, numOfSub, pSql->subState.numOfSub); //the subqueries that do not actually launch the secondary query to virtual node is set as completed. - SSubqueryState* pState = pSupporter->pState; - pState->numOfTotal = pSql->numOfSubs; + SSubqueryState* pState = &pSql->subState; pState->numOfRemain = numOfSub; - + bool success = true; - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { SSqlObj *pPrevSub = pSql->pSubs[i]; pSql->pSubs[i] = NULL; @@ -322,7 +319,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { memset(&pSupporter->fieldsInfo, 0, sizeof(SFieldInfo)); SQueryInfo *pNewQueryInfo = tscGetQueryInfoDetail(&pNew->cmd, 0); - assert(pNew->numOfSubs == 0 && pNew->cmd.numOfClause == 1 && pNewQueryInfo->numOfTables == 1); + assert(pNew->subState.numOfSub == 0 && pNew->cmd.numOfClause == 1 && pNewQueryInfo->numOfTables == 1); tscFieldInfoUpdateOffset(pNewQueryInfo); @@ -373,13 +370,13 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { if (!success) { pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY; tscError("%p failed to prepare subqueries objs for secondary phase query, numOfSub:%d, code:%d", pSql, - pSql->numOfSubs, pSql->res.code); + pSql->subState.numOfSub, pSql->res.code); freeJoinSubqueryObj(pSql); return pSql->res.code; } - for(int32_t i = 0; i < pSql->numOfSubs; ++i) { + for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) { if (pSql->pSubs[i] == NULL) { continue; } @@ -391,17 +388,13 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) { } void freeJoinSubqueryObj(SSqlObj* pSql) { - SSubqueryState* pState = NULL; - - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { SSqlObj* pSub = pSql->pSubs[i]; if (pSub == NULL) { continue; } SJoinSupporter* p = pSub->param; - pState = p->pState; - tscDestroyJoinSupporter(p); if (pSub->res.code == TSDB_CODE_SUCCESS) { @@ -409,14 +402,13 @@ void freeJoinSubqueryObj(SSqlObj* pSql) { } } - taosTFree(pState); - pSql->numOfSubs = 0; + pSql->subState.numOfSub = 0; } static void quitAllSubquery(SSqlObj* pSqlObj, SJoinSupporter* pSupporter) { - assert(pSupporter->pState->numOfRemain > 0); + assert(pSqlObj->subState.numOfRemain > 0); - if (atomic_sub_fetch_32(&pSupporter->pState->numOfRemain, 1) <= 0) { + if (atomic_sub_fetch_32(&pSqlObj->subState.numOfRemain, 1) <= 0) { tscError("%p all subquery return and query failed, global code:%d", pSqlObj, pSqlObj->res.code); freeJoinSubqueryObj(pSqlObj); } @@ -457,7 +449,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr SVgroupTableInfo info = {{0}}; for (int32_t m = 0; m < pvg->numOfVgroups; ++m) { if (tt->vgId == pvg->vgroups[m].vgId) { - info.vgInfo = pvg->vgroups[m]; + tscSCMVgroupInfoCopy(&info.vgInfo, &pvg->vgroups[m]); break; } } @@ -680,7 +672,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow // no data exists in next vnode, mark the query completed // only when there is no subquery exits any more, proceeds to get the intersect of the tuple sets. - if (atomic_sub_fetch_32(&pSupporter->pState->numOfRemain, 1) > 0) { + if (atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1) > 0) { return; } @@ -716,10 +708,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow STableMetaInfo* pTableMetaInfo2 = tscGetMetaInfo(pQueryInfo2, 0); tscBuildVgroupTableInfo(pParentSql, pTableMetaInfo2, s2); - pSupporter->pState->numOfTotal = 2; - pSupporter->pState->numOfRemain = pSupporter->pState->numOfTotal; + pParentSql->subState.numOfSub = 2; + pParentSql->subState.numOfRemain = pParentSql->subState.numOfSub; - for (int32_t m = 0; m < pParentSql->numOfSubs; ++m) { + for (int32_t m = 0; m < pParentSql->subState.numOfSub; ++m) { SSqlObj* sub = pParentSql->pSubs[m]; issueTSCompQuery(sub, sub->param, pParentSql); } @@ -818,7 +810,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow return; } - if (atomic_sub_fetch_32(&pSupporter->pState->numOfRemain, 1) > 0) { + if (atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1) > 0) { return; } @@ -850,7 +842,6 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR SJoinSupporter* pSupporter = (SJoinSupporter*)param; SSqlObj* pParentSql = pSupporter->pObj; - SSubqueryState* pState = pSupporter->pState; SSqlObj* pSql = (SSqlObj*)tres; SSqlCmd* pCmd = &pSql->cmd; @@ -871,6 +862,7 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR pRes->numOfTotal += pRes->numOfRows; } + SSubqueryState* pState = &pParentSql->subState; if (tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0) && numOfRows == 0) { STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); assert(pQueryInfo->numOfTables == 1); @@ -878,7 +870,7 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR // for projection query, need to try next vnode if current vnode is exhausted if ((++pTableMetaInfo->vgroupIndex) < pTableMetaInfo->vgroupList->numOfVgroups) { pState->numOfRemain = 1; - pState->numOfTotal = 1; + pState->numOfSub = 1; pSql->cmd.command = TSDB_SQL_SELECT; pSql->fp = tscJoinQueryCallback; @@ -888,12 +880,12 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR } } - if (atomic_sub_fetch_32(&pState->numOfRemain, 1) > 0) { - tscDebug("%p sub:%p completed, remain:%d, total:%d", pParentSql, tres, pState->numOfRemain, pState->numOfTotal); + if (atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1) > 0) { + tscDebug("%p sub:%p completed, remain:%d, total:%d", pParentSql, tres, pParentSql->subState.numOfRemain, pState->numOfSub); return; } - tscDebug("%p all %d secondary subqueries retrieval completed, code:%d", tres, pState->numOfTotal, pParentSql->res.code); + tscDebug("%p all %d secondary subqueries retrieval completed, code:%d", tres, pState->numOfSub, pParentSql->res.code); if (pParentSql->res.code != TSDB_CODE_SUCCESS) { freeJoinSubqueryObj(pParentSql); @@ -901,7 +893,7 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR } // update the records for each subquery in parent sql object. - for (int32_t i = 0; i < pParentSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pState->numOfSub; ++i) { if (pParentSql->pSubs[i] == NULL) { continue; } @@ -917,32 +909,26 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR static SJoinSupporter* tscUpdateSubqueryStatus(SSqlObj* pSql, int32_t numOfFetch) { int32_t notInvolved = 0; SJoinSupporter* pSupporter = NULL; - SSubqueryState* pState = NULL; + SSubqueryState* pState = &pSql->subState; - for(int32_t i = 0; i < pSql->numOfSubs; ++i) { + for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) { if (pSql->pSubs[i] == NULL) { notInvolved++; } else { pSupporter = (SJoinSupporter*)pSql->pSubs[i]->param; - pState = pSupporter->pState; } } - assert(pState != NULL); - if (pState != NULL) { - pState->numOfTotal = pSql->numOfSubs; - pState->numOfRemain = numOfFetch; - } - + pState->numOfRemain = numOfFetch; return pSupporter; } void tscFetchDatablockFromSubquery(SSqlObj* pSql) { - assert(pSql->numOfSubs >= 1); + assert(pSql->subState.numOfSub >= 1); int32_t numOfFetch = 0; bool hasData = true; - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { // if the subquery is NULL, it does not involved in the final result generation SSqlObj* pSub = pSql->pSubs[i]; if (pSub == NULL) { @@ -989,7 +975,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) { tscDebug("%p retrieve data from %d subqueries", pSql, numOfFetch); SJoinSupporter* pSupporter = tscUpdateSubqueryStatus(pSql, numOfFetch); - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { SSqlObj* pSql1 = pSql->pSubs[i]; if (pSql1 == NULL) { continue; @@ -1124,7 +1110,7 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) { } // wait for the other subqueries response from vnode - if (atomic_sub_fetch_32(&pSupporter->pState->numOfRemain, 1) > 0) { + if (atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1) > 0) { return; } @@ -1136,7 +1122,7 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) { * data instead of returning to its invoker */ if (pTableMetaInfo->vgroupIndex > 0 && tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0)) { - pSupporter->pState->numOfRemain = pSupporter->pState->numOfTotal; // reset the record value + pParentSql->subState.numOfRemain = pParentSql->subState.numOfSub; // reset the record value pSql->fp = joinRetrieveFinalResCallback; // continue retrieve data pSql->cmd.command = TSDB_SQL_FETCH; @@ -1156,7 +1142,6 @@ static void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code); static SSqlObj *tscCreateSTableSubquery(SSqlObj *pSql, SRetrieveSupport *trsupport, SSqlObj *prevSqlObj); -// TODO int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter *pSupporter) { SSqlCmd * pCmd = &pSql->cmd; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); @@ -1165,7 +1150,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter assert(pSql->res.numOfRows == 0); if (pSql->pSubs == NULL) { - pSql->pSubs = calloc(pSupporter->pState->numOfTotal, POINTER_BYTES); + pSql->pSubs = calloc(pSql->subState.numOfSub, POINTER_BYTES); if (pSql->pSubs == NULL) { return TSDB_CODE_TSC_OUT_OF_MEMORY; } @@ -1176,8 +1161,8 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter return TSDB_CODE_TSC_OUT_OF_MEMORY; } - pSql->pSubs[pSql->numOfSubs++] = pNew; - assert(pSql->numOfSubs <= pSupporter->pState->numOfTotal); + pSql->pSubs[pSql->subState.numOfRemain++] = pNew; + assert(pSql->subState.numOfRemain <= pSql->subState.numOfSub); if (QUERY_IS_JOIN_QUERY(pQueryInfo->type)) { addGroupInfoForSubquery(pSql, pNew, 0, tableIndex); @@ -1221,7 +1206,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pNewQueryInfo, 0); if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { // return the tableId & tag - SColumnIndex index = {0}; + SColumnIndex colIndex = {0}; STagCond* pTagCond = &pSupporter->tagCond; assert(pTagCond->joinInfo.hasJoin); @@ -1234,7 +1219,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); for(int32_t i = 0; i < numOfTags; ++i) { if (pSchema[i].colId == tagColId) { - index.columnIndex = i; + colIndex.columnIndex = i; break; } } @@ -1251,18 +1236,18 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter // set get tags query type TSDB_QUERY_SET_TYPE(pNewQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY); - tscAddSpecialColumnForSelect(pNewQueryInfo, 0, TSDB_FUNC_TID_TAG, &index, &s1, TSDB_COL_TAG); + tscAddSpecialColumnForSelect(pNewQueryInfo, 0, TSDB_FUNC_TID_TAG, &colIndex, &s1, TSDB_COL_TAG); size_t numOfCols = taosArrayGetSize(pNewQueryInfo->colList); tscDebug( "%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, transfer to tid_tag query to retrieve (tableId, tags), " "exprInfo:%" PRIzu ", colList:%" PRIzu ", fieldsInfo:%d, tagIndex:%d, name:%s", pSql, pNew, tableIndex, pTableMetaInfo->vgroupIndex, pNewQueryInfo->type, tscSqlExprNumOfExprs(pNewQueryInfo), - numOfCols, pNewQueryInfo->fieldsInfo.numOfOutput, index.columnIndex, pNewQueryInfo->pTableMetaInfo[0]->name); + numOfCols, pNewQueryInfo->fieldsInfo.numOfOutput, colIndex.columnIndex, pNewQueryInfo->pTableMetaInfo[0]->name); } else { SSchema colSchema = {.type = TSDB_DATA_TYPE_BINARY, .bytes = 1}; - SColumnIndex index = {0, PRIMARYKEY_TIMESTAMP_COL_INDEX}; - tscAddSpecialColumnForSelect(pNewQueryInfo, 0, TSDB_FUNC_TS_COMP, &index, &colSchema, TSDB_COL_NORMAL); + SColumnIndex colIndex = {0, PRIMARYKEY_TIMESTAMP_COL_INDEX}; + tscAddSpecialColumnForSelect(pNewQueryInfo, 0, TSDB_FUNC_TS_COMP, &colIndex, &colSchema, TSDB_COL_NORMAL); // set the tags value for ts_comp function SSqlExpr *pExpr = tscSqlExprGet(pNewQueryInfo, 0); @@ -1312,22 +1297,13 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) { assert((pQueryInfo->type & TSDB_QUERY_TYPE_SUBQUERY) == 0); int32_t code = TSDB_CODE_SUCCESS; - - // todo add test - SSubqueryState *pState = calloc(1, sizeof(SSubqueryState)); - if (pState == NULL) { - code = TSDB_CODE_TSC_OUT_OF_MEMORY; - goto _error; - } - - pState->numOfTotal = pQueryInfo->numOfTables; - pState->numOfRemain = pState->numOfTotal; + pSql->subState.numOfSub = pQueryInfo->numOfTables; bool hasEmptySub = false; tscDebug("%p start subquery, total:%d", pSql, pQueryInfo->numOfTables); for (int32_t i = 0; i < pQueryInfo->numOfTables; ++i) { - SJoinSupporter *pSupporter = tscCreateJoinSupporter(pSql, pState, i); + SJoinSupporter *pSupporter = tscCreateJoinSupporter(pSql, i); if (pSupporter == NULL) { // failed to create support struct, abort current query tscError("%p tableIndex:%d, failed to allocate join support object, abort further query", pSql, i); @@ -1354,10 +1330,10 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) { pSql->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT; (*pSql->fp)(pSql->param, pSql, 0); } else { - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { SSqlObj* pSub = pSql->pSubs[i]; if ((code = tscProcessSql(pSub)) != TSDB_CODE_SUCCESS) { - pState->numOfRemain = i - 1; // the already sent reques will continue and do not go to the error process routine + pSql->subState.numOfRemain = i - 1; // the already sent request will continue and do not go to the error process routine break; } } @@ -1372,8 +1348,8 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) { tscQueueAsyncRes(pSql); } -static void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs, SSubqueryState* pState) { - assert(numOfSubs <= pSql->numOfSubs && numOfSubs >= 0 && pState != NULL); +static void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) { + assert(numOfSubs <= pSql->subState.numOfSub && numOfSubs >= 0); for(int32_t i = 0; i < numOfSubs; ++i) { SSqlObj* pSub = pSql->pSubs[i]; @@ -1386,8 +1362,6 @@ static void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs, SSubqueryState taos_free_result(pSub); } - - free(pState); } int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { @@ -1410,9 +1384,10 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); - - pSql->numOfSubs = pTableMetaInfo->vgroupList->numOfVgroups; - assert(pSql->numOfSubs > 0); + SSubqueryState *pState = &pSql->subState; + + pState->numOfSub = pTableMetaInfo->vgroupList->numOfVgroups; + assert(pState->numOfSub > 0); int32_t ret = tscLocalReducerEnvCreate(pSql, &pMemoryBuf, &pDesc, &pModel, nBufferSize); if (ret != 0) { @@ -1422,28 +1397,24 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { return ret; } - pSql->pSubs = calloc(pSql->numOfSubs, POINTER_BYTES); + pSql->pSubs = calloc(pState->numOfSub, POINTER_BYTES); - tscDebug("%p retrieved query data from %d vnode(s)", pSql, pSql->numOfSubs); - SSubqueryState *pState = calloc(1, sizeof(SSubqueryState)); + tscDebug("%p retrieved query data from %d vnode(s)", pSql, pState->numOfSub); - if (pSql->pSubs == NULL || pState == NULL) { - taosTFree(pState); + if (pSql->pSubs == NULL) { taosTFree(pSql->pSubs); pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY; - tscLocalReducerEnvDestroy(pMemoryBuf, pDesc, pModel, pSql->numOfSubs); + tscLocalReducerEnvDestroy(pMemoryBuf, pDesc, pModel, pState->numOfSub); tscQueueAsyncRes(pSql); return ret; } - pState->numOfTotal = pSql->numOfSubs; - pState->numOfRemain = pSql->numOfSubs; - + pState->numOfRemain = pState->numOfSub; pRes->code = TSDB_CODE_SUCCESS; int32_t i = 0; - for (; i < pSql->numOfSubs; ++i) { + for (; i < pState->numOfSub; ++i) { SRetrieveSupport *trs = (SRetrieveSupport *)calloc(1, sizeof(SRetrieveSupport)); if (trs == NULL) { tscError("%p failed to malloc buffer for SRetrieveSupport, orderOfSub:%d, reason:%s", pSql, i, strerror(errno)); @@ -1452,8 +1423,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { trs->pExtMemBuffer = pMemoryBuf; trs->pOrderDescriptor = pDesc; - trs->pState = pState; - + trs->localBuffer = (tFilePage *)calloc(1, nBufferSize + sizeof(tFilePage)); if (trs->localBuffer == NULL) { tscError("%p failed to malloc buffer for local buffer, orderOfSub:%d, reason:%s", pSql, i, strerror(errno)); @@ -1461,8 +1431,8 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { break; } - trs->subqueryIndex = i; - trs->pParentSql = pSql; + trs->subqueryIndex = i; + trs->pParentSql = pSql; trs->pFinalColModel = pModel; SSqlObj *pNew = tscCreateSTableSubquery(pSql, trs, NULL); @@ -1483,42 +1453,46 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) { tscDebug("%p sub:%p create subquery success. orderOfSub:%d", pSql, pNew, trs->subqueryIndex); } - if (i < pSql->numOfSubs) { + if (i < pState->numOfSub) { tscError("%p failed to prepare subquery structure and launch subqueries", pSql); pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY; - tscLocalReducerEnvDestroy(pMemoryBuf, pDesc, pModel, pSql->numOfSubs); - doCleanupSubqueries(pSql, i, pState); + tscLocalReducerEnvDestroy(pMemoryBuf, pDesc, pModel, pState->numOfSub); + doCleanupSubqueries(pSql, i); return pRes->code; // free all allocated resource } if (pRes->code == TSDB_CODE_TSC_QUERY_CANCELLED) { - tscLocalReducerEnvDestroy(pMemoryBuf, pDesc, pModel, pSql->numOfSubs); - doCleanupSubqueries(pSql, i, pState); + tscLocalReducerEnvDestroy(pMemoryBuf, pDesc, pModel, pState->numOfSub); + doCleanupSubqueries(pSql, i); return pRes->code; } - for(int32_t j = 0; j < pSql->numOfSubs; ++j) { + for(int32_t j = 0; j < pState->numOfSub; ++j) { SSqlObj* pSub = pSql->pSubs[j]; SRetrieveSupport* pSupport = pSub->param; tscDebug("%p sub:%p launch subquery, orderOfSub:%d.", pSql, pSub, pSupport->subqueryIndex); tscProcessSql(pSub); } - + return TSDB_CODE_SUCCESS; } -static void tscFreeSubSqlObj(SRetrieveSupport *trsupport, SSqlObj *pSql) { - tscDebug("%p start to free subquery obj", pSql); +static void tscFreeRetrieveSup(SSqlObj *pSql) { + SRetrieveSupport *trsupport = pSql->param; - int32_t index = trsupport->subqueryIndex; - SSqlObj *pParentSql = trsupport->pParentSql; + void* p = atomic_val_compare_exchange_ptr(&pSql->param, trsupport, 0); + if (p == NULL) { + tscDebug("%p retrieve supp already released", pSql); + return; + } - assert(pSql == pParentSql->pSubs[index]); -// pParentSql->pSubs[index] = NULL; -// -// taos_free_result(pSql); + tscDebug("%p start to free subquery supp obj:%p", pSql, trsupport); +// int32_t index = trsupport->subqueryIndex; +// SSqlObj *pParentSql = trsupport->pParentSql; + +// assert(pSql == pParentSql->pSubs[index]); taosTFree(trsupport->localBuffer); taosTFree(trsupport); } @@ -1577,13 +1551,19 @@ static int32_t tscReissueSubquery(SRetrieveSupport *trsupport, SSqlObj *pSql, in } void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numOfRows) { + // it has been freed already + if (pSql->param != trsupport || pSql->param == NULL) { + return; + } + SSqlObj *pParentSql = trsupport->pParentSql; int32_t subqueryIndex = trsupport->subqueryIndex; assert(pSql != NULL); - SSubqueryState* pState = trsupport->pState; - assert(pState->numOfRemain <= pState->numOfTotal && pState->numOfRemain >= 0 && pParentSql->numOfSubs == pState->numOfTotal); - + + SSubqueryState* pState = &pParentSql->subState; + assert(pState->numOfRemain <= pState->numOfSub && pState->numOfRemain >= 0); + // retrieved in subquery failed. OR query cancelled in retrieve phase. if (taos_errno(pSql) == TSDB_CODE_SUCCESS && pParentSql->res.code != TSDB_CODE_SUCCESS) { @@ -1616,22 +1596,21 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO int32_t remain = -1; if ((remain = atomic_sub_fetch_32(&pState->numOfRemain, 1)) > 0) { tscDebug("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pParentSql, pSql, trsupport->subqueryIndex, - pState->numOfTotal - remain); + pState->numOfSub - remain); - tscFreeSubSqlObj(trsupport, pSql); + tscFreeRetrieveSup(pSql); return; } // all subqueries are failed - tscError("%p retrieve from %d vnode(s) completed,code:%s.FAILED.", pParentSql, pState->numOfTotal, + tscError("%p retrieve from %d vnode(s) completed,code:%s.FAILED.", pParentSql, pState->numOfSub, tstrerror(pParentSql->res.code)); // release allocated resource tscLocalReducerEnvDestroy(trsupport->pExtMemBuffer, trsupport->pOrderDescriptor, trsupport->pFinalColModel, - pState->numOfTotal); + pState->numOfSub); - taosTFree(trsupport->pState); - tscFreeSubSqlObj(trsupport, pSql); + tscFreeRetrieveSup(pSql); // in case of second stage join subquery, invoke its callback function instead of regular QueueAsyncRes SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pParentSql->cmd, 0); @@ -1650,16 +1629,16 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p SSqlObj * pParentSql = trsupport->pParentSql; tOrderDescriptor *pDesc = trsupport->pOrderDescriptor; - SSubqueryState* pState = trsupport->pState; + SSubqueryState* pState = &pParentSql->subState; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, 0); STableMetaInfo* pTableMetaInfo = pQueryInfo->pTableMetaInfo[0]; // data in from current vnode is stored in cache and disk uint32_t numOfRowsFromSubquery = (uint32_t)(trsupport->pExtMemBuffer[idx]->numOfTotalElems + trsupport->localBuffer->num); - tscDebug("%p sub:%p all data retrieved from ep:%s, vgId:%d, numOfRows:%d, orderOfSub:%d", pParentSql, pSql, - pTableMetaInfo->vgroupList->vgroups[0].epAddr[0].fqdn, pTableMetaInfo->vgroupList->vgroups[0].vgId, - numOfRowsFromSubquery, idx); + SVgroupsInfo* vgroupsInfo = pTableMetaInfo->vgroupList; + tscDebug("%p sub:%p all data retrieved from ep:%s, vgId:%d, numOfRows:%d, orderOfSub:%d", pParentSql, pSql, + vgroupsInfo->vgroups[0].epAddr[0].fqdn, vgroupsInfo->vgroups[0].vgId, numOfRowsFromSubquery, idx); tColModelCompact(pDesc->pColumnModel, trsupport->localBuffer, pDesc->pColumnModel->capacity); @@ -1687,11 +1666,11 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p } int32_t remain = -1; - if ((remain = atomic_sub_fetch_32(&pState->numOfRemain, 1)) > 0) { + if ((remain = atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1)) > 0) { tscDebug("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pParentSql, pSql, trsupport->subqueryIndex, - pState->numOfTotal - remain); + pState->numOfSub - remain); - tscFreeSubSqlObj(trsupport, pSql); + tscFreeRetrieveSup(pSql); return; } @@ -1699,21 +1678,19 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p pDesc->pColumnModel->capacity = trsupport->pExtMemBuffer[idx]->numOfElemsPerPage; tscDebug("%p retrieve from %d vnodes completed.final NumOfRows:%" PRId64 ",start to build loser tree", pParentSql, - pState->numOfTotal, pState->numOfRetrievedRows); + pState->numOfSub, pState->numOfRetrievedRows); SQueryInfo *pPQueryInfo = tscGetQueryInfoDetail(&pParentSql->cmd, 0); tscClearInterpInfo(pPQueryInfo); - tscCreateLocalReducer(trsupport->pExtMemBuffer, pState->numOfTotal, pDesc, trsupport->pFinalColModel, pParentSql); + tscCreateLocalReducer(trsupport->pExtMemBuffer, pState->numOfSub, pDesc, trsupport->pFinalColModel, pParentSql); tscDebug("%p build loser tree completed", pParentSql); pParentSql->res.precision = pSql->res.precision; pParentSql->res.numOfRows = 0; pParentSql->res.row = 0; - // only free once - taosTFree(trsupport->pState); - tscFreeSubSqlObj(trsupport, pSql); + tscFreeRetrieveSup(pSql); // set the command flag must be after the semaphore been correctly set. pParentSql->cmd.command = TSDB_SQL_RETRIEVE_LOCALMERGE; @@ -1725,16 +1702,23 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p } static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) { + SSqlObj *pSql = (SSqlObj *)tres; + assert(pSql != NULL); + + // this query has been freed already SRetrieveSupport *trsupport = (SRetrieveSupport *)param; + if (pSql->param == NULL || param == NULL) { + tscDebug("%p already freed in dnodecallback", pSql); + assert(pSql->res.code == TSDB_CODE_TSC_QUERY_CANCELLED); + return; + } + tOrderDescriptor *pDesc = trsupport->pOrderDescriptor; int32_t idx = trsupport->subqueryIndex; SSqlObj * pParentSql = trsupport->pParentSql; - assert(tres != NULL); - SSqlObj *pSql = (SSqlObj *)tres; - - SSubqueryState* pState = trsupport->pState; - assert(pState->numOfRemain <= pState->numOfTotal && pState->numOfRemain >= 0 && pParentSql->numOfSubs == pState->numOfTotal); + SSubqueryState* pState = &pParentSql->subState; + assert(pState->numOfRemain <= pState->numOfSub && pState->numOfRemain >= 0); STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0); SCMVgroupInfo *pVgroup = &pTableMetaInfo->vgroupList->vgroups[0]; @@ -1751,6 +1735,10 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR if (taos_errno(pSql) != TSDB_CODE_SUCCESS) { assert(numOfRows == taos_errno(pSql)); + if (numOfRows == TSDB_CODE_TSC_QUERY_CANCELLED) { + trsupport->numOfRetry = MAX_NUM_OF_SUBQUERY_RETRY; + } + if (trsupport->numOfRetry++ < MAX_NUM_OF_SUBQUERY_RETRY) { tscError("%p sub:%p failed code:%s, retry:%d", pParentSql, pSql, tstrerror(numOfRows), trsupport->numOfRetry); @@ -1822,7 +1810,7 @@ static SSqlObj *tscCreateSTableSubquery(SSqlObj *pSql, SRetrieveSupport *trsuppo SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pNew->cmd, 0); pQueryInfo->type |= TSDB_QUERY_TYPE_STABLE_SUBQUERY; - assert(pQueryInfo->numOfTables == 1 && pNew->cmd.numOfClause == 1 && trsupport->subqueryIndex < pSql->numOfSubs); + assert(pQueryInfo->numOfTables == 1 && pNew->cmd.numOfClause == 1 && trsupport->subqueryIndex < pSql->subState.numOfSub); // launch subquery for each vnode, so the subquery index equals to the vgroupIndex. STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, table_index); @@ -1893,7 +1881,6 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) { static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows) { SInsertSupporter *pSupporter = (SInsertSupporter *)param; SSqlObj* pParentObj = pSupporter->pSql; - SSubqueryState* pState = pSupporter->pState; // record the total inserted rows if (numOfRows > 0) { @@ -1908,15 +1895,13 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows) } taosTFree(pSupporter); - if (atomic_sub_fetch_32(&pState->numOfRemain, 1) > 0) { + + if (atomic_sub_fetch_32(&pParentObj->subState.numOfRemain, 1) > 0) { return; } tscDebug("%p Async insertion completed, total inserted:%" PRId64, pParentObj, pParentObj->res.numOfRows); - // release data block data - taosTFree(pState); - // restore user defined fp pParentObj->fp = pParentObj->fetchFp; @@ -1937,7 +1922,7 @@ int32_t tscHandleInsertRetry(SSqlObj* pSql) { SSqlRes* pRes = &pSql->res; SInsertSupporter* pSupporter = (SInsertSupporter*) pSql->param; - assert(pSupporter->index < pSupporter->pState->numOfTotal); + assert(pSupporter->index < pSupporter->pSql->subState.numOfSub); STableDataBlocks* pTableDataBlock = taosArrayGetP(pCmd->pDataBlocks, pSupporter->index); int32_t code = tscCopyDataBlockToPayload(pSql, pTableDataBlock); @@ -1954,33 +1939,29 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) { SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; - pSql->numOfSubs = (uint16_t)taosArrayGetSize(pCmd->pDataBlocks); - assert(pSql->numOfSubs > 0); + pSql->subState.numOfSub = (uint16_t)taosArrayGetSize(pCmd->pDataBlocks); + assert(pSql->subState.numOfSub > 0); pRes->code = TSDB_CODE_SUCCESS; // the number of already initialized subqueries int32_t numOfSub = 0; - SSubqueryState *pState = calloc(1, sizeof(SSubqueryState)); - pState->numOfTotal = pSql->numOfSubs; - pState->numOfRemain = pSql->numOfSubs; - - pSql->pSubs = calloc(pSql->numOfSubs, POINTER_BYTES); + pSql->subState.numOfRemain = pSql->subState.numOfSub; + pSql->pSubs = calloc(pSql->subState.numOfSub, POINTER_BYTES); if (pSql->pSubs == NULL) { goto _error; } - tscDebug("%p submit data to %d vnode(s)", pSql, pSql->numOfSubs); + tscDebug("%p submit data to %d vnode(s)", pSql, pSql->subState.numOfSub); - while(numOfSub < pSql->numOfSubs) { + while(numOfSub < pSql->subState.numOfSub) { SInsertSupporter* pSupporter = calloc(1, sizeof(SInsertSupporter)); if (pSupporter == NULL) { goto _error; } pSupporter->pSql = pSql; - pSupporter->pState = pState; pSupporter->index = numOfSub; SSqlObj *pNew = createSimpleSubObj(pSql, multiVnodeInsertFinalize, pSupporter, TSDB_SQL_INSERT); @@ -2003,12 +1984,12 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) { numOfSub++; } else { tscDebug("%p prepare submit data block failed in async insertion, vnodeIdx:%d, total:%d, code:%s", pSql, numOfSub, - pSql->numOfSubs, tstrerror(pRes->code)); + pSql->subState.numOfSub, tstrerror(pRes->code)); goto _error; } } - if (numOfSub < pSql->numOfSubs) { + if (numOfSub < pSql->subState.numOfSub) { tscError("%p failed to prepare subObj structure and launch sub-insertion", pSql); pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY; goto _error; @@ -2026,14 +2007,13 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) { return TSDB_CODE_SUCCESS; _error: - taosTFree(pState); return TSDB_CODE_TSC_OUT_OF_MEMORY; } static char* getResultBlockPosition(SSqlCmd* pCmd, SSqlRes* pRes, int32_t columnIndex, int16_t* bytes) { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); - SFieldSupInfo* pInfo = (SFieldSupInfo*) TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.pSupportInfo, columnIndex); + SInternalField* pInfo = (SInternalField*) TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.internalField, columnIndex); assert(pInfo->pSqlExpr != NULL); *bytes = pInfo->pSqlExpr->resBytes; @@ -2048,7 +2028,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) { SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex); int32_t numOfRes = INT32_MAX; - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { if (pSql->pSubs[i] == NULL) { continue; } @@ -2141,7 +2121,7 @@ static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pF int32_t length = taosUcs4ToMbs(pRes->tsrow[columnIndex], pRes->length[columnIndex], pRes->buffer[columnIndex]); if ( length >= 0 ) { - pRes->tsrow[columnIndex] = pRes->buffer[columnIndex]; + pRes->tsrow[columnIndex] = (unsigned char*)pRes->buffer[columnIndex]; pRes->length[columnIndex] = length; } else { tscError("%p charset:%s to %s. val:%s convert failed.", pSql, DEFAULT_UNICODE_ENCODEC, tsCharset, (char*)pRes->tsrow[columnIndex]); @@ -2169,7 +2149,7 @@ static char *getArithemicInputSrc(void *param, const char *name, int32_t colId) return pSupport->data[index] + pSupport->offset * pExpr->resBytes; } -void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { +TAOS_ROW doSetResultRowData(SSqlObj *pSql, bool finalResult) { SSqlCmd *pCmd = &pSql->cmd; SSqlRes *pRes = &pSql->res; @@ -2183,7 +2163,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { size_t size = tscNumOfFields(pQueryInfo); for (int i = 0; i < size; ++i) { - SFieldSupInfo* pSup = TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.pSupportInfo, i); + SInternalField* pSup = TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.internalField, i); if (pSup->pSqlExpr != NULL) { tscGetResultColumnChr(pRes, &pQueryInfo->fieldsInfo, i); } @@ -2193,7 +2173,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { continue; } - TAOS_FIELD *pField = TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.pFields, i); + TAOS_FIELD *pField = TARRAY_GET_ELEM(pQueryInfo->fieldsInfo.internalField, i); if (pRes->tsrow[i] != NULL && pField->type == TSDB_DATA_TYPE_NCHAR) { transferNcharData(pSql, i, pField); } @@ -2222,7 +2202,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) { tExprTreeCalcTraverse(pRes->pArithSup->pArithExpr->pExpr, 1, pRes->buffer[i], pRes->pArithSup, TSDB_ORDER_ASC, getArithemicInputSrc); - pRes->tsrow[i] = pRes->buffer[i]; + pRes->tsrow[i] = (unsigned char*)pRes->buffer[i]; } } @@ -2238,7 +2218,7 @@ static UNUSED_FUNC bool tscHasRemainDataInSubqueryResultSet(SSqlObj *pSql) { if (tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0)) { bool allSubqueryExhausted = true; - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { if (pSql->pSubs[i] == NULL) { continue; } @@ -2264,7 +2244,7 @@ static UNUSED_FUNC bool tscHasRemainDataInSubqueryResultSet(SSqlObj *pSql) { hasData = !allSubqueryExhausted; } else { // otherwise, in case inner join, if any subquery exhausted, query completed. - for (int32_t i = 0; i < pSql->numOfSubs; ++i) { + for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) { if (pSql->pSubs[i] == 0) { continue; } diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 85c8a5705864ee5dde9a141743d55eb61bc09593..47c2d35a75cba4787e00c645e2f242ae24788df7 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -77,6 +77,7 @@ int32_t tscInitRpc(const char *user, const char *secretEncrypt, void **pDnodeCon return 0; } + void taos_init_imp(void) { char temp[128]; @@ -124,8 +125,9 @@ void taos_init_imp(void) { double factor = (tscEmbedded == 0)? 2.0:4.0; tscNumOfThreads = (int)(tsNumOfCores * tsNumOfThreadsPerCore / factor); - - if (tscNumOfThreads < 2) tscNumOfThreads = 2; + if (tscNumOfThreads < 2) { + tscNumOfThreads = 2; + } tscQhandle = taosInitScheduler(queueSize, tscNumOfThreads, "tsc"); if (NULL == tscQhandle) { @@ -140,8 +142,8 @@ void taos_init_imp(void) { int64_t refreshTime = 10; // 10 seconds by default if (tscMetaCache == NULL) { - tscMetaCache = taosCacheInit(TSDB_DATA_TYPE_BINARY, refreshTime, false, NULL, "tableMeta"); - tscObjCache = taosCacheInit(TSDB_CACHE_PTR_KEY, refreshTime / 2, false, tscFreeSqlObjInCache, "sqlObj"); + tscMetaCache = taosCacheInit(TSDB_DATA_TYPE_BINARY, refreshTime, false, tscFreeTableMetaHelper, "tableMeta"); + tscObjCache = taosCacheInit(TSDB_CACHE_PTR_KEY, refreshTime / 2, false, tscFreeRegisteredSqlObj, "sqlObj"); } tscDebug("client is initialized successfully"); diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index d00b39e68beba06945df465ff862e2515938bb26..b60bf958a84bcefd8fb14970923f4af1074b7a6f 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -114,9 +114,9 @@ bool tscIsTwoStageSTableQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) { } // for select query super table, the super table vgroup list can not be null in any cases. - if (pQueryInfo->command == TSDB_SQL_SELECT && UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { - assert(pTableMetaInfo->vgroupList != NULL); - } + // if (pQueryInfo->command == TSDB_SQL_SELECT && UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { + // assert(pTableMetaInfo->vgroupList != NULL); + // } if ((pQueryInfo->type & TSDB_QUERY_TYPE_FREE_RESOURCE) == TSDB_QUERY_TYPE_FREE_RESOURCE) { return false; @@ -360,26 +360,26 @@ void tscPartiallyFreeSqlObj(SSqlObj* pSql) { tscFreeSqlResult(pSql); taosTFree(pSql->pSubs); - pSql->numOfSubs = 0; + pSql->subState.numOfSub = 0; pSql->self = 0; tscResetSqlCmdObj(pCmd, false); } -static UNUSED_FUNC void tscFreeSubobj(SSqlObj* pSql) { - if (pSql->numOfSubs == 0) { +static void tscFreeSubobj(SSqlObj* pSql) { + if (pSql->subState.numOfSub == 0) { return; } - tscDebug("%p start to free sub SqlObj, numOfSub:%d", pSql, pSql->numOfSubs); + tscDebug("%p start to free sub SqlObj, numOfSub:%d", pSql, pSql->subState.numOfSub); - for(int32_t i = 0; i < pSql->numOfSubs; ++i) { + for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) { tscDebug("%p free sub SqlObj:%p, index:%d", pSql, pSql->pSubs[i], i); taos_free_result(pSql->pSubs[i]); pSql->pSubs[i] = NULL; } - pSql->numOfSubs = 0; + pSql->subState.numOfSub = 0; } /** @@ -389,7 +389,7 @@ static UNUSED_FUNC void tscFreeSubobj(SSqlObj* pSql) { * * @param pSql */ -void tscFreeSqlObjInCache(void *pSql) { +void tscFreeRegisteredSqlObj(void *pSql) { assert(pSql != NULL); SSqlObj** p = (SSqlObj**)pSql; @@ -408,6 +408,24 @@ void tscFreeSqlObjInCache(void *pSql) { } } +void tscFreeTableMetaHelper(void *pTableMeta) { + STableMeta* p = (STableMeta*) pTableMeta; + + int32_t numOfEps = p->vgroupInfo.numOfEps; + assert(numOfEps >= 0 && numOfEps <= TSDB_MAX_REPLICA); + + for(int32_t i = 0; i < numOfEps; ++i) { + taosTFree(p->vgroupInfo.epAddr[i].fqdn); + } + + int32_t numOfEps1 = p->corVgroupInfo.numOfEps; + assert(numOfEps1 >= 0 && numOfEps1 <= TSDB_MAX_REPLICA); + + for(int32_t i = 0; i < numOfEps1; ++i) { + taosTFree(p->corVgroupInfo.epAddr[i].fqdn); + } +} + void tscFreeSqlObj(SSqlObj* pSql) { if (pSql == NULL || pSql->signature != pSql) { return; @@ -415,7 +433,9 @@ void tscFreeSqlObj(SSqlObj* pSql) { tscDebug("%p start to free sqlObj", pSql); + pSql->res.code = TSDB_CODE_TSC_QUERY_CANCELLED; tscFreeSubobj(pSql); + tscPartiallyFreeSqlObj(pSql); pSql->signature = NULL; @@ -684,16 +704,14 @@ static int32_t getRowExpandSize(STableMeta* pTableMeta) { int32_t tscMergeTableDataBlocks(SSqlObj* pSql, SArray* pTableDataBlockList) { SSqlCmd* pCmd = &pSql->cmd; - // the maximum expanded size in byte when a row-wise data is converted to SDataRow format - STableDataBlocks* pOneTableBlock = taosArrayGetP(pTableDataBlockList, 0); - int32_t expandSize = getRowExpandSize(pOneTableBlock->pTableMeta); - void* pVnodeDataBlockHashList = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false); SArray* pVnodeDataBlockList = taosArrayInit(8, POINTER_BYTES); size_t total = taosArrayGetSize(pTableDataBlockList); for (int32_t i = 0; i < total; ++i) { - pOneTableBlock = taosArrayGetP(pTableDataBlockList, i); + // the maximum expanded size in byte when a row-wise data is converted to SDataRow format + STableDataBlocks* pOneTableBlock = taosArrayGetP(pTableDataBlockList, i); + int32_t expandSize = getRowExpandSize(pOneTableBlock->pTableMeta); STableDataBlocks* dataBuf = NULL; int32_t ret = @@ -827,35 +845,30 @@ TAOS_FIELD tscCreateField(int8_t type, const char* name, int16_t bytes) { return f; } -SFieldSupInfo* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField) { +SInternalField* tscFieldInfoAppend(SFieldInfo* pFieldInfo, TAOS_FIELD* pField) { assert(pFieldInfo != NULL); - taosArrayPush(pFieldInfo->pFields, pField); pFieldInfo->numOfOutput++; - struct SFieldSupInfo info = { + struct SInternalField info = { .pSqlExpr = NULL, .pArithExprInfo = NULL, .visible = true, }; - - return taosArrayPush(pFieldInfo->pSupportInfo, &info); -} -SFieldSupInfo* tscFieldInfoGetSupp(SFieldInfo* pFieldInfo, int32_t index) { - return TARRAY_GET_ELEM(pFieldInfo->pSupportInfo, index); + info.field = *pField; + return taosArrayPush(pFieldInfo->internalField, &info); } -SFieldSupInfo* tscFieldInfoInsert(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* field) { - taosArrayInsert(pFieldInfo->pFields, index, field); +SInternalField* tscFieldInfoInsert(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* field) { pFieldInfo->numOfOutput++; - - struct SFieldSupInfo info = { + struct SInternalField info = { .pSqlExpr = NULL, .pArithExprInfo = NULL, .visible = true, }; - - return taosArrayInsert(pFieldInfo->pSupportInfo, index, &info); + + info.field = *field; + return taosArrayInsert(pFieldInfo->internalField, index, &info); } void tscFieldInfoUpdateOffset(SQueryInfo* pQueryInfo) { @@ -889,29 +902,18 @@ void tscFieldInfoUpdateOffsetForInterResult(SQueryInfo* pQueryInfo) { } } -void tscFieldInfoCopy(SFieldInfo* dst, const SFieldInfo* src) { - dst->numOfOutput = src->numOfOutput; - - if (dst->pFields == NULL) { - dst->pFields = taosArrayClone(src->pFields); - } else { - taosArrayCopy(dst->pFields, src->pFields); - } - - if (dst->pSupportInfo == NULL) { - dst->pSupportInfo = taosArrayClone(src->pSupportInfo); - } else { - taosArrayCopy(dst->pSupportInfo, src->pSupportInfo); - } +SInternalField* tscFieldInfoGetInternalField(SFieldInfo* pFieldInfo, int32_t index) { + assert(index < pFieldInfo->numOfOutput); + return TARRAY_GET_ELEM(pFieldInfo->internalField, index); } TAOS_FIELD* tscFieldInfoGetField(SFieldInfo* pFieldInfo, int32_t index) { assert(index < pFieldInfo->numOfOutput); - return TARRAY_GET_ELEM(pFieldInfo->pFields, index); + return &((SInternalField*)TARRAY_GET_ELEM(pFieldInfo->internalField, index))->field; } int16_t tscFieldInfoGetOffset(SQueryInfo* pQueryInfo, int32_t index) { - SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pQueryInfo->fieldsInfo, index); + SInternalField* pInfo = tscFieldInfoGetInternalField(&pQueryInfo->fieldsInfo, index); assert(pInfo != NULL && pInfo->pSqlExpr != NULL); return pInfo->pSqlExpr->offset; @@ -958,10 +960,8 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) { return; } - taosArrayDestroy(pFieldInfo->pFields); - for(int32_t i = 0; i < pFieldInfo->numOfOutput; ++i) { - SFieldSupInfo* pInfo = taosArrayGet(pFieldInfo->pSupportInfo, i); + SInternalField* pInfo = taosArrayGet(pFieldInfo->internalField, i); if (pInfo->pArithExprInfo != NULL) { tExprTreeDestroy(&pInfo->pArithExprInfo->pExpr, NULL); @@ -969,7 +969,9 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) { } } - taosArrayDestroy(pFieldInfo->pSupportInfo); + taosArrayDestroy(pFieldInfo->internalField); + taosTFree(pFieldInfo->final); + memset(pFieldInfo, 0, sizeof(SFieldInfo)); } @@ -1516,13 +1518,6 @@ void tscSetFreeHeatBeat(STscObj* pObj) { pQueryInfo->type = TSDB_QUERY_TYPE_FREE_RESOURCE; } -bool tscShouldFreeHeartBeat(SSqlObj* pHb) { - assert(pHb == pHb->signature); - - SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pHb->cmd, 0); - return pQueryInfo->type == TSDB_QUERY_TYPE_FREE_RESOURCE; -} - /* * the following four kinds of SqlObj should not be freed * 1. SqlObj for stream computing @@ -1620,11 +1615,8 @@ STableMetaInfo* tscGetTableMetaInfoByUid(SQueryInfo* pQueryInfo, uint64_t uid, i } void tscInitQueryInfo(SQueryInfo* pQueryInfo) { - assert(pQueryInfo->fieldsInfo.pFields == NULL); - pQueryInfo->fieldsInfo.pFields = taosArrayInit(4, sizeof(TAOS_FIELD)); - - assert(pQueryInfo->fieldsInfo.pSupportInfo == NULL); - pQueryInfo->fieldsInfo.pSupportInfo = taosArrayInit(4, sizeof(SFieldSupInfo)); + assert(pQueryInfo->fieldsInfo.internalField == NULL); + pQueryInfo->fieldsInfo.internalField = taosArrayInit(4, sizeof(SInternalField)); assert(pQueryInfo->exprList == NULL); pQueryInfo->exprList = taosArrayInit(4, POINTER_BYTES); @@ -1687,8 +1679,14 @@ void tscClearSubqueryInfo(SSqlCmd* pCmd) { void tscFreeVgroupTableInfo(SArray* pVgroupTables) { if (pVgroupTables != NULL) { - for (size_t i = 0; i < taosArrayGetSize(pVgroupTables); i++) { + size_t num = taosArrayGetSize(pVgroupTables); + for (size_t i = 0; i < num; i++) { SVgroupTableInfo* pInfo = taosArrayGet(pVgroupTables, i); + + for(int32_t j = 0; j < pInfo->vgInfo.numOfEps; ++j) { + taosTFree(pInfo->vgInfo.epAddr[j].fqdn); + } + taosArrayDestroy(pInfo->itemList); } taosArrayDestroy(pVgroupTables); @@ -1700,6 +1698,7 @@ void clearAllTableMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool rem for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) { STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i); + tscFreeVgroupTableInfo(pTableMetaInfo->pVgroupTables); tscClearTableMetaInfo(pTableMetaInfo, removeFromCache); free(pTableMetaInfo); @@ -1732,13 +1731,7 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST pTableMetaInfo->pTableMeta = pTableMeta; if (vgroupList != NULL) { - size_t size = sizeof(SVgroupsInfo) + sizeof(SCMVgroupInfo) * vgroupList->numOfVgroups; - pTableMetaInfo->vgroupList = malloc(size); - if (pTableMetaInfo->vgroupList == NULL) { - return NULL; - } - - memcpy(pTableMetaInfo->vgroupList, vgroupList, size); + pTableMetaInfo->vgroupList = tscVgroupInfoClone(vgroupList); } pTableMetaInfo->tagColList = taosArrayInit(4, POINTER_BYTES); @@ -1767,8 +1760,7 @@ void tscClearTableMetaInfo(STableMetaInfo* pTableMetaInfo, bool removeFromCache) taosCacheRelease(tscMetaCache, (void**)&(pTableMetaInfo->pTableMeta), removeFromCache); } - taosTFree(pTableMetaInfo->vgroupList); - + pTableMetaInfo->vgroupList = tscVgroupInfoClear(pTableMetaInfo->vgroupList); tscColumnListDestroy(pTableMetaInfo->tagColList); pTableMetaInfo->tagColList = NULL; } @@ -1836,54 +1828,23 @@ SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cm return pNew; } -// current sql function is not direct output result, so create a dummy output field -static void doSetNewFieldInfo(SQueryInfo* pNewQueryInfo, SSqlExpr* pExpr) { - TAOS_FIELD f = {.type = (uint8_t)pExpr->resType, .bytes = pExpr->resBytes}; - tstrncpy(f.name, pExpr->aliasName, sizeof(f.name)); - - SFieldSupInfo* pInfo1 = tscFieldInfoAppend(&pNewQueryInfo->fieldsInfo, &f); - - pInfo1->pSqlExpr = pExpr; - pInfo1->visible = false; -} - static void doSetSqlExprAndResultFieldInfo(SQueryInfo* pQueryInfo, SQueryInfo* pNewQueryInfo, int64_t uid) { int32_t numOfOutput = (int32_t)tscSqlExprNumOfExprs(pNewQueryInfo); if (numOfOutput == 0) { return; } - size_t numOfExprs = tscSqlExprNumOfExprs(pQueryInfo); - SFieldInfo* pFieldInfo = &pQueryInfo->fieldsInfo; - - // set the field info in pNewQueryInfo object + // set the field info in pNewQueryInfo object according to sqlExpr information + size_t numOfExprs = tscSqlExprNumOfExprs(pNewQueryInfo); for (int32_t i = 0; i < numOfExprs; ++i) { - SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i); + SSqlExpr* pExpr = tscSqlExprGet(pNewQueryInfo, i); - if (pExpr->uid == uid) { - if (i < pFieldInfo->numOfOutput) { - SFieldSupInfo* pInfo = tscFieldInfoGetSupp(pFieldInfo, i); - - if (pInfo->pSqlExpr != NULL) { - TAOS_FIELD* p = tscFieldInfoGetField(pFieldInfo, i); - assert(strcmp(p->name, pExpr->aliasName) == 0); - - SFieldSupInfo* pInfo1 = tscFieldInfoAppend(&pNewQueryInfo->fieldsInfo, p); - *pInfo1 = *pInfo; - } else { - assert(pInfo->pArithExprInfo != NULL); - doSetNewFieldInfo(pNewQueryInfo, pExpr); - } - } else { // it is a arithmetic column, does not have actual field for sqlExpr, so build it - doSetNewFieldInfo(pNewQueryInfo, pExpr); - } - } + TAOS_FIELD f = tscCreateField((int8_t) pExpr->resType, pExpr->aliasName, pExpr->resBytes); + SInternalField* pInfo1 = tscFieldInfoAppend(&pNewQueryInfo->fieldsInfo, &f); + pInfo1->pSqlExpr = pExpr; } - // make sure the the sqlExpr for each fields is correct - numOfExprs = tscSqlExprNumOfExprs(pNewQueryInfo); - - // update the pSqlExpr pointer in SFieldSupInfo according the field name + // update the pSqlExpr pointer in SInternalField according the field name // make sure the pSqlExpr point to the correct SqlExpr in pNewQueryInfo, not SqlExpr in pQueryInfo for (int32_t f = 0; f < pNewQueryInfo->fieldsInfo.numOfOutput; ++f) { TAOS_FIELD* field = tscFieldInfoGetField(&pNewQueryInfo->fieldsInfo, f); @@ -1893,7 +1854,7 @@ static void doSetSqlExprAndResultFieldInfo(SQueryInfo* pQueryInfo, SQueryInfo* p SSqlExpr* pExpr1 = tscSqlExprGet(pNewQueryInfo, k1); if (strcmp(field->name, pExpr1->aliasName) == 0) { // establish link according to the result field name - SFieldSupInfo* pInfo = tscFieldInfoGetSupp(&pNewQueryInfo->fieldsInfo, f); + SInternalField* pInfo = tscFieldInfoGetInternalField(&pNewQueryInfo->fieldsInfo, f); pInfo->pSqlExpr = pExpr1; matched = true; @@ -2291,7 +2252,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) { * * For super table join with projection query, if anyone of the subquery is exhausted, the query completed. */ - pSql->numOfSubs = 0; + pSql->subState.numOfSub = 0; pCmd->command = TSDB_SQL_SELECT; tscResetForNextRetrieve(pRes); @@ -2323,7 +2284,7 @@ void tscTryQueryNextClause(SSqlObj* pSql, __async_cb_func_t fp) { pRes->numOfTotal = num; taosTFree(pSql->pSubs); - pSql->numOfSubs = 0; + pSql->subState.numOfSub = 0; pSql->fp = fp; tscDebug("%p try data in the next subclause:%d, total subclause:%d", pSql, pCmd->clauseIndex, pCmd->numOfClause); @@ -2408,3 +2369,58 @@ void tscClearSqlOwner(SSqlObj* pSql) { assert(taosCheckPthreadValid(pSql->owner)); atomic_store_64(&pSql->owner, 0); } + +SVgroupsInfo* tscVgroupInfoClone(SVgroupsInfo *vgroupList) { + if (vgroupList == NULL) { + return NULL; + } + + size_t size = sizeof(SVgroupsInfo) + sizeof(SCMVgroupInfo) * vgroupList->numOfVgroups; + SVgroupsInfo* pNew = calloc(1, size); + if (pNew == NULL) { + return NULL; + } + + pNew->numOfVgroups = vgroupList->numOfVgroups; + + for(int32_t i = 0; i < vgroupList->numOfVgroups; ++i) { + SCMVgroupInfo* pNewVInfo = &pNew->vgroups[i]; + + SCMVgroupInfo* pvInfo = &vgroupList->vgroups[i]; + pNewVInfo->vgId = pvInfo->vgId; + pNewVInfo->numOfEps = pvInfo->numOfEps; + + for(int32_t j = 0; j < pvInfo->numOfEps; ++j) { + pNewVInfo->epAddr[j].fqdn = strdup(pvInfo->epAddr[j].fqdn); + pNewVInfo->epAddr[j].port = pvInfo->epAddr[j].port; + } + } + + return pNew; +} + +void* tscVgroupInfoClear(SVgroupsInfo *vgroupList) { + if (vgroupList == NULL) { + return NULL; + } + + for(int32_t i = 0; i < vgroupList->numOfVgroups; ++i) { + SCMVgroupInfo* pVgroupInfo = &vgroupList->vgroups[i]; + + for(int32_t j = 0; j < pVgroupInfo->numOfEps; ++j) { + taosTFree(pVgroupInfo->epAddr[j].fqdn); + } + } + + taosTFree(vgroupList); + return NULL; +} + +void tscSCMVgroupInfoCopy(SCMVgroupInfo* dst, const SCMVgroupInfo* src) { + dst->vgId = src->vgId; + dst->numOfEps = src->numOfEps; + for(int32_t i = 0; i < dst->numOfEps; ++i) { + dst->epAddr[i].port = src->epAddr[i].port; + dst->epAddr[i].fqdn = strdup(src->epAddr[i].fqdn); + } +} diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h index 798e2654555c9e7ed9ff88c6da10b4a20841b718..515115c323294a67318b5eb1dd17660e651d09f8 100644 --- a/src/common/inc/tglobal.h +++ b/src/common/inc/tglobal.h @@ -34,6 +34,7 @@ extern int32_t tsStatusInterval; extern int32_t tsNumOfMnodes; extern int32_t tsEnableVnodeBak; extern int32_t tsEnableTelemetryReporting; +extern char tsEmail[]; // common extern int tsRpcTimer; diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index 9c241c5c437507c6c66400a4acc7716f2a479d49..28289b051e4ef32e1b1e22847df584238857002b 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -566,7 +566,7 @@ int tdSetKVRowDataOfCol(SKVRow *orow, int16_t colId, int8_t type, void *value) { SKVRow nrow = NULL; void * ptr = taosbsearch(&colId, kvRowColIdx(row), kvRowNCols(row), sizeof(SColIdx), comparTagId, TD_GE); - if (ptr == NULL || ((SColIdx *)ptr)->colId < colId) { // need to add a column value to the row + if (ptr == NULL || ((SColIdx *)ptr)->colId > colId) { // need to add a column value to the row int diff = IS_VAR_DATA_TYPE(type) ? varDataTLen(value) : TYPE_BYTES[type]; nrow = malloc(kvRowLen(row) + sizeof(SColIdx) + diff); if (nrow == NULL) return -1; diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c index 2630e3c468bd43a4c23b2f391e8e25254cbe8672..c24ba490ba7f4cb25ba032b0404790d68540c826 100644 --- a/src/common/src/tglobal.c +++ b/src/common/src/tglobal.c @@ -42,6 +42,7 @@ int32_t tsStatusInterval = 1; // second int32_t tsNumOfMnodes = 3; int32_t tsEnableVnodeBak = 1; int32_t tsEnableTelemetryReporting = 1; +char tsEmail[TSDB_FQDN_LEN] = {0}; // common int32_t tsRpcTimer = 1000; @@ -307,6 +308,8 @@ bool taosCfgDynamicOptions(char *msg) { static void doInitGlobalConfig(void) { osInit(); + srand(taosSafeRand()); + SGlobalCfg cfg = {0}; // ip address diff --git a/src/connector/jdbc/CMakeLists.txt b/src/connector/jdbc/CMakeLists.txt index 7f823b97b266dae11ce1ba384cc812a1a9d6b691..c565853ab0fd3fa961643725bbf3d17ff1dc349a 100644 --- a/src/connector/jdbc/CMakeLists.txt +++ b/src/connector/jdbc/CMakeLists.txt @@ -8,7 +8,7 @@ IF (TD_MVN_INSTALLED) ADD_CUSTOM_COMMAND(OUTPUT ${JDBC_CMD_NAME} POST_BUILD COMMAND mvn -Dmaven.test.skip=true install -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.0-dist.jar ${LIBRARY_OUTPUT_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/target/taos-jdbcdriver-2.0.8-dist.jar ${LIBRARY_OUTPUT_PATH} COMMAND mvn -Dmaven.test.skip=true clean -f ${CMAKE_CURRENT_SOURCE_DIR}/pom.xml COMMENT "build jdbc driver") ADD_CUSTOM_TARGET(${JDBC_TARGET_NAME} ALL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} DEPENDS ${JDBC_CMD_NAME}) diff --git a/src/connector/jdbc/pom.xml b/src/connector/jdbc/pom.xml index 99409fe27722fb43f9d9fa50a0c0f17b5c1f76be..3b62f66d2ec88002d2f749166fb00bff670617ee 100755 --- a/src/connector/jdbc/pom.xml +++ b/src/connector/jdbc/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.taosdata.jdbc taos-jdbcdriver - 2.0.0 + 2.0.8 jar JDBCDriver https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java index e5515c24b7a298f0d82f5ad5f880fc1a166f9a3f..c1d9d2af8e5a5c24dcfed6039e3ce06530b95276 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java @@ -587,7 +587,6 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData { public ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) throws SQLException { - /** add by zyyang **********/ Statement stmt = null; if (null != conn && !conn.isClosed()) { diff --git a/src/connector/odbc/CMakeLists.txt b/src/connector/odbc/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..58e7b6acf1f8424c8b8f72578a9ece027d1a9447 --- /dev/null +++ b/src/connector/odbc/CMakeLists.txt @@ -0,0 +1,33 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(TDengine) + +IF (TD_LINUX_64) + find_program(HAVE_ODBCINST NAMES odbcinst) + + IF (HAVE_ODBCINST) + include(CheckSymbolExists) + # shall we revert CMAKE_REQUIRED_LIBRARIES and how? + set(CMAKE_REQUIRED_LIBRARIES odbc) + check_symbol_exists(SQLExecute "sql.h" HAVE_ODBC_DEV) + if(NOT (HAVE_ODBC_DEV)) + unset(HAVE_ODBC_DEV CACHE) + message(WARNING "unixodbc-dev is not installed yet, you may install it under ubuntu by typing: sudo apt install unixodbc-dev") + else () + message(STATUS "unixodbc/unixodbc-dev are installed, and odbc connector will be built") + AUX_SOURCE_DIRECTORY(src SRC) + + # generate dynamic library (*.so) + ADD_LIBRARY(todbc SHARED ${SRC}) + SET_TARGET_PROPERTIES(todbc PROPERTIES CLEAN_DIRECT_OUTPUT 1) + SET_TARGET_PROPERTIES(todbc PROPERTIES VERSION ${TD_VER_NUMBER} SOVERSION 1) + TARGET_LINK_LIBRARIES(todbc taos) + + install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/src/install.sh ${CMAKE_BINARY_DIR})") + + ADD_SUBDIRECTORY(tests) + endif() + ELSE () + message(WARNING "unixodbc is not installed yet, you may install it under ubuntu by typing: sudo apt install unixodbc") + ENDIF () +ENDIF () + diff --git a/src/connector/odbc/src/install.sh b/src/connector/odbc/src/install.sh new file mode 100755 index 0000000000000000000000000000000000000000..b8c04677c7199384f7bc0b66515eb04d0fe560fc --- /dev/null +++ b/src/connector/odbc/src/install.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -u + +BLD_DIR="$1" + +rm -f "${BLD_DIR}/template.ini" +rm -f "${BLD_DIR}/template.dsn" + +cat > "${BLD_DIR}/template.ini" < "${BLD_DIR}/template.dsn" < + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +// #define _BSD_SOURCE +#define _XOPEN_SOURCE +#define _DEFAULT_SOURCE + +#include "taos.h" + +#include "os.h" +#include "taoserror.h" +#include "todbc_util.h" + +#include +#include + +#include + + +#define GET_REF(obj) atomic_load_64(&obj->refcount) +#define INC_REF(obj) atomic_add_fetch_64(&obj->refcount, 1) +#define DEC_REF(obj) atomic_sub_fetch_64(&obj->refcount, 1) + +#define LOCK(obj) pthread_mutex_lock(&obj->lock); +#define UNLOCK(obj) pthread_mutex_unlock(&obj->lock); + +#define SET_ERROR(obj, sqlstate, eno, err_fmt, ...) \ +do { \ + obj->err.err_no = eno; \ + const char* estr = tstrerror(eno); \ + if (!estr) estr = "Unknown error"; \ + int n = snprintf(NULL, 0, "%s: @[%d][TSDB:%x]" err_fmt "", estr, __LINE__, eno, ##__VA_ARGS__); \ + if (n<0) break; \ + char *err_str = (char*)realloc(obj->err.err_str, n+1); \ + if (!err_str) break; \ + obj->err.err_str = err_str; \ + snprintf(obj->err.err_str, n+1, "%s: @[%d][TSDB:%x]" err_fmt "", estr, __LINE__, eno, ##__VA_ARGS__); \ + snprintf((char*)obj->err.sql_state, sizeof(obj->err.sql_state), "%s", sqlstate); \ +} while (0) + +#define CLR_ERROR(obj) \ +do { \ + obj->err.err_no = TSDB_CODE_SUCCESS; \ + if (obj->err.err_str) obj->err.err_str[0] = '\0'; \ + obj->err.sql_state[0] = '\0'; \ +} while (0) + +#define FILL_ERROR(obj) \ +do { \ + size_t n = sizeof(obj->err.sql_state); \ + if (Sqlstate) strncpy((char*)Sqlstate, (char*)obj->err.sql_state, n); \ + if (NativeError) *NativeError = obj->err.err_no; \ + snprintf((char*)MessageText, BufferLength, "%s", obj->err.err_str); \ + if (TextLength && obj->err.err_str) *TextLength = strlen(obj->err.err_str); \ + if (TextLength && obj->err.err_str) *TextLength = utf8_chars(obj->err.err_str); \ +} while (0) + +#define FREE_ERROR(obj) \ +do { \ + obj->err.err_no = TSDB_CODE_SUCCESS; \ + if (obj->err.err_str) { \ + free(obj->err.err_str); \ + obj->err.err_str = NULL; \ + } \ + obj->err.sql_state[0] = '\0'; \ +} while (0) + +#define SET_UNSUPPORT_ERROR(obj, sqlstate, err_fmt, ...) \ +do { \ + SET_ERROR(obj, sqlstate, TSDB_CODE_ODBC_NOT_SUPPORT, err_fmt, ##__VA_ARGS__); \ +} while (0) \ + +#define SET_HANDLE_INVALID(obj, sqlstate, err_fmt, ...) \ +do { \ + SET_ERROR(obj, sqlstate, TSDB_CODE_QRY_INVALID_QHANDLE, err_fmt, ##__VA_ARGS__); \ +} while (0); + +#define SDUP(s,n) (s ? (s[n] ? (const char*)strndup((const char*)s,n) : (const char*)s) : strdup("")) +#define SFRE(x,s,n) \ +do { \ + if (x==(const char*)s) break; \ + if (x) { \ + free((char*)x); \ + x = NULL; \ + } \ +} while (0) + +#define CHK_CONN(obj) \ +do { \ + if (!obj->conn) { \ + SET_ERROR(obj, "HY000", TSDB_CODE_ODBC_INVALID_HANDLE, "connection closed or not ready"); \ + return SQL_ERROR; \ + } \ +} while (0); + +#define CHK_CONN_TAOS(obj) \ +do { \ + if (!obj->conn->taos) { \ + SET_ERROR(obj, "HY000", TSDB_CODE_ODBC_INVALID_HANDLE, "connection to data source closed or not ready"); \ + return SQL_ERROR; \ + } \ +} while (0); + +#define CHK_RS(r_091c, sql_091c, fmt_091c, ...) \ +do { \ + r_091c = SQL_ERROR; \ + int e = sql_091c->rs ? taos_errno(sql_091c->rs) : terrno; \ + if (e != TSDB_CODE_SUCCESS) { \ + SET_ERROR(sql_091c, "HY000", e, fmt_091c, ##__VA_ARGS__); \ + break; \ + } \ + r_091c = SQL_SUCCESS; \ +} while (0) + +#define PROFILING 0 + +#define PROFILE(statement) \ +do { \ + if (!PROFILING) { \ + statement; \ + break; \ + } \ + struct timeval tv0, tv1; \ + gettimeofday(&tv0, NULL); \ + statement; \ + gettimeofday(&tv1, NULL); \ + double delta = difftime(tv1.tv_sec, tv0.tv_sec); \ + delta *= 1000000; \ + delta += (tv1.tv_usec-tv0.tv_usec); \ + delta /= 1000000; \ + D("%s: elapsed: [%.6f]s", #statement, delta); \ +} while (0) + + +#define CHK_CONV(statement) \ +do { \ + const char *sqlstate = statement; \ + if (sqlstate) { \ + SET_ERROR(sql, sqlstate, TSDB_CODE_ODBC_OUT_OF_RANGE, \ + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", \ + sql_c_type(valueType), valueType, valueType, \ + taos_data_type(type), type, type, idx+1); \ + return SQL_ERROR; \ + } \ +} while (0) + +typedef struct env_s env_t; +typedef struct conn_s conn_t; +typedef struct sql_s sql_t; +typedef struct taos_error_s taos_error_t; +typedef struct param_bind_s param_bind_t; + +struct param_bind_s { + SQLUSMALLINT ParameterNumber; + SQLSMALLINT ValueType; + SQLSMALLINT ParameterType; + SQLULEN LengthPrecision; + SQLSMALLINT ParameterScale; + SQLPOINTER ParameterValue; + SQLLEN *StrLen_or_Ind; + + unsigned int valid; +}; + +struct taos_error_s { + char *err_str; + int err_no; + + SQLCHAR sql_state[6]; +}; + +struct env_s { + uint64_t refcount; + unsigned int destroying:1; + + taos_error_t err; +}; + +struct conn_s { + uint64_t refcount; + env_t *env; + + TAOS *taos; + + taos_error_t err; +}; + +struct sql_s { + uint64_t refcount; + conn_t *conn; + + TAOS_STMT *stmt; + param_bind_t *params; + int n_params; + size_t rowlen; + size_t n_rows; + size_t ptr_offset; + + TAOS_RES *rs; + TAOS_ROW row; + + taos_error_t err; + unsigned int is_prepared:1; + unsigned int is_insert:1; + unsigned int is_executed:1; +}; + +typedef struct c_target_s c_target_t; +struct c_target_s { + SQLUSMALLINT col; + SQLSMALLINT ct; // c type: SQL_C_XXX + char *ptr; + SQLLEN len; + SQLLEN *soi; +}; + +static pthread_once_t init_once = PTHREAD_ONCE_INIT; +static void init_routine(void); + +// conversions + +const char* tsdb_int64_to_bit(int64_t src, int8_t *dst); +const char* tsdb_int64_to_tinyint(int64_t src, int8_t *dst); +const char* tsdb_int64_to_smallint(int64_t src, int16_t *dst); +const char* tsdb_int64_to_int(int64_t src, int32_t *dst); +const char* tsdb_int64_to_bigint(int64_t src, int64_t *dst); +const char* tsdb_int64_to_ts(int64_t src, int64_t *dst); +const char* tsdb_int64_to_float(int64_t src, float *dst); +const char* tsdb_int64_to_double(int64_t src, double *dst); +const char* tsdb_int64_to_char(int64_t src, char *dst, size_t dlen); + +const char* tsdb_double_to_bit(double src, int precision, int8_t *dst); +const char* tsdb_double_to_tinyint(double src, int precision, int8_t *dst); +const char* tsdb_double_to_smallint(double src, int precision, int16_t *dst); +const char* tsdb_double_to_int(double src, int precision, int32_t *dst); +const char* tsdb_double_to_bigint(double src, int precision, int64_t *dst); +const char* tsdb_double_to_ts(double src, int precision, int64_t *dst); +const char* tsdb_double_to_float(double src, int precision, float *dst); +const char* tsdb_double_to_double(double src, int precision, double *dst); +const char* tsdb_double_to_char(double src, int precision, char *dst, size_t dlen); + +const char* tsdb_chars_to_bit(const char *src, int8_t *dst); +const char* tsdb_chars_to_tinyint(const char *src, int8_t *dst); +const char* tsdb_chars_to_smallint(const char *src, int16_t *dst); +const char* tsdb_chars_to_int(const char *src, int32_t *dst); +const char* tsdb_chars_to_bigint(const char *src, int64_t *dst); +const char* tsdb_chars_to_ts(const char *src, int64_t *dst); +const char* tsdb_chars_to_float(const char *src, float *dst); +const char* tsdb_chars_to_double(const char *src, double *dst); +const char* tsdb_chars_to_char(const char *src, char *dst, size_t dlen); + + +static int do_field_display_size(TAOS_FIELD *field); + +static SQLRETURN doSQLAllocEnv(SQLHENV *EnvironmentHandle) +{ + pthread_once(&init_once, init_routine); + + env_t *env = (env_t*)calloc(1, sizeof(*env)); + if (!env) return SQL_ERROR; + + DASSERT(INC_REF(env)>0); + + *EnvironmentHandle = env; + + CLR_ERROR(env); + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLAllocEnv(SQLHENV *EnvironmentHandle) +{ + SQLRETURN r; + r = doSQLAllocEnv(EnvironmentHandle); + return r; +} + +static SQLRETURN doSQLFreeEnv(SQLHENV EnvironmentHandle) +{ + env_t *env = (env_t*)EnvironmentHandle; + if (!env) return SQL_ERROR; + + DASSERT(GET_REF(env)==1); + + DASSERT(!env->destroying); + + env->destroying = 1; + DASSERT(env->destroying == 1); + + DASSERT(DEC_REF(env)==0); + + FREE_ERROR(env); + free(env); + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLFreeEnv(SQLHENV EnvironmentHandle) +{ + SQLRETURN r; + r = doSQLFreeEnv(EnvironmentHandle); + return r; +} + +static SQLRETURN doSQLAllocConnect(SQLHENV EnvironmentHandle, + SQLHDBC *ConnectionHandle) +{ + env_t *env = (env_t*)EnvironmentHandle; + if (!env) return SQL_ERROR; + + DASSERT(INC_REF(env)>1); + + conn_t *conn = NULL; + do { + conn = (conn_t*)calloc(1, sizeof(*conn)); + if (!conn) { + SET_ERROR(env, "HY001", TSDB_CODE_ODBC_OOM, ""); + break; + } + + conn->env = env; + *ConnectionHandle = conn; + + DASSERT(INC_REF(conn)>0); + + return SQL_SUCCESS; + } while (0); + + DASSERT(DEC_REF(env)>0); + + return SQL_ERROR; +} + +SQLRETURN SQL_API SQLAllocConnect(SQLHENV EnvironmentHandle, + SQLHDBC *ConnectionHandle) +{ + SQLRETURN r; + r = doSQLAllocConnect(EnvironmentHandle, ConnectionHandle); + return r; +} + +static SQLRETURN doSQLFreeConnect(SQLHDBC ConnectionHandle) +{ + conn_t *conn = (conn_t*)ConnectionHandle; + if (!conn) return SQL_ERROR; + + DASSERT(GET_REF(conn)==1); + + DASSERT(conn->env); + + do { + if (conn->taos) { + taos_close(conn->taos); + conn->taos = NULL; + } + + DASSERT(DEC_REF(conn->env)>0); + DASSERT(DEC_REF(conn)==0); + + conn->env = NULL; + FREE_ERROR(conn); + free(conn); + } while (0); + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLFreeConnect(SQLHDBC ConnectionHandle) +{ + SQLRETURN r; + r = doSQLFreeConnect(ConnectionHandle); + return r; +} + +static SQLRETURN doSQLConnect(SQLHDBC ConnectionHandle, + SQLCHAR *ServerName, SQLSMALLINT NameLength1, + SQLCHAR *UserName, SQLSMALLINT NameLength2, + SQLCHAR *Authentication, SQLSMALLINT NameLength3) +{ + conn_t *conn = (conn_t*)ConnectionHandle; + if (!conn) return SQL_ERROR; + + if (conn->taos) { + SET_ERROR(conn, "08002", TSDB_CODE_ODBC_CONNECTION_BUSY, "connection still in use"); + return SQL_ERROR; + } + + const char *serverName = SDUP(ServerName, NameLength1); + const char *userName = SDUP(UserName, NameLength2); + const char *auth = SDUP(Authentication, NameLength3); + + do { + if ((ServerName && !serverName) || (UserName && !userName) || (Authentication && !auth)) { + SET_ERROR(conn, "HY001", TSDB_CODE_ODBC_OOM, ""); + break; + } + + // TODO: data-race + // TODO: shall receive ip/port from odbc.ini + conn->taos = taos_connect("localhost", userName, auth, NULL, 0); + if (!conn->taos) { + SET_ERROR(conn, "08001", terrno, "failed to connect to data source"); + break; + } + } while (0); + + SFRE(serverName, ServerName, NameLength1); + SFRE(userName, UserName, NameLength2); + SFRE(auth, Authentication, NameLength3); + + return conn->taos ? SQL_SUCCESS : SQL_ERROR; +} + +SQLRETURN SQL_API SQLConnect(SQLHDBC ConnectionHandle, + SQLCHAR *ServerName, SQLSMALLINT NameLength1, + SQLCHAR *UserName, SQLSMALLINT NameLength2, + SQLCHAR *Authentication, SQLSMALLINT NameLength3) +{ + SQLRETURN r; + r = doSQLConnect(ConnectionHandle, ServerName, NameLength1, + UserName, NameLength2, + Authentication, NameLength3); + return r; +} + +static SQLRETURN doSQLDisconnect(SQLHDBC ConnectionHandle) +{ + conn_t *conn = (conn_t*)ConnectionHandle; + if (!conn) return SQL_ERROR; + + if (conn->taos) { + taos_close(conn->taos); + conn->taos = NULL; + } + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLDisconnect(SQLHDBC ConnectionHandle) +{ + SQLRETURN r; + r = doSQLDisconnect(ConnectionHandle); + return r; +} + +static SQLRETURN doSQLAllocStmt(SQLHDBC ConnectionHandle, + SQLHSTMT *StatementHandle) +{ + conn_t *conn = (conn_t*)ConnectionHandle; + if (!conn) return SQL_ERROR; + + DASSERT(INC_REF(conn)>1); + + do { + sql_t *sql = (sql_t*)calloc(1, sizeof(*sql)); + if (!sql) { + SET_ERROR(conn, "HY001", TSDB_CODE_ODBC_OOM, ""); + break; + } + + sql->conn = conn; + DASSERT(INC_REF(sql)>0); + + *StatementHandle = sql; + + return SQL_SUCCESS; + } while (0); + + DASSERT(DEC_REF(conn)>0); + + return SQL_ERROR; +} + +SQLRETURN SQL_API SQLAllocStmt(SQLHDBC ConnectionHandle, + SQLHSTMT *StatementHandle) +{ + SQLRETURN r; + r = doSQLAllocStmt(ConnectionHandle, StatementHandle); + return r; +} + +static SQLRETURN doSQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) +{ + switch (HandleType) { + case SQL_HANDLE_ENV: { + SQLHENV env = {0}; + SQLRETURN r = doSQLAllocEnv(&env); + if (r==SQL_SUCCESS && OutputHandle) *OutputHandle = env; + return r; + } break; + case SQL_HANDLE_DBC: { + SQLHDBC dbc = {0}; + SQLRETURN r = doSQLAllocConnect(InputHandle, &dbc); + if (r==SQL_SUCCESS && OutputHandle) *OutputHandle = dbc; + return r; + } break; + case SQL_HANDLE_STMT: { + SQLHSTMT stmt = {0}; + SQLRETURN r = doSQLAllocStmt(InputHandle, &stmt); + if (r==SQL_SUCCESS && OutputHandle) *OutputHandle = stmt; + return r; + } break; + default: { + return SQL_ERROR; + } break; + } +} + +SQLRETURN SQL_API SQLAllocHandle(SQLSMALLINT HandleType, SQLHANDLE InputHandle, SQLHANDLE *OutputHandle) +{ + SQLRETURN r; + r = doSQLAllocHandle(HandleType, InputHandle, OutputHandle); + return r; +} + +static SQLRETURN doSQLFreeStmt(SQLHSTMT StatementHandle, + SQLUSMALLINT Option) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + if (Option == SQL_CLOSE) return SQL_SUCCESS; + if (Option != SQL_DROP) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NOT_SUPPORT, "free statement with Option[%x] not supported yet", Option); + return SQL_ERROR; + } + + DASSERT(GET_REF(sql)==1); + + if (sql->rs) { + taos_free_result(sql->rs); + sql->rs = NULL; + } + + if (sql->stmt) { + taos_stmt_close(sql->stmt); + sql->stmt = NULL; + } + + if (sql->params) { + free(sql->params); + sql->params = NULL; + } + sql->n_params = 0; + + DASSERT(DEC_REF(sql->conn)>0); + DASSERT(DEC_REF(sql)==0); + + sql->conn = NULL; + + FREE_ERROR(sql); + free(sql); + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLFreeStmt(SQLHSTMT StatementHandle, + SQLUSMALLINT Option) +{ + SQLRETURN r; + r = doSQLFreeStmt(StatementHandle, Option); + return r; +} + +static SQLRETURN doSQLExecDirect(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (sql->rs) { + taos_free_result(sql->rs); + sql->rs = NULL; + sql->row = NULL; + } + + if (sql->stmt) { + taos_stmt_close(sql->stmt); + sql->stmt = NULL; + } + + if (sql->params) { + free(sql->params); + sql->params = NULL; + } + sql->n_params = 0; + + const char *stxt = SDUP(StatementText, TextLength); + + SQLRETURN r = SQL_ERROR; + do { + if (!stxt) { + SET_ERROR(sql, "HY001", TSDB_CODE_ODBC_OOM, ""); + break; + } + sql->rs = taos_query(sql->conn->taos, stxt); + CHK_RS(r, sql, "failed to execute"); + } while (0); + + SFRE(stxt, StatementText, TextLength); + + return r; +} + +SQLRETURN SQL_API SQLExecDirect(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength) +{ + SQLRETURN r; + r = doSQLExecDirect(StatementHandle, StatementText, TextLength); + return r; +} + +SQLRETURN SQL_API SQLExecDirectW(SQLHSTMT hstmt, SQLWCHAR *szSqlStr, SQLINTEGER cbSqlStr) +{ + size_t bytes = 0; + SQLCHAR *utf8 = wchars_to_chars(szSqlStr, cbSqlStr, &bytes); + return SQLExecDirect(hstmt, utf8, bytes); +} + +static SQLRETURN doSQLNumResultCols(SQLHSTMT StatementHandle, + SQLSMALLINT *ColumnCount) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (sql->is_insert) { + if (ColumnCount) { + *ColumnCount = 0; + } + return SQL_SUCCESS; + } + + if (!sql->rs) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NO_RESULT, ""); + return SQL_ERROR; + } + + int fields = taos_field_count(sql->rs); + if (ColumnCount) { + *ColumnCount = fields; + } + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLNumResultCols(SQLHSTMT StatementHandle, + SQLSMALLINT *ColumnCount) +{ + SQLRETURN r; + r = doSQLNumResultCols(StatementHandle, ColumnCount); + return r; +} + +static SQLRETURN doSQLRowCount(SQLHSTMT StatementHandle, + SQLLEN *RowCount) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (sql->is_insert) { + if (RowCount) *RowCount = 0; + return SQL_SUCCESS; + } + + if (!sql->rs) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NO_RESULT, ""); + return SQL_ERROR; + } + + int rows = taos_affected_rows(sql->rs); + if (RowCount) { + *RowCount = rows; + } + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLRowCount(SQLHSTMT StatementHandle, + SQLLEN *RowCount) +{ + SQLRETURN r; + r = doSQLRowCount(StatementHandle, RowCount); + return r; +} + +static SQLRETURN doSQLColAttribute(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLLEN *NumericAttribute ) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->rs) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NO_RESULT, ""); + return SQL_ERROR; + } + + int nfields = taos_field_count(sql->rs); + TAOS_FIELD *fields = taos_fetch_fields(sql->rs); + + if (nfields==0 || fields==NULL) { + SET_ERROR(sql, "07005", TSDB_CODE_ODBC_NO_FIELDS, ""); + return SQL_ERROR; + } + + if (ColumnNumber<=0 || ColumnNumber>nfields) { + SET_ERROR(sql, "07009", TSDB_CODE_ODBC_OUT_OF_RANGE, "invalid column number [%d]", ColumnNumber); + return SQL_ERROR; + } + + TAOS_FIELD *field = fields + ColumnNumber-1; + + switch (FieldIdentifier) { + case SQL_COLUMN_DISPLAY_SIZE: { + *NumericAttribute = do_field_display_size(field); + } break; + case SQL_COLUMN_LABEL: { + size_t n = sizeof(field->name); + strncpy(CharacterAttribute, field->name, (n>BufferLength ? BufferLength : n)); + } break; + case SQL_COLUMN_UNSIGNED: { + *NumericAttribute = SQL_FALSE; + } break; + default: { + SET_ERROR(sql, "HY091", TSDB_CODE_ODBC_OUT_OF_RANGE, + "FieldIdentifier[%d/0x%x] for Column [%d] not supported yet", + FieldIdentifier, FieldIdentifier, ColumnNumber); + return SQL_ERROR; + } break; + } + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLColAttribute(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLUSMALLINT FieldIdentifier, + SQLPOINTER CharacterAttribute, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength, SQLLEN *NumericAttribute ) +{ + SQLRETURN r; + r = doSQLColAttribute(StatementHandle, ColumnNumber, FieldIdentifier, + CharacterAttribute, BufferLength, + StringLength, NumericAttribute); + return r; +} + +static SQLRETURN conv_tsdb_bool_to_c_bit(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_tinyint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_short(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_bool_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b); +static SQLRETURN conv_tsdb_v1_to_c_tinyint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v1_to_c_short(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v1_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v1_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v1_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v1_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v1_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v1_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1); +static SQLRETURN conv_tsdb_v2_to_c_short(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2); +static SQLRETURN conv_tsdb_v2_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2); +static SQLRETURN conv_tsdb_v2_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2); +static SQLRETURN conv_tsdb_v2_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2); +static SQLRETURN conv_tsdb_v2_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2); +static SQLRETURN conv_tsdb_v2_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2); +static SQLRETURN conv_tsdb_v2_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2); +static SQLRETURN conv_tsdb_v4_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4); +static SQLRETURN conv_tsdb_v4_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4); +static SQLRETURN conv_tsdb_v4_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4); +static SQLRETURN conv_tsdb_v4_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4); +static SQLRETURN conv_tsdb_v4_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4); +static SQLRETURN conv_tsdb_v4_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4); +static SQLRETURN conv_tsdb_v8_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8); +static SQLRETURN conv_tsdb_v8_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8); +static SQLRETURN conv_tsdb_v8_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8); +static SQLRETURN conv_tsdb_v8_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8); +static SQLRETURN conv_tsdb_v8_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8); +static SQLRETURN conv_tsdb_f4_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4); +static SQLRETURN conv_tsdb_f4_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4); +static SQLRETURN conv_tsdb_f4_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4); +static SQLRETURN conv_tsdb_f4_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4); +static SQLRETURN conv_tsdb_f8_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, double f8); +static SQLRETURN conv_tsdb_f8_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, double f8); +static SQLRETURN conv_tsdb_f8_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, double f8); +static SQLRETURN conv_tsdb_ts_to_c_v8(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts); +static SQLRETURN conv_tsdb_ts_to_c_str(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts); +static SQLRETURN conv_tsdb_ts_to_c_bin(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts); +static SQLRETURN conv_tsdb_ts_to_c_ts(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts); +static SQLRETURN conv_tsdb_bin_to_c_str(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const unsigned char *bin); +static SQLRETURN conv_tsdb_bin_to_c_bin(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const unsigned char *bin); +static SQLRETURN conv_tsdb_str_to_c_bit(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_v1(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_v2(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_v4(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_v8(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_f4(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_f8(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_str(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); +static SQLRETURN conv_tsdb_str_to_c_bin(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str); + +static SQLRETURN doSQLGetData(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->rs) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NO_RESULT, ""); + return SQL_ERROR; + } + + if (!sql->row) { + SET_ERROR(sql, "24000", TSDB_CODE_ODBC_INVALID_CURSOR, ""); + return SQL_ERROR; + } + + DASSERT(TargetValue); + + int nfields = taos_field_count(sql->rs); + TAOS_FIELD *fields = taos_fetch_fields(sql->rs); + + if (ColumnNumber<=0 || ColumnNumber>nfields) { + SET_ERROR(sql, "07009", TSDB_CODE_ODBC_OUT_OF_RANGE, "invalid column number [%d]", ColumnNumber); + return SQL_ERROR; + } + + if (TargetValue == NULL) { + SET_ERROR(sql, "HY009", TSDB_CODE_ODBC_BAD_ARG, "NULL TargetValue not allowed for col [%d]", ColumnNumber); + return SQL_ERROR; + } + + TAOS_FIELD *field = fields + ColumnNumber-1; + void *row = sql->row[ColumnNumber-1]; + + if (!row) { + if (StrLen_or_Ind) { + *StrLen_or_Ind = SQL_NULL_DATA; + } + return SQL_SUCCESS; + } + + c_target_t target = {0}; + target.col = ColumnNumber; + target.ct = TargetType; + target.ptr = TargetValue; + target.len = BufferLength; + target.soi = StrLen_or_Ind; + + switch (field->type) { + case TSDB_DATA_TYPE_BOOL: { + int8_t v = *(int8_t*)row; + if (v) v = 1; + switch (target.ct) { + case SQL_C_BIT: return conv_tsdb_bool_to_c_bit(sql, &target, field, v); + case SQL_C_TINYINT: return conv_tsdb_bool_to_c_tinyint(sql, &target, field, v); + case SQL_C_SHORT: return conv_tsdb_bool_to_c_short(sql, &target, field, v); + case SQL_C_LONG: return conv_tsdb_bool_to_c_long(sql, &target, field, v); + case SQL_C_SBIGINT: return conv_tsdb_bool_to_c_sbigint(sql, &target, field, v); + case SQL_C_FLOAT: return conv_tsdb_bool_to_c_float(sql, &target, field, v); + case SQL_C_DOUBLE: return conv_tsdb_bool_to_c_double(sql, &target, field, v); + case SQL_C_CHAR: return conv_tsdb_bool_to_c_char(sql, &target, field, v); + case SQL_C_BINARY: return conv_tsdb_bool_to_c_binary(sql, &target, field, v); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_TINYINT: { + int8_t v = *(int8_t*)row; + switch (target.ct) { + case SQL_C_TINYINT: return conv_tsdb_v1_to_c_tinyint(sql, &target, field, v); + case SQL_C_SHORT: return conv_tsdb_v1_to_c_short(sql, &target, field, v); + case SQL_C_LONG: return conv_tsdb_v1_to_c_long(sql, &target, field, v); + case SQL_C_SBIGINT: return conv_tsdb_v1_to_c_sbigint(sql, &target, field, v); + case SQL_C_FLOAT: return conv_tsdb_v1_to_c_float(sql, &target, field, v); + case SQL_C_DOUBLE: return conv_tsdb_v1_to_c_double(sql, &target, field, v); + case SQL_C_CHAR: return conv_tsdb_v1_to_c_char(sql, &target, field, v); + case SQL_C_BINARY: return conv_tsdb_v1_to_c_binary(sql, &target, field, v); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_SMALLINT: { + int16_t v = *(int16_t*)row; + switch (target.ct) { + case SQL_C_SHORT: return conv_tsdb_v2_to_c_short(sql, &target, field, v); + case SQL_C_LONG: return conv_tsdb_v2_to_c_long(sql, &target, field, v); + case SQL_C_SBIGINT: return conv_tsdb_v2_to_c_sbigint(sql, &target, field, v); + case SQL_C_FLOAT: return conv_tsdb_v2_to_c_float(sql, &target, field, v); + case SQL_C_DOUBLE: return conv_tsdb_v2_to_c_double(sql, &target, field, v); + case SQL_C_CHAR: return conv_tsdb_v2_to_c_char(sql, &target, field, v); + case SQL_C_BINARY: return conv_tsdb_v2_to_c_binary(sql, &target, field, v); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_INT: { + int32_t v = *(int32_t*)row; + switch (target.ct) { + case SQL_C_LONG: return conv_tsdb_v4_to_c_long(sql, &target, field, v); + case SQL_C_SBIGINT: return conv_tsdb_v4_to_c_sbigint(sql, &target, field, v); + case SQL_C_FLOAT: return conv_tsdb_v4_to_c_float(sql, &target, field, v); + case SQL_C_DOUBLE: return conv_tsdb_v4_to_c_double(sql, &target, field, v); + case SQL_C_CHAR: return conv_tsdb_v4_to_c_char(sql, &target, field, v); + case SQL_C_BINARY: return conv_tsdb_v4_to_c_binary(sql, &target, field, v); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_BIGINT: { + int64_t v = *(int64_t*)row; + switch (target.ct) { + case SQL_C_SBIGINT: return conv_tsdb_v8_to_c_sbigint(sql, &target, field, v); + case SQL_C_FLOAT: return conv_tsdb_v8_to_c_float(sql, &target, field, v); + case SQL_C_DOUBLE: return conv_tsdb_v8_to_c_double(sql, &target, field, v); + case SQL_C_CHAR: return conv_tsdb_v8_to_c_char(sql, &target, field, v); + case SQL_C_BINARY: return conv_tsdb_v8_to_c_binary(sql, &target, field, v); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_FLOAT: { + float v = *(float*)row; + switch (target.ct) { + case SQL_C_FLOAT: return conv_tsdb_f4_to_c_float(sql, &target, field, v); + case SQL_C_DOUBLE: return conv_tsdb_f4_to_c_double(sql, &target, field, v); + case SQL_C_CHAR: return conv_tsdb_f4_to_c_char(sql, &target, field, v); + case SQL_C_BINARY: return conv_tsdb_f4_to_c_binary(sql, &target, field, v); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_DOUBLE: { + double v = *(double*)row; + switch (target.ct) { + case SQL_C_DOUBLE: return conv_tsdb_f8_to_c_double(sql, &target, field, v); + case SQL_C_CHAR: return conv_tsdb_f8_to_c_char(sql, &target, field, v); + case SQL_C_BINARY: return conv_tsdb_f8_to_c_binary(sql, &target, field, v); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_TIMESTAMP: { + SQL_TIMESTAMP_STRUCT ts = {0}; + int64_t v = *(int64_t*)row; + time_t t = v/1000; + struct tm tm = {0}; + localtime_r(&t, &tm); + ts.year = tm.tm_year + 1900; + ts.month = tm.tm_mon + 1; + ts.day = tm.tm_mday; + ts.hour = tm.tm_hour; + ts.minute = tm.tm_min; + ts.second = tm.tm_sec; + ts.fraction = v%1000 * 1000000; + switch (target.ct) { + case SQL_C_SBIGINT: return conv_tsdb_ts_to_c_v8(sql, &target, field, &ts); + case SQL_C_CHAR: return conv_tsdb_ts_to_c_str(sql, &target, field, &ts); + case SQL_C_BINARY: return conv_tsdb_ts_to_c_bin(sql, &target, field, &ts); + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_TIMESTAMP: return conv_tsdb_ts_to_c_ts(sql, &target, field, &ts); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_BINARY: { + const unsigned char *bin = (const unsigned char *)row; + switch (target.ct) { + case SQL_C_CHAR: return conv_tsdb_bin_to_c_str(sql, &target, field, bin); + case SQL_C_BINARY: return conv_tsdb_bin_to_c_bin(sql, &target, field, bin); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + case TSDB_DATA_TYPE_NCHAR: { + const char *str = (const char *)row; + switch (target.ct) { + case SQL_C_BIT: return conv_tsdb_str_to_c_bit(sql, &target, field, str); + case SQL_C_TINYINT: return conv_tsdb_str_to_c_v1(sql, &target, field, str); + case SQL_C_SHORT: return conv_tsdb_str_to_c_v2(sql, &target, field, str); + case SQL_C_LONG: return conv_tsdb_str_to_c_v4(sql, &target, field, str); + case SQL_C_SBIGINT: return conv_tsdb_str_to_c_v8(sql, &target, field, str); + case SQL_C_FLOAT: return conv_tsdb_str_to_c_f4(sql, &target, field, str); + case SQL_C_DOUBLE: return conv_tsdb_str_to_c_f8(sql, &target, field, str); + case SQL_C_CHAR: return conv_tsdb_str_to_c_str(sql, &target, field, str); + case SQL_C_BINARY: return conv_tsdb_str_to_c_bin(sql, &target, field, str); + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, + "no convertion from [%s] to [%s[%d][0x%x]] for col [%d]", + taos_data_type(field->type), sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } + } + } break; + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for col [%d]", + taos_data_type(field->type), field->type, field->type, + sql_c_type(target.ct), target.ct, target.ct, ColumnNumber); + return SQL_ERROR; + } break; + } +} + +SQLRETURN SQL_API SQLGetData(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, + SQLPOINTER TargetValue, SQLLEN BufferLength, + SQLLEN *StrLen_or_Ind) +{ + SQLRETURN r; + r = doSQLGetData(StatementHandle, ColumnNumber, TargetType, + TargetValue, BufferLength, + StrLen_or_Ind); + return r; +} + +static SQLRETURN doSQLFetch(SQLHSTMT StatementHandle) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->rs) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NO_RESULT, ""); + return SQL_ERROR; + } + + sql->row = taos_fetch_row(sql->rs); + return sql->row ? SQL_SUCCESS : SQL_NO_DATA; +} + +SQLRETURN SQL_API SQLFetch(SQLHSTMT StatementHandle) +{ + SQLRETURN r; + r = doSQLFetch(StatementHandle); + return r; +} + +static SQLRETURN doSQLPrepare(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (sql->rs) { + taos_free_result(sql->rs); + sql->rs = NULL; + sql->row = NULL; + } + + if (sql->stmt) { + taos_stmt_close(sql->stmt); + sql->stmt = NULL; + } + + if (sql->params) { + free(sql->params); + sql->params = NULL; + } + sql->n_params = 0; + sql->is_insert = 0; + + do { + sql->stmt = taos_stmt_init(sql->conn->taos); + if (!sql->stmt) { + SET_ERROR(sql, "HY001", terrno, "failed to initialize TAOS statement internally"); + break; + } + + int ok = 0; + do { + int r = taos_stmt_prepare(sql->stmt, (const char *)StatementText, TextLength); + if (r) { + SET_ERROR(sql, "HY000", r, "failed to prepare a TAOS statement"); + break; + } + sql->is_prepared = 1; + + int is_insert = 0; + r = taos_stmt_is_insert(sql->stmt, &is_insert); + if (r) { + SET_ERROR(sql, "HY000", r, "failed to determine if a prepared-statement is of insert"); + break; + } + sql->is_insert = is_insert ? 1 : 0; + + int params = 0; + r = taos_stmt_num_params(sql->stmt, ¶ms); + if (r) { + SET_ERROR(sql, "HY000", terrno, "fetch num of statement params failed"); + break; + } + DASSERT(params>=0); + + if (params>0) { + param_bind_t *ar = (param_bind_t*)calloc(1, params * sizeof(*ar)); + if (!ar) { + SET_ERROR(sql, "HY001", TSDB_CODE_ODBC_OOM, ""); + break; + } + sql->params = ar; + } + + sql->n_params = params; + + ok = 1; + } while (0); + + if (!ok) { + taos_stmt_close(sql->stmt); + sql->stmt = NULL; + sql->is_prepared = 0; + sql->is_insert = 0; + sql->is_executed = 0; + } + } while (0); + + return sql->stmt ? SQL_SUCCESS : SQL_ERROR; +} + +SQLRETURN SQL_API SQLPrepare(SQLHSTMT StatementHandle, + SQLCHAR *StatementText, SQLINTEGER TextLength) +{ + SQLRETURN r; + r = doSQLPrepare(StatementHandle, StatementText, TextLength); + return r; +} + +static const int yes = 1; +static const int no = 0; + +static SQLRETURN do_bind_param_value(sql_t *sql, int idx_row, int idx, param_bind_t *param, TAOS_BIND *bind) +{ + if (!param->valid) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NOT_SUPPORT, "parameter [@%d] not bound yet", idx+1); + return SQL_ERROR; + } + + SQLPOINTER paramValue = param->ParameterValue; + SQLSMALLINT valueType = param->ValueType; + SQLLEN *soi = param->StrLen_or_Ind; + + size_t offset = idx_row * sql->rowlen + sql->ptr_offset; + + if (paramValue) paramValue += offset; + if (soi) soi = (SQLLEN*)((char*)soi + offset); + + + if (soi && *soi == SQL_NULL_DATA) { + bind->is_null = (int*)&yes; + return SQL_SUCCESS; + } + bind->is_null = (int*)&no; + int type = 0; + int bytes = 0; + if (sql->is_insert) { + int r = taos_stmt_get_param(sql->stmt, idx, &type, &bytes); + if (r) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_OUT_OF_RANGE, "parameter [@%d] not valid", idx+1); + return SQL_ERROR; + } + } else { + switch (valueType) { + case SQL_C_LONG: { + type = TSDB_DATA_TYPE_INT; + } break; + case SQL_C_WCHAR: { + type = TSDB_DATA_TYPE_NCHAR; + bytes = SQL_NTS; + } break; + case SQL_C_CHAR: + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + idx+1); + return SQL_ERROR; + } break; + } + } + + // ref: https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/converting-data-from-c-to-sql-data-types?view=sql-server-ver15 + switch (type) { + case TSDB_DATA_TYPE_BOOL: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.b); + bind->buffer = &bind->u.b; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_LONG: { + CHK_CONV(tsdb_int64_to_bit(*(int32_t*)paramValue, &bind->u.b)); + } break; + case SQL_C_BIT: { + CHK_CONV(tsdb_int64_to_bit(*(int8_t*)paramValue, &bind->u.b)); + } break; + case SQL_C_CHAR: + case SQL_C_WCHAR: + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_TINYINT: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.v1); + bind->buffer = &bind->u.v1; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_TINYINT: { + CHK_CONV(tsdb_int64_to_tinyint(*(int8_t*)paramValue, &bind->u.v1)); + } break; + case SQL_C_SHORT: { + CHK_CONV(tsdb_int64_to_tinyint(*(int16_t*)paramValue, &bind->u.v1)); + } break; + case SQL_C_LONG: { + CHK_CONV(tsdb_int64_to_tinyint(*(int32_t*)paramValue, &bind->u.v1)); + } break; + case SQL_C_SBIGINT: { + CHK_CONV(tsdb_int64_to_tinyint(*(int64_t*)paramValue, &bind->u.v1)); + } break; + case SQL_C_CHAR: + case SQL_C_WCHAR: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_SMALLINT: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.v2); + bind->buffer = &bind->u.v2; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_LONG: { + CHK_CONV(tsdb_int64_to_smallint(*(int32_t*)paramValue, &bind->u.v2)); + } break; + case SQL_C_SHORT: { + CHK_CONV(tsdb_int64_to_smallint(*(int16_t*)paramValue, &bind->u.v2)); + } break; + case SQL_C_CHAR: + case SQL_C_WCHAR: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_INT: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.v4); + bind->buffer = &bind->u.v4; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_LONG: { + CHK_CONV(tsdb_int64_to_int(*(int32_t*)paramValue, &bind->u.v4)); + } break; + case SQL_C_CHAR: + case SQL_C_WCHAR: + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_BIGINT: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.v8); + bind->buffer = &bind->u.v8; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_SBIGINT: { + bind->u.v8 = *(int64_t*)paramValue; + } break; + case SQL_C_LONG: { + bind->u.v8 = *(int32_t*)paramValue; + } break; + case SQL_C_CHAR: + case SQL_C_WCHAR: + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_FLOAT: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.f4); + bind->buffer = &bind->u.f4; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_DOUBLE: { + bind->u.f4 = *(double*)paramValue; + } break; + case SQL_C_FLOAT: { + bind->u.f4 = *(float*)paramValue; + } break; + case SQL_C_CHAR: + case SQL_C_WCHAR: + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_LONG: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_DOUBLE: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.f8); + bind->buffer = &bind->u.f8; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_DOUBLE: { + bind->u.f8 = *(double*)paramValue; + } break; + case SQL_C_CHAR: + case SQL_C_WCHAR: + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_LONG: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_BINARY: { + bind->buffer_type = type; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_WCHAR: { + DASSERT(soi); + DASSERT(*soi != SQL_NTS); + size_t bytes = 0; + SQLCHAR *utf8 = wchars_to_chars(paramValue, *soi/2, &bytes); + bind->allocated = 1; + bind->u.bin = utf8; + bind->buffer_length = bytes; + bind->buffer = bind->u.bin; + } break; + case SQL_C_BINARY: { + bind->u.bin = (unsigned char*)paramValue; + if (*soi == SQL_NTS) { + bind->buffer_length = strlen((const char*)paramValue); + } else { + bind->buffer_length = *soi; + } + bind->buffer = bind->u.bin; + } break; + case SQL_C_CHAR: + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_LONG: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_TIMESTAMP: { + bind->buffer_type = type; + bind->buffer_length = sizeof(bind->u.v8); + bind->buffer = &bind->u.v8; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_WCHAR: { + DASSERT(soi); + DASSERT(*soi != SQL_NTS); + size_t bytes = 0; + int r = 0; + int64_t t = 0; + SQLCHAR *utf8 = wchars_to_chars(paramValue, *soi/2, &bytes); + // why cast utf8 to 'char*' ? + r = taosParseTime((char*)utf8, &t, strlen((const char*)utf8), TSDB_TIME_PRECISION_MILLI, 0); + bind->u.v8 = t; + free(utf8); + if (r) { + SET_ERROR(sql, "22007", TSDB_CODE_ODBC_OUT_OF_RANGE, + "convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d] failed", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } + } break; + case SQL_C_SBIGINT: { + int64_t t = *(int64_t*)paramValue; + bind->u.v8 = t; + } break; + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_LONG: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + case TSDB_DATA_TYPE_NCHAR: { + bind->buffer_type = type; + bind->length = &bind->buffer_length; + switch (valueType) { + case SQL_C_WCHAR: { + DASSERT(soi); + DASSERT(*soi != SQL_NTS); + size_t bytes = 0; + SQLCHAR *utf8 = wchars_to_chars(paramValue, *soi/2, &bytes); + bind->allocated = 1; + bind->u.nchar = (char*)utf8; + bind->buffer_length = bytes; + bind->buffer = bind->u.nchar; + } break; + case SQL_C_CHAR: { + bind->u.nchar = (char*)paramValue; + if (*soi == SQL_NTS) { + bind->buffer_length = strlen((const char*)paramValue); + } else { + bind->buffer_length = *soi; + } + bind->buffer = bind->u.nchar; + } break; + case SQL_C_SHORT: + case SQL_C_SSHORT: + case SQL_C_USHORT: + case SQL_C_LONG: + case SQL_C_SLONG: + case SQL_C_ULONG: + case SQL_C_FLOAT: + case SQL_C_DOUBLE: + case SQL_C_BIT: + case SQL_C_TINYINT: + case SQL_C_STINYINT: + case SQL_C_UTINYINT: + case SQL_C_SBIGINT: + case SQL_C_UBIGINT: + case SQL_C_BINARY: + case SQL_C_DATE: + case SQL_C_TIME: + case SQL_C_TIMESTAMP: + case SQL_C_TYPE_DATE: + case SQL_C_TYPE_TIME: + case SQL_C_TYPE_TIMESTAMP: + case SQL_C_NUMERIC: + case SQL_C_GUID: + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + } break; + default: { + SET_ERROR(sql, "HYC00", TSDB_CODE_ODBC_OUT_OF_RANGE, + "no convertion from [%s[%d/0x%x]] to [%s[%d/0x%x]] for parameter [%d]", + sql_c_type(valueType), valueType, valueType, + taos_data_type(type), type, type, idx+1); + return SQL_ERROR; + } break; + } + return SQL_SUCCESS; +} + +static SQLRETURN do_bind_batch(sql_t *sql, int idx_row, TAOS_BIND *binds) +{ + for (int j=0; jn_params; ++j) { + SQLRETURN r = do_bind_param_value(sql, idx_row, j, sql->params+j, binds+j); + if (r==SQL_SUCCESS) continue; + return r; + } + if (sql->n_params > 0) { + int tr = 0; + PROFILE(tr = taos_stmt_bind_param(sql->stmt, binds)); + if (tr) { + SET_ERROR(sql, "HY000", tr, "failed to bind parameters[%d in total]", sql->n_params); + return SQL_ERROR; + } + + if (sql->is_insert) { + int r = 0; + PROFILE(r = taos_stmt_add_batch(sql->stmt)); + if (r) { + SET_ERROR(sql, "HY000", r, "failed to add batch"); + return SQL_ERROR; + } + } + } + return SQL_SUCCESS; +} + +static SQLRETURN do_execute(sql_t *sql) +{ + int tr = TSDB_CODE_SUCCESS; + if (sql->n_rows==0) sql->n_rows = 1; + for (int i=0; in_rows; ++i) { + TAOS_BIND *binds = NULL; + if (sql->n_params>0) { + binds = (TAOS_BIND*)calloc(sql->n_params, sizeof(*binds)); + if (!binds) { + SET_ERROR(sql, "HY001", TSDB_CODE_ODBC_OOM, ""); + return SQL_ERROR; + } + } + + SQLRETURN r = do_bind_batch(sql, i, binds); + + if (binds) { + for (int i = 0; in_params; ++i) { + TAOS_BIND *bind = binds + i; + if (bind->allocated) { + free(bind->u.nchar); + bind->u.nchar = NULL; + } + } + free(binds); + } + + if (r) return r; + } + + PROFILE(tr = taos_stmt_execute(sql->stmt)); + if (tr) { + SET_ERROR(sql, "HY000", tr, "failed to execute statement"); + return SQL_ERROR; + } + + sql->is_executed = 1; + if (sql->is_insert) return SQL_SUCCESS; + + SQLRETURN r = SQL_SUCCESS; + PROFILE(sql->rs = taos_stmt_use_result(sql->stmt)); + CHK_RS(r, sql, "failed to use result"); + + return r; +} + +static SQLRETURN doSQLExecute(SQLHSTMT StatementHandle) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->stmt) { + SET_ERROR(sql, "HY010", TSDB_CODE_ODBC_STATEMENT_NOT_READY, ""); + return SQL_ERROR; + } + + if (sql->rs) { + taos_free_result(sql->rs); + sql->rs = NULL; + sql->row = NULL; + } + + SQLRETURN r = do_execute(sql); + + return r; +} + +SQLRETURN SQL_API SQLExecute(SQLHSTMT StatementHandle) +{ + SQLRETURN r; + PROFILE(r = doSQLExecute(StatementHandle)); + return r; +} + +static SQLRETURN doSQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength) +{ + // if this function is not exported, isql will never call SQLGetDiagRec + return SQL_ERROR; +} + +SQLRETURN SQL_API SQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLSMALLINT DiagIdentifier, + SQLPOINTER DiagInfo, SQLSMALLINT BufferLength, + SQLSMALLINT *StringLength) +{ + SQLRETURN r; + r = doSQLGetDiagField(HandleType, Handle, + RecNumber, DiagIdentifier, + DiagInfo, BufferLength, + StringLength); + return r; +} + +static SQLRETURN doSQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, + SQLINTEGER *NativeError, SQLCHAR *MessageText, + SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) +{ + if (RecNumber>1) return SQL_NO_DATA; + + switch (HandleType) { + case SQL_HANDLE_ENV: { + env_t *env = (env_t*)Handle; + if (!env) break; + FILL_ERROR(env); + return SQL_SUCCESS; + } break; + case SQL_HANDLE_DBC: { + conn_t *conn = (conn_t*)Handle; + if (!conn) break; + FILL_ERROR(conn); + return SQL_SUCCESS; + } break; + case SQL_HANDLE_STMT: { + sql_t *sql = (sql_t*)Handle; + if (!sql) break; + FILL_ERROR(sql); + return SQL_SUCCESS; + } break; + default: { + } break; + } + + // how to return error? + return SQL_ERROR; +} + +SQLRETURN SQL_API SQLGetDiagRec(SQLSMALLINT HandleType, SQLHANDLE Handle, + SQLSMALLINT RecNumber, SQLCHAR *Sqlstate, + SQLINTEGER *NativeError, SQLCHAR *MessageText, + SQLSMALLINT BufferLength, SQLSMALLINT *TextLength) +{ + SQLRETURN r; + r = doSQLGetDiagRec(HandleType, Handle, + RecNumber, Sqlstate, + NativeError, MessageText, + BufferLength, TextLength); + return r; +} + +static SQLRETURN doSQLBindParameter( + SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT fParamType, + SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, + SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, + SQLPOINTER ParameterValue, + SQLLEN cbValueMax, // ignore for now, since only SQL_PARAM_INPUT is supported now + SQLLEN *StrLen_or_Ind) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->stmt) { + SET_ERROR(sql, "HY010", TSDB_CODE_ODBC_STATEMENT_NOT_READY, ""); + return SQL_ERROR; + } + + if (ParameterNumber<=0 || ParameterNumber>sql->n_params) { + SET_ERROR(sql, "07009", TSDB_CODE_ODBC_BAD_ARG, + "parameter [@%d] invalid", ParameterNumber); + return SQL_ERROR; + } + + if (fParamType != SQL_PARAM_INPUT) { + SET_ERROR(sql, "HY105", TSDB_CODE_ODBC_NOT_SUPPORT, "non-input parameter [@%d] not supported yet", ParameterNumber); + return SQL_ERROR; + } + + if (ValueType == SQL_C_DEFAULT) { + SET_ERROR(sql, "HY003", TSDB_CODE_ODBC_NOT_SUPPORT, "default value for parameter [@%d] not supported yet", ParameterNumber); + return SQL_ERROR; + } + + if (!is_valid_sql_c_type(ValueType)) { + SET_ERROR(sql, "HY003", TSDB_CODE_ODBC_NOT_SUPPORT, + "SQL_C_TYPE [%s/%d/0x%x] for parameter [@%d] unknown", + sql_c_type(ValueType), ValueType, ValueType, ParameterNumber); + return SQL_ERROR; + } + + if (!is_valid_sql_sql_type(ParameterType)) { + SET_ERROR(sql, "HY004", TSDB_CODE_ODBC_NOT_SUPPORT, + "SQL_TYPE [%s/%d/0x%x] for parameter [@%d] unknown", + sql_c_type(ParameterType), ParameterType, ParameterType, ParameterNumber); + return SQL_ERROR; + } + + param_bind_t *pb = sql->params + ParameterNumber - 1; + + pb->ParameterNumber = ParameterNumber; + pb->ValueType = ValueType; + pb->ParameterType = ParameterType; + pb->LengthPrecision = LengthPrecision; + pb->ParameterScale = ParameterScale; + pb->ParameterValue = ParameterValue; + pb->StrLen_or_Ind = StrLen_or_Ind; + + pb->valid = 1; + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLBindParameter( + SQLHSTMT StatementHandle, + SQLUSMALLINT ParameterNumber, + SQLSMALLINT fParamType, + SQLSMALLINT ValueType, + SQLSMALLINT ParameterType, + SQLULEN LengthPrecision, + SQLSMALLINT ParameterScale, + SQLPOINTER ParameterValue, + SQLLEN cbValueMax, // ignore for now, since only SQL_PARAM_INPUT is supported now + SQLLEN *StrLen_or_Ind) +{ + SQLRETURN r; + r = doSQLBindParameter(StatementHandle, ParameterNumber, fParamType, ValueType, ParameterType, + LengthPrecision, ParameterScale, ParameterValue, cbValueMax, StrLen_or_Ind); + return r; +} + +static SQLRETURN doSQLDriverConnect( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion) +{ + conn_t *conn = (conn_t*)hdbc; + if (!conn) return SQL_ERROR; + + if (fDriverCompletion!=SQL_DRIVER_NOPROMPT) { + SET_ERROR(conn, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, "option[%d] other than SQL_DRIVER_NOPROMPT not supported yet", fDriverCompletion); + return SQL_ERROR; + } + + if (conn->taos) { + SET_ERROR(conn, "08002", TSDB_CODE_ODBC_CONNECTION_BUSY, "connection still in use"); + return SQL_ERROR; + } + + // DSN=; UID=; PWD= + + const char *connStr = SDUP(szConnStrIn, cbConnStrIn); + + char *serverName = NULL; + char *userName = NULL; + char *auth = NULL; + int bytes = 0; + + do { + if (szConnStrIn && !connStr) { + SET_ERROR(conn, "HY001", TSDB_CODE_ODBC_OOM, ""); + break; + } + + int n = sscanf((const char*)connStr, "DSN=%m[^;]; UID=%m[^;]; PWD=%m[^;] %n", &serverName, &userName, &auth, &bytes); + if (n<1) { + SET_ERROR(conn, "HY000", TSDB_CODE_ODBC_BAD_CONNSTR, "unrecognized connection string: [%s]", (const char*)szConnStrIn); + break; + } + + // TODO: data-race + // TODO: shall receive ip/port from odbc.ini + conn->taos = taos_connect("localhost", userName, auth, NULL, 0); + if (!conn->taos) { + SET_ERROR(conn, "HY000", terrno, "failed to connect to data source"); + break; + } + + if (szConnStrOut) { + snprintf((char*)szConnStrOut, cbConnStrOutMax, "%s", connStr); + } + if (pcbConnStrOut) { + *pcbConnStrOut = cbConnStrIn; + } + + } while (0); + + if (serverName) free(serverName); + if (userName) free(userName); + if (auth) free(auth); + + SFRE(connStr, szConnStrIn, cbConnStrIn); + + return conn->taos ? SQL_SUCCESS : SQL_ERROR; +} + +SQLRETURN SQL_API SQLDriverConnect( + SQLHDBC hdbc, + SQLHWND hwnd, + SQLCHAR *szConnStrIn, + SQLSMALLINT cbConnStrIn, + SQLCHAR *szConnStrOut, + SQLSMALLINT cbConnStrOutMax, + SQLSMALLINT *pcbConnStrOut, + SQLUSMALLINT fDriverCompletion) +{ + SQLRETURN r; + r = doSQLDriverConnect(hdbc, hwnd, szConnStrIn, cbConnStrIn, szConnStrOut, cbConnStrOutMax, pcbConnStrOut, fDriverCompletion); + return r; +} + +static SQLRETURN doSQLSetConnectAttr(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength) +{ + conn_t *conn = (conn_t*)ConnectionHandle; + if (!conn) return SQL_ERROR; + + if (Attribute != SQL_ATTR_AUTOCOMMIT) { + SET_ERROR(conn, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, "Attribute other than SQL_ATTR_AUTOCOMMIT not supported yet"); + return SQL_ERROR; + } + if (Value != (SQLPOINTER)SQL_AUTOCOMMIT_ON) { + SET_ERROR(conn, "HYC00", TSDB_CODE_ODBC_NOT_SUPPORT, "Attribute Value other than SQL_AUTOCOMMIT_ON not supported yet[%p]", Value); + return SQL_ERROR; + } + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLSetConnectAttr(SQLHDBC ConnectionHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength) +{ + SQLRETURN r; + r = doSQLSetConnectAttr(ConnectionHandle, Attribute, Value, StringLength); + return r; +} + +static SQLRETURN doSQLDescribeCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, + SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, + SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->rs) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NO_RESULT, ""); + return SQL_ERROR; + } + + int nfields = taos_field_count(sql->rs); + TAOS_FIELD *fields = taos_fetch_fields(sql->rs); + + if (ColumnNumber<=0 || ColumnNumber>nfields) { + SET_ERROR(sql, "07009", TSDB_CODE_ODBC_OUT_OF_RANGE, "invalid column number [%d]", ColumnNumber); + return SQL_ERROR; + } + + TAOS_FIELD *field = fields + ColumnNumber - 1; + if (ColumnName) { + size_t n = sizeof(field->name); + if (n>BufferLength) n = BufferLength; + strncpy((char*)ColumnName, field->name, n); + } + if (NameLength) { + *NameLength = strnlen(field->name, sizeof(field->name)); + } + if (ColumnSize) { + *ColumnSize = field->bytes; + } + if (DecimalDigits) *DecimalDigits = 0; + + if (DataType) { + switch (field->type) { + case TSDB_DATA_TYPE_BOOL: { + *DataType = SQL_TINYINT; + } break; + + case TSDB_DATA_TYPE_TINYINT: { + *DataType = SQL_TINYINT; + } break; + + case TSDB_DATA_TYPE_SMALLINT: { + *DataType = SQL_SMALLINT; + } break; + + case TSDB_DATA_TYPE_INT: { + *DataType = SQL_INTEGER; + } break; + + case TSDB_DATA_TYPE_BIGINT: { + *DataType = SQL_BIGINT; + } break; + + case TSDB_DATA_TYPE_FLOAT: { + *DataType = SQL_FLOAT; + } break; + + case TSDB_DATA_TYPE_DOUBLE: { + *DataType = SQL_DOUBLE; + } break; + + case TSDB_DATA_TYPE_TIMESTAMP: { + // *DataType = SQL_TIMESTAMP; + // *ColumnSize = 30; + // *DecimalDigits = 3; + *DataType = SQL_TIMESTAMP; + *ColumnSize = sizeof(SQL_TIMESTAMP_STRUCT); + *DecimalDigits = 0; + } break; + + case TSDB_DATA_TYPE_NCHAR: { + *DataType = SQL_CHAR; // unicode ? + if (ColumnSize) *ColumnSize -= VARSTR_HEADER_SIZE; + } break; + + case TSDB_DATA_TYPE_BINARY: { + *DataType = SQL_BINARY; + if (ColumnSize) *ColumnSize -= VARSTR_HEADER_SIZE; + } break; + + default: + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NOT_SUPPORT, + "unknown [%s[%d/0x%x]]", taos_data_type(field->type), field->type, field->type); + return SQL_ERROR; + break; + } + } + if (Nullable) { + *Nullable = SQL_NULLABLE_UNKNOWN; + } + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLDescribeCol(SQLHSTMT StatementHandle, + SQLUSMALLINT ColumnNumber, SQLCHAR *ColumnName, + SQLSMALLINT BufferLength, SQLSMALLINT *NameLength, + SQLSMALLINT *DataType, SQLULEN *ColumnSize, + SQLSMALLINT *DecimalDigits, SQLSMALLINT *Nullable) +{ + SQLRETURN r; + r = doSQLDescribeCol(StatementHandle, ColumnNumber, ColumnName, + BufferLength, NameLength, + DataType, ColumnSize, + DecimalDigits, Nullable); + return r; +} + +static SQLRETURN doSQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar) +{ + sql_t *sql = (sql_t*)hstmt; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->stmt) { + SET_ERROR(sql, "HY010", TSDB_CODE_ODBC_STATEMENT_NOT_READY, ""); + return SQL_ERROR; + } + + int insert = 0; + int r = taos_stmt_is_insert(sql->stmt, &insert); + if (r) { + SET_ERROR(sql, "HY000", terrno, ""); + return SQL_ERROR; + } + // if (!insert) { + // SET_ERROR(sql, "HY000", terrno, "taos does not provide count of parameters for statement other than insert"); + // return SQL_ERROR; + // } + + int params = 0; + r = taos_stmt_num_params(sql->stmt, ¶ms); + if (r) { + SET_ERROR(sql, "HY000", terrno, "fetch num of statement params failed"); + return SQL_ERROR; + } + + if (pcpar) *pcpar = params; + + return SQL_SUCCESS; +} + +SQLRETURN SQL_API SQLNumParams(SQLHSTMT hstmt, SQLSMALLINT *pcpar) +{ + SQLRETURN r; + r = doSQLNumParams(hstmt, pcpar); + return r; +} + +static SQLRETURN doSQLSetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength) +{ + sql_t *sql = (sql_t*)StatementHandle; + if (!sql) return SQL_ERROR; + + CHK_CONN(sql); + CHK_CONN_TAOS(sql); + + if (!sql->stmt) { + SET_ERROR(sql, "HY010", TSDB_CODE_ODBC_STATEMENT_NOT_READY, ""); + return SQL_ERROR; + } + + if (sql->is_executed) { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NOT_SUPPORT, "change attr after executing statement not supported yet"); + return SQL_ERROR; + } + + switch (Attribute) { + case SQL_ATTR_PARAM_BIND_TYPE: { + SQLULEN val = (SQLULEN)Value; + if (val==SQL_BIND_BY_COLUMN) { + sql->rowlen = 0; + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NOT_SUPPORT, "SQL_ATTR_PARAM_BIND_TYPE/SQL_BIND_BY_COLUMN"); + return SQL_ERROR; + } + sql->rowlen = val; + return SQL_SUCCESS; + } break; + case SQL_ATTR_PARAMSET_SIZE: { + SQLULEN val = (SQLULEN)Value; + DASSERT(val>0); + sql->n_rows = val; + return SQL_SUCCESS; + } break; + case SQL_ATTR_PARAM_BIND_OFFSET_PTR: { + if (Value) { + SQLULEN val = *(SQLULEN*)Value; + sql->ptr_offset = val; + } else { + sql->ptr_offset = 0; + } + return SQL_SUCCESS; + } break; + default: { + SET_ERROR(sql, "HY000", TSDB_CODE_ODBC_NOT_SUPPORT, "Attribute:%d", Attribute); + } break; + } + return SQL_ERROR; +} + +SQLRETURN SQL_API SQLSetStmtAttr(SQLHSTMT StatementHandle, + SQLINTEGER Attribute, SQLPOINTER Value, + SQLINTEGER StringLength) +{ + SQLRETURN r; + r = doSQLSetStmtAttr(StatementHandle, Attribute, Value, StringLength); + return r; +} + + + + +static void init_routine(void) { + if (0) { + string_conv(NULL, NULL, NULL, 0, NULL, 0, NULL, NULL); + utf8_to_ucs4le(NULL, NULL); + ucs4le_to_utf8(NULL, 0, NULL); + } + taos_init(); +} + +static int do_field_display_size(TAOS_FIELD *field) { + switch (field->type) { + case TSDB_DATA_TYPE_TINYINT: + return 5; + break; + + case TSDB_DATA_TYPE_SMALLINT: + return 7; + break; + + case TSDB_DATA_TYPE_INT: + return 12; + break; + + case TSDB_DATA_TYPE_BIGINT: + return 22; + break; + + case TSDB_DATA_TYPE_FLOAT: { + return 12; + } break; + + case TSDB_DATA_TYPE_DOUBLE: { + return 20; + } break; + + case TSDB_DATA_TYPE_BINARY: + case TSDB_DATA_TYPE_NCHAR: { + return 3*(field->bytes - VARSTR_HEADER_SIZE) + 2; + } break; + + case TSDB_DATA_TYPE_TIMESTAMP: + return 26; + break; + + case TSDB_DATA_TYPE_BOOL: + return 7; + default: + break; + } + + return 10; +} + +// convertion from TSDB_DATA_TYPE_XXX to SQL_C_XXX +static SQLRETURN conv_tsdb_bool_to_c_bit(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + int8_t v = b; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_tinyint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + int8_t v = b; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_short(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + int16_t v = b; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + int32_t v = b; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + int64_t v = b; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + float v = b; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + double v = b; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + DASSERT(target->len>0); + *target->soi = 1; + target->ptr[0] = '0' + b; + if (target->len>1) { + target->ptr[1] = '\0'; + } + + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bool_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t b) +{ + DASSERT(target->len>0); + *target->soi = 1; + target->ptr[0] = '0' + b; + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v1_to_c_tinyint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + int8_t v = v1; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v1_to_c_short(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + int16_t v = v1; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v1_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + int32_t v = v1; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v1_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + int64_t v = v1; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v1_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + float v = v1; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v1_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + double v = v1; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v1_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%d", v1); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>=target->len ? target->len : n+1)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_TINYINT -> SQL_C_BIT"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_v1_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int8_t v1) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%d", v1); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>target->len ? target->len : n)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_TINYINT -> SQL_C_BIT"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_v2_to_c_short(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2) +{ + int16_t v = v2; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v2_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2) +{ + int32_t v = v2; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v2_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2) +{ + int64_t v = v2; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v2_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2) +{ + float v = v2; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v2_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2) +{ + double v = v2; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v2_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%d", v2); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>=target->len ? target->len : n+1)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_SMALLINT -> SQL_C_CHAR"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_v2_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int16_t v2) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%d", v2); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>target->len ? target->len : n)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_SMALLINT -> SQL_C_CHAR"); + return SQL_SUCCESS_WITH_INFO; +} + + +static SQLRETURN conv_tsdb_v4_to_c_long(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4) +{ + int32_t v = v4; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v4_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4) +{ + int64_t v = v4; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v4_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4) +{ + float v = v4; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v4_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4) +{ + double v = v4; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v4_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%d", v4); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>=target->len ? target->len : n+1)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_INTEGER -> SQL_C_CHAR"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_v4_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int32_t v4) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%d", v4); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>target->len ? target->len : n)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_INTEGER -> SQL_C_BINARY"); + return SQL_SUCCESS_WITH_INFO; +} + + +static SQLRETURN conv_tsdb_v8_to_c_sbigint(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8) +{ + int64_t v = v8; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v8_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8) +{ + float v = v8; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v8_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8) +{ + double v = v8; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_v8_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%" PRId64 "", v8); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>=target->len ? target->len : n+1)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_BIGINT -> SQL_C_CHAR"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_v8_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, int64_t v8) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%" PRId64 "", v8); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>target->len ? target->len : n)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_BIGINT -> SQL_C_BINARY"); + return SQL_SUCCESS_WITH_INFO; +} + + +static SQLRETURN conv_tsdb_f4_to_c_float(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4) +{ + float v = f4; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_f4_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4) +{ + double v = f4; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_f4_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%g", f4); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>=target->len ? target->len : n+1)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_FLOAT -> SQL_C_CHAR"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_f4_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, float f4) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%g", f4); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>target->len ? target->len : n)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_FLOAT -> SQL_C_BINARY"); + return SQL_SUCCESS_WITH_INFO; +} + + +static SQLRETURN conv_tsdb_f8_to_c_double(sql_t *sql, c_target_t *target, TAOS_FIELD *field, double f8) +{ + double v = f8; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_f8_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIELD *field, double f8) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%.6f", f8); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>=target->len ? target->len : n+1)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_DOUBLE -> SQL_C_CHAR"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_f8_to_c_binary(sql_t *sql, c_target_t *target, TAOS_FIELD *field, double f8) +{ + char buf[64]; + int n = snprintf(buf, sizeof(buf), "%g", f8); + DASSERT(nsoi = n; + strncpy(target->ptr, buf, (n>target->len ? target->len : n)); + if (n<=target->len) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_DOUBLE -> SQL_C_BINARY"); + return SQL_SUCCESS_WITH_INFO; +} + + +static SQLRETURN conv_tsdb_ts_to_c_v8(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts) +{ + struct tm tm = {0}; + tm.tm_sec = ts->second; + tm.tm_min = ts->minute; + tm.tm_hour = ts->hour; + tm.tm_mday = ts->day; + tm.tm_mon = ts->month - 1; + tm.tm_year = ts->year - 1900; + time_t t = mktime(&tm); + DASSERT(sizeof(t) == sizeof(int64_t)); + int64_t v = (int64_t)t; + v *= 1000; + v += ts->fraction / 1000000; + memcpy(target->ptr, &v, sizeof(v)); + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_ts_to_c_str(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts) +{ + struct tm tm = {0}; + tm.tm_sec = ts->second; + tm.tm_min = ts->minute; + tm.tm_hour = ts->hour; + tm.tm_mday = ts->day; + tm.tm_mon = ts->month - 1; + tm.tm_year = ts->year - 1900; + + char buf[64]; + int n = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm); + DASSERT(n < sizeof(buf)); + + *target->soi = n; + + unsigned int fraction = ts->fraction; + fraction /= 1000000; + snprintf(target->ptr, target->len, "%s.%03d", buf, fraction); + if (target->soi) *target->soi = strlen((const char*)target->ptr); + + if (n <= target->len) { + return SQL_SUCCESS; + } + + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_TIMESTAMP -> SQL_C_CHAR"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_ts_to_c_bin(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts) +{ + struct tm tm = {0}; + tm.tm_sec = ts->second; + tm.tm_min = ts->minute; + tm.tm_hour = ts->hour; + tm.tm_mday = ts->day; + tm.tm_mon = ts->month - 1; + tm.tm_year = ts->year - 1900; + + char buf[64]; + int n = strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm); + DASSERT(n < sizeof(buf)); + + unsigned int fraction = ts->fraction; + fraction /= 1000000; + snprintf(target->ptr, target->len, "%s.%03d", buf, fraction); + if (target->soi) *target->soi = strlen((const char*)target->ptr); + + if (n <= target->len) { + return SQL_SUCCESS; + } + + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_TIMESTAMP -> SQL_C_BINARY"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_ts_to_c_ts(sql_t *sql, c_target_t *target, TAOS_FIELD *field, SQL_TIMESTAMP_STRUCT *ts) +{ + DASSERT(target->len == sizeof(*ts)); + memcpy(target->ptr, ts, sizeof(*ts)); + *target->soi = target->len; + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_bin_to_c_str(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const unsigned char *bin) +{ + if (target->len<1) { + SET_ERROR(sql, "HY090", TSDB_CODE_ODBC_BAD_ARG, ""); + return SQL_ERROR; + } + size_t field_bytes = field->bytes - VARSTR_HEADER_SIZE; + size_t n = strnlen((const char*)bin, field_bytes); + + if (n < target->len) { + memcpy(target->ptr, bin, n); + target->ptr[n] = '\0'; + *target->soi = n; + return SQL_SUCCESS; + } + n = target->len - 1; + *target->soi = n; + if (n > 0) { + memcpy(target->ptr, bin, n-1); + target->ptr[n-1] = '\0'; + } + SET_ERROR(sql, "01004", TSDB_CODE_ODBC_CONV_TRUNC, ""); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_bin_to_c_bin(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const unsigned char *bin) +{ + if (target->len<1) { + SET_ERROR(sql, "HY090", TSDB_CODE_ODBC_BAD_ARG, ""); + return SQL_ERROR; + } + size_t field_bytes = field->bytes - VARSTR_HEADER_SIZE; + size_t n = strnlen((const char*)bin, field_bytes); + + if (n <= target->len) { + memcpy(target->ptr, bin, n); + if (nlen) target->ptr[n] = '\0'; + *target->soi = n; + return SQL_SUCCESS; + } + + n = target->len; + memcpy(target->ptr, bin, n); + *target->soi = n; + SET_ERROR(sql, "01004", TSDB_CODE_ODBC_CONV_TRUNC, ""); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_str_to_c_bit(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + int bytes = 0; + double f8 = 0; + int n = sscanf(str, "%lf%n", &f8, &bytes); + + int8_t v = f8; + memcpy(target->ptr, &v, sizeof(v)); + + *target->soi = 1; + + if (n!=1 || bytes!=strlen(str)) { + SET_ERROR(sql, "22018", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_BIT"); + return SQL_SUCCESS_WITH_INFO; + } + + char buf[64]; + snprintf(buf, sizeof(buf), "%d", v); + + if (strcmp(buf, str)==0) { + if (v==0 || v==1) return SQL_SUCCESS; + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_BIT"); + return SQL_SUCCESS_WITH_INFO; + } + + if (f8>0 || f8<2) { + SET_ERROR(sql, "01S07", TSDB_CODE_ODBC_CONV_TRUNC, "TSDB_DATA_TYPE_NCHAR -> SQL_C_BIT"); + return SQL_SUCCESS_WITH_INFO; + } + + if (f8<0 || f8>2) { + SET_ERROR(sql, "22003", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_BIT"); + return SQL_SUCCESS_WITH_INFO; + } + + SET_ERROR(sql, "01S07", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_BIT"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_str_to_c_v1(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + int bytes = 0; + double f8 = 0; + int n = sscanf(str, "%lf%n", &f8, &bytes); + + int8_t v = f8; + memcpy(target->ptr, &v, sizeof(v)); + + *target->soi = 1; + + if (n!=1 || bytes!=strlen(str)) { + SET_ERROR(sql, "22018", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_TINYINT"); + return SQL_SUCCESS_WITH_INFO; + } + + char buf[64]; + snprintf(buf, sizeof(buf), "%d", v); + + if (strcmp(buf, str)==0) return SQL_SUCCESS; + + if (f8>INT8_MAX || f8 SQL_C_TINYINT"); + return SQL_SUCCESS_WITH_INFO; + } + + SET_ERROR(sql, "01S07", TSDB_CODE_ODBC_CONV_TRUNC, "TSDB_DATA_TYPE_NCHAR -> SQL_C_TINYINT"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_str_to_c_v2(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + int bytes = 0; + double f8 = 0; + int n = sscanf(str, "%lf%n", &f8, &bytes); + + int16_t v = f8; + memcpy(target->ptr, &v, sizeof(v)); + + *target->soi = 2; + + if (n!=1 || bytes!=strlen(str)) { + SET_ERROR(sql, "22018", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_SHORT"); + return SQL_SUCCESS_WITH_INFO; + } + + char buf[64]; + snprintf(buf, sizeof(buf), "%d", v); + + if (strcmp(buf, str)==0) return SQL_SUCCESS; + + if (f8>INT16_MAX || f8 SQL_C_SHORT"); + return SQL_SUCCESS_WITH_INFO; + } + + SET_ERROR(sql, "01S07", TSDB_CODE_ODBC_CONV_TRUNC, "TSDB_DATA_TYPE_NCHAR -> SQL_C_SHORT"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_str_to_c_v4(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + int bytes = 0; + double f8 = 0; + int n = sscanf(str, "%lf%n", &f8, &bytes); + + int32_t v = f8; + memcpy(target->ptr, &v, sizeof(v)); + + *target->soi = 4; + + if (n!=1 || bytes!=strlen(str)) { + SET_ERROR(sql, "22018", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_LONG"); + return SQL_SUCCESS_WITH_INFO; + } + + char buf[64]; + snprintf(buf, sizeof(buf), "%d", v); + + if (strcmp(buf, str)==0) return SQL_SUCCESS; + + if (f8>INT32_MAX || f8 SQL_C_LONG"); + return SQL_SUCCESS_WITH_INFO; + } + + SET_ERROR(sql, "01S07", TSDB_CODE_ODBC_CONV_TRUNC, "TSDB_DATA_TYPE_NCHAR -> SQL_C_LONG"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_str_to_c_v8(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + int bytes = 0; + double f8 = 0; + int n = sscanf(str, "%lf%n", &f8, &bytes); + + int64_t v = f8; + memcpy(target->ptr, &v, sizeof(v)); + + *target->soi = 8; + + if (n!=1 || bytes!=strlen(str)) { + SET_ERROR(sql, "22018", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_SBIGINT"); + return SQL_SUCCESS_WITH_INFO; + } + + char buf[64]; + snprintf(buf, sizeof(buf), "%" PRId64 "", v); + + if (strcmp(buf, str)==0) return SQL_SUCCESS; + + if (f8>INT64_MAX || f8 SQL_C_SBIGINT"); + return SQL_SUCCESS_WITH_INFO; + } + + SET_ERROR(sql, "01S07", TSDB_CODE_ODBC_CONV_TRUNC, "TSDB_DATA_TYPE_NCHAR -> SQL_C_SBIGINT"); + return SQL_SUCCESS_WITH_INFO; +} + +static SQLRETURN conv_tsdb_str_to_c_f4(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + int bytes = 0; + double f8 = 0; + int n = sscanf(str, "%lf%n", &f8, &bytes); + + float v = f8; + memcpy(target->ptr, &v, sizeof(v)); + + *target->soi = 4; + + if (n!=1 || bytes!=strlen(str)) { + SET_ERROR(sql, "22018", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_FLOAT"); + return SQL_SUCCESS_WITH_INFO; + } + + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_str_to_c_f8(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + int bytes = 0; + double f8 = 0; + int n = sscanf(str, "%lf%n", &f8, &bytes); + + float v = f8; + memcpy(target->ptr, &v, sizeof(v)); + + *target->soi = 8; + + if (n!=1 || bytes!=strlen(str)) { + SET_ERROR(sql, "22018", TSDB_CODE_ODBC_CONV_UNDEF, "TSDB_DATA_TYPE_NCHAR -> SQL_C_DOUBLE"); + return SQL_SUCCESS_WITH_INFO; + } + + return SQL_SUCCESS; +} + +static SQLRETURN conv_tsdb_str_to_c_str(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + return conv_tsdb_bin_to_c_str(sql, target, field, (const unsigned char*)str); +} + +static SQLRETURN conv_tsdb_str_to_c_bin(sql_t *sql, c_target_t *target, TAOS_FIELD *field, const char *str) +{ + return conv_tsdb_bin_to_c_bin(sql, target, field, (const unsigned char*)str); +} + + + + +const char* tsdb_int64_to_bit(int64_t src, int8_t *dst) +{ + *dst = src; + if (src==0 || src==1) return NULL; + return "22003"; +} + +const char* tsdb_int64_to_tinyint(int64_t src, int8_t *dst) +{ + *dst = src; + if (src>=SCHAR_MIN && src<=SCHAR_MAX) return NULL; + return "22003"; +} + +const char* tsdb_int64_to_smallint(int64_t src, int16_t *dst) +{ + *dst = src; + if (src>=SHRT_MIN && src<=SHRT_MAX) return NULL; + return "22003"; +} + +const char* tsdb_int64_to_int(int64_t src, int32_t *dst) +{ + *dst = src; + if (src>=LONG_MIN && src<=LONG_MAX) return NULL; + return "22003"; +} + +const char* tsdb_int64_to_bigint(int64_t src, int64_t *dst) +{ + *dst = src; + return NULL; +} + +const char* tsdb_int64_to_ts(int64_t src, int64_t *dst) +{ + *dst = src; + + char buf[4096]; + int n = snprintf(buf, sizeof(buf), "%" PRId64 "", src); + DASSERT(n>=0); + DASSERT(n=2) return "22003"; + + char buf[4096]; + int n = snprintf(buf, sizeof(buf), "%.*g", precision, src); + DASSERT(n>=0); + DASSERT(nSCHAR_MAX) return "22003"; + + char buf[4096]; + int n = snprintf(buf, sizeof(buf), "%.*g", precision, src); + DASSERT(n>=0); + DASSERT(nSHRT_MAX) return "22003"; + + char buf[4096]; + int n = snprintf(buf, sizeof(buf), "%.*g", precision, src); + DASSERT(n>=0); + DASSERT(nLONG_MAX) return "22003"; + + char buf[4096]; + int n = snprintf(buf, sizeof(buf), "%.*g", precision, src); + DASSERT(n>=0); + DASSERT(nLLONG_MAX) return "22003"; + + char buf[4096]; + int n = snprintf(buf, sizeof(buf), "%.*g", precision, src); + DASSERT(n>=0); + DASSERT(n=0); + DASSERT(n=0); + DASSERT(n2>=0); + DASSERT(n1=0); + if (n>=dlen) return "22001"; + + return NULL; +} + +const char* tsdb_chars_to_bit(const char *src, int8_t *dst) +{ + int bytes = 0; + int64_t v = 0; + int n = sscanf(src, "%" PRId64 "%n", &v, &bytes); + if (n!=1) return "22018"; + + if (bytes!=strlen(src)) { + if (src[bytes-1]=='.') { + if (v==0 || v==1) return "22001"; + + return "22003"; + } + return "22018"; + } + + if (v==0 || v==1) return NULL; + + return "22003"; +} + +const char* tsdb_chars_to_tinyint(const char *src, int8_t *dst) +{ + int bytes = 0; + int64_t v = 0; + int n = sscanf(src, "%" PRId64 "%n", &v, &bytes); + if (n!=1) return "22018"; + + + if (bytes!=strlen(src)) { + if (src[bytes-1]=='.') { + if (vSCHAR_MAX) return "22001"; + + return "22003"; + } + return "22018"; + } + + if (vSCHAR_MAX) return "22001"; + + return NULL; +} + +const char* tsdb_chars_to_smallint(const char *src, int16_t *dst) +{ + int bytes = 0; + int64_t v = 0; + int n = sscanf(src, "%" PRId64 "%n", &v, &bytes); + if (n!=1) return "22018"; + + + if (bytes!=strlen(src)) { + if (src[bytes-1]=='.') { + if (vSHRT_MAX) return "22001"; + + return "22003"; + } + return "22018"; + } + + if (vSHRT_MAX) return "22001"; + + return NULL; +} + +const char* tsdb_chars_to_int(const char *src, int32_t *dst) +{ + int bytes = 0; + int64_t v = 0; + int n = sscanf(src, "%" PRId64 "%n", &v, &bytes); + if (n!=1) return "22018"; + + + if (bytes!=strlen(src)) { + if (src[bytes-1]=='.') { + if (vLONG_MAX) return "22001"; + + return "22003"; + } + return "22018"; + } + + if (vLONG_MAX) return "22001"; + + return NULL; +} + +const char* tsdb_chars_to_bigint(const char *src, int64_t *dst) +{ + int bytes = 0; + int64_t v = 0; + int n = sscanf(src, "%" PRId64 "%n", &v, &bytes); + if (n!=1) return "22018"; + + + if (bytes!=strlen(src)) { + if (src[bytes-1]=='.') { + if (vLLONG_MAX) return "22001"; + + return "22003"; + } + return "22018"; + } + + if (vLLONG_MAX) return "22001"; + + return NULL; +} + +const char* tsdb_chars_to_ts(const char *src, int64_t *dst) +{ + int bytes = 0; + int64_t v = 0; + int n = sscanf(src, "%" PRId64 "%n", &v, &bytes); + if (n!=1) return "22018"; + + + if (bytes!=strlen(src)) { + if (src[bytes-1]=='.') { + if (vLLONG_MAX) return "22001"; + + return "22003"; + } + return "22018"; + } + + if (vLLONG_MAX) return "22001"; + + return NULL; +} + +const char* tsdb_chars_to_float(const char *src, float *dst) +{ + int bytes = 0; + int n = sscanf(src, "%f%n", dst, &bytes); + if (n!=1) return "22018"; + + if (bytes!=strlen(src)) return "22018"; + + return NULL; +} + +const char* tsdb_chars_to_double(const char *src, double *dst) +{ + int bytes = 0; + int n = sscanf(src, "%lf%n", dst, &bytes); + if (n!=1) return "22018"; + + if (bytes!=strlen(src)) return "22018"; + + return NULL; +} + +const char* tsdb_chars_to_char(const char *src, char *dst, size_t dlen) +{ + int n = snprintf(dst, dlen, "%s", src); + if (n>=dlen) return "22001"; + + return NULL; +} + diff --git a/src/connector/odbc/src/todbc_util.c b/src/connector/odbc/src/todbc_util.c new file mode 100644 index 0000000000000000000000000000000000000000..b6b45d8120d28da31dcc1d323893984f9b93519b --- /dev/null +++ b/src/connector/odbc/src/todbc_util.c @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include "todbc_util.h" + +#include "iconv.h" + +#include +#include +#include +#include +#include + +const char* sql_sql_type(int type) { + switch (type) { + case SQL_BIT: return "SQL_BIT"; + case SQL_TINYINT: return "SQL_TINYINT"; + case SQL_SMALLINT: return "SQL_SMALLINT"; + case SQL_INTEGER: return "SQL_INTEGER"; + case SQL_BIGINT: return "SQL_BIGINT"; + case SQL_FLOAT: return "SQL_FLOAT"; + case SQL_DOUBLE: return "SQL_DOUBLE"; + case SQL_DECIMAL: return "SQL_DECIMAL"; + case SQL_NUMERIC: return "SQL_NUMERIC"; + case SQL_REAL: return "SQL_REAL"; + case SQL_CHAR: return "SQL_CHAR"; + case SQL_VARCHAR: return "SQL_VARCHAR"; + case SQL_LONGVARCHAR: return "SQL_LONGVARCHAR"; + case SQL_WCHAR: return "SQL_WCHAR"; + case SQL_WVARCHAR: return "SQL_WVARCHAR"; + case SQL_WLONGVARCHAR: return "SQL_WLONGVARCHAR"; + case SQL_BINARY: return "SQL_BINARY"; + case SQL_VARBINARY: return "SQL_VARBINARY"; + case SQL_LONGVARBINARY: return "SQL_LONGVARBINARY"; + case SQL_DATE: return "SQL_DATE"; + case SQL_TIME: return "SQL_TIME"; + case SQL_TIMESTAMP: return "SQL_TIMESTAMP"; + case SQL_TYPE_DATE: return "SQL_TYPE_DATE"; + case SQL_TYPE_TIME: return "SQL_TYPE_TIME"; + case SQL_TYPE_TIMESTAMP: return "SQL_TYPE_TIMESTAMP"; + case SQL_INTERVAL_MONTH: return "SQL_INTERVAL_MONTH"; + case SQL_INTERVAL_YEAR: return "SQL_INTERVAL_YEAR"; + case SQL_INTERVAL_YEAR_TO_MONTH: return "SQL_INTERVAL_YEAR_TO_MONTH"; + case SQL_INTERVAL_DAY: return "SQL_INTERVAL_DAY"; + case SQL_INTERVAL_HOUR: return "SQL_INTERVAL_HOUR"; + case SQL_INTERVAL_MINUTE: return "SQL_INTERVAL_MINUTE"; + case SQL_INTERVAL_SECOND: return "SQL_INTERVAL_SECOND"; + case SQL_INTERVAL_DAY_TO_HOUR: return "SQL_INTERVAL_DAY_TO_HOUR"; + case SQL_INTERVAL_DAY_TO_MINUTE: return "SQL_INTERVAL_DAY_TO_MINUTE"; + case SQL_INTERVAL_DAY_TO_SECOND: return "SQL_INTERVAL_DAY_TO_SECOND"; + case SQL_INTERVAL_HOUR_TO_MINUTE: return "SQL_INTERVAL_HOUR_TO_MINUTE"; + case SQL_INTERVAL_HOUR_TO_SECOND: return "SQL_INTERVAL_HOUR_TO_SECOND"; + case SQL_INTERVAL_MINUTE_TO_SECOND: return "SQL_INTERVAL_MINUTE_TO_SECOND"; + case SQL_GUID: return "SQL_GUID"; + default: return "UNKNOWN"; + } +} + +const char* sql_c_type(int type) { + switch (type) { + case SQL_C_CHAR: return "SQL_C_CHAR"; + case SQL_C_WCHAR: return "SQL_C_WCHAR"; + case SQL_C_SHORT: return "SQL_C_SHORT"; + case SQL_C_SSHORT: return "SQL_C_SSHORT"; + case SQL_C_USHORT: return "SQL_C_USHORT"; + case SQL_C_LONG: return "SQL_C_LONG"; + case SQL_C_SLONG: return "SQL_C_SLONG"; + case SQL_C_ULONG: return "SQL_C_ULONG"; + case SQL_C_FLOAT: return "SQL_C_FLOAT"; + case SQL_C_DOUBLE: return "SQL_C_DOUBLE"; + case SQL_C_BIT: return "SQL_C_BIT"; + case SQL_C_TINYINT: return "SQL_C_TINYINT"; + case SQL_C_STINYINT: return "SQL_C_STINYINT"; + case SQL_C_UTINYINT: return "SQL_C_UTINYINT"; + case SQL_C_SBIGINT: return "SQL_C_SBIGINT"; + case SQL_C_UBIGINT: return "SQL_C_UBIGINT"; + case SQL_C_BINARY: return "SQL_C_BINARY"; + case SQL_C_DATE: return "SQL_C_DATE"; + case SQL_C_TIME: return "SQL_C_TIME"; + case SQL_C_TIMESTAMP: return "SQL_C_TIMESTAMP"; + case SQL_C_TYPE_DATE: return "SQL_C_TYPE_DATE"; + case SQL_C_TYPE_TIME: return "SQL_C_TYPE_TIME"; + case SQL_C_TYPE_TIMESTAMP: return "SQL_C_TYPE_TIMESTAMP"; + case SQL_C_NUMERIC: return "SQL_C_NUMERIC"; + case SQL_C_GUID: return "SQL_C_GUID"; + default: return "UNKNOWN"; + } +} + +int is_valid_sql_c_type(int type) { + const char *ctype = sql_c_type(type); + if (strcmp(ctype, "UNKNOWN")==0) return 0; + return 1; +} + +int is_valid_sql_sql_type(int type) { + const char *sqltype = sql_sql_type(type); + if (strcmp(sqltype, "UNKNOWN")==0) return 0; + return 1; +} + +int string_conv(const char *fromcode, const char *tocode, + const unsigned char *src, size_t sbytes, + unsigned char *dst, size_t dbytes, + size_t *consumed, size_t *generated) +{ + if (consumed) *consumed = 0; + if (generated) *generated = 0; + + if (dbytes <= 0) return -1; + dst[0] = '\0'; + + iconv_t conv = iconv_open(tocode, fromcode); + if (!conv) return -1; + + int r = 0; + do { + char *s = (char*)src; + char *d = (char*)dst; + size_t sl = sbytes; + size_t dl = dbytes; + + r = iconv(conv, &s, &sl, &d, &dl); + *d = '\0'; + + if (consumed) *consumed = sbytes - sl; + if (generated) *generated = dbytes - dl; + + } while (0); + + iconv_close(conv); + return r; +} + +int utf8_chars(const char *src) +{ + const char *fromcode = "UTF-8"; + const char *tocode = "UCS-2LE"; + iconv_t conv = iconv_open(tocode, fromcode); + if (!conv) return -1; + + size_t slen = strlen(src); + char buf[4096]; + size_t dlen = sizeof(buf); + char *ps = (char*)src; + char *pd = buf; + iconv(conv, &ps, &slen, &pd, &dlen); + DASSERT(slen==0); + + size_t chars = (sizeof(buf) - dlen) / 2; + iconv_close(conv); + return chars; +} + +unsigned char* utf8_to_ucs4le(const char *utf8, size_t *chars) +{ + const char *tocode = "UCS-4LE"; + const char *fromcode = "UTF-8"; + + iconv_t conv = iconv_open(tocode, fromcode); + if (!conv) return NULL; + + unsigned char *ucs4le = NULL; + + do { + size_t slen = strlen(utf8); + size_t dlen = slen * 4; + + ucs4le = (unsigned char*)malloc(dlen+1); + if (!ucs4le) break; + + char *src = (char*)utf8; + char *dst = (char*)ucs4le; + size_t s = slen; + size_t d = dlen; + iconv(conv, &src, &s, &dst, &d); + dst[0] = '\0'; + + if (chars) *chars = (dlen - d) / 4; + } while (0); + + iconv_close(conv); + return ucs4le; +} + +char* ucs4le_to_utf8(const unsigned char *ucs4le, size_t slen, size_t *chars) +{ + const char *fromcode = "UCS-4LE"; + const char *tocode = "UTF-8"; + + iconv_t conv = iconv_open(tocode, fromcode); + if (!conv) return NULL; + + char *utf8 = NULL; + + do { + size_t dlen = slen; + + utf8 = (char*)malloc(dlen+1); + if (!utf8) break; + + char *dst = utf8; + char *src = (char*)ucs4le; + size_t s = slen; + size_t d = dlen; + iconv(conv, &src, &s, &dst, &d); + dst[0] = '\0'; + + if (chars) *chars = (slen - s) / 4; + } while (0); + + iconv_close(conv); + return utf8; +} + +SQLCHAR* wchars_to_chars(const SQLWCHAR *wchars, size_t chs, size_t *bytes) +{ + size_t dlen = chs * 4; + SQLCHAR *dst = (SQLCHAR*)malloc(dlen + 1); + if (!dst) return NULL; + + string_conv("UCS-2LE", "UTF-8", (const unsigned char*)wchars, chs * sizeof(*wchars), dst, dlen + 1, NULL, bytes); + + return dst; +} + diff --git a/src/connector/odbc/src/todbc_util.h b/src/connector/odbc/src/todbc_util.h new file mode 100644 index 0000000000000000000000000000000000000000..43264975b4e618bd495691e59fb9df59f6664e03 --- /dev/null +++ b/src/connector/odbc/src/todbc_util.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TODBC_UTIL_H_ +#define _TODBC_UTIL_H_ + +#include +#include +#include +#include +#include + +#define D(fmt, ...) \ + fprintf(stderr, \ + "%s[%d]:%s() " fmt "\n", \ + basename((char*)__FILE__), __LINE__, __func__, \ + ##__VA_ARGS__) + +#define DASSERT(statement) \ +do { \ + if (statement) break; \ + D("Assertion failure: %s", #statement); \ + abort(); \ +} while (0) + +#define DASSERTX(statement, fmt, ...) \ +do { \ + if (statement) break; \ + D("Assertion failure: %s, " fmt "", #statement, ##__VA_ARGS__); \ + abort(); \ +} while (0) + + + +const char* sql_sql_type(int type); +const char* sql_c_type(int type); + +int is_valid_sql_c_type(int type); +int is_valid_sql_sql_type(int type); + +int string_conv(const char *fromcode, const char *tocode, + const unsigned char *src, size_t sbytes, + unsigned char *dst, size_t dbytes, + size_t *consumed, size_t *generated); +int utf8_chars(const char *src); + +unsigned char* utf8_to_ucs4le(const char *utf8, size_t *chars); +char* ucs4le_to_utf8(const unsigned char *ucs4le, size_t slen, size_t *chars); +SQLCHAR* wchars_to_chars(const SQLWCHAR *wchars, size_t chs, size_t *bytes); + +#endif // _TODBC_UTIL_H_ diff --git a/src/connector/odbc/tests/CMakeLists.txt b/src/connector/odbc/tests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..ac57a5647fce8bd036e133936284f3f4c847d8c8 --- /dev/null +++ b/src/connector/odbc/tests/CMakeLists.txt @@ -0,0 +1,7 @@ +PROJECT(TDengine) + +IF (TD_LINUX) + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(tcodbc main.c) + TARGET_LINK_LIBRARIES(tcodbc odbc) +ENDIF () diff --git a/src/connector/odbc/tests/main.c b/src/connector/odbc/tests/main.c new file mode 100644 index 0000000000000000000000000000000000000000..1ac9b71369e8a526b051008b9379fdda4b6a5e77 --- /dev/null +++ b/src/connector/odbc/tests/main.c @@ -0,0 +1,231 @@ +#include +#include + +#include +#include + +#include "os.h" + +// static const char *dsn = "TAOS_DSN"; +// static const char *uid = "root"; +// static const char *pwd = "taosdata"; + +typedef struct data_s data_t; +struct data_s { + int64_t ts; + int8_t b; + int8_t v1; + int16_t v2; + int32_t v4; + int64_t v8; + float f4; + double f8; + char bin[40+1]; + char blob[40+1]; // why 80? ref: tests/examples/c/apitest.c +}; + +static const char *pre_stmts[] = { + "create database db", + "use db", + "create table t (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin binary(40), blob nchar(10))" +}; + +static const char *pro_stmts[] = { + // "insert into t values ('2019-07-15 00:00:00', 1)", + // "insert into t values ('2019-07-15 01:00:00', 2)", + "select * from t" + // "drop database db" +}; + +#define CHK_RESULT(r, ht, h) \ +do { \ + if (r==0) break; \ + SQLCHAR ss[10]; \ + SQLINTEGER ne = 0; \ + SQLCHAR es[4096]; \ + SQLSMALLINT n = 0; \ + ss[0] = '\0'; \ + es[0] = '\0'; \ + SQLRETURN ret = SQLGetDiagRec(ht, h, 1, ss, &ne, es, sizeof(es), &n); \ + if (ret) break; \ + fprintf(stderr, "%s%s\n", ss, es); \ +} while (0) + +static int do_statement(SQLHSTMT stmt, const char *statement) { + SQLRETURN r = 0; + do { + fprintf(stderr, "prepare [%s]\n", statement); + r = SQLPrepare(stmt, (SQLCHAR*)statement, strlen(statement)); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + fprintf(stderr, "execute [%s]\n", statement); + r = SQLExecute(stmt); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + fprintf(stderr, "done\n"); + } while (0); + fprintf(stderr, "r: [%x][%d]\n", r, r); + return r; +} + +static int do_insert(SQLHSTMT stmt, data_t data) { + SQLRETURN r = 0; + SQLLEN lbin; + SQLLEN lblob; + + const char *statement = "insert into t values (?, ?, ?, ?, ?, ?, ?, ?, ?,?)"; + int ignored = 0; + + do { + fprintf(stderr, "prepare [%s]\n", statement); + r = SQLPrepare(stmt, (SQLCHAR*)statement, strlen(statement)); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 1 [%s]\n", statement); + r = SQLBindParameter(stmt, 1, SQL_PARAM_INPUT, SQL_C_SBIGINT, SQL_TIMESTAMP, ignored, ignored, &data.ts, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 2 [%s]\n", statement); + r = SQLBindParameter(stmt, 2, SQL_PARAM_INPUT, SQL_C_BIT, SQL_BIT, ignored, ignored, &data.b, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 3 [%s]\n", statement); + r = SQLBindParameter(stmt, 3, SQL_PARAM_INPUT, SQL_C_TINYINT, SQL_TINYINT, ignored, ignored, &data.v1, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 4 [%s]\n", statement); + r = SQLBindParameter(stmt, 4, SQL_PARAM_INPUT, SQL_C_SHORT, SQL_SMALLINT, ignored, ignored, &data.v2, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 5 [%s]\n", statement); + r = SQLBindParameter(stmt, 5, SQL_PARAM_INPUT, SQL_C_LONG, SQL_INTEGER, ignored, ignored, &data.v4, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 6 [%s]\n", statement); + r = SQLBindParameter(stmt, 6, SQL_PARAM_INPUT, SQL_C_SBIGINT, SQL_BIGINT, ignored, ignored, &data.v8, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 7 [%s]\n", statement); + r = SQLBindParameter(stmt, 7, SQL_PARAM_INPUT, SQL_C_FLOAT, SQL_FLOAT, ignored, ignored, &data.f4, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 8 [%s]\n", statement); + r = SQLBindParameter(stmt, 8, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_DOUBLE, ignored, ignored, &data.f8, ignored, NULL); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 9 [%s]\n", statement); + lbin = SQL_NTS; + r = SQLBindParameter(stmt, 9, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, sizeof(data.bin)-1, ignored, &data.bin, ignored, &lbin); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "bind 10 [%s]\n", statement); + lblob = SQL_NTS; + r = SQLBindParameter(stmt, 10, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_VARCHAR, sizeof(data.blob)-1, ignored, &data.blob, ignored, &lblob); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + fprintf(stderr, "execute [%s]\n", statement); + r = SQLExecute(stmt); + CHK_RESULT(r, SQL_HANDLE_STMT, stmt); + if (r) break; + + // ts += 1; + // v = 2; + // fprintf(stderr, "execute [%s]\n", statement); + // r = SQLExecute(stmt); + // if (r) break; + + fprintf(stderr, "done\n"); + } while (0); + fprintf(stderr, "r: [%x][%d]\n", r, r); + return r; +} + +int main(int argc, char *argv[]) { + if (argc < 4) return 1; + const char *dsn = argv[1]; + const char *uid = argv[2]; + const char *pwd = argv[3]; + SQLRETURN r; + SQLHENV env = {0}; + SQLHDBC conn = {0}; + r = SQLAllocEnv(&env); + if (r!=SQL_SUCCESS) return 1; + do { + r = SQLAllocConnect(env, &conn); + CHK_RESULT(r, SQL_HANDLE_ENV, env); + if (r!=SQL_SUCCESS) break; + do { + r = SQLConnect(conn, (SQLCHAR*)dsn, strlen(dsn), + (SQLCHAR*)uid, strlen(uid), + (SQLCHAR*)pwd, strlen(pwd)); + CHK_RESULT(r, SQL_HANDLE_DBC, conn); + if (r!=SQL_SUCCESS) break; + do { + SQLHSTMT stmt = {0}; + r = SQLAllocHandle(SQL_HANDLE_STMT, conn, &stmt); + if (r!=SQL_SUCCESS) break; + do { + do_statement(stmt, "drop database db"); + for (size_t i=0; i ?", 4) +row = cursor.fetchone() +while row: + print(row) + row = cursor.fetchone() +cursor.close() + +cursor = cnxn.cursor() +cursor.execute("SELECT * from db.v where v1 > ?", '5') +row = cursor.fetchone() +while row: + print(row) + row = cursor.fetchone() +cursor.close() + diff --git a/src/connector/python/linux/python2/taos/cinterface.py b/src/connector/python/linux/python2/taos/cinterface.py index c26e5c0967918bd45f362b3df6267561e80dfd66..32859f6b340b4393b523d475bce1ac89cef1a040 100644 --- a/src/connector/python/linux/python2/taos/cinterface.py +++ b/src/connector/python/linux/python2/taos/cinterface.py @@ -225,6 +225,7 @@ class CTaosInterface(object): if connection.value == None: print('connect to TDengine failed') + raise ConnectionError("connect to TDengine failed") # sys.exit(1) else: print('connect to TDengine success') diff --git a/src/connector/python/linux/python2/taos/cursor.py b/src/connector/python/linux/python2/taos/cursor.py index 8c268d8afba2b971709fba6f157abfebdc8dfd1a..37c02d330e856717b5ed0bdac76723cf64d3860b 100644 --- a/src/connector/python/linux/python2/taos/cursor.py +++ b/src/connector/python/linux/python2/taos/cursor.py @@ -192,8 +192,10 @@ class TDengineCursor(object): buffer = [[] for i in range(len(self._fields))] self._rowcount = 0 while True: - block, num_of_fields = CTaosInterface.fetchBlock( - self._result, self._fields) + block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno != 0: + raise ProgrammingError(CTaosInterface.errStr(self._result), errno) if num_of_fields == 0: break self._rowcount += num_of_fields diff --git a/src/connector/python/linux/python3/taos/cinterface.py b/src/connector/python/linux/python3/taos/cinterface.py index c9d0551af5faedc0b9726fa9be28337f26bba079..609154a3a4b38cfd1cf7976fb755e4aef7be3354 100644 --- a/src/connector/python/linux/python3/taos/cinterface.py +++ b/src/connector/python/linux/python3/taos/cinterface.py @@ -225,6 +225,7 @@ class CTaosInterface(object): if connection.value == None: print('connect to TDengine failed') + raise ConnectionError("connect to TDengine failed") # sys.exit(1) #else: # print('connect to TDengine success') @@ -414,4 +415,4 @@ if __name__ == '__main__': print(data) cinter.freeResult(result) - cinter.close(conn) \ No newline at end of file + cinter.close(conn) diff --git a/src/connector/python/linux/python3/taos/cursor.py b/src/connector/python/linux/python3/taos/cursor.py index 3f0f315d3388fcac1c752c847b7fa1c412b06749..ec7a85ee1a3f8cb0cd49aca8c2a4242dca89021e 100644 --- a/src/connector/python/linux/python3/taos/cursor.py +++ b/src/connector/python/linux/python3/taos/cursor.py @@ -207,8 +207,10 @@ class TDengineCursor(object): buffer = [[] for i in range(len(self._fields))] self._rowcount = 0 while True: - block, num_of_fields = CTaosInterface.fetchBlock( - self._result, self._fields) + block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno != 0: + raise ProgrammingError(CTaosInterface.errStr(self._result), errno) if num_of_fields == 0: break self._rowcount += num_of_fields diff --git a/src/connector/python/windows/python2/taos/cursor.py b/src/connector/python/windows/python2/taos/cursor.py index 7eee3bfc8f8559454f53aa967f5ad0294a1cb2bf..8714fe77cb739f23f79247a41d72aa127b6d6d25 100644 --- a/src/connector/python/windows/python2/taos/cursor.py +++ b/src/connector/python/windows/python2/taos/cursor.py @@ -142,6 +142,9 @@ class TDengineCursor(object): self._rowcount = 0 while True: block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno != 0: + raise ProgrammingError(CTaosInterface.errStr(self._result), errno) if num_of_fields == 0: break self._rowcount += num_of_fields for i in range(len(self._fields)): diff --git a/src/connector/python/windows/python3/taos/cursor.py b/src/connector/python/windows/python3/taos/cursor.py index 5f5aa4e1d7d9b454132f533a9e84cca2859db735..c2c442b06ee71ae90ec63662886c709e38d4d2ad 100644 --- a/src/connector/python/windows/python3/taos/cursor.py +++ b/src/connector/python/windows/python3/taos/cursor.py @@ -142,6 +142,9 @@ class TDengineCursor(object): self._rowcount = 0 while True: block, num_of_fields = CTaosInterface.fetchBlock(self._result, self._fields) + errno = CTaosInterface.libtaos.taos_errno(self._result) + if errno != 0: + raise ProgrammingError(CTaosInterface.errStr(self._result), errno) if num_of_fields == 0: break self._rowcount += num_of_fields for i in range(len(self._fields)): diff --git a/src/dnode/CMakeLists.txt b/src/dnode/CMakeLists.txt index dea90811ad83206b05e29b0e2468b8057ac8d7a8..5608cfd6d16826e399f9ea41dc026d2ab2459610 100644 --- a/src/dnode/CMakeLists.txt +++ b/src/dnode/CMakeLists.txt @@ -4,6 +4,7 @@ PROJECT(TDengine) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/mnode/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/tsdb/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/sync/inc) INCLUDE_DIRECTORIES(${TD_ENTERPRISE_DIR}/src/inc) INCLUDE_DIRECTORIES(inc) diff --git a/src/dnode/src/dnodeMPeer.c b/src/dnode/src/dnodeMPeer.c index 82ed7dd1793882c15929aa0899e04357a99359bb..8414d79a9815287dfdfae3af5cc123304745c56d 100644 --- a/src/dnode/src/dnodeMPeer.c +++ b/src/dnode/src/dnodeMPeer.c @@ -33,7 +33,8 @@ typedef struct { } SMPeerWorker; typedef struct { - int32_t num; + int32_t curNum; + int32_t maxNum; SMPeerWorker *peerWorker; } SMPeerWorkerPool; @@ -46,37 +47,44 @@ static void *dnodeProcessMnodePeerQueue(void *param); int32_t dnodeInitMnodePeer() { tsMPeerQset = taosOpenQset(); - tsMPeerPool.num = 1; - tsMPeerPool.peerWorker = (SMPeerWorker *)calloc(sizeof(SMPeerWorker), tsMPeerPool.num); + tsMPeerPool.maxNum = 1; + tsMPeerPool.curNum = 0; + tsMPeerPool.peerWorker = (SMPeerWorker *)calloc(sizeof(SMPeerWorker), tsMPeerPool.maxNum); if (tsMPeerPool.peerWorker == NULL) return -1; - for (int32_t i = 0; i < tsMPeerPool.num; ++i) { + for (int32_t i = 0; i < tsMPeerPool.maxNum; ++i) { SMPeerWorker *pWorker = tsMPeerPool.peerWorker + i; pWorker->workerId = i; + dDebug("dnode mpeer worker:%d is created", i); } - dInfo("dnode mpeer is opened"); + dDebug("dnode mpeer is opened, workers:%d qset:%p", tsMPeerPool.maxNum, tsMPeerQset); return 0; } void dnodeCleanupMnodePeer() { - for (int32_t i = 0; i < tsMPeerPool.num; ++i) { + for (int32_t i = 0; i < tsMPeerPool.maxNum; ++i) { SMPeerWorker *pWorker = tsMPeerPool.peerWorker + i; if (pWorker->thread) { taosQsetThreadResume(tsMPeerQset); } + dDebug("dnode mpeer worker:%d is closed", i); } - for (int32_t i = 0; i < tsMPeerPool.num; ++i) { + for (int32_t i = 0; i < tsMPeerPool.maxNum; ++i) { SMPeerWorker *pWorker = tsMPeerPool.peerWorker + i; + dDebug("dnode mpeer worker:%d start to join", i); if (pWorker->thread) { pthread_join(pWorker->thread, NULL); } + dDebug("dnode mpeer worker:%d join success", i); } + dDebug("dnode mpeer is closed, qset:%p", tsMPeerQset); + taosCloseQset(tsMPeerQset); + tsMPeerQset = NULL; taosTFree(tsMPeerPool.peerWorker); - dInfo("dnode mpeer is closed"); } int32_t dnodeAllocateMnodePqueue() { @@ -85,7 +93,7 @@ int32_t dnodeAllocateMnodePqueue() { taosAddIntoQset(tsMPeerQset, tsMPeerQueue, NULL); - for (int32_t i = 0; i < tsMPeerPool.num; ++i) { + for (int32_t i = tsMPeerPool.curNum; i < tsMPeerPool.maxNum; ++i) { SMPeerWorker *pWorker = tsMPeerPool.peerWorker + i; pWorker->workerId = i; @@ -98,7 +106,9 @@ int32_t dnodeAllocateMnodePqueue() { } pthread_attr_destroy(&thAttr); - dDebug("dnode mpeer worker:%d is launched, total:%d", pWorker->workerId, tsMPeerPool.num); + + tsMPeerPool.curNum = i + 1; + dDebug("dnode mpeer worker:%d is launched, total:%d", pWorker->workerId, tsMPeerPool.maxNum); } dDebug("dnode mpeer queue:%p is allocated", tsMPeerQueue); @@ -106,6 +116,7 @@ int32_t dnodeAllocateMnodePqueue() { } void dnodeFreeMnodePqueue() { + dDebug("dnode mpeer queue:%p is freed", tsMPeerQueue); taosCloseQueue(tsMPeerQueue); tsMPeerQueue = NULL; } @@ -148,7 +159,7 @@ static void *dnodeProcessMnodePeerQueue(void *param) { while (1) { if (taosReadQitemFromQset(tsMPeerQset, &type, (void **)&pPeerMsg, &unUsed) == 0) { - dDebug("dnodeProcessMnodePeerQueue: got no message from qset, exiting..."); + dDebug("qset:%p, mnode peer got no message from qset, exiting", tsMPeerQset); break; } diff --git a/src/dnode/src/dnodeMRead.c b/src/dnode/src/dnodeMRead.c index 6e610d8498ad4776d0eb02098129d6b87992ec0a..fdcbb5889f766ddebdb3f1e56ccffa0b5b129552 100644 --- a/src/dnode/src/dnodeMRead.c +++ b/src/dnode/src/dnodeMRead.c @@ -33,7 +33,8 @@ typedef struct { } SMReadWorker; typedef struct { - int32_t num; + int32_t curNum; + int32_t maxNum; SMReadWorker *readWorker; } SMReadWorkerPool; @@ -46,40 +47,46 @@ static void *dnodeProcessMnodeReadQueue(void *param); int32_t dnodeInitMnodeRead() { tsMReadQset = taosOpenQset(); - tsMReadPool.num = tsNumOfCores * tsNumOfThreadsPerCore / 2; - tsMReadPool.num = MAX(2, tsMReadPool.num); - tsMReadPool.num = MIN(4, tsMReadPool.num); - tsMReadPool.readWorker = (SMReadWorker *)calloc(sizeof(SMReadWorker), tsMReadPool.num); + tsMReadPool.maxNum = tsNumOfCores * tsNumOfThreadsPerCore / 2; + tsMReadPool.maxNum = MAX(2, tsMReadPool.maxNum); + tsMReadPool.maxNum = MIN(4, tsMReadPool.maxNum); + tsMReadPool.curNum = 0; + tsMReadPool.readWorker = (SMReadWorker *)calloc(sizeof(SMReadWorker), tsMReadPool.maxNum); if (tsMReadPool.readWorker == NULL) return -1; - for (int32_t i = 0; i < tsMReadPool.num; ++i) { + for (int32_t i = 0; i < tsMReadPool.maxNum; ++i) { SMReadWorker *pWorker = tsMReadPool.readWorker + i; pWorker->workerId = i; + dDebug("dnode mread worker:%d is created", i); } - dInfo("dnode mread is opened"); + dDebug("dnode mread is opened, workers:%d qset:%p", tsMReadPool.maxNum, tsMReadQset); return 0; } void dnodeCleanupMnodeRead() { - for (int32_t i = 0; i < tsMReadPool.num; ++i) { + for (int32_t i = 0; i < tsMReadPool.maxNum; ++i) { SMReadWorker *pWorker = tsMReadPool.readWorker + i; if (pWorker->thread) { taosQsetThreadResume(tsMReadQset); } + dDebug("dnode mread worker:%d is closed", i); } - for (int32_t i = 0; i < tsMReadPool.num; ++i) { + for (int32_t i = 0; i < tsMReadPool.maxNum; ++i) { SMReadWorker *pWorker = tsMReadPool.readWorker + i; + dDebug("dnode mread worker:%d start to join", i); if (pWorker->thread) { pthread_join(pWorker->thread, NULL); } + dDebug("dnode mread worker:%d start to join", i); } + dDebug("dnode mread is closed, qset:%p", tsMReadQset); + taosCloseQset(tsMReadQset); + tsMReadQset = NULL; free(tsMReadPool.readWorker); - - dInfo("dnode mread is closed"); } int32_t dnodeAllocateMnodeRqueue() { @@ -88,7 +95,7 @@ int32_t dnodeAllocateMnodeRqueue() { taosAddIntoQset(tsMReadQset, tsMReadQueue, NULL); - for (int32_t i = 0; i < tsMReadPool.num; ++i) { + for (int32_t i = tsMReadPool.curNum; i < tsMReadPool.maxNum; ++i) { SMReadWorker *pWorker = tsMReadPool.readWorker + i; pWorker->workerId = i; @@ -101,7 +108,8 @@ int32_t dnodeAllocateMnodeRqueue() { } pthread_attr_destroy(&thAttr); - dDebug("dnode mread worker:%d is launched, total:%d", pWorker->workerId, tsMReadPool.num); + tsMReadPool.curNum = i + 1; + dDebug("dnode mread worker:%d is launched, total:%d", pWorker->workerId, tsMReadPool.maxNum); } dDebug("dnode mread queue:%p is allocated", tsMReadQueue); @@ -109,6 +117,7 @@ int32_t dnodeAllocateMnodeRqueue() { } void dnodeFreeMnodeRqueue() { + dDebug("dnode mread queue:%p is freed", tsMReadQueue); taosCloseQueue(tsMReadQueue); tsMReadQueue = NULL; } @@ -156,7 +165,7 @@ static void *dnodeProcessMnodeReadQueue(void *param) { while (1) { if (taosReadQitemFromQset(tsMReadQset, &type, (void **)&pReadMsg, &unUsed) == 0) { - dDebug("dnodeProcessMnodeReadQueue: got no message from qset, exiting..."); + dDebug("qset:%p, mnode read got no message from qset, exiting", tsMReadQset); break; } diff --git a/src/dnode/src/dnodeMWrite.c b/src/dnode/src/dnodeMWrite.c index 0a305b5598161447bd1e94f0d8c7202389a2f724..384a0fae75088197d7fb01dd67c6e1b9d38739cd 100644 --- a/src/dnode/src/dnodeMWrite.c +++ b/src/dnode/src/dnodeMWrite.c @@ -34,7 +34,8 @@ typedef struct { } SMWriteWorker; typedef struct { - int32_t num; + int32_t curNum; + int32_t maxNum; SMWriteWorker *writeWorker; } SMWriteWorkerPool; @@ -47,38 +48,45 @@ static void *dnodeProcessMnodeWriteQueue(void *param); int32_t dnodeInitMnodeWrite() { tsMWriteQset = taosOpenQset(); - - tsMWritePool.num = 1; - tsMWritePool.writeWorker = (SMWriteWorker *)calloc(sizeof(SMWriteWorker), tsMWritePool.num); + + tsMWritePool.maxNum = 1; + tsMWritePool.curNum = 0; + tsMWritePool.writeWorker = (SMWriteWorker *)calloc(sizeof(SMWriteWorker), tsMWritePool.maxNum); if (tsMWritePool.writeWorker == NULL) return -1; - for (int32_t i = 0; i < tsMWritePool.num; ++i) { + for (int32_t i = 0; i < tsMWritePool.maxNum; ++i) { SMWriteWorker *pWorker = tsMWritePool.writeWorker + i; pWorker->workerId = i; + dDebug("dnode mwrite worker:%d is created", i); } - dInfo("dnode mwrite is opened"); + dDebug("dnode mwrite is opened, workers:%d qset:%p", tsMWritePool.maxNum, tsMWriteQset); return 0; } void dnodeCleanupMnodeWrite() { - for (int32_t i = 0; i < tsMWritePool.num; ++i) { + for (int32_t i = 0; i < tsMWritePool.maxNum; ++i) { SMWriteWorker *pWorker = tsMWritePool.writeWorker + i; if (pWorker->thread) { taosQsetThreadResume(tsMWriteQset); } + dDebug("dnode mwrite worker:%d is closed", i); } - for (int32_t i = 0; i < tsMWritePool.num; ++i) { + for (int32_t i = 0; i < tsMWritePool.maxNum; ++i) { SMWriteWorker *pWorker = tsMWritePool.writeWorker + i; + dDebug("dnode mwrite worker:%d start to join", i); if (pWorker->thread) { pthread_join(pWorker->thread, NULL); } + dDebug("dnode mwrite worker:%d join success", i); } + dDebug("dnode mwrite is closed, qset:%p", tsMWriteQset); + taosCloseQset(tsMWriteQset); + tsMWriteQset = NULL; taosTFree(tsMWritePool.writeWorker); - dInfo("dnode mwrite is closed"); } int32_t dnodeAllocateMnodeWqueue() { @@ -87,7 +95,7 @@ int32_t dnodeAllocateMnodeWqueue() { taosAddIntoQset(tsMWriteQset, tsMWriteQueue, NULL); - for (int32_t i = 0; i < tsMWritePool.num; ++i) { + for (int32_t i = tsMWritePool.curNum; i < tsMWritePool.maxNum; ++i) { SMWriteWorker *pWorker = tsMWritePool.writeWorker + i; pWorker->workerId = i; @@ -100,7 +108,8 @@ int32_t dnodeAllocateMnodeWqueue() { } pthread_attr_destroy(&thAttr); - dDebug("dnode mwrite worker:%d is launched, total:%d", pWorker->workerId, tsMWritePool.num); + tsMWritePool.curNum = i + 1; + dDebug("dnode mwrite worker:%d is launched, total:%d", pWorker->workerId, tsMWritePool.maxNum); } dDebug("dnode mwrite queue:%p is allocated", tsMWriteQueue); @@ -108,6 +117,7 @@ int32_t dnodeAllocateMnodeWqueue() { } void dnodeFreeMnodeWqueue() { + dDebug("dnode mwrite queue:%p is freed", tsMWriteQueue); taosCloseQueue(tsMWriteQueue); tsMWriteQueue = NULL; } @@ -122,11 +132,15 @@ void dnodeDispatchToMnodeWriteQueue(SRpcMsg *pMsg) { SMnodeMsg *pWrite = (SMnodeMsg *)taosAllocateQitem(sizeof(SMnodeMsg)); mnodeCreateMsg(pWrite, pMsg); - dDebug("app:%p:%p, msg:%s is put into mwrite queue", pWrite->rpcMsg.ahandle, pWrite, taosMsg[pWrite->rpcMsg.msgType]); + dDebug("app:%p:%p, msg:%s is put into mwrite queue:%p", pWrite->rpcMsg.ahandle, pWrite, + taosMsg[pWrite->rpcMsg.msgType], tsMWriteQueue); taosWriteQitem(tsMWriteQueue, TAOS_QTYPE_RPC, pWrite); } static void dnodeFreeMnodeWriteMsg(SMnodeMsg *pWrite) { + dDebug("app:%p:%p, msg:%s is freed from mwrite queue:%p", pWrite->rpcMsg.ahandle, pWrite, + taosMsg[pWrite->rpcMsg.msgType], tsMWriteQueue); + mnodeCleanupMsg(pWrite); taosFreeQitem(pWrite); } @@ -158,7 +172,7 @@ static void *dnodeProcessMnodeWriteQueue(void *param) { while (1) { if (taosReadQitemFromQset(tsMWriteQset, &type, (void **)&pWrite, &unUsed) == 0) { - dDebug("dnodeProcessMnodeWriteQueue: got no message from qset, exiting..."); + dDebug("qset:%p, mnode write got no message from qset, exiting", tsMWriteQset); break; } @@ -182,8 +196,8 @@ void dnodeReprocessMnodeWriteMsg(void *pMsg) { dnodeSendRedirectMsg(pMsg, true); dnodeFreeMnodeWriteMsg(pWrite); } else { - dDebug("app:%p:%p, msg:%s is reput into mwrite queue, retry times:%d", pWrite->rpcMsg.ahandle, pWrite, - taosMsg[pWrite->rpcMsg.msgType], pWrite->retry); + dDebug("app:%p:%p, msg:%s is reput into mwrite queue:%p, retry times:%d", pWrite->rpcMsg.ahandle, pWrite, + taosMsg[pWrite->rpcMsg.msgType], tsMWriteQueue, pWrite->retry); taosWriteQitem(tsMWriteQueue, TAOS_QTYPE_RPC, pWrite); } diff --git a/src/dnode/src/dnodeMgmt.c b/src/dnode/src/dnodeMgmt.c index 8f2b687dc4df129d508ba0a1515d5b00d41a57c1..968a8d9759e5618753996476b40efc3be77f7925 100644 --- a/src/dnode/src/dnodeMgmt.c +++ b/src/dnode/src/dnodeMgmt.c @@ -74,14 +74,16 @@ static int32_t dnodeProcessAlterVnodeMsg(SRpcMsg *pMsg); static int32_t dnodeProcessDropVnodeMsg(SRpcMsg *pMsg); static int32_t dnodeProcessAlterStreamMsg(SRpcMsg *pMsg); static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg); +static int32_t dnodeProcessCreateMnodeMsg(SRpcMsg *pMsg); static int32_t (*dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MAX])(SRpcMsg *pMsg); int32_t dnodeInitMgmt() { dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CREATE_VNODE] = dnodeProcessCreateVnodeMsg; - dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_VNODE] = dnodeProcessAlterVnodeMsg; + dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_VNODE] = dnodeProcessAlterVnodeMsg; dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_DROP_VNODE] = dnodeProcessDropVnodeMsg; dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_ALTER_STREAM] = dnodeProcessAlterStreamMsg; dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CONFIG_DNODE] = dnodeProcessConfigDnodeMsg; + dnodeProcessMgmtMsgFp[TSDB_MSG_TYPE_MD_CREATE_MNODE] = dnodeProcessCreateMnodeMsg; dnodeAddClientRspHandle(TSDB_MSG_TYPE_DM_STATUS_RSP, dnodeProcessStatusRsp); dnodeReadDnodeCfg(); @@ -226,7 +228,7 @@ static void *dnodeProcessMgmtQueue(void *param) { while (1) { if (taosReadQitemFromQset(tsMgmtQset, &type, (void **) &pMsg, &handle) == 0) { - dDebug("dnode mgmt got no message from qset, exit ..."); + dDebug("qset:%p, dnode mgmt got no message from qset, exit", tsMgmtQset); break; } @@ -451,10 +453,34 @@ static int32_t dnodeProcessAlterStreamMsg(SRpcMsg *pMsg) { } static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) { - SMDCfgDnodeMsg *pCfg = (SMDCfgDnodeMsg *)pMsg->pCont; + SMDCfgDnodeMsg *pCfg = pMsg->pCont; return taosCfgDynamicOptions(pCfg->config); } +static int32_t dnodeProcessCreateMnodeMsg(SRpcMsg *pMsg) { + SMDCreateMnodeMsg *pCfg = pMsg->pCont; + pCfg->dnodeId = htonl(pCfg->dnodeId); + if (pCfg->dnodeId != dnodeGetDnodeId()) { + dError("dnodeId:%d, in create mnode msg is not equal with saved dnodeId:%d", pCfg->dnodeId, dnodeGetDnodeId()); + return TSDB_CODE_MND_DNODE_ID_NOT_CONFIGURED; + } + + if (strcmp(pCfg->dnodeEp, tsLocalEp) != 0) { + dError("dnodeEp:%s, in create mnode msg is not equal with saved dnodeEp:%s", pCfg->dnodeEp, tsLocalEp); + return TSDB_CODE_MND_DNODE_EP_NOT_CONFIGURED; + } + + dDebug("dnodeId:%d, create mnode msg is received from mnodes, numOfMnodes:%d", pCfg->dnodeId, pCfg->mnodes.nodeNum); + for (int i = 0; i < pCfg->mnodes.nodeNum; ++i) { + pCfg->mnodes.nodeInfos[i].nodeId = htonl(pCfg->mnodes.nodeInfos[i].nodeId); + dDebug("mnode index:%d, mnode:%d:%s", i, pCfg->mnodes.nodeInfos[i].nodeId, pCfg->mnodes.nodeInfos[i].nodeEp); + } + + dnodeStartMnode(&pCfg->mnodes); + + return TSDB_CODE_SUCCESS; +} + void dnodeUpdateMnodeEpSetForPeer(SRpcEpSet *pEpSet) { if (pEpSet->numOfEps <= 0) { dError("mnode EP list for peer is changed, but content is invalid, discard it"); @@ -465,29 +491,6 @@ void dnodeUpdateMnodeEpSetForPeer(SRpcEpSet *pEpSet) { for (int i = 0; i < pEpSet->numOfEps; ++i) { pEpSet->port[i] -= TSDB_PORT_DNODEDNODE; dInfo("mnode index:%d %s:%u", i, pEpSet->fqdn[i], pEpSet->port[i]); - - if (!mnodeIsRunning()) { - if (strcmp(pEpSet->fqdn[i], tsLocalFqdn) == 0 && pEpSet->port[i] == tsServerPort) { - dInfo("mnode index:%d %s:%u should work as mnode", i, pEpSet->fqdn[i], pEpSet->port[i]); - bool find = false; - for (int i = 0; i < tsDMnodeInfos.nodeNum; ++i) { - if (tsDMnodeInfos.nodeInfos[i].nodeId == dnodeGetDnodeId()) { - dInfo("localEp found in mnode infos"); - find = true; - break; - } - } - - if (!find) { - dInfo("localEp not found in mnode infos, will set into mnode infos"); - tstrncpy(tsDMnodeInfos.nodeInfos[tsDMnodeInfos.nodeNum].nodeEp, tsLocalEp, TSDB_EP_LEN); - tsDMnodeInfos.nodeInfos[tsDMnodeInfos.nodeNum].nodeId = dnodeGetDnodeId(); - tsDMnodeInfos.nodeNum++; - } - - dnodeStartMnode(); - } - } } tsDMnodeEpSet = *pEpSet; @@ -532,7 +535,9 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) { } vnodeSetAccess(pStatusRsp->vgAccess, pCfg->numOfVnodes); - dnodeProcessModuleStatus(pCfg->moduleStatus); + + // will not set mnode in status msg + // dnodeProcessModuleStatus(pCfg->moduleStatus); dnodeUpdateDnodeCfg(pCfg); dnodeUpdateMnodeInfos(pMnodes); @@ -576,7 +581,7 @@ static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) { } dnodeSaveMnodeInfos(); - sdbUpdateSync(); + sdbUpdateAsync(); } static bool dnodeReadMnodeInfos() { diff --git a/src/dnode/src/dnodeModule.c b/src/dnode/src/dnodeModule.c index ba7cdf2664cb641047f5651920925808e5ec530e..001c73eb3946fe46984c25758d9e0ac2a678dd37 100644 --- a/src/dnode/src/dnodeModule.c +++ b/src/dnode/src/dnodeModule.c @@ -146,7 +146,9 @@ void dnodeProcessModuleStatus(uint32_t moduleStatus) { } } -bool dnodeStartMnode() { +bool dnodeStartMnode(void *pMnodes) { + SDMMnodeInfos *mnodes = pMnodes; + if (tsModuleStatus & (1 << TSDB_MOD_MNODE)) { dDebug("mnode module is already started, module status:%d", tsModuleStatus); return false; @@ -156,6 +158,7 @@ bool dnodeStartMnode() { dInfo("start mnode module, module status:%d, new status:%d", tsModuleStatus, moduleStatus); dnodeProcessModuleStatus(moduleStatus); - sdbUpdateSync(); + sdbUpdateSync(mnodes); + return true; } diff --git a/src/dnode/src/dnodePeer.c b/src/dnode/src/dnodePeer.c index c09d7422396b4525945ae0bb1f32d77d82ac9903..3bc2f7b48b319f3c9e6215a05463ebedc74035fa 100644 --- a/src/dnode/src/dnodePeer.c +++ b/src/dnode/src/dnodePeer.c @@ -48,6 +48,7 @@ int32_t dnodeInitServer() { dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_DROP_VNODE] = dnodeDispatchToMgmtQueue; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_ALTER_STREAM] = dnodeDispatchToMgmtQueue; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_CONFIG_DNODE] = dnodeDispatchToMgmtQueue; + dnodeProcessReqMsgFp[TSDB_MSG_TYPE_MD_CREATE_MNODE] = dnodeDispatchToMgmtQueue; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_CONFIG_TABLE] = dnodeDispatchToMnodePeerQueue; dnodeProcessReqMsgFp[TSDB_MSG_TYPE_DM_CONFIG_VNODE] = dnodeDispatchToMnodePeerQueue; @@ -170,8 +171,12 @@ void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg) { rpcSendRequest(tsDnodeClientRpc, epSet, rpcMsg); } -void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp) { +void dnodeSendMsgToMnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp) { SRpcEpSet epSet = {0}; dnodeGetMnodeEpSetForPeer(&epSet); rpcSendRecv(tsDnodeClientRpc, &epSet, rpcMsg, rpcRsp); } + +void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp, SRpcEpSet *epSet) { + rpcSendRecv(tsDnodeClientRpc, epSet, rpcMsg, rpcRsp); +} \ No newline at end of file diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index 4a1d337824e3a7879c651b8db3a3465e526c9299..4c6c2100e048e9aaf23f4155d3c54604104a8f9b 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -156,7 +156,7 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char dDebug("user:%s, send auth msg to mnodes", user); SRpcMsg rpcRsp = {0}; - dnodeSendMsgToDnodeRecv(&rpcMsg, &rpcRsp); + dnodeSendMsgToMnodeRecv(&rpcMsg, &rpcRsp); if (rpcRsp.code != 0) { dError("user:%s, auth msg received from mnodes, error:%s", user, tstrerror(rpcRsp.code)); @@ -173,15 +173,15 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char return rpcRsp.code; } -void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) { - dDebug("vgId:%d, sid:%d send config table msg to mnode", vgId, sid); +void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid) { + dDebug("vgId:%d, tid:%d send config table msg to mnode", vgId, tid); int32_t contLen = sizeof(SDMConfigTableMsg); SDMConfigTableMsg *pMsg = rpcMallocCont(contLen); pMsg->dnodeId = htonl(dnodeGetDnodeId()); pMsg->vgId = htonl(vgId); - pMsg->sid = htonl(sid); + pMsg->tid = htonl(tid); SRpcMsg rpcMsg = {0}; rpcMsg.pCont = pMsg; @@ -189,23 +189,23 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) { rpcMsg.msgType = TSDB_MSG_TYPE_DM_CONFIG_TABLE; SRpcMsg rpcRsp = {0}; - dnodeSendMsgToDnodeRecv(&rpcMsg, &rpcRsp); + dnodeSendMsgToMnodeRecv(&rpcMsg, &rpcRsp); terrno = rpcRsp.code; if (rpcRsp.code != 0) { rpcFreeCont(rpcRsp.pCont); - dError("vgId:%d, sid:%d failed to config table from mnode", vgId, sid); + dError("vgId:%d, tid:%d failed to config table from mnode", vgId, tid); return NULL; } else { - dInfo("vgId:%d, sid:%d config table msg is received", vgId, sid); + dInfo("vgId:%d, tid:%d config table msg is received", vgId, tid); // delete this after debug finished SMDCreateTableMsg *pTable = rpcRsp.pCont; int16_t numOfColumns = htons(pTable->numOfColumns); int16_t numOfTags = htons(pTable->numOfTags); - int32_t sid = htonl(pTable->sid); + int32_t tableId = htonl(pTable->tid); uint64_t uid = htobe64(pTable->uid); - dInfo("table:%s, numOfColumns:%d numOfTags:%d sid:%d uid:%" PRIu64, pTable->tableId, numOfColumns, numOfTags, sid, uid); + dInfo("table:%s, numOfColumns:%d numOfTags:%d tid:%d uid:%" PRIu64, pTable->tableId, numOfColumns, numOfTags, tableId, uid); return rpcRsp.pCont; } diff --git a/src/dnode/src/dnodeTelemetry.c b/src/dnode/src/dnodeTelemetry.c index 8ed4a9518b6c8a80bf79e0c7f326da54fa7d9e83..4fdc0b8a73b58efa801f33ea99ffb7d123a72dcf 100644 --- a/src/dnode/src/dnodeTelemetry.c +++ b/src/dnode/src/dnodeTelemetry.c @@ -177,7 +177,8 @@ static void addMemoryInfo(SBufferWriter* bw) { static void addVersionInfo(SBufferWriter* bw) { addStringField(bw, "version", version); addStringField(bw, "buildInfo", buildinfo); - addStringField(bw, "gitInfo", gitinfo); + addStringField(bw, "gitInfo", gitinfo); + addStringField(bw, "email", tsEmail); } static void addRuntimeInfo(SBufferWriter* bw) { @@ -261,11 +262,27 @@ static void* telemetryThread(void* param) { return NULL; } +static void dnodeGetEmail(char* filepath) { + int fd = open(filepath, O_RDONLY); + if (fd < 0) { + return; + } + + if (taosTRead(fd, (void *)tsEmail, TSDB_FQDN_LEN) < 0) { + dError("failed to read %d bytes from file %s since %s", TSDB_FQDN_LEN, filepath, strerror(errno)); + } + + close(fd); +} + + int32_t dnodeInitTelemetry() { if (!tsEnableTelemetryReporting) { return 0; } + dnodeGetEmail("/usr/local/taos/email"); + if (tsem_init(&tsExitSem, 0, 0) == -1) { // just log the error, it is ok for telemetry to fail dTrace("failed to create semaphore for telemetry, reason:%s", strerror(errno)); diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index fb4ffcdafa3847d1583a58b773738148b53e2c1d..e61158ef30dddd6037af36c61be1fd522f8af10b 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -189,7 +189,6 @@ void dnodeSendRpcReadRsp(void *pVnode, SReadMsg *pRead, int32_t code) { void dnodeDispatchNonRspMsg(void *pVnode, SReadMsg *pRead, int32_t code) { rpcFreeCont(pRead->rpcMsg.pCont); vnodeRelease(pVnode); - return; } static void *dnodeProcessReadQueue(void *param) { @@ -199,7 +198,7 @@ static void *dnodeProcessReadQueue(void *param) { while (1) { if (taosReadQitemFromQset(readQset, &type, (void **)&pReadMsg, &pVnode) == 0) { - dDebug("dnodeProcessReadQueee: got no message from qset, exiting..."); + dDebug("qset:%p dnode read got no message from qset, exiting", readQset); break; } @@ -213,7 +212,8 @@ static void *dnodeProcessReadQueue(void *param) { } else { if (code == TSDB_CODE_QRY_HAS_RSP) { dnodeSendRpcReadRsp(pVnode, pReadMsg, pReadMsg->rpcMsg.code); - } else { // code == TSDB_CODE_NOT_READY, do not return msg to client + } else { // code == TSDB_CODE_QRY_NOT_READY, do not return msg to client + assert(pReadMsg->rpcMsg.handle == NULL || (pReadMsg->rpcMsg.handle != NULL && pReadMsg->rpcMsg.msgType == 5)); dnodeDispatchNonRspMsg(pVnode, pReadMsg, code); } } diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index 51bc8890fcd98b6f5dee4c88d2858990e68bc2a3..e56bae0d7e84953af493176a585ba3e7060b751b 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -24,8 +24,10 @@ #include "twal.h" #include "tdataformat.h" #include "tglobal.h" +#include "tsync.h" #include "vnode.h" #include "dnodeInt.h" +#include "syncInt.h" #include "dnodeVWrite.h" #include "dnodeMgmt.h" @@ -210,19 +212,19 @@ void dnodeSendRpcVnodeWriteRsp(void *pVnode, void *param, int32_t code) { static void *dnodeProcessWriteQueue(void *param) { SWriteWorker *pWorker = (SWriteWorker *)param; - SWriteMsg *pWrite; - SWalHead *pHead; + SWriteMsg * pWrite; + SWalHead * pHead; int32_t numOfMsgs; int type; - void *pVnode, *item; - SRspRet *pRspRet; + void * pVnode, *item; + SRspRet * pRspRet; dDebug("write worker:%d is running", pWorker->workerId); while (1) { numOfMsgs = taosReadAllQitemsFromQset(pWorker->qset, pWorker->qall, &pVnode); if (numOfMsgs == 0) { - dDebug("dnodeProcessWriteQueee: got no message from qset, exiting..."); + dDebug("qset:%p, dnode write got no message from qset, exiting", pWorker->qset); break; } @@ -237,16 +239,25 @@ static void *dnodeProcessWriteQueue(void *param) { pHead->msgType = pWrite->rpcMsg.msgType; pHead->version = 0; pHead->len = pWrite->contLen; - dDebug("%p, rpc msg:%s will be processed in vwrite queue", pWrite->rpcMsg.ahandle, taosMsg[pWrite->rpcMsg.msgType]); + dDebug("%p, rpc msg:%s will be processed in vwrite queue", pWrite->rpcMsg.ahandle, + taosMsg[pWrite->rpcMsg.msgType]); + } else if (type == TAOS_QTYPE_CQ) { + pHead = (SWalHead *)((char*)item + sizeof(SSyncHead)); + dTrace("%p, CQ wal msg:%s will be processed in vwrite queue, version:%" PRIu64, pHead, taosMsg[pHead->msgType], + pHead->version); } else { pHead = (SWalHead *)item; - dTrace("%p, wal msg:%s will be processed in vwrite queue, version:%" PRIu64, pHead, taosMsg[pHead->msgType], pHead->version); + dTrace("%p, wal msg:%s will be processed in vwrite queue, version:%" PRIu64, pHead, taosMsg[pHead->msgType], + pHead->version); } int32_t code = vnodeProcessWrite(pVnode, type, pHead, pRspRet); - if (pWrite) { + dTrace("%p, msg:%s is processed in vwrite queue, version:%" PRIu64 ", result:%s", pHead, taosMsg[pHead->msgType], + pHead->version, tstrerror(code)); + + if (pWrite) { pWrite->rpcMsg.code = code; - if (code <= 0) pWrite->processedCount = 1; + if (code <= 0) pWrite->processedCount = 1; } } @@ -258,7 +269,7 @@ static void *dnodeProcessWriteQueue(void *param) { taosGetQitem(pWorker->qall, &type, &item); if (type == TAOS_QTYPE_RPC) { pWrite = (SWriteMsg *)item; - dnodeSendRpcVnodeWriteRsp(pVnode, item, pWrite->rpcMsg.code); + dnodeSendRpcVnodeWriteRsp(pVnode, item, pWrite->rpcMsg.code); } else if (type == TAOS_QTYPE_FWD) { pHead = (SWalHead *)item; vnodeConfirmForward(pVnode, pHead->version, 0); @@ -279,13 +290,13 @@ static void dnodeHandleIdleWorker(SWriteWorker *pWorker) { int32_t num = taosGetQueueNumber(pWorker->qset); if (num > 0) { - usleep(30000); - sched_yield(); + usleep(30000); + sched_yield(); } else { - taosFreeQall(pWorker->qall); - taosCloseQset(pWorker->qset); - pWorker->qset = NULL; - dDebug("write worker:%d is released", pWorker->workerId); - pthread_exit(NULL); + taosFreeQall(pWorker->qall); + taosCloseQset(pWorker->qset); + pWorker->qset = NULL; + dDebug("write worker:%d is released", pWorker->workerId); + pthread_exit(NULL); } } diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 017241c4f869dcc450dd552c922e72446c8922f7..e84545be1753f3fedb4ee78acf397c91d824ad8b 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -43,12 +43,13 @@ void dnodeGetMnodeEpSetForPeer(void *epSet); void dnodeGetMnodeEpSetForShell(void *epSet); void * dnodeGetMnodeInfos(); int32_t dnodeGetDnodeId(); -bool dnodeStartMnode(); +bool dnodeStartMnode(void *pModes); void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg); -void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp); -void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid); +void dnodeSendMsgToMnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp); +void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp, SRpcEpSet *epSet); +void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid); void *dnodeAllocateVnodeWqueue(void *pVnode); void dnodeFreeVnodeWqueue(void *queue); diff --git a/src/inc/mnode.h b/src/inc/mnode.h index 03a25e0f92b881b6b1b9bcfcf6605257b776ae1b..5bef7402e30a0cc9f1964cc2430e0b1f5141590c 100644 --- a/src/inc/mnode.h +++ b/src/inc/mnode.h @@ -60,7 +60,8 @@ int32_t mnodeInitSystem(); int32_t mnodeStartSystem(); void mnodeCleanupSystem(); void mnodeStopSystem(); -void sdbUpdateSync(); +void sdbUpdateAsync(); +void sdbUpdateSync(void *pMnodes); bool mnodeIsRunning(); int32_t mnodeProcessRead(SMnodeMsg *pMsg); int32_t mnodeProcessWrite(SMnodeMsg *pMsg); diff --git a/src/inc/taos.h b/src/inc/taos.h index 7e8f174b7c3737463f7e66dfdc6d5cd906791ee3..315313734753de73bf477b1f67783a45c38c87c9 100644 --- a/src/inc/taos.h +++ b/src/inc/taos.h @@ -22,12 +22,12 @@ extern "C" { #endif -typedef void TAOS; -typedef void** TAOS_ROW; -typedef void TAOS_RES; -typedef void TAOS_SUB; -typedef void TAOS_STREAM; -typedef void TAOS_STMT; +typedef void TAOS; +typedef void TAOS_STMT; +typedef void TAOS_RES; +typedef void TAOS_STREAM; +typedef void TAOS_SUB; +typedef void **TAOS_ROW; // Data type definition #define TSDB_DATA_TYPE_NULL 0 // 1 bytes @@ -69,6 +69,8 @@ DLL_EXPORT int taos_options(TSDB_OPTION option, const void *arg, ...); DLL_EXPORT TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port); DLL_EXPORT void taos_close(TAOS *taos); +const char *taos_data_type(int type); + typedef struct TAOS_BIND { int buffer_type; void * buffer; @@ -77,10 +79,26 @@ typedef struct TAOS_BIND { int * is_null; int is_unsigned; // unused int * error; // unused + union { + int64_t ts; + int8_t b; + int8_t v1; + int16_t v2; + int32_t v4; + int64_t v8; + float f4; + double f8; + unsigned char *bin; + char *nchar; + } u; + unsigned int allocated; } TAOS_BIND; TAOS_STMT *taos_stmt_init(TAOS *taos); int taos_stmt_prepare(TAOS_STMT *stmt, const char *sql, unsigned long length); +int taos_stmt_is_insert(TAOS_STMT *stmt, int *insert); +int taos_stmt_num_params(TAOS_STMT *stmt, int *nums); +int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes); int taos_stmt_bind_param(TAOS_STMT *stmt, TAOS_BIND *bind); int taos_stmt_add_batch(TAOS_STMT *stmt); int taos_stmt_execute(TAOS_STMT *stmt); diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h index 25814a748e4bb1a1951c93979e26daabeffe6e2e..aee60da20147c674979540aa73da5ac101fae7f0 100644 --- a/src/inc/taosdef.h +++ b/src/inc/taosdef.h @@ -194,9 +194,9 @@ static FORCE_INLINE bool isNull(const char *val, int32_t type) { case TSDB_DATA_TYPE_DOUBLE: return *(uint64_t *)val == TSDB_DATA_DOUBLE_NULL; case TSDB_DATA_TYPE_NCHAR: - return *(uint32_t*) varDataVal(val) == TSDB_DATA_NCHAR_NULL; + return varDataLen(val) == sizeof(int32_t) && *(uint32_t*) varDataVal(val) == TSDB_DATA_NCHAR_NULL; case TSDB_DATA_TYPE_BINARY: - return *(uint8_t *) varDataVal(val) == TSDB_DATA_BINARY_NULL; + return varDataLen(val) == sizeof(int8_t) && *(uint8_t *) varDataVal(val) == TSDB_DATA_BINARY_NULL; default: return false; }; @@ -253,8 +253,10 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf #define TSDB_COL_NAME_LEN 65 #define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64 #define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE -#define TSDB_MAX_SQL_SHOW_LEN 256 -#define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024U) // sql length should be less than 8mb +#define TSDB_MAX_SQL_SHOW_LEN 512 +#define TSDB_MAX_ALLOWED_SQL_LEN (8*1024*1024U) // sql length should be less than 8mb + +#define TSDB_APPNAME_LEN TSDB_UNI_LEN #define TSDB_MAX_BYTES_PER_ROW 16384 #define TSDB_MAX_TAGS_LEN 16384 @@ -282,7 +284,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf #define TSDB_SHELL_VNODE_BITS 24 #define TSDB_SHELL_SID_MASK 0xFF #define TSDB_HTTP_TOKEN_LEN 20 -#define TSDB_SHOW_SQL_LEN 64 +#define TSDB_SHOW_SQL_LEN 512 #define TSDB_SLOW_QUERY_SQL_LEN 512 #define TSDB_MQTT_HOSTNAME_LEN 64 diff --git a/src/inc/taoserror.h b/src/inc/taoserror.h index b5d22ea80c2c0a9f338b537c3452929d0141e6e5..bb111d2da0da75e6a3e3812ac21364f9a18fb6f3 100644 --- a/src/inc/taoserror.h +++ b/src/inc/taoserror.h @@ -28,7 +28,7 @@ extern "C" { #else #define TAOS_DEFINE_ERROR(name, mod, code, msg) static const int32_t name = (0x80000000 | ((mod)<<16) | (code)); #endif - + #define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code)) #define TAOS_SUCCEEDED(err) ((err) >= 0) #define TAOS_FAILED(err) ((err) < 0) @@ -37,7 +37,7 @@ const char* tstrerror(int32_t err); int32_t* taosGetErrno(); #define terrno (*taosGetErrno()) - + #define TSDB_CODE_SUCCESS 0 #ifdef TAOS_ERROR_C @@ -139,6 +139,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_VGROUP_ALREADY_IN_DNODE, 0, 0x0339, "Vgroup alr TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_NOT_FREE, 0, 0x033A, "Dnode not avaliable") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_CLUSTER_ID, 0, 0x033B, "Cluster id not match") TAOS_DEFINE_ERROR(TSDB_CODE_MND_NOT_READY, 0, 0x033C, "Cluster not ready") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_ID_NOT_CONFIGURED, 0, 0x033D, "Dnode Id not configured") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_DNODE_EP_NOT_CONFIGURED, 0, 0x033E, "Dnode Ep not configured") TAOS_DEFINE_ERROR(TSDB_CODE_MND_ACCT_ALREADY_EXIST, 0, 0x0340, "Account already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ACCT, 0, 0x0341, "Invalid account") @@ -180,7 +182,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_DND_OUT_OF_MEMORY, 0, 0x0401, "Dnode out TAOS_DEFINE_ERROR(TSDB_CODE_DND_NO_WRITE_ACCESS, 0, 0x0402, "No permission for disk files in dnode") TAOS_DEFINE_ERROR(TSDB_CODE_DND_INVALID_MSG_LEN, 0, 0x0403, "Invalid message length") -// vnode +// vnode TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_IN_PROGRESS, 0, 0x0500, "Action in progress") TAOS_DEFINE_ERROR(TSDB_CODE_VND_MSG_NOT_PROCESSED, 0, 0x0501, "Message not processed") TAOS_DEFINE_ERROR(TSDB_CODE_VND_ACTION_NEED_REPROCESSED, 0, 0x0502, "Action need to be reprocessed") @@ -191,6 +193,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_DISK_PERMISSIONS, 0, 0x0506, "No write p TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR, 0, 0x0507, "Missing data file") TAOS_DEFINE_ERROR(TSDB_CODE_VND_OUT_OF_MEMORY, 0, 0x0508, "Out of memory") TAOS_DEFINE_ERROR(TSDB_CODE_VND_APP_ERROR, 0, 0x0509, "Unexpected generic error in vnode") +TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VRESION_FILE, 0, 0x050A, "Invalid version file") TAOS_DEFINE_ERROR(TSDB_CODE_VND_NOT_SYNCED, 0, 0x0511, "Database suspended") TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, 0, 0x0512, "Write operation denied") @@ -245,6 +248,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_GRANT_CPU_LIMITED, 0, 0x080B, "CPU cores // sync TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_CONFIG, 0, 0x0900, "Invalid Sync Configuration") TAOS_DEFINE_ERROR(TSDB_CODE_SYN_NOT_ENABLED, 0, 0x0901, "Sync module not enabled") +TAOS_DEFINE_ERROR(TSDB_CODE_SYN_INVALID_VERSION, 0, 0x0902, "Invalid Sync version") // wal TAOS_DEFINE_ERROR(TSDB_CODE_WAL_APP_ERROR, 0, 0x1000, "Unexpected generic error in wal") @@ -350,6 +354,23 @@ TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_TAG_VALUE_TOO_LONG, 0, 0x11A4, "tag value TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_NULL, 0, 0x11A5, "value not find") TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_TYPE, 0, 0x11A6, "value type should be boolean, number or string") + +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_OOM, 0, 0x2101, "out of memory") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_UNDEF, 0, 0x2102, "convertion undefined") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_TRUNC, 0, 0x2103, "convertion truncated") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONV_NOT_SUPPORT, 0, 0x2104, "convertion not supported") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_OUT_OF_RANGE, 0, 0x2105, "out of range") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_NOT_SUPPORT, 0, 0x2106, "not supported yet") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_INVALID_HANDLE, 0, 0x2107, "invalid handle") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_NO_RESULT, 0, 0x2108, "no result set") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_NO_FIELDS, 0, 0x2109, "no fields returned") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_INVALID_CURSOR, 0, 0x2110, "invalid cursor") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_STATEMENT_NOT_READY, 0, 0x2111, "statement not ready") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_CONNECTION_BUSY, 0, 0x2112, "connection still busy") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_BAD_CONNSTR, 0, 0x2113, "bad connection string") +TAOS_DEFINE_ERROR(TSDB_CODE_ODBC_BAD_ARG, 0, 0x2114, "bad argument") + + #ifdef TAOS_ERROR_C }; #endif diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 50b31a86ccd743b0e56c85e50628f9574bfc8c8e..600347c44fdb2a89e03bf24413f22240bb2815f2 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -59,7 +59,7 @@ TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_DROP_STABLE, "drop-stable" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_STREAM, "alter-stream" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CONFIG_DNODE, "config-dnode" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_ALTER_VNODE, "alter-vnode" ) -TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY5, "dummy5" ) +TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_MD_CREATE_MNODE, "create-mnode" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY6, "dummy6" ) TAOS_DEFINE_MESSAGE_TYPE( TSDB_MSG_TYPE_DUMMY7, "dummy7" ) @@ -182,10 +182,16 @@ extern char *taosMsg[]; #pragma pack(push, 1) +// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta typedef struct { char fqdn[TSDB_FQDN_LEN]; uint16_t port; -} SEpAddr; +} SEpAddrMsg; + +typedef struct { + char* fqdn; + uint16_t port; +} SEpAddr1; typedef struct { int32_t numOfVnodes; @@ -245,7 +251,7 @@ typedef struct { int8_t tableType; int16_t numOfColumns; int16_t numOfTags; - int32_t sid; + int32_t tid; int32_t sversion; int32_t tversion; int32_t tagDataLen; @@ -305,6 +311,8 @@ typedef struct { char clientVersion[TSDB_VERSION_LEN]; char msgVersion[TSDB_VERSION_LEN]; char db[TSDB_TABLE_FNAME_LEN]; + char appName[TSDB_APPNAME_LEN]; + int32_t pid; } SCMConnectMsg; typedef struct { @@ -352,7 +360,7 @@ typedef struct { typedef struct { int32_t contLen; int32_t vgId; - int32_t sid; + int32_t tid; uint64_t uid; char tableId[TSDB_TABLE_FNAME_LEN]; } SMDDropTableMsg; @@ -399,6 +407,7 @@ typedef struct SExprInfo { int16_t bytes; int16_t type; int32_t interBytes; + int64_t uid; } SExprInfo; typedef struct SColumnFilterInfo { @@ -660,16 +669,27 @@ typedef struct SCMSTableVgroupMsg { } SCMSTableVgroupMsg, SCMSTableVgroupRspMsg; typedef struct { - int32_t vgId; - int8_t numOfEps; - SEpAddr epAddr[TSDB_MAX_REPLICA]; + int32_t vgId; + int8_t numOfEps; + SEpAddr1 epAddr[TSDB_MAX_REPLICA]; } SCMVgroupInfo; +typedef struct { + int32_t vgId; + int8_t numOfEps; + SEpAddrMsg epAddr[TSDB_MAX_REPLICA]; +} SCMVgroupMsg; + typedef struct { int32_t numOfVgroups; SCMVgroupInfo vgroups[]; } SVgroupsInfo; +typedef struct { + int32_t numOfVgroups; + SCMVgroupMsg vgroups[]; +} SVgroupsMsg; + typedef struct STableMetaMsg { int32_t contLen; char tableId[TSDB_TABLE_FNAME_LEN]; // table id @@ -680,9 +700,9 @@ typedef struct STableMetaMsg { int16_t numOfColumns; int16_t sversion; int16_t tversion; - int32_t sid; + int32_t tid; uint64_t uid; - SCMVgroupInfo vgroup; + SCMVgroupMsg vgroup; SSchema schema[]; } STableMetaMsg; @@ -719,10 +739,16 @@ typedef struct { char ep[TSDB_EP_LEN]; // end point, hostname:port } SCMCreateDnodeMsg, SCMDropDnodeMsg; +typedef struct { + int32_t dnodeId; + char dnodeEp[TSDB_EP_LEN]; // end point, hostname:port + SDMMnodeInfos mnodes; +} SMDCreateMnodeMsg; + typedef struct { int32_t dnodeId; int32_t vgId; - int32_t sid; + int32_t tid; } SDMConfigTableMsg; typedef struct { @@ -740,6 +766,7 @@ typedef struct { uint32_t queryId; int64_t useconds; int64_t stime; + uint64_t qHandle; } SQueryDesc; typedef struct { @@ -755,8 +782,10 @@ typedef struct { typedef struct { uint32_t connId; + int32_t pid; int32_t numOfQueries; int32_t numOfStreams; + char appName[TSDB_APPNAME_LEN]; char pData[]; } SCMHeartBeatMsg; diff --git a/src/inc/twal.h b/src/inc/twal.h index cf570aefdc50f26944706f4eddb1d44364986bca..92204abd7d34a9ee2eebf1b74c2e8d58b9599f17 100644 --- a/src/inc/twal.h +++ b/src/inc/twal.h @@ -51,6 +51,7 @@ int walWrite(twalh, SWalHead *); void walFsync(twalh); int walRestore(twalh, void *pVnode, FWalWrite writeFp); int walGetWalFile(twalh, char *name, uint32_t *index); +int64_t walGetVersion(twalh); extern int wDebugFlag; diff --git a/src/inc/vnode.h b/src/inc/vnode.h index 15ddb6afee7c3ac2914df8133df24f6ef80a0a8a..fdce4d62794075bd2e7027b125780fbd7a2deaed 100644 --- a/src/inc/vnode.h +++ b/src/inc/vnode.h @@ -41,6 +41,8 @@ typedef struct { SRpcMsg rpcMsg; } SReadMsg; +extern char *vnodeStatus[]; + int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg); int32_t vnodeDrop(int32_t vgId); int32_t vnodeOpen(int32_t vgId, char *rootDir); @@ -54,6 +56,7 @@ void vnodeRelease(void *pVnode); // dec refCount void* vnodeGetWal(void *pVnode); int32_t vnodeProcessWrite(void *pVnode, int qtype, void *pHead, void *item); +int32_t vnodeCheckWrite(void *pVnode); int32_t vnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes); void vnodeBuildStatusMsg(void *param); void vnodeConfirmForward(void *param, uint64_t version, int32_t code); @@ -63,6 +66,7 @@ int32_t vnodeInitResources(); void vnodeCleanupResources(); int32_t vnodeProcessRead(void *pVnode, SReadMsg *pReadMsg); +int32_t vnodeCheckRead(void *pVnode); #ifdef __cplusplus } diff --git a/src/kit/shell/inc/shell.h b/src/kit/shell/inc/shell.h index dd62df170a7c87f127eb7c52c1f580b7f460b445..f508d186083c84482080f2f8fe251173733f1366 100644 --- a/src/kit/shell/inc/shell.h +++ b/src/kit/shell/inc/shell.h @@ -20,6 +20,7 @@ #include "taos.h" #include "taosdef.h" #include "stdbool.h" +#include "tsclient.h" #define MAX_USERNAME_SIZE 64 #define MAX_DBNAME_SIZE 64 @@ -59,7 +60,7 @@ typedef struct SShellArguments { extern void shellParseArgument(int argc, char* argv[], SShellArguments* arguments); extern TAOS* shellInit(SShellArguments* args); extern void* shellLoopQuery(void* arg); -extern void taos_error(TAOS* con); +extern void taos_error(TAOS_RES* tres); extern int regex_match(const char* s, const char* reg, int cflags); void shellReadCommand(TAOS* con, char command[]); int32_t shellRunCommand(TAOS* con, char* command); @@ -71,7 +72,7 @@ void source_dir(TAOS* con, SShellArguments* args); void get_history_path(char* history); void cleanup_handler(void* arg); void exitShell(); -int shellDumpResult(TAOS* con, char* fname, int* error_no, bool printMode); +int shellDumpResult(TAOS_RES* con, char* fname, int* error_no, bool printMode); void shellGetGrantInfo(void *con); int isCommentLine(char *line); diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index d5e826fbaabfbf76dfac0256935f3222b53cd70a..748b7e792982352de611227d82a844448d251ee2 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -294,9 +294,7 @@ void shellRunCommandOnServer(TAOS *con, char command[]) { st = taosGetTimestampUs(); - TAOS_RES* pSql = taos_query(con, command); - atomic_store_ptr(&result, pSql); // set the global TAOS_RES pointer - + TAOS_RES* pSql = taos_query_h(con, command, &result); if (taos_errno(pSql)) { taos_error(pSql); return; @@ -495,7 +493,7 @@ static int dumpResultToFile(const char* fname, TAOS_RES* tres) { if (i > 0) { fputc(',', fp); } - dumpFieldToFile(fp, row[i], fields +i, length[i], precision); + dumpFieldToFile(fp, (const char*)row[i], fields +i, length[i], precision); } fputc('\n', fp); @@ -621,7 +619,7 @@ static int verticalPrintResult(TAOS_RES* tres) { int padding = (int)(maxColNameLen - strlen(field->name)); printf("%*.s%s: ", padding, " ", field->name); - printField(row[i], field, 0, length[i], precision); + printField((const char*)row[i], field, 0, length[i], precision); putchar('\n'); } @@ -722,7 +720,7 @@ static int horizontalPrintResult(TAOS_RES* tres) { int32_t* length = taos_fetch_lengths(tres); for (int i = 0; i < num_fields; i++) { putchar(' '); - printField(row[i], fields + i, width[i], length[i], precision); + printField((const char*)row[i], fields + i, width[i], length[i], precision); putchar(' '); putchar('|'); } diff --git a/src/kit/shell/src/shellImport.c b/src/kit/shell/src/shellImport.c index ee0a90757bb51a98dd2bf535319afc215dbc04a8..af61995c618bc80389b8abf6d8c6f6c929327925 100644 --- a/src/kit/shell/src/shellImport.c +++ b/src/kit/shell/src/shellImport.c @@ -204,7 +204,7 @@ static void shellSourceFile(TAOS *con, char *fptr) { int32_t code = taos_errno(pSql); if (code != 0) { - fprintf(stderr, "DB error: %s: %s (%d)\n", taos_errstr(con), fname, lineNo); + fprintf(stderr, "DB error: %s: %s (%d)\n", taos_errstr(pSql), fname, lineNo); } /* free local resouce: allocated memory/metric-meta refcnt */ @@ -243,7 +243,7 @@ static void shellRunImportThreads(SShellArguments* args) pThread->totalThreads = args->threadNum; pThread->taos = taos_connect(args->host, args->user, args->password, args->database, tsDnodeShellPort); if (pThread->taos == NULL) { - fprintf(stderr, "ERROR: thread:%d failed connect to TDengine, error:%s\n", pThread->threadIndex, taos_errstr(pThread->taos)); + fprintf(stderr, "ERROR: thread:%d failed connect to TDengine, error:%s\n", pThread->threadIndex, "null taos"/*taos_errstr(pThread->taos)*/); exit(0); } diff --git a/src/kit/shell/src/shellWindows.c b/src/kit/shell/src/shellWindows.c index 67174827d4ce005ad579fbb9ab3c72f1828ad095..ce986813918249ebe501e92d3af307a67c296907 100644 --- a/src/kit/shell/src/shellWindows.c +++ b/src/kit/shell/src/shellWindows.c @@ -90,11 +90,12 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { } } else if (strcmp(argv[i], "-c") == 0) { if (i < argc - 1) { - if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) { - fprintf(stderr, "config file path: %s overflow max len %d\n", argv[i], TSDB_FILENAME_LEN - 1); + char *tmp = argv[++i]; + if (strlen(tmp) >= TSDB_FILENAME_LEN) { + fprintf(stderr, "config file path: %s overflow max len %d\n", tmp, TSDB_FILENAME_LEN - 1); exit(EXIT_FAILURE); } - strcpy(configDir, argv[++i]); + strcpy(configDir, tmp); } else { fprintf(stderr, "Option -c requires an argument\n"); exit(EXIT_FAILURE); diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index 8a2947dd180218dfd2ddc91d52b2825ccb011eae..4bc840f026d41dc4fe4e8d61c84d53140501bff6 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -115,7 +115,7 @@ typedef struct { uint64_t suid; int64_t createdTime; int32_t numOfColumns; //used by normal table - int32_t sid; + int32_t tid; int32_t vgId; int32_t sqlLen; int8_t updateEnd[4]; diff --git a/src/mnode/inc/mnodeMnode.h b/src/mnode/inc/mnodeMnode.h index 0976ea8acd74e511a6cda374dc6ad5501b503482..a28a03ea4028a243a27e79688de54627aaeb7064 100644 --- a/src/mnode/inc/mnodeMnode.h +++ b/src/mnode/inc/mnodeMnode.h @@ -31,7 +31,7 @@ typedef enum { int32_t mnodeInitMnodes(); void mnodeCleanupMnodes(); -int32_t mnodeAddMnode(int32_t dnodeId); +void mnodeCreateMnode(int32_t dnodeId, char *dnodeEp, bool needConfirm); int32_t mnodeDropMnode(int32_t dnodeId); void mnodeDropMnodeLocal(int32_t dnodeId); diff --git a/src/mnode/inc/mnodeProfile.h b/src/mnode/inc/mnodeProfile.h index e39496ec9cacf431e2fefd737018d54a56e27f88..1e5b1c0f9c7c1c220a88339f00d46538c78cf938 100644 --- a/src/mnode/inc/mnodeProfile.h +++ b/src/mnode/inc/mnodeProfile.h @@ -23,6 +23,8 @@ extern "C" { typedef struct { char user[TSDB_USER_LEN]; + char appName[TSDB_APPNAME_LEN]; // app name that invokes taosc + uint32_t pid; // pid of app that invokes taosc int8_t killed; uint16_t port; uint32_t ip; @@ -40,7 +42,7 @@ typedef struct { int32_t mnodeInitProfile(); void mnodeCleanupProfile(); -SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port); +SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port, int32_t pid, const char* app); SConnObj *mnodeAccquireConn(int32_t connId, char *user, uint32_t ip, uint16_t port); void mnodeReleaseConn(SConnObj *pConn); int32_t mnodeSaveQueryStreamList(SConnObj *pConn, SCMHeartBeatMsg *pHBMsg); diff --git a/src/mnode/src/mnodeCluster.c b/src/mnode/src/mnodeCluster.c index 69614f77d6876f86c44e42fbfa12ce95e93c452a..35b6a67ab24d5ee50a4f4da7bb902ab0d7232b7e 100644 --- a/src/mnode/src/mnodeCluster.c +++ b/src/mnode/src/mnodeCluster.c @@ -225,6 +225,7 @@ static int32_t mnodeRetrieveClusters(SShowObj *pShow, char *data, int32_t rows, numOfRows++; } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; } diff --git a/src/mnode/src/mnodeDb.c b/src/mnode/src/mnodeDb.c index a06152080ef23bbd561ef2e7b02531c6111e85df..8d7c267ab7cb328bb187518a88be3d344b0d53e2 100644 --- a/src/mnode/src/mnodeDb.c +++ b/src/mnode/src/mnodeDb.c @@ -648,8 +648,12 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void while (numOfRows < rows) { pShow->pIter = mnodeGetNextDb(pShow->pIter, &pDb); + if (pDb == NULL) break; - if (pDb->pAcct != pUser->pAcct) continue; + if (pDb->pAcct != pUser->pAcct) { + mnodeDecDbRef(pDb); + continue; + } cols = 0; @@ -760,7 +764,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void } pShow->numOfReads += numOfRows; - mnodeVacuumResult(data, cols, numOfRows, rows, pShow); + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); mnodeDecUserRef(pUser); return numOfRows; diff --git a/src/mnode/src/mnodeDnode.c b/src/mnode/src/mnodeDnode.c index 61c1d4113fea5170dd02e3d46d5f7a579788f326..1cd861e22303d5f6f0dcb75c7ef83cf66696578f 100644 --- a/src/mnode/src/mnodeDnode.c +++ b/src/mnode/src/mnodeDnode.c @@ -147,7 +147,7 @@ static int32_t mnodeDnodeActionRestored() { mnodeCreateDnode(tsLocalEp, NULL); SDnodeObj *pDnode = mnodeGetDnodeByEp(tsLocalEp); if (pDnode != NULL) { - mnodeAddMnode(pDnode->dnodeId); + mnodeCreateMnode(pDnode->dnodeId, pDnode->dnodeEp, false); mnodeDecDnodeRef(pDnode); } } @@ -471,7 +471,8 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) { mnodeGetClusterId()); return TSDB_CODE_MND_INVALID_CLUSTER_ID; } else { - mTrace("dnode:%d, status received, access times %d", pDnode->dnodeId, pDnode->lastAccess); + mTrace("dnode:%d, status received, access times %d openVnodes:%d:%d", pDnode->dnodeId, pDnode->lastAccess, + htons(pStatus->openVnodes), pDnode->openVnodes); } } @@ -790,6 +791,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo mnodeDecDnodeRef(pDnode); } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; } @@ -857,6 +859,7 @@ int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pC char* pWrite; char* moduleName[5] = { "MNODE", "HTTP", "MONITOR", "MQTT", "UNKNOWN" }; + int32_t cols; while (numOfRows < rows) { SDnodeObj *pDnode = NULL; @@ -864,7 +867,7 @@ int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pC if (pDnode == NULL) break; for (int32_t moduleType = 0; moduleType < TSDB_MOD_MAX; ++moduleType) { - int32_t cols = 0; + cols = 0; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; *(int16_t *)pWrite = pDnode->dnodeId; @@ -891,6 +894,7 @@ int32_t mnodeRetrieveModules(SShowObj *pShow, char *data, int32_t rows, void *pC mnodeDecDnodeRef(pDnode); } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; } @@ -990,6 +994,7 @@ static int32_t mnodeRetrieveConfigs(SShowObj *pShow, char *data, int32_t rows, v } } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; } @@ -1082,6 +1087,7 @@ static int32_t mnodeRetrieveVnodes(SShowObj *pShow, char *data, int32_t rows, vo numOfRows = 0; } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; } diff --git a/src/mnode/src/mnodeMain.c b/src/mnode/src/mnodeMain.c index d63a5758686f5db46926e1b3c1bc97becd53d8ae..ea2ac9bf90ed6669c01402c78e11c23bd200dc3d 100644 --- a/src/mnode/src/mnodeMain.c +++ b/src/mnode/src/mnodeMain.c @@ -109,7 +109,7 @@ int32_t mnodeStartSystem() { mInfo("mnode is initialized successfully"); - sdbUpdateSync(); + sdbUpdateSync(NULL); return 0; } diff --git a/src/mnode/src/mnodeMnode.c b/src/mnode/src/mnodeMnode.c index bff84d8041cd1bb4ededbd48704a888763453059..89b2f50b731c90c1261957da93623ba16cebf2ab 100644 --- a/src/mnode/src/mnodeMnode.c +++ b/src/mnode/src/mnodeMnode.c @@ -23,6 +23,8 @@ #include "tutil.h" #include "tsocket.h" #include "tdataformat.h" +#include "dnode.h" +#include "mnode.h" #include "mnodeDef.h" #include "mnodeInt.h" #include "mnodeMnode.h" @@ -30,6 +32,7 @@ #include "mnodeSdb.h" #include "mnodeShow.h" #include "mnodeUser.h" +#include "mnodeVgroup.h" static void * tsMnodeSdb = NULL; static int32_t tsMnodeUpdateSize = 0; @@ -266,25 +269,87 @@ void mnodeGetMnodeInfos(void *mnodeInfos) { mnodeMnodeUnLock(); } -int32_t mnodeAddMnode(int32_t dnodeId) { +static int32_t mnodeSendCreateMnodeMsg(int32_t dnodeId, char *dnodeEp) { + mDebug("dnode:%d, send create mnode msg to dnode %s", dnodeId, dnodeEp); + + SMDCreateMnodeMsg *pCreate = rpcMallocCont(sizeof(SMDCreateMnodeMsg)); + if (pCreate == NULL) { + return TSDB_CODE_MND_OUT_OF_MEMORY; + } else { + pCreate->dnodeId = htonl(dnodeId); + tstrncpy(pCreate->dnodeEp, dnodeEp, sizeof(pCreate->dnodeEp)); + pCreate->mnodes = tsMnodeInfos; + bool found = false; + for (int i = 0; i < pCreate->mnodes.nodeNum; ++i) { + if (pCreate->mnodes.nodeInfos[i].nodeId == htonl(dnodeId)) { + found = true; + } + } + if (!found) { + pCreate->mnodes.nodeInfos[pCreate->mnodes.nodeNum].nodeId = htonl(dnodeId); + tstrncpy(pCreate->mnodes.nodeInfos[pCreate->mnodes.nodeNum].nodeEp, dnodeEp, sizeof(pCreate->dnodeEp)); + pCreate->mnodes.nodeNum++; + } + } + + SRpcMsg rpcMsg = {0}; + rpcMsg.pCont = pCreate; + rpcMsg.contLen = sizeof(SMDCreateMnodeMsg); + rpcMsg.msgType = TSDB_MSG_TYPE_MD_CREATE_MNODE; + + SRpcMsg rpcRsp = {0}; + SRpcEpSet epSet = mnodeGetEpSetFromIp(pCreate->dnodeEp); + dnodeSendMsgToDnodeRecv(&rpcMsg, &rpcRsp, &epSet); + + if (rpcRsp.code != TSDB_CODE_SUCCESS) { + mError("dnode:%d, failed to send create mnode msg, ep:%s reason:%s", dnodeId, dnodeEp, tstrerror(rpcRsp.code)); + } else { + mDebug("dnode:%d, create mnode msg is disposed, mnode is created in dnode", dnodeId); + } + + rpcFreeCont(rpcRsp.pCont); + return rpcRsp.code; +} + +static int32_t mnodeCreateMnodeCb(SMnodeMsg *pMsg, int32_t code) { + if (code != TSDB_CODE_SUCCESS) { + mError("failed to create mnode, reason:%s", tstrerror(code)); + } else { + mDebug("mnode is created successfully"); + mnodeUpdateMnodeEpSet(); + sdbUpdateAsync(); + } + + return code; +} + +void mnodeCreateMnode(int32_t dnodeId, char *dnodeEp, bool needConfirm) { SMnodeObj *pMnode = calloc(1, sizeof(SMnodeObj)); pMnode->mnodeId = dnodeId; pMnode->createdTime = taosGetTimestampMs(); SSdbOper oper = { - .type = SDB_OPER_GLOBAL, + .type = SDB_OPER_GLOBAL, .table = tsMnodeSdb, - .pObj = pMnode, + .pObj = pMnode, + .writeCb = mnodeCreateMnodeCb }; - int32_t code = sdbInsertRow(&oper); - if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { - taosTFree(pMnode); + int32_t code = TSDB_CODE_SUCCESS; + if (needConfirm) { + code = mnodeSendCreateMnodeMsg(dnodeId, dnodeEp); } - mnodeUpdateMnodeEpSet(); + if (code != TSDB_CODE_SUCCESS) { + taosTFree(pMnode); + return; + } - return code; + code = sdbInsertRow(&oper); + if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) { + mError("dnode:%d, failed to create mnode, ep:%s reason:%s", dnodeId, dnodeEp, tstrerror(code)); + taosTFree(pMnode); + } } void mnodeDropMnodeLocal(int32_t dnodeId) { @@ -296,6 +361,7 @@ void mnodeDropMnodeLocal(int32_t dnodeId) { } mnodeUpdateMnodeEpSet(); + sdbUpdateAsync(); } int32_t mnodeDropMnode(int32_t dnodeId) { @@ -315,6 +381,7 @@ int32_t mnodeDropMnode(int32_t dnodeId) { sdbDecRef(tsMnodeSdb, pMnode); mnodeUpdateMnodeEpSet(); + sdbUpdateAsync(); return code; } @@ -414,6 +481,7 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo mnodeDecMnodeRef(pMnode); } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; diff --git a/src/mnode/src/mnodePeer.c b/src/mnode/src/mnodePeer.c index 8b368a33f4c7336178fcd949b729ca81fa660b4a..2a04f541c51483ccba93369a65061507f83ead23 100644 --- a/src/mnode/src/mnodePeer.c +++ b/src/mnode/src/mnodePeer.c @@ -58,10 +58,15 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) { rpcRsp->rsp = epSet; rpcRsp->len = sizeof(SRpcEpSet); - mDebug("%p, msg:%s in mpeer queue, will be redireced, numOfEps:%d inUse:%d", pMsg->rpcMsg.ahandle, + mDebug("%p, msg:%s in mpeer queue will be redirected, numOfEps:%d inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], epSet->numOfEps, epSet->inUse); for (int32_t i = 0; i < epSet->numOfEps; ++i) { - mDebug("mnode index:%d ep:%s:%d", i, epSet->fqdn[i], htons(epSet->port[i])); + if (strcmp(epSet->fqdn[i], tsLocalFqdn) == 0 && htons(epSet->port[i]) == tsServerPort + TSDB_PORT_DNODEDNODE) { + epSet->inUse = (i + 1) % epSet->numOfEps; + mDebug("mnode index:%d ep:%s:%u, set inUse to %d", i, epSet->fqdn[i], htons(epSet->port[i]), epSet->inUse); + } else { + mDebug("mnode index:%d ep:%s:%u", i, epSet->fqdn[i], htons(epSet->port[i])); + } } return TSDB_CODE_RPC_REDIRECT; diff --git a/src/mnode/src/mnodeProfile.c b/src/mnode/src/mnodeProfile.c index 26f38dde034788fb440a785ce6c90e8aedf8ddca..f8f99e22c6f437b1eece0d704c8c4551bc434110 100644 --- a/src/mnode/src/mnodeProfile.c +++ b/src/mnode/src/mnodeProfile.c @@ -24,15 +24,9 @@ #include "mnode.h" #include "mnodeDef.h" #include "mnodeInt.h" -#include "mnodeAcct.h" -#include "mnodeDnode.h" -#include "mnodeDb.h" -#include "mnodeMnode.h" #include "mnodeProfile.h" #include "mnodeShow.h" -#include "mnodeTable.h" #include "mnodeUser.h" -#include "mnodeVgroup.h" #include "mnodeWrite.h" #define CONN_KEEP_TIME (tsShellActivityTimer * 3) @@ -78,7 +72,7 @@ void mnodeCleanupProfile() { } } -SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port) { +SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port, int32_t pid, const char* app) { #if 0 int32_t connSize = taosHashGetSize(tsMnodeConnCache->pHashTable); if (connSize > tsMaxShellConns) { @@ -96,10 +90,13 @@ SConnObj *mnodeCreateConn(char *user, uint32_t ip, uint16_t port) { .ip = ip, .port = port, .connId = connId, - .stime = taosGetTimestampMs() + .stime = taosGetTimestampMs(), + .pid = pid, }; - tstrncpy(connObj.user, user, sizeof(connObj.user)); + tstrncpy(connObj.user, user, tListLen(connObj.user)); + tstrncpy(connObj.appName, app, tListLen(connObj.appName)); + connObj.lastAccess = connObj.stime; SConnObj *pConn = taosCachePut(tsMnodeConnCache, &connId, sizeof(int32_t), &connObj, sizeof(connObj), CONN_KEEP_TIME * 1000); @@ -114,7 +111,6 @@ void mnodeReleaseConn(SConnObj *pConn) { } SConnObj *mnodeAccquireConn(int32_t connId, char *user, uint32_t ip, uint16_t port) { - uint64_t expireTime = CONN_KEEP_TIME * 1000 + (uint64_t)taosGetTimestampMs(); SConnObj *pConn = taosCacheAcquireByKey(tsMnodeConnCache, &connId, sizeof(int32_t)); if (pConn == NULL) { mDebug("connId:%d, is already destroyed, user:%s ip:%s:%u", connId, user, taosIpStr(ip), port); @@ -129,7 +125,7 @@ SConnObj *mnodeAccquireConn(int32_t connId, char *user, uint32_t ip, uint16_t po } // mDebug("connId:%d, is incoming, user:%s ip:%s:%u", connId, pConn->user, taosIpStr(pConn->ip), pConn->port); - pConn->lastAccess = expireTime; + pConn->lastAccess = CONN_KEEP_TIME * 1000 + (uint64_t)taosGetTimestampMs(); return pConn; } @@ -183,6 +179,20 @@ static int32_t mnodeGetConnsMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; + // app name + pShow->bytes[cols] = TSDB_APPNAME_LEN + VARSTR_HEADER_SIZE; + pSchema[cols].type = TSDB_DATA_TYPE_BINARY; + strcpy(pSchema[cols].name, "app_name"); + pSchema[cols].bytes = htons(pShow->bytes[cols]); + cols++; + + // app pid + pShow->bytes[cols] = 4; + pSchema[cols].type = TSDB_DATA_TYPE_INT; + strcpy(pSchema[cols].name, "pid"); + pSchema[cols].bytes = htons(pShow->bytes[cols]); + cols++; + pShow->bytes[cols] = TSDB_IPv4ADDR_LEN + 6 + VARSTR_HEADER_SIZE; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; strcpy(pSchema[cols].name, "ip:port"); @@ -191,13 +201,13 @@ static int32_t mnodeGetConnsMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pShow->bytes[cols] = 8; pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP; - strcpy(pSchema[cols].name, "login time"); + strcpy(pSchema[cols].name, "login_time"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; pShow->bytes[cols] = 8; pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP; - strcpy(pSchema[cols].name, "last access"); + strcpy(pSchema[cols].name, "last_access"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; @@ -236,6 +246,16 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->user, pShow->bytes[cols]); cols++; + // app name + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pConnObj->appName, pShow->bytes[cols]); + cols++; + + // app pid + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + *(int32_t*)pWrite = pConnObj->pid; + cols++; + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); @@ -254,8 +274,7 @@ static int32_t mnodeRetrieveConns(SShowObj *pShow, char *data, int32_t rows, voi } pShow->numOfReads += numOfRows; - const int32_t NUM_OF_COLUMNS = 5; - mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow); + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); return numOfRows; } @@ -299,7 +318,7 @@ static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pShow->bytes[cols] = QUERY_ID_SIZE + VARSTR_HEADER_SIZE; pSchema[cols].type = TSDB_DATA_TYPE_BINARY; - strcpy(pSchema[cols].name, "queryId"); + strcpy(pSchema[cols].name, "query_id"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; @@ -315,9 +334,15 @@ static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; + pShow->bytes[cols] = 24; + pSchema[cols].type = TSDB_DATA_TYPE_BINARY; + strcpy(pSchema[cols].name, "qhandle"); + pSchema[cols].bytes = htons(pShow->bytes[cols]); + cols++; + pShow->bytes[cols] = 8; pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP; - strcpy(pSchema[cols].name, "created time"); + strcpy(pSchema[cols].name, "created_time"); pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; @@ -352,7 +377,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v SConnObj *pConnObj = NULL; int32_t cols = 0; char * pWrite; - char ipStr[TSDB_IPv4ADDR_LEN + 6]; + char str[TSDB_IPv4ADDR_LEN + 6] = {0}; while (numOfRows < rows) { pShow->pIter = mnodeGetNextConn(pShow->pIter, &pConnObj); @@ -362,9 +387,9 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v SQueryDesc *pDesc = pConnObj->pQueries + i; cols = 0; - snprintf(ipStr, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->queryId)); + snprintf(str, QUERY_ID_SIZE + 1, "%u:%u", pConnObj->connId, htonl(pDesc->queryId)); pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -372,8 +397,15 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - snprintf(ipStr, sizeof(ipStr), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); - STR_WITH_MAXSIZE_TO_VARSTR(pWrite, ipStr, pShow->bytes[cols]); + snprintf(str, tListLen(str), "%s:%u", taosIpStr(pConnObj->ip), pConnObj->port); + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->bytes[cols]); + cols++; + + char handleBuf[24] = {0}; + snprintf(handleBuf, tListLen(handleBuf), "%p", (void*)htobe64(pDesc->qHandle)); + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + + STR_WITH_MAXSIZE_TO_VARSTR(pWrite, handleBuf, pShow->bytes[cols]); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; @@ -393,8 +425,7 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v } pShow->numOfReads += numOfRows; - const int32_t NUM_OF_COLUMNS = 6; - mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow); + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); return numOfRows; } @@ -522,8 +553,7 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v } pShow->numOfReads += numOfRows; - const int32_t NUM_OF_COLUMNS = 8; - mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow); + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); return numOfRows; } @@ -595,7 +625,7 @@ static int32_t mnodeProcessKillConnectionMsg(SMnodeMsg *pMsg) { SCMKillConnMsg *pKill = pMsg->rpcMsg.pCont; int32_t connId = atoi(pKill->queryId); - SConnObj * pConn = taosCacheAcquireByKey(tsMnodeConnCache, &connId, sizeof(int32_t)); + SConnObj *pConn = taosCacheAcquireByKey(tsMnodeConnCache, &connId, sizeof(int32_t)); if (pConn == NULL) { mError("connId:%s, failed to kill, conn not exist", pKill->queryId); return TSDB_CODE_MND_INVALID_CONN_ID; diff --git a/src/mnode/src/mnodeRead.c b/src/mnode/src/mnodeRead.c index af2fed3408ab726b5a819f6717fab497fcba1136..93b944febb42d3c7e7bac113b5447ddd1488369c 100644 --- a/src/mnode/src/mnodeRead.c +++ b/src/mnode/src/mnodeRead.c @@ -51,14 +51,21 @@ int32_t mnodeProcessRead(SMnodeMsg *pMsg) { SMnodeRsp *rpcRsp = &pMsg->rpcRsp; SRpcEpSet *epSet = rpcMallocCont(sizeof(SRpcEpSet)); mnodeGetMnodeEpSetForShell(epSet); - rpcRsp->rsp = epSet; - rpcRsp->len = sizeof(SRpcEpSet); - mDebug("%p, msg:%s in mread queue, will be redireced, inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], epSet->inUse); + mDebug("%p, msg:%s in mread queue will be redirected, numOfEps:%d inUse:%d", pMsg->rpcMsg.ahandle, + taosMsg[pMsg->rpcMsg.msgType], epSet->numOfEps, epSet->inUse); for (int32_t i = 0; i < epSet->numOfEps; ++i) { - mDebug("mnode index:%d ep:%s:%d", i, epSet->fqdn[i], htons(epSet->port[i])); + if (strcmp(epSet->fqdn[i], tsLocalFqdn) == 0 && htons(epSet->port[i]) == tsServerPort) { + epSet->inUse = (i + 1) % epSet->numOfEps; + mDebug("mnode index:%d ep:%s:%u, set inUse to %d", i, epSet->fqdn[i], htons(epSet->port[i]), epSet->inUse); + } else { + mDebug("mnode index:%d ep:%s:%u", i, epSet->fqdn[i], htons(epSet->port[i])); + } } + rpcRsp->rsp = epSet; + rpcRsp->len = sizeof(SRpcEpSet); + return TSDB_CODE_RPC_REDIRECT; } diff --git a/src/mnode/src/mnodeSdb.c b/src/mnode/src/mnodeSdb.c index 7654536122873ce3fbc37a300a87f767bd33d415..14558485aa743a42bee016226dfc2e16a4f81d0c 100644 --- a/src/mnode/src/mnodeSdb.c +++ b/src/mnode/src/mnodeSdb.c @@ -91,6 +91,7 @@ typedef struct { } SSdbWriteWorkerPool; extern void * tsMnodeTmr; +static void * tsUpdateSyncTmr; static SSdbObject tsSdbObj = {0}; static taos_qset tsSdbWriteQset; static taos_qall tsSdbWriteQall; @@ -297,27 +298,25 @@ static void sdbConfirmForward(void *ahandle, void *param, int32_t code) { taosFreeQitem(pOper); } -void sdbUpdateSync() { +static void sdbUpdateSyncTmrFp(void *param, void *tmrId) { sdbUpdateSync(NULL); } + +void sdbUpdateAsync() { + taosTmrReset(sdbUpdateSyncTmrFp, 200, NULL, tsMnodeTmr, &tsUpdateSyncTmr); +} + +void sdbUpdateSync(void *pMnodes) { + SDMMnodeInfos *mnodes = pMnodes; if (!mnodeIsRunning()) { - mDebug("mnode not start yet, update sync info later"); + mDebug("mnode not start yet, update sync config later"); return; } - mDebug("update sync info in sdb"); + mDebug("update sync config in sync module, mnodes:%p", pMnodes); SSyncCfg syncCfg = {0}; int32_t index = 0; - SDMMnodeInfos *mnodes = dnodeGetMnodeInfos(); - for (int32_t i = 0; i < mnodes->nodeNum; ++i) { - SDMMnodeInfo *node = &mnodes->nodeInfos[i]; - syncCfg.nodeInfo[i].nodeId = node->nodeId; - taosGetFqdnPortFromEp(node->nodeEp, syncCfg.nodeInfo[i].nodeFqdn, &syncCfg.nodeInfo[i].nodePort); - syncCfg.nodeInfo[i].nodePort += TSDB_PORT_SYNC; - index++; - } - - if (index == 0) { + if (mnodes == NULL) { void *pIter = NULL; while (1) { SMnodeObj *pMnode = NULL; @@ -337,9 +336,19 @@ void sdbUpdateSync() { mnodeDecMnodeRef(pMnode); } sdbFreeIter(pIter); + syncCfg.replica = index; + mDebug("mnodes info not input, use infos in sdb, numOfMnodes:%d", syncCfg.replica); + } else { + for (index = 0; index < mnodes->nodeNum; ++index) { + SDMMnodeInfo *node = &mnodes->nodeInfos[index]; + syncCfg.nodeInfo[index].nodeId = node->nodeId; + taosGetFqdnPortFromEp(node->nodeEp, syncCfg.nodeInfo[index].nodeFqdn, &syncCfg.nodeInfo[index].nodePort); + syncCfg.nodeInfo[index].nodePort += TSDB_PORT_SYNC; + } + syncCfg.replica = index; + mDebug("mnodes info input, numOfMnodes:%d", syncCfg.replica); } - syncCfg.replica = index; syncCfg.quorum = (syncCfg.replica == 1) ? 1 : 2; bool hasThisDnode = false; @@ -350,8 +359,15 @@ void sdbUpdateSync() { } } - if (!hasThisDnode) return; - if (memcmp(&syncCfg, &tsSdbObj.cfg, sizeof(SSyncCfg)) == 0) return; + if (!hasThisDnode) { + sdbDebug("update sync config, this dnode not exist"); + return; + } + + if (memcmp(&syncCfg, &tsSdbObj.cfg, sizeof(SSyncCfg)) == 0) { + sdbDebug("update sync config, info not changed"); + return; + } sdbInfo("work as mnode, replica:%d", syncCfg.replica); for (int32_t i = 0; i < syncCfg.replica; ++i) { @@ -578,7 +594,7 @@ static int sdbWrite(void *param, void *data, int type) { pthread_mutex_unlock(&tsSdbObj.mutex); sdbError("table:%s, failed to restore %s record:%s from source(%d), ver:%" PRId64 " too large, sdb ver:%" PRId64, pTable->tableName, sdbGetActionStr(action), sdbGetKeyStr(pTable, pHead->cont), type, pHead->version, tsSdbObj.version); - return TSDB_CODE_MND_APP_ERROR; + return TSDB_CODE_SYN_INVALID_VERSION; } else { tsSdbObj.version = pHead->version; } @@ -1038,7 +1054,7 @@ static void *sdbWorkerFp(void *param) { while (1) { numOfMsgs = taosReadAllQitemsFromQset(tsSdbWriteQset, tsSdbWriteQall, &unUsed); if (numOfMsgs == 0) { - sdbDebug("sdbWorkerFp: got no message from qset, exiting..."); + sdbDebug("qset:%p, sdb got no message from qset, exiting", tsSdbWriteQset); break; } diff --git a/src/mnode/src/mnodeShow.c b/src/mnode/src/mnodeShow.c index e587758e465d7a138275862ad411af884c0b78ec..80909e99aec6d752d35042ca2d761a6e8b923441 100644 --- a/src/mnode/src/mnodeShow.c +++ b/src/mnode/src/mnodeShow.c @@ -186,7 +186,7 @@ static int32_t mnodeProcessRetrieveMsg(SMnodeMsg *pMsg) { rowsToRead = pShow->numOfRows - pShow->numOfReads; } - /* return no more than 100 meters in one round trip */ + /* return no more than 100 tables in one round trip */ if (rowsToRead > 100) rowsToRead = 100; /* @@ -244,7 +244,8 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) { int32_t connId = htonl(pHBMsg->connId); SConnObj *pConn = mnodeAccquireConn(connId, connInfo.user, connInfo.clientIp, connInfo.clientPort); if (pConn == NULL) { - pConn = mnodeCreateConn(connInfo.user, connInfo.clientIp, connInfo.clientPort); + pHBMsg->pid = htonl(pHBMsg->pid); + pConn = mnodeCreateConn(connInfo.user, connInfo.clientIp, connInfo.clientPort, pHBMsg->pid, pHBMsg->appName); } if (pConn == NULL) { @@ -325,7 +326,8 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) { goto connect_over; } - SConnObj *pConn = mnodeCreateConn(connInfo.user, connInfo.clientIp, connInfo.clientPort); + pConnectMsg->pid = htonl(pConnectMsg->pid); + SConnObj *pConn = mnodeCreateConn(connInfo.user, connInfo.clientIp, connInfo.clientPort, pConnectMsg->pid, pConnectMsg->appName); if (pConn == NULL) { code = terrno; } else { diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index 1bc328800e1924879d5af18ab4f6c876238e0ae0..82a062169a591d26d665437273183a4c5e1f27b4 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -63,27 +63,27 @@ static int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t static int32_t mnodeGetStreamTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t rows, void *pConn); -static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *mnodeMsg); +static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg); static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg); static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg); static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg); -static int32_t mnodeProcessDropTableMsg(SMnodeMsg *mnodeMsg); +static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg); static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg); static void mnodeProcessDropSuperTableRsp(SRpcMsg *rpcMsg); static int32_t mnodeProcessDropChildTableMsg(SMnodeMsg *pMsg); static void mnodeProcessDropChildTableRsp(SRpcMsg *rpcMsg); -static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *mnodeMsg); -static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *mnodeMsg); -static int32_t mnodeProcessTableCfgMsg(SMnodeMsg *mnodeMsg); +static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg); +static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg); +static int32_t mnodeProcessTableCfgMsg(SMnodeMsg *pMsg); -static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *mnodeMsg); +static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg); static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg); static int32_t mnodeGetChildTableMeta(SMnodeMsg *pMsg); static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg); -static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *mnodeMsg); +static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg); static void mnodeProcessAlterTableRsp(SRpcMsg *rpcMsg); static int32_t mnodeFindSuperTableColumnIndex(SSuperTableObj *pStable, char *colName); @@ -131,6 +131,8 @@ static int32_t mnodeChildTableActionInsert(SSdbOper *pOper) { mnodeAddTableIntoStable(pTable->superTable, pTable); grantAdd(TSDB_GRANT_TIMESERIES, pTable->superTable->numOfColumns - 1); if (pAcct) pAcct->acctInfo.numOfTimeSeries += (pTable->superTable->numOfColumns - 1); + } else { + mError("table:%s:%p, correspond stable not found suid:%" PRIu64, pTable->info.tableId, pTable, pTable->suid); } } else { grantAdd(TSDB_GRANT_TIMESERIES, pTable->numOfColumns - 1); @@ -301,7 +303,7 @@ static int32_t mnodeChildTableActionRestored() { SVgObj *pVgroup = mnodeGetVgroup(pTable->vgId); if (pVgroup == NULL) { - mError("ctable:%s, failed to get vgId:%d sid:%d, discard it", pTable->info.tableId, pTable->vgId, pTable->sid); + mError("ctable:%s, failed to get vgId:%d tid:%d, discard it", pTable->info.tableId, pTable->vgId, pTable->tid); pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); @@ -312,7 +314,7 @@ static int32_t mnodeChildTableActionRestored() { if (strcmp(pVgroup->dbName, pDb->name) != 0) { mError("ctable:%s, db:%s not match with vgId:%d db:%s sid:%d, discard it", - pTable->info.tableId, pDb->name, pTable->vgId, pVgroup->dbName, pTable->sid); + pTable->info.tableId, pDb->name, pTable->vgId, pVgroup->dbName, pTable->tid); pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); @@ -460,12 +462,14 @@ static int32_t mnodeSuperTableActionUpdate(SSdbOper *pOper) { void *oldSchema = pTable->schema; void *oldVgHash = pTable->vgHash; int32_t oldRefCount = pTable->refCount; + int32_t oldNumOfTables = pTable->numOfTables; memcpy(pTable, pNew, sizeof(SSuperTableObj)); pTable->vgHash = oldVgHash; pTable->refCount = oldRefCount; pTable->schema = pNew->schema; + pTable->numOfTables = oldNumOfTables; free(pNew); free(oldTableId); free(oldSchema); @@ -767,8 +771,8 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) { return mnodeProcessDropSuperTableMsg(pMsg); } else { SChildTableObj *pCTable = (SChildTableObj *)pMsg->pTable; - mInfo("app:%p:%p, table:%s, start to drop ctable, vgId:%d sid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pDrop->tableId, pCTable->vgId, pCTable->sid, pCTable->uid); + mInfo("app:%p:%p, table:%s, start to drop ctable, vgId:%d tid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, + pDrop->tableId, pCTable->vgId, pCTable->tid, pCTable->uid); return mnodeProcessDropChildTableMsg(pMsg); } } @@ -837,10 +841,11 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { return TSDB_CODE_MND_OUT_OF_MEMORY; } + int64_t us = taosGetTimestampUs(); pStable->info.tableId = strdup(pCreate->tableId); pStable->info.type = TSDB_SUPER_TABLE; pStable->createdTime = taosGetTimestampMs(); - pStable->uid = (((uint64_t) pStable->createdTime) << 16) + (sdbGetVersion() & ((1ul << 16) - 1ul)); + pStable->uid = (us << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); pStable->sversion = 0; pStable->tversion = 0; pStable->numOfColumns = htons(pCreate->numOfColumns); @@ -1384,9 +1389,8 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, } pShow->numOfReads += numOfRows; - const int32_t NUM_OF_COLUMNS = 5; - mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow); + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); mnodeDecDbRef(pDb); return numOfRows; @@ -1395,16 +1399,20 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, void mnodeDropAllSuperTables(SDbObj *pDropDb) { void * pIter= NULL; int32_t numOfTables = 0; - int32_t dbNameLen = strlen(pDropDb->name); SSuperTableObj *pTable = NULL; + char prefix[64] = {0}; + tstrncpy(prefix, pDropDb->name, 64); + strcat(prefix, TS_PATH_DELIMITER); + int32_t prefixLen = strlen(prefix); + mInfo("db:%s, all super tables will be dropped from sdb", pDropDb->name); while (1) { pIter = mnodeGetNextSuperTable(pIter, &pTable); if (pTable == NULL) break; - if (strncmp(pDropDb->name, pTable->info.tableId, dbNameLen) == 0) { + if (strncmp(prefix, pTable->info.tableId, prefixLen) == 0) { SSdbOper oper = { .type = SDB_OPER_LOCAL, .table = tsSuperTableSdb, @@ -1468,13 +1476,14 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) { int32_t numOfTable = htonl(pInfo->numOfTables); // reserve space - int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + 32 * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo); + int32_t contLen = sizeof(SCMSTableVgroupRspMsg) + 32 * sizeof(SCMVgroupMsg) + sizeof(SVgroupsMsg); for (int32_t i = 0; i < numOfTable; ++i) { char *stableName = (char*)pInfo + sizeof(SCMSTableVgroupMsg) + (TSDB_TABLE_FNAME_LEN) * i; SSuperTableObj *pTable = mnodeGetSuperTable(stableName); if (pTable != NULL && pTable->vgHash != NULL) { - contLen += (taosHashGetSize(pTable->vgHash) * sizeof(SCMVgroupInfo) + sizeof(SVgroupsInfo)); + contLen += (taosHashGetSize(pTable->vgHash) * sizeof(SCMVgroupMsg) + sizeof(SVgroupsMsg)); } + mnodeDecTableRef(pTable); } @@ -1495,19 +1504,19 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) { continue; } if (pTable->vgHash == NULL) { - mError("app:%p:%p, stable:%s, no vgroup exist while get stable vgroup info", pMsg->rpcMsg.ahandle, pMsg, + mDebug("app:%p:%p, stable:%s, no vgroup exist while get stable vgroup info", pMsg->rpcMsg.ahandle, pMsg, stableName); mnodeDecTableRef(pTable); // even this super table has no corresponding table, still return pRsp->numOfTables++; - SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg; - pVgroupInfo->numOfVgroups = 0; + SVgroupsMsg *pVgroupMsg = (SVgroupsMsg *)msg; + pVgroupMsg->numOfVgroups = 0; - msg += sizeof(SVgroupsInfo); + msg += sizeof(SVgroupsMsg); } else { - SVgroupsInfo *pVgroupInfo = (SVgroupsInfo *)msg; + SVgroupsMsg *pVgroupMsg = (SVgroupsMsg *)msg; SHashMutableIterator *pIter = taosHashCreateIter(pTable->vgHash); int32_t vgSize = 0; @@ -1516,15 +1525,17 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) { SVgObj * pVgroup = mnodeGetVgroup(*pVgId); if (pVgroup == NULL) continue; - pVgroupInfo->vgroups[vgSize].vgId = htonl(pVgroup->vgId); + pVgroupMsg->vgroups[vgSize].vgId = htonl(pVgroup->vgId); + pVgroupMsg->vgroups[vgSize].numOfEps = 0; + for (int32_t vn = 0; vn < pVgroup->numOfVnodes; ++vn) { SDnodeObj *pDnode = pVgroup->vnodeGid[vn].pDnode; if (pDnode == NULL) break; - tstrncpy(pVgroupInfo->vgroups[vgSize].epAddr[vn].fqdn, pDnode->dnodeFqdn, TSDB_FQDN_LEN); - pVgroupInfo->vgroups[vgSize].epAddr[vn].port = htons(pDnode->dnodePort); + tstrncpy(pVgroupMsg->vgroups[vgSize].epAddr[vn].fqdn, pDnode->dnodeFqdn, TSDB_FQDN_LEN); + pVgroupMsg->vgroups[vgSize].epAddr[vn].port = htons(pDnode->dnodePort); - pVgroupInfo->vgroups[vgSize].numOfEps++; + pVgroupMsg->vgroups[vgSize].numOfEps++; } vgSize++; @@ -1534,10 +1545,10 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) { taosHashDestroyIter(pIter); mnodeDecTableRef(pTable); - pVgroupInfo->numOfVgroups = htonl(vgSize); + pVgroupMsg->numOfVgroups = htonl(vgSize); // one table is done, try the next table - msg += sizeof(SVgroupsInfo) + vgSize * sizeof(SCMVgroupInfo); + msg += sizeof(SVgroupsMsg) + vgSize * sizeof(SCMVgroupMsg); pRsp->numOfTables++; } } @@ -1587,7 +1598,7 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableO pCreate->vgId = htonl(pTable->vgId); pCreate->tableType = pTable->info.type; pCreate->createdTime = htobe64(pTable->createdTime); - pCreate->sid = htonl(pTable->sid); + pCreate->tid = htonl(pTable->tid); pCreate->sqlDataLen = htonl(pTable->sqlLen); pCreate->uid = htobe64(pTable->uid); @@ -1636,7 +1647,7 @@ static int32_t mnodeDoCreateChildTableFp(SMnodeMsg *pMsg) { assert(pTable); mDebug("app:%p:%p, table:%s, created in mnode, vgId:%d sid:%d, uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid); + pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid); SCMCreateTableMsg *pCreate = pMsg->rpcMsg.pCont; SMDCreateTableMsg *pMDCreate = mnodeBuildCreateChildTableMsg(pCreate, pTable); @@ -1678,7 +1689,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) { return TSDB_CODE_MND_ACTION_IN_PROGRESS; } else { mError("app:%p:%p, table:%s, failed to create table sid:%d, uid:%" PRIu64 ", reason:%s", pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pTable->sid, pTable->uid, tstrerror(code)); + pTable->info.tableId, pTable->tid, pTable->uid, tstrerror(code)); SSdbOper desc = {.type = SDB_OPER_GLOBAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); return code; @@ -1702,11 +1713,11 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { pTable->info.tableId = strdup(pCreate->tableId); pTable->createdTime = taosGetTimestampMs(); - pTable->sid = tid; + pTable->tid = tid; pTable->vgId = pVgroup->vgId; - + if (pTable->info.type == TSDB_CHILD_TABLE) { - STagData *pTagData = (STagData *) pCreate->schema; // it is a tag key + STagData *pTagData = (STagData *)pCreate->schema; // it is a tag key if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(pTagData->name); if (pMsg->pSTable == NULL) { mError("app:%p:%p, table:%s, corresponding super table:%s does not exist", pMsg->rpcMsg.ahandle, pMsg, @@ -1716,7 +1727,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { } pTable->suid = pMsg->pSTable->uid; - pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->sid) & ((1ul << 24) - 1ul)) << 24) + + pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->tid) & ((1ul << 24) - 1ul)) << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); pTable->superTable = pMsg->pSTable; } else { @@ -1724,7 +1735,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { int64_t us = taosGetTimestampUs(); pTable->uid = (us << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); } else { - pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->sid) & ((1ul << 24) - 1ul)) << 24) + + pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->tid) & ((1ul << 24) - 1ul)) << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); } @@ -1781,7 +1792,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { tstrerror(code)); } else { mDebug("app:%p:%p, table:%s, allocated in vgroup, vgId:%d sid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pVgroup->vgId, pTable->sid, pTable->uid); + pTable->info.tableId, pVgroup->vgId, pTable->tid, pTable->uid); } return code; @@ -1799,8 +1810,8 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { if (pMsg->retry == 0) { if (pMsg->pTable == NULL) { SVgObj *pVgroup = NULL; - int32_t sid = 0; - code = mnodeGetAvailableVgroup(pMsg, &pVgroup, &sid); + int32_t tid = 0; + code = mnodeGetAvailableVgroup(pMsg, &pVgroup, &tid); if (code != TSDB_CODE_SUCCESS) { mDebug("app:%p:%p, table:%s, failed to get available vgroup, reason:%s", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId, tstrerror(code)); @@ -1814,7 +1825,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { pMsg->pVgroup = pVgroup; mnodeIncVgroupRef(pVgroup); - return mnodeDoCreateChildTable(pMsg, sid); + return mnodeDoCreateChildTable(pMsg, tid); } } else { if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableId); @@ -1844,13 +1855,13 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) { tstrncpy(pDrop->tableId, pTable->info.tableId, TSDB_TABLE_FNAME_LEN); pDrop->vgId = htonl(pTable->vgId); pDrop->contLen = htonl(sizeof(SMDDropTableMsg)); - pDrop->sid = htonl(pTable->sid); + pDrop->tid = htonl(pTable->tid); pDrop->uid = htobe64(pTable->uid); SRpcEpSet epSet = mnodeGetEpSetFromVgroup(pMsg->pVgroup); mInfo("app:%p:%p, ctable:%s, send drop ctable msg, vgId:%d sid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pDrop->tableId, pTable->vgId, pTable->sid, pTable->uid); + pDrop->tableId, pTable->vgId, pTable->tid, pTable->uid); SRpcMsg rpcMsg = { .ahandle = pMsg, @@ -2089,7 +2100,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) { SChildTableObj *pTable = (SChildTableObj *)pMsg->pTable; pMeta->uid = htobe64(pTable->uid); - pMeta->sid = htonl(pTable->sid); + pMeta->tid = htonl(pTable->tid); pMeta->precision = pDb->cfg.precision; pMeta->tableType = pTable->info.type; tstrncpy(pMeta->tableId, pTable->info.tableId, TSDB_TABLE_FNAME_LEN); @@ -2129,7 +2140,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) { pMeta->vgroup.vgId = htonl(pMsg->pVgroup->vgId); mDebug("app:%p:%p, table:%s, uid:%" PRIu64 " table meta is retrieved, vgId:%d sid:%d", pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pTable->uid, pTable->vgId, pTable->sid); + pTable->info.tableId, pTable->uid, pTable->vgId, pTable->tid); return TSDB_CODE_SUCCESS; } @@ -2220,16 +2231,20 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) { void mnodeDropAllChildTables(SDbObj *pDropDb) { void * pIter = NULL; int32_t numOfTables = 0; - int32_t dbNameLen = strlen(pDropDb->name); SChildTableObj *pTable = NULL; + char prefix[64] = {0}; + tstrncpy(prefix, pDropDb->name, 64); + strcat(prefix, TS_PATH_DELIMITER); + int32_t prefixLen = strlen(prefix); + mInfo("db:%s, all child tables will be dropped from sdb", pDropDb->name); while (1) { pIter = mnodeGetNextChildTable(pIter, &pTable); if (pTable == NULL) break; - if (strncmp(pDropDb->name, pTable->info.tableId, dbNameLen) == 0) { + if (strncmp(prefix, pTable->info.tableId, prefixLen) == 0) { SSdbOper oper = { .type = SDB_OPER_LOCAL, .table = tsChildTableSdb, @@ -2251,7 +2266,8 @@ static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) { int32_t numOfTables = 0; SChildTableObj *pTable = NULL; - mInfo("stable:%s, all child tables:%d will dropped from sdb", pStable->info.tableId, pStable->numOfTables); + mInfo("stable:%s uid:%" PRIu64 ", all child tables:%d will be dropped from sdb", pStable->info.tableId, pStable->uid, + pStable->numOfTables); while (1) { pIter = mnodeGetNextChildTable(pIter, &pTable); @@ -2276,11 +2292,11 @@ static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) { } #if 0 -static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t sid) { +static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t tid) { SVgObj *pVgroup = mnodeGetVgroup(vnode); if (pVgroup == NULL) return NULL; - SChildTableObj *pTable = pVgroup->tableList[sid - 1]; + SChildTableObj *pTable = pVgroup->tableList[tid - 1]; mnodeIncTableRef((STableObj *)pTable); mnodeDecVgroupRef(pVgroup); @@ -2328,12 +2344,12 @@ static void mnodeProcessDropChildTableRsp(SRpcMsg *rpcMsg) { assert(pTable); mInfo("app:%p:%p, table:%s, drop table rsp received, vgId:%d sid:%d uid:%" PRIu64 ", thandle:%p result:%s", - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid, + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, mnodeMsg->rpcMsg.handle, tstrerror(rpcMsg->code)); if (rpcMsg->code != TSDB_CODE_SUCCESS) { mError("app:%p:%p, table:%s, failed to drop in dnode, vgId:%d sid:%d uid:%" PRIu64 ", reason:%s", - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid, + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, tstrerror(rpcMsg->code)); dnodeSendRpcMnodeWriteRsp(mnodeMsg, rpcMsg->code); return; @@ -2371,7 +2387,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) { // If the table is deleted by another thread during creation, stop creating and send drop msg to vnode if (sdbCheckRowDeleted(tsChildTableSdb, pTable)) { mDebug("app:%p:%p, table:%s, create table rsp received, but a deleting opertion incoming, vgId:%d sid:%d uid:%" PRIu64, - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid); + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid); // if the vgroup is already dropped from hash, it can't be accquired by pTable->vgId // so the refCount of vgroup can not be decreased @@ -2404,14 +2420,16 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) { } } else { if (mnodeMsg->retry++ < 10) { - mDebug("app:%p:%p, table:%s, create table rsp received, need retry, times:%d result:%s thandle:%p", - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, mnodeMsg->retry, tstrerror(rpcMsg->code), - mnodeMsg->rpcMsg.handle); + mDebug("app:%p:%p, table:%s, create table rsp received, need retry, times:%d vgId:%d sid:%d uid:%" PRIu64 + " result:%s thandle:%p", + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, mnodeMsg->retry, pTable->vgId, pTable->tid, + pTable->uid, tstrerror(rpcMsg->code), mnodeMsg->rpcMsg.handle); dnodeDelayReprocessMnodeWriteMsg(mnodeMsg); } else { - mError("app:%p:%p, table:%s, failed to create in dnode, result:%s thandle:%p", mnodeMsg->rpcMsg.ahandle, mnodeMsg, - pTable->info.tableId, tstrerror(rpcMsg->code), mnodeMsg->rpcMsg.handle); + mError("app:%p:%p, table:%s, failed to create in dnode, vgId:%d sid:%d uid:%" PRIu64 ", result:%s thandle:%p", + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, + tstrerror(rpcMsg->code), mnodeMsg->rpcMsg.handle); SSdbOper oper = {.type = SDB_OPER_GLOBAL, .table = tsChildTableSdb, .pObj = pTable}; sdbDeleteRow(&oper); @@ -2543,6 +2561,25 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void pSchema[cols].bytes = htons(pShow->bytes[cols]); cols++; + pShow->bytes[cols] = 8; // table uid + pSchema[cols].type = TSDB_DATA_TYPE_BIGINT; + strcpy(pSchema[cols].name, "uid"); + pSchema[cols].bytes = htons(pShow->bytes[cols]); + cols++; + + pShow->bytes[cols] = 4; + pSchema[cols].type = TSDB_DATA_TYPE_INT; + strcpy(pSchema[cols].name, "tid"); + pSchema[cols].bytes = htons(pShow->bytes[cols]); + cols++; + + pShow->bytes[cols] = 4; + pSchema[cols].type = TSDB_DATA_TYPE_INT; + strcpy(pSchema[cols].name, "vgId"); + pSchema[cols].bytes = htons(pShow->bytes[cols]); + cols++; + + pMeta->numOfColumns = htons(cols); pShow->numOfColumns = cols; @@ -2568,6 +2605,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows return 0; } + int32_t cols = 0; int32_t numOfRows = 0; SChildTableObj *pTable = NULL; SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER; @@ -2608,8 +2646,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows continue; } - int32_t cols = 0; - + cols = 0; char *pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]); @@ -2638,14 +2675,29 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows cols++; + // uid + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + *(int64_t*) pWrite = pTable->uid; + cols++; + + + // tid + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + *(int32_t*) pWrite = pTable->tid; + cols++; + + //vgid + pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; + *(int32_t*) pWrite = pTable->vgId; + cols++; + numOfRows++; mnodeDecTableRef(pTable); } pShow->numOfReads += numOfRows; - const int32_t NUM_OF_COLUMNS = 4; - mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow); + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); mnodeDecDbRef(pDb); free(pattern); @@ -2843,9 +2895,8 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro } pShow->numOfReads += numOfRows; - const int32_t NUM_OF_COLUMNS = 4; - mnodeVacuumResult(data, NUM_OF_COLUMNS, numOfRows, rows, pShow); + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); mnodeDecDbRef(pDb); return numOfRows; diff --git a/src/mnode/src/mnodeUser.c b/src/mnode/src/mnodeUser.c index c03ff688d2282f931706e80331a884439d78ee04..779e25254897ff37f1ca884e83469233d7197b8c 100644 --- a/src/mnode/src/mnodeUser.c +++ b/src/mnode/src/mnodeUser.c @@ -386,6 +386,7 @@ static int32_t mnodeRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, voi mnodeDecUserRef(pUser); } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); pShow->numOfReads += numOfRows; return numOfRows; } diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 7dbf605405f1dc393c46be871651f0dab57c8f16..5084f1276ae883289939bd74c50a0502f6b3c71d 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -270,31 +270,34 @@ void mnodeUpdateVgroup(SVgObj *pVgroup) { Traverse all vgroups on mnode, if there no such vgId on a dnode, so send msg to this dnode for re-creating this vgId/vnode */ void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t openVnodes) { - SVnodeLoad *pNextV = NULL; - void *pIter = NULL; while (1) { SVgObj *pVgroup; pIter = mnodeGetNextVgroup(pIter, &pVgroup); if (pVgroup == NULL) break; - pNextV = pVloads; - int32_t i; - for (i = 0; i < openVnodes; ++i) { - if ((pVgroup->vnodeGid[i].pDnode == pDnode) && (pVgroup->vgId == pNextV->vgId)) { - break; - } - pNextV++; - } - - if (i == openVnodes) { - if (pVgroup->status == TAOS_VG_STATUS_CREATING || pVgroup->status == TAOS_VG_STATUS_DROPPING) { - mDebug("vgId:%d, not exist in dnode:%d and status is %s, do nothing", pVgroup->vgId, pDnode->dnodeId, - vgroupStatus[pVgroup->status]); - } else { - mDebug("vgId:%d, not exist in dnode:%d and status is %s, send create msg", pVgroup->vgId, pDnode->dnodeId, - vgroupStatus[pVgroup->status]); - mnodeSendCreateVgroupMsg(pVgroup, NULL); + for (int v = 0; v < pVgroup->numOfVnodes; ++v) { + if (pVgroup->vnodeGid[v].dnodeId == pDnode->dnodeId) { + // vgroup should have a vnode on this dnode + bool have = false; + for (int32_t i = 0; i < openVnodes; ++i) { + SVnodeLoad *pVload = pVloads + i; + if (pVgroup->vgId == pVload->vgId) { + have = true; + break; + } + } + + if (have) continue; + + if (pVgroup->status == TAOS_VG_STATUS_CREATING || pVgroup->status == TAOS_VG_STATUS_DROPPING) { + mDebug("vgId:%d, not exist in dnode:%d and status is %s, do nothing", pVgroup->vgId, pDnode->dnodeId, + vgroupStatus[pVgroup->status]); + } else { + mDebug("vgId:%d, not exist in dnode:%d and status is %s, send create msg", pVgroup->vgId, pDnode->dnodeId, + vgroupStatus[pVgroup->status]); + mnodeSendCreateVgroupMsg(pVgroup, NULL); + } } } @@ -302,7 +305,6 @@ void mnodeCheckUnCreatedVgroup(SDnodeObj *pDnode, SVnodeLoad *pVloads, int32_t o } sdbFreeIter(pIter); - return; } void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVload) { @@ -310,7 +312,7 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) { SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; if (pVgid->pDnode == pDnode) { - mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d", pDnode->dnodeId, pVgroup->vgId, pVgid->role); + mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d:%s", pDnode->dnodeId, pVgroup->vgId, pVgid->role, syncRole[pVgid->role]); pVgid->role = pVload->role; if (pVload->role == TAOS_SYNC_ROLE_MASTER) { pVgroup->inUse = i; @@ -723,8 +725,16 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v while (numOfRows < rows) { pShow->pIter = mnodeGetNextVgroup(pShow->pIter, &pVgroup); if (pVgroup == NULL) break; - if (pVgroup->pDb != pDb) continue; - if (!mnodeFilterVgroups(pVgroup, pTable)) continue; + + if (pVgroup->pDb != pDb) { + mnodeDecVgroupRef(pVgroup); + continue; + } + + if (!mnodeFilterVgroups(pVgroup, pTable)) { + mnodeDecVgroupRef(pVgroup); + continue; + } cols = 0; @@ -772,6 +782,8 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v numOfRows++; } + mnodeVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow); + pShow->numOfReads += numOfRows; mnodeDecTableRef(pTable); mnodeDecDbRef(pDb); @@ -781,12 +793,12 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v void mnodeAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { int32_t idPoolSize = taosIdPoolMaxSize(pVgroup->idPool); - if (pTable->sid > idPoolSize) { + if (pTable->tid > idPoolSize) { mnodeAllocVgroupIdPool(pVgroup); } - if (pTable->sid >= 1) { - taosIdPoolMarkStatus(pVgroup->idPool, pTable->sid); + if (pTable->tid >= 1) { + taosIdPoolMarkStatus(pVgroup->idPool, pTable->tid); pVgroup->numOfTables++; // The create vgroup message may be received later than the create table message // and the writing order in sdb is therefore uncertain @@ -796,8 +808,8 @@ void mnodeAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { } void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { - if (pTable->sid >= 1) { - taosFreeId(pVgroup->idPool, pTable->sid); + if (pTable->tid >= 1) { + taosFreeId(pVgroup->idPool, pTable->tid); pVgroup->numOfTables--; // The create vgroup message may be received later than the create table message // and the writing order in sdb is therefore uncertain diff --git a/src/mnode/src/mnodeWrite.c b/src/mnode/src/mnodeWrite.c index ab3cfa2dad179628a9ee74d578ff0d4d06ead127..d021745d2b754c21e422f87438d18539a15fd908 100644 --- a/src/mnode/src/mnodeWrite.c +++ b/src/mnode/src/mnodeWrite.c @@ -54,11 +54,17 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) { rpcRsp->rsp = epSet; rpcRsp->len = sizeof(SRpcEpSet); - mDebug("app:%p:%p, msg:%s will be redireced inUse:%d", pMsg->rpcMsg.ahandle, pMsg, taosMsg[pMsg->rpcMsg.msgType], - epSet->inUse); + mDebug("app:%p:%p, msg:%s in write queue, will be redirected, numOfEps:%d inUse:%d", pMsg->rpcMsg.ahandle, pMsg, + taosMsg[pMsg->rpcMsg.msgType], epSet->numOfEps, epSet->inUse); for (int32_t i = 0; i < epSet->numOfEps; ++i) { - mDebug("app:%p:%p, mnode index:%d ep:%s:%d", pMsg->rpcMsg.ahandle, pMsg, i, epSet->fqdn[i], - htons(epSet->port[i])); + if (strcmp(epSet->fqdn[i], tsLocalFqdn) == 0 && htons(epSet->port[i]) == tsServerPort) { + epSet->inUse = (i + 1) % epSet->numOfEps; + mDebug("app:%p:%p, mnode index:%d ep:%s:%d, set inUse to %d", pMsg->rpcMsg.ahandle, pMsg, i, epSet->fqdn[i], + htons(epSet->port[i]), epSet->inUse); + } else { + mDebug("app:%p:%p, mnode index:%d ep:%s:%d", pMsg->rpcMsg.ahandle, pMsg, i, epSet->fqdn[i], + htons(epSet->port[i])); + } } return TSDB_CODE_RPC_REDIRECT; diff --git a/src/os/inc/osDef.h b/src/os/inc/osDef.h index 81c70a58fdf01e405d2e665b5a017a4696d76e91..d718bef6da42f59c5ee4ea7bfaad098b47062984 100644 --- a/src/os/inc/osDef.h +++ b/src/os/inc/osDef.h @@ -27,7 +27,7 @@ extern "C" { #define FD_VALID(x) ((x) > STDERR_FILENO) #define FD_INITIALIZER ((int32_t)-1) -#define WCHAR wchar_t +// #define WCHAR wchar_t #define POINTER_SHIFT(p, b) ((void *)((char *)(p) + (b))) #define POINTER_DISTANCE(p1, p2) ((char *)(p1) - (char *)(p2)) diff --git a/src/os/inc/osSemphone.h b/src/os/inc/osSemphone.h index 4280b458a65b23b3aa680c6ed46f61beb5c48948..a71e74e97f4d9910414a5e801b89a1968d1df050 100644 --- a/src/os/inc/osSemphone.h +++ b/src/os/inc/osSemphone.h @@ -33,6 +33,8 @@ bool taosCheckPthreadValid(pthread_t thread); int64_t taosGetPthreadId(); void taosResetPthread(pthread_t *thread); bool taosComparePthread(pthread_t first, pthread_t second); +int32_t taosGetPId(); +int32_t taosGetCurrentAPPName(char *name, int32_t* len); #ifdef __cplusplus } diff --git a/src/os/src/detail/osSemphone.c b/src/os/src/detail/osSemphone.c index b91888845edd9e98315994eaada9eca245aacb24..9eb8c18a40a11fac9ada037163011cdcf92201fb 100644 --- a/src/os/src/detail/osSemphone.c +++ b/src/os/src/detail/osSemphone.c @@ -34,5 +34,31 @@ bool taosCheckPthreadValid(pthread_t thread) { return thread != 0; } int64_t taosGetPthreadId() { return (int64_t)pthread_self(); } void taosResetPthread(pthread_t *thread) { *thread = 0; } bool taosComparePthread(pthread_t first, pthread_t second) { return first == second; } +int32_t taosGetPId() { return getpid(); } + +int32_t taosGetCurrentAPPName(char *name, int32_t* len) { + const char* self = "/proc/self/exe"; + char path[PATH_MAX] = {0}; + + if (readlink(self, path, PATH_MAX) <= 0) { + return -1; + } + + path[PATH_MAX - 1] = 0; + char* end = strrchr(path, '/'); + if (end == NULL) { + return -1; + } + + ++end; + + strcpy(name, end); + + if (len != NULL) { + *len = strlen(name); + } + + return 0; +} #endif \ No newline at end of file diff --git a/src/os/src/detail/osSysinfo.c b/src/os/src/detail/osSysinfo.c index f6470fc3e1e84e38013d963d4ea2d3a2ae58833b..8df671f9c8974ecf77e5bf0943950772e3f9d192 100644 --- a/src/os/src/detail/osSysinfo.c +++ b/src/os/src/detail/osSysinfo.c @@ -203,7 +203,7 @@ static void taosGetSystemTimezone() { snprintf(tsTimezone, TSDB_TIMEZONE_LEN, "%s (%s, %s%02d00)", buf, tzname[daylight], tz >= 0 ? "+" : "-", abs(tz)); // cfg_timezone->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT; - uInfo("timezone not configured, set to system default:%s", tsTimezone); + uWarn("timezone not configured, set to system default:%s", tsTimezone); } /* @@ -235,7 +235,7 @@ static void taosGetSystemLocale() { // get and set default locale strcpy(tsLocale, "en_US.UTF-8"); } else { tstrncpy(tsLocale, locale, TSDB_LOCALE_LEN); - uError("locale not configured, set to system default:%s", tsLocale); + uWarn("locale not configured, set to system default:%s", tsLocale); } } diff --git a/src/os/src/linux/CMakeLists.txt b/src/os/src/linux/CMakeLists.txt index 752326cc1de74550afac386ad5ac84f6d2f48990..b1a7ebf54e58bbbdeea6d5cc219904916cc2ba03 100644 --- a/src/os/src/linux/CMakeLists.txt +++ b/src/os/src/linux/CMakeLists.txt @@ -4,4 +4,4 @@ PROJECT(TDengine) AUX_SOURCE_DIRECTORY(. SRC) ADD_LIBRARY(os ${SRC}) -TARGET_LINK_LIBRARIES(os m rt) +TARGET_LINK_LIBRARIES(os m rt z) diff --git a/src/os/src/windows/wSemphone.c b/src/os/src/windows/wSemphone.c index ded7e418430be2674b82761771579c7b84a65007..1f723540f695e4a4609a9ec74e773a1559e7f30a 100644 --- a/src/os/src/windows/wSemphone.c +++ b/src/os/src/windows/wSemphone.c @@ -36,3 +36,21 @@ int64_t taosGetPthreadId() { bool taosComparePthread(pthread_t first, pthread_t second) { return first.p == second.p; } + +int32_t taosGetPId() { + return GetCurrentProcessId(); +} + +int32_t taosGetCurrentAPPName(char *name, int32_t* len) { + char filepath[1024] = {0}; + + GetModuleFileName(NULL, filepath, MAX_PATH); + *strrchr(filepath,'.') = '\0'; + strcpy(name, filepath); + + if (len != NULL) { + *len = (int32_t) strlen(filepath); + } + + return 0; +} \ No newline at end of file diff --git a/src/plugins/http/inc/httpInt.h b/src/plugins/http/inc/httpInt.h index 36a022159f4e8b58ca4179e9ae73d5ad7dd793d2..affc0e838ea97f25dcb2e53947ecbb7b025dffb1 100644 --- a/src/plugins/http/inc/httpInt.h +++ b/src/plugins/http/inc/httpInt.h @@ -122,9 +122,9 @@ typedef struct { } HttpDecodeMethod; typedef struct { - void (*startJsonFp)(struct HttpContext *pContext, HttpSqlCmd *cmd, void *result); + void (*startJsonFp)(struct HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result); void (*stopJsonFp)(struct HttpContext *pContext, HttpSqlCmd *cmd); - bool (*buildQueryJsonFp)(struct HttpContext *pContext, HttpSqlCmd *cmd, void *result, int numOfRows); + bool (*buildQueryJsonFp)(struct HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, int numOfRows); void (*buildAffectRowJsonFp)(struct HttpContext *pContext, HttpSqlCmd *cmd, int affectRows); void (*initJsonFp)(struct HttpContext *pContext); void (*cleanJsonFp)(struct HttpContext *pContext); @@ -148,7 +148,7 @@ typedef struct HttpContext { char ipstr[22]; char user[TSDB_USER_LEN]; // parsed from auth token or login message char pass[TSDB_PASSWORD_LEN]; - void * taos; + TAOS * taos; void * ppContext; HttpSession *session; z_stream gzipStream; diff --git a/src/plugins/http/src/httpGcJson.c b/src/plugins/http/src/httpGcJson.c index 80e4ae3bc2b51387d5573af00aa1e91d2c1cd663..2c9eca11deb51acc8cc25965b83cc686ac04c6e5 100644 --- a/src/plugins/http/src/httpGcJson.c +++ b/src/plugins/http/src/httpGcJson.c @@ -217,7 +217,7 @@ bool gcBuildQueryJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - httpJsonStringForTransMean(jsonBuf, row[i], fields[i].bytes); + httpJsonStringForTransMean(jsonBuf, (char*)row[i], fields[i].bytes); break; case TSDB_DATA_TYPE_TIMESTAMP: if (precision == TSDB_TIME_PRECISION_MILLI) { //ms diff --git a/src/plugins/http/src/httpQueue.c b/src/plugins/http/src/httpQueue.c index 86a97a6abe251e1fa99219b9fb63a525ba89f7d4..43a8ddbd1a0d207addf0576951b2af9b2be16555 100644 --- a/src/plugins/http/src/httpQueue.c +++ b/src/plugins/http/src/httpQueue.c @@ -67,7 +67,7 @@ static void *httpProcessResultQueue(void *param) { while (1) { if (taosReadQitemFromQset(tsHttpQset, &type, (void **)&pMsg, &unUsed) == 0) { - httpDebug("httpResultQueue: got no message from qset, exiting..."); + httpDebug("qset:%p, http queue got no message from qset, exiting", tsHttpQset); break; } diff --git a/src/plugins/http/src/httpRestJson.c b/src/plugins/http/src/httpRestJson.c index 954678c24c8fb4597ef3184d2d65060c6d159aa1..a5b156bffc23ea3cdb042f456a327895fc0bdaa6 100644 --- a/src/plugins/http/src/httpRestJson.c +++ b/src/plugins/http/src/httpRestJson.c @@ -131,7 +131,7 @@ bool restBuildSqlJson(HttpContext *pContext, HttpSqlCmd *cmd, TAOS_RES *result, break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: - httpJsonStringForTransMean(jsonBuf, row[i], length[i]); + httpJsonStringForTransMean(jsonBuf, (char*)row[i], length[i]); break; case TSDB_DATA_TYPE_TIMESTAMP: if (timestampFormat == REST_TIMESTAMP_FMT_LOCAL_STRING) { @@ -195,4 +195,4 @@ void restStopSqlJson(HttpContext *pContext, HttpSqlCmd *cmd) { httpJsonToken(jsonBuf, JsonObjEnd); httpWriteJsonBufEnd(jsonBuf); -} \ No newline at end of file +} diff --git a/src/plugins/http/src/httpSql.c b/src/plugins/http/src/httpSql.c index 883fa574ff19958591051512e717a9b512f3e0ce..70d644146cf5ebe15a42c8f00a2e6e4bd603d081 100644 --- a/src/plugins/http/src/httpSql.c +++ b/src/plugins/http/src/httpSql.c @@ -27,8 +27,6 @@ #include "httpSession.h" #include "httpQueue.h" -void *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int), - void *param, void **taos); void httpProcessMultiSql(HttpContext *pContext); void httpProcessMultiSqlRetrieveCallBack(void *param, TAOS_RES *result, int numOfRows); diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h index 5d570821cb6608fb382398e146766eb1f8aff284..f392644e6736f528fa75f21ee2857c570c0c22c9 100644 --- a/src/query/inc/qExecutor.h +++ b/src/query/inc/qExecutor.h @@ -185,11 +185,18 @@ enum { QUERY_RESULT_READY = 2, }; +typedef struct SMemRef { + int32_t ref; + void *mem; + void *imem; +} SMemRef; + typedef struct SQInfo { void* signature; int32_t code; // error code to returned to client int64_t owner; // if it is in execution void* tsdb; + SMemRef memRef; int32_t vgId; STableGroupInfo tableGroupInfo; // table list SArray STableGroupInfo tableqinfoGroupInfo; // this is a group array list, including SArray structure @@ -206,6 +213,7 @@ typedef struct SQInfo { void* pBuf; // allocated buffer for STableQueryInfo, sizeof(STableQueryInfo)*numOfTables; pthread_mutex_t lock; // used to synchronize the rsp/query threads + tsem_t ready; int32_t dataReady; // denote if query result is ready or not void* rspContext; // response context } SQInfo; diff --git a/src/query/inc/qExtbuffer.h b/src/query/inc/qExtbuffer.h index 0bdcf5c45ef6d9ce283d36ccd9d7b6296fc67472..df6e64ddd85c4ec6be693f262ea561ee23f3bf0b 100644 --- a/src/query/inc/qExtbuffer.h +++ b/src/query/inc/qExtbuffer.h @@ -89,7 +89,7 @@ typedef struct SColumnModel { typedef struct SColumnOrderInfo { int32_t numOfCols; - int16_t pData[]; + int16_t colIndex[]; } SColumnOrderInfo; typedef struct tOrderDescriptor { diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h index d6664577a377bb619db2f0bab04471642aa10e20..bc8f9a5e23df72f82bcb3bb5140bec42fe426268 100644 --- a/src/query/inc/qSqlparser.h +++ b/src/query/inc/qSqlparser.h @@ -276,8 +276,6 @@ tSQLExpr *tSQLExprNodeClone(tSQLExpr *pExpr); SAlterTableSQL *tAlterTableSQLElems(SStrToken *pMeterName, tFieldList *pCols, tVariantList *pVals, int32_t type); -tSQLExprListList *tSQLListListAppend(tSQLExprListList *pList, tSQLExprList *pExprList); - void destroyAllSelectClause(SSubclauseInfo *pSql); void doDestroyQuerySql(SQuerySQL *pSql); diff --git a/src/query/src/qAst.c b/src/query/src/qAst.c index 63411aaf3f9085d3912b923ac419cd1552239583..893105e44ac4eb82843514cda20928d3e0dcdaf9 100644 --- a/src/query/src/qAst.c +++ b/src/query/src/qAst.c @@ -646,9 +646,7 @@ static bool filterItem(tExprNode *pExpr, const void *pItem, SExprTraverseSupp *p } // handle the leaf node - assert(pLeft->nodeType == TSQL_NODE_COL && pRight->nodeType == TSQL_NODE_VALUE); param->setupInfoFn(pExpr, param->pExtInfo); - return param->nodeFilterFn(pItem, pExpr->_node.info); } @@ -769,6 +767,7 @@ void tExprTreeTraverse(tExprNode *pExpr, SSkipList *pSkipList, SArray *result, S assert(taosArrayGetSize(result) == 0); tSQLBinaryTraverseOnSkipList(pExpr, result, pSkipList, param); } + return; } diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index 77a402c7bef84157c6188c9482086e8f62310882..3cb8db9fafe4ea8fa985377424152c7d0daecf12 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -1537,7 +1537,9 @@ void setExecParams(SQuery *pQuery, SQLFunctionCtx *pCtx, void* inputData, TSKEY if (isNull((const char*) &pQuery->fillVal[colIndex], pCtx->inputType)) { pCtx->param[1].nType = TSDB_DATA_TYPE_NULL; } else { // todo refactor, tVariantCreateFromBinary should handle the NULL value - tVariantCreateFromBinary(&pCtx->param[1], (char*) &pQuery->fillVal[colIndex], pCtx->inputBytes, pCtx->inputType); + if (pCtx->inputType != TSDB_DATA_TYPE_BINARY && pCtx->inputType != TSDB_DATA_TYPE_NCHAR) { + tVariantCreateFromBinary(&pCtx->param[1], (char*) &pQuery->fillVal[colIndex], pCtx->inputBytes, pCtx->inputType); + } } } } @@ -4511,7 +4513,6 @@ int32_t doInitQInfo(SQInfo *pQInfo, STSBuf *pTsBuf, void *tsdb, int32_t vgId, bo int32_t code = TSDB_CODE_SUCCESS; SQuery *pQuery = pQInfo->runtimeEnv.pQuery; - pQuery->precision = tsdbGetCfg(tsdb)->precision; pRuntimeEnv->topBotQuery = isTopBottomQuery(pQuery); pRuntimeEnv->hasTagResults = hasTagValOutput(pQuery); @@ -6226,7 +6227,9 @@ static SQInfo *createQInfoImpl(SQueryTableMsg *pQueryMsg, SSqlGroupbyExpr *pGrou // NOTE: pTableCheckInfo need to update the query time range and the lastKey info pQInfo->arrTableIdInfo = taosArrayInit(tableIndex, sizeof(STableIdInfo)); pQInfo->dataReady = QUERY_RESULT_NOT_READY; + pQInfo->rspContext = NULL; pthread_mutex_init(&pQInfo->lock, NULL); + tsem_init(&pQInfo->ready, 0, 0); pQuery->pos = -1; pQuery->window = pQueryMsg->window; @@ -6323,6 +6326,8 @@ static int32_t initQInfo(SQueryTableMsg *pQueryMsg, void *tsdb, int32_t vgId, SQ bool ret = tsBufNextPos(pTSBuf); UNUSED(ret); } + + pQuery->precision = tsdbGetCfg(tsdb)->precision; if ((QUERY_IS_ASC_QUERY(pQuery) && (pQuery->window.skey > pQuery->window.ekey)) || (!QUERY_IS_ASC_QUERY(pQuery) && (pQuery->window.ekey > pQuery->window.skey))) { @@ -6689,12 +6694,14 @@ static bool doBuildResCheck(SQInfo* pQInfo) { pQInfo->dataReady = QUERY_RESULT_READY; buildRes = (pQInfo->rspContext != NULL); - pthread_mutex_unlock(&pQInfo->lock); - - // clear qhandle owner + // clear qhandle owner, it must be in the secure area. other thread may run ahead before current, after it is + // put into task to be executed. assert(pQInfo->owner == taosGetPthreadId()); pQInfo->owner = 0; + pthread_mutex_unlock(&pQInfo->lock); + + tsem_post(&pQInfo->ready); return buildRes; } @@ -6758,18 +6765,24 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex SQInfo *pQInfo = (SQInfo *)qinfo; if (pQInfo == NULL || !isValidQInfo(pQInfo)) { + qError("QInfo:%p invalid qhandle", pQInfo); return TSDB_CODE_QRY_INVALID_QHANDLE; } *buildRes = false; - SQuery *pQuery = pQInfo->runtimeEnv.pQuery; if (IS_QUERY_KILLED(pQInfo)) { qDebug("QInfo:%p query is killed, code:%d", pQInfo, pQInfo->code); return pQInfo->code; } int32_t code = TSDB_CODE_SUCCESS; + +#if 0 + SQuery *pQuery = pQInfo->runtimeEnv.pQuery; + pthread_mutex_lock(&pQInfo->lock); + assert(pQInfo->rspContext == NULL); + if (pQInfo->dataReady == QUERY_RESULT_READY) { *buildRes = true; qDebug("QInfo:%p retrieve result info, rowsize:%d, rows:%"PRId64", code:%d", pQInfo, pQuery->rowSize, pQuery->rec.rows, @@ -6778,10 +6791,17 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo, bool* buildRes, void* pRspContex *buildRes = false; qDebug("QInfo:%p retrieve req set query return result after paused", pQInfo); pQInfo->rspContext = pRspContext; + assert(pQInfo->rspContext != NULL); } code = pQInfo->code; pthread_mutex_unlock(&pQInfo->lock); +#else + tsem_wait(&pQInfo->ready); + *buildRes = true; + code = pQInfo->code; +#endif + return code; } @@ -7098,6 +7118,7 @@ void qCleanupQueryMgmt(void* pQMgmt) { void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) { if (pMgmt == NULL) { + terrno = TSDB_CODE_VND_INVALID_VGROUP_ID; return NULL; } @@ -7106,6 +7127,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) { SQueryMgmt *pQueryMgmt = pMgmt; if (pQueryMgmt->qinfoPool == NULL) { qError("QInfo:%p failed to add qhandle into qMgmt, since qMgmt is closed", (void *)qInfo); + terrno = TSDB_CODE_VND_INVALID_VGROUP_ID; return NULL; } @@ -7113,6 +7135,7 @@ void** qRegisterQInfo(void* pMgmt, uint64_t qInfo) { if (pQueryMgmt->closed) { // pthread_mutex_unlock(&pQueryMgmt->lock); qError("QInfo:%p failed to add qhandle into cache, since qMgmt is colsing", (void *)qInfo); + terrno = TSDB_CODE_VND_INVALID_VGROUP_ID; return NULL; } else { TSDB_CACHE_PTR_TYPE handleVal = (TSDB_CACHE_PTR_TYPE) qInfo; diff --git a/src/query/src/qExtbuffer.c b/src/query/src/qExtbuffer.c index 1d3120ead47852da3e3ec6bdcc6f92de9c52cb60..fc9c60b39b0cfa4b591cc77c1efcdac4e6647ce9 100644 --- a/src/query/src/qExtbuffer.c +++ b/src/query/src/qExtbuffer.c @@ -343,8 +343,10 @@ static FORCE_INLINE int32_t primaryKeyComparator(int64_t f1, int64_t f2, int32_t if (f1 == f2) { return 0; } - - if (colIdx == 0 && tsOrder == TSDB_ORDER_DESC) { // primary column desc order + + assert(colIdx == 0); + + if (tsOrder == TSDB_ORDER_DESC) { // primary column desc order return (f1 < f2) ? 1 : -1; } else { // asc return (f1 < f2) ? -1 : 1; @@ -435,7 +437,7 @@ int32_t compare_a(tOrderDescriptor *pDescriptor, int32_t numOfRows1, int32_t s1, int32_t cmpCnt = pDescriptor->orderInfo.numOfCols; for (int32_t i = 0; i < cmpCnt; ++i) { - int32_t colIdx = pDescriptor->orderInfo.pData[i]; + int32_t colIdx = pDescriptor->orderInfo.colIndex[i]; char *f1 = COLMODEL_GET_VAL(data1, pDescriptor->pColumnModel, numOfRows1, s1, colIdx); char *f2 = COLMODEL_GET_VAL(data2, pDescriptor->pColumnModel, numOfRows2, s2, colIdx); @@ -467,7 +469,7 @@ int32_t compare_d(tOrderDescriptor *pDescriptor, int32_t numOfRows1, int32_t s1, int32_t cmpCnt = pDescriptor->orderInfo.numOfCols; for (int32_t i = 0; i < cmpCnt; ++i) { - int32_t colIdx = pDescriptor->orderInfo.pData[i]; + int32_t colIdx = pDescriptor->orderInfo.colIndex[i]; char *f1 = COLMODEL_GET_VAL(data1, pDescriptor->pColumnModel, numOfRows1, s1, colIdx); char *f2 = COLMODEL_GET_VAL(data2, pDescriptor->pColumnModel, numOfRows2, s2, colIdx); @@ -557,13 +559,13 @@ static void median(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta int32_t midIdx = ((end - start) >> 1) + start; #if defined(_DEBUG_VIEW) - int32_t f = pDescriptor->orderInfo.pData[0]; + int32_t f = pDescriptor->orderInfo.colIndex[0]; char *midx = COLMODEL_GET_VAL(data, pDescriptor->pColumnModel, numOfRows, midIdx, f); char *startx = COLMODEL_GET_VAL(data, pDescriptor->pColumnModel, numOfRows, start, f); char *endx = COLMODEL_GET_VAL(data, pDescriptor->pColumnModel, numOfRows, end, f); - int32_t colIdx = pDescriptor->orderInfo.pData[0]; + int32_t colIdx = pDescriptor->orderInfo.colIndex[0]; tSortDataPrint(pDescriptor->pColumnModel->pFields[colIdx].field.type, "before", startx, midx, endx); #endif @@ -591,7 +593,7 @@ static void median(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta } static UNUSED_FUNC void tRowModelDisplay(tOrderDescriptor *pDescriptor, int32_t numOfRows, char *d, int32_t len) { - int32_t colIdx = pDescriptor->orderInfo.pData[0]; + int32_t colIdx = pDescriptor->orderInfo.colIndex[0]; for (int32_t i = 0; i < len; ++i) { char *startx = COLMODEL_GET_VAL(d, pDescriptor->pColumnModel, numOfRows, i, colIdx); @@ -1075,7 +1077,7 @@ tOrderDescriptor *tOrderDesCreate(const int32_t *orderColIdx, int32_t numOfOrder desc->orderInfo.numOfCols = numOfOrderCols; for (int32_t i = 0; i < numOfOrderCols; ++i) { - desc->orderInfo.pData[i] = orderColIdx[i]; + desc->orderInfo.colIndex[i] = orderColIdx[i]; } return desc; diff --git a/src/query/src/qParserImpl.c b/src/query/src/qParserImpl.c index 33237a58c2096f7c87b890863723318fe487ff32..7e8128f200658af282bab89bd73dc2c27ddb25c1 100644 --- a/src/query/src/qParserImpl.c +++ b/src/query/src/qParserImpl.c @@ -130,13 +130,15 @@ tSQLExpr *tSQLExprIdValueCreate(SStrToken *pToken, int32_t optrType) { tVariantCreate(&pSQLExpr->val, pToken); pSQLExpr->nSQLOptr = optrType; } else if (optrType == TK_NOW) { - // default use microsecond + // use microsecond by default pSQLExpr->val.i64Key = taosGetTimestamp(TSDB_TIME_PRECISION_MICRO); pSQLExpr->val.nType = TSDB_DATA_TYPE_BIGINT; pSQLExpr->nSQLOptr = TK_TIMESTAMP; // TK_TIMESTAMP used to denote the time value is in microsecond } else if (optrType == TK_VARIABLE) { int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSQLExpr->val.i64Key); - UNUSED(ret); + if (ret != TSDB_CODE_SUCCESS) { + terrno = TSDB_CODE_TSC_SQL_SYNTAX_ERROR; + } pSQLExpr->val.nType = TSDB_DATA_TYPE_BIGINT; pSQLExpr->nSQLOptr = TK_TIMESTAMP; @@ -148,6 +150,7 @@ tSQLExpr *tSQLExprIdValueCreate(SStrToken *pToken, int32_t optrType) { pSQLExpr->nSQLOptr = optrType; } + return pSQLExpr; } @@ -532,26 +535,6 @@ SQuerySQL *tSetQuerySQLElems(SStrToken *pSelectToken, tSQLExprList *pSelection, return pQuery; } -tSQLExprListList *tSQLListListAppend(tSQLExprListList *pList, tSQLExprList *pExprList) { - if (pList == NULL) pList = calloc(1, sizeof(tSQLExprListList)); - - if (pList->nAlloc <= pList->nList) { // - pList->nAlloc = (pList->nAlloc << 1) + 4; - pList->a = realloc(pList->a, pList->nAlloc * sizeof(pList->a[0])); - if (pList->a == 0) { - pList->nList = pList->nAlloc = 0; - return pList; - } - } - assert(pList->a != 0); - - if (pExprList) { - pList->a[pList->nList++] = pExprList; - } - - return pList; -} - void doDestroyQuerySql(SQuerySQL *pQuerySql) { if (pQuerySql == NULL) { return; diff --git a/src/query/src/qPercentile.c b/src/query/src/qPercentile.c index 3a8be781d5c9e7cfcb524e10b2d937a73ecb74ca..ab9ffb7bcb458129b7f170e7020cee904d2dfda6 100644 --- a/src/query/src/qPercentile.c +++ b/src/query/src/qPercentile.c @@ -365,7 +365,7 @@ void tMemBucketDestroy(tMemBucket *pBucket) { taosTFree(pBucket); } -void tMemBucketUpdateBoundingBox(MinMaxEntry *r, char *data, int32_t dataType) { +void tMemBucketUpdateBoundingBox(MinMaxEntry *r, const char *data, int32_t dataType) { switch (dataType) { case TSDB_DATA_TYPE_INT: { int32_t val = *(int32_t *)data; diff --git a/src/query/src/qSyntaxtreefunction.c b/src/query/src/qSyntaxtreefunction.c index 2104edfd910bba1a1701800387545c4f58dfb625..7f7fca2c1e0ca6ce85f0df1c1b6e6dce82d8c000 100644 --- a/src/query/src/qSyntaxtreefunction.c +++ b/src/query/src/qSyntaxtreefunction.c @@ -1247,7 +1247,10 @@ _bi_consumer_fn_t tGetBiConsumerFn(int32_t leftType, int32_t rightType, int32_t case TSDB_BINARY_OP_REMAINDER: return rem_function_arraylist[leftType][rightType]; default: + assert(0); return NULL; } + + assert(0); return NULL; } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 414d37d8b8c3141784a22bb117a8ec6d92b4096a..6e9088d9fb82a80bb28857d563ad51f19594e6b7 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -412,7 +412,7 @@ void rpcSendResponse(const SRpcMsg *pRsp) { rpcLockConn(pConn); if ( pConn->inType == 0 || pConn->user[0] == 0 ) { - tDebug("%s, connection is already released, rsp wont be sent", pConn->info); + tError("%s, connection is already released, rsp wont be sent", pConn->info); rpcUnlockConn(pConn); rpcFreeCont(pMsg->pCont); rpcDecRef(pRpc); @@ -542,10 +542,7 @@ void rpcCancelRequest(void *handle) { if (pContext->pConn) { tDebug("%s, app tries to cancel request", pContext->pConn->info); - pContext->pConn->pReqMsg = NULL; rpcCloseConn(pContext->pConn); - pContext->pConn = NULL; - rpcFreeCont(pContext->pCont); } } @@ -613,8 +610,10 @@ static void rpcReleaseConn(SRpcConn *pConn) { if (pConn->pReqMsg) rpcFreeCont(pConn->pReqMsg); // do not use rpcFreeMsg } else { // if there is an outgoing message, free it - if (pConn->outType && pConn->pReqMsg) + if (pConn->outType && pConn->pReqMsg) { + if (pConn->pContext) pConn->pContext->pConn = NULL; rpcFreeMsg(pConn->pReqMsg); + } } // memset could not be used, since lockeBy can not be reset @@ -1052,6 +1051,9 @@ static void *rpcProcessMsgFromPeer(SRecvInfo *pRecv) { if (code != 0) { // parsing error if (rpcIsReq(pHead->msgType)) { rpcSendErrorMsgToPeer(pRecv, code); + if (code == TSDB_CODE_RPC_INVALID_TIME_STAMP || code == TSDB_CODE_RPC_AUTH_FAILURE) { + rpcCloseConn(pConn); + } tDebug("%s %p %p, %s is sent with error code:0x%x", pRpc->label, pConn, (void *)pHead->ahandle, taosMsg[pHead->msgType+1], code); } } else { // msg is passed to app only parsing is ok @@ -1121,9 +1123,13 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead, SRpcReqConte SRpcEpSet *pEpSet = (SRpcEpSet*)pHead->content; if (pEpSet->numOfEps > 0) { memcpy(&pContext->epSet, pHead->content, sizeof(pContext->epSet)); - tDebug("%s, redirect is received, numOfEps:%d", pConn->info, pContext->epSet.numOfEps); - for (int i=0; iepSet.numOfEps; ++i) + tDebug("%s, redirect is received, numOfEps:%d inUse:%d", pConn->info, pContext->epSet.numOfEps, + pContext->epSet.inUse); + for (int i = 0; i < pContext->epSet.numOfEps; ++i) { pContext->epSet.port[i] = htons(pContext->epSet.port[i]); + tDebug("%s, redirect is received, index:%d ep:%s:%u", pConn->info, i, pContext->epSet.fqdn[i], + pContext->epSet.port[i]); + } } rpcSendReqToServer(pRpc, pContext); rpcFreeCont(rpcMsg.pCont); diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index dd9e7684e03e5cfc8c44dc3555a4ad1d144b90b6..0b9bbae92eef3942b7a930f30650c412ce2eba46 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -525,7 +525,7 @@ static void *taosProcessTcpData(void *param) { while (pThreadObj->pHead) { SFdObj *pFdObj = pThreadObj->pHead; pThreadObj->pHead = pFdObj->next; - taosFreeFdObj(pFdObj); + taosReportBrokenLink(pFdObj); } pthread_mutex_destroy(&(pThreadObj->mutex)); diff --git a/src/sync/CMakeLists.txt b/src/sync/CMakeLists.txt index efdf2bd185cb5db46d7f0918725ebe8886d5bd98..60271c771ca0a01bd449cb878fe2269759250fd3 100644 --- a/src/sync/CMakeLists.txt +++ b/src/sync/CMakeLists.txt @@ -5,14 +5,14 @@ INCLUDE_DIRECTORIES(inc) AUX_SOURCE_DIRECTORY(src SRC) IF (TD_LINUX) - LIST(REMOVE_ITEM SRC ./src/tarbitrator.c) + LIST(REMOVE_ITEM SRC src/tarbitrator.c) ADD_LIBRARY(sync ${SRC}) TARGET_LINK_LIBRARIES(sync tutil pthread common) - LIST(APPEND BIN_SRC ./src/tarbitrator.c) - LIST(APPEND BIN_SRC ./src/taosTcpPool.c) + LIST(APPEND BIN_SRC src/tarbitrator.c) + LIST(APPEND BIN_SRC src/taosTcpPool.c) ADD_EXECUTABLE(tarbitrator ${BIN_SRC}) TARGET_LINK_LIBRARIES(tarbitrator sync common osdetail tutil) - ADD_SUBDIRECTORY(test) + #ADD_SUBDIRECTORY(test) ENDIF () diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c index 0daf0b962060e9c9fc40d101d13eab200262c40a..ef635e6efc1ca5f071c64dbe00920c3987837494 100644 --- a/src/sync/src/syncMain.c +++ b/src/sync/src/syncMain.c @@ -215,6 +215,9 @@ void syncStop(void *param) { pthread_mutex_lock(&(pNode->mutex)); + if (vgIdHash) taosHashRemove(vgIdHash, (const char *)&pNode->vgId, sizeof(int32_t)); + if (pNode->pFwdTimer) taosTmrStop(pNode->pFwdTimer); + for (int i = 0; i < pNode->replica; ++i) { pPeer = pNode->peerInfo[i]; if (pPeer) syncRemovePeer(pPeer); @@ -223,9 +226,6 @@ void syncStop(void *param) { pPeer = pNode->peerInfo[TAOS_SYNC_MAX_REPLICA]; if (pPeer) syncRemovePeer(pPeer); - if (vgIdHash) taosHashRemove(vgIdHash, (const char *)&pNode->vgId, sizeof(int32_t)); - if (pNode->pFwdTimer) taosTmrStop(pNode->pFwdTimer); - pthread_mutex_unlock(&(pNode->mutex)); syncDecNodeRef(pNode); @@ -311,8 +311,21 @@ int32_t syncForwardToPeer(void *param, void *data, void *mhandle, int qtype) { if (pNode == NULL) return 0; + if (nodeRole == TAOS_SYNC_ROLE_SLAVE && pWalHead->version != nodeVersion + 1) { + sError("vgId:%d, received ver:%" PRIu64 ", inconsistent with last ver:%" PRIu64 ", restart connection", pNode->vgId, + pWalHead->version, nodeVersion); + for (int i = 0; i < pNode->replica; ++i) { + pPeer = pNode->peerInfo[i]; + syncRestartConnection(pPeer); + } + return TSDB_CODE_SYN_INVALID_VERSION; + } + // always update version nodeVersion = pWalHead->version; + sDebug("vgId:%d, replica:%d nodeRole:%s qtype:%d ver:%" PRIu64, pNode->vgId, pNode->replica, syncRole[nodeRole], + qtype, pWalHead->version); + if (pNode->replica == 1 || nodeRole != TAOS_SYNC_ROLE_MASTER) return 0; // only pkt from RPC or CQ can be forwarded @@ -881,7 +894,7 @@ static void syncProcessPeersStatusMsg(char *cont, SSyncPeer *pPeer) { SSyncNode * pNode = pPeer->pSyncNode; SPeersStatus *pPeersStatus = (SPeersStatus *)cont; - sDebug("%s, status msg received, self:%s ver:%" PRIu64 " peer:%s ver:%" PRIu64 ", ack:%d", pPeer->id, + sDebug("%s, status msg is received, self:%s ver:%" PRIu64 " peer:%s ver:%" PRIu64 ", ack:%d", pPeer->id, syncRole[nodeRole], nodeVersion, syncRole[pPeersStatus->role], pPeersStatus->version, pPeersStatus->ack); pPeer->version = pPeersStatus->version; @@ -968,7 +981,8 @@ static void syncSendPeersStatusMsgToPeer(SSyncPeer *pPeer, char ack) { int retLen = write(pPeer->peerFd, msg, statusMsgLen); if (retLen == statusMsgLen) { - sDebug("%s, status msg is sent", pPeer->id); + sDebug("%s, status msg is sent, self:%s ver:%" PRIu64 ", ack:%d", pPeer->id, syncRole[pPeersStatus->role], + pPeersStatus->version, pPeersStatus->ack); } else { sDebug("%s, failed to send status msg, restart", pPeer->id); syncRestartConnection(pPeer); @@ -1189,6 +1203,8 @@ static void syncProcessFwdAck(SSyncNode *pNode, SFwdInfo *pFwdInfo, int32_t code static void syncMonitorFwdInfos(void *param, void *tmrId) { SSyncNode *pNode = param; SSyncFwds *pSyncFwds = pNode->pSyncFwds; + if (pSyncFwds == NULL) return; + uint64_t time = taosGetTimestampMs(); if (pSyncFwds->fwds > 0) { diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 564d7f5db51c80929391283e4b6fa1128275ea14..f3bd91f038cf209827b1c252160019a6b0aac27f 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -239,7 +239,7 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg) { return NULL; } - if (tsdbInitTableCfg(pCfg, pMsg->tableType, htobe64(pMsg->uid), htonl(pMsg->sid)) < 0) goto _err; + if (tsdbInitTableCfg(pCfg, pMsg->tableType, htobe64(pMsg->uid), htonl(pMsg->tid)) < 0) goto _err; if (tdInitTSchemaBuilder(&schemaBuilder, htonl(pMsg->sversion)) < 0) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; goto _err; diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index d3f4747a96d509ef9764661a7f4bc7e8c8ceaef4..ac6c2e0c5a9d5590e7dd57863dd18d8726912de5 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -20,6 +20,7 @@ #include "exception.h" #include "../../query/inc/qAst.h" // todo move to common module +#include "../../query/inc/qExecutor.h" // todo move to common module #include "tlosertree.h" #include "tsdb.h" #include "tsdbMain.h" @@ -72,7 +73,6 @@ typedef struct STableCheckInfo { SCompInfo* pCompInfo; int32_t compSize; int32_t numOfBlocks; // number of qualified data blocks not the original blocks - SDataCols* pDataCols; int32_t chosen; // indicate which iterator should move forward bool initBuf; // whether to initialize the in-memory skip list iterator or not SSkipListIterator* iter; // mem buffer skip list iterator @@ -117,10 +117,12 @@ typedef struct STsdbQueryHandle { SFileGroupIter fileIter; SRWHelper rhelper; STableBlockInfo* pDataBlockInfo; + + SDataCols *pDataCols; // in order to hold current file data block int32_t allocSize; // allocated data block size - SMemTable* mem; // mem-table - SMemTable* imem; // imem-table, acquired from snapshot - SArray* defaultLoadColumn;// default load column + SMemTable *mem; // mem-table + SMemTable *imem; // imem-table, acquired from snapshot + SArray *defaultLoadColumn;// default load column SDataBlockLoadInfo dataBlockLoadInfo; /* record current block load information */ SLoadCompBlockInfo compBlockLoadInfo; /* record current compblock information in SQuery */ @@ -142,6 +144,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, STsdbQueryHandle* pQueryHandle); static int tsdbCheckInfoCompar(const void* key1, const void* key2); + static void tsdbInitDataBlockLoadInfo(SDataBlockLoadInfo* pBlockLoadInfo) { pBlockLoadInfo->slot = -1; pBlockLoadInfo->tid = -1; @@ -181,7 +184,93 @@ static SArray* getDefaultLoadColumns(STsdbQueryHandle* pQueryHandle, bool loadTS return pLocalIdList; } -TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STableGroupInfo* groupList, void* qinfo) { +static void tsdbMayTakeMemSnapshot(TsdbQueryHandleT pHandle) { + STsdbQueryHandle* pSecQueryHandle = (STsdbQueryHandle*) pHandle; + SQInfo *pQInfo = (SQInfo *)(pSecQueryHandle->qinfo); + + if (pQInfo->memRef.ref++ == 0) { + tsdbTakeMemSnapshot(pSecQueryHandle->pTsdb, &pSecQueryHandle->mem, &pSecQueryHandle->imem); + pQInfo->memRef.mem = pSecQueryHandle->mem; + pQInfo->memRef.imem = pSecQueryHandle->imem; + } else { + pSecQueryHandle->mem = (SMemTable *)(pQInfo->memRef.mem); + pSecQueryHandle->imem = (SMemTable *)(pQInfo->memRef.imem); + } +} +static void tsdbMayUnTakeMemSnapshot(TsdbQueryHandleT pHandle) { + STsdbQueryHandle* pSecQueryHandle = (STsdbQueryHandle*) pHandle; + SQInfo *pQInfo = (SQInfo *)(pSecQueryHandle->qinfo); + + if (--pQInfo->memRef.ref == 0) { + tsdbUnTakeMemSnapShot(pSecQueryHandle->pTsdb, pSecQueryHandle->mem, pSecQueryHandle->imem); + } +} +static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STableGroupInfo* pGroupList, STsdbMeta* pMeta) { + size_t sizeOfGroup = taosArrayGetSize(pGroupList->pGroupList); + assert(sizeOfGroup >= 1 && pMeta != NULL); + + // allocate buffer in order to load data blocks from file + SArray* pTableCheckInfo = taosArrayInit(pGroupList->numOfTables, sizeof(STableCheckInfo)); + if (pTableCheckInfo == NULL) { + return NULL; + } + + // todo apply the lastkey of table check to avoid to load header file + for (int32_t i = 0; i < sizeOfGroup; ++i) { + SArray* group = *(SArray**) taosArrayGet(pGroupList->pGroupList, i); + + size_t gsize = taosArrayGetSize(group); + assert(gsize > 0); + + for (int32_t j = 0; j < gsize; ++j) { + STableKeyInfo* pKeyInfo = (STableKeyInfo*) taosArrayGet(group, j); + + STableCheckInfo info = { .lastKey = pKeyInfo->lastKey, .pTableObj = pKeyInfo->pTable }; + info.tableId = ((STable*)(pKeyInfo->pTable))->tableId; + + assert(info.pTableObj != NULL && (info.pTableObj->type == TSDB_NORMAL_TABLE || + info.pTableObj->type == TSDB_CHILD_TABLE || info.pTableObj->type == TSDB_STREAM_TABLE)); + + info.tableId.tid = info.pTableObj->tableId.tid; + info.tableId.uid = info.pTableObj->tableId.uid; + + if (ASCENDING_TRAVERSE(pQueryHandle->order)) { + assert(info.lastKey >= pQueryHandle->window.skey); + } else { + assert(info.lastKey <= pQueryHandle->window.skey); + } + + taosArrayPush(pTableCheckInfo, &info); + tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" %p", pQueryHandle, info.tableId.uid, + info.tableId.tid, info.lastKey, pQueryHandle->qinfo); + } + } + + taosArraySort(pTableCheckInfo, tsdbCheckInfoCompar); + return pTableCheckInfo; +} + +static SArray* createCheckInfoFromCheckInfo(SArray* pTableCheckInfo, TSKEY skey) { + size_t si = taosArrayGetSize(pTableCheckInfo); + SArray* pNew = taosArrayInit(si, sizeof(STableCheckInfo)); + if (pNew == NULL) { + return NULL; + } + + for (int32_t j = 0; j < si; ++j) { + STableCheckInfo* pCheckInfo = (STableCheckInfo*) taosArrayGet(pTableCheckInfo, j); + STableCheckInfo info = { .lastKey = skey, .pTableObj = pCheckInfo->pTableObj}; + + info.tableId = pCheckInfo->tableId; + taosArrayPush(pNew, &info); + } + + // it is ordered already, no need to sort again. + taosArraySort(pNew, tsdbCheckInfoCompar); + return pNew; +} + +static STsdbQueryHandle* tsdbQueryTablesImpl(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, void* qinfo) { STsdbQueryHandle* pQueryHandle = calloc(1, sizeof(STsdbQueryHandle)); if (pQueryHandle == NULL) { goto out_of_memory; @@ -204,10 +293,8 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab goto out_of_memory; } - tsdbTakeMemSnapshot(pQueryHandle->pTsdb, &pQueryHandle->mem, &pQueryHandle->imem); - - size_t sizeOfGroup = taosArrayGetSize(groupList->pGroupList); - assert(sizeOfGroup >= 1 && pCond != NULL && pCond->numOfCols > 0); + tsdbMayTakeMemSnapshot(pQueryHandle); + assert(pCond != NULL && pCond->numOfCols > 0); if (ASCENDING_TRAVERSE(pCond->order)) { assert(pQueryHandle->window.skey <= pQueryHandle->window.ekey); @@ -216,21 +303,19 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab } // allocate buffer in order to load data blocks from file - int32_t numOfCols = pCond->numOfCols; - - pQueryHandle->statis = calloc(numOfCols, sizeof(SDataStatis)); + pQueryHandle->statis = calloc(pCond->numOfCols, sizeof(SDataStatis)); if (pQueryHandle->statis == NULL) { goto out_of_memory; } - pQueryHandle->pColumns = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); // todo: use list instead of array? + pQueryHandle->pColumns = taosArrayInit(pCond->numOfCols, sizeof(SColumnInfoData)); // todo: use list instead of array? if (pQueryHandle->pColumns == NULL) { goto out_of_memory; } - for (int32_t i = 0; i < numOfCols; ++i) { + for (int32_t i = 0; i < pCond->numOfCols; ++i) { SColumnInfoData colInfo = {{0}, 0}; - + colInfo.info = pCond->colList[i]; colInfo.pData = calloc(1, EXTRA_BYTES + pQueryHandle->outputCapacity * pCond->colList[i].bytes); if (colInfo.pData == NULL) { @@ -240,61 +325,47 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab pQueryHandle->statis[i].colId = colInfo.info.colId; } - pQueryHandle->pTableCheckInfo = taosArrayInit(groupList->numOfTables, sizeof(STableCheckInfo)); - if (pQueryHandle->pTableCheckInfo == NULL) { - goto out_of_memory; - } + pQueryHandle->defaultLoadColumn = getDefaultLoadColumns(pQueryHandle, true); STsdbMeta* pMeta = tsdbGetMeta(tsdb); - assert(pMeta != NULL && sizeOfGroup >= 1 && pCond != NULL && pCond->numOfCols > 0); - - // todo apply the lastkey of table check to avoid to load header file - for (int32_t i = 0; i < sizeOfGroup; ++i) { - SArray* group = *(SArray**) taosArrayGet(groupList->pGroupList, i); - - size_t gsize = taosArrayGetSize(group); - assert(gsize > 0); - - for (int32_t j = 0; j < gsize; ++j) { - STableKeyInfo* pKeyInfo = (STableKeyInfo*) taosArrayGet(group, j); - - STableCheckInfo info = { .lastKey = pKeyInfo->lastKey, .pTableObj = pKeyInfo->pTable }; - info.tableId = ((STable*)(pKeyInfo->pTable))->tableId; + assert(pMeta != NULL); - assert(info.pTableObj != NULL && (info.pTableObj->type == TSDB_NORMAL_TABLE || - info.pTableObj->type == TSDB_CHILD_TABLE || info.pTableObj->type == TSDB_STREAM_TABLE)); - - info.tableId.tid = info.pTableObj->tableId.tid; - info.tableId.uid = info.pTableObj->tableId.uid; - - if (ASCENDING_TRAVERSE(pQueryHandle->order)) { - assert(info.lastKey >= pQueryHandle->window.skey); - } else { - assert(info.lastKey <= pQueryHandle->window.skey); - } - - taosArrayPush(pQueryHandle->pTableCheckInfo, &info); - tsdbDebug("%p check table uid:%"PRId64", tid:%d from lastKey:%"PRId64" %p", pQueryHandle, info.tableId.uid, - info.tableId.tid, info.lastKey, qinfo); - } + pQueryHandle->pDataCols = tdNewDataCols(pMeta->maxRowBytes, pMeta->maxCols, pQueryHandle->pTsdb->config.maxRowsPerFileBlock); + if (pQueryHandle->pDataCols == NULL) { + tsdbError("%p failed to malloc buf for pDataCols, %p", pQueryHandle, pQueryHandle->qinfo); + terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; + goto out_of_memory; } - - taosArraySort(pQueryHandle->pTableCheckInfo, tsdbCheckInfoCompar); - pQueryHandle->defaultLoadColumn = getDefaultLoadColumns(pQueryHandle, true); - - tsdbDebug("%p total numOfTable:%" PRIzu " in query, %p", pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qinfo); tsdbInitDataBlockLoadInfo(&pQueryHandle->dataBlockLoadInfo); tsdbInitCompBlockLoadInfo(&pQueryHandle->compBlockLoadInfo); return (TsdbQueryHandleT) pQueryHandle; -out_of_memory: + out_of_memory: tsdbCleanupQueryHandle(pQueryHandle); terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; return NULL; } +TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STableGroupInfo* groupList, void* qinfo) { + STsdbQueryHandle* pQueryHandle = tsdbQueryTablesImpl(tsdb, pCond, qinfo); + + STsdbMeta* pMeta = tsdbGetMeta(tsdb); + assert(pMeta != NULL); + + // todo apply the lastkey of table check to avoid to load header file + pQueryHandle->pTableCheckInfo = createCheckInfoFromTableGroup(pQueryHandle, groupList, pMeta); + if (pQueryHandle->pTableCheckInfo == NULL) { + tsdbCleanupQueryHandle(pQueryHandle); + terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; + return NULL; + } + + tsdbDebug("%p total numOfTable:%" PRIzu " in query, %p", pQueryHandle, taosArrayGetSize(pQueryHandle->pTableCheckInfo), pQueryHandle->qinfo); + return (TsdbQueryHandleT) pQueryHandle; +} + TsdbQueryHandleT tsdbQueryLastRow(TSDB_REPO_T *tsdb, STsdbQueryCond *pCond, STableGroupInfo *groupList, void* qinfo) { pCond->twindow = changeTableGroupByLastrow(groupList); @@ -689,22 +760,10 @@ static int32_t getFileCompInfo(STsdbQueryHandle* pQueryHandle, int32_t* numOfBlo } static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlock, STableCheckInfo* pCheckInfo, int32_t slotIndex) { - STsdbRepo *pRepo = pQueryHandle->pTsdb; - int64_t st = taosGetTimestampUs(); - - if (pCheckInfo->pDataCols == NULL) { - STsdbMeta* pMeta = tsdbGetMeta(pRepo); - - pCheckInfo->pDataCols = tdNewDataCols(pMeta->maxRowBytes, pMeta->maxCols, pRepo->config.maxRowsPerFileBlock); - if (pCheckInfo->pDataCols == NULL) { - tsdbError("%p failed to malloc buf for pDataCols, %p", pQueryHandle, pQueryHandle->qinfo); - terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; - goto _error; - } - } + int64_t st = taosGetTimestampUs(); - STSchema* pSchema = tsdbGetTableSchema(pCheckInfo->pTableObj); - int32_t code = tdInitDataCols(pCheckInfo->pDataCols, pSchema); + STSchema *pSchema = tsdbGetTableSchema(pCheckInfo->pTableObj); + int32_t code = tdInitDataCols(pQueryHandle->pDataCols, pSchema); if (code != TSDB_CODE_SUCCESS) { tsdbError("%p failed to malloc buf for pDataCols, %p", pQueryHandle, pQueryHandle->qinfo); terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; @@ -1924,77 +1983,34 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) { pQueryHandle->type = TSDB_QUERY_TYPE_ALL; return true; } else { - STsdbQueryHandle* pSecQueryHandle = calloc(1, sizeof(STsdbQueryHandle)); - if (pSecQueryHandle == NULL) { - terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; + STimeWindow win = (STimeWindow) {pQueryHandle->window.skey, INT64_MAX}; + STsdbQueryCond cond = { + .order = TSDB_ORDER_ASC, + .numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle)) + }; + cond.twindow = win; + + cond.colList = calloc(cond.numOfCols, sizeof(SColumnInfo)); + if (cond.colList == NULL) { + terrno = TSDB_CODE_QRY_OUT_OF_MEMORY; return false; } - pSecQueryHandle->order = TSDB_ORDER_ASC; - pSecQueryHandle->window = (STimeWindow) {pQueryHandle->window.skey, INT64_MAX}; - pSecQueryHandle->pTsdb = pQueryHandle->pTsdb; - pSecQueryHandle->type = TSDB_QUERY_TYPE_ALL; - pSecQueryHandle->cur.fid = -1; - pSecQueryHandle->cur.win = TSWINDOW_INITIALIZER; - pSecQueryHandle->checkFiles = true; - pSecQueryHandle->activeIndex = 0; - pSecQueryHandle->outputCapacity = ((STsdbRepo*)pSecQueryHandle->pTsdb)->config.maxRowsPerFileBlock; - - if (tsdbInitReadHelper(&pSecQueryHandle->rhelper, (STsdbRepo*) pSecQueryHandle->pTsdb) != 0) { - terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; - free(pSecQueryHandle); - return false; + for(int32_t i = 0; i < cond.numOfCols; ++i) { + SColumnInfoData* pColInfoData = taosArrayGet(pQueryHandle->pColumns, i); + memcpy(&cond.colList[i], &pColInfoData->info, sizeof(SColumnInfo)); } - tsdbTakeMemSnapshot(pSecQueryHandle->pTsdb, &pSecQueryHandle->mem, &pSecQueryHandle->imem); + STsdbQueryHandle* pSecQueryHandle = tsdbQueryTablesImpl(pQueryHandle->pTsdb, &cond, pQueryHandle->qinfo); - // allocate buffer in order to load data blocks from file - int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle)); + taosTFree(cond.colList); - pSecQueryHandle->statis = calloc(numOfCols, sizeof(SDataStatis)); - pSecQueryHandle->pColumns = taosArrayInit(numOfCols, sizeof(SColumnInfoData)); - if (pSecQueryHandle->statis == NULL || pSecQueryHandle->pColumns == NULL) { - terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; + pSecQueryHandle->pTableCheckInfo = createCheckInfoFromCheckInfo(pQueryHandle->pTableCheckInfo, pSecQueryHandle->window.skey); + if (pSecQueryHandle->pTableCheckInfo == NULL) { tsdbCleanupQueryHandle(pSecQueryHandle); return false; } - for (int32_t i = 0; i < numOfCols; ++i) { - SColumnInfoData colInfo = {{0}, 0}; - SColumnInfoData* pCol = taosArrayGet(pQueryHandle->pColumns, i); - - colInfo.info = pCol->info; - colInfo.pData = calloc(1, EXTRA_BYTES + pQueryHandle->outputCapacity * pCol->info.bytes); - if (colInfo.pData == NULL) { - terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; - tsdbCleanupQueryHandle(pSecQueryHandle); - return false; - } - - taosArrayPush(pSecQueryHandle->pColumns, &colInfo); - } - - size_t si = taosArrayGetSize(pQueryHandle->pTableCheckInfo); - pSecQueryHandle->pTableCheckInfo = taosArrayInit(si, sizeof(STableCheckInfo)); - STsdbMeta* pMeta = tsdbGetMeta(pQueryHandle->pTsdb); - assert(pMeta != NULL); - - for (int32_t j = 0; j < si; ++j) { - STableCheckInfo* pCheckInfo = (STableCheckInfo*) taosArrayGet(pQueryHandle->pTableCheckInfo, j); - STableCheckInfo info = { - .lastKey = pSecQueryHandle->window.skey, - .pTableObj = pCheckInfo->pTableObj, - }; - - info.tableId = pCheckInfo->tableId; - - taosArrayPush(pSecQueryHandle->pTableCheckInfo, &info); - } - - tsdbInitDataBlockLoadInfo(&pSecQueryHandle->dataBlockLoadInfo); - tsdbInitCompBlockLoadInfo(&pSecQueryHandle->compBlockLoadInfo); - pSecQueryHandle->defaultLoadColumn = taosArrayClone(pQueryHandle->defaultLoadColumn); - if (!tsdbNextDataBlock((void*) pSecQueryHandle)) { tsdbCleanupQueryHandle(pSecQueryHandle); return false; @@ -2003,6 +2019,9 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) { tsdbRetrieveDataBlockInfo((void*) pSecQueryHandle, &blockInfo); tsdbRetrieveDataBlock((void*) pSecQueryHandle, pSecQueryHandle->defaultLoadColumn); + int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pSecQueryHandle)); + size_t si = taosArrayGetSize(pSecQueryHandle->pTableCheckInfo); + for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pCol = taosArrayGet(pQueryHandle->pColumns, i); memcpy((char*)pCol->pData, (char*)pCol->pData + pCol->info.bytes * (pQueryHandle->cur.rows - 1), pCol->info.bytes); @@ -2016,11 +2035,11 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) { SColumnInfoData* pTSCol = taosArrayGet(pQueryHandle->pColumns, 0); // it is ascending order - pQueryHandle->cur.win = (STimeWindow){((TSKEY*)pTSCol->pData)[0], ((TSKEY*)pTSCol->pData)[1]}; + pQueryHandle->order = TSDB_ORDER_DESC; pQueryHandle->window = pQueryHandle->cur.win; + pQueryHandle->cur.win = (STimeWindow){((TSKEY*)pTSCol->pData)[0], ((TSKEY*)pTSCol->pData)[1]}; pQueryHandle->cur.rows = 2; pQueryHandle->cur.mixBlock = true; - pQueryHandle->order = TSDB_ORDER_DESC; int32_t step = -1;// one step for ascending order traverse for (int32_t j = 0; j < si; ++j) { @@ -2284,7 +2303,7 @@ void filterPrepare(void* expr, void* param) { if (pInfo->optr == TSDB_RELATION_IN) { pInfo->q = (char*) pCond->arr; } else { - pInfo->q = calloc(1, pSchema->bytes); + pInfo->q = calloc(1, pSchema->bytes + TSDB_NCHAR_SIZE); // to make sure tonchar does not cause invalid write, since the '\0' needs at least sizeof(wchar_t) space. tVariantDump(pCond, pInfo->q, pSchema->type, true); } } @@ -2639,8 +2658,7 @@ int32_t tsdbGetTableGroupFromIdList(TSDB_REPO_T* tsdb, SArray* pTableIdList, STa pGroupInfo->pGroupList = taosArrayInit(1, POINTER_BYTES); SArray* group = taosArrayInit(1, sizeof(STableKeyInfo)); - int32_t i = 0; - for(; i < size; ++i) { + for(int32_t i = 0; i < size; ++i) { STableIdInfo *id = taosArrayGet(pTableIdList, i); STable* pTable = tsdbGetTableByUid(tsdbGetMeta(tsdb), id->uid); @@ -2665,8 +2683,12 @@ int32_t tsdbGetTableGroupFromIdList(TSDB_REPO_T* tsdb, SArray* pTableIdList, STa return terrno; } - pGroupInfo->numOfTables = i; - taosArrayPush(pGroupInfo->pGroupList, &group); + pGroupInfo->numOfTables = taosArrayGetSize(group); + if (pGroupInfo->numOfTables > 0) { + taosArrayPush(pGroupInfo->pGroupList, &group); + } else { + taosArrayDestroy(group); + } return TSDB_CODE_SUCCESS; } @@ -2683,8 +2705,6 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) { STableCheckInfo* pTableCheckInfo = taosArrayGet(pQueryHandle->pTableCheckInfo, i); destroyTableMemIterator(pTableCheckInfo); - tdFreeDataCols(pTableCheckInfo->pDataCols); - pTableCheckInfo->pDataCols = NULL; taosTFree(pTableCheckInfo->pCompInfo); } taosArrayDestroy(pQueryHandle->pTableCheckInfo); @@ -2704,10 +2724,13 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) { taosTFree(pQueryHandle->statis); // todo check error - tsdbUnTakeMemSnapShot(pQueryHandle->pTsdb, pQueryHandle->mem, pQueryHandle->imem); + tsdbMayUnTakeMemSnapshot(pQueryHandle); tsdbDestroyHelper(&pQueryHandle->rhelper); + tdFreeDataCols(pQueryHandle->pDataCols); + pQueryHandle->pDataCols = NULL; + SIOCostSummary* pCost = &pQueryHandle->cost; tsdbDebug("%p :io-cost summary: statis-info:%"PRId64" us, datablock:%" PRId64" us, check data:%"PRId64" us, %p", pQueryHandle, pCost->statisInfoLoadTime, pCost->blockLoadTime, pCost->checkForNextTime, pQueryHandle->qinfo); diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 2637699adb1c6b7508418fe10e189ff37a969b2a..6e20c1708dfc81728c6b961b9259d50e953b4b9d 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -107,12 +107,14 @@ static FORCE_INLINE void taosCacheReleaseNode(SCacheObj *pCacheObj, SCacheDataNo free(pNode); } -static FORCE_INLINE void doRemoveElemInTrashcan(SCacheObj* pCacheObj, STrashElem *pElem) { +static FORCE_INLINE STrashElem* doRemoveElemInTrashcan(SCacheObj* pCacheObj, STrashElem *pElem) { if (pElem->pData->signature != (uint64_t) pElem->pData) { uWarn("key:sig:0x%" PRIx64 " %p data has been released, ignore", pElem->pData->signature, pElem->pData); - return; + return NULL; } + STrashElem* next = pElem->next; + pCacheObj->numOfElemsInTrash--; if (pElem->prev) { pElem->prev->next = pElem->next; @@ -120,9 +122,15 @@ static FORCE_INLINE void doRemoveElemInTrashcan(SCacheObj* pCacheObj, STrashElem pCacheObj->pTrash = pElem->next; } - if (pElem->next) { - pElem->next->prev = pElem->prev; + if (next) { + next->prev = pElem->prev; + } + + if (pCacheObj->numOfElemsInTrash == 0) { + assert(pCacheObj->pTrash == NULL); } + + return next; } static FORCE_INLINE void doDestroyTrashcanElem(SCacheObj* pCacheObj, STrashElem *pElem) { @@ -550,8 +558,8 @@ void taosAddToTrashcan(SCacheObj *pCacheObj, SCacheDataNode *pNode) { pCacheObj->numOfElemsInTrash++; __cache_unlock(pCacheObj); - uDebug("cache:%s key:%p, %p move to trashcan, numOfElem in trashcan:%d", pCacheObj->name, pNode->key, pNode->data, - pCacheObj->numOfElemsInTrash); + uDebug("cache:%s key:%p, %p move to trashcan, pTrashElem:%p, numOfElem in trashcan:%d", pCacheObj->name, + pNode->key, pNode->data, pElem, pCacheObj->numOfElemsInTrash); } void taosTrashcanEmpty(SCacheObj *pCacheObj, bool force) { @@ -559,31 +567,30 @@ void taosTrashcanEmpty(SCacheObj *pCacheObj, bool force) { if (pCacheObj->numOfElemsInTrash == 0) { if (pCacheObj->pTrash != NULL) { + pCacheObj->pTrash = NULL; uError("cache:%s, key:inconsistency data in cache, numOfElem in trashcan:%d", pCacheObj->name, pCacheObj->numOfElemsInTrash); } - pCacheObj->pTrash = NULL; __cache_unlock(pCacheObj); return; } - STrashElem *pElem = pCacheObj->pTrash; + const char* stat[] = {"false", "true"}; + uDebug("cache:%s start to cleanup trashcan, numOfElem in trashcan:%d, free:%s", pCacheObj->name, + pCacheObj->numOfElemsInTrash, (force? stat[1]:stat[0])); + STrashElem *pElem = pCacheObj->pTrash; while (pElem) { T_REF_VAL_CHECK(pElem->pData); - if (pElem->next == pElem) { - pElem->next = NULL; - } + assert(pElem->next != pElem && pElem->prev != pElem); if (force || (T_REF_VAL_GET(pElem->pData) == 0)) { uDebug("cache:%s, key:%p, %p removed from trashcan. numOfElem in trashcan:%d", pCacheObj->name, pElem->pData->key, pElem->pData->data, pCacheObj->numOfElemsInTrash - 1); - STrashElem *p = pElem; - pElem = pElem->next; - - doRemoveElemInTrashcan(pCacheObj, p); - doDestroyTrashcanElem(pCacheObj, p); + doRemoveElemInTrashcan(pCacheObj, pElem); + doDestroyTrashcanElem(pCacheObj, pElem); + pElem = pCacheObj->pTrash; } else { pElem = pElem->next; } diff --git a/src/util/src/tqueue.c b/src/util/src/tqueue.c index 8c6d6243eb4f677e9a5436b4449e07df011d2b52..d3c17e7626c4566df32c1e4257bda1a4e68a200a 100644 --- a/src/util/src/tqueue.c +++ b/src/util/src/tqueue.c @@ -263,6 +263,7 @@ void taosCloseQset(taos_qset param) { // thread to exit. void taosQsetThreadResume(taos_qset param) { STaosQset *qset = (STaosQset *)param; + uDebug("qset:%p, it will exit", qset); tsem_post(&qset->sem); } diff --git a/src/vnode/CMakeLists.txt b/src/vnode/CMakeLists.txt index 09cfa632fbfaaa77b32c09b49f051c0714b33564..de0cdb028b5f9231f57c78fa3411714c93de85c7 100644 --- a/src/vnode/CMakeLists.txt +++ b/src/vnode/CMakeLists.txt @@ -4,6 +4,7 @@ PROJECT(TDengine) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/query/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/tsdb/inc) INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/dnode/inc) +INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/sync/inc) INCLUDE_DIRECTORIES(${TD_ENTERPRISE_DIR}/src/inc) INCLUDE_DIRECTORIES(inc) AUX_SOURCE_DIRECTORY(src SRC) diff --git a/src/vnode/inc/vnodeInt.h b/src/vnode/inc/vnodeInt.h index 38f7c8e6056644591993027b410283b41fb8560c..169334c6119a35f53fd0a69dd1f7cb6952fbb727 100644 --- a/src/vnode/inc/vnodeInt.h +++ b/src/vnode/inc/vnodeInt.h @@ -62,6 +62,7 @@ typedef struct { } SVnodeObj; int vnodeWriteToQueue(void *param, void *pHead, int type); +int vnodeWriteCqMsgToQueue(void *param, void *pHead, int type); void vnodeInitWriteFp(void); void vnodeInitReadFp(void); diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index d89c383d6a4147ae6a2501fca0c73481f1a437f0..e529f27f55abe99e0a842fb839f2916a0f303bfc 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -56,6 +56,14 @@ int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; } void syncConfirmForward(tsync_h shandle, uint64_t version, int32_t code) {} #endif +char* vnodeStatus[] = { + "init", + "ready", + "closing", + "updating", + "reset" +}; + int32_t vnodeInitResources() { int code = syncInit(); if (code != 0) return code; @@ -74,6 +82,7 @@ int32_t vnodeInitResources() { void vnodeCleanupResources() { if (tsDnodeVnodesHash != NULL) { + vDebug("vnode list is cleanup"); taosHashCleanup(tsDnodeVnodesHash); tsDnodeVnodesHash = NULL; } @@ -84,9 +93,10 @@ void vnodeCleanupResources() { int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { int32_t code; - SVnodeObj *pTemp = (SVnodeObj *)taosHashGet(tsDnodeVnodesHash, (const char *)&pVnodeCfg->cfg.vgId, sizeof(int32_t)); - if (pTemp != NULL) { - vInfo("vgId:%d, vnode already exist, pVnode:%p", pVnodeCfg->cfg.vgId, pTemp); + SVnodeObj *pVnode = vnodeAcquire(pVnodeCfg->cfg.vgId); + if (pVnode != NULL) { + vDebug("vgId:%d, vnode already exist, refCount:%d pVnode:%p", pVnodeCfg->cfg.vgId, pVnode->refCount, pVnode); + vnodeRelease(pVnode); return TSDB_CODE_SUCCESS; } @@ -143,22 +153,24 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) { return TSDB_CODE_VND_INIT_FAILED; } - vInfo("vgId:%d, vnode is created, walLevel:%d fsyncPeriod:%d", pVnodeCfg->cfg.vgId, pVnodeCfg->cfg.walLevel, pVnodeCfg->cfg.fsyncPeriod); + vInfo("vgId:%d, vnode dir is created, walLevel:%d fsyncPeriod:%d", pVnodeCfg->cfg.vgId, pVnodeCfg->cfg.walLevel, + pVnodeCfg->cfg.fsyncPeriod); code = vnodeOpen(pVnodeCfg->cfg.vgId, rootDir); return code; } int32_t vnodeDrop(int32_t vgId) { - SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t)); - if (ppVnode == NULL || *ppVnode == NULL) { - vDebug("vgId:%d, failed to drop, vgId not find", vgId); + SVnodeObj *pVnode = vnodeAcquire(vgId); + if (pVnode == NULL) { + vDebug("vgId:%d, failed to drop, vnode not find", vgId); return TSDB_CODE_VND_INVALID_VGROUP_ID; } - SVnodeObj *pVnode = *ppVnode; - vTrace("vgId:%d, vnode will be dropped, refCount:%d", pVnode->vgId, pVnode->refCount); + vInfo("vgId:%d, vnode will be dropped, refCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); pVnode->dropped = 1; + + vnodeRelease(pVnode); vnodeCleanUp(pVnode); return TSDB_CODE_SUCCESS; @@ -239,8 +251,10 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { code = vnodeReadVersion(pVnode); if (code != TSDB_CODE_SUCCESS) { - vnodeCleanUp(pVnode); - return code; + vError("vgId:%d, failed to read version, generate it from data file", pVnode->vgId); + // Allow vnode start even when read version fails, set version as walVersion or zero + // vnodeCleanUp(pVnode); + // return code; } pVnode->fversion = pVnode->version; @@ -257,7 +271,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { strcpy(cqCfg.pass, tsInternalPass); strcpy(cqCfg.db, pVnode->db); cqCfg.vgId = vnode; - cqCfg.cqWrite = vnodeWriteToQueue; + cqCfg.cqWrite = vnodeWriteCqMsgToQueue; pVnode->cq = cqOpen(pVnode, &cqCfg); if (pVnode->cq == NULL) { vnodeCleanUp(pVnode); @@ -292,6 +306,9 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { } walRestore(pVnode->wal, pVnode, vnodeWriteToQueue); + if (pVnode->version == 0) { + pVnode->version = walGetVersion(pVnode->wal); + } SSyncInfo syncInfo; syncInfo.vgId = pVnode->vgId; @@ -335,11 +352,11 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) { } int32_t vnodeClose(int32_t vgId) { - SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t)); - if (ppVnode == NULL || *ppVnode == NULL) return 0; + SVnodeObj *pVnode = vnodeAcquire(vgId); + if (pVnode == NULL) return 0; - SVnodeObj *pVnode = *ppVnode; - vDebug("vgId:%d, vnode will be closed", pVnode->vgId); + vDebug("vgId:%d, vnode will be closed, pVnode:%p", pVnode->vgId, pVnode); + vnodeRelease(pVnode); vnodeCleanUp(pVnode); return 0; @@ -350,21 +367,27 @@ void vnodeRelease(void *pVnodeRaw) { int32_t vgId = pVnode->vgId; int32_t refCount = atomic_sub_fetch_32(&pVnode->refCount, 1); + vTrace("vgId:%d, release vnode, refCount:%d pVnode:%p", vgId, refCount, pVnode); assert(refCount >= 0); if (refCount > 0) { - vDebug("vgId:%d, release vnode, refCount:%d", vgId, refCount); - if (pVnode->status == TAOS_VN_STATUS_RESET && refCount == 2) + if (pVnode->status == TAOS_VN_STATUS_RESET && refCount == 2) { tsem_post(&pVnode->sem); + } return; } - qCleanupQueryMgmt(pVnode->qMgmt); - pVnode->qMgmt = NULL; + vDebug("vgId:%d, vnode will be destroyed, refCount:%d pVnode:%p", vgId, refCount, pVnode); + + if (pVnode->qMgmt) { + qCleanupQueryMgmt(pVnode->qMgmt); + pVnode->qMgmt = NULL; + } - if (pVnode->tsdb) + if (pVnode->tsdb) { tsdbCloseRepo(pVnode->tsdb, 1); - pVnode->tsdb = NULL; + pVnode->tsdb = NULL; + } // stop continuous query if (pVnode->cq) { @@ -373,18 +396,21 @@ void vnodeRelease(void *pVnodeRaw) { cqClose(cq); } - if (pVnode->wal) + if (pVnode->wal) { walClose(pVnode->wal); - pVnode->wal = NULL; + pVnode->wal = NULL; + } - if (pVnode->wqueue) + if (pVnode->wqueue) { dnodeFreeVnodeWqueue(pVnode->wqueue); - pVnode->wqueue = NULL; + pVnode->wqueue = NULL; + } - if (pVnode->rqueue) + if (pVnode->rqueue) { dnodeFreeVnodeRqueue(pVnode->rqueue); - pVnode->rqueue = NULL; - + pVnode->rqueue = NULL; + } + taosTFree(pVnode->rootDir); if (pVnode->dropped) { @@ -408,31 +434,41 @@ void vnodeRelease(void *pVnodeRaw) { free(pVnode); int32_t count = taosHashGetSize(tsDnodeVnodesHash); - vDebug("vgId:%d, vnode is released, vnodes:%d", vgId, count); + vDebug("vgId:%d, vnode is destroyed, vnodes:%d", vgId, count); +} + +static void vnodeIncRef(void *ptNode) { + assert(ptNode != NULL); + + SVnodeObj **ppVnode = (SVnodeObj **)ptNode; + assert(ppVnode); + assert(*ppVnode); + + SVnodeObj *pVnode = *ppVnode; + atomic_add_fetch_32(&pVnode->refCount, 1); + vTrace("vgId:%d, get vnode, refCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); } void *vnodeAcquire(int32_t vgId) { - SVnodeObj **ppVnode = (SVnodeObj **)taosHashGet(tsDnodeVnodesHash, (const char *)&vgId, sizeof(int32_t)); + SVnodeObj **ppVnode = taosHashGetCB(tsDnodeVnodesHash, &vgId, sizeof(int32_t), vnodeIncRef, NULL, sizeof(void *)); + if (ppVnode == NULL || *ppVnode == NULL) { terrno = TSDB_CODE_VND_INVALID_VGROUP_ID; - vInfo("vgId:%d, not exist", vgId); + vDebug("vgId:%d, not exist", vgId); return NULL; } - SVnodeObj *pVnode = *ppVnode; - atomic_add_fetch_32(&pVnode->refCount, 1); - vDebug("vgId:%d, get vnode, refCount:%d", pVnode->vgId, pVnode->refCount); - - return pVnode; + return *ppVnode; } void *vnodeAcquireRqueue(int32_t vgId) { SVnodeObj *pVnode = vnodeAcquire(vgId); if (pVnode == NULL) return NULL; - if (pVnode->status == TAOS_VN_STATUS_RESET) { - terrno = TSDB_CODE_APP_NOT_READY; - vInfo("vgId:%d, status is in reset", vgId); + int32_t code = vnodeCheckRead(pVnode); + if (code != TSDB_CODE_SUCCESS) { + terrno = code; + vInfo("vgId:%d, can not provide read service, status is %s", vgId, vnodeStatus[pVnode->status]); vnodeRelease(pVnode); return NULL; } @@ -444,13 +480,14 @@ void *vnodeAcquireWqueue(int32_t vgId) { SVnodeObj *pVnode = vnodeAcquire(vgId); if (pVnode == NULL) return NULL; - if (pVnode->status == TAOS_VN_STATUS_RESET) { - terrno = TSDB_CODE_APP_NOT_READY; - vInfo("vgId:%d, status is in reset", vgId); + int32_t code = vnodeCheckWrite(pVnode); + if (code != TSDB_CODE_SUCCESS) { + terrno = code; + vInfo("vgId:%d, can not provide write service, status is %s", vgId, vnodeStatus[pVnode->status]); vnodeRelease(pVnode); return NULL; } - + return pVnode->wqueue; } @@ -523,7 +560,7 @@ void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes) { if (pVnode != NULL) { pVnode->accessState = pAccess[i].accessState; if (pVnode->accessState != TSDB_VN_ALL_ACCCESS) { - vDebug("vgId:%d, access state is set to %d", pAccess[i].vgId, pVnode->accessState) + vDebug("vgId:%d, access state is set to %d", pAccess[i].vgId, pVnode->accessState); } vnodeRelease(pVnode); } @@ -533,11 +570,12 @@ void vnodeSetAccess(SDMVgroupAccess *pAccess, int32_t numOfVnodes) { static void vnodeCleanUp(SVnodeObj *pVnode) { // remove from hash, so new messages wont be consumed taosHashRemove(tsDnodeVnodesHash, (const char *)&pVnode->vgId, sizeof(int32_t)); - int i = 0; if (pVnode->status != TAOS_VN_STATUS_INIT) { // it may be in updateing or reset state, then it shall wait - while (atomic_val_compare_exchange_8(&pVnode->status, TAOS_VN_STATUS_READY, TAOS_VN_STATUS_CLOSING) != TAOS_VN_STATUS_READY) { + int i = 0; + while (atomic_val_compare_exchange_8(&pVnode->status, TAOS_VN_STATUS_READY, TAOS_VN_STATUS_CLOSING) != + TAOS_VN_STATUS_READY) { if (++i % 1000 == 0) { sched_yield(); } @@ -551,7 +589,7 @@ static void vnodeCleanUp(SVnodeObj *pVnode) { syncStop(sync); } - vTrace("vgId:%d, vnode will cleanup, refCount:%d", pVnode->vgId, pVnode->refCount); + vDebug("vgId:%d, vnode will cleanup, refCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); // release local resources only after cutting off outside connections qQueryMgmtNotifyClosed(pVnode->qMgmt); @@ -608,17 +646,19 @@ static int vnodeResetTsdb(SVnodeObj *pVnode) char rootDir[128] = "\0"; sprintf(rootDir, "%s/tsdb", pVnode->rootDir); - if (atomic_val_compare_exchange_8(&pVnode->status, TAOS_VN_STATUS_READY, TAOS_VN_STATUS_RESET) != TAOS_VN_STATUS_READY) + if (atomic_val_compare_exchange_8(&pVnode->status, TAOS_VN_STATUS_READY, TAOS_VN_STATUS_RESET) != TAOS_VN_STATUS_READY) { return -1; + } void *tsdb = pVnode->tsdb; pVnode->tsdb = NULL; // acquire vnode - int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); + int32_t refCount = atomic_add_fetch_32(&pVnode->refCount, 1); - if (refCount > 2) + if (refCount > 2) { tsem_wait(&pVnode->sem); + } // close tsdb, then open tsdb tsdbCloseRepo(tsdb, 0); @@ -947,6 +987,7 @@ static int32_t vnodeSaveVersion(SVnodeObj *pVnode) { len += snprintf(content + len, maxLen - len, "}\n"); fwrite(content, 1, len, fp); + fflush(fp); fclose(fp); vInfo("vgId:%d, save vnode version:%" PRId64 " succeed", pVnode->vgId, pVnode->fversion); @@ -960,7 +1001,7 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) { cJSON *root = NULL; int maxLen = 100; - terrno = TSDB_CODE_VND_APP_ERROR; + terrno = TSDB_CODE_VND_INVALID_VRESION_FILE; sprintf(versionFile, "%s/vnode%d/version.json", tsVnodeDir, pVnode->vgId); FILE *fp = fopen(versionFile, "r"); if (!fp) { @@ -974,7 +1015,7 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) { } content = calloc(1, maxLen + 1); - int len = fread(content, 1, maxLen, fp); + int len = fread(content, 1, maxLen, fp); if (len <= 0) { vError("vgId:%d, failed to read vnode version, content is null", pVnode->vgId); goto PARSE_OVER; @@ -999,6 +1040,6 @@ static int32_t vnodeReadVersion(SVnodeObj *pVnode) { PARSE_OVER: taosTFree(content); cJSON_Delete(root); - if(fp) fclose(fp); + if (fp) fclose(fp); return terrno; } diff --git a/src/vnode/src/vnodeRead.c b/src/vnode/src/vnodeRead.c index 58e97075ac3f98197a6b6e17ac135d8bf9405b66..1da84bf9b41c1bfc011a97cb0c06a71795a204b0 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -14,7 +14,8 @@ */ #define _DEFAULT_SOURCE -//#include +#define _NON_BLOCKING_RETRIEVE 0 + #include "os.h" #include "tglobal.h" @@ -38,6 +39,11 @@ void vnodeInitReadFp(void) { vnodeProcessReadMsgFp[TSDB_MSG_TYPE_FETCH] = vnodeProcessFetchMsg; } +// +// After the fetch request enters the vnode queue, if the vnode cannot provide services, the process function are +// still required, or there will be a deadlock, so we don’t do any check here, but put the check codes before the +// request enters the queue +// int32_t vnodeProcessRead(void *param, SReadMsg *pReadMsg) { SVnodeObj *pVnode = (SVnodeObj *)param; int msgType = pReadMsg->rpcMsg.msgType; @@ -47,48 +53,72 @@ int32_t vnodeProcessRead(void *param, SReadMsg *pReadMsg) { return TSDB_CODE_VND_MSG_NOT_PROCESSED; } + return (*vnodeProcessReadMsgFp[msgType])(pVnode, pReadMsg); +} + +int32_t vnodeCheckRead(void *param) { + SVnodeObj *pVnode = param; if (pVnode->status != TAOS_VN_STATUS_READY) { - vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[msgType], pVnode->status); - return TSDB_CODE_APP_NOT_READY; + vDebug("vgId:%d, vnode status is %s, recCount:%d pVnode:%p", pVnode->vgId, vnodeStatus[pVnode->status], + pVnode->refCount, pVnode); + return TSDB_CODE_APP_NOT_READY; } - // tsdb may be in reset state - if (pVnode->tsdb == NULL) return TSDB_CODE_APP_NOT_READY; - if (pVnode->status == TAOS_VN_STATUS_CLOSING) + // tsdb may be in reset state + if (pVnode->tsdb == NULL) { + vDebug("vgId:%d, tsdb is null, recCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); return TSDB_CODE_APP_NOT_READY; + } - // TODO: Later, let slave to support query - // if (pVnode->syncCfg.replica > 1 && pVnode->role != TAOS_SYNC_ROLE_MASTER) { - if (pVnode->role != TAOS_SYNC_ROLE_SLAVE && pVnode->role != TAOS_SYNC_ROLE_MASTER) { - vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[msgType], pVnode->syncCfg.replica, pVnode->role); + if (pVnode->role != TAOS_SYNC_ROLE_SLAVE && pVnode->role != TAOS_SYNC_ROLE_MASTER) { + vDebug("vgId:%d, replica:%d role:%s, recCount:%d pVnode:%p", pVnode->vgId, pVnode->syncCfg.replica, + syncRole[pVnode->role], pVnode->refCount, pVnode); return TSDB_CODE_APP_NOT_READY; } - return (*vnodeProcessReadMsgFp[msgType])(pVnode, pReadMsg); + return TSDB_CODE_SUCCESS; } +static int32_t vnodePutItemIntoReadQueue(SVnodeObj *pVnode, void **qhandle, void *ahandle) { + int32_t code = vnodeCheckRead(pVnode); + if (code != TSDB_CODE_SUCCESS) return code; -static void vnodePutItemIntoReadQueue(SVnodeObj *pVnode, void **qhandle) { SReadMsg *pRead = (SReadMsg *)taosAllocateQitem(sizeof(SReadMsg)); pRead->rpcMsg.msgType = TSDB_MSG_TYPE_QUERY; pRead->pCont = qhandle; pRead->contLen = 0; - pRead->rpcMsg.handle = NULL; + pRead->rpcMsg.ahandle = ahandle; atomic_add_fetch_32(&pVnode->refCount, 1); vDebug("QInfo:%p add to vread queue for exec query, msg:%p", *qhandle, pRead); taosWriteQitem(pVnode->rqueue, TAOS_QTYPE_QUERY, pRead); + + return TSDB_CODE_SUCCESS; } -static int32_t vnodeDumpQueryResult(SRspRet *pRet, void* pVnode, void** handle, bool* freeHandle) { +/** + * + * @param pRet response message object + * @param pVnode the vnode object + * @param handle qhandle for executing query + * @param freeHandle free qhandle or not + * @param ahandle sqlObj address at client side + * @return + */ +static int32_t vnodeDumpQueryResult(SRspRet *pRet, void *pVnode, void **handle, bool *freeHandle, void *ahandle) { bool continueExec = false; int32_t code = TSDB_CODE_SUCCESS; if ((code = qDumpRetrieveResult(*handle, (SRetrieveTableRsp **)&pRet->rsp, &pRet->len, &continueExec)) == TSDB_CODE_SUCCESS) { if (continueExec) { *freeHandle = false; - vnodePutItemIntoReadQueue(pVnode, handle); - pRet->qhandle = *handle; + code = vnodePutItemIntoReadQueue(pVnode, handle, ahandle); + if (code != TSDB_CODE_SUCCESS) { + *freeHandle = true; + return code; + } else { + pRet->qhandle = *handle; + } } else { *freeHandle = true; vDebug("QInfo:%p exec completed, free handle:%d", *handle, *freeHandle); @@ -106,55 +136,56 @@ static int32_t vnodeDumpQueryResult(SRspRet *pRet, void* pVnode, void** handle, return code; } -static void vnodeBuildNoResultQueryRsp(SRspRet* pRet) { +static void vnodeBuildNoResultQueryRsp(SRspRet *pRet) { pRet->rsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp)); pRet->len = sizeof(SRetrieveTableRsp); memset(pRet->rsp, 0, sizeof(SRetrieveTableRsp)); - SRetrieveTableRsp* pRsp = pRet->rsp; + SRetrieveTableRsp *pRsp = pRet->rsp; pRsp->completed = true; } static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { - void *pCont = pReadMsg->pCont; + void * pCont = pReadMsg->pCont; int32_t contLen = pReadMsg->contLen; SRspRet *pRet = &pReadMsg->rspRet; - SQueryTableMsg* pQueryTableMsg = (SQueryTableMsg*) pCont; + SQueryTableMsg *pQueryTableMsg = (SQueryTableMsg *)pCont; memset(pRet, 0, sizeof(SRspRet)); // qHandle needs to be freed correctly if (pReadMsg->rpcMsg.code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { - SRetrieveTableMsg* killQueryMsg = (SRetrieveTableMsg*) pReadMsg->pCont; + SRetrieveTableMsg *killQueryMsg = (SRetrieveTableMsg *)pReadMsg->pCont; killQueryMsg->free = htons(killQueryMsg->free); killQueryMsg->qhandle = htobe64(killQueryMsg->qhandle); - vWarn("QInfo:%p connection %p broken, kill query", (void*) killQueryMsg->qhandle, pReadMsg->rpcMsg.handle); + vWarn("QInfo:%p connection %p broken, kill query", (void *)killQueryMsg->qhandle, pReadMsg->rpcMsg.handle); assert(pReadMsg->rpcMsg.contLen > 0 && killQueryMsg->free == 1); - void** qhandle = qAcquireQInfo(pVnode->qMgmt, (uint64_t) killQueryMsg->qhandle); + void **qhandle = qAcquireQInfo(pVnode->qMgmt, (uint64_t)killQueryMsg->qhandle); if (qhandle == NULL || *qhandle == NULL) { - vWarn("QInfo:%p invalid qhandle, no matched query handle, conn:%p", (void*) killQueryMsg->qhandle, pReadMsg->rpcMsg.handle); + vWarn("QInfo:%p invalid qhandle, no matched query handle, conn:%p", (void *)killQueryMsg->qhandle, + pReadMsg->rpcMsg.handle); } else { - assert(*qhandle == (void*) killQueryMsg->qhandle); + assert(*qhandle == (void *)killQueryMsg->qhandle); qKillQuery(*qhandle); - qReleaseQInfo(pVnode->qMgmt, (void**) &qhandle, true); + qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, true); } return TSDB_CODE_TSC_QUERY_CANCELLED; } int32_t code = TSDB_CODE_SUCCESS; - void** handle = NULL; + void ** handle = NULL; if (contLen != 0) { qinfo_t pQInfo = NULL; code = qCreateQueryInfo(pVnode->tsdb, pVnode->vgId, pQueryTableMsg, &pQInfo); - SQueryTableRsp *pRsp = (SQueryTableRsp *) rpcMallocCont(sizeof(SQueryTableRsp)); - pRsp->code = code; + SQueryTableRsp *pRsp = (SQueryTableRsp *)rpcMallocCont(sizeof(SQueryTableRsp)); + pRsp->code = code; pRsp->qhandle = 0; pRet->len = sizeof(SQueryTableRsp); @@ -163,21 +194,25 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { // current connect is broken if (code == TSDB_CODE_SUCCESS) { - handle = qRegisterQInfo(pVnode->qMgmt, (uint64_t) pQInfo); - if (handle == NULL) { // failed to register qhandle, todo add error test case + handle = qRegisterQInfo(pVnode->qMgmt, (uint64_t)pQInfo); + if (handle == NULL) { // failed to register qhandle + pRsp->code = terrno; + terrno = 0; vError("vgId:%d QInfo:%p register qhandle failed, return to app, code:%s", pVnode->vgId, (void *)pQInfo, tstrerror(pRsp->code)); - pRsp->code = TSDB_CODE_QRY_INVALID_QHANDLE; qDestroyQueryInfo(pQInfo); // destroy it directly + return pRsp->code; } else { assert(*handle == pQInfo); - pRsp->qhandle = htobe64((uint64_t) pQInfo); + pRsp->qhandle = htobe64((uint64_t)pQInfo); } - if (handle != NULL && vnodeNotifyCurrentQhandle(pReadMsg->rpcMsg.handle, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) { - vError("vgId:%d, QInfo:%p, query discarded since link is broken, %p", pVnode->vgId, *handle, pReadMsg->rpcMsg.handle); + if (handle != NULL && + vnodeNotifyCurrentQhandle(pReadMsg->rpcMsg.handle, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) { + vError("vgId:%d, QInfo:%p, query discarded since link is broken, %p", pVnode->vgId, *handle, + pReadMsg->rpcMsg.handle); pRsp->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - qReleaseQInfo(pVnode->qMgmt, (void**) &handle, true); + qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); return pRsp->code; } } else { @@ -186,16 +221,23 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { if (handle != NULL) { vDebug("vgId:%d, QInfo:%p, dnode query msg disposed, create qhandle and returns to app", vgId, *handle); - vnodePutItemIntoReadQueue(pVnode, handle); + code = vnodePutItemIntoReadQueue(pVnode, handle, pReadMsg->rpcMsg.ahandle); + if (code != TSDB_CODE_SUCCESS) { + pRsp->code = code; + qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); + return pRsp->code; + } } } else { assert(pCont != NULL); - void** qhandle = (void**) pCont; + void **qhandle = (void **)pCont; vDebug("vgId:%d, QInfo:%p, dnode continues to exec query", pVnode->vgId, *qhandle); + +#if _NON_BLOCKING_RETRIEVE bool freehandle = false; - bool buildRes = qTableQuery(*qhandle); // do execute query + bool buildRes = qTableQuery(*qhandle); // do execute query // build query rsp, the retrieve request has reached here already if (buildRes) { @@ -207,11 +249,14 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { pReadMsg->rpcMsg.handle); // set the real rsp error code - pReadMsg->rpcMsg.code = vnodeDumpQueryResult(&pReadMsg->rspRet, pVnode, qhandle, &freehandle); + pReadMsg->rpcMsg.code = vnodeDumpQueryResult(&pReadMsg->rspRet, pVnode, qhandle, &freehandle, pReadMsg->rpcMsg.ahandle); // NOTE: set return code to be TSDB_CODE_QRY_HAS_RSP to notify dnode to return msg to client code = TSDB_CODE_QRY_HAS_RSP; } else { + void* h1 = qGetResultRetrieveMsg(*qhandle); + assert(h1 == NULL); + freehandle = qQueryCompleted(*qhandle); } @@ -220,6 +265,10 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { if (freehandle || (!buildRes)) { qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, freehandle); } +#else + qTableQuery(*qhandle); // do execute query + qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, false); +#endif } return code; @@ -233,16 +282,17 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { pRetrieve->free = htons(pRetrieve->free); pRetrieve->qhandle = htobe64(pRetrieve->qhandle); - vDebug("vgId:%d, QInfo:%p, retrieve msg is disposed, free:%d, conn:%p", pVnode->vgId, (void*) pRetrieve->qhandle, pRetrieve->free, pReadMsg->rpcMsg.handle); + vDebug("vgId:%d, QInfo:%p, retrieve msg is disposed, free:%d, conn:%p", pVnode->vgId, (void *)pRetrieve->qhandle, + pRetrieve->free, pReadMsg->rpcMsg.handle); memset(pRet, 0, sizeof(SRspRet)); int32_t code = TSDB_CODE_SUCCESS; - void** handle = qAcquireQInfo(pVnode->qMgmt, pRetrieve->qhandle); - if (handle == NULL || (*handle) != (void*) pRetrieve->qhandle) { + void ** handle = qAcquireQInfo(pVnode->qMgmt, pRetrieve->qhandle); + if (handle == NULL || (*handle) != (void *)pRetrieve->qhandle) { code = TSDB_CODE_QRY_INVALID_QHANDLE; - vDebug("vgId:%d, invalid qhandle in retrieving result, QInfo:%p", pVnode->vgId, (void*) pRetrieve->qhandle); - + vDebug("vgId:%d, invalid qhandle in retrieving result, QInfo:%p", pVnode->vgId, (void *)pRetrieve->qhandle); + vnodeBuildNoResultQueryRsp(pRet); return code; } @@ -250,7 +300,7 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { if (pRetrieve->free == 1) { vWarn("vgId:%d, QInfo:%p, retrieve msg received to kill query and free qhandle", pVnode->vgId, *handle); qKillQuery(*handle); - qReleaseQInfo(pVnode->qMgmt, (void**) &handle, true); + qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); vnodeBuildNoResultQueryRsp(pRet); code = TSDB_CODE_TSC_QUERY_CANCELLED; @@ -259,35 +309,43 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { // register the qhandle to connect to quit query immediate if connection is broken if (vnodeNotifyCurrentQhandle(pReadMsg->rpcMsg.handle, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) { - vError("vgId:%d, QInfo:%p, retrieve discarded since link is broken, %p", pVnode->vgId, *handle, pReadMsg->rpcMsg.handle); + vError("vgId:%d, QInfo:%p, retrieve discarded since link is broken, %p", pVnode->vgId, *handle, + pReadMsg->rpcMsg.handle); code = TSDB_CODE_RPC_NETWORK_UNAVAIL; - qReleaseQInfo(pVnode->qMgmt, (void**) &handle, true); + qKillQuery(*handle); + qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); return code; } bool freeHandle = true; - bool buildRes = false; + bool buildRes = false; code = qRetrieveQueryResultInfo(*handle, &buildRes, pReadMsg->rpcMsg.handle); if (code != TSDB_CODE_SUCCESS) { - //TODO handle malloc failure + // TODO handle malloc failure pRet->rsp = (SRetrieveTableRsp *)rpcMallocCont(sizeof(SRetrieveTableRsp)); pRet->len = sizeof(SRetrieveTableRsp); memset(pRet->rsp, 0, sizeof(SRetrieveTableRsp)); freeHandle = true; - } else { // result is not ready, return immediately + } else { // result is not ready, return immediately + assert(buildRes == true); +#if _NON_BLOCKING_RETRIEVE if (!buildRes) { - qReleaseQInfo(pVnode->qMgmt, (void**) &handle, false); + assert(pReadMsg->rpcMsg.handle != NULL); + + qReleaseQInfo(pVnode->qMgmt, (void **)&handle, false); return TSDB_CODE_QRY_NOT_READY; } +#endif - code = vnodeDumpQueryResult(pRet, pVnode, handle, &freeHandle); + // ahandle is the sqlObj pointer + code = vnodeDumpQueryResult(pRet, pVnode, handle, &freeHandle, pReadMsg->rpcMsg.ahandle); } // If qhandle is not added into vread queue, the query should be completed already or paused with error. // Here free qhandle immediately if (freeHandle) { - qReleaseQInfo(pVnode->qMgmt, (void**) &handle, true); + qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); } return code; @@ -295,13 +353,13 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) { // notify connection(handle) that current qhandle is created, if current connection from // client is broken, the query needs to be killed immediately. -int32_t vnodeNotifyCurrentQhandle(void* handle, void* qhandle, int32_t vgId) { - SRetrieveTableMsg* killQueryMsg = rpcMallocCont(sizeof(SRetrieveTableMsg)); - killQueryMsg->qhandle = htobe64((uint64_t) qhandle); +int32_t vnodeNotifyCurrentQhandle(void *handle, void *qhandle, int32_t vgId) { + SRetrieveTableMsg *killQueryMsg = rpcMallocCont(sizeof(SRetrieveTableMsg)); + killQueryMsg->qhandle = htobe64((uint64_t)qhandle); killQueryMsg->free = htons(1); killQueryMsg->header.vgId = htonl(vgId); killQueryMsg->header.contLen = htonl(sizeof(SRetrieveTableMsg)); vDebug("QInfo:%p register qhandle to connect:%p", qhandle, handle); - return rpcReportProgress(handle, (char*) killQueryMsg, sizeof(SRetrieveTableMsg)); + return rpcReportProgress(handle, (char *)killQueryMsg, sizeof(SRetrieveTableMsg)); } diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 0c310439bb0904da9252cb1c29e1652472f60df7..855df81a1b9029d7ddd2f5e5ca6d42e8c680f7ac 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -22,9 +22,11 @@ #include "tutil.h" #include "tsdb.h" #include "twal.h" +#include "tsync.h" #include "tdataformat.h" #include "vnode.h" #include "vnodeInt.h" +#include "syncInt.h" #include "tcq.h" static int32_t (*vnodeProcessWriteMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *, void *, SRspRet *); @@ -47,62 +49,75 @@ void vnodeInitWriteFp(void) { int32_t vnodeProcessWrite(void *param1, int qtype, void *param2, void *item) { int32_t code = 0; SVnodeObj *pVnode = (SVnodeObj *)param1; - SWalHead *pHead = param2; + SWalHead * pHead = param2; if (vnodeProcessWriteMsgFp[pHead->msgType] == NULL) { vDebug("vgId:%d, msgType:%s not processed, no handle", pVnode->vgId, taosMsg[pHead->msgType]); - return TSDB_CODE_VND_MSG_NOT_PROCESSED; + return TSDB_CODE_VND_MSG_NOT_PROCESSED; } - if (!(pVnode->accessState & TSDB_VN_WRITE_ACCCESS)) { - vDebug("vgId:%d, msgType:%s not processed, no write auth", pVnode->vgId, taosMsg[pHead->msgType]); - return TSDB_CODE_VND_NO_WRITE_AUTH; - } - - // tsdb may be in reset state - if (pVnode->tsdb == NULL) return TSDB_CODE_APP_NOT_READY; - if (pVnode->status == TAOS_VN_STATUS_CLOSING) - return TSDB_CODE_APP_NOT_READY; - - if (pHead->version == 0) { // from client or CQ + if (pHead->version == 0) { // from client or CQ if (pVnode->status != TAOS_VN_STATUS_READY) { - vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->status); + vDebug("vgId:%d, msgType:%s not processed, vnode status is %d", pVnode->vgId, taosMsg[pHead->msgType], + pVnode->status); return TSDB_CODE_APP_NOT_READY; // it may be in deleting or closing state } if (pVnode->role != TAOS_SYNC_ROLE_MASTER) { - vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%d", pVnode->vgId, taosMsg[pHead->msgType], pVnode->syncCfg.replica, pVnode->role); + vDebug("vgId:%d, msgType:%s not processed, replica:%d role:%s", pVnode->vgId, taosMsg[pHead->msgType], + pVnode->syncCfg.replica, syncRole[pVnode->role]); return TSDB_CODE_APP_NOT_READY; } // assign version - pVnode->version++; - pHead->version = pVnode->version; - if (pVnode->delay) usleep(pVnode->delay*1000); + pHead->version = pVnode->version + 1; + if (pVnode->delay) usleep(pVnode->delay * 1000); - } else { // from wal or forward + } else { // from wal or forward // for data from WAL or forward, version may be smaller if (pHead->version <= pVnode->version) return 0; } - pVnode->version = pHead->version; + // forward to peers, even it is WAL/FWD, it shall be called to update version in sync + int32_t syncCode = 0; + syncCode = syncForwardToPeer(pVnode->sync, pHead, item, qtype); + if (syncCode < 0) return syncCode; // write into WAL code = walWrite(pVnode->wal, pHead); if (code < 0) return code; - // forward to peers, even it is WAL/FWD, it shall be called to update version in sync - int32_t syncCode = 0; - syncCode = syncForwardToPeer(pVnode->sync, pHead, item, qtype); - if (syncCode < 0) return syncCode; + pVnode->version = pHead->version; - // write data locally + // write data locally code = (*vnodeProcessWriteMsgFp[pHead->msgType])(pVnode, pHead->cont, item); if (code < 0) return code; return syncCode; } +int32_t vnodeCheckWrite(void *param) { + SVnodeObj *pVnode = param; + if (!(pVnode->accessState & TSDB_VN_WRITE_ACCCESS)) { + vDebug("vgId:%d, no write auth, recCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); + return TSDB_CODE_VND_NO_WRITE_AUTH; + } + + // tsdb may be in reset state + if (pVnode->tsdb == NULL) { + vDebug("vgId:%d, tsdb is null, recCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); + return TSDB_CODE_APP_NOT_READY; + } + + if (pVnode->status == TAOS_VN_STATUS_CLOSING) { + vDebug("vgId:%d, vnode status is %s, recCount:%d pVnode:%p", pVnode->vgId, vnodeStatus[pVnode->status], + pVnode->refCount, pVnode); + return TSDB_CODE_APP_NOT_READY; + } + + return TSDB_CODE_SUCCESS; +} + void vnodeConfirmForward(void *param, uint64_t version, int32_t code) { SVnodeObj *pVnode = (SVnodeObj *)param; syncConfirmForward(pVnode->sync, version, code); @@ -115,14 +130,14 @@ static int32_t vnodeProcessSubmitMsg(SVnodeObj *pVnode, void *pCont, SRspRet *pR // save insert result into item SShellSubmitRspMsg *pRsp = NULL; - if (pRet) { + if (pRet) { pRet->len = sizeof(SShellSubmitRspMsg); pRet->rsp = rpcMallocCont(pRet->len); pRsp = pRet->rsp; } if (tsdbInsertData(pVnode->tsdb, pCont, pRsp) < 0) code = terrno; - + return code; } @@ -149,7 +164,7 @@ static int32_t vnodeProcessDropTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet int32_t code = TSDB_CODE_SUCCESS; vDebug("vgId:%d, table:%s, start to drop", pVnode->vgId, pTable->tableId); - STableId tableId = {.uid = htobe64(pTable->uid), .tid = htonl(pTable->sid)}; + STableId tableId = {.uid = htobe64(pTable->uid), .tid = htonl(pTable->tid)}; if (tsdbDropTable(pVnode->tsdb, tableId) < 0) code = terrno; @@ -189,19 +204,37 @@ static int32_t vnodeProcessUpdateTagValMsg(SVnodeObj *pVnode, void *pCont, SRspR return TSDB_CODE_SUCCESS; } + +int vnodeWriteCqMsgToQueue(void *param, void *data, int type) { + SVnodeObj *pVnode = param; + SWalHead * pHead = data; + + int size = sizeof(SWalHead) + pHead->len; + SSyncHead *pSync = (SSyncHead*) taosAllocateQitem(size + sizeof(SSyncHead)); + SWalHead *pWal = (SWalHead *)(pSync + 1); + memcpy(pWal, pHead, size); + + atomic_add_fetch_32(&pVnode->refCount, 1); + vTrace("CQ: vgId:%d, get vnode wqueue, refCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); + + taosWriteQitem(pVnode->wqueue, type, pSync); + + return 0; +} + + int vnodeWriteToQueue(void *param, void *data, int type) { SVnodeObj *pVnode = param; - SWalHead *pHead = data; + SWalHead * pHead = data; int size = sizeof(SWalHead) + pHead->len; SWalHead *pWal = (SWalHead *)taosAllocateQitem(size); memcpy(pWal, pHead, size); atomic_add_fetch_32(&pVnode->refCount, 1); - vDebug("vgId:%d, get vnode wqueue, refCount:%d", pVnode->vgId, pVnode->refCount); + vTrace("vgId:%d, get vnode wqueue, refCount:%d pVnode:%p", pVnode->vgId, pVnode->refCount, pVnode); taosWriteQitem(pVnode->wqueue, type, pWal); return 0; } - diff --git a/src/wal/src/walMain.c b/src/wal/src/walMain.c index 5d7f8ee20be7f7b497dd56b9f7387a4cd71f8d34..d7fd1b84c97b94730971277a699c40e3252c335f 100644 --- a/src/wal/src/walMain.c +++ b/src/wal/src/walMain.c @@ -63,7 +63,7 @@ static void walRelease(SWal *pWal); static void walModuleInitFunc() { walTmrCtrl = taosTmrInit(1000, 100, 300000, "WAL"); - if (walTmrCtrl == NULL) + if (walTmrCtrl == NULL) walModuleInit = PTHREAD_ONCE_INIT; else wDebug("WAL module is initialized"); @@ -90,7 +90,7 @@ void *walOpen(const char *path, const SWalCfg *pCfg) { return NULL; } - atomic_add_fetch_32(&tsWalNum, 1); + atomic_add_fetch_32(&tsWalNum, 1); pWal->fd = -1; pWal->max = pCfg->wals; pWal->id = 0; @@ -117,18 +117,17 @@ void *walOpen(const char *path, const SWalCfg *pCfg) { walRelease(pWal); pWal = NULL; } - + if (pCfg->keep == 1) return pWal; - if (walHandleExistingFiles(path) == 0) - walRenew(pWal); + if (walHandleExistingFiles(path) == 0) walRenew(pWal); - if (pWal && pWal->fd <0) { + if (pWal && pWal->fd < 0) { terrno = TAOS_SYSTEM_ERROR(errno); wError("wal:%s, failed to open(%s)", path, strerror(errno)); walRelease(pWal); pWal = NULL; - } + } if (pWal) wDebug("wal:%s, it is open, level:%d fsyncPeriod:%d", path, pWal->level, pWal->fsyncPeriod); return pWal; @@ -154,7 +153,7 @@ int walAlter(twalh wal, const SWalCfg *pCfg) { pWal->fsyncPeriod = pCfg->fsyncPeriod; if (walNeedFsyncTimer(pWal)) { wInfo("wal:%s, reset fsync timer, walLevel:%d fsyncPeriod:%d", pWal->name, pWal->level, pWal->fsyncPeriod); - taosTmrReset(walProcessFsyncTimer, pWal->fsyncPeriod, pWal, &pWal->timer,walTmrCtrl); + taosTmrReset(walProcessFsyncTimer, pWal->fsyncPeriod, pWal, &pWal->timer, walTmrCtrl); } else { wInfo("wal:%s, stop fsync timer, walLevel:%d fsyncPeriod:%d", pWal->name, pWal->level, pWal->fsyncPeriod); taosTmrStop(pWal->timer); @@ -167,16 +166,16 @@ int walAlter(twalh wal, const SWalCfg *pCfg) { void walClose(void *handle) { if (handle == NULL) return; - - SWal *pWal = handle; + + SWal *pWal = handle; taosClose(pWal->fd); if (pWal->timer) taosTmrStopA(&pWal->timer); if (pWal->keep == 0) { // remove all files in the directory - for (int i=0; inum; ++i) { - snprintf(pWal->name, sizeof(pWal->name), "%s/%s%d", pWal->path, walPrefix, pWal->id-i); - if (remove(pWal->name) <0) { + for (int i = 0; i < pWal->num; ++i) { + snprintf(pWal->name, sizeof(pWal->name), "%s/%s%d", pWal->path, walPrefix, pWal->id - i); + if (remove(pWal->name) < 0) { wError("wal:%s, failed to remove", pWal->name); } else { wDebug("wal:%s, it is removed", pWal->name); @@ -197,7 +196,7 @@ int walRenew(void *handle) { pthread_mutex_lock(&pWal->mutex); - if (pWal->fd >=0) { + if (pWal->fd >= 0) { close(pWal->fd); pWal->id++; wDebug("wal:%s, it is closed", pWal->name); @@ -218,7 +217,7 @@ int walRenew(void *handle) { // remove the oldest wal file char name[TSDB_FILENAME_LEN * 3]; snprintf(name, sizeof(name), "%s/%s%d", pWal->path, walPrefix, pWal->id - pWal->max); - if (remove(name) <0) { + if (remove(name) < 0) { wError("wal:%s, failed to remove(%s)", name, strerror(errno)); } else { wDebug("wal:%s, it is removed", name); @@ -226,8 +225,8 @@ int walRenew(void *handle) { pWal->num--; } - } - + } + pthread_mutex_unlock(&pWal->mutex); return terrno; @@ -239,7 +238,7 @@ int walWrite(void *handle, SWalHead *pHead) { terrno = 0; - // no wal + // no wal if (pWal->level == TAOS_WAL_NOLOG) return 0; if (pHead->version <= pWal->version) return 0; @@ -247,7 +246,7 @@ int walWrite(void *handle, SWalHead *pHead) { taosCalcChecksumAppend(0, (uint8_t *)pHead, sizeof(SWalHead)); int contLen = pHead->len + sizeof(SWalHead); - if(taosTWrite(pWal->fd, pHead, contLen) != contLen) { + if (taosTWrite(pWal->fd, pHead, contLen) != contLen) { wError("wal:%s, failed to write(%s)", pWal->name, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); } else { @@ -258,7 +257,6 @@ int walWrite(void *handle, SWalHead *pHead) { } void walFsync(void *handle) { - SWal *pWal = handle; if (pWal == NULL || pWal->level != TAOS_WAL_FSYNC || pWal->fd < 0) return; @@ -276,12 +274,11 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int)) uint32_t maxId = 0, minId = -1, index =0; terrno = 0; - int plen = strlen(walPrefix); - char opath[TSDB_FILENAME_LEN+5]; - + int plen = strlen(walPrefix); + char opath[TSDB_FILENAME_LEN + 5]; + int slen = snprintf(opath, sizeof(opath), "%s", pWal->path); - if ( pWal->keep == 0) - strcpy(opath+slen, "/old"); + if (pWal->keep == 0) strcpy(opath + slen, "/old"); DIR *dir = opendir(opath); if (dir == NULL && errno == ENOENT) return 0; @@ -290,8 +287,8 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int)) return terrno; } - while ((ent = readdir(dir))!= NULL) { - if ( strncmp(ent->d_name, walPrefix, plen) == 0) { + while ((ent = readdir(dir)) != NULL) { + if (strncmp(ent->d_name, walPrefix, plen) == 0) { index = atol(ent->d_name + plen); if (index > maxId) maxId = index; if (index < minId) minId = index; @@ -306,13 +303,13 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int)) return terrno; } - if ( count != (maxId-minId+1) ) { + if (count != (maxId - minId + 1)) { wError("wal:%s, messed up, count:%d max:%d min:%d", opath, count, maxId, minId); terrno = TSDB_CODE_WAL_APP_ERROR; } else { wDebug("wal:%s, %d files will be restored", opath, count); - for (index = minId; index<=maxId; ++index) { + for (index = minId; index <= maxId; ++index) { snprintf(pWal->name, sizeof(pWal->name), "%s/%s%d", opath, walPrefix, index); terrno = walRestoreWalFile(pWal, pVnode, writeFp); if (terrno < 0) break; @@ -328,7 +325,7 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int)) terrno = TAOS_SYSTEM_ERROR(errno); } } - } else { + } else { // open the existing WAL file in append mode pWal->num = count; pWal->id = maxId; @@ -345,9 +342,9 @@ int walRestore(void *handle, void *pVnode, int (*writeFp)(void *, void *, int)) } int walGetWalFile(void *handle, char *name, uint32_t *index) { - SWal *pWal = handle; + SWal * pWal = handle; int code = 1; - int32_t first = 0; + int32_t first = 0; name[0] = 0; if (pWal == NULL || pWal->num == 0) return 0; @@ -359,18 +356,17 @@ int walGetWalFile(void *handle, char *name, uint32_t *index) { if (*index < first && *index > pWal->id) { code = -1; // index out of range - } else { + } else { sprintf(name, "wal/%s%d", walPrefix, *index); - code = (*index == pWal->id) ? 0:1; + code = (*index == pWal->id) ? 0 : 1; } pthread_mutex_unlock(&(pWal->mutex)); return code; -} +} static void walRelease(SWal *pWal) { - pthread_mutex_destroy(&pWal->mutex); pWal->signature = NULL; free(pWal); @@ -385,12 +381,12 @@ static void walRelease(SWal *pWal) { static int walRestoreWalFile(SWal *pWal, void *pVnode, FWalWrite writeFp) { char *name = pWal->name; - int size = 1024 * 1024; // default 1M buffer size + int size = 1024 * 1024; // default 1M buffer size terrno = 0; char *buffer = malloc(size); if (buffer == NULL) { - terrno = TAOS_SYSTEM_ERROR(errno); + terrno = TAOS_SYSTEM_ERROR(errno); return terrno; } @@ -487,21 +483,21 @@ int walHandleExistingFiles(const char *path) { } else { // move all files to old directory int count = 0; - while ((ent = readdir(dir))!= NULL) { - if ( strncmp(ent->d_name, walPrefix, plen) == 0) { + while ((ent = readdir(dir)) != NULL) { + if (strncmp(ent->d_name, walPrefix, plen) == 0) { snprintf(oname, sizeof(oname), "%s/%s", path, ent->d_name); snprintf(nname, sizeof(nname), "%s/old/%s", path, ent->d_name); if (taosMkDir(opath, 0755) != 0) { wError("wal:%s, failed to create directory:%s(%s)", oname, opath, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); - break; + break; } if (rename(oname, nname) < 0) { wError("wal:%s, failed to move to new:%s", oname, nname); terrno = TAOS_SYSTEM_ERROR(errno); break; - } + } count++; } @@ -509,34 +505,34 @@ int walHandleExistingFiles(const char *path) { wDebug("wal:%s, %d files are moved for restoration", path, count); } - + closedir(dir); return terrno; } static int walRemoveWalFiles(const char *path) { - int plen = strlen(walPrefix); - char name[TSDB_FILENAME_LEN * 3]; - + int plen = strlen(walPrefix); + char name[TSDB_FILENAME_LEN * 3]; + terrno = 0; struct dirent *ent; - DIR *dir = opendir(path); + DIR *dir = opendir(path); if (dir == NULL && errno == ENOENT) return 0; if (dir == NULL) { terrno = TAOS_SYSTEM_ERROR(errno); return terrno; - } + } - while ((ent = readdir(dir))!= NULL) { - if ( strncmp(ent->d_name, walPrefix, plen) == 0) { + while ((ent = readdir(dir)) != NULL) { + if (strncmp(ent->d_name, walPrefix, plen) == 0) { snprintf(name, sizeof(name), "%s/%s", path, ent->d_name); - if (remove(name) <0) { + if (remove(name) < 0) { wError("wal:%s, failed to remove(%s)", name, strerror(errno)); terrno = TAOS_SYSTEM_ERROR(errno); } } - } + } closedir(dir); @@ -561,3 +557,10 @@ static void walProcessFsyncTimer(void *param, void *tmrId) { pWal->timer = NULL; } } + +int64_t walGetVersion(twalh param) { + SWal *pWal = param; + if (pWal == 0) return 0; + + return pWal->version; +} \ No newline at end of file diff --git a/tests/comparisonTest/tdengine/tdengineTest.c b/tests/comparisonTest/tdengine/tdengineTest.c index 237403f52565c1b68b21e895d5555a2a673bb5f7..1298aa8323b0f876e3c64ff88323031b8d529648 100644 --- a/tests/comparisonTest/tdengine/tdengineTest.c +++ b/tests/comparisonTest/tdengine/tdengineTest.c @@ -108,9 +108,9 @@ void parseArg(int argc, char *argv[]) { } } -void taos_error(TAOS *con) { - printf("TDengine error: %s\n", taos_errstr(con)); - taos_close(con); +static void taos_error(TAOS_RES *tres, TAOS *conn) { + printf("TDengine error: %s\n", tres?taos_errstr(tres):"null result"); + taos_close(conn); exit(1); } @@ -125,13 +125,17 @@ void writeDataImp(void *param) { printf("Thread %d, writing sID %d, eID %d\n", pThread->threadId, pThread->sID, pThread->eID); void *taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); - if (taos == NULL) - taos_error(taos); + if (taos == NULL) { + // where to find errstr? + // taos_error(NULL, taos); + printf("TDengine error: %s\n", "failed to connect"); + exit(1); + } TAOS_RES* result = taos_query(taos, "use db"); int32_t code = taos_errno(result); if (code != 0) { - taos_error(taos); + taos_error(result, taos); } taos_free_result(result); @@ -227,12 +231,17 @@ void writeData() { taos_init(); void *taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); - if (taos == NULL) taos_error(taos); + if (taos == NULL) { + // where to find errstr? + // taos_error(NULL, taos); + printf("TDengine error: %s\n", "failed to connect"); + exit(1); + } TAOS_RES *result = taos_query(taos, "create database if not exists db"); int32_t code = taos_errno(result); if (code != 0) { - taos_error(taos); + taos_error(result, taos); } taos_free_result(result); @@ -241,7 +250,7 @@ void writeData() { "tags(devid int, devname binary(16), devgroup int)"); code = taos_errno(result); if (code != 0) { - taos_error(taos); + taos_error(result, taos); } taos_free_result(result); @@ -293,8 +302,12 @@ void readDataImp(void *param) printf("open file %s success\n", arguments.sql); void *taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); - if (taos == NULL) - taos_error(taos); + if (taos == NULL) { + // where to find errstr? + // taos_error(NULL, taos); + printf("TDengine error: %s\n", "failed to connect"); + exit(1); + } char *line = NULL; size_t len = 0; @@ -313,7 +326,7 @@ void readDataImp(void *param) TAOS_RES *result = taos_query(taos, line); int32_t code = taos_errno(result); if (code != 0) { - taos_error(taos); + taos_error(result, taos); } TAOS_ROW row; @@ -343,8 +356,12 @@ void readData() { printf("---- clients: %d\n", arguments.clients); void *taos = taos_connect("127.0.0.1", "root", "taosdata", NULL, 0); - if (taos == NULL) - taos_error(taos); + if (taos == NULL) { + // where to find errstr? + // taos_error(NULL, taos); + printf("TDengine error: %s\n", "failed to connect"); + exit(1); + } ThreadObj *threads = calloc((size_t)arguments.clients, sizeof(ThreadObj)); diff --git a/tests/examples/C#/C#checker/C#checker.cs b/tests/examples/C#/C#checker/C#checker.cs new file mode 100644 index 0000000000000000000000000000000000000000..24b7060b14862e220b9b08a362e27cd65ae4eb7d --- /dev/null +++ b/tests/examples/C#/C#checker/C#checker.cs @@ -0,0 +1,377 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +using System; +using System.Text; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Collections; + +namespace TDengineDriver +{ + class TDengineTest + { + //connect parameters + private string host; + private string configDir; + private string user; + private string password; + private short port = 0; + + //sql parameters + private string dbName; + private string tbName; + + + private bool isInsertData; + private bool isQueryData; + + private long tableCount; + private long totalRows; + private long batchRows; + private long beginTimestamp = 1551369600000L; + + private IntPtr conn = IntPtr.Zero; + private long rowsInserted = 0; + + static void Main(string[] args) + { + TDengineTest tester = new TDengineTest(); + tester.ReadArgument(args); + + + tester.InitTDengine(); + tester.ConnectTDengine(); + tester.createDatabase(); + tester.useDatabase(); + tester.checkDropTable(); + tester.createTable(); + tester.checkInsert(); + tester.checkSelect(); + tester.checkDropTable(); + + tester.CloseConnection(); + + + + } + + public long GetArgumentAsLong(String[] argv, String argName, int minVal, int maxVal, int defaultValue) + { + int argc = argv.Length; + for (int i = 0; i < argc; ++i) + { + if (argName != argv[i]) + { + continue; + } + if (i < argc - 1) + { + String tmp = argv[i + 1]; + if (tmp[0] == '-') + { + Console.WriteLine("option {0:G} requires an argument", tmp); + ExitProgram(); + } + + long tmpVal = Convert.ToInt64(tmp); + if (tmpVal < minVal || tmpVal > maxVal) + { + Console.WriteLine("option {0:G} should in range [{1:G}, {2:G}]", argName, minVal, maxVal); + ExitProgram(); + } + + return tmpVal; + } + } + + return defaultValue; + } + + public String GetArgumentAsString(String[] argv, String argName, String defaultValue) + { + int argc = argv.Length; + for (int i = 0; i < argc; ++i) + { + if (argName != argv[i]) + { + continue; + } + if (i < argc - 1) + { + String tmp = argv[i + 1]; + if (tmp[0] == '-') + { + Console.WriteLine("option {0:G} requires an argument", tmp); + ExitProgram(); + } + return tmp; + } + } + + return defaultValue; + } + + public void PrintHelp(String[] argv) + { + for (int i = 0; i < argv.Length; ++i) + { + if ("--help" == argv[i]) + { + String indent = " "; + Console.WriteLine("taosTest is simple example to operate TDengine use C# Language.\n"); + Console.WriteLine("{0:G}{1:G}", indent, "-h"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "TDEngine server IP address to connect"); + Console.WriteLine("{0:G}{1:G}", indent, "-u"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "The TDEngine user name to use when connecting to the server, default is root"); + Console.WriteLine("{0:G}{1:G}", indent, "-p"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "The TDEngine user name to use when connecting to the server, default is taosdata"); + Console.WriteLine("{0:G}{1:G}", indent, "-d"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Database used to create table or import data, default is db"); + Console.WriteLine("{0:G}{1:G}", indent, "-s"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Super Tables used to create table, default is mt"); + Console.WriteLine("{0:G}{1:G}", indent, "-t"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Table prefixs, default is t"); + Console.WriteLine("{0:G}{1:G}", indent, "-w"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Whether to insert data"); + Console.WriteLine("{0:G}{1:G}", indent, "-r"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Whether to query data"); + Console.WriteLine("{0:G}{1:G}", indent, "-n"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many Tables to create, default is 10"); + Console.WriteLine("{0:G}{1:G}", indent, "-b"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many rows per insert batch, default is 10"); + Console.WriteLine("{0:G}{1:G}", indent, "-i"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "How many rows to insert, default is 100"); + Console.WriteLine("{0:G}{1:G}", indent, "-c"); + Console.WriteLine("{0:G}{1:G}{2:G}", indent, indent, "Configuration directory"); + + ExitProgram(); + } + } + } + + public void ReadArgument(String[] argv) + { + PrintHelp(argv); + host = this.GetArgumentAsString(argv, "-h", "127.0.0.1"); + user = this.GetArgumentAsString(argv, "-u", "root"); + password = this.GetArgumentAsString(argv, "-p", "taosdata"); + dbName = this.GetArgumentAsString(argv, "-db", "test"); + tbName = this.GetArgumentAsString(argv, "-s", "weather"); + + isInsertData = this.GetArgumentAsLong(argv, "-w", 0, 1, 1) != 0; + isQueryData = this.GetArgumentAsLong(argv, "-r", 0, 1, 1) != 0; + tableCount = this.GetArgumentAsLong(argv, "-n", 1, 10000, 10); + batchRows = this.GetArgumentAsLong(argv, "-b", 1, 1000, 500); + totalRows = this.GetArgumentAsLong(argv, "-i", 1, 10000000, 10000); + configDir = this.GetArgumentAsString(argv, "-c", "C:/TDengine/cfg"); + } + + public void InitTDengine() + { + TDengine.Options((int)TDengineInitOption.TDDB_OPTION_CONFIGDIR, this.configDir); + TDengine.Options((int)TDengineInitOption.TDDB_OPTION_SHELL_ACTIVITY_TIMER, "60"); + TDengine.Init(); + Console.WriteLine("get connection starting..."); + } + + public void ConnectTDengine() + { + string db = ""; + this.conn = TDengine.Connect(this.host, this.user, this.password, db, this.port); + if (this.conn == IntPtr.Zero) + { + Console.WriteLine("connection failed: " + this.host); + ExitProgram(); + } + else + { + Console.WriteLine("[ OK ] Connection established."); + } + } + public void createDatabase() + { + StringBuilder sql = new StringBuilder(); + sql.Append("create database if not exists ").Append(this.dbName); + execute(sql.ToString()); + } + public void useDatabase() + { + StringBuilder sql = new StringBuilder(); + sql.Append("use ").Append(this.dbName); + execute(sql.ToString()); + } + public void checkSelect() + { + StringBuilder sql = new StringBuilder(); + sql.Append("select * from test.weather"); + execute(sql.ToString()); + } + public void createTable() + { + StringBuilder sql = new StringBuilder(); + sql.Append("create table if not exists ").Append(this.dbName).Append(".").Append(this.tbName).Append("(ts timestamp, temperature float, humidity int)"); + execute(sql.ToString()); + } + public void checkInsert() + { + StringBuilder sql = new StringBuilder(); + sql.Append("insert into test.weather (ts, temperature, humidity) values(now, 20.5, 34)"); + execute(sql.ToString()); + } + public void checkDropTable() + { + StringBuilder sql = new StringBuilder(); + sql.Append("drop table if exists ").Append(this.dbName).Append(".").Append(this.tbName).Append(""); + execute(sql.ToString()); + } + public void execute(string sql) + { + DateTime dt1 = DateTime.Now; + IntPtr res = TDengine.Query(this.conn, sql.ToString()); + DateTime dt2 = DateTime.Now; + TimeSpan span = dt2 - dt1; + + if (res != IntPtr.Zero) + { + Console.WriteLine("[OK] time cost: " + span.ToString() + "ms, execute statement ====> " + sql.ToString()); + } + else + { + Console.WriteLine(sql.ToString() + " failure, reason: " + TDengine.Error(res)); + ExitProgram(); + } + TDengine.FreeResult(res); + } + + public void ExecuteQuery(string sql) + { + + DateTime dt1 = DateTime.Now; + long queryRows = 0; + IntPtr res = TDengine.Query(conn, sql); + if (res == IntPtr.Zero) + { + Console.WriteLine(sql + " failure, reason: " + TDengine.Error(res)); + ExitProgram(); + } + DateTime dt2 = DateTime.Now; + TimeSpan span = dt2 - dt1; + Console.WriteLine("[OK] time cost: " + span.ToString() + "ms, execute statement ====> " + sql.ToString()); + int fieldCount = TDengine.FieldCount(res); + + List metas = TDengine.FetchFields(res); + for (int j = 0; j < metas.Count; j++) + { + TDengineMeta meta = (TDengineMeta)metas[j]; + } + + IntPtr rowdata; + StringBuilder builder = new StringBuilder(); + while ((rowdata = TDengine.FetchRows(res)) != IntPtr.Zero) + { + queryRows++; + for (int fields = 0; fields < fieldCount; ++fields) + { + TDengineMeta meta = metas[fields]; + int offset = IntPtr.Size * fields; + IntPtr data = Marshal.ReadIntPtr(rowdata, offset); + + builder.Append("---"); + + if (data == IntPtr.Zero) + { + builder.Append("NULL"); + continue; + } + + switch ((TDengineDataType)meta.type) + { + case TDengineDataType.TSDB_DATA_TYPE_BOOL: + bool v1 = Marshal.ReadByte(data) == 0 ? false : true; + builder.Append(v1); + break; + case TDengineDataType.TSDB_DATA_TYPE_TINYINT: + byte v2 = Marshal.ReadByte(data); + builder.Append(v2); + break; + case TDengineDataType.TSDB_DATA_TYPE_SMALLINT: + short v3 = Marshal.ReadInt16(data); + builder.Append(v3); + break; + case TDengineDataType.TSDB_DATA_TYPE_INT: + int v4 = Marshal.ReadInt32(data); + builder.Append(v4); + break; + case TDengineDataType.TSDB_DATA_TYPE_BIGINT: + long v5 = Marshal.ReadInt64(data); + builder.Append(v5); + break; + case TDengineDataType.TSDB_DATA_TYPE_FLOAT: + float v6 = (float)Marshal.PtrToStructure(data, typeof(float)); + builder.Append(v6); + break; + case TDengineDataType.TSDB_DATA_TYPE_DOUBLE: + double v7 = (double)Marshal.PtrToStructure(data, typeof(double)); + builder.Append(v7); + break; + case TDengineDataType.TSDB_DATA_TYPE_BINARY: + string v8 = Marshal.PtrToStringAnsi(data); + builder.Append(v8); + break; + case TDengineDataType.TSDB_DATA_TYPE_TIMESTAMP: + long v9 = Marshal.ReadInt64(data); + builder.Append(v9); + break; + case TDengineDataType.TSDB_DATA_TYPE_NCHAR: + string v10 = Marshal.PtrToStringAnsi(data); + builder.Append(v10); + break; + } + } + builder.Append("---"); + + if (queryRows <= 10) + { + Console.WriteLine(builder.ToString()); + } + builder.Clear(); + } + + if (TDengine.ErrorNo(res) != 0) + { + Console.Write("Query is not complete, Error {0:G}", TDengine.ErrorNo(res), TDengine.Error(res)); + } + + TDengine.FreeResult(res); + + } + + public void CloseConnection() + { + if (this.conn != IntPtr.Zero) + { + TDengine.Close(this.conn); + Console.WriteLine("connection closed."); + } + } + + static void ExitProgram() + { + TDengine.Cleanup(); + System.Environment.Exit(0); + } + } +} diff --git a/tests/examples/C#/C#checker/TDengineDriver.cs b/tests/examples/C#/C#checker/TDengineDriver.cs new file mode 100644 index 0000000000000000000000000000000000000000..b6f143e1813d60c1ac4ae8356efdca4929c51345 --- /dev/null +++ b/tests/examples/C#/C#checker/TDengineDriver.cs @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace TDengineDriver +{ + enum TDengineDataType { + TSDB_DATA_TYPE_NULL = 0, // 1 bytes + TSDB_DATA_TYPE_BOOL = 1, // 1 bytes + TSDB_DATA_TYPE_TINYINT = 2, // 1 bytes + TSDB_DATA_TYPE_SMALLINT = 3, // 2 bytes + TSDB_DATA_TYPE_INT = 4, // 4 bytes + TSDB_DATA_TYPE_BIGINT = 5, // 8 bytes + TSDB_DATA_TYPE_FLOAT = 6, // 4 bytes + TSDB_DATA_TYPE_DOUBLE = 7, // 8 bytes + TSDB_DATA_TYPE_BINARY = 8, // string + TSDB_DATA_TYPE_TIMESTAMP = 9,// 8 bytes + TSDB_DATA_TYPE_NCHAR = 10 // unicode string + } + + enum TDengineInitOption + { + TSDB_OPTION_LOCALE = 0, + TSDB_OPTION_CHARSET = 1, + TSDB_OPTION_TIMEZONE = 2, + TDDB_OPTION_CONFIGDIR = 3, + TDDB_OPTION_SHELL_ACTIVITY_TIMER = 4 + } + + class TDengineMeta + { + public string name; + public short size; + public byte type; + public string TypeName() + { + switch ((TDengineDataType)type) + { + case TDengineDataType.TSDB_DATA_TYPE_BOOL: + return "BOOLEAN"; + case TDengineDataType.TSDB_DATA_TYPE_TINYINT: + return "BYTE"; + case TDengineDataType.TSDB_DATA_TYPE_SMALLINT: + return "SHORT"; + case TDengineDataType.TSDB_DATA_TYPE_INT: + return "INT"; + case TDengineDataType.TSDB_DATA_TYPE_BIGINT: + return "LONG"; + case TDengineDataType.TSDB_DATA_TYPE_FLOAT: + return "FLOAT"; + case TDengineDataType.TSDB_DATA_TYPE_DOUBLE: + return "DOUBLE"; + case TDengineDataType.TSDB_DATA_TYPE_BINARY: + return "STRING"; + case TDengineDataType.TSDB_DATA_TYPE_TIMESTAMP: + return "TIMESTAMP"; + case TDengineDataType.TSDB_DATA_TYPE_NCHAR: + return "NCHAR"; + default: + return "undefine"; + } + } + } + + class TDengine + { + public const int TSDB_CODE_SUCCESS = 0; + + [DllImport("taos.dll", EntryPoint = "taos_init", CallingConvention = CallingConvention.Cdecl)] + static extern public void Init(); + + [DllImport("taos.dll", EntryPoint = "taos_cleanup", CallingConvention = CallingConvention.Cdecl)] + static extern public void Cleanup(); + + [DllImport("taos.dll", EntryPoint = "taos_options", CallingConvention = CallingConvention.Cdecl)] + static extern public void Options(int option, string value); + + [DllImport("taos.dll", EntryPoint = "taos_connect", CallingConvention = CallingConvention.Cdecl)] + static extern public IntPtr Connect(string ip, string user, string password, string db, short port); + + [DllImport("taos.dll", EntryPoint = "taos_errstr", CallingConvention = CallingConvention.Cdecl)] + static extern private IntPtr taos_errstr(IntPtr res); + static public string Error(IntPtr res) + { + IntPtr errPtr = taos_errstr(res); + return Marshal.PtrToStringAnsi(errPtr); + } + + [DllImport("taos.dll", EntryPoint = "taos_errno", CallingConvention = CallingConvention.Cdecl)] + static extern public int ErrorNo(IntPtr res); + + [DllImport("taos.dll", EntryPoint = "taos_query", CallingConvention = CallingConvention.Cdecl)] + static extern public IntPtr Query(IntPtr conn, string sqlstr); + + [DllImport("taos.dll", EntryPoint = "taos_affected_rows", CallingConvention = CallingConvention.Cdecl)] + static extern public int AffectRows(IntPtr res); + + [DllImport("taos.dll", EntryPoint = "taos_field_count", CallingConvention = CallingConvention.Cdecl)] + static extern public int FieldCount(IntPtr res); + + [DllImport("taos.dll", EntryPoint = "taos_fetch_fields", CallingConvention = CallingConvention.Cdecl)] + static extern private IntPtr taos_fetch_fields(IntPtr res); + static public List FetchFields(IntPtr res) + { + const int fieldSize = 68; + + List metas = new List(); + if (res == IntPtr.Zero) + { + return metas; + } + + int fieldCount = FieldCount(res); + IntPtr fieldsPtr = taos_fetch_fields(res); + + for (int i = 0; i < fieldCount; ++i) + { + int offset = i * fieldSize; + + TDengineMeta meta = new TDengineMeta(); + meta.name = Marshal.PtrToStringAnsi(fieldsPtr + offset); + meta.type = Marshal.ReadByte(fieldsPtr + offset + 65); + meta.size = Marshal.ReadInt16(fieldsPtr + offset + 66); + metas.Add(meta); + } + + return metas; + } + + [DllImport("taos.dll", EntryPoint = "taos_fetch_row", CallingConvention = CallingConvention.Cdecl)] + static extern public IntPtr FetchRows(IntPtr res); + + [DllImport("taos.dll", EntryPoint = "taos_free_result", CallingConvention = CallingConvention.Cdecl)] + static extern public IntPtr FreeResult(IntPtr res); + + [DllImport("taos.dll", EntryPoint = "taos_close", CallingConvention = CallingConvention.Cdecl)] + static extern public int Close(IntPtr taos); + } +} \ No newline at end of file diff --git a/tests/examples/JDBC/JDBCDemo/pom.xml b/tests/examples/JDBC/JDBCDemo/pom.xml index 21130746741209b1b9e89d00a73c7e52e496b519..121a3b5cd63579b47fb166c7365090f06d05c0da 100644 --- a/tests/examples/JDBC/JDBCDemo/pom.xml +++ b/tests/examples/JDBC/JDBCDemo/pom.xml @@ -5,18 +5,11 @@ 4.0.0 com.taosdata.jdbc - jdbcdemo - 1.0-SNAPSHOT + jdbcChecker + SNAPSHOT jar - - - org.apache.maven.plugins - maven-plugins - 30 - - org.apache.maven.plugins maven-assembly-plugin @@ -30,7 +23,7 @@ - TSDBSyncSample + com.taosdata.example.JdbcChecker @@ -63,12 +56,18 @@ com.taosdata.jdbc taos-jdbcdriver - 2.0.4 + 2.0.8 log4j log4j 1.2.17 + + junit + junit + 4.13.1 + test + diff --git a/tests/examples/JDBC/JDBCDemo/readme.md b/tests/examples/JDBC/JDBCDemo/readme.md index a91624a9e47a3015d88e2e9aa9f62cf8dd0672cc..9b8790adaddb20246232392dd323ec502102fa18 100644 --- a/tests/examples/JDBC/JDBCDemo/readme.md +++ b/tests/examples/JDBC/JDBCDemo/readme.md @@ -2,12 +2,14 @@ TDengine's JDBC demo project is organized in a Maven way so that users can easily compile, package and run the project. If you don't have Maven on your server, you may install it using
    sudo apt-get install maven
    -## Compile and Install JDBC Driver -TDengine's JDBC driver jar is not yet published to maven center repo, so we need to manually compile it and install it to the local Maven repository. This can be easily done with Maven. Go to source directory of the JDBC driver ``TDengine/src/connector/jdbc`` and execute -
    mvn clean package install
    +## Install TDengine Client +Make sure you have already installed a tdengine client on your current develop environment. +Download the tdengine package on our website: ``https://www.taosdata.com/cn/all-downloads/`` and install the client. ## Compile the Demo Code and Run It To compile the demo project, go to the source directory ``TDengine/tests/examples/JDBC/JDBCDemo`` and execute -
    mvn clean assembly:single package
    -The ``pom.xml`` is configured to package all the dependencies into one executable jar file. To run it, go to ``examples/JDBC/JDBCDemo/target`` and execute -
    java -jar jdbcdemo-1.0-SNAPSHOT-jar-with-dependencies.jar
    +
    mvn clean package assembly:single
    +The ``pom.xml`` is configured to package all the dependencies into one executable jar file. + +To run it, go to ``examples/JDBC/JDBCDemo/target`` and execute +
    java -jar jdbcChecker-SNAPSHOT-jar-with-dependencies.jar -host localhost
    \ No newline at end of file diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/TSDBSyncSample.java b/tests/examples/JDBC/JDBCDemo/src/main/java/TSDBSyncSample.java deleted file mode 100644 index c093b604da6dc6f815272f99d7fc786dab87928b..0000000000000000000000000000000000000000 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/TSDBSyncSample.java +++ /dev/null @@ -1,205 +0,0 @@ -import java.sql.*; - -public class TSDBSyncSample { - private static final String JDBC_PROTOCAL = "jdbc:TAOS://"; - private static final String TSDB_DRIVER = "com.taosdata.jdbc.TSDBDriver"; - - private String host = "127.0.0.1"; - private String user = "root"; - private String password = "taosdata"; - private int port = 0; - private String jdbcUrl = ""; - - private String databaseName = "db"; - private String metricsName = "mt"; - private String tablePrefix = "t"; - - private int tablesCount = 1; - private int loopCount = 2; - private int batchSize = 10; - private long beginTimestamp = 1519833600000L; - - private long rowsInserted = 0; - - static { - try { - Class.forName(TSDB_DRIVER); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * @param args - */ - public static void main(String[] args) { - TSDBSyncSample tester = new TSDBSyncSample(); - tester.doReadArgument(args); - - System.out.println("---------------------------------------------------------------"); - System.out.println("Start testing..."); - System.out.println("---------------------------------------------------------------"); - - tester.doMakeJdbcUrl(); - tester.doCreateDbAndTable(); - tester.doExecuteInsert(); - tester.doExecuteQuery(); - - System.out.println("\n---------------------------------------------------------------"); - System.out.println("Stop testing..."); - System.out.println("---------------------------------------------------------------"); - } - - private void doReadArgument(String[] args) { - System.out.println("Arguments format: host tables loop batchs"); - if (args.length >= 1) { - this.host = args[0]; - } - - if (args.length >= 2) { - this.tablesCount = Integer.parseInt(args[1]); - } - - if (args.length >= 3) { - this.loopCount = Integer.parseInt(args[2]); - } - - if (args.length >= 4) { - this.batchSize = Integer.parseInt(args[3]); - } - } - - private void doMakeJdbcUrl() { - // jdbc:TSDB://127.0.0.1:0/dbname?user=root&password=taosdata - System.out.println("\nJDBC URL to use:"); - this.jdbcUrl = String.format("%s%s:%d/%s?user=%s&password=%s", JDBC_PROTOCAL, this.host, this.port, "", - this.user, this.password); - System.out.println(this.jdbcUrl); - } - - private void doCreateDbAndTable() { - System.out.println("\n---------------------------------------------------------------"); - System.out.println("Start creating databases and tables..."); - String sql = ""; - try (Connection conn = DriverManager.getConnection(jdbcUrl); - Statement stmt = conn.createStatement()){ - - sql = "create database if not exists " + this.databaseName; - stmt.executeUpdate(sql); - System.out.printf("Successfully executed: %s\n", sql); - - sql = "use " + this.databaseName; - stmt.executeUpdate(sql); - System.out.printf("Successfully executed: %s\n", sql); - - sql = "create table if not exists " + this.metricsName + " (ts timestamp, v1 int) tags(t1 int)"; - stmt.executeUpdate(sql); - System.out.printf("Successfully executed: %s\n", sql); - - for (int i = 0; i < this.tablesCount; i++) { - sql = String.format("create table if not exists %s%d using %s tags(%d)", this.tablePrefix, i, - this.metricsName, i); - stmt.executeUpdate(sql); - System.out.printf("Successfully executed: %s\n", sql); - } - } catch (SQLException e) { - e.printStackTrace(); - System.out.printf("Failed to execute SQL: %s\n", sql); - System.exit(4); - } catch (Exception e) { - e.printStackTrace(); - System.exit(4); - } - System.out.println("Successfully created databases and tables"); - } - - public void doExecuteInsert() { - System.out.println("\n---------------------------------------------------------------"); - System.out.println("Start inserting data..."); - int start = (int) System.currentTimeMillis(); - StringBuilder sql = new StringBuilder(""); - try (Connection conn = DriverManager.getConnection(jdbcUrl); - Statement stmt = conn.createStatement()){ - stmt.executeUpdate("use " + databaseName); - for (int loop = 0; loop < this.loopCount; loop++) { - for (int table = 0; table < this.tablesCount; ++table) { - sql = new StringBuilder("insert into "); - sql.append(this.tablePrefix).append(table).append(" values"); - for (int batch = 0; batch < this.batchSize; ++batch) { - int rows = loop * this.batchSize + batch; - sql.append("(").append(this.beginTimestamp + rows).append(",").append(rows).append(")"); - } - int affectRows = stmt.executeUpdate(sql.toString()); - this.rowsInserted += affectRows; - } - } - } catch (SQLException e) { - e.printStackTrace(); - System.out.printf("Failed to execute SQL: %s\n", sql.toString()); - System.exit(4); - } catch (Exception e) { - e.printStackTrace(); - System.exit(4); - } - int end = (int) System.currentTimeMillis(); - System.out.println("Inserting completed!"); - System.out.printf("Total %d rows inserted, %d rows failed, time spend %d seconds.\n", this.rowsInserted, - this.loopCount * this.batchSize - this.rowsInserted, (end - start) / 1000); - } - - public void doExecuteQuery() { - System.out.println("\n---------------------------------------------------------------"); - System.out.println("Starting querying data..."); - ResultSet resSet = null; - StringBuilder sql = new StringBuilder(""); - StringBuilder resRow = new StringBuilder(""); - try (Connection conn = DriverManager.getConnection(jdbcUrl); - Statement stmt = conn.createStatement()){ - stmt.executeUpdate("use " + databaseName); - for (int i = 0; i < this.tablesCount; ++i) { - sql = new StringBuilder("select * from ").append(this.tablePrefix).append(i); - - resSet = stmt.executeQuery(sql.toString()); - if (resSet == null) { - System.out.println(sql + " failed"); - System.exit(4); - } - - ResultSetMetaData metaData = resSet.getMetaData(); - System.out.println("Retrieve metadata of " + tablePrefix + i); - for (int column = 1; column <= metaData.getColumnCount(); ++column) { - System.out.printf("Column%d: name = %s, type = %d, type name = %s, display size = %d\n", column, metaData.getColumnName(column), metaData.getColumnType(column), - metaData.getColumnTypeName(column), metaData.getColumnDisplaySize(column)); - } - int rows = 0; - System.out.println("Retrieve data of " + tablePrefix + i); - while (resSet.next()) { - resRow = new StringBuilder(); - for (int col = 1; col <= metaData.getColumnCount(); col++) { - resRow.append(metaData.getColumnName(col)).append("=").append(resSet.getObject(col)) - .append(" "); - } - System.out.println(resRow.toString()); - rows++; - } - - try { - if (resSet != null) - resSet.close(); - } catch (SQLException e) { - e.printStackTrace(); - } - System.out.printf("Successfully executed query: %s;\nTotal rows returned: %d\n", sql.toString(), rows); - } - } catch (SQLException e) { - e.printStackTrace(); - System.out.printf("Failed to execute query: %s\n", sql.toString()); - System.exit(4); - } catch (Exception e) { - e.printStackTrace(); - System.exit(4); - } - System.out.println("Query completed!"); - } - -} diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCConnectorChecker.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcChecker.java similarity index 98% rename from tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCConnectorChecker.java rename to tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcChecker.java index 74e586d7fdf1a0f8ad65a807134caae7e05f6d4a..4be71c52214c348ed7b41c3e763de0d908514907 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JDBCConnectorChecker.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/JdbcChecker.java @@ -5,7 +5,7 @@ import com.taosdata.jdbc.TSDBDriver; import java.sql.*; import java.util.Properties; -public class JDBCConnectorChecker { +public class JdbcChecker { private static String host; private static String dbName = "test"; private static String tbName = "weather"; @@ -120,6 +120,7 @@ public class JDBCConnectorChecker { printSql(sql, execute, (end - start)); } catch (SQLException e) { e.printStackTrace(); + } } @@ -157,7 +158,7 @@ public class JDBCConnectorChecker { return; } - JDBCConnectorChecker checker = new JDBCConnectorChecker(); + JdbcChecker checker = new JdbcChecker(); checker.init(); checker.createDatabase(); checker.useDatabase(); diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/JdbcTaosdemo.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/JdbcTaosdemo.java index c30d85a084d7175e9e6861ad33d7374a868553d9..259985ec9f4708b9317575fd97919adcc82d7161 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/JdbcTaosdemo.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/JdbcTaosdemo.java @@ -25,6 +25,7 @@ public class JdbcTaosdemo { } public static void main(String[] args) { + // parse config from args JdbcTaosdemoConfig config = new JdbcTaosdemoConfig(args); boolean isHelp = Arrays.asList(args).contains("--help"); @@ -38,27 +39,51 @@ public class JdbcTaosdemo { } JdbcTaosdemo taosdemo = new JdbcTaosdemo(config); + // establish connection taosdemo.init(); + // drop database taosdemo.dropDatabase(); + // create database taosdemo.createDatabase(); + // use db taosdemo.useDatabase(); + // create super table taosdemo.createSuperTable(); + // create sub tables taosdemo.createTableMultiThreads(); boolean infinite = Arrays.asList(args).contains("--infinite"); if (infinite) { - logger.info("!!! Infinite Insert Mode Started. !!!!"); + logger.info("!!! Infinite Insert Mode Started. !!!"); taosdemo.insertInfinite(); } else { + // insert into table taosdemo.insertMultiThreads(); - // single table select + // select from sub table taosdemo.selectFromTableLimit(); taosdemo.selectCountFromTable(); taosdemo.selectAvgMinMaxFromTable(); - // super table select + // select last from + taosdemo.selectLastFromTable(); + // select from super table taosdemo.selectFromSuperTableLimit(); taosdemo.selectCountFromSuperTable(); taosdemo.selectAvgMinMaxFromSuperTable(); + //select avg ,max from stb where tag + taosdemo.selectAvgMinMaxFromSuperTableWhereTag(); + //select last from stb where location = '' + taosdemo.selectLastFromSuperTableWhere(); + // select group by + taosdemo.selectGroupBy(); + // select like + taosdemo.selectLike(); + // select where ts >= ts<= + taosdemo.selectLastOneHour(); + taosdemo.selectLastOneDay(); + taosdemo.selectLastOneWeek(); + taosdemo.selectLastOneMonth(); + taosdemo.selectLastOneYear(); + // drop super table if (config.isDeleteTable()) taosdemo.dropSuperTable(); @@ -196,6 +221,11 @@ public class JdbcTaosdemo { executeQuery(sql); } + private void selectLastFromTable() { + String sql = SqlSpeller.selectLastFromTableSQL(config.getDbName(), config.getTbPrefix(), 1); + executeQuery(sql); + } + private void selectFromSuperTableLimit() { String sql = SqlSpeller.selectFromSuperTableLimitSQL(config.getDbName(), config.getStbName(), 10, 0); executeQuery(sql); @@ -211,6 +241,52 @@ public class JdbcTaosdemo { executeQuery(sql); } + private void selectAvgMinMaxFromSuperTableWhereTag() { + String sql = SqlSpeller.selectAvgMinMaxFromSuperTableWhere("current", config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectLastFromSuperTableWhere() { + String sql = SqlSpeller.selectLastFromSuperTableWhere("current", config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectGroupBy() { + String sql = SqlSpeller.selectGroupBy("current", config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectLike() { + String sql = SqlSpeller.selectLike(config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectLastOneHour() { + String sql = SqlSpeller.selectLastOneHour(config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectLastOneDay() { + String sql = SqlSpeller.selectLastOneDay(config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectLastOneWeek() { + String sql = SqlSpeller.selectLastOneWeek(config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectLastOneMonth() { + String sql = SqlSpeller.selectLastOneMonth(config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void selectLastOneYear() { + String sql = SqlSpeller.selectLastOneYear(config.getDbName(), config.getStbName()); + executeQuery(sql); + } + + private void close() { try { if (connection != null) { @@ -241,6 +317,7 @@ public class JdbcTaosdemo { long end = System.currentTimeMillis(); printSql(sql, execute, (end - start)); } catch (SQLException e) { + logger.error("ERROR execute SQL ===> " + sql); logger.error(e.getMessage()); e.printStackTrace(); } @@ -258,6 +335,7 @@ public class JdbcTaosdemo { printSql(sql, true, (end - start)); printResult(resultSet); } catch (SQLException e) { + logger.error("ERROR execute SQL ===> " + sql); logger.error(e.getMessage()); e.printStackTrace(); } diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/domain/JdbcTaosdemoConfig.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/domain/JdbcTaosdemoConfig.java index 3cca9a3d7a8b45be5d733b9f7a4836eb89c828c3..82613037dbccd3be1f2c8a85a2f25e7a25ffad01 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/domain/JdbcTaosdemoConfig.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/domain/JdbcTaosdemoConfig.java @@ -14,9 +14,9 @@ public final class JdbcTaosdemoConfig { //Destination database. Default is 'test' private String dbName = "test"; //keep - private int keep = 365 * 20; + private int keep = 3650; //days - private int days = 30; + private int days = 10; //Super table Name. Default is 'meters' private String stbName = "meters"; @@ -35,7 +35,7 @@ public final class JdbcTaosdemoConfig { private boolean deleteTable = false; public static void printHelp() { - System.out.println("Usage: java -jar JDBCConnectorChecker.jar [OPTION...]"); + System.out.println("Usage: java -jar JdbcTaosDemo.jar [OPTION...]"); System.out.println("-h host The host to connect to TDengine. you must input one"); System.out.println("-p port The TCP/IP port number to use for the connection. Default is 6030"); System.out.println("-u user The TDengine user name to use when connecting to the server. Default is 'root'"); diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/task/InsertTableTask.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/task/InsertTableTask.java index d6d6ebbff1ac08e68e3e8034a59f84189ad86bf4..a35628bb58c6630d92bd2b6aebb09f9912e57536 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/task/InsertTableTask.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/task/InsertTableTask.java @@ -3,44 +3,49 @@ package com.taosdata.example.jdbcTaosdemo.task; import com.taosdata.example.jdbcTaosdemo.domain.JdbcTaosdemoConfig; import com.taosdata.example.jdbcTaosdemo.utils.ConnectionFactory; import com.taosdata.example.jdbcTaosdemo.utils.SqlSpeller; -import com.taosdata.example.jdbcTaosdemo.utils.TimeStampUtil; import org.apache.log4j.Logger; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; -import java.util.concurrent.atomic.AtomicLong; +import java.time.Duration; +import java.time.Instant; +import java.time.temporal.ChronoUnit; public class InsertTableTask implements Runnable { private static final Logger logger = Logger.getLogger(InsertTableTask.class); - private static AtomicLong beginTimestamp = new AtomicLong(TimeStampUtil.datetimeToLong("2005-01-01 00:00:00.000")); private final JdbcTaosdemoConfig config; - private final int startIndex; + private final int startTbIndex; private final int tableNumber; - private final int recordsNumber; + private final int recordsNumberPerTable; - public InsertTableTask(JdbcTaosdemoConfig config, int startIndex, int tableNumber, int recordsNumber) { + public InsertTableTask(JdbcTaosdemoConfig config, int startTbIndex, int tableNumber, int recordsNumberPerTable) { this.config = config; - this.startIndex = startIndex; + this.startTbIndex = startTbIndex; this.tableNumber = tableNumber; - this.recordsNumber = recordsNumber; + this.recordsNumberPerTable = recordsNumberPerTable; } @Override public void run() { try { Connection connection = ConnectionFactory.build(config); + int keep = config.getKeep(); + Instant end = Instant.now(); + Instant start = end.minus(Duration.ofDays(keep - 1)); + long timeGap = ChronoUnit.MILLIS.between(start, end) / (recordsNumberPerTable - 1); + // iterate insert - for (int j = 0; j < recordsNumber; j++) { - long ts = beginTimestamp.getAndIncrement(); + for (int j = 0; j < recordsNumberPerTable; j++) { + long ts = start.toEpochMilli() + (j * timeGap); // insert data into echo table - for (int i = startIndex; i < startIndex + tableNumber; i++) { + for (int i = startTbIndex; i < startTbIndex + tableNumber; i++) { String sql = SqlSpeller.insertOneRowSQL(config.getDbName(), config.getTbPrefix(), i + 1, ts); + logger.info(Thread.currentThread().getName() + ">>> " + sql); Statement statement = connection.createStatement(); statement.execute(sql); statement.close(); - logger.info(Thread.currentThread().getName() + ">>> " + sql); } } connection.close(); diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/SqlSpeller.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/SqlSpeller.java index 7af97f3b1baa0206f6f29b18a1ae59d2182c5423..b4a79e9eba47cc947d822b645d0ae1f9952f08f0 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/SqlSpeller.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/SqlSpeller.java @@ -78,5 +78,49 @@ public class SqlSpeller { return "select avg(" + field + "),min(" + field + "),max(" + field + ") from " + dbName + "." + stbName + ""; } + public static String selectLastFromTableSQL(String dbName, String tbPrefix, int tbIndex) { + return "select last(*) from " + dbName + "." + tbPrefix + "" + tbIndex; + } + + //select avg ,max from stb where tag + public static String selectAvgMinMaxFromSuperTableWhere(String field, String dbName, String stbName) { + return "select avg(" + field + "),min(" + field + "),max(" + field + ") from " + dbName + "." + stbName + " where location = '" + locations[random.nextInt(locations.length)] + "'"; + } + + //select last from stb where + public static String selectLastFromSuperTableWhere(String field, String dbName, String stbName) { + return "select last(" + field + ") from " + dbName + "." + stbName + " where location = '" + locations[random.nextInt(locations.length)] + "'"; + } + + public static String selectGroupBy(String field, String dbName, String stbName) { + return "select avg(" + field + ") from " + dbName + "." + stbName + " group by location"; + } + + public static String selectLike(String dbName, String stbName) { + return "select * from " + dbName + "." + stbName + " where location like 'S%'"; + } + + public static String selectLastOneHour(String dbName, String stbName) { + return "select * from " + dbName + "." + stbName + " where ts >= now - 1h"; + } + + public static String selectLastOneDay(String dbName, String stbName) { + return "select * from " + dbName + "." + stbName + " where ts >= now - 1d"; + } + + public static String selectLastOneWeek(String dbName, String stbName) { + return "select * from " + dbName + "." + stbName + " where ts >= now - 1w"; + } + + public static String selectLastOneMonth(String dbName, String stbName) { + return "select * from " + dbName + "." + stbName + " where ts >= now - 1n"; + } + + public static String selectLastOneYear(String dbName, String stbName) { + return "select * from " + dbName + "." + stbName + " where ts >= now - 1y"; + } + // select group by + // select like + // select ts >= ts<= } \ No newline at end of file diff --git a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/TimeStampUtil.java b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/TimeStampUtil.java index d00471f58147f9c66f3747c1f8a1eadbae3a6dab..0a345afdd1e45123d889d7ee198cf8efd201176b 100644 --- a/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/TimeStampUtil.java +++ b/tests/examples/JDBC/JDBCDemo/src/main/java/com/taosdata/example/jdbcTaosdemo/utils/TimeStampUtil.java @@ -1,8 +1,10 @@ package com.taosdata.example.jdbcTaosdemo.utils; -import java.sql.Date; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.time.Duration; +import java.time.Instant; +import java.util.Date; public class TimeStampUtil { private static final String datetimeFormat = "yyyy-MM-dd HH:mm:ss.SSS"; @@ -21,14 +23,14 @@ public class TimeStampUtil { return sdf.format(new Date(time)); } - public static void main(String[] args) { - final String startTime = "2005-01-01 00:00:00.000"; + public static void main(String[] args) throws ParseException { + +// Instant now = Instant.now(); +// System.out.println(now); +// Instant years20Ago = now.minus(Duration.ofDays(365)); +// System.out.println(years20Ago); - long start = TimeStampUtil.datetimeToLong(startTime); - System.out.println(start); - String datetime = TimeStampUtil.longToDatetime(1519833600000L); - System.out.println(datetime); } diff --git a/tests/examples/JDBC/JDBCDemo/src/test/java/com/taosdata/example/jdbcTaosdemo/utils/TimeStampUtilTest.java b/tests/examples/JDBC/JDBCDemo/src/test/java/com/taosdata/example/jdbcTaosdemo/utils/TimeStampUtilTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f370b2ef6eaa708b061ebf4a7f58f3d31f78f999 --- /dev/null +++ b/tests/examples/JDBC/JDBCDemo/src/test/java/com/taosdata/example/jdbcTaosdemo/utils/TimeStampUtilTest.java @@ -0,0 +1,52 @@ +package com.taosdata.example.jdbcTaosdemo.utils; + +import org.junit.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.Duration; +import java.time.Instant; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; +import java.util.Date; + +import static org.junit.Assert.*; + +public class TimeStampUtilTest { + + @Test + public void datetimeToLong() { + final String startTime = "2005-01-01 00:00:00.000"; + long start = TimeStampUtil.datetimeToLong(startTime); + assertEquals(1104508800000l, start); + } + + @Test + public void longToDatetime() { + String datetime = TimeStampUtil.longToDatetime(1510000000000L); + assertEquals("2017-11-07 04:26:40.000", datetime); + } + + @Test + public void getStartDateTime() { + int keep = 365; + + Instant end = Instant.now(); + System.out.println(end.toString()); + System.out.println(end.toEpochMilli()); + + Instant start = end.minus(Duration.ofDays(keep)); + System.out.println(start.toString()); + System.out.println(start.toEpochMilli()); + + int numberOfRecordsPerTable = 10; + long timeGap = ChronoUnit.MILLIS.between(start, end) / (numberOfRecordsPerTable - 1); + System.out.println(timeGap); + + System.out.println("==========================="); + for (int i = 0; i < numberOfRecordsPerTable; i++) { + long ts = start.toEpochMilli() + (i * timeGap); + System.out.println(i + " : " + ts); + } + } +} \ No newline at end of file diff --git a/tests/examples/JDBC/calciteDemo/pom.xml b/tests/examples/JDBC/calciteDemo/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a7d47837d9ba407f3959a00d522a9cd26b5622db --- /dev/null +++ b/tests/examples/JDBC/calciteDemo/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + com.taosdata.example.calcite + calciteDemo + 1.0-SNAPSHOT + + + + + org.slf4j + slf4j-simple + 1.7.25 + compile + + + + org.apache.calcite + calcite-core + 1.23.0 + + + org.apache.commons + commons-dbcp2 + 2.7.0 + + + org.apache.calcite.avatica + avatica-core + 1.17.0 + + + + + mysql + mysql-connector-java + 5.1.47 + + + + + com.taosdata.jdbc + taos-jdbcdriver + 2.0.8 + + + + + + \ No newline at end of file diff --git a/tests/examples/JDBC/calciteDemo/src/main/java/com/taosdata/example/calcite/CalciteDemo.java b/tests/examples/JDBC/calciteDemo/src/main/java/com/taosdata/example/calcite/CalciteDemo.java new file mode 100644 index 0000000000000000000000000000000000000000..7e97956b7879c26056b9b0e27cce4786284ff96c --- /dev/null +++ b/tests/examples/JDBC/calciteDemo/src/main/java/com/taosdata/example/calcite/CalciteDemo.java @@ -0,0 +1,67 @@ +package com.taosdata.example.calcite; + +import org.apache.calcite.adapter.jdbc.JdbcSchema; +import org.apache.calcite.jdbc.CalciteConnection; +import org.apache.calcite.schema.Schema; +import org.apache.calcite.schema.SchemaPlus; +import org.apache.calcite.sql.parser.SqlParseException; +import org.apache.commons.dbcp2.BasicDataSource; + +import java.sql.*; +import java.util.Properties; + +public class CalciteDemo { + + private static String url_taos = "jdbc:TAOS://192.168.236.135:6030/test"; + private static String url_mysql = "jdbc:mysql://master:3306/test?useSSL=false&useUnicode=true&characterEncoding=UTF-8"; + + public static void main(String[] args) throws SqlParseException, ClassNotFoundException, SQLException { + Class.forName("org.apache.calcite.jdbc.Driver"); + Properties info = new Properties(); + info.setProperty("caseSensitive", "false"); + + Connection connection = DriverManager.getConnection("jdbc:calcite:", info); + CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class); + + SchemaPlus rootSchema = calciteConnection.getRootSchema(); + + //这里hdb是在tdengine中创建的数据库名 + Schema schema = mysqlTest(rootSchema); +// Schema schema = tdengineTest(rootSchema); + + //创建新的schema自动映射到原来的hdb数据库 + rootSchema.add("test", schema); + + Statement stmt = calciteConnection.createStatement(); + //查询schema test中的表,表名是tdengine中的表 + ResultSet rs = stmt.executeQuery("select * from test.t"); + ResultSetMetaData metaData = rs.getMetaData(); + while (rs.next()) { + for (int i = 1; i <= metaData.getColumnCount(); i++) { + System.out.println(metaData.getColumnLabel(i) + " : " + rs.getString(i)); + } + } + } + + + private static Schema tdengineTest(SchemaPlus rootSchema) throws ClassNotFoundException { + Class.forName("com.taosdata.jdbc.TSDBDriver"); + BasicDataSource dataSource = new BasicDataSource(); + dataSource.setUrl(url_taos); + dataSource.setUsername("root"); + dataSource.setPassword("taosdata"); + + return JdbcSchema.create(rootSchema, "test", dataSource, "hdb", null); + } + + private static Schema mysqlTest(SchemaPlus rootSchema) throws ClassNotFoundException { + Class.forName("com.mysql.jdbc.Driver"); + BasicDataSource dataSource = new BasicDataSource(); + dataSource.setUrl(url_mysql); + dataSource.setUsername("root"); + dataSource.setPassword("123456"); + + //Schema schema = JdbcSchema.create(rootSchema, "test", dataSource, "hdb", null); + return JdbcSchema.create(rootSchema, "test", dataSource, "test", null); + } +} diff --git a/tests/examples/JDBC/calciteDemo/src/main/resources/log4j.properties b/tests/examples/JDBC/calciteDemo/src/main/resources/log4j.properties new file mode 100644 index 0000000000000000000000000000000000000000..1a77ec520cd3e727ac51acb4b8f647b7cf188d97 --- /dev/null +++ b/tests/examples/JDBC/calciteDemo/src/main/resources/log4j.properties @@ -0,0 +1,6 @@ +log4j.rootLogger=info,stdout + +#console +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern= [%d{yyyy-MM-dd HH:mm:ss a}]:%p %l%m%n \ No newline at end of file diff --git a/tests/examples/c/demo.c b/tests/examples/c/demo.c index d64c0de1ce45597e26396979bb693cc0f96873d5..8f8a66a32593bc25d71b554808719ca42f5b32ac 100644 --- a/tests/examples/c/demo.c +++ b/tests/examples/c/demo.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) { taos = taos_connect(argv[1], "root", "taosdata", NULL, 0); if (taos == NULL) { - printf("failed to connect to server, reason:%s\n", taos_errstr(taos)); + printf("failed to connect to server, reason:%s\n", "null taos"/*taos_errstr(taos)*/); exit(1); } printf("success to connect to server\n"); @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) { result = taos_query(taos, "create database demo"); if (result == NULL) { - printf("failed to create database, reason:%s\n", taos_errstr(taos)); + printf("failed to create database, reason:%s\n", "null result"/*taos_errstr(taos)*/); exit(1); } printf("success to create database\n"); @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) { // create table if (taos_query(taos, "create table m1 (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10))") == 0) { - printf("failed to create table, reason:%s\n", taos_errstr(taos)); + printf("failed to create table, reason:%s\n", taos_errstr(result)); exit(1); } printf("success to create table\n"); @@ -70,9 +70,19 @@ int main(int argc, char *argv[]) { for (i = 0; i < 10; ++i) { sprintf(qstr, "insert into m1 values (%" PRId64 ", %d, %d, %d, %d, %f, %lf, '%s')", 1546300800000 + i * 1000, i, i, i, i*10000000, i*1.0, i*2.0, "hello"); printf("qstr: %s\n", qstr); - if (taos_query(taos, qstr)) { - printf("insert row: %i, reason:%s\n", i, taos_errstr(taos)); + + // note: how do you wanna do if taos_query returns non-NULL + // if (taos_query(taos, qstr)) { + // printf("insert row: %i, reason:%s\n", i, taos_errstr(taos)); + // } + TAOS_RES *result = taos_query(taos, qstr); + if (result) { + printf("insert row: %i\n", i); + } else { + printf("failed to insert row: %i, reason:%s\n", i, "null result"/*taos_errstr(result)*/); + exit(1); } + //sleep(1); } printf("success to insert rows, total %d rows\n", i); diff --git a/tests/examples/nodejs/nodejsChecker.js b/tests/examples/nodejs/nodejsChecker.js new file mode 100644 index 0000000000000000000000000000000000000000..c77944f75243a50e6e2c738e659cb4e64f3e5574 --- /dev/null +++ b/tests/examples/nodejs/nodejsChecker.js @@ -0,0 +1,60 @@ +const taos = require('td2.0-connector'); + + +var host = null; +var port = 6030; +for(var i = 2; i < global.process.argv.length; i++){ + var key = global.process.argv[i].split("=")[0]; + var value = global.process.argv[i].split("=")[1]; + + if("host" == key){ + host = value; + } + if("port" == key){ + port = value; + } +} + +if(host == null){ + console.log("Usage: node nodejsChecker.js host= port="); + process.exit(0); +} + +// establish connection +var conn = taos.connect({host:host, user:"root", password:"taosdata",port:port}); +var cursor = conn.cursor(); +// create database +executeSql("create database if not exists test", 0); +// use db +executeSql("use test", 0); +// drop table +executeSql("drop table if exists test.weather", 0); +// create table +executeSql("create table if not exists test.weather(ts timestamp, temperature float, humidity int)", 0); +// insert +executeSql("insert into test.weather (ts, temperature, humidity) values(now, 20.5, 34)", 1); +// select +executeQuery("select * from test.weather"); +// close connection +conn.close(); + +function executeQuery(sql){ + var start = new Date().getTime(); + var promise = cursor.query(sql, true); + var end = new Date().getTime(); + printSql(sql, promise != null,(end - start)); + promise.then(function(result){ + result.pretty(); + }); +} + +function executeSql(sql, affectRows){ + var start = new Date().getTime(); + var promise = cursor.execute(sql); + var end = new Date().getTime(); + printSql(sql, promise == affectRows, (end - start)); +} + +function printSql(sql, succeed, cost){ + console.log("[ "+(succeed ? "OK" : "ERROR!")+" ] time cost: " + cost + " ms, execute statement ====> " + sql); +} diff --git a/tests/examples/python/PYTHONConnectorChecker/PythonChecker.py b/tests/examples/python/PYTHONConnectorChecker/PythonChecker.py new file mode 100644 index 0000000000000000000000000000000000000000..d74f021ffcf3aa33c551cc265243b5139c23b757 --- /dev/null +++ b/tests/examples/python/PYTHONConnectorChecker/PythonChecker.py @@ -0,0 +1,114 @@ +import taos +import time +import sys +import getopt +class ConnectorChecker: + def init(self): + self.host = "127.0.0.1" + self.dbName = "test" + self.tbName = "weather" + self.user = "root" + self.password = "taosdata" + + + def sethdt(self,FQDN,dbname,tbname): + if(FQDN): + self.host=FQDN + if(dbname): + self.dbname=dbname + if(tbname): + self.tbName + def printSql(self,sql,elapsed): + print("[ "+"OK"+" ]"+" time cost: %s ms, execute statement ====> %s" + %(elapsed,sql)) + def executeQuery(self,sql): + try: + start=time.time() + execute = self.cl.execute(sql) + elapsed = (time.time()-start)*1000 + self.printSql(sql,elapsed) + data = self.cl.fetchall() + numOfRows = self.cl.rowcount + numOfCols = len(self.cl.description) + for irow in range(numOfRows): + print("Row%d: ts=%s, temperature=%d, humidity=%f" %(irow, data[irow][0], data[irow][1],data[irow][2])) + except Exception as e: + print("Failure sql: %s,exception: %s" %sql,str(e)) + def execute(self,sql): + try: + start=time.time() + execute = self.cl.execute(sql) + elapsed = (time.time()-start)*1000 + self.printSql(sql,elapsed) + + except Exception as e: + print("Failure sql: %s,exception: %s" % + sql,str(e)) + def close(self): + print("connetion closed.") + self.cl.close() + self.conn.close() + def createDatabase(self): + sql="create database if not exists %s" % self.dbName + self.execute(sql) + def useDatabase(self): + sql="use %s" % self.dbName + self.execute(sql) + def createTable(self): + sql="create table if not exists %s.%s (ts timestamp, temperature float, humidity int)"%(self.dbName,self.tbName) + self.execute(sql) + def checkDropTable(self): + sql="drop table if exists " + self.dbName + "." + self.tbName + "" + self.execute(sql) + def checkInsert(self): + sql="insert into test.weather (ts, temperature, humidity) values(now, 20.5, 34)" + self.execute(sql) + def checkSelect(self): + sql = "select * from test.weather" + self.executeQuery(sql) + def srun(self): + try: + self.conn = taos.connect(host=self.host,user=self.user,password=self.password) + #self.conn = taos.connect(self.host,self.user,self.password) + except Exception as e: + print("connection failed: %s"%self.host) + exit(1) + print("[ OK ] Connection established.") + self.cl = self.conn.cursor() + +def main(argv): + FQDN='' + dbname='' + tbname='' + try: + opts, args = getopt.getopt(argv,"h:d:t:",["FQDN=","ifile=","ofile="]) + except getopt.GetoptError: + print ('PYTHONConnectorChecker.py -h ') + sys.exit(2) + for opt, arg in opts: + if opt in ("-h", "--FQDN"): + FQDN=arg + elif opt in ("-d", "--dbname"): + dbname = arg + elif opt in ("-t", "--tbname"): + tbname = arg + + checker = ConnectorChecker() + checker.init() + checker.sethdt(FQDN,dbname,tbname) + checker.srun() + checker.createDatabase() + checker.useDatabase() + checker.checkDropTable() + checker.createTable() + checker.checkInsert() + checker.checkSelect() + checker.checkDropTable() + checker.close() + + + +if __name__ == "__main__": + main(sys.argv[1:]) + + diff --git a/tests/examples/rust/src/bindings.rs b/tests/examples/rust/src/bindings.rs index b93e833ba05dbc4bbf2a390a5cf801d27c340590..fc13647130995b2a85b485236ec9a7ba30c1cc1b 100644 --- a/tests/examples/rust/src/bindings.rs +++ b/tests/examples/rust/src/bindings.rs @@ -308,12 +308,6 @@ extern "C" { extern "C" { pub fn taos_unsubscribe(tsub: *mut ::std::os::raw::c_void); } -extern "C" { - pub fn taos_subfields_count(tsub: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; -} -extern "C" { - pub fn taos_fetch_subfields(tsub: *mut ::std::os::raw::c_void) -> *mut TAOS_FIELD; -} extern "C" { pub fn taos_open_stream( taos: *mut ::std::os::raw::c_void, diff --git a/tests/examples/rust/src/subscriber.rs b/tests/examples/rust/src/subscriber.rs index b6812d7b6e5b48016c62c3bb45d11bfb7fd85e0b..78c6f5cd8d036be537da11f34f829d48750d2a73 100644 --- a/tests/examples/rust/src/subscriber.rs +++ b/tests/examples/rust/src/subscriber.rs @@ -37,16 +37,16 @@ impl Subscriber { println!("subscribed to {} user:{}, db:{}, tb:{}, time:{}, mseconds:{}", host, username, db, table, time, mseconds); - let mut fields = taos_fetch_subfields(tsub); + let mut fields = taos_fetch_fields(tsub); if fields.is_null() { taos_unsubscribe(tsub); - return Err("fetch subfields error") + return Err("fetch fields error") } - let fcount = taos_subfields_count(tsub); + let fcount = taos_field_count(tsub); if fcount == 0 { taos_unsubscribe(tsub); - return Err("subfields count is 0") + return Err("fields count is 0") } Ok(Subscriber{tsub, fields, fcount}) @@ -74,4 +74,4 @@ impl Drop for Subscriber { fn drop(&mut self) { unsafe {taos_unsubscribe(self.tsub);} } -} \ No newline at end of file +} diff --git a/tests/gotest/batchtest.bat b/tests/gotest/batchtest.bat new file mode 100644 index 0000000000000000000000000000000000000000..abe9a58f319068d5e11017abcd721a4c54d6aca9 --- /dev/null +++ b/tests/gotest/batchtest.bat @@ -0,0 +1,17 @@ +@echo off +echo ==== start Go connector test cases test ==== +cd /d %~dp0 + +set severIp=%1 +set serverPort=%2 +if "%severIp%"=="" (set severIp=127.0.0.1) +if "%serverPort%"=="" (set serverPort=6030) + +cd case001 +case001.bat %severIp% %serverPort% + +rem cd case002 +rem case002.bat + +:: cd case002 +:: case002.bat diff --git a/tests/gotest/batchtest.sh b/tests/gotest/batchtest.sh index a027dd0d7ce04c599233157bdd618fad3885c809..e8ed9ecbed9f70c98e6b5db052c3e69082c1794d 100644 --- a/tests/gotest/batchtest.sh +++ b/tests/gotest/batchtest.sh @@ -1,5 +1,18 @@ #!/bin/bash -bash ./case001/case001.sh -#bash ./case002/case002.sh -#bash ./case003/case003.sh +echo "==== start Go connector test cases test ====" + +severIp=$1 +serverPort=$2 + +if [ ! -n "$severIp" ]; then + severIp=127.0.0.1 +fi + +if [ ! -n "$serverPort" ]; then + serverPort=6030 +fi + +bash ./case001/case001.sh $severIp $serverPort +#bash ./case002/case002.sh $severIp $serverPort +#bash ./case003/case003.sh $severIp $serverPort diff --git a/tests/gotest/case001/case001.bat b/tests/gotest/case001/case001.bat new file mode 100644 index 0000000000000000000000000000000000000000..ebec576e724ccb14319dd380c9783a783ac0db62 --- /dev/null +++ b/tests/gotest/case001/case001.bat @@ -0,0 +1,9 @@ +@echo off +echo ==== start run cases001.go + +del go.* +go mod init demotest +go build +demotest.exe -h %1 -p %2 +cd .. + diff --git a/tests/gotest/case001/case001.go b/tests/gotest/case001/case001.go index 1d5ede6d21a0bacad34cb807a16b50e0ae643512..fb94f566dd7fa9ef8932bc28326310681998b410 100644 --- a/tests/gotest/case001/case001.go +++ b/tests/gotest/case001/case001.go @@ -16,20 +16,53 @@ package main import ( "database/sql" + "flag" "fmt" _ "github.com/taosdata/driver-go/taosSql" "log" + "strconv" "time" ) +type config struct { + hostName string + serverPort int + user string + password string +} + +var configPara config +var url string + +func init() { + flag.StringVar(&configPara.hostName, "h", "127.0.0.1","The host to connect to TDengine server.") + flag.IntVar(&configPara.serverPort, "p", 6030, "The TCP/IP port number to use for the connection to TDengine server.") + flag.StringVar(&configPara.user, "u", "root", "The TDengine user name to use when connecting to the server.") + flag.StringVar(&configPara.password, "P", "taosdata", "The password to use when connecting to the server.") + + flag.Parse() +} + +func printAllArgs() { + fmt.Printf("\n============= args parse result: =============\n") + fmt.Printf("hostName: %v\n", configPara.hostName) + fmt.Printf("serverPort: %v\n", configPara.serverPort) + fmt.Printf("usr: %v\n", configPara.user) + fmt.Printf("password: %v\n", configPara.password) + fmt.Printf("================================================\n") +} + func main() { + printAllArgs() taosDriverName := "taosSql" demodb := "demodb" demot := "demot" fmt.Printf("\n======== start demo test ========\n") + + url = "root:taosdata@/tcp(" + configPara.hostName + ":" + strconv.Itoa(configPara.serverPort) + ")/" // open connect to taos server - db, err := sql.Open(taosDriverName, "root:taosdata@/tcp(192.168.1.217:7100)/") + db, err := sql.Open(taosDriverName, url) if err != nil { log.Fatalf("Open database error: %s\n", err) } diff --git a/tests/gotest/case001/case001.sh b/tests/gotest/case001/case001.sh index 5a9034c4d18e257eaaf9324c570fbc17b01c548b..831e9f83ac482c0a2c668e2ad0d16c4bf59f19aa 100644 --- a/tests/gotest/case001/case001.sh +++ b/tests/gotest/case001/case001.sh @@ -1,10 +1,6 @@ #!/bin/bash -################################################## -# -# Do go test -# -################################################## +echo "==== start run cases001.go" set +e #set -x @@ -12,59 +8,14 @@ set +e script_dir="$(dirname $(readlink -f $0))" #echo "pwd: $script_dir, para0: $0" -execName=$0 -execName=`echo ${execName##*/}` -goName=`echo ${execName%.*}` - -###### step 1: start one taosd -scriptDir=$script_dir/../../script/sh -bash $scriptDir/stop_dnodes.sh -bash $scriptDir/deploy.sh -n dnode1 -i 1 -bash $scriptDir/cfg.sh -n dnode1 -c walLevel -v 0 -bash $scriptDir/exec.sh -n dnode1 -s start - -###### step 2: set config item -TAOS_CFG=/etc/taos/taos.cfg -HOSTNAME=`hostname -f` - -if [ ! -f ${TAOS_CFG} ]; then - touch -f $TAOS_CFG -fi - -echo " " > $TAOS_CFG -echo "firstEp ${HOSTNAME}:7100" >> $TAOS_CFG -echo "secondEp ${HOSTNAME}:7200" >> $TAOS_CFG -echo "serverPort 7100" >> $TAOS_CFG -#echo "dataDir $DATA_DIR" >> $TAOS_CFG -#echo "logDir $LOG_DIR" >> $TAOS_CFG -#echo "scriptDir ${CODE_DIR}/../script" >> $TAOS_CFG -echo "numOfLogLines 100000000" >> $TAOS_CFG -echo "dDebugFlag 135" >> $TAOS_CFG -echo "mDebugFlag 135" >> $TAOS_CFG -echo "sdbDebugFlag 135" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG -echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "cDebugFlag 135" >> $TAOS_CFG -echo "httpDebugFlag 135" >> $TAOS_CFG -echo "monitorDebugFlag 135" >> $TAOS_CFG -echo "udebugFlag 135" >> $TAOS_CFG -echo "tablemetakeeptimer 5" >> $TAOS_CFG -echo "wal 0" >> $TAOS_CFG -echo "asyncLog 0" >> $TAOS_CFG -echo "locale en_US.UTF-8" >> $TAOS_CFG -echo "enableCoreFile 1" >> $TAOS_CFG -echo " " >> $TAOS_CFG - -ulimit -n 600000 -ulimit -c unlimited -# -##sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e -# +#execName=$0 +#execName=`echo ${execName##*/}` +#goName=`echo ${execName%.*}` ###### step 3: start build cd $script_dir rm -f go.* -go mod init $goName +go mod init demotest go build -sleep 1s -sudo ./$goName +sleep 1s +./demotest -h $1 -p $2 diff --git a/tests/pytest/concurrent_inquiry.py b/tests/pytest/concurrent_inquiry.py new file mode 100644 index 0000000000000000000000000000000000000000..39a4cb48fdc22060f63f443a4ac8142cd6a6903e --- /dev/null +++ b/tests/pytest/concurrent_inquiry.py @@ -0,0 +1,169 @@ +################################################################### +# 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 threading +import taos +import sys +import json +import time +import random +# query sql +query_sql = [ +# first supertable +"select count(*) from test.meters ;", +"select count(*) from test.meters where t3 > 2;", +"select count(*) from test.meters where ts <> '2020-05-13 10:00:00.002';", +"select count(*) from test.meters where t7 like 'taos_1%';", +"select count(*) from test.meters where t7 like '_____2';", +"select count(*) from test.meters where t8 like '%思%';", +"select count(*) from test.meters interval(1n) order by ts desc;", +#"select max(c0) from test.meters group by tbname", +"select first(ts) from test.meters where t5 >5000 and t5<5100;", +"select last(ts) from test.meters where t5 >5000 and t5<5100;", +"select last_row(*) from test.meters;", +"select twa(c1) from test.t1 where ts > 1500000001000 and ts < 1500000101000" , +"select avg(c1) from test.meters where t5 >5000 and t5<5100;", +"select bottom(c1, 2) from test.t1;", +"select diff(c1) from test.t1;", +"select leastsquares(c1, 1, 1) from test.t1 ;", +"select max(c1) from test.meters where t5 >5000 and t5<5100;", +"select min(c1) from test.meters where t5 >5000 and t5<5100;", +"select c1 + c2 + c1 / c5 + c4 + c2 from test.t1;", +"select percentile(c1, 50) from test.t1;", +"select spread(c1) from test.t1 ;", +"select stddev(c1) from test.t1;", +"select sum(c1) from test.meters where t5 >5000 and t5<5100;", +"select top(c1, 2) from test.meters where t5 >5000 and t5<5100;" +"select twa(c4) from test.t1 where ts > 1500000001000 and ts < 1500000101000" , +"select avg(c4) from test.meters where t5 >5000 and t5<5100;", +"select bottom(c4, 2) from test.t1 where t5 >5000 and t5<5100;", +"select diff(c4) from test.t1 where t5 >5000 and t5<5100;", +"select leastsquares(c4, 1, 1) from test.t1 ;", +"select max(c4) from test.meters where t5 >5000 and t5<5100;", +"select min(c4) from test.meters where t5 >5000 and t5<5100;", +"select c5 + c2 + c4 / c5 + c4 + c2 from test.t1 ;", +"select percentile(c5, 50) from test.t1;", +"select spread(c5) from test.t1 ;", +"select stddev(c5) from test.t1 where t5 >5000 and t5<5100;", +"select sum(c5) from test.meters where t5 >5000 and t5<5100;", +"select top(c5, 2) from test.meters where t5 >5000 and t5<5100;", +#all vnode +"select count(*) from test.meters where t5 >5000 and t5<5100", +"select max(c0),avg(c1) from test.meters where t5 >5000 and t5<5100", +"select sum(c5),avg(c1) from test.meters where t5 >5000 and t5<5100", +"select max(c0),min(c5) from test.meters where t5 >5000 and t5<5100", +"select min(c0),avg(c5) from test.meters where t5 >5000 and t5<5100", +# second supertable +"select count(*) from test.meters1 where t3 > 2;", +"select count(*) from test.meters1 where ts <> '2020-05-13 10:00:00.002';", +"select count(*) from test.meters where t7 like 'taos_1%';", +"select count(*) from test.meters where t7 like '_____2';", +"select count(*) from test.meters where t8 like '%思%';", +"select count(*) from test.meters1 interval(1n) order by ts desc;", +#"select max(c0) from test.meters1 group by tbname", +"select first(ts) from test.meters1 where t5 >5000 and t5<5100;", +"select last(ts) from test.meters1 where t5 >5000 and t5<5100;", +"select last_row(*) from test.meters1 ;", +"select twa(c1) from test.m1 where ts > 1500000001000 and ts < 1500000101000" , +"select avg(c1) from test.meters1 where t5 >5000 and t5<5100;", +"select bottom(c1, 2) from test.m1 where t5 >5000 and t5<5100;", +"select diff(c1) from test.m1 ;", +"select leastsquares(c1, 1, 1) from test.m1 ;", +"select max(c1) from test.meters1 where t5 >5000 and t5<5100;", +"select min(c1) from test.meters1 where t5 >5000 and t5<5100;", +"select c1 + c2 + c1 / c0 + c2 from test.m1 ;", +"select percentile(c1, 50) from test.m1;", +"select spread(c1) from test.m1 ;", +"select stddev(c1) from test.m1;", +"select sum(c1) from test.meters1 where t5 >5000 and t5<5100;", +"select top(c1, 2) from test.meters1 where t5 >5000 and t5<5100;", +"select twa(c5) from test.m1 where ts > 1500000001000 and ts < 1500000101000" , +"select avg(c5) from test.meters1 where t5 >5000 and t5<5100;", +"select bottom(c5, 2) from test.m1;", +"select diff(c5) from test.m1;", +"select leastsquares(c5, 1, 1) from test.m1 ;", +"select max(c5) from test.meters1 where t5 >5000 and t5<5100;", +"select min(c5) from test.meters1 where t5 >5000 and t5<5100;", +"select c5 + c2 + c4 / c5 + c0 from test.m1;", +"select percentile(c4, 50) from test.m1;", +"select spread(c4) from test.m1 ;", +"select stddev(c4) from test.m1;", +"select sum(c4) from test.meters1 where t5 >5100 and t5<5300;", +"select top(c4, 2) from test.meters1 where t5 >5100 and t5<5300;", +"select count(*) from test.meters1 where t5 >5100 and t5<5300", +#all vnode +"select count(*) from test.meters1 where t5 >5100 and t5<5300", +"select max(c0),avg(c1) from test.meters1 where t5 >5000 and t5<5100", +"select sum(c5),avg(c1) from test.meters1 where t5 >5000 and t5<5100", +"select max(c0),min(c5) from test.meters1 where t5 >5000 and t5<5100", +"select min(c0),avg(c5) from test.meters1 where t5 >5000 and t5<5100", +#join +# "select * from meters,meters1 where meters.ts = meters1.ts and meters.t5 = meters1.t5", +# "select * from meters,meters1 where meters.ts = meters1.ts and meters.t7 = meters1.t7", +# "select * from meters,meters1 where meters.ts = meters1.ts and meters.t8 = meters1.t8", +# "select meters.ts,meters1.c2 from meters,meters1 where meters.ts = meters1.ts and meters.t8 = meters1.t8" +] + +class ConcurrentInquiry: + def initConnection(self): + self.numOfTherads = 50 + self.ts=1500000001000 + + def SetThreadsNum(self,num): + self.numOfTherads=num + def query_thread(self,threadID): + host = "10.211.55.14" + user = "root" + password = "taosdata" + conn = taos.connect( + host, + user, + password, + ) + cl = conn.cursor() + cl.execute("use test;") + + print("Thread %d: starting" % threadID) + + while True: + ran_query_sql=query_sql + random.shuffle(ran_query_sql) + for i in ran_query_sql: + print("Thread %d : %s"% (threadID,i)) + try: + start = time.time() + cl.execute(i) + cl.fetchall + end = time.time() + print("time cost :",end-start) + except Exception as e: + print( + "Failure thread%d, sql: %s,exception: %s" % + (threadID, str(i),str(e))) + exit(-1) + + + print("Thread %d: finishing" % threadID) + + + + def run(self): + + threads = [] + for i in range(self.numOfTherads): + thread = threading.Thread(target=self.query_thread, args=(i,)) + threads.append(thread) + thread.start() + +q = ConcurrentInquiry() +q.initConnection() +q.run() diff --git a/tests/pytest/crash_gen.sh b/tests/pytest/crash_gen.sh index df1a9f595b986215deb69a5f9f99a3a5847f41dd..4ffe35fc3c94edbdd194e03171696a1d681387c1 100755 --- a/tests/pytest/crash_gen.sh +++ b/tests/pytest/crash_gen.sh @@ -35,18 +35,45 @@ CURR_DIR=`pwd` IN_TDINTERNAL="community" if [[ "$CURR_DIR" == *"$IN_TDINTERNAL"* ]]; then TAOS_DIR=$CURR_DIR/../../.. + TAOSD_DIR=`find $TAOS_DIR -name "taosd"|grep bin|head -n1` + LIB_DIR=`echo $TAOSD_DIR|rev|cut -d '/' -f 3,4,5,6,7|rev`/lib else TAOS_DIR=$CURR_DIR/../.. + TAOSD_DIR=`find $TAOS_DIR -name "taosd"|grep bin|head -n1` + LIB_DIR=`echo $TAOSD_DIR|rev|cut -d '/' -f 3,4,5,6|rev`/lib fi -TAOSD_DIR=`find $TAOS_DIR -name "taosd"|grep bin|head -n1` -LIB_DIR=`echo $TAOSD_DIR|rev|cut -d '/' -f 3,4,5,6|rev`/lib +# Now getting ready to execute Python +# The following is the default of our standard dev env (Ubuntu 20.04), modify/adjust at your own risk +PYTHON_EXEC=python3.8 # First we need to set up a path for Python to find our own TAOS modules, so that "import" can work. -export PYTHONPATH=$(pwd)/../../src/connector/python/linux/python3 +export PYTHONPATH=$(pwd)/../../src/connector/python/linux/python3:$(pwd) # Then let us set up the library path so that our compiled SO file can be loaded by Python export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LIB_DIR # Now we are all let, and let's see if we can find a crash. Note we pass all params -python3.8 ./crash_gen.py $@ +if [[ $1 == '--valgrind' ]]; then + shift + export PYTHONMALLOC=malloc + VALGRIND_OUT=valgrind.out + VALGRIND_ERR=valgrind.err + # How to generate valgrind suppression file: https://stackoverflow.com/questions/17159578/generating-suppressions-for-memory-leaks + # valgrind --leak-check=full --gen-suppressions=all --log-fd=9 python3.8 ./crash_gen.py $@ 9>>memcheck.log + echo Executing under VALGRIND, with STDOUT/ERR going to $VALGRIND_OUT and $VALGRIND_ERR, please watch them from a different terminal. + valgrind \ + --leak-check=yes \ + --suppressions=crash_gen/valgrind_taos.supp \ + $PYTHON_EXEC \ + ./crash_gen/crash_gen.py $@ > $VALGRIND_OUT 2> $VALGRIND_ERR +elif [[ $1 == '--helgrind' ]]; then + shift + valgrind \ + --tool=helgrind \ + $PYTHON_EXEC \ + ./crash_gen/crash_gen.py $@ +else + $PYTHON_EXEC ./crash_gen/crash_gen.py $@ +fi + diff --git a/tests/pytest/crash_gen.py b/tests/pytest/crash_gen/crash_gen.py similarity index 84% rename from tests/pytest/crash_gen.py rename to tests/pytest/crash_gen/crash_gen.py index fee355eef95bc1ce8d33699d85debed7756ba434..48196ab383c974b5c5d3f5ebc54773cd846353e6 100755 --- a/tests/pytest/crash_gen.py +++ b/tests/pytest/crash_gen/crash_gen.py @@ -15,7 +15,6 @@ # https://stackoverflow.com/questions/33533148/how-do-i-specify-that-the-return-type-of-a-method-is-the-same-as-the-class-itsel from __future__ import annotations import taos -import crash_gen from util.sql import * from util.cases import * from util.dnodes import * @@ -42,6 +41,9 @@ import os import io import signal import traceback +import resource +from guppy import hpy +import gc try: import psutil @@ -53,14 +55,13 @@ except: if sys.version_info[0] < 3: raise Exception("Must be using Python 3") - # Global variables, tried to keep a small number. # Command-line/Environment Configurations, will set a bit later # ConfigNameSpace = argparse.Namespace gConfig = argparse.Namespace() # Dummy value, will be replaced later gSvcMgr = None # TODO: refactor this hack, use dep injection -logger = None +logger = None # type: Logger def runThread(wt: WorkerThread): wt.run() @@ -101,7 +102,7 @@ class WorkerThread: else: raise RuntimeError("Unexpected connector type: {}".format(gConfig.connector_type)) - self._dbInUse = False # if "use db" was executed already + # self._dbInUse = False # if "use db" was executed already def logDebug(self, msg): logger.debug(" TRD[{}] {}".format(self._tid, msg)) @@ -109,13 +110,13 @@ class WorkerThread: def logInfo(self, msg): logger.info(" TRD[{}] {}".format(self._tid, msg)) - def dbInUse(self): - return self._dbInUse + # def dbInUse(self): + # return self._dbInUse - def useDb(self): - if (not self._dbInUse): - self.execSql("use db") - self._dbInUse = True + # def useDb(self): + # if (not self._dbInUse): + # self.execSql("use db") + # self._dbInUse = True def getTaskExecutor(self): return self._tc.getTaskExecutor() @@ -161,12 +162,12 @@ class WorkerThread: logger.debug("[TRD] Thread Coordinator not running any more, worker thread now stopping...") break - # Before we fetch the task and run it, let's ensure we properly "use" the database + # Before we fetch the task and run it, let's ensure we properly "use" the database (not needed any more) try: if (gConfig.per_thread_db_connection): # most likely TRUE if not self._dbConn.isOpen: # might have been closed during server auto-restart self._dbConn.open() - self.useDb() # might encounter exceptions. TODO: catch + # self.useDb() # might encounter exceptions. TODO: catch except taos.error.ProgrammingError as err: errno = Helper.convertErrno(err.errno) if errno in [0x383, 0x386, 0x00B, 0x014] : # invalid database, dropping, Unable to establish connection, Database not ready @@ -181,14 +182,13 @@ class WorkerThread: task = tc.fetchTask() # Execute such a task - logger.debug( - "[TRD] Worker thread [{}] about to execute task: {}".format( + logger.debug("[TRD] Worker thread [{}] about to execute task: {}".format( self._tid, task.__class__.__name__)) task.execute(self) tc.saveExecutedTask(task) logger.debug("[TRD] Worker thread [{}] finished executing task".format(self._tid)) - self._dbInUse = False # there may be changes between steps + # self._dbInUse = False # there may be changes between steps # print("_wtd", end=None) # worker thread died def verifyThreadSelf(self): # ensure we are called by this own thread @@ -237,7 +237,7 @@ class WorkerThread: def getQueryResult(self): return self.getDbConn().getQueryResult() - def getDbConn(self): + def getDbConn(self) -> DbConn : if (gConfig.per_thread_db_connection): return self._dbConn else: @@ -255,7 +255,7 @@ class WorkerThread: class ThreadCoordinator: WORKER_THREAD_TIMEOUT = 60 # one minute - def __init__(self, pool: ThreadPool, dbManager): + def __init__(self, pool: ThreadPool, dbManager: DbManager): self._curStep = -1 # first step is 0 self._pool = pool # self._wd = wd @@ -268,6 +268,7 @@ class ThreadCoordinator: self._pool.numThreads + 1) # one barrier for all threads self._execStats = ExecutionStats() self._runStatus = MainExec.STATUS_RUNNING + self._initDbs() def getTaskExecutor(self): return self._te @@ -318,7 +319,7 @@ class ThreadCoordinator: logger.debug("[TRD] Main thread waking up at step {}, tapping worker threads".format( self._curStep)) # Now not all threads had time to go to sleep # Worker threads will wake up at this point, and each execute it's own task - self.tapAllThreads() # release all worker thread from their "gate" + self.tapAllThreads() # release all worker thread from their "gates" def _syncAtBarrier(self): # Now main thread (that's us) is ready to enter a step @@ -332,12 +333,16 @@ class ThreadCoordinator: def _doTransition(self): transitionFailed = False try: - sm = self._dbManager.getStateMachine() - logger.debug("[STT] starting transitions") - # at end of step, transiton the DB state - sm.transition(self._executedTasks) - logger.debug("[STT] transition ended") - # Due to limitation (or maybe not) of the Python library, + for x in self._dbs: + db = x # type: Database + sm = db.getStateMachine() + logger.debug("[STT] starting transitions for DB: {}".format(db.getName())) + # at end of step, transiton the DB state + tasksForDb = db.filterTasks(self._executedTasks) + sm.transition(tasksForDb, self.getDbManager().getDbConn()) + logger.debug("[STT] transition ended for DB: {}".format(db.getName())) + + # Due to limitation (or maybe not) of the TD Python library, # we cannot share connections across threads # Here we are in main thread, we cannot operate the connections created in workers # Moving below to task loop @@ -347,6 +352,7 @@ class ThreadCoordinator: # t.useDb() # t.execSql("use db") # main thread executing "use # db" on behalf of every worker thread + except taos.error.ProgrammingError as err: if (err.msg == 'network unavailable'): # broken DB connection logger.info("DB connection broken, execution failed") @@ -358,7 +364,7 @@ class ThreadCoordinator: # end, and maybe signal them to stop else: raise - return transitionFailed + # return transitionFailed # Why did we have this??!! self.resetExecutedTasks() # clear the tasks after we are done # Get ready for next step @@ -378,6 +384,14 @@ class ThreadCoordinator: while not self._runShouldEnd(transitionFailed, hasAbortedTask, workerTimeout): if not gConfig.debug: # print this only if we are not in debug mode print(".", end="", flush=True) + # if (self._curStep % 2) == 0: # print memory usage once every 10 steps + # memUsage = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss + # print("[m:{}]".format(memUsage), end="", flush=True) # print memory usage + # if (self._curStep % 10) == 3: + # h = hpy() + # print("\n") + # print(h.heap()) + try: self._syncAtBarrier() # For now just cross the barrier @@ -407,6 +421,7 @@ class ThreadCoordinator: errno2 = Helper.convertErrno(err.errno) # correct error scheme errMsg = "Transition failed: errno=0x{:X}, msg: {}".format(errno2, err) logger.info(errMsg) + traceback.print_exc() self._execStats.registerFailure(errMsg) # Then we move on to the next step @@ -430,6 +445,19 @@ class ThreadCoordinator: logger.info("\nAll worker threads finished") self._execStats.endExec() + def cleanup(self): # free resources + self._pool.cleanup() + + self._pool = None + self._te = None + self._dbManager = None + self._executedTasks = None + self._lock = None + self._stepBarrier = None + self._execStats = None + self._runStatus = None + + def printStats(self): self._execStats.printStats() @@ -458,23 +486,34 @@ class ThreadCoordinator: def isRunning(self): return self._te is not None + def _initDbs(self): + ''' Initialize multiple databases, invoked at __ini__() time ''' + self._dbs = [] # type: List[Database] + dbc = self.getDbManager().getDbConn() + if gConfig.max_dbs == 0: + self._dbs.append(Database(0, dbc)) + else: + for i in range(gConfig.max_dbs): + self._dbs.append(Database(i, dbc)) + + def pickDatabase(self): + idxDb = 0 + if gConfig.max_dbs != 0 : + idxDb = Dice.throw(gConfig.max_dbs) # 0 to N-1 + db = self._dbs[idxDb] # type: Database + return db + def fetchTask(self) -> Task: + ''' The thread coordinator (that's us) is responsible for fetching a task + to be executed next. + ''' if (not self.isRunning()): # no task raise RuntimeError("Cannot fetch task when not running") - # return self._wd.pickTask() - # Alternatively, let's ask the DbState for the appropriate task - # dbState = self.getDbState() - # tasks = dbState.getTasksAtState() # TODO: create every time? - # nTasks = len(tasks) - # i = Dice.throw(nTasks) - # logger.debug(" (dice:{}/{}) ".format(i, nTasks)) - # # return copy.copy(tasks[i]) # Needs a fresh copy, to save execution results, etc. - # return tasks[i].clone() # TODO: still necessary? + # pick a task type for current state - taskType = self.getDbManager().getStateMachine().pickTaskType() - return taskType( - self.getDbManager(), - self._execStats) # create a task from it + db = self.pickDatabase() + taskType = db.getStateMachine().pickTaskType() # type: Task + return taskType(self._execStats, db) # create a task from it def resetExecutedTasks(self): self._executedTasks = [] # should be under single thread @@ -510,6 +549,9 @@ class ThreadPool: logger.debug("Joining thread...") workerThread._thread.join() + def cleanup(self): + self.threadList = None # maybe clean up each? + # A queue of continguous POSITIVE integers, used by DbManager to generate continuous numbers # for new table names @@ -632,17 +674,6 @@ class DbConn: logger.debug("[DB] data connection opened, type = {}".format(self._type)) self.isOpen = True - def resetDb(self): # reset the whole database, etc. - if (not self.isOpen): - raise RuntimeError("Cannot reset database until connection is open") - # self._tdSql.prepare() # Recreate database, etc. - - self.execute('drop database if exists db') - logger.debug("Resetting DB, dropped database") - # self._cursor.execute('create database db') - # self._cursor.execute('use db') - # tdSql.execute('show databases') - def queryScalar(self, sql) -> int: return self._queryAny(sql) @@ -654,7 +685,10 @@ class DbConn: raise RuntimeError("Cannot query database until connection is open") nRows = self.query(sql) if nRows != 1: - raise RuntimeError("Unexpected result for query: {}, rows = {}".format(sql, nRows)) + raise taos.error.ProgrammingError( + "Unexpected result for query: {}, rows = {}".format(sql, nRows), + (0x991 if nRows==0 else 0x992) + ) if self.getResultRows() != 1 or self.getResultCols() != 1: raise RuntimeError("Unexpected result set for query: {}".format(sql)) return self.getQueryResult()[0][0] @@ -662,16 +696,32 @@ class DbConn: def use(self, dbName): self.execute("use {}".format(dbName)) - def hasDatabases(self): - return self.query("show databases") > 1 # We now have a "log" database by default + def existsDatabase(self, dbName: str): + ''' Check if a certain database exists ''' + self.query("show databases") + dbs = [v[0] for v in self.getQueryResult()] # ref: https://stackoverflow.com/questions/643823/python-list-transformation + # ret2 = dbName in dbs + # print("dbs = {}, str = {}, ret2={}, type2={}".format(dbs, dbName,ret2, type(dbName))) + return dbName in dbs # TODO: super weird type mangling seen, once here def hasTables(self): return self.query("show tables") > 0 def execute(self, sql): + ''' Return the number of rows affected''' raise RuntimeError("Unexpected execution, should be overriden") + def safeExecute(self, sql): + '''Safely execute any SQL query, returning True/False upon success/failure''' + try: + self.execute(sql) + return True # ignore num of results, return success + except taos.error.ProgrammingError as err: + return False # failed, for whatever TAOS reason + # Not possile to reach here, non-TAOS exception would have been thrown + def query(self, sql) -> int: # return num rows returned + ''' Return the number of rows affected''' raise RuntimeError("Unexpected execution, should be overriden") def openByType(self): @@ -766,6 +816,13 @@ class DbConnRest(DbConn): class MyTDSql: + # Class variables + _clsLock = threading.Lock() # class wide locking + longestQuery = None # type: str + longestQueryTime = 0.0 # seconds + lqStartTime = 0.0 + # lqEndTime = 0.0 # Not needed, as we have the two above already + def __init__(self, hostAddr, cfgPath): # Make the DB connection self._conn = taos.connect(host=hostAddr, config=cfgPath) @@ -782,13 +839,28 @@ class MyTDSql: # self.cursor.log(caller.filename + ".sql") def close(self): + self._cursor.close() # can we double close? self._conn.close() # TODO: very important, cursor close does NOT close DB connection! self._cursor.close() + def _execInternal(self, sql): + startTime = time.time() + ret = self._cursor.execute(sql) + # print("\nSQL success: {}".format(sql)) + queryTime = time.time() - startTime + # Record the query time + cls = self.__class__ + if queryTime > (cls.longestQueryTime + 0.01) : + with cls._clsLock: + cls.longestQuery = sql + cls.longestQueryTime = queryTime + cls.lqStartTime = startTime + return ret + def query(self, sql): self.sql = sql try: - self._cursor.execute(sql) + self._execInternal(sql) self.queryResult = self._cursor.fetchall() self.queryRows = len(self.queryResult) self.queryCols = len(self._cursor.description) @@ -802,7 +874,7 @@ class MyTDSql: def execute(self, sql): self.sql = sql try: - self.affectedRows = self._cursor.execute(sql) + self.affectedRows = self._execInternal(sql) except Exception as e: # caller = inspect.getframeinfo(inspect.stack()[1][0]) # args = (caller.filename, caller.lineno, sql, repr(e)) @@ -922,7 +994,9 @@ class AnyState: STATE_VAL_IDX = 0 CAN_CREATE_DB = 1 - CAN_DROP_DB = 2 + # For below, if we can "drop the DB", but strictly speaking + # only "under normal circumstances", as we may override it with the -b option + CAN_DROP_DB = 2 CAN_CREATE_FIXED_SUPER_TABLE = 3 CAN_DROP_FIXED_SUPER_TABLE = 4 CAN_ADD_DATA = 5 @@ -935,6 +1009,8 @@ class AnyState: # -1 hack to accomodate the STATE_INVALID case return self._stateNames[self._info[self.STATE_VAL_IDX] + 1] + # Each sub state tells us the "info", about itself, so we can determine + # on things like canDropDB() def getInfo(self): raise RuntimeError("Must be overriden by child classes") @@ -961,6 +1037,10 @@ class AnyState: return self._info[self.CAN_CREATE_DB] def canDropDb(self): + # If user requests to run up to a number of DBs, + # we'd then not do drop_db operations any more + if gConfig.max_dbs > 0 : + return False return self._info[self.CAN_DROP_DB] def canCreateFixedSuperTable(self): @@ -997,8 +1077,8 @@ class AnyState: if task.isSuccess(): sCnt += 1 if (exists and sCnt <= 0): - raise RuntimeError( - "Unexpected zero success for task: {}".format(cls)) + raise RuntimeError("Unexpected zero success for task type: {}, from tasks: {}" + .format(cls, tasks)) def assertNoTask(self, tasks, cls): for task in tasks: @@ -1145,13 +1225,16 @@ class StateHasData(AnyState): class StateMechine: - def __init__(self, dbConn): - self._dbConn = dbConn - self._curState = self._findCurrentState() # starting state - # transitition target probabilities, indexed with value of STATE_EMPTY, - # STATE_DB_ONLY, etc. + def __init__(self, db: Database): + self._db = db + # transitition target probabilities, indexed with value of STATE_EMPTY, STATE_DB_ONLY, etc. self._stateWeights = [1, 2, 10, 40] + def init(self, dbc: DbConn): # late initailization, don't save the dbConn + self._curState = self._findCurrentState(dbc) # starting state + logger.debug("Found Starting State: {}".format(self._curState)) + + # TODO: seems no lnoger used, remove? def getCurrentState(self): return self._curState @@ -1193,34 +1276,35 @@ class StateMechine: typesToStrings(taskTypes))) return taskTypes - def _findCurrentState(self): - dbc = self._dbConn + def _findCurrentState(self, dbc: DbConn): ts = time.time() # we use this to debug how fast/slow it is to do the various queries to find the current DB state - if not dbc.hasDatabases(): # no database?! + dbName =self._db.getName() + if not dbc.existsDatabase(dbName): # dbc.hasDatabases(): # no database?! logger.debug( "[STT] empty database found, between {} and {}".format(ts, time.time())) return StateEmpty() # did not do this when openning connection, and this is NOT the worker # thread, which does this on their own - dbc.use("db") + dbc.use(dbName) if not dbc.hasTables(): # no tables logger.debug("[STT] DB_ONLY found, between {} and {}".format(ts, time.time())) return StateDbOnly() - sTable = DbManager.getFixedSuperTable() - if sTable.hasRegTables(dbc): # no regular tables + sTable = self._db.getFixedSuperTable() + if sTable.hasRegTables(dbc, dbName): # no regular tables logger.debug("[STT] SUPER_TABLE_ONLY found, between {} and {}".format(ts, time.time())) return StateSuperTableOnly() else: # has actual tables logger.debug("[STT] HAS_DATA found, between {} and {}".format(ts, time.time())) return StateHasData() - def transition(self, tasks): + # We transition the system to a new state by examining the current state itself + def transition(self, tasks, dbc: DbConn): if (len(tasks) == 0): # before 1st step, or otherwise empty logger.debug("[STT] Starting State: {}".format(self._curState)) return # do nothing # this should show up in the server log, separating steps - self._dbConn.execute("show dnodes") + dbc.execute("show dnodes") # Generic Checks, first based on the start state if self._curState.canCreateDb(): @@ -1251,7 +1335,7 @@ class StateMechine: # if self._state.canReadData(): # Nothing for sure - newState = self._findCurrentState() + newState = self._findCurrentState(dbc) logger.debug("[STT] New DB state determined: {}".format(newState)) # can old state move to new state through the tasks? self._curState.verifyTasksToState(tasks, newState) @@ -1283,49 +1367,53 @@ class StateMechine: if rnd < 0: return i -# Manager of the Database Data/Connection +class Database: + ''' We use this to represent an actual TDengine database inside a service instance, + possibly in a cluster environment. + + For now we use it to manage state transitions in that database + ''' + _clsLock = threading.Lock() # class wide lock + _lastInt = 101 # next one is initial integer + _lastTick = 0 + _lastLaggingTick = 0 # lagging tick, for unsequenced insersions + + def __init__(self, dbNum: int, dbc: DbConn): # TODO: remove dbc + self._dbNum = dbNum # we assign a number to databases, for our testing purpose + self._stateMachine = StateMechine(self) + self._stateMachine.init(dbc) + + self._lock = threading.RLock() + def getStateMachine(self) -> StateMechine: + return self._stateMachine -class DbManager(): - def __init__(self, resetDb=True): - self.tableNumQueue = LinearQueue() - # datetime.datetime(2019, 1, 1) # initial date time tick - self._lastTick = self.setupLastTick() - self._lastInt = 0 # next one is initial integer - self._lock = threading.RLock() + def getDbNum(self): + return self._dbNum - # self.openDbServerConnection() - self._dbConn = DbConn.createNative() if ( - gConfig.connector_type == 'native') else DbConn.createRest() - try: - self._dbConn.open() # may throw taos.error.ProgrammingError: disconnected - except taos.error.ProgrammingError as err: - # print("Error type: {}, msg: {}, value: {}".format(type(err), err.msg, err)) - if (err.msg == 'client disconnected'): # cannot open DB connection - print( - "Cannot establish DB connection, please re-run script without parameter, and follow the instructions.") - sys.exit(2) - else: - print("Failed to connect to DB, errno = {}, msg: {}".format(Helper.convertErrno(err.errno), err.msg)) - raise - except BaseException: - print("[=] Unexpected exception") - raise + def getName(self): + return "db_{}".format(self._dbNum) - if resetDb: - self._dbConn.resetDb() # drop and recreate DB + def filterTasks(self, inTasks: List[Task]): # Pick out those belonging to us + outTasks = [] + for task in inTasks: + if task.getDb().isSame(self): + outTasks.append(task) + return outTasks - # Do this after dbConn is in proper shape - self._stateMachine = StateMechine(self._dbConn) + def isSame(self, other): + return self._dbNum == other._dbNum - def getDbConn(self): - return self._dbConn + def exists(self, dbc: DbConn): + return dbc.existsDatabase(self.getName()) - def getStateMachine(self) -> StateMechine: - return self._stateMachine + @classmethod + def getFixedSuperTableName(cls): + return "fs_table" - # def getState(self): - # return self._stateMachine.getCurrentState() + @classmethod + def getFixedSuperTable(cls) -> TdSuperTable: + return TdSuperTable(cls.getFixedSuperTableName()) # We aim to create a starting time tick, such that, whenever we run our test here once # We should be able to safely create 100,000 records, which will not have any repeated time stamp @@ -1333,7 +1421,8 @@ class DbManager(): # by a factor of 500. # TODO: what if it goes beyond 10 years into the future # TODO: fix the error as result of above: "tsdb timestamp is out of range" - def setupLastTick(self): + @classmethod + def setupLastTick(cls): t1 = datetime.datetime(2020, 6, 1) t2 = datetime.datetime.now() # maybe a very large number, takes 69 years to exceed Python int range @@ -1347,33 +1436,22 @@ class DbManager(): logger.info("Setting up TICKS to start from: {}".format(t4)) return t4 - def pickAndAllocateTable(self): # pick any table, and "use" it - return self.tableNumQueue.pickAndAllocate() - - def addTable(self): - with self._lock: - tIndex = self.tableNumQueue.push() - return tIndex - @classmethod - def getFixedSuperTableName(cls): - return "fs_table" - - @classmethod - def getFixedSuperTable(cls): - return TdSuperTable(cls.getFixedSuperTableName()) - - def releaseTable(self, i): # return the table back, so others can use it - self.tableNumQueue.release(i) - - def getNextTick(self): - with self._lock: # prevent duplicate tick - if Dice.throw(20) == 0: # 1 in 20 chance - return self._lastTick + datetime.timedelta(0, -100) # Go back in time 100 seconds + def getNextTick(cls): + with cls._clsLock: # prevent duplicate tick + if cls._lastLaggingTick==0: + # 10k at 1/20 chance, should be enough to avoid overlaps + cls._lastLaggingTick = cls.setupLastTick() + datetime.timedelta(0, -10000) + if cls._lastTick==0: # should be quite a bit into the future + cls._lastTick = cls.setupLastTick() + + if Dice.throw(20) == 0: # 1 in 20 chance, return lagging tick + cls._lastLaggingTick += datetime.timedelta(0, 1) # Go back in time 100 seconds + return cls._lastLaggingTick else: # regular # add one second to it - self._lastTick += datetime.timedelta(0, 1) - return self._lastTick + cls._lastTick += datetime.timedelta(0, 1) + return cls._lastTick def getNextInt(self): with self._lock: @@ -1389,6 +1467,55 @@ class DbManager(): # print("Float obtained: {}".format(ret)) return ret + +class DbManager(): + ''' This is a wrapper around DbConn(), to make it easier to use. + + TODO: rename this to DbConnManager + ''' + def __init__(self): + self.tableNumQueue = LinearQueue() # TODO: delete? + # self.openDbServerConnection() + self._dbConn = DbConn.createNative() if ( + gConfig.connector_type == 'native') else DbConn.createRest() + try: + self._dbConn.open() # may throw taos.error.ProgrammingError: disconnected + except taos.error.ProgrammingError as err: + # print("Error type: {}, msg: {}, value: {}".format(type(err), err.msg, err)) + if (err.msg == 'client disconnected'): # cannot open DB connection + print( + "Cannot establish DB connection, please re-run script without parameter, and follow the instructions.") + sys.exit(2) + else: + print("Failed to connect to DB, errno = {}, msg: {}" + .format(Helper.convertErrno(err.errno), err.msg)) + raise + except BaseException: + print("[=] Unexpected exception") + raise + + # Do this after dbConn is in proper shape + # Moved to Database() + # self._stateMachine = StateMechine(self._dbConn) + + def getDbConn(self): + return self._dbConn + + # TODO: not used any more, to delete + def pickAndAllocateTable(self): # pick any table, and "use" it + return self.tableNumQueue.pickAndAllocate() + + # TODO: Not used any more, to delete + def addTable(self): + with self._lock: + tIndex = self.tableNumQueue.push() + return tIndex + + # Not used any more, to delete + def releaseTable(self, i): # return the table back, so others can use it + self.tableNumQueue.release(i) + + # TODO: not used any more, delete def getTableNameToDelete(self): tblNum = self.tableNumQueue.pop() # TODO: race condition! if (not tblNum): # maybe false @@ -1399,7 +1526,6 @@ class DbManager(): def cleanUp(self): self._dbConn.close() - class TaskExecutor(): class BoundedList: def __init__(self, size=10): @@ -1465,6 +1591,10 @@ class TaskExecutor(): class Task(): + ''' A generic "Task" to be executed. For now we decide that there is no + need to embed a DB connection here, we use whatever the Worker Thread has + instead. But a task is always associated with a DB + ''' taskSn = 100 @classmethod @@ -1473,10 +1603,9 @@ class Task(): # logger.debug("Allocating taskSN: {}".format(Task.taskSn)) return Task.taskSn - def __init__(self, dbManager: DbManager, execStats: ExecutionStats): - self._dbManager = dbManager + def __init__(self, execStats: ExecutionStats, db: Database): self._workerThread = None - self._err = None + self._err = None # type: Exception self._aborted = False self._curStep = None self._numRows = None # Number of rows affected @@ -1486,6 +1615,7 @@ class Task(): # logger.debug("Creating new task {}...".format(self._taskNum)) self._execStats = execStats + self._db = db # A task is always associated/for a specific DB def isSuccess(self): return self._err is None @@ -1494,9 +1624,12 @@ class Task(): return self._aborted def clone(self): # TODO: why do we need this again? - newTask = self.__class__(self._dbManager, self._execStats) + newTask = self.__class__(self._execStats, self._db) return newTask + def getDb(self): + return self._db + def logDebug(self, msg): self._workerThread.logDebug( "Step[{}.{}] {}".format( @@ -1515,6 +1648,7 @@ class Task(): def _isErrAcceptable(self, errno, msg): if errno in [ 0x05, # TSDB_CODE_RPC_NOT_READY + 0x0B, # Unable to establish connection, more details in TD-1648 # 0x200, # invalid SQL, TODO: re-examine with TD-934 0x217, # "db not selected", client side defined error code 0x218, # "Table does not exist" client side defined error code @@ -1557,9 +1691,12 @@ class Task(): self.logDebug( "[-] executing task {}...".format(self.__class__.__name__)) - self._err = None + self._err = None # TODO: type hint mess up? self._execStats.beginTaskType(self.__class__.__name__) # mark beginning errno2 = None + + # Now pick a database, and stick with it for the duration of the task execution + dbName = self._db.getName() try: self._executeInternal(te, wt) # TODO: no return value? except taos.error.ProgrammingError as err: @@ -1597,7 +1734,7 @@ class Task(): self._err = e self._aborted = True traceback.print_exc() - except BaseException: + except BaseException: # TODO: what is this again??!! self.logDebug( "[=] Unexpected exception, SQL: {}".format( wt.getDbConn().getLastSql())) @@ -1609,10 +1746,9 @@ class Task(): # TODO: merge with above. self._execStats.incExecCount(self.__class__.__name__, self.isSuccess(), errno2) - def execSql(self, sql): - return self._dbManager.execute(sql) - + # TODO: refactor away, just provide the dbConn def execWtSql(self, wt: WorkerThread, sql): # execute an SQL on the worker thread + """ Haha """ return wt.execSql(sql) def queryWtSql(self, wt: WorkerThread, sql): # execute an SQL on the worker thread @@ -1714,7 +1850,11 @@ class ExecutionStats: "| Total Elapsed Time (from wall clock): {:.3f} seconds".format( self._elapsedTime)) logger.info("| Top numbers written: {}".format(TaskExecutor.getBoundedList())) - logger.info("| Total Number of Active DB Native Connections: {}".format(DbConnNative.totalConnections)) + logger.info("| Active DB Native Connections (now): {}".format(DbConnNative.totalConnections)) + logger.info("| Longest native query time: {:.3f} seconds, started: {}". + format(MyTDSql.longestQueryTime, + time.strftime("%x %X", time.localtime(MyTDSql.lqStartTime))) ) + logger.info("| Longest native query: {}".format(MyTDSql.longestQuery)) logger.info( "----------------------------------------------------------------------") @@ -1764,9 +1904,15 @@ class TaskCreateDb(StateTransitionTask): def canBeginFrom(cls, state: AnyState): return state.canCreateDb() + # Actually creating the database(es) def _executeInternal(self, te: TaskExecutor, wt: WorkerThread): - # self.execWtSql(wt, "create database db replica {}".format(Dice.throw(3)+1)) - self.execWtSql(wt, "create database db") + # was: self.execWtSql(wt, "create database db") + repStr = "" + if gConfig.max_replicas != 1: + numReplica = Dice.throw(gConfig.max_replicas) + 1 # 1,2 ... N + repStr = "replica {}".format(numReplica) + self.execWtSql(wt, "create database {} {}" + .format(self._db.getName(), repStr) ) class TaskDropDb(StateTransitionTask): @classmethod @@ -1778,10 +1924,9 @@ class TaskDropDb(StateTransitionTask): return state.canDropDb() def _executeInternal(self, te: TaskExecutor, wt: WorkerThread): - self.execWtSql(wt, "drop database db") + self.execWtSql(wt, "drop database {}".format(self._db.getName())) logger.debug("[OPS] database dropped at {}".format(time.time())) - class TaskCreateSuperTable(StateTransitionTask): @classmethod def getEndState(cls): @@ -1792,13 +1937,14 @@ class TaskCreateSuperTable(StateTransitionTask): return state.canCreateFixedSuperTable() def _executeInternal(self, te: TaskExecutor, wt: WorkerThread): - if not wt.dbInUse(): # no DB yet, to the best of our knowledge + if not self._db.exists(wt.getDbConn()): logger.debug("Skipping task, no DB yet") return - sTable = self._dbManager.getFixedSuperTable() + sTable = self._db.getFixedSuperTable() # type: TdSuperTable # wt.execSql("use db") # should always be in place - sTable.create(wt.getDbConn(), {'ts':'timestamp', 'speed':'int'}, {'b':'binary(200)', 'f':'float'}) + sTable.create(wt.getDbConn(), self._db.getName(), + {'ts':'timestamp', 'speed':'int'}, {'b':'binary(200)', 'f':'float'}) # self.execWtSql(wt,"create table db.{} (ts timestamp, speed int) tags (b binary(200), f float) ".format(tblName)) # No need to create the regular tables, INSERT will do that # automatically @@ -1811,17 +1957,20 @@ class TdSuperTable: def getName(self): return self._stName - def create(self, dbc, cols: dict, tags: dict): - sql = "CREATE TABLE db.{} ({}) TAGS ({})".format( + # TODO: odd semantic, create() method is usually static? + def create(self, dbc, dbName, cols: dict, tags: dict): + '''Creating a super table''' + sql = "CREATE TABLE {}.{} ({}) TAGS ({})".format( + dbName, self._stName, ",".join(['%s %s'%(k,v) for (k,v) in cols.items()]), ",".join(['%s %s'%(k,v) for (k,v) in tags.items()]) ) dbc.execute(sql) - def getRegTables(self, dbc: DbConn): + def getRegTables(self, dbc: DbConn, dbName: str): try: - dbc.query("select TBNAME from db.{}".format(self._stName)) # TODO: analyze result set later + dbc.query("select TBNAME from {}.{}".format(dbName, self._stName)) # TODO: analyze result set later except taos.error.ProgrammingError as err: errno2 = Helper.convertErrno(err.errno) logger.debug("[=] Failed to get tables from super table: errno=0x{:X}, msg: {}".format(errno2, err)) @@ -1830,20 +1979,20 @@ class TdSuperTable: qr = dbc.getQueryResult() return [v[0] for v in qr] # list transformation, ref: https://stackoverflow.com/questions/643823/python-list-transformation - def hasRegTables(self, dbc: DbConn): - return dbc.query("SELECT * FROM db.{}".format(self._stName)) > 0 + def hasRegTables(self, dbc: DbConn, dbName: str): + return dbc.query("SELECT * FROM {}.{}".format(dbName, self._stName)) > 0 - def ensureTable(self, dbc: DbConn, regTableName: str): - sql = "select tbname from db.{} where tbname in ('{}')".format(self._stName, regTableName) + def ensureTable(self, dbc: DbConn, dbName: str, regTableName: str): + sql = "select tbname from {}.{} where tbname in ('{}')".format(dbName, self._stName, regTableName) if dbc.query(sql) >= 1 : # reg table exists already return - sql = "CREATE TABLE {} USING {} tags ({})".format( - regTableName, self._stName, self._getTagStrForSql(dbc) + sql = "CREATE TABLE {}.{} USING {}.{} tags ({})".format( + dbName, regTableName, dbName, self._stName, self._getTagStrForSql(dbc, dbName) ) dbc.execute(sql) - def _getTagStrForSql(self, dbc) : - tags = self._getTags(dbc) + def _getTagStrForSql(self, dbc, dbName: str) : + tags = self._getTags(dbc, dbName) tagStrs = [] for tagName in tags: tagType = tags[tagName] @@ -1857,34 +2006,34 @@ class TdSuperTable: raise RuntimeError("Unexpected tag type: {}".format(tagType)) return ", ".join(tagStrs) - def _getTags(self, dbc) -> dict: - dbc.query("DESCRIBE {}".format(self._stName)) + def _getTags(self, dbc, dbName) -> dict: + dbc.query("DESCRIBE {}.{}".format(dbName, self._stName)) stCols = dbc.getQueryResult() # print(stCols) ret = {row[0]:row[1] for row in stCols if row[3]=='TAG'} # name:type # print("Tags retrieved: {}".format(ret)) return ret - def addTag(self, dbc, tagName, tagType): - if tagName in self._getTags(dbc): # already + def addTag(self, dbc, dbName, tagName, tagType): + if tagName in self._getTags(dbc, dbName): # already return # sTable.addTag("extraTag", "int") - sql = "alter table db.{} add tag {} {}".format(self._stName, tagName, tagType) + sql = "alter table {}.{} add tag {} {}".format(dbName, self._stName, tagName, tagType) dbc.execute(sql) - def dropTag(self, dbc, tagName): - if not tagName in self._getTags(dbc): # don't have this tag + def dropTag(self, dbc, dbName, tagName): + if not tagName in self._getTags(dbc, dbName): # don't have this tag return - sql = "alter table db.{} drop tag {}".format(self._stName, tagName) + sql = "alter table {}.{} drop tag {}".format(dbName, self._stName, tagName) dbc.execute(sql) - def changeTag(self, dbc, oldTag, newTag): - tags = self._getTags(dbc) + def changeTag(self, dbc, dbName, oldTag, newTag): + tags = self._getTags(dbc, dbName) if not oldTag in tags: # don't have this tag return if newTag in tags: # already have this tag return - sql = "alter table db.{} change tag {} {}".format(self._stName, oldTag, newTag) + sql = "alter table {}.{} change tag {} {}".format(dbName, self._stName, oldTag, newTag) dbc.execute(sql) class TaskReadData(StateTransitionTask): @@ -1897,19 +2046,21 @@ class TaskReadData(StateTransitionTask): return state.canReadData() def _executeInternal(self, te: TaskExecutor, wt: WorkerThread): - sTable = self._dbManager.getFixedSuperTable() + sTable = self._db.getFixedSuperTable() - if random.randrange( - 5) == 0: # 1 in 5 chance, simulate a broken connection. TODO: break connection in all situations + # 1 in 5 chance, simulate a broken connection. + if random.randrange(5) == 0: # TODO: break connection in all situations wt.getDbConn().close() wt.getDbConn().open() + print("_r", end="", flush=True) dbc = wt.getDbConn() - for rTbName in sTable.getRegTables(dbc): # regular tables + dbName = self._db.getName() + for rTbName in sTable.getRegTables(dbc, dbName): # regular tables aggExpr = Dice.choice([ - '*', - 'count(*)', - 'avg(speed)', + '*', + 'count(*)', + 'avg(speed)', # 'twa(speed)', # TODO: this one REQUIRES a where statement, not reasonable 'sum(speed)', 'stddev(speed)', @@ -1931,10 +2082,10 @@ class TaskReadData(StateTransitionTask): ]) try: # Run the query against the regular table first - dbc.execute("select {} from db.{}".format(aggExpr, rTbName)) + dbc.execute("select {} from {}.{}".format(aggExpr, dbName, rTbName)) # Then run it against the super table if aggExpr not in ['stddev(speed)']: #TODO: STDDEV not valid for super tables?! - dbc.execute("select {} from db.{}".format(aggExpr, sTable.getName())) + dbc.execute("select {} from {}.{}".format(aggExpr, dbName, sTable.getName())) except taos.error.ProgrammingError as err: errno2 = Helper.convertErrno(err.errno) logger.debug("[=] Read Failure: errno=0x{:X}, msg: {}, SQL: {}".format(errno2, err, dbc.getLastSql())) @@ -1950,27 +2101,25 @@ class TaskDropSuperTable(StateTransitionTask): return state.canDropFixedSuperTable() def _executeInternal(self, te: TaskExecutor, wt: WorkerThread): - # 1/2 chance, we'll drop the regular tables one by one, in a randomized - # sequence + # 1/2 chance, we'll drop the regular tables one by one, in a randomized sequence if Dice.throw(2) == 0: + # print("_7_", end="", flush=True) tblSeq = list(range( 2 + (self.LARGE_NUMBER_OF_TABLES if gConfig.larger_data else self.SMALL_NUMBER_OF_TABLES))) random.shuffle(tblSeq) tickOutput = False # if we have spitted out a "d" character for "drop regular table" isSuccess = True for i in tblSeq: - regTableName = self.getRegTableName( - i) # "db.reg_table_{}".format(i) + regTableName = self.getRegTableName(i) # "db.reg_table_{}".format(i) try: - self.execWtSql(wt, "drop table {}".format( - regTableName)) # nRows always 0, like MySQL + self.execWtSql(wt, "drop table {}.{}". + format(self._db.getName(), regTableName)) # nRows always 0, like MySQL except taos.error.ProgrammingError as err: # correcting for strange error number scheme errno2 = Helper.convertErrno(err.errno) if (errno2 in [0x362]): # mnode invalid table name isSuccess = False - logger.debug( - "[DB] Acceptable error when dropping a table") + logger.debug("[DB] Acceptable error when dropping a table") continue # try to delete next regular table if (not tickOutput): @@ -1981,8 +2130,8 @@ class TaskDropSuperTable(StateTransitionTask): print("f", end="", flush=True) # Drop the super table itself - tblName = self._dbManager.getFixedSuperTableName() - self.execWtSql(wt, "drop table db.{}".format(tblName)) + tblName = self._db.getFixedSuperTableName() + self.execWtSql(wt, "drop table {}.{}".format(self._db.getName(), tblName)) class TaskAlterTags(StateTransitionTask): @@ -1997,19 +2146,20 @@ class TaskAlterTags(StateTransitionTask): def _executeInternal(self, te: TaskExecutor, wt: WorkerThread): # tblName = self._dbManager.getFixedSuperTableName() dbc = wt.getDbConn() - sTable = self._dbManager.getFixedSuperTable() + sTable = self._db.getFixedSuperTable() + dbName = self._db.getName() dice = Dice.throw(4) if dice == 0: - sTable.addTag(dbc, "extraTag", "int") + sTable.addTag(dbc, dbName, "extraTag", "int") # sql = "alter table db.{} add tag extraTag int".format(tblName) elif dice == 1: - sTable.dropTag(dbc, "extraTag") + sTable.dropTag(dbc, dbName, "extraTag") # sql = "alter table db.{} drop tag extraTag".format(tblName) elif dice == 2: - sTable.dropTag(dbc, "newTag") + sTable.dropTag(dbc, dbName, "newTag") # sql = "alter table db.{} drop tag newTag".format(tblName) else: # dice == 3 - sTable.changeTag(dbc, "extraTag", "newTag") + sTable.changeTag(dbc, dbName, "extraTag", "newTag") # sql = "alter table db.{} change tag extraTag newTag".format(tblName) class TaskRestartService(StateTransitionTask): @@ -2074,7 +2224,9 @@ class TaskAddData(StateTransitionTask): return state.canAddData() def _executeInternal(self, te: TaskExecutor, wt: WorkerThread): - ds = self._dbManager # Quite DANGEROUS here, may result in multi-thread client access + # ds = self._dbManager # Quite DANGEROUS here, may result in multi-thread client access + db = self._db + dbc = wt.getDbConn() tblSeq = list(range( self.LARGE_NUMBER_OF_TABLES if gConfig.larger_data else self.SMALL_NUMBER_OF_TABLES)) random.shuffle(tblSeq) @@ -2084,23 +2236,25 @@ class TaskAddData(StateTransitionTask): else: self.activeTable.add(i) # marking it active - sTable = ds.getFixedSuperTable() + sTable = db.getFixedSuperTable() regTableName = self.getRegTableName(i) # "db.reg_table_{}".format(i) - sTable.ensureTable(wt.getDbConn(), regTableName) # Ensure the table exists + sTable.ensureTable(wt.getDbConn(), db.getName(), regTableName) # Ensure the table exists for j in range(self.LARGE_NUMBER_OF_RECORDS if gConfig.larger_data else self.SMALL_NUMBER_OF_RECORDS): # number of records per table - nextInt = ds.getNextInt() + nextInt = db.getNextInt() + nextTick = db.getNextTick() if gConfig.record_ops: self.prepToRecordOps() self.fAddLogReady.write("Ready to write {} to {}\n".format(nextInt, regTableName)) self.fAddLogReady.flush() os.fsync(self.fAddLogReady) - sql = "insert into {} values ('{}', {});".format( # removed: tags ('{}', {}) + sql = "insert into {}.{} values ('{}', {});".format( # removed: tags ('{}', {}) + db.getName(), regTableName, # ds.getFixedSuperTableName(), # ds.getNextBinary(), ds.getNextFloat(), - ds.getNextTick(), nextInt) - self.execWtSql(wt, sql) + nextTick, nextInt) + dbc.execute(sql) # Successfully wrote the data into the DB, let's record it # somehow te.recordDataMark(nextInt) @@ -2110,6 +2264,27 @@ class TaskAddData(StateTransitionTask): nextInt, regTableName)) self.fAddLogDone.flush() os.fsync(self.fAddLogDone) + + # Now read it back and verify, we might encounter an error if table is dropped + if gConfig.verify_data: # only if command line asks for it + try: + readBack = dbc.queryScalar("SELECT speed from {}.{} WHERE ts= '{}'". + format(db.getName(), regTableName, nextTick)) + if readBack != nextInt : + raise taos.error.ProgrammingError( + "Failed to read back same data, wrote: {}, read: {}" + .format(nextInt, readBack), 0x999) + except taos.error.ProgrammingError as err: + errno = Helper.convertErrno(err.errno) + if errno in [0x991, 0x992] : # not a single result + raise taos.error.ProgrammingError( + "Failed to read back same data for tick: {}, wrote: {}, read: {}" + .format(nextTick, nextInt, "Empty Result" if errno==0x991 else "Multiple Result"), + errno) + # Re-throw no matter what + raise + + self.activeTable.discard(i) # not raising an error, unlike remove @@ -2178,7 +2353,7 @@ class SvcManager: self.inSigHandler = False # self._status = MainExec.STATUS_RUNNING # set inside # _startTaosService() - self.svcMgrThread = None + self.svcMgrThread = None # type: ServiceManagerThread self._lock = threading.Lock() self._isRestarting = False @@ -2265,13 +2440,12 @@ class SvcManager: time.sleep(2.0) proc.kill() # print("Process: {}".format(proc.name())) + self.svcMgrThread = ServiceManagerThread() # create the object print("Attempting to start TAOS service started, printing out output...") self.svcMgrThread.start() - self.svcMgrThread.procIpcBatch( - trimToTarget=10, - forceOutput=True) # for printing 10 lines + self.svcMgrThread.procIpcBatch(trimToTarget=10, forceOutput=True) # for printing 10 lines print("TAOS service started") def stopTaosService(self, outputLines=20): @@ -2320,7 +2494,7 @@ class ServiceManagerThread: MAX_QUEUE_SIZE = 10000 def __init__(self): - self._tdeSubProcess = None + self._tdeSubProcess = None # type: TdeSubProcess self._thread = None self._status = None @@ -2351,13 +2525,13 @@ class ServiceManagerThread: self._tdeSubProcess.start() self._ipcQueue = Queue() - self._thread = threading.Thread( + self._thread = threading.Thread( # First thread captures server OUTPUT target=self.svcOutputReader, args=(self._tdeSubProcess.getStdOut(), self._ipcQueue)) self._thread.daemon = True # thread dies with the program self._thread.start() - self._thread2 = threading.Thread( + self._thread2 = threading.Thread( # 2nd thread captures server ERRORs target=self.svcErrorReader, args=(self._tdeSubProcess.getStdErr(), self._ipcQueue)) self._thread2.daemon = True # thread dies with the program @@ -2690,40 +2864,39 @@ class ClientManager: self.inSigHandler = False - def _printLastNumbers(self): # to verify data durability - dbManager = DbManager(resetDb=False) - dbc = dbManager.getDbConn() - if dbc.query("show databases") <= 1: # no database (we have a default called "log") - return - dbc.execute("use db") - if dbc.query("show tables") == 0: # no tables - return - - sTbName = dbManager.getFixedSuperTableName() - - # get all regular tables - # TODO: analyze result set later - dbc.query("select TBNAME from db.{}".format(sTbName)) - rTables = dbc.getQueryResult() - - bList = TaskExecutor.BoundedList() - for rTbName in rTables: # regular tables - dbc.query("select speed from db.{}".format(rTbName[0])) - numbers = dbc.getQueryResult() - for row in numbers: - # print("<{}>".format(n), end="", flush=True) - bList.add(row[0]) - - print("Top numbers in DB right now: {}".format(bList)) - print("TDengine client execution is about to start in 2 seconds...") - time.sleep(2.0) - dbManager = None # release? - - def prepare(self): - self._printLastNumbers() + # TODO: need to revise how we verify data durability + # def _printLastNumbers(self): # to verify data durability + # dbManager = DbManager() + # dbc = dbManager.getDbConn() + # if dbc.query("show databases") <= 1: # no database (we have a default called "log") + # return + # dbc.execute("use db") + # if dbc.query("show tables") == 0: # no tables + # return + + # sTbName = dbManager.getFixedSuperTableName() + + # # get all regular tables + # # TODO: analyze result set later + # dbc.query("select TBNAME from db.{}".format(sTbName)) + # rTables = dbc.getQueryResult() + + # bList = TaskExecutor.BoundedList() + # for rTbName in rTables: # regular tables + # dbc.query("select speed from db.{}".format(rTbName[0])) + # numbers = dbc.getQueryResult() + # for row in numbers: + # # print("<{}>".format(n), end="", flush=True) + # bList.add(row[0]) + + # print("Top numbers in DB right now: {}".format(bList)) + # print("TDengine client execution is about to start in 2 seconds...") + # time.sleep(2.0) + # dbManager = None # release? def run(self, svcMgr): - self._printLastNumbers() + # self._printLastNumbers() + global gConfig dbManager = DbManager() # Regular function thPool = ThreadPool(gConfig.num_threads, gConfig.max_steps) @@ -2734,15 +2907,37 @@ class ClientManager: # print("TC failed = {}".format(self.tc.isFailed())) if svcMgr: # gConfig.auto_start_service: svcMgr.stopTaosService() + svcMgr = None # Print exec status, etc., AFTER showing messages from the server self.conclude() # print("TC failed (2) = {}".format(self.tc.isFailed())) # Linux return code: ref https://shapeshed.com/unix-exit-codes/ - return 1 if self.tc.isFailed() else 0 + ret = 1 if self.tc.isFailed() else 0 + self.tc.cleanup() + + # Release global variables + gConfig = None + gSvcMgr = None + logger = None + + # Release variables here + self.tc = None + thPool = None + dbManager = None + + gc.collect() # force garbage collection + # h = hpy() + # print("\n----- Final Python Heap -----\n") + # print(h.heap()) + + return ret def conclude(self): + # self.tc.getDbManager().cleanUp() # clean up first, so we can show ZERO db connections self.tc.printStats() - self.tc.getDbManager().cleanUp() + + + class MainExec: STATUS_STARTING = 1 @@ -2878,6 +3073,13 @@ def main(): '--auto-start-service', action='store_true', help='Automatically start/stop the TDengine service (default: false)') + parser.add_argument( + '-b', + '--max-dbs', + action='store', + default=0, + type=int, + help='Maximum number of DBs to keep, set to disable dropping DB. (default: 0)') parser.add_argument( '-c', '--connector-type', @@ -2895,6 +3097,13 @@ def main(): '--run-tdengine', action='store_true', help='Run TDengine service in foreground (default: false)') + parser.add_argument( + '-i', + '--max-replicas', + action='store', + default=1, + type=int, + help='Maximum number of replicas to use, when testing against clusters. (default: 1)') parser.add_argument( '-l', '--larger-data', @@ -2924,6 +3133,11 @@ def main(): default=5, type=int, help='Number of threads to run (default: 10)') + parser.add_argument( + '-v', + '--verify-data', + action='store_true', + help='Verify data written in a number of places by reading back (default: false)') parser.add_argument( '-x', '--continue-on-exception', diff --git a/tests/pytest/crash_gen/valgrind_taos.supp b/tests/pytest/crash_gen/valgrind_taos.supp new file mode 100644 index 0000000000000000000000000000000000000000..123858b3db3d66ddad8194e2a11338735288e7a8 --- /dev/null +++ b/tests/pytest/crash_gen/valgrind_taos.supp @@ -0,0 +1,17249 @@ +{ + + Memcheck:Cond + fun:PyUnicode_Decode + fun:PyUnicode_FromEncodedObject + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyFloat_FromDouble + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyFloat_FromDouble + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyFloat_FromDouble + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyLong_FromLong + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyLong_FromLong + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyLong_FromLong + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyLong_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyLong_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PySequence_Tuple + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyUnicode_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyUnicode_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyUnicode_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PyLong_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PyFloat_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PyErr_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyModuleDef_Init + fun:_PyModule_CreateInitialized + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyObject_SetAttr + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:PyThread_GetInfo + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + obj:/usr/bin/python3.8 + fun:_PyObject_LookupSpecial + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + fun:_PyErr_NormalizeException + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyStructSequence_NewType + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyStructSequence_NewType + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyStructSequence_NewType + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyStructSequence_NewType + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyStructSequence_NewType + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:PyInit_time + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__abc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + obj:/usr/bin/python3.8 + fun:PyObject_LengthHint + fun:PySequence_List + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__operator + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__operator + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__operator + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags + fun:Py_RunMain +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyList_AsTuple + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags + fun:Py_RunMain +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__datetime + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__datetime + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__datetime + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__datetime + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__datetime + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__datetime + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyStack_UnpackDict + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sre + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sre + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sre + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyErr_NewException + fun:PyErr_NewExceptionWithDoc + fun:PyInit__queue + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__queue + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyErr_NewException + fun:PyInit__socket + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyErr_NewException + fun:PyInit__socket + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyErr_NewException + fun:PyInit__socket + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + fun:PyErr_Format + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__random + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_FromSpecWithBases + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__hashlib + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__blake2 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__blake2 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit_zlib + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit_zlib + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyErr_NewException + fun:PyInit_zlib + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyErr_NewException + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__bz2 + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__bz2 + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyErr_NewException + fun:PyErr_NewExceptionWithDoc + fun:PyInit__lzma + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__lzma + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__lzma + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:PyInit_grp + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyObject_MakeTpCall + fun:PyObject_CallFunction +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__speedups + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__speedups + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nybitset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nybitset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nybitset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nybitset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyFloat_FromDouble + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:PyCapsule_New + fun:fsb_dx_nybitset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:PyCapsule_New + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:PyCapsule_New + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:PyObject_Call + fun:_PyCodec_Lookup + obj:/usr/bin/python3.8 + fun:_PyUnicode_InitEncodings + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_FromNodeObject + fun:PyParser_ASTFromStringObject + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_FromNodeObject + fun:PyParser_ASTFromFileObject + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyDict_SetItemId + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyDict_SetItemId + fun:_PySys_SetPreliminaryStderr + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyDict_SetItemId + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyList_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyUnicode_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyUnicode_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyUnicode_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyHamt_Init + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyContext_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyModuleDef_Init + fun:_PyModule_CreateInitialized + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyObject_SetAttr + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + fun:PyImport_ImportFrozenModuleObject +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + obj:/usr/bin/python3.8 + fun:_PyObject_LookupSpecial + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + obj:/usr/bin/python3.8 + fun:PyObject_LengthHint + fun:PySequence_List + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__operator + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__collections + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_FromNodeObject + fun:PyParser_ASTFromFileObject + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags + fun:Py_RunMain +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyType_GenericNew + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__ssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__sha3 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__speedups + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyUnicode_InternFromString + obj:/usr/bin/python3.8 + fun:_PyWarnings_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyImportHooks_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_SetPreliminaryStderr + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyImportHooks_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + fun:PyInit__imp + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyType_Ready + fun:PyInit__ctypes + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyUnicode_InternInPlace + fun:PyUnicode_InternFromString + obj:/usr/bin/python3.8 + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyTypes_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PyLong_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PyFloat_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PyErr_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyType_Ready + fun:PyModuleDef_Init + fun:_PyModule_CreateInitialized + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyModule_NewObject + fun:PyModule_New + fun:_PyModule_CreateInitialized + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:PyThread_GetInfo + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyModule_NewObject + fun:PyModule_New + fun:_PyModule_CreateInitialized + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:_PyWarnings_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:_PyDict_NewPresized + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/bin/python3.8 + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyInit_posix + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/bin/python3.8 + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:_PyObject_SetAttrId + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyObject_CallFunction_SizeT + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodId_SizeT + fun:PyFile_OpenCodeObject + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyModule_NewObject + fun:PyModule_New + fun:_PyModule_CreateInitialized + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_Copy + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PySymtable_BuildObject + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_CallMethod + fun:PyInit__openssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyContextVar_New + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:realloc + fun:_PyObject_GC_Resize + fun:_PyTuple_Resize + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_CallMethod + fun:PyInit__decimal +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:PyObject_CallFunction + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:fsb_dx_nybitset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:fsb_dx_nybitset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:fsb_dx_nynodeset_init + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_InitMain + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyType_Ready + fun:PyInit__thread + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyImportHooks_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyModule_AddIntConstant + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyInit__imp + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_Call + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyFloat_FromDouble + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:_PyBuiltins_AddExceptions + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:_PyWarnings_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:_PyWarnings_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:_PyWarnings_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:_PyWarnings_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:_PyWarnings_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/bin/python3.8 + fun:PyContextVar_New + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:_PyExc_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + fun:PyInit__functools + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyUnicode_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyImport_Cleanup + fun:Py_FinalizeEx + fun:Py_Exit + obj:/usr/bin/python3.8 + fun:PyErr_PrintEx + fun:PyRun_SimpleFileExFlags + fun:Py_RunMain + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_CallMethod + fun:PyInit__constant_time + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_CallMethod + fun:PyInit__openssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PySequence_List + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyType_GenericAlloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + fun:PySymtable_BuildObject + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PySymtable_BuildObject + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags + fun:Py_RunMain +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:PyObject_CallFunction + fun:PyImport_Import + fun:PyImport_ImportModule + fun:PyFile_OpenCodeObject + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:PyType_Ready + fun:PyStructSequence_InitType2 + fun:_PyErr_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyDict_SetItemId + obj:/usr/bin/python3.8 + fun:PyModule_NewObject + fun:PyModule_New + fun:_PyModule_CreateInitialized + fun:PyInit__imp + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:PyType_Ready + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyDict_Copy + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyDict_Copy + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyStack_AsDict + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PySymtable_BuildObject + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PySymtable_BuildObject + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_StringFlags + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PySymtable_BuildObject + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags + fun:PyRun_SimpleFileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:PyType_Ready + fun:PyInit__cffi_backend + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyCode_NewWithPosOnlyArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyCode_NewWithPosOnlyArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyCode_NewWithPosOnlyArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/bin/python3.8 + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_Copy + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:PyObject_CallFunction + fun:PyErr_NewException + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyObject_CallFunction_SizeT + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodId_SizeT + fun:PyFile_OpenCodeObject + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_CallMethod + fun:PyInit__openssl + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyList_AsTuple + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyErr_NewException + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_Copy + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_New + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + obj:/usr/bin/python3.8 + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyType_GenericAlloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:_PyObject_GC_New + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_CallMethod + fun:PyInit__constant_time + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + obj:/usr/bin/python3.8 + fun:PyObject_GenericGetDict + obj:/usr/bin/python3.8 + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_Copy + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:PyObject_CallFunction + fun:PyErr_NewException + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyDict_Copy + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyStack_UnpackDict + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyBytes_FromStringAndSize + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_Copy + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyCFunction_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + fun:PyImport_ImportFrozenModuleObject + fun:PyImport_ImportFrozenModule +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:PyObject_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + obj:/usr/bin/python3.8 + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + fun:PyObject_IsSubclass + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_Pack + fun:PyType_Ready + obj:/usr/bin/python3.8 + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + fun:PyInit__ctypes + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:_PyObject_SetAttrId + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyObject_CallFunction_SizeT + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodId_SizeT + fun:PyFile_OpenCodeObject + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyErr_NewException + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:PyObject_Call + fun:_PyCodec_Lookup +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + fun:PyType_Ready + fun:PyInit_itertools + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyDict_Copy + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyType_GenericAlloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyDict_Copy + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:PyObject_CallFunction + fun:PyErr_NewException + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + obj:/usr/bin/python3.8 + fun:PyObject_GetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PySequence_List + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + fun:PyObject_CallFunctionObjArgs + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_NewVar + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + obj:/usr/bin/python3.8 + fun:_PyObject_CallMethodIdObjArgs + fun:PyImport_ImportModuleLevelObject + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__io + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyMarshal_ReadObjectFromString + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyDict_Copy + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/bin/python3.8 + fun:PyInit_setsc + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyAST_CompileObject + obj:/usr/bin/python3.8 + fun:PyRun_FileExFlags +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:PyDict_Copy + obj:/usr/bin/python3.8 + fun:_PyObject_MakeTpCall + fun:PyObject_CallFunction + fun:PyErr_NewException + fun:PyInit__decimal + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + fun:_PyBuiltin_Init + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + fun:_PyObject_GC_New + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:PyObject_SetAttr + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + fun:PyModule_AddObject + fun:PyInit__ctypes + fun:_PyImport_LoadDynamicModuleWithSpec + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyVectorcall_Call + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:_PyFunction_Vectorcall +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyModule_AddFunctions + fun:_PyModule_CreateInitialized + fun:_PySys_Create + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItemString + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_InitializeFromConfig + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:PyImport_Cleanup + fun:Py_FinalizeEx + fun:Py_Exit + obj:/usr/bin/python3.8 + fun:PyErr_PrintEx + fun:PyRun_SimpleFileExFlags + fun:Py_RunMain + fun:Py_BytesMain + fun:(below main) +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyTuple_New + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + fun:PyObject_SetAttr + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName + fun:PyEval_EvalCode +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetItem + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + obj:/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-x86_64-linux-gnu.so + fun:PyObject_GetAttr + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyFunction_Vectorcall + fun:_PyEval_EvalFrameDefault + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault +} +{ + + Memcheck:Leak + match-leak-kinds: possible + fun:malloc + obj:/usr/bin/python3.8 + fun:PyDict_SetDefault + fun:PyUnicode_InternInPlace + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + obj:/usr/bin/python3.8 + fun:_PyEval_EvalFrameDefault + fun:_PyEval_EvalCodeWithName +} diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh index b679942054c000050271fcb96328d18adea60b42..bdebe9a1ade22ae362961508666a808af8d1b1c4 100755 --- a/tests/pytest/fulltest.sh +++ b/tests/pytest/fulltest.sh @@ -18,6 +18,7 @@ python3 ./test.py -f insert/multi.py python3 ./test.py -f insert/randomNullCommit.py python3 insert/retentionpolicy.py python3 ./test.py -f insert/alterTableAndInsert.py +python3 ./test.py -f insert/insertIntoTwoTables.py python3 ./test.py -f table/column_name.py python3 ./test.py -f table/column_num.py @@ -149,6 +150,7 @@ python3 ./test.py -f query/queryNullValueTest.py python3 ./test.py -f query/queryInsertValue.py python3 ./test.py -f query/queryConnection.py python3 ./test.py -f query/natualInterval.py +python3 ./test.py -f query/bug1471.py #stream python3 ./test.py -f stream/metric_1.py @@ -172,23 +174,23 @@ python3 testNoCompress.py python3 testMinTablesPerVnode.py # functions -python3 ./test.py -f functions/function_avg.py -python3 ./test.py -f functions/function_bottom.py -python3 ./test.py -f functions/function_count.py -python3 ./test.py -f functions/function_diff.py -python3 ./test.py -f functions/function_first.py -python3 ./test.py -f functions/function_last.py -python3 ./test.py -f functions/function_last_row.py -python3 ./test.py -f functions/function_leastsquares.py -python3 ./test.py -f functions/function_max.py -python3 ./test.py -f functions/function_min.py -python3 ./test.py -f functions/function_operations.py +python3 ./test.py -f functions/function_avg.py -r 1 +python3 ./test.py -f functions/function_bottom.py -r 1 +python3 ./test.py -f functions/function_count.py -r 1 +python3 ./test.py -f functions/function_diff.py -r 1 +python3 ./test.py -f functions/function_first.py -r 1 +python3 ./test.py -f functions/function_last.py -r 1 +python3 ./test.py -f functions/function_last_row.py -r 1 +python3 ./test.py -f functions/function_leastsquares.py -r 1 +python3 ./test.py -f functions/function_max.py -r 1 +python3 ./test.py -f functions/function_min.py -r 1 +python3 ./test.py -f functions/function_operations.py -r 1 python3 ./test.py -f functions/function_percentile.py -python3 ./test.py -f functions/function_spread.py -python3 ./test.py -f functions/function_stddev.py -python3 ./test.py -f functions/function_sum.py -python3 ./test.py -f functions/function_top.py -#python3 ./test.py -f functions/function_twa.py +python3 ./test.py -f functions/function_spread.py -r 1 +python3 ./test.py -f functions/function_stddev.py -r 1 +python3 ./test.py -f functions/function_sum.py -r 1 +python3 ./test.py -f functions/function_top.py -r 1 +#python3 ./test.py -f functions/function_twa.py -r 1 python3 queryCount.py python3 ./test.py -f query/queryGroupbyWithInterval.py python3 client/twoClients.py @@ -200,4 +202,4 @@ python3 test.py -f tools/taosdemo.py # subscribe python3 test.py -f subscribe/singlemeter.py #python3 test.py -f subscribe/stability.py -python3 test.py -f subscribe/supertable.py \ No newline at end of file +python3 test.py -f subscribe/supertable.py diff --git a/tests/pytest/functions/function_avg_restart.py b/tests/pytest/functions/function_avg_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..56b99cdf910869b5bc4f5bd93da208943b1b026e --- /dev/null +++ b/tests/pytest/functions/function_avg_restart.py @@ -0,0 +1,73 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + #tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + # col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''') + #tdSql.execute("create table test1 using test tags('beijing')") + for i in range(self.rowNum): + #tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" + # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1)) + intData.append(i + 1) + floatData.append(i + 0.1) + + # average verifacation + tdSql.error("select avg(ts) from test") + tdSql.error("select avg(ts) from test1") + tdSql.error("select avg(col7) from test") + tdSql.error("select avg(col7) from test1") + tdSql.error("select avg(col8) from test") + tdSql.error("select avg(col8) from test1") + tdSql.error("select avg(col9) from test") + tdSql.error("select avg(col9) from test1") + + tdSql.query("select avg(col1) from test") + tdSql.checkData(0, 0, np.average(intData)) + tdSql.query("select avg(col2) from test") + tdSql.checkData(0, 0, np.average(intData)) + tdSql.query("select avg(col3) from test") + tdSql.checkData(0, 0, np.average(intData)) + tdSql.query("select avg(col4) from test") + tdSql.checkData(0, 0, np.average(intData)) + tdSql.query("select avg(col5) from test") + tdSql.checkData(0, 0, np.average(floatData)) + tdSql.query("select avg(col6) from test") + tdSql.checkData(0, 0, np.average(floatData)) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_bottom_restart.py b/tests/pytest/functions/function_bottom_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..74eb044645ffa6a54e286dd11d022672575a38db --- /dev/null +++ b/tests/pytest/functions/function_bottom_restart.py @@ -0,0 +1,93 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + #tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + # col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''') + #tdSql.execute("create table test1 using test tags('beijing')") + #for i in range(self.rowNum): + # tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" + # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1)) + + # bottom verifacation + tdSql.error("select bottom(ts, 10) from test") + tdSql.error("select bottom(col1, 0) from test") + tdSql.error("select bottom(col1, 101) from test") + tdSql.error("select bottom(col2, 0) from test") + tdSql.error("select bottom(col2, 101) from test") + tdSql.error("select bottom(col3, 0) from test") + tdSql.error("select bottom(col3, 101) from test") + tdSql.error("select bottom(col4, 0) from test") + tdSql.error("select bottom(col4, 101) from test") + tdSql.error("select bottom(col5, 0) from test") + tdSql.error("select bottom(col5, 101) from test") + tdSql.error("select bottom(col6, 0) from test") + tdSql.error("select bottom(col6, 101) from test") + tdSql.error("select bottom(col7, 10) from test") + tdSql.error("select bottom(col8, 10) from test") + tdSql.error("select bottom(col9, 10) from test") + + tdSql.query("select bottom(col1, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + + tdSql.query("select bottom(col2, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + + tdSql.query("select bottom(col3, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + + tdSql.query("select bottom(col4, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 1) + tdSql.checkData(1, 1, 2) + + tdSql.query("select bottom(col5, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 0.1) + tdSql.checkData(1, 1, 1.1) + + tdSql.query("select bottom(col6, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 0.1) + tdSql.checkData(1, 1, 1.1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_count_restart.py b/tests/pytest/functions/function_count_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..5eabb47d952a1a461b6fd5c976f3f2a8c294222b --- /dev/null +++ b/tests/pytest/functions/function_count_restart.py @@ -0,0 +1,79 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + #tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + # col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''') + #tdSql.execute("create table test1 using test tags('beijing')") + #for i in range(self.rowNum): + # tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" + # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1)) + + # Count verifacation + tdSql.query("select count(*) from test") + tdSql.checkData(0, 0, 11) + + tdSql.query("select count(ts) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col1) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col2) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col3) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col4) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col5) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col6) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col7) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col8) from test") + tdSql.checkData(0, 0, 11) + tdSql.query("select count(col9) from test") + tdSql.checkData(0, 0, 11) + + #tdSql.execute("alter table test add column col10 int") + #tdSql.query("select count(col10) from test") + #tdSql.checkRows(0) + + ##tdSql.execute("insert into test1 values(now, 1, 2, 3, 4, 1.1, 2.2, false, 'test', 'test' 1)") + tdSql.query("select count(col10) from test") + tdSql.checkData(0, 0, 1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_diff_restart.py b/tests/pytest/functions/function_diff_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..870ee03fc94cbd8dbf5e858726cd52b09010a884 --- /dev/null +++ b/tests/pytest/functions/function_diff_restart.py @@ -0,0 +1,99 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + #tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + # col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''') + #tdSql.execute("create table test1 using test tags('beijing')") + #tdSql.execute("insert into test1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ')" % (self.ts - 1)) + + # diff verifacation + #tdSql.query("select diff(col1) from test1") + #tdSql.checkRows(0) + # + #tdSql.query("select diff(col2) from test1") + #tdSql.checkRows(0) + + #tdSql.query("select diff(col3) from test1") + #tdSql.checkRows(0) + + #tdSql.query("select diff(col4) from test1") + #tdSql.checkRows(0) + + #tdSql.query("select diff(col5) from test1") + #tdSql.checkRows(0) + + #tdSql.query("select diff(col6) from test1") + #tdSql.checkRows(0) + + #for i in range(self.rowNum): + # tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d')" + # % (self.ts + i, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1)) + + tdSql.error("select diff(ts) from test") + tdSql.error("select diff(ts) from test1") + tdSql.error("select diff(col1) from test") + tdSql.error("select diff(col2) from test") + tdSql.error("select diff(col3) from test") + tdSql.error("select diff(col4) from test") + tdSql.error("select diff(col5) from test") + tdSql.error("select diff(col6) from test") + tdSql.error("select diff(col7) from test") + tdSql.error("select diff(col7) from test1") + tdSql.error("select diff(col8) from test") + tdSql.error("select diff(col8) from test1") + tdSql.error("select diff(col9) from test") + tdSql.error("select diff(col9) from test1") + + tdSql.query("select diff(col1) from test1") + tdSql.checkRows(10) + + tdSql.query("select diff(col2) from test1") + tdSql.checkRows(10) + + tdSql.query("select diff(col3) from test1") + tdSql.checkRows(10) + + tdSql.query("select diff(col4) from test1") + tdSql.checkRows(10) + + tdSql.query("select diff(col5) from test1") + tdSql.checkRows(10) + + tdSql.query("select diff(col6) from test1") + tdSql.checkRows(10) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_first_restart.py b/tests/pytest/functions/function_first_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..31904c3cde6e1237472aac5767037e5e53e08a47 --- /dev/null +++ b/tests/pytest/functions/function_first_restart.py @@ -0,0 +1,78 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + tdSql.query("select first(*) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 1) + + tdSql.query("select first(col1) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query("select first(col2) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query("select first(col3) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query("select first(col4) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query("select first(col5) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0.1) + + tdSql.query("select first(col6) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 0.1) + + tdSql.query("select first(col7) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, False) + + tdSql.query("select first(col8) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 'taosdata1') + + tdSql.query("select first(col9) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '涛思数据1') + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_last_restart.py b/tests/pytest/functions/function_last_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..69a588d28de7081da4469e9a407be1b68d07f82a --- /dev/null +++ b/tests/pytest/functions/function_last_restart.py @@ -0,0 +1,78 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + tdSql.query("select last(*) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 10) + + tdSql.query("select last(col1) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last(col2) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last(col3) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last(col4) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last(col5) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.1) + + tdSql.query("select last(col6) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.1) + + tdSql.query("select last(col7) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, True) + + tdSql.query("select last(col8) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 'taosdata10') + + tdSql.query("select last(col9) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '涛思数据10') + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_last_row_restart.py b/tests/pytest/functions/function_last_row_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..1043a8809d640d5b57f808d83799f1f497776233 --- /dev/null +++ b/tests/pytest/functions/function_last_row_restart.py @@ -0,0 +1,78 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + tdSql.query("select last_row(*) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 1, 10) + + tdSql.query("select last_row(col1) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last_row(col2) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last_row(col3) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last_row(col4) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select last_row(col5) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.1) + + tdSql.query("select last_row(col6) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.1) + + tdSql.query("select last_row(col7) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, True) + + tdSql.query("select last_row(col8) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 'taosdata10') + + tdSql.query("select last_row(col9) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, '涛思数据10') + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_leastsquares_restart.py b/tests/pytest/functions/function_leastsquares_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..0221dc0aed865882e375f90c44f52b391d1ffee5 --- /dev/null +++ b/tests/pytest/functions/function_leastsquares_restart.py @@ -0,0 +1,68 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + # leastsquares verifacation + tdSql.error("select leastsquares(ts, 1, 1) from test1") + tdSql.error("select leastsquares(col1, 1, 1) from test") + tdSql.error("select leastsquares(col2, 1, 1) from test") + tdSql.error("select leastsquares(col3, 1, 1) from test") + tdSql.error("select leastsquares(col4, 1, 1) from test") + tdSql.error("select leastsquares(col5, 1, 1) from test") + tdSql.error("select leastsquares(col6, 1, 1) from test") + tdSql.error("select leastsquares(col7, 1, 1) from test1") + tdSql.error("select leastsquares(col8, 1, 1) from test1") + tdSql.error("select leastsquares(col9, 1, 1) from test1") + + tdSql.query("select leastsquares(col1, 1, 1) from test1") + tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}') + + tdSql.query("select leastsquares(col2, 1, 1) from test1") + tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}') + + tdSql.query("select leastsquares(col3, 1, 1) from test1") + tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}') + + tdSql.query("select leastsquares(col4, 1, 1) from test1") + tdSql.checkData(0, 0, '{slop:1.000000, intercept:0.000000}') + + tdSql.query("select leastsquares(col5, 1, 1) from test1") + tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}') + + tdSql.query("select leastsquares(col6, 1, 1) from test1") + tdSql.checkData(0, 0, '{slop:1.000000, intercept:-0.900000}') + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_max_restart.py b/tests/pytest/functions/function_max_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..8d1827561758f1ceebffab877aabd6cd79166d42 --- /dev/null +++ b/tests/pytest/functions/function_max_restart.py @@ -0,0 +1,76 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + #tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + # col7 bool, col8 binary(20), col9 nchar(20)) tags(loc nchar(20))''') + #tdSql.execute("create table test1 using test tags('beijing')") + for i in range(self.rowNum): + intData.append(i + 1) + floatData.append(i + 0.1) + + # max verifacation + tdSql.error("select max(ts) from test") + tdSql.error("select max(ts) from test1") + tdSql.error("select max(col7) from test") + tdSql.error("select max(col7) from test1") + tdSql.error("select max(col8) from test") + tdSql.error("select max(col8) from test1") + tdSql.error("select max(col9) from test") + tdSql.error("select max(col9) from test1") + + tdSql.query("select max(col1) from test1") + tdSql.checkData(0, 0, np.max(intData)) + + tdSql.query("select max(col2) from test1") + tdSql.checkData(0, 0, np.max(intData)) + + tdSql.query("select max(col3) from test1") + tdSql.checkData(0, 0, np.max(intData)) + + tdSql.query("select max(col4) from test1") + tdSql.checkData(0, 0, np.max(intData)) + + tdSql.query("select max(col5) from test1") + tdSql.checkData(0, 0, np.max(floatData)) + + tdSql.query("select max(col6) from test1") + tdSql.checkData(0, 0, np.max(floatData)) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_min_restart.py b/tests/pytest/functions/function_min_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..c8329bffa5525c2386d264010acf7231059e344d --- /dev/null +++ b/tests/pytest/functions/function_min_restart.py @@ -0,0 +1,73 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + for i in range(self.rowNum): + intData.append(i + 1) + floatData.append(i + 0.1) + + # min verifacation + tdSql.error("select min(ts) from test") + tdSql.error("select min(ts) from test1") + tdSql.error("select min(col7) from test") + tdSql.error("select min(col7) from test1") + tdSql.error("select min(col8) from test") + tdSql.error("select min(col8) from test1") + tdSql.error("select min(col9) from test") + tdSql.error("select min(col9) from test1") + + tdSql.query("select min(col1) from test1") + tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col2) from test1") + tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col3) from test1") + tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col4) from test1") + tdSql.checkData(0, 0, np.min(intData)) + + tdSql.query("select min(col5) from test1") + tdSql.checkData(0, 0, np.min(floatData)) + + tdSql.query("select min(col6) from test1") + tdSql.checkData(0, 0, np.min(floatData)) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_operations_restart.py b/tests/pytest/functions/function_operations_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..6e3990264cb91d8c063fe638a5f77231ef7be424 --- /dev/null +++ b/tests/pytest/functions/function_operations_restart.py @@ -0,0 +1,70 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + # min verifacation + tdSql.error("select ts + col1 from test") + tdSql.error("select ts + col1 from test1") + tdSql.error("select col1 + col7 from test") + tdSql.error("select col1 + col7 from test1") + tdSql.error("select col1 + col8 from test") + tdSql.error("select col1 + col8 from test1") + tdSql.error("select col1 + col9 from test") + tdSql.error("select col1 + col9 from test1") + + tdSql.query("select col1 + col2 from test1") + tdSql.checkRows(11) + tdSql.checkData(0, 0, 2.0) + + tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1") + tdSql.checkRows(11) + tdSql.checkData(0, 0, 3.2) + + #tdSql.execute("insert into test1(ts, col1) values(%d, 11)" % (self.ts + 11)) + tdSql.query("select col1 + col2 from test1") + tdSql.checkRows(11) + tdSql.checkData(10, 0, None) + + tdSql.query("select col1 + col2 * col3 from test1") + tdSql.checkRows(11) + tdSql.checkData(10, 0, None) + + tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1") + tdSql.checkRows(11) + tdSql.checkData(10, 0, None) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_percentile_restart.py b/tests/pytest/functions/function_percentile_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..ade10282dedd655bc7ccb912a30a2a3e88a72223 --- /dev/null +++ b/tests/pytest/functions/function_percentile_restart.py @@ -0,0 +1,136 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + for i in range(self.rowNum): + intData.append(i + 1) + floatData.append(i + 0.1) + + # percentile verifacation + tdSql.error("select percentile(ts 20) from test") + tdSql.error("select apercentile(ts 20) from test") + tdSql.error("select percentile(col7 20) from test") + tdSql.error("select apercentile(col7 20) from test") + tdSql.error("select percentile(col8 20) from test") + tdSql.error("select apercentile(col8 20) from test") + tdSql.error("select percentile(col9 20) from test") + tdSql.error("select apercentile(col9 20) from test") + + tdSql.query("select percentile(col1, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col1, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col1, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col1, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col1, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col1, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col2, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col2, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col2, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col2, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col2, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col2, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col3, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col3, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col3, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col3, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col3, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col3, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col4, 0) from test") + tdSql.checkData(0, 0, np.percentile(intData, 0)) + tdSql.query("select apercentile(col4, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col4, 50) from test") + tdSql.checkData(0, 0, np.percentile(intData, 50)) + tdSql.query("select apercentile(col4, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col4, 100) from test") + tdSql.checkData(0, 0, np.percentile(intData, 100)) + tdSql.query("select apercentile(col4, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col5, 0) from test") + print("query result: %s" % tdSql.getData(0, 0)) + print("array result: %s" % np.percentile(floatData, 0)) + tdSql.query("select apercentile(col5, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col5, 50) from test") + print("query result: %s" % tdSql.getData(0, 0)) + print("array result: %s" % np.percentile(floatData, 50)) + tdSql.query("select apercentile(col5, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col5, 100) from test") + print("query result: %s" % tdSql.getData(0, 0)) + print("array result: %s" % np.percentile(floatData, 100)) + tdSql.query("select apercentile(col5, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + tdSql.query("select percentile(col6, 0) from test") + tdSql.checkData(0, 0, np.percentile(floatData, 0)) + tdSql.query("select apercentile(col6, 0) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col6, 50) from test") + tdSql.checkData(0, 0, np.percentile(floatData, 50)) + tdSql.query("select apercentile(col6, 50) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + tdSql.query("select percentile(col6, 100) from test") + tdSql.checkData(0, 0, np.percentile(floatData, 100)) + tdSql.query("select apercentile(col6, 100) from test") + print("apercentile result: %s" % tdSql.getData(0, 0)) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_spread_restart.py b/tests/pytest/functions/function_spread_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..ba71da0a18ac2e1e2a1ead6ab3de9ff5cae6a600 --- /dev/null +++ b/tests/pytest/functions/function_spread_restart.py @@ -0,0 +1,69 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + tdSql.error("select spread(col7) from test") + tdSql.error("select spread(col7) from test1") + tdSql.error("select spread(col8) from test") + tdSql.error("select spread(col8) from test1") + tdSql.error("select spread(col9) from test") + tdSql.error("select spread(col9) from test1") + + tdSql.query("select spread(col1) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select spread(col2) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select spread(col3) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select spread(col4) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 10) + + tdSql.query("select spread(col5) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.1) + + tdSql.query("select spread(col6) from test1") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 9.1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_stddev_restart.py b/tests/pytest/functions/function_stddev_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..ec413b94b20a89c210131188d2a09e38cdbc721c --- /dev/null +++ b/tests/pytest/functions/function_stddev_restart.py @@ -0,0 +1,75 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + for i in range(self.rowNum): + intData.append(i + 1) + floatData.append(i + 0.1) + + # stddev verifacation + tdSql.error("select stddev(ts) from test1") + tdSql.error("select stddev(col1) from test") + tdSql.error("select stddev(col2) from test") + tdSql.error("select stddev(col3) from test") + tdSql.error("select stddev(col4) from test") + tdSql.error("select stddev(col5) from test") + tdSql.error("select stddev(col6) from test") + tdSql.error("select stddev(col7) from test1") + tdSql.error("select stddev(col8) from test1") + tdSql.error("select stddev(col9) from test1") + + tdSql.query("select stddev(col1) from test1") + tdSql.checkData(0, 0, np.std(intData)) + + tdSql.query("select stddev(col2) from test1") + tdSql.checkData(0, 0, np.std(intData)) + + tdSql.query("select stddev(col3) from test1") + tdSql.checkData(0, 0, np.std(intData)) + + tdSql.query("select stddev(col4) from test1") + tdSql.checkData(0, 0, np.std(intData)) + + tdSql.query("select stddev(col5) from test1") + tdSql.checkData(0, 0, np.std(floatData)) + + tdSql.query("select stddev(col6) from test1") + tdSql.checkData(0, 0, np.std(floatData)) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_sum_restart.py b/tests/pytest/functions/function_sum_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..7fd9ae7dd419faa7f9e00f5a043a0c5e2c3d5f03 --- /dev/null +++ b/tests/pytest/functions/function_sum_restart.py @@ -0,0 +1,64 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + for i in range(self.rowNum): + intData.append(i + 1) + floatData.append(i + 0.1) + + # sum verifacation + tdSql.error("select sum(ts) from test") + tdSql.error("select sum(col7) from test") + tdSql.error("select sum(col8) from test") + tdSql.error("select sum(col9) from test") + + tdSql.query("select sum(col1) from test") + tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col2) from test") + tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col3) from test") + tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col4) from test") + tdSql.checkData(0, 0, np.sum(intData)) + tdSql.query("select sum(col5) from test") + tdSql.checkData(0, 0, np.sum(floatData)) + tdSql.query("select sum(col6) from test") + tdSql.checkData(0, 0, np.sum(floatData)) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_top_restart.py b/tests/pytest/functions/function_top_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..5ae96a2505f98a1bfe4ce8602e098c5217816fda --- /dev/null +++ b/tests/pytest/functions/function_top_restart.py @@ -0,0 +1,93 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + for i in range(self.rowNum): + intData.append(i + 1) + floatData.append(i + 0.1) + + # top verifacation + tdSql.error("select top(ts, 10) from test") + tdSql.error("select top(col1, 0) from test") + tdSql.error("select top(col1, 101) from test") + tdSql.error("select top(col2, 0) from test") + tdSql.error("select top(col2, 101) from test") + tdSql.error("select top(col3, 0) from test") + tdSql.error("select top(col3, 101) from test") + tdSql.error("select top(col4, 0) from test") + tdSql.error("select top(col4, 101) from test") + tdSql.error("select top(col5, 0) from test") + tdSql.error("select top(col5, 101) from test") + tdSql.error("select top(col6, 0) from test") + tdSql.error("select top(col6, 101) from test") + tdSql.error("select top(col7, 10) from test") + tdSql.error("select top(col8, 10) from test") + tdSql.error("select top(col9, 10) from test") + + tdSql.query("select top(col1, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + + tdSql.query("select top(col2, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + + tdSql.query("select top(col3, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + + tdSql.query("select top(col4, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 9) + tdSql.checkData(1, 1, 10) + + tdSql.query("select top(col5, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 8.1) + tdSql.checkData(1, 1, 9.1) + + tdSql.query("select top(col6, 2) from test") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 8.1) + tdSql.checkData(1, 1, 9.1) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/functions/function_twa_restart.py b/tests/pytest/functions/function_twa_restart.py new file mode 100644 index 0000000000000000000000000000000000000000..2025e3c9ddcdd41aa18db949e5db0d059090e469 --- /dev/null +++ b/tests/pytest/functions/function_twa_restart.py @@ -0,0 +1,130 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import numpy as np + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + self.rowNum = 10 + self.ts = 1537146000000 + + def run(self): + tdSql.execute("use db") + + intData = [] + floatData = [] + + for i in range(self.rowNum): + intData.append(i + 1) + floatData.append(i + 0.1) + + # twa verifacation + tdSql.error("select twa(ts) from test") + tdSql.error("select twa(ts) from test1") + + tdSql.error("select twa(col1) from test") + tdSql.error("select twa(col1) from test1") + + tdSql.error("select twa(col2) from test") + tdSql.error("select twa(col2) from test1") + + tdSql.error("select twa(col3) from test") + tdSql.error("select twa(col3) from test1") + + tdSql.error("select twa(col4) from test") + tdSql.error("select twa(col4) from test1") + + tdSql.error("select twa(col5) from test") + tdSql.error("select twa(col5) from test1") + + tdSql.error("select twa(col6) from test") + tdSql.error("select twa(col6) from test1") + + tdSql.error("select twa(col7) from test") + tdSql.error("select twa(col7) from test1") + + tdSql.error("select twa(col8) from test") + tdSql.error("select twa(col8) from test1") + + tdSql.error("select twa(col9) from test") + tdSql.error("select twa(col9) from test1") + + tdSql.error("select twa(col1) from test where ts > %d" % self.ts) + tdSql.error("select twa(col1) from test1 where ts > %d" % self.ts) + + tdSql.error("select twa(col2) from test where ts > %d" % self.ts) + tdSql.error("select twa(col2) from test1 where ts > %d" % self.ts) + + tdSql.error("select twa(col3) from test where ts > %d" % self.ts) + tdSql.error("select twa(col3) from test1 where ts > %d" % self.ts) + + tdSql.error("select twa(col4) from test where ts > %d" % self.ts) + tdSql.error("select twa(col4) from test1 where ts > %d" % self.ts) + + tdSql.error("select twa(col5) from test where ts > %d" % self.ts) + tdSql.error("select twa(col5) from test1 where ts > %d" % self.ts) + + tdSql.error("select twa(col6) from test where ts > %d" % self.ts) + tdSql.error("select twa(col6) from test1 where ts > %d" % self.ts) + + tdSql.error("select twa(col1) from test where ts < %d" % (self.ts + self.rowNum)) + tdSql.error("select twa(col1) from test1 where ts < %d" % (self.ts + self.rowNum)) + + tdSql.error("select twa(col2) from test where ts < %d" % (self.ts + self.rowNum)) + tdSql.error("select twa(col2) from test1 where ts < %d" % (self.ts + self.rowNum)) + + tdSql.error("select twa(col3) from test where ts < %d" % (self.ts + self.rowNum)) + tdSql.error("select twa(col3) from test1 where ts < %d" % (self.ts + self.rowNum)) + + tdSql.error("select twa(col4) from test where ts < %d" % (self.ts + self.rowNum)) + tdSql.error("select twa(col4) from test1 where ts < %d" % (self.ts + self.rowNum)) + + tdSql.error("select twa(col5) from test where ts < %d" % (self.ts + self.rowNum)) + tdSql.error("select twa(col5) from test1 where ts < %d" % (self.ts + self.rowNum)) + + tdSql.error("select twa(col6) from test where ts < %d" % (self.ts + self.rowNum)) + tdSql.error("select twa(col6) from test1 where ts < %d" % (self.ts + self.rowNum)) + + tdSql.query("select twa(col1) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + tdSql.query("select twa(col1) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + + tdSql.query("select twa(col2) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + tdSql.query("select twa(col2) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + + tdSql.query("select twa(col3) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + tdSql.query("select twa(col3) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + + tdSql.query("select twa(col4) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + tdSql.query("select twa(col4) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + + tdSql.query("select twa(col5) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + tdSql.query("select twa(col5) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + + tdSql.query("select twa(col6) from test where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + tdSql.query("select twa(col6) from test1 where ts > %d and ts < %d" % (self.ts, self.ts + self.rowNum)) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/handle_val_log.sh b/tests/pytest/handle_val_log.sh new file mode 100755 index 0000000000000000000000000000000000000000..142cf1074552256d712bcef891fff74d4f4396b0 --- /dev/null +++ b/tests/pytest/handle_val_log.sh @@ -0,0 +1,29 @@ +# Color setting +RED='\033[0;31m' +GREEN='\033[1;32m' +GREEN_DARK='\033[0;32m' +GREEN_UNDERLINE='\033[4;32m' +NC='\033[0m' + +grep 'start to execute\|ERROR SUMMARY' mem-error-out.log|grep -v 'grep'|uniq|tee uniq-mem-error-out.log + +for memError in `grep 'ERROR SUMMARY' uniq-mem-error-out.log | awk '{print $4}'` +do +if [ -n "$memError" ]; then + if [ "$memError" -gt 12 ]; then + echo -e "${RED} ## Memory errors number valgrind reports is $memError.\ + More than our threshold! ## ${NC}" + fi +fi +done + +grep 'start to execute\|definitely lost:' mem-error-out.log|grep -v 'grep'|uniq|tee uniq-definitely-lost-out.log +for defiMemError in `grep 'definitely lost:' uniq-definitely-lost-out.log | awk '{print $7}'` +do +if [ -n "$defiMemError" ]; then + if [ "$defiMemError" -gt 13 ]; then + echo -e "${RED} ## Memory errors number valgrind reports \ + Definitely lost is $defiMemError. More than our threshold! ## ${NC}" + fi +fi +done \ No newline at end of file diff --git a/tests/pytest/insert/before_1970.py b/tests/pytest/insert/before_1970.py new file mode 100644 index 0000000000000000000000000000000000000000..cb17b657aad1a3bfdb915c9661bad291b75d6f04 --- /dev/null +++ b/tests/pytest/insert/before_1970.py @@ -0,0 +1,80 @@ +################################################################### +# 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 +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import tdDnodes + + +class TDTestCase: + """ + add test data before 1970s + """ + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute("create database if not exists demo keep 36500;"); + print("==============create db demo keep 365000 days") + tdSql.execute("use demo;") + tdSql.execute("CREATE table if not exists test (ts timestamp, f1 int);") + print("==============create table test") + + print("==============step2") + #TODO : should add more testcases + tdSql.execute("insert into test values('1930-12-12 01:19:20.345', 1);") + tdSql.execute("insert into test values('1969-12-30 23:59:59.999', 2);") + tdSql.execute("insert into test values(-3600, 3);") + tdSql.execute("insert into test values('2020-10-20 14:02:53.770', 4);") + print("==============insert data") + + # tdSql.query("select * from test;") + # + # tdSql.checkRows(3) + # + # tdSql.checkData(0,0,'1969-12-12 01:19:20.345000') + # tdSql.checkData(1,0,'1970-01-01 07:00:00.000000') + # tdSql.checkData(2,0,'2020-10-20 14:02:53.770000') + print("==============step3") + tdDnodes.stopAll() + tdDnodes.start(1) + print("==============restart taosd") + + + print("==============step4") + tdSql.execute("use demo;") + tdSql.query("select * from test;") + # print(tdSql.queryResult) + tdSql.checkRows(4) + tdSql.checkData(0,0,'1930-12-12 01:19:20.345000') + tdSql.checkData(1,0,'1969-12-30 23:59:59.999000') + tdSql.checkData(2,0,'1970-01-01 07:00:00.000000') + tdSql.checkData(3,0,'2020-10-20 14:02:53.770000') + print("==============check data") + + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/insert/insertIntoTwoTables.py b/tests/pytest/insert/insertIntoTwoTables.py new file mode 100644 index 0000000000000000000000000000000000000000..dc985fbe12efb5cfb7e511336e573a18abcaa358 --- /dev/null +++ b/tests/pytest/insert/insertIntoTwoTables.py @@ -0,0 +1,53 @@ +################################################################### +# 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 +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + ### test case for TD-1758 ### + print("==============step1") + tdSql.execute( + "create table t0(ts timestamp, c int)") + tdSql.execute( + 'create table t1(ts timestamp, c binary(1))') + tdSql.execute( + "insert into t0 values(now,1) t1 values(now,'0')(now+1a,'1')(now+2a,'2')(now+3a,'3')(now+4a,'4')") + + print("==============step2") + + tdSql.query("select * from t0") + tdSql.checkRows(1) + tdSql.checkData(0, 0, 1) + + tdSql.query("select * from t1") + tdSql.checkRows(5) + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/bug1471.py b/tests/pytest/query/bug1471.py new file mode 100644 index 0000000000000000000000000000000000000000..f1cb0bdcdfbb085410d0001606208e11373687a1 --- /dev/null +++ b/tests/pytest/query/bug1471.py @@ -0,0 +1,73 @@ +################################################################### +# 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 +import taos +from util.log import * +from util.cases import * +from util.sql import * +import time +import threading + + +class myThread(threading.Thread): + def __init__(self, conn): + threading.Thread.__init__(self) + self.event = threading.Event() + self.conn = taos.connect(conn._host, port=conn._port, config=conn._config) + + def run(self): + cur = self.conn.cursor() + self.event.wait() + cur.execute("drop database db") + cur.close() + self.conn.close() + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor()) + + def run(self): + for i in range(50): + print("round", i) + thread = myThread(tdSql.cursor._connection) + thread.start() + + tdSql.execute('reset query cache') + tdSql.execute('drop database if exists db') + tdSql.execute('create database db') + tdSql.execute('use db') + tdSql.execute("create table car (ts timestamp, s int)") + tdSql.execute("insert into car values('2020-10-19 17:00:00', 123)") + + thread.event.set() + try: + tdSql.query("select s from car where ts = '2020-10-19 17:00:00'") + except Exception as e: + pass + else: + tdSql.checkData(0, 0, 123) + + thread.join() + time.sleep(0.2) + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/query/removeDBAndSTable.py b/tests/pytest/query/removeDBAndSTable.py new file mode 100644 index 0000000000000000000000000000000000000000..4616c7e378326af633a89905d746c7d51ce92139 --- /dev/null +++ b/tests/pytest/query/removeDBAndSTable.py @@ -0,0 +1,70 @@ +################################################################### +# 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 +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import tdDnodes + + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute("create database db_vplu"); + tdSql.execute("use db_vplu") + tdSql.execute("CREATE table if not exists st (ts timestamp, speed int) tags(id int)") + tdSql.execute("CREATE table if not exists st_vplu (ts timestamp, speed int) tags(id int)") + + print("==============step2") + + tdSql.execute("drop table st") + + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st_vplu") + + tdDnodes.stopAll() + tdDnodes.start(1) + + tdSql.execute("use db_vplu") + tdSql.query("show stables") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "st_vplu") + + tdSql.execute("drop database db") + tdSql.query("show databases") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "db_vplu") + + tdDnodes.stopAll() + tdDnodes.start(1) + + tdSql.query("show databases") + tdSql.checkRows(1) + tdSql.checkData(0, 0, "db_vplu") + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/table/alter_wal0.py b/tests/pytest/table/alter_wal0.py new file mode 100644 index 0000000000000000000000000000000000000000..15ad69998f450b8e385cbf58052d246d9de27380 --- /dev/null +++ b/tests/pytest/table/alter_wal0.py @@ -0,0 +1,75 @@ +################################################################### +# 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 +import taos +from util.log import tdLog +from util.cases import tdCases +from util.sql import tdSql +from util.dnodes import tdDnodes + + +class TDTestCase: + """ + remove last tow bytes of file 'wal0',then restart taosd and create new tables. + """ + def init(self, conn, logSql): + tdLog.debug("start to execute %s" % __file__) + tdSql.init(conn.cursor(), logSql) + + def run(self): + tdSql.prepare() + + print("==============step1") + tdSql.execute("create database if not exists demo;"); + tdSql.execute("use demo;") + tdSql.execute("create table if not exists meters(ts timestamp, f1 int) tags(t1 int);"); + for i in range(1,11): + tdSql.execute("CREATE table if not exists test{num} using meters tags({num});".format(num=i)) + print("==============insert 10 tables") + + tdSql.query('show tables;') + tdSql.checkRows(10) + + print("==============step2") + tdDnodes.stopAll() + filename = '/var/lib/taos/mnode/wal/wal0' + + with open(filename, 'rb') as f1: + temp = f1.read() + + with open(filename, 'wb') as f2: + f2.write(temp[:-2]) + + tdDnodes.start(1) + print("==============remove last tow bytes of file 'wal0' and restart taosd") + + print("==============step3") + tdSql.execute("use demo;") + tdSql.query('show tables;') + tdSql.checkRows(10) + for i in range(11,21): + tdSql.execute("CREATE table if not exists test{num} using meters tags({num});".format(num=i)) + + tdSql.query('show tables;') + tdSql.checkRows(20) + print("==============check table numbers and create 10 tables") + + + def stop(self): + tdSql.close() + tdLog.success("%s successfully executed" % __file__) + + +tdCases.addWindows(__file__, TDTestCase()) +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/pytest/test.py b/tests/pytest/test.py index 678bd873368325d97783fac1e0f94cd76be38cef..a2c35444b55fea9df55e46b4c81a9150b642b452 100644 --- a/tests/pytest/test.py +++ b/tests/pytest/test.py @@ -16,6 +16,7 @@ import sys import getopt import subprocess +import time from distutils.log import warn as printf from util.log import * @@ -33,7 +34,8 @@ if __name__ == "__main__": valgrind = 0 logSql = True stop = 0 - opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scgh', [ + restart = False + opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghr', [ 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help']) for key, value in opts: if key in ['-h', '--help']: @@ -46,8 +48,12 @@ if __name__ == "__main__": tdLog.printNoPrefix('-s stop All dnodes') tdLog.printNoPrefix('-c Test Cluster Flag') tdLog.printNoPrefix('-g valgrind Test Flag') + tdLog.printNoPrefix('-r taosd restart test') sys.exit(0) + if key in ['-r', '--restart']: + restart = True + if key in ['-f', '--file']: fileName = value @@ -138,5 +144,19 @@ if __name__ == "__main__": tdCases.runAllLinux(conn) else: tdCases.runOneLinux(conn, fileName) - + if restart: + if fileName == "all": + tdLog.info("not need to query ") + else: + sp = fileName.rsplit(".", 1) + if len(sp) == 2 and sp[1] == "py": + tdDnodes.stopAll() + tdDnodes.start(1) + time.sleep(1) + conn = taos.connect( host, config=tdDnodes.getSimCfgPath()) + tdLog.info("Procedures for tdengine deployed in %s" % (host)) + tdLog.info("query test after taosd restart") + tdCases.runOneLinux(conn, sp[0] + "_" + "restart.py") + else: + tdLog.info("not need to query") conn.close() diff --git a/tests/pytest/valgrind-test.sh b/tests/pytest/valgrind-test.sh index 9dc9de1b152e5bf6611a2b9353a9879119ffcf04..468974d0983884a5df0ee4fcc06aaf1ce0a36a90 100755 --- a/tests/pytest/valgrind-test.sh +++ b/tests/pytest/valgrind-test.sh @@ -1,5 +1,26 @@ #!/bin/bash +IN_TDINTERNAL="community" +TDIR=`pwd` +if [[ "$tests_dir" == *"$IN_TDINTERNAL"* ]]; then + cd ../.. +else + cd ../../.. +fi +TOP_DIR=`pwd` +TAOSLIB_DIR=`find . -name "libtaos.so"|grep -w lib|head -n1` +if [[ "$TAOSLIB_DIR" == *"$IN_TDINTERNAL"* ]]; then + LIB_DIR=`find . -name "libtaos.so"|grep -w lib|head -n1|cut -d '/' --fields=2,3,4,5` +else + LIB_DIR=`find . -name "libtaos.so"|grep -w lib|head -n1|cut -d '/' --fields=2,3,4` +fi +if [ ! $LD_LIBRARY_PATH ]; then + export LD_LIBRARY_PATH=$TOP_DIR/$LIB_DIR +else + export LD_LIBRARY_PATH=$TOP_DIR/$LIB_DIR:$LD_LIBRARY_PATH +fi + +cd $TDIR # client PYTHONMALLOC=malloc python3 ./test.py -g -f client/client.py PYTHONMALLOC=malloc python3 ./test.py -g -s && sleep 1 diff --git a/tests/script/general/compute/avg.sim b/tests/script/general/compute/avg.sim index 9a37363a6052e1098d2aa92221044a067b3abee7..52a270bc6d9b1581fb210693f74cce9ecc73b3fa 100644 --- a/tests/script/general/compute/avg.sim +++ b/tests/script/general/compute/avg.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,9 @@ if $data00 != 9.500000000 then endi print =============== step3 -sql select avg(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select avg(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 2.000000000 then return -1 @@ -79,7 +83,9 @@ if $data01 != 9.500000000 then endi print =============== step6 -sql select avg(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select avg(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data01 if $data41 != 4.000000000 then return -1 @@ -96,7 +102,9 @@ if $data00 != 9.500000000 then endi print =============== step8 -sql select avg(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select avg(tbcol) as c from $mt where ts <= $ms print ===> $data00 if $data00 != 2.000000000 then return -1 @@ -108,7 +116,9 @@ if $data00 != 9.500000000 then return -1 endi -sql select avg(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select avg(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 2.000000000 then return -1 @@ -139,7 +149,9 @@ if $rows != $tbNum then endi print =============== step11 -sql select avg(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select avg(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol print ===> $data11 if $data11 != 1.000000000 then return -1 diff --git a/tests/script/general/compute/bottom.sim b/tests/script/general/compute/bottom.sim index 592f87651e118c0c7509cfcab26bbad4d9873047..415bd36e2e0417e8f9da2989e21f1a1908e01cfd 100644 --- a/tests/script/general/compute/bottom.sim +++ b/tests/script/general/compute/bottom.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,9 @@ if $data01 != 0 then endi print =============== step3 -sql select bottom(tbcol, 1) from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select bottom(tbcol, 1) from $tb where ts > $ms print ===> $data01 if $data01 != 5 then return -1 @@ -76,7 +80,9 @@ if $data11 != 1 then endi print =============== step6 -sql select bottom(tbcol, 2) as b from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select bottom(tbcol, 2) as b from $tb where ts > $ms print ===> $data01 $data11 if $data01 != 5 then return -1 diff --git a/tests/script/general/compute/count.sim b/tests/script/general/compute/count.sim index c2ed5af3ca4631ca37bdef4959fd1fc353171e8a..d8aeb18752a3fee18471a3402d259142486ecc1a 100644 --- a/tests/script/general/compute/count.sim +++ b/tests/script/general/compute/count.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -65,7 +67,9 @@ if $data00 != $rowNum then endi print =============== step3 -sql select count(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select count(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 5 then return -1 @@ -92,7 +96,9 @@ if $data01 != $rowNum then endi print =============== step6 -sql select count(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select count(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data01 if $data01 != 1 then return -1 @@ -122,7 +128,9 @@ if $data00 != $totalNum then endi print =============== step10 -sql select count(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select count(tbcol) as c from $mt where ts <= $ms print ===> $data00 if $data00 != 50 then return -1 @@ -134,7 +142,9 @@ if $data00 != 100 then return -1 endi -sql select count(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select count(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 25 then return -1 @@ -168,7 +178,9 @@ if $rows != $tbNum then endi print =============== step11 -sql select count(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select count(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol print ===> $data01 if $data01 != 1 then return -1 diff --git a/tests/script/general/compute/diff.sim b/tests/script/general/compute/diff.sim index 8a60cd00bc745180d6f5d910e34650091b6b8945..88c2ecb09df9128499cef1426a53d5b922512164 100644 --- a/tests/script/general/compute/diff.sim +++ b/tests/script/general/compute/diff.sim @@ -31,8 +31,9 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,13 +53,17 @@ if $data11 != 1 then endi print =============== step3 -sql select diff(tbcol) from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select diff(tbcol) from $tb where ts > $ms print ===> $data11 if $data11 != 1 then return -1 endi -sql select diff(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select diff(tbcol) from $tb where ts <= $ms print ===> $data11 if $data11 != 1 then return -1 @@ -77,7 +82,9 @@ sql select diff(tbcol) as b from $tb interval(1m) -x step5 step5: print =============== step6 -sql select diff(tbcol) as b from $tb where ts < now + 4m interval(1m) -x step6 +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select diff(tbcol) as b from $tb where ts <= $ms interval(1m) -x step6 return -1 step6: diff --git a/tests/script/general/compute/diff2.sim b/tests/script/general/compute/diff2.sim index 0be907c16ae20690e32eb2364f9b169f9e77f302..14675c823f04693c76fcb151169b6dba738b8aaf 100644 --- a/tests/script/general/compute/diff2.sim +++ b/tests/script/general/compute/diff2.sim @@ -31,9 +31,11 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m + $cc = $x * 60000 + $ms = 1601481600000 + $cc + $tinyint = $x / 128 - sql insert into $tb values (now + $ms , $x , $x , $x , $x , $tinyint , $x , $x , $x , $x ) + sql insert into $tb values ($ms , $x , $x , $x , $x , $tinyint , $x , $x , $x , $x ) $x = $x + 1 endw diff --git a/tests/script/general/compute/first.sim b/tests/script/general/compute/first.sim index 80f4f53cdbe8f498345a5f68e542b9914163485e..01b82cce62adbc13420289878ea01ed63776bbce 100644 --- a/tests/script/general/compute/first.sim +++ b/tests/script/general/compute/first.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,9 @@ if $data00 != 0 then endi print =============== step3 -sql select first(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select first(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 0 then return -1 @@ -79,7 +83,9 @@ if $data01 != 0 then endi print =============== step6 -sql select first(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select first(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data01 if $data41 != 4 then return -1 @@ -96,7 +102,9 @@ if $data00 != 0 then endi print =============== step8 -sql select first(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select first(tbcol) as c from $mt where ts <= $ms print ===> $data00 if $data00 != 0 then return -1 @@ -108,7 +116,9 @@ if $data00 != 0 then return -1 endi -sql select first(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select first(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 0 then return -1 @@ -140,7 +150,9 @@ if $rows != $tbNum then endi print =============== step11 -sql select first(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select first(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol print ===> $data11 if $data11 != 1 then return -1 diff --git a/tests/script/general/compute/interval.sim b/tests/script/general/compute/interval.sim index 26f40eda5ae78a3f49d1341c8aae25d549fdb52e..8f9bf2ecb3013afe2bc11d5c851d8effbcf37686 100644 --- a/tests/script/general/compute/interval.sim +++ b/tests/script/general/compute/interval.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -56,7 +58,9 @@ if $data05 != 1 then endi print =============== step3 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms interval(1m) print ===> $rows if $rows > 10 then return -1 @@ -72,7 +76,13 @@ if $data05 != 1 then endi print =============== step4 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now-1m interval(1m) +$cc = 40 * 60000 +$ms = 1601481600000 + $cc + +$cc = 1 * 60000 +$ms2 = 1601481600000 - $cc + +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) print ===> $rows if $rows < 18 then return -1 @@ -88,7 +98,13 @@ if $data05 != 1 then endi print =============== step5 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts < now+40m and ts > now+1m interval(1m) fill(value,0) +$cc = 40 * 60000 +$ms = 1601481600000 + $cc + +$cc = 1 * 60000 +$ms2 = 1601481600000 - $cc + +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0) print ===> $rows if $rows < 30 then return -1 @@ -120,7 +136,9 @@ if $data11 < 5 then endi print =============== step7 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms interval(1m) print ===> $rows if $rows < 3 then return -1 @@ -136,7 +154,13 @@ if $data11 < 5 then endi print =============== step8 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now-1m interval(1m) +$cc = 40 * 60000 +$ms1 = 1601481600000 + $cc + +$cc = 1 * 60000 +$ms2 = 1601481600000 - $cc + +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) print ===> $rows if $rows < 18 then return -1 @@ -152,7 +176,13 @@ if $data11 < 5 then endi print =============== step9 -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts < now+40m and ts > now+1m interval(1m) fill(value, 0) +$cc = 40 * 60000 +$ms1 = 1601481600000 + $cc + +$cc = 1 * 60000 +$ms2 = 1601481600000 - $cc + +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $mt where ts <= $ms1 and ts > $ms2 interval(1m) fill(value, 0) if $rows < 30 then return -1 endi diff --git a/tests/script/general/compute/last.sim b/tests/script/general/compute/last.sim index 0e92bb6d456c92b8158faa59aa18d2bef82995e9..88a6a268463ef005dd4c611e2b127c3a0d8f3bf0 100644 --- a/tests/script/general/compute/last.sim +++ b/tests/script/general/compute/last.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,10 @@ if $data00 != 19 then endi print =============== step3 -sql select last(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select last(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -79,7 +84,10 @@ if $data01 != 19 then endi print =============== step6 -sql select last(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select last(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data11 if $data11 != 1 then return -1 @@ -96,7 +104,10 @@ if $data00 != 19 then endi print =============== step8 -sql select last(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select last(tbcol) as c from $mt where ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -108,7 +119,10 @@ if $data00 != 19 then return -1 endi -sql select last(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select last(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -139,7 +153,10 @@ if $rows != $tbNum then endi print =============== step11 -sql select last(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select last(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol print ===> $data11 if $data11 != 1 then return -1 diff --git a/tests/script/general/compute/last_row.sim b/tests/script/general/compute/last_row.sim index cc5cc3edbbf47f57eec723eba007c79fc03f150b..55d97fe53c75b8df34caed98f4bd57bc05a9711f 100644 --- a/tests/script/general/compute/last_row.sim +++ b/tests/script/general/compute/last_row.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,9 @@ if $data00 != 19 then endi print =============== step3 -sql select last_row(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select last_row(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -75,7 +79,9 @@ if $data00 != 19 then endi print =============== step8 -sql select last_row(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select last_row(tbcol) as c from $mt where ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -87,7 +93,9 @@ if $data00 != 19 then return -1 endi -sql select last_row(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select last_row(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -108,18 +116,37 @@ endi print =============== step11 -sql insert into $tb values(now + 1h, 10) -sql insert into $tb values(now + 3h, null) -sql insert into $tb values(now + 5h, -1) -sql insert into $tb values(now + 7h, null) +$cc = 1 * 3600000 +$ms = 1601481600000 + $cc +sql insert into $tb values( $ms , 10) + +$cc = 3 * 3600000 +$ms = 1601481600000 + $cc +sql insert into $tb values( $ms , null) + +$cc = 5 * 3600000 +$ms = 1601481600000 + $cc + +sql insert into $tb values( $ms , -1) + +$cc = 7 * 3600000 +$ms = 1601481600000 + $cc + +sql insert into $tb values( $ms , null) ## for super table -sql select last_row(*) from $mt where ts < now + 6h +$cc = 6 * 3600000 +$ms = 1601481600000 + $cc + +sql select last_row(*) from $mt where ts < $ms if $data01 != -1 then return -1 endi -sql select last_row(*) from $mt where ts < now + 8h +$cc = 8 * 3600000 +$ms = 1601481600000 + $cc + +sql select last_row(*) from $mt where ts < $ms if $data01 != NULL then return -1 endi @@ -129,23 +156,37 @@ if $data01 != NULL then return -1 endi -sql select last_row(*) from $mt where ts < now + 4h +$cc = 4 * 3600000 +$ms = 1601481600000 + $cc + +sql select last_row(*) from $mt where ts < $ms if $data01 != NULL then return -1 endi -sql select last_row(*) from $mt where ts > now + 1h and ts < now + 4h +$cc = 1 * 3600000 +$ms1 = 1601481600000 + $cc +$cc = 4 * 3600000 +$ms2 = 1601481600000 + $cc + +sql select last_row(*) from $mt where ts > $ms1 and ts <= $ms2 if $data01 != NULL then return -1 endi ## for table -sql select last_row(*) from $tb where ts < now + 6h +$cc = 6 * 3600000 +$ms = 1601481600000 + $cc + +sql select last_row(*) from $tb where ts <= $ms if $data01 != -1 then return -1 endi -sql select last_row(*) from $tb where ts < now + 8h +$cc = 8 * 3600000 +$ms = 1601481600000 + $cc + +sql select last_row(*) from $tb where ts <= $ms if $data01 != NULL then return -1 endi @@ -155,12 +196,20 @@ if $data01 != NULL then return -1 endi -sql select last_row(*) from $tb where ts < now + 4h +$cc = 4 * 3600000 +$ms = 1601481600000 + $cc + +sql select last_row(*) from $tb where ts <= $ms if $data01 != NULL then return -1 endi -sql select last_row(*) from $tb where ts > now + 1h and ts < now + 4h +$cc = 1 * 3600000 +$ms1 = 1601481600000 + $cc +$cc = 4 * 3600000 +$ms2 = 1601481600000 + $cc + +sql select last_row(*) from $tb where ts > $ms1 and ts <= $ms2 if $data01 != NULL then return -1 endi diff --git a/tests/script/general/compute/max.sim b/tests/script/general/compute/max.sim index 4fc760d66d1391e2b92ffc2fb01d00b4a0136c07..1029ba78cc595b70048f887c55a2393cb2b46e10 100644 --- a/tests/script/general/compute/max.sim +++ b/tests/script/general/compute/max.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,10 @@ if $data00 != 19 then endi print =============== step3 -sql select max(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select max(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -79,7 +84,10 @@ if $data01 != 19 then endi print =============== step6 -sql select max(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select max(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data11 if $data11 != 1 then return -1 @@ -96,7 +104,10 @@ if $data00 != 19 then endi print =============== step8 -sql select max(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select max(tbcol) as c from $mt where ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -108,7 +119,10 @@ if $data00 != 19 then return -1 endi -sql select max(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select max(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 4 then return -1 @@ -139,7 +153,10 @@ if $rows != $tbNum then endi print =============== step11 -sql select max(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select max(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol print ===> $data11 if $data11 != 1 then return -1 diff --git a/tests/script/general/compute/min.sim b/tests/script/general/compute/min.sim index 82a22b642e3f8f912eadb2a525c4fa1d38a788b3..d6a57f4f20d01a4ab1fc95ec902785363d1f004b 100644 --- a/tests/script/general/compute/min.sim +++ b/tests/script/general/compute/min.sim @@ -32,8 +32,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -53,7 +55,10 @@ if $data00 != 0 then endi print =============== step3 -sql select min(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select min(tbcol) from $tb where ts < $ms print ===> $data00 if $data00 != 0 then return -1 @@ -80,7 +85,11 @@ if $data01 != 0 then endi print =============== step6 -sql select min(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select min(tbcol) as b from $tb where ts <= $ms interval(1m) +print select min(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data11 if $data11 != 1 then return -1 @@ -97,7 +106,9 @@ if $data00 != 0 then endi print =============== step8 -sql select min(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select min(tbcol) as c from $mt where ts < $ms print ===> $data00 if $data00 != 0 then return -1 @@ -109,7 +120,9 @@ if $data00 != 0 then return -1 endi -sql select min(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select min(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 0 then return -1 @@ -140,7 +153,9 @@ if $rows != $tbNum then endi print =============== step11 -sql select min(tbcol) as b from $mt where ts < now + 4m interval(1m) group by tgcol +$cc = 4 * 60000 +$ms = 1601481600000 + $cc +sql select min(tbcol) as b from $mt where ts <= $ms interval(1m) group by tgcol print ===> $data11 if $data11 != 1 then return -1 diff --git a/tests/script/general/compute/null.sim b/tests/script/general/compute/null.sim index cde95ca77f2ba741581a5ea82554b2b5112f662b..47f7a3c1b96152e5a30b4712831146187b98abc7 100644 --- a/tests/script/general/compute/null.sim +++ b/tests/script/general/compute/null.sim @@ -31,14 +31,16 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m + $cc = $x * 60000 + $ms = 1601481600000 + $cc - $v1 = $x - $v2 = $x - if $x == 0 then - $v1 = NULL - endi - sql insert into $tb values (now + $ms , $v1 , $v2 ) + $v1 = $x + $v2 = $x + if $x == 0 then + $v1 = NULL + endi + + sql insert into $tb values ($ms , $v1 , $v2 ) $x = $x + 1 endw diff --git a/tests/script/general/compute/percentile.sim b/tests/script/general/compute/percentile.sim index dd309c378943b69e87ea622bbdae133e7899209f..0fb88e7a40224404c2889696d6e8ba34655d18ee 100644 --- a/tests/script/general/compute/percentile.sim +++ b/tests/script/general/compute/percentile.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -68,38 +70,56 @@ sql select percentile(tbcol, 110) from $tb -x step2 step2: print =============== step3 -sql select percentile(tbcol, 1) from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select percentile(tbcol, 1) from $tb where ts > $ms print ===> $data00 if $data00 != 5.140000000 then return -1 endi -sql select percentile(tbcol, 5) from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select percentile(tbcol, 5) from $tb where ts > $ms print ===> $data00 if $data00 != 5.700000000 then return -1 endi -sql select percentile(tbcol, 0) from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select percentile(tbcol, 0) from $tb where ts > $ms print ===> $data00 if $data00 != 5.000000000 then return -1 endi print =============== step4 -sql select percentile(tbcol, 1) as c from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select percentile(tbcol, 1) as c from $tb where ts > $ms print ===> $data00 if $data00 != 5.140000000 then return -1 endi -sql select percentile(tbcol, 5) as c from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select percentile(tbcol, 5) as c from $tb where ts > $ms print ===> $data00 if $data00 != 5.700000000 then return -1 endi -sql select percentile(tbcol, 0) as c from $tb where ts > now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select percentile(tbcol, 0) as c from $tb where ts > $ms print ===> $data00 if $data00 != 5.000000000 then return -1 diff --git a/tests/script/general/compute/stddev.sim b/tests/script/general/compute/stddev.sim index 7cea8726a9ed3d3d8215c97e368df623bb0a1c30..abe4025e961460803e33c63c7243a1112a1bfab5 100644 --- a/tests/script/general/compute/stddev.sim +++ b/tests/script/general/compute/stddev.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,10 @@ if $data00 != 5.766281297 then endi print =============== step3 -sql select stddev(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select stddev(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 1.414213562 then return -1 @@ -79,7 +84,10 @@ if $data01 != 5.766281297 then endi print =============== step6 -sql select stddev(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select stddev(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data01 if $data01 != 0.000000000 then return -1 diff --git a/tests/script/general/compute/sum.sim b/tests/script/general/compute/sum.sim index d05fe8930ecb882a14bd831e27925994179c888c..9d42e766b61e4c137b7f738dcb8b27d1f5061413 100644 --- a/tests/script/general/compute/sum.sim +++ b/tests/script/general/compute/sum.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,10 @@ if $data00 != 190 then endi print =============== step3 -sql select sum(tbcol) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select sum(tbcol) from $tb where ts <= $ms print ===> $data00 if $data00 != 10 then return -1 @@ -79,7 +84,10 @@ if $data01 != 190 then endi print =============== step6 -sql select sum(tbcol) as b from $tb where ts < now + 4m interval(1m) +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select sum(tbcol) as b from $tb where ts <= $ms interval(1m) print ===> $data11 if $data11 != 1 then return -1 @@ -96,7 +104,10 @@ if $data00 != 1900 then endi print =============== step8 -sql select sum(tbcol) as c from $mt where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select sum(tbcol) as c from $mt where ts <= $ms print ===> $data00 if $data00 != 100 then return -1 @@ -108,7 +119,10 @@ if $data00 != 950 then return -1 endi -sql select sum(tbcol) as c from $mt where tgcol < 5 and ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select sum(tbcol) as c from $mt where tgcol < 5 and ts <= $ms print ===> $data00 if $data00 != 50 then return -1 @@ -139,8 +153,11 @@ if $rows != $tbNum then endi print =============== step11 -sql select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol -print select sum(tbcol) as b from $mt where ts < now + 4m interval(1d) group by tgcol +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select sum(tbcol) as b from $mt where ts <= $ms interval(1d) group by tgcol +print select sum(tbcol) as b from $mt where ts <= $ms interval(1d) group by tgcol print ===> $data01 if $data01 != 10 then return -1 diff --git a/tests/script/general/compute/top.sim b/tests/script/general/compute/top.sim index 14b3b328a07e46759a17e206f1f3bc5d733e1c16..e6bcd4a5cb0cfb928d8e322b80aa10d801fe76e5 100644 --- a/tests/script/general/compute/top.sim +++ b/tests/script/general/compute/top.sim @@ -31,8 +31,10 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $cc = $x * 60000 + $ms = 1601481600000 + $cc + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw @@ -52,7 +54,10 @@ if $data01 != 19 then endi print =============== step3 -sql select top(tbcol, 1) from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select top(tbcol, 1) from $tb where ts <= $ms print ===> $data01 if $data01 != 4 then return -1 @@ -76,7 +81,10 @@ if $data11 != 19 then endi print =============== step6 -sql select top(tbcol, 2) as b from $tb where ts < now + 4m +$cc = 4 * 60000 +$ms = 1601481600000 + $cc + +sql select top(tbcol, 2) as b from $tb where ts <= $ms print ===> $data01 $data11 if $data01 != 3 then return -1 diff --git a/tests/script/general/insert/query_block1_memory.sim b/tests/script/general/insert/query_block1_memory.sim index 83509ad5b0de17500f87591f5cb0a9c3a3c21438..bec9190f9b93044d4321b96d6604209cbc78daba 100644 --- a/tests/script/general/insert/query_block1_memory.sim +++ b/tests/script/general/insert/query_block1_memory.sim @@ -30,9 +30,11 @@ print =============== step 1 $x = $N $y = $N / 2 while $x > $y - $ms = $x . m + $z = $x * 60000 + $ms = 1601481600000 - $z + $xt = - . $x - sql insert into $tb values (now - $ms , -$x ) + sql insert into $tb values ($ms , -$x ) $x = $x - 1 endw @@ -45,8 +47,10 @@ endi $x = $N / 2 $y = $N while $x < $y - $ms = $x . m - sql insert into $tb values (now + $ms , $x ) + $z = $x * 60000 + $ms = 1601481600000 + $z + + sql insert into $tb values ($ms , $x ) $x = $x + 1 endw sql select * from $tb @@ -60,14 +64,14 @@ print =============== step 2 $N1 = $N + 1 $result1 = $N / 2 $result2 = $N -$step = $N1 . m - -$start1 = now- . $step -$start2 = now -$start3 = now+ . $step -$end1 = now- . $step -$end2 = now -$end3 = now+ . $step +$step = $N1 * 60000 + +$start1 = 1601481600000 - $step +$start2 = 1601481600000 +$start3 = 1601481600000 + $step +$end1 = 1601481600000 - $step +$end2 = 1601481600000 +$end3 = 1601481600000 + $step sql select * from $tb where ts < $start1 and ts > $end1 if $rows != 0 then diff --git a/tests/script/general/parser/col_arithmetic_operation.sim b/tests/script/general/parser/col_arithmetic_operation.sim index 132ecf43428cbb5d12abb1a991136f1cbb335a98..3208df95e446f5f06494617fa33a71a5f09ab828 100644 --- a/tests/script/general/parser/col_arithmetic_operation.sim +++ b/tests/script/general/parser/col_arithmetic_operation.sim @@ -91,4 +91,60 @@ endi sql_error select max(c2*2) from $tb sql_error select max(c1-c2) from $tb +print =====================> td-1764 +sql select sum(c1)/count(*), sum(c1) as b, count(*) as b from $stb interval(1y) +if $rows != 1 then + return -1 +endi + +if $data00 != @18-01-01 00:00:00.000@ then + return -1 +endi + +if $data01 != 2.250000000 then + return -1 +endi + +if $data02 != 225000 then + return -1 +endi + +sql select first(c1) - last(c1), first(c1) as b, last(c1) as b, min(c1) - max(c1), spread(c1) from ca_stb0 interval(1y) +if $rows != 1 then + return -1 +endi + +if $data00 != @18-01-01 00:00:00.000@ then + return -1 +endi + +if $data01 != -9.000000000 then + return -1 +endi + +if $data02 != 0 then + return -1 +endi + +if $data03 != 9 then + return -1 +endi + +if $data04 != -9.000000000 then + return -1 +endi + +if $data05 != 9.000000000 then + return -1 +endi + +sql_error select first(c1, c2) - last(c1, c2) from stb interval(1y) +sql_error select first(ts) - last(ts) from stb interval(1y) +sql_error select top(c1, 2) - last(c1) from stb; +sql_error select stddev(c1) - last(c1) from stb; +sql_error select diff(c1) - last(c1) from stb; +sql_error select first(c7) - last(c7) from stb; +sql_error select first(c8) - last(c8) from stb; +sql_error select first(c9) - last(c9) from stb; + system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/constCol.sim b/tests/script/general/parser/constCol.sim index 13b4455779933e65d53f2556eb7b4946578c074f..7ae496f1ac60ca7c4eb2b143f4d906c0c18e3726 100644 --- a/tests/script/general/parser/constCol.sim +++ b/tests/script/general/parser/constCol.sim @@ -353,4 +353,36 @@ sql_error select from t1 sql_error select abc from t1 sql_error select abc as tu from t1 +print ========================> td-1756 +sql_error select * from t1 where ts>now-1y +sql_error select * from t1 where ts>now-1n + +print ========================> td-1752 +sql select * from db.st2 where t2 < 200 and t2 is not null; +if $rows != 1 then + return -1 +endi + +if $data00 != @19-12-09 16:27:35.000@ then + return -1 +endi + +if $data01 != 2 then + return -1 +endi + +if $data02 != 1 then + return -1 +endi + +sql select * from db.st2 where t2 > 200 or t2 is null; +if $rows != 0 then + return -1 +endi + +sql select * from st2 where t2 < 200 and t2 is null; +if $rows != 0 then + return -1 +endi + system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/general/parser/tags_dynamically_specifiy.sim b/tests/script/general/parser/tags_dynamically_specifiy.sim index 0a5d5c971649abae07d149f1cc914eb096e638fa..07bf4d8dd1cae6b0b374b9b67b1dca58f218fb3f 100644 --- a/tests/script/general/parser/tags_dynamically_specifiy.sim +++ b/tests/script/general/parser/tags_dynamically_specifiy.sim @@ -96,5 +96,10 @@ if $rows != 14 then return -1 endi +print ===============================> td-1765 +sql create table m1(ts timestamp, k int) tags(a binary(4), b nchar(4)); +sql create table tm0 using m1 tags('abcd', 'abcd'); +sql_error alter table tm0 set tag b = 'abcd1'; +sql_error alter table tm0 set tag a = 'abcd1'; system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/general/parser/union.sim b/tests/script/general/parser/union.sim index 9e178537a291a3ccd4ab93b9ae03a25e7e619faa..4af482bde073000d9f2ba098b469f8ec33d7f419 100644 --- a/tests/script/general/parser/union.sim +++ b/tests/script/general/parser/union.sim @@ -251,7 +251,7 @@ if $rows != 15 then endi # first subclause are empty -sql select count(*) as c from union_tb0 where ts>now+10y union all select sum(c1) as c from union_tb1; +sql select count(*) as c from union_tb0 where ts > now + 3650d union all select sum(c1) as c from union_tb1; if $rows != 1 then return -1 endi @@ -346,7 +346,7 @@ if $data91 != 99 then return -1 endi -#1111111111111111111111111111111111111111111111111 +#================================================================================================= # two aggregated functions for normal tables sql select sum(c1) as a from union_tb0 limit 1 union all select sum(c3) as a from union_tb1 limit 2; if $rows != 2 then diff --git a/tests/script/general/parser/where.sim b/tests/script/general/parser/where.sim index e609dda652304846081c28a43ed6745be3806eb3..5cac3f47235c1321d740e373d0f5828f076c31c7 100644 --- a/tests/script/general/parser/where.sim +++ b/tests/script/general/parser/where.sim @@ -33,7 +33,8 @@ while $i < $tbNum $x = 0 while $x < $rowNum - $ms = $x . m + $y = $x * 60000 + $ms = 1600099200000 + $y $c = $x / 100 $c = $c * 100 $c = $x - $c @@ -41,7 +42,7 @@ while $i < $tbNum $binary = $binary . ' $nchar = 'nchar . $c $nchar = $nchar . ' - sql insert into $tb values (now + $ms , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) + sql insert into $tb values ($ms , $c , $c , $c , $c , $c , $c , $c , $binary , $nchar ) $x = $x + 1 endw @@ -299,7 +300,8 @@ while $i < 1 $x = 0 while $x < 10000 - $ms = $x . m + $y = $x * 60000 + $ms = 1601481600000 + $y $c = $x / 100 $c = $c * 100 $c = $x - $c @@ -307,7 +309,7 @@ while $i < 1 $binary = $binary . ' $nchar = 'nchar . $c $nchar = $nchar . ' - sql insert into $tb values (now + $ms , null , null , null , null , null , null , null , null , null ) + sql insert into $tb values ($ms , null , null , null , null , null , null , null , null , null ) $x = $x + 1 endw diff --git a/tests/script/general/stream/table_n.sim b/tests/script/general/stream/table_n.sim index d1b4a87a9ea641a8f4d58e0d9fc61bd9ac7c7477..a336772a9819ec54607265913eb65c26a2ec1a28 100644 --- a/tests/script/general/stream/table_n.sim +++ b/tests/script/general/stream/table_n.sim @@ -289,3 +289,5 @@ endi if $data09 != 20 then return -1 endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 977ef452ab4836aadba330634d9183fc9414b080..4e68d1566a76468b06115a80aace70871665c9cb 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -272,6 +272,7 @@ cd ../../../debug; make ./test.sh -f unique/db/replica_part.sim ./test.sh -f unique/dnode/alternativeRole.sim +./test.sh -f unique/dnode/simple.sim ./test.sh -f unique/dnode/balance1.sim ./test.sh -f unique/dnode/balance2.sim ./test.sh -f unique/dnode/balance3.sim diff --git a/tests/script/jenkins/basic_1.txt b/tests/script/jenkins/basic_1.txt new file mode 100644 index 0000000000000000000000000000000000000000..765e7139163952c43569e596d8ca8cf27d583cf6 --- /dev/null +++ b/tests/script/jenkins/basic_1.txt @@ -0,0 +1,205 @@ +./test.sh -f general/alter/cached_schema_after_alter.sim +./test.sh -f general/alter/count.sim +./test.sh -f general/alter/dnode.sim +./test.sh -f general/alter/import.sim +./test.sh -f general/alter/insert1.sim +./test.sh -f general/alter/insert2.sim +./test.sh -f general/alter/metrics.sim +./test.sh -f general/alter/table.sim + +./test.sh -f general/cache/new_metrics.sim +./test.sh -f general/cache/restart_metrics.sim +./test.sh -f general/cache/restart_table.sim + +./test.sh -f general/connection/connection.sim + +./test.sh -f general/column/commit.sim +./test.sh -f general/column/metrics.sim +./test.sh -f general/column/table.sim + +./test.sh -f general/compress/commitlog.sim +./test.sh -f general/compress/compress.sim +./test.sh -f general/compress/compress2.sim +./test.sh -f general/compress/uncompress.sim + +./test.sh -f general/compute/avg.sim +./test.sh -f general/compute/bottom.sim +./test.sh -f general/compute/count.sim +./test.sh -f general/compute/diff.sim +./test.sh -f general/compute/diff2.sim +./test.sh -f general/compute/first.sim +./test.sh -f general/compute/interval.sim +./test.sh -f general/compute/last.sim +./test.sh -f general/compute/leastsquare.sim +./test.sh -f general/compute/max.sim +./test.sh -f general/compute/min.sim +./test.sh -f general/compute/null.sim +./test.sh -f general/compute/percentile.sim +./test.sh -f general/compute/stddev.sim +./test.sh -f general/compute/sum.sim +./test.sh -f general/compute/top.sim + +./test.sh -f general/db/alter_option.sim +./test.sh -f general/db/alter_tables_d2.sim +./test.sh -f general/db/alter_tables_v1.sim +./test.sh -f general/db/alter_tables_v4.sim +./test.sh -f general/db/alter_vgroups.sim +./test.sh -f general/db/basic.sim +./test.sh -f general/db/basic1.sim +./test.sh -f general/db/basic2.sim +./test.sh -f general/db/basic3.sim +./test.sh -f general/db/basic4.sim +./test.sh -f general/db/basic5.sim +./test.sh -f general/db/delete_reuse1.sim +./test.sh -f general/db/delete_reuse2.sim +./test.sh -f general/db/delete_reusevnode.sim +./test.sh -f general/db/delete_reusevnode2.sim +./test.sh -f general/db/delete_writing1.sim +./test.sh -f general/db/delete_writing2.sim +./test.sh -f general/db/delete.sim +./test.sh -f general/db/len.sim +./test.sh -f general/db/repeat.sim +./test.sh -f general/db/tables.sim +./test.sh -f general/db/vnodes.sim + +./test.sh -f general/field/2.sim +./test.sh -f general/field/3.sim +./test.sh -f general/field/4.sim +./test.sh -f general/field/5.sim +./test.sh -f general/field/6.sim +./test.sh -f general/field/bigint.sim +./test.sh -f general/field/binary.sim +./test.sh -f general/field/bool.sim +./test.sh -f general/field/single.sim +./test.sh -f general/field/smallint.sim +./test.sh -f general/field/tinyint.sim + +./test.sh -f general/http/autocreate.sim +./test.sh -f general/http/chunked.sim +./test.sh -f general/http/gzip.sim +./test.sh -f general/http/restful.sim +./test.sh -f general/http/restful_insert.sim +./test.sh -f general/http/restful_limit.sim +./test.sh -f general/http/restful_full.sim +./test.sh -f general/http/prepare.sim +./test.sh -f general/http/telegraf.sim +./test.sh -f general/http/grafana_bug.sim +./test.sh -f general/http/grafana.sim + +./test.sh -f general/import/basic.sim +./test.sh -f general/import/commit.sim +./test.sh -f general/import/large.sim +./test.sh -f general/import/replica1.sim + +./test.sh -f general/insert/basic.sim +./test.sh -f general/insert/insert_drop.sim +./test.sh -f general/insert/query_block1_memory.sim +./test.sh -f general/insert/query_block2_memory.sim +./test.sh -f general/insert/query_block1_file.sim +./test.sh -f general/insert/query_block2_file.sim +./test.sh -f general/insert/query_file_memory.sim +./test.sh -f general/insert/query_multi_file.sim +./test.sh -f general/insert/tcp.sim + +./test.sh -f general/parser/alter.sim +./test.sh -f general/parser/alter1.sim +./test.sh -f general/parser/alter_stable.sim +./test.sh -f general/parser/auto_create_tb.sim +./test.sh -f general/parser/auto_create_tb_drop_tb.sim +./test.sh -f general/parser/col_arithmetic_operation.sim +./test.sh -f general/parser/columnValue.sim +./test.sh -f general/parser/commit.sim +./test.sh -f general/parser/create_db.sim +./test.sh -f general/parser/create_mt.sim +./test.sh -f general/parser/create_tb.sim +./test.sh -f general/parser/dbtbnameValidate.sim +./test.sh -f general/parser/import_commit1.sim +./test.sh -f general/parser/import_commit2.sim +./test.sh -f general/parser/import_commit3.sim +./test.sh -f general/parser/insert_tb.sim +./test.sh -f general/parser/first_last.sim +./test.sh -f general/parser/lastrow.sim +./test.sh -f general/parser/nchar.sim +./test.sh -f general/parser/null_char.sim +./test.sh -f general/parser/single_row_in_tb.sim +./test.sh -f general/parser/select_from_cache_disk.sim +./test.sh -f general/parser/mixed_blocks.sim +./test.sh -f general/parser/selectResNum.sim +./test.sh -f general/parser/limit.sim +./test.sh -f general/parser/limit1.sim +./test.sh -f general/parser/limit1_tblocks100.sim +./test.sh -f general/parser/select_across_vnodes.sim +./test.sh -f general/parser/slimit1.sim +./test.sh -f general/parser/tbnameIn.sim +./test.sh -f general/parser/projection_limit_offset.sim +./test.sh -f general/parser/limit2.sim +./test.sh -f general/parser/fill.sim +./test.sh -f general/parser/fill_stb.sim +./test.sh -f general/parser/where.sim +./test.sh -f general/parser/slimit.sim +./test.sh -f general/parser/select_with_tags.sim +./test.sh -f general/parser/interp.sim +./test.sh -f general/parser/tags_dynamically_specifiy.sim +./test.sh -f general/parser/groupby.sim +./test.sh -f general/parser/set_tag_vals.sim +./test.sh -f general/parser/tags_filter.sim +./test.sh -f general/parser/slimit_alter_tags.sim +./test.sh -f general/parser/join.sim +./test.sh -f general/parser/join_multivnode.sim +./test.sh -f general/parser/binary_escapeCharacter.sim +./test.sh -f general/parser/repeatAlter.sim +./test.sh -f general/parser/union.sim +./test.sh -f general/parser/topbot.sim + +./test.sh -f general/stable/disk.sim +./test.sh -f general/stable/dnode3.sim +./test.sh -f general/stable/metrics.sim +./test.sh -f general/stable/refcount.sim +./test.sh -f general/stable/show.sim +./test.sh -f general/stable/values.sim +./test.sh -f general/stable/vnode3.sim + +./test.sh -f general/table/autocreate.sim +./test.sh -f general/table/basic1.sim +./test.sh -f general/table/basic2.sim +./test.sh -f general/table/basic3.sim +./test.sh -f general/table/bigint.sim +./test.sh -f general/table/binary.sim +./test.sh -f general/table/bool.sim +./test.sh -f general/table/column_name.sim +./test.sh -f general/table/column_num.sim +./test.sh -f general/table/column_value.sim +./test.sh -f general/table/column2.sim +./test.sh -f general/table/date.sim +./test.sh -f general/table/db.table.sim +./test.sh -f general/table/delete_reuse1.sim +./test.sh -f general/table/delete_reuse2.sim +./test.sh -f general/table/delete_writing.sim +./test.sh -f general/table/describe.sim +./test.sh -f general/table/double.sim +./test.sh -f general/table/fill.sim +./test.sh -f general/table/float.sim +./test.sh -f general/table/int.sim +./test.sh -f general/table/limit.sim +./test.sh -f general/table/smallint.sim +./test.sh -f general/table/table_len.sim +./test.sh -f general/table/table.sim +./test.sh -f general/table/tinyint.sim +./test.sh -f general/table/vgroup.sim +./test.sh -f unique/dnode/alternativeRole.sim +./test.sh -f unique/dnode/balance1.sim +./test.sh -f unique/dnode/balance2.sim +./test.sh -f unique/dnode/balance3.sim +./test.sh -f unique/dnode/balancex.sim +./test.sh -f unique/dnode/offline1.sim +./test.sh -f unique/dnode/offline2.sim +./test.sh -f unique/dnode/reason.sim +./test.sh -f unique/dnode/remove1.sim +./test.sh -f unique/dnode/remove2.sim +./test.sh -f unique/dnode/vnode_clean.sim + +./test.sh -f unique/http/admin.sim +./test.sh -f unique/http/opentsdb.sim + +./test.sh -f unique/import/replica2.sim +./test.sh -f unique/import/replica3.sim diff --git a/tests/script/jenkins/basic_2.txt b/tests/script/jenkins/basic_2.txt new file mode 100644 index 0000000000000000000000000000000000000000..014313fafe9c7974baa7205cca41492dedee213a --- /dev/null +++ b/tests/script/jenkins/basic_2.txt @@ -0,0 +1,90 @@ +cd ../../../debug; cmake .. +cd ../../../debug; make + +./test.sh -f general/tag/3.sim +./test.sh -f general/tag/4.sim +./test.sh -f general/tag/5.sim +./test.sh -f general/tag/6.sim +./test.sh -f general/tag/add.sim +./test.sh -f general/tag/bigint.sim +./test.sh -f general/tag/binary_binary.sim +./test.sh -f general/tag/binary.sim +./test.sh -f general/tag/bool_binary.sim +./test.sh -f general/tag/bool_int.sim +./test.sh -f general/tag/bool.sim +./test.sh -f general/tag/change.sim +./test.sh -f general/tag/column.sim +./test.sh -f general/tag/commit.sim +./test.sh -f general/tag/create.sim +./test.sh -f general/tag/delete.sim +./test.sh -f general/tag/double.sim +./test.sh -f general/tag/filter.sim +./test.sh -f general/tag/float.sim +./test.sh -f general/tag/int_binary.sim +./test.sh -f general/tag/int_float.sim +./test.sh -f general/tag/int.sim +./test.sh -f general/tag/set.sim +./test.sh -f general/tag/smallint.sim +./test.sh -f general/tag/tinyint.sim + +./test.sh -f general/user/authority.sim +./test.sh -f general/user/monitor.sim +./test.sh -f general/user/pass_alter.sim +./test.sh -f general/user/pass_len.sim +./test.sh -f general/user/user_create.sim +./test.sh -f general/user/user_len.sim + +./test.sh -f general/vector/metrics_field.sim +./test.sh -f general/vector/metrics_mix.sim +./test.sh -f general/vector/metrics_query.sim +./test.sh -f general/vector/metrics_tag.sim +./test.sh -f general/vector/metrics_time.sim +./test.sh -f general/vector/multi.sim +./test.sh -f general/vector/single.sim +./test.sh -f general/vector/table_field.sim +./test.sh -f general/vector/table_mix.sim +./test.sh -f general/vector/table_query.sim +./test.sh -f general/vector/table_time.sim + +./test.sh -f unique/account/account_create.sim +./test.sh -f unique/account/account_delete.sim +./test.sh -f unique/account/account_len.sim +./test.sh -f unique/account/authority.sim +./test.sh -f unique/account/basic.sim +./test.sh -f unique/account/paras.sim +./test.sh -f unique/account/pass_alter.sim +./test.sh -f unique/account/pass_len.sim +./test.sh -f unique/account/usage.sim +./test.sh -f unique/account/user_create.sim +./test.sh -f unique/account/user_len.sim + +./test.sh -f unique/big/balance.sim +./test.sh -f unique/big/maxvnodes.sim +./test.sh -f unique/big/tcp.sim + +./test.sh -f unique/cluster/alter.sim +./test.sh -f unique/cluster/balance1.sim +./test.sh -f unique/cluster/balance2.sim +./test.sh -f unique/cluster/balance3.sim +./test.sh -f unique/cluster/cache.sim +./test.sh -f unique/cluster/vgroup100.sim + +./test.sh -f unique/column/replica3.sim + +./test.sh -f unique/db/commit.sim +./test.sh -f unique/db/delete.sim +./test.sh -f unique/db/delete_part.sim +./test.sh -f unique/db/replica_add12.sim +./test.sh -f unique/db/replica_add13.sim +./test.sh -f unique/db/replica_add23.sim +./test.sh -f unique/db/replica_reduce21.sim +./test.sh -f unique/db/replica_reduce32.sim +./test.sh -f unique/db/replica_reduce31.sim +./test.sh -f unique/db/replica_part.sim + +./test.sh -f unique/vnode/many.sim +./test.sh -f unique/vnode/replica2_basic2.sim +./test.sh -f unique/vnode/replica2_repeat.sim +./test.sh -f unique/vnode/replica3_basic.sim +./test.sh -f unique/vnode/replica3_repeat.sim +./test.sh -f unique/vnode/replica3_vgroup.sim \ No newline at end of file diff --git a/tests/script/jenkins/basic_3.txt b/tests/script/jenkins/basic_3.txt new file mode 100644 index 0000000000000000000000000000000000000000..83b10a371cbc354acc079a6307fe0dbee27e3533 --- /dev/null +++ b/tests/script/jenkins/basic_3.txt @@ -0,0 +1,81 @@ + +./test.sh -f unique/stable/balance_replica1.sim +./test.sh -f unique/stable/dnode2_stop.sim +./test.sh -f unique/stable/dnode2.sim +./test.sh -f unique/stable/dnode3.sim +./test.sh -f unique/stable/replica2_dnode4.sim +./test.sh -f unique/stable/replica2_vnode3.sim +./test.sh -f unique/stable/replica3_dnode6.sim +./test.sh -f unique/stable/replica3_vnode3.sim + +./test.sh -f unique/mnode/mgmt20.sim +./test.sh -f unique/mnode/mgmt21.sim +./test.sh -f unique/mnode/mgmt22.sim +./test.sh -f unique/mnode/mgmt23.sim +./test.sh -f unique/mnode/mgmt24.sim +#./test.sh -f unique/mnode/mgmt25.sim +#./test.sh -f unique/mnode/mgmt26.sim +./test.sh -f unique/mnode/mgmt33.sim +./test.sh -f unique/mnode/mgmt34.sim +./test.sh -f unique/mnode/mgmtr2.sim + + + +./test.sh -f general/parser/stream_on_sys.sim +./test.sh -f general/stream/metrics_del.sim +./test.sh -f general/stream/metrics_n.sim +./test.sh -f general/stream/metrics_replica1_vnoden.sim +./test.sh -f general/stream/restart_stream.sim +./test.sh -f general/stream/stream_3.sim +./test.sh -f general/stream/stream_restart.sim +./test.sh -f general/stream/table_1.sim +./test.sh -f general/stream/table_del.sim +./test.sh -f general/stream/table_n.sim +./test.sh -f general/stream/table_replica1_vnoden.sim + +./test.sh -f unique/arbitrator/check_cluster_cfg_para.sim +#./test.sh -f unique/arbitrator/dn2_mn1_cache_file_sync.sim +./test.sh -f unique/arbitrator/dn3_mn1_full_createTableFail.sim +./test.sh -f unique/arbitrator/dn3_mn1_multiCreateDropTable.sim +#./test.sh -f unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim +#./test.sh -f unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim +./test.sh -f unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim +./test.sh -f unique/arbitrator/dn3_mn1_replica_change.sim +#./test.sh -f unique/arbitrator/dn3_mn1_stopDnode_timeout.sim +# lower the priority while file corruption +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_change.sim +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim +#./test.sh -f unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim +./test.sh -f unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim +./test.sh -f unique/arbitrator/dn3_mn1_vnode_delDir.sim +./test.sh -f unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim +./test.sh -f unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim +./test.sh -f unique/arbitrator/dn3_mn1_vnode_nomaster.sim +./test.sh -f unique/arbitrator/dn3_mn2_killDnode.sim +./test.sh -f unique/arbitrator/insert_duplicationTs.sim +./test.sh -f unique/arbitrator/offline_replica2_alterTable_online.sim +./test.sh -f unique/arbitrator/offline_replica2_alterTag_online.sim +./test.sh -f unique/arbitrator/offline_replica2_createTable_online.sim +./test.sh -f unique/arbitrator/offline_replica2_dropDb_online.sim +./test.sh -f unique/arbitrator/offline_replica2_dropTable_online.sim +./test.sh -f unique/arbitrator/offline_replica3_alterTable_online.sim +./test.sh -f unique/arbitrator/offline_replica3_alterTag_online.sim +./test.sh -f unique/arbitrator/offline_replica3_createTable_online.sim +./test.sh -f unique/arbitrator/offline_replica3_dropDb_online.sim +./test.sh -f unique/arbitrator/offline_replica3_dropTable_online.sim +./test.sh -f unique/arbitrator/replica_changeWithArbitrator.sim +./test.sh -f unique/arbitrator/sync_replica2_alterTable_add.sim +./test.sh -f unique/arbitrator/sync_replica2_alterTable_drop.sim + +./test.sh -f unique/arbitrator/sync_replica2_dropDb.sim +./test.sh -f unique/arbitrator/sync_replica2_dropTable.sim +./test.sh -f unique/arbitrator/sync_replica3_alterTable_add.sim +./test.sh -f unique/arbitrator/sync_replica3_alterTable_drop.sim +./test.sh -f unique/arbitrator/sync_replica3_dropDb.sim +./test.sh -f unique/arbitrator/sync_replica3_dropTable.sim + +./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim +./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim +./test.sh -f unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim +./test.sh -f unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim diff --git a/tests/script/sh/deploy.sh b/tests/script/sh/deploy.sh index 8fccb1442f9d9af20e8153be7790ad592fbe010f..e26778e86b9876ab6e6f47f4b41207ea35cafbf5 100755 --- a/tests/script/sh/deploy.sh +++ b/tests/script/sh/deploy.sh @@ -111,24 +111,24 @@ echo "serverPort ${NODE}" >> $TAOS_CFG echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "debugFlag 0" >> $TAOS_CFG -echo "mDebugFlag 135" >> $TAOS_CFG -echo "sdbDebugFlag 135" >> $TAOS_CFG -echo "dDebugFlag 135" >> $TAOS_CFG -echo "vDebugFlag 135" >> $TAOS_CFG -echo "tsdbDebugFlag 135" >> $TAOS_CFG -echo "cDebugFlag 135" >> $TAOS_CFG -echo "jnidebugFlag 135" >> $TAOS_CFG -echo "odbcdebugFlag 135" >> $TAOS_CFG -echo "httpDebugFlag 135" >> $TAOS_CFG -echo "monitorDebugFlag 135" >> $TAOS_CFG -echo "mqttDebugFlag 135" >> $TAOS_CFG -echo "qdebugFlag 135" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "mDebugFlag 143" >> $TAOS_CFG +echo "sdbDebugFlag 143" >> $TAOS_CFG +echo "dDebugFlag 143" >> $TAOS_CFG +echo "vDebugFlag 143" >> $TAOS_CFG +echo "tsdbDebugFlag 143" >> $TAOS_CFG +echo "cDebugFlag 143" >> $TAOS_CFG +echo "jnidebugFlag 143" >> $TAOS_CFG +echo "odbcdebugFlag 143" >> $TAOS_CFG +echo "httpDebugFlag 143" >> $TAOS_CFG +echo "monitorDebugFlag 143" >> $TAOS_CFG +echo "mqttDebugFlag 143" >> $TAOS_CFG +echo "qdebugFlag 143" >> $TAOS_CFG +echo "rpcDebugFlag 143" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "udebugFlag 135" >> $TAOS_CFG -echo "sdebugFlag 135" >> $TAOS_CFG -echo "wdebugFlag 135" >> $TAOS_CFG -echo "cqdebugFlag 135" >> $TAOS_CFG +echo "udebugFlag 143" >> $TAOS_CFG +echo "sdebugFlag 143" >> $TAOS_CFG +echo "wdebugFlag 143" >> $TAOS_CFG +echo "cqdebugFlag 143" >> $TAOS_CFG echo "monitor 0" >> $TAOS_CFG echo "monitorInterval 1" >> $TAOS_CFG echo "http 0" >> $TAOS_CFG diff --git a/tests/script/test.sh b/tests/script/test.sh index 96e4ffe689e5098b36ca9993eed66fd7ba9cacef..a68ac4736dc8e7c0fa3b458c722ea58e4c9aec8e 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -109,15 +109,10 @@ echo "dataDir $DATA_DIR" >> $TAOS_CFG echo "logDir $LOG_DIR" >> $TAOS_CFG echo "scriptDir ${CODE_DIR}/../script" >> $TAOS_CFG echo "numOfLogLines 100000000" >> $TAOS_CFG -echo "dDebugFlag 135" >> $TAOS_CFG -echo "mDebugFlag 135" >> $TAOS_CFG -echo "sdbDebugFlag 135" >> $TAOS_CFG -echo "rpcDebugFlag 135" >> $TAOS_CFG +echo "rpcDebugFlag 143" >> $TAOS_CFG echo "tmrDebugFlag 131" >> $TAOS_CFG -echo "cDebugFlag 135" >> $TAOS_CFG -echo "httpDebugFlag 135" >> $TAOS_CFG -echo "monitorDebugFlag 135" >> $TAOS_CFG -echo "udebugFlag 135" >> $TAOS_CFG +echo "cDebugFlag 143" >> $TAOS_CFG +echo "udebugFlag 143" >> $TAOS_CFG echo "tablemetakeeptimer 5" >> $TAOS_CFG echo "wal 0" >> $TAOS_CFG echo "asyncLog 0" >> $TAOS_CFG diff --git a/tests/script/unique/cluster/vgroup100.sim b/tests/script/unique/cluster/vgroup100.sim index bde6dd2462db261c3f50088fec3419543bdcb07d..68a5bad6b32dc23c667900707d3e9027ac943077 100644 --- a/tests/script/unique/cluster/vgroup100.sim +++ b/tests/script/unique/cluster/vgroup100.sim @@ -27,7 +27,19 @@ system sh/exec.sh -n dnode2 -s start sql create dnode $hostname3 system sh/exec.sh -n dnode3 -s start -sleep 5000 +sleep 3000 + +$maxNum = 102 +$maxNum = 12 + +$x = 0 +show2: + $x = $x + 1 + sleep 2000 + if $x == 10 then + return -1 + endi + sql show mnodes $dnode1Role = $data2_1 $dnode2Role = $data2_2 @@ -37,9 +49,19 @@ print $dnode1Role print $dnode2Role print $dnode3Role +if $dnode1Role != master then + goto show2 +endi +if $dnode2Role != slave then + goto show2 +endi +if $dnode3Role != slave then + goto show2 +endi + print ============================== step3 $count = 2 -while $count < 102 +while $count < $maxNum $db = d . $count $tb = $db . .t $tb2 = $db . .t2 @@ -54,7 +76,7 @@ endw print ============================== step4 $count = 2 -while $count < 102 +while $count < $maxNum $db = d . $count $tb = $db . .t sql select * from $tb @@ -112,7 +134,7 @@ show8: endi $count = 2 -while $count < 102 +while $count < $maxNum $db = d . $count $tb = $db . .t sql select * from $tb diff --git a/tests/script/unique/dnode/simple.sim b/tests/script/unique/dnode/simple.sim new file mode 100644 index 0000000000000000000000000000000000000000..014e2dd04f4e221dd036830eca95c50af03bd77e --- /dev/null +++ b/tests/script/unique/dnode/simple.sim @@ -0,0 +1,147 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/deploy.sh -n dnode4 -i 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create dnode $hostname2 +system sh/exec.sh -n dnode2 -s start +sql create dnode $hostname3 +system sh/exec.sh -n dnode3 -s start +sleep 3000 + +sql create database d1 replica 2 +sql create table d1.t1 (t timestamp, i int) +sql insert into d1.t1 values(now+1s, 15) +sql insert into d1.t1 values(now+2s, 14) +sql insert into d1.t1 values(now+3s, 13) +sql insert into d1.t1 values(now+4s, 12) +sql insert into d1.t1 values(now+5s, 11) + +sql show dnodes +print dnode1 openVnodes $data2_1 +print dnode2 openVnodes $data2_2 +print dnode3 openVnodes $data2_3 +print dnode4 openVnodes $data2_4 +if $data2_1 != 0 then + return -1 +endi +if $data2_2 != 1 then + return -1 +endi +if $data2_3 != 1 then + return -1 +endi +if $data2_4 != null then + return -1 +endi + +print ========== step2 +sql create dnode $hostname4 +system sh/exec.sh -n dnode4 -s start +sleep 3000 + +sql show dnodes +print dnode1 openVnodes $data2_1 +print dnode2 openVnodes $data2_2 +print dnode3 openVnodes $data2_3 +print dnode4 openVnodes $data2_4 +if $data2_1 != 0 then + return -1 +endi +if $data2_2 != 1 then + return -1 +endi +if $data2_3 != 1 then + return -1 +endi +if $data2_4 != 0 then + return -1 +endi + +print ========== step3 +sql drop dnode $hostname2 + +$x = 0 +show3: + $x = $x + 1 + sleep 2000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 openVnodes $data2_1 +print dnode2 openVnodes $data2_2 +print dnode3 openVnodes $data2_3 +print dnode4 openVnodes $data2_4 +if $data2_1 != 0 then + goto show3 +endi +if $data2_2 != null then + goto show3 +endi +if $data2_3 != 1 then + goto show3 +endi +if $data2_4 != 1 then + goto show3 +endi + +print ========== step4 +sql drop dnode $hostname3 + +$x = 0 +show4: + $x = $x + 1 + sleep 2000 + if $x == 10 then + return -1 + endi + +sql show dnodes +print dnode1 openVnodes $data2_1 +print dnode2 openVnodes $data2_2 +print dnode3 openVnodes $data2_3 +print dnode4 openVnodes $data2_4 +if $data2_1 != 1 then + goto show4 +endi +if $data2_2 != null then + goto show4 +endi +if $data2_3 != null then + goto show4 +endi +if $data2_4 != 1 then + goto show4 +endi + +print ========== step5 +sql select * from d1.t1 order by t desc +print $data01 $data11 $data21 $data31 $data41 +if $data01 != 11 then + return -1 +endi +if $data11 != 12 then + return -1 +endi +if $data21 != 13 then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data41 != 15 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT diff --git a/tests/script/unique/mnode/mgmt21.sim b/tests/script/unique/mnode/mgmt21.sim index 53ad0eebe7cc1798647226452479db47d1476528..8409383309dbde5500b9719cd64fd74ca5e384b2 100644 --- a/tests/script/unique/mnode/mgmt21.sim +++ b/tests/script/unique/mnode/mgmt21.sim @@ -26,11 +26,11 @@ $x = 0 show2: $x = $x + 1 sleep 2000 - if $x == 10 then + if $x == 5 then return -1 endi -sql show mnodes +sql show mnodes -x show2 print dnode1 ==> $data2_1 print dnode2 ==> $data2_2 if $data2_1 != master then diff --git a/tests/test-all.sh b/tests/test-all.sh index 84b663809d03cc87010e048bbe0289f42e5d3a09..e45dd15fedc999c08037544254f13f78607ee638 100755 --- a/tests/test-all.sh +++ b/tests/test-all.sh @@ -56,6 +56,15 @@ if [ "$2" != "python" ]; then elif [ "$1" == "full" ]; then echo "### run TSIM full test ###" runSimCaseOneByOne jenkins/basic.txt + elif [ "$1" == "b1" ]; then + echo "### run TSIM b1 test ###" + runSimCaseOneByOne jenkins/basic_1.txt + elif [ "$1" == "b2" ]; then + echo "### run TSIM b2 test ###" + runSimCaseOneByOne jenkins/basic_2.txt + elif [ "$1" == "b3" ]; then + echo "### run TSIM b3 test ###" + runSimCaseOneByOne jenkins/basic_3.txt elif [ "$1" == "smoke" ] || [ -z "$1" ]; then echo "### run TSIM smoke test ###" runSimCaseOneByOne basicSuite.sim @@ -112,6 +121,11 @@ if [ "$2" != "sim" ]; then elif [ "$1" == "full" ]; then echo "### run Python full test ###" runPyCaseOneByOne fulltest.sh + elif [ "$1" == "pytest" ]; then + echo "### run Python full test ###" + runPyCaseOneByOne fulltest.sh + elif [ "$1" == "b2" ] || [ "$1" == "b3" ]; then + exit $(($totalFailed + $totalPyFailed)) elif [ "$1" == "smoke" ] || [ -z "$1" ]; then echo "### run Python smoke test ###" runPyCaseOneByOne smoketest.sh