Merge branch 'develop' into hotfix/sync_loss_data
This commit is contained in:
commit
85e7ea51ac
|
@ -66,3 +66,14 @@ CMakeError.log
|
||||||
/test/cfg
|
/test/cfg
|
||||||
/src/.vs
|
/src/.vs
|
||||||
*.o
|
*.o
|
||||||
|
src/connector/jdbc/.settings/
|
||||||
|
tests/comparisonTest/cassandra/cassandratest/.classpath
|
||||||
|
tests/comparisonTest/cassandra/cassandratest/.project
|
||||||
|
tests/comparisonTest/cassandra/cassandratest/.settings/
|
||||||
|
tests/comparisonTest/opentsdb/opentsdbtest/.classpath
|
||||||
|
tests/comparisonTest/opentsdb/opentsdbtest/.factorypath
|
||||||
|
tests/comparisonTest/opentsdb/opentsdbtest/.project
|
||||||
|
tests/comparisonTest/opentsdb/opentsdbtest/.settings/
|
||||||
|
tests/examples/JDBC/JDBCDemo/.classpath
|
||||||
|
tests/examples/JDBC/JDBCDemo/.project
|
||||||
|
tests/examples/JDBC/JDBCDemo/.settings/
|
||||||
|
|
|
@ -338,16 +338,11 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Java 对
|
||||||
maven 项目中使用如下 pom.xml 配置即可:
|
maven 项目中使用如下 pom.xml 配置即可:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<dependencies>
|
<dependency>
|
||||||
<dependency>
|
<groupId>com.taosdata.jdbc</groupId>
|
||||||
<groupId>com.taosdata.jdbc</groupId>
|
<artifactId>taos-jdbcdriver</artifactId>
|
||||||
<artifactId>taos-jdbcdriver</artifactId>
|
<version>2.0.1</version>
|
||||||
<version>2.0.0</version>
|
</dependency>
|
||||||
<type>jar</type>
|
|
||||||
<scope>system</scope>
|
|
||||||
<systemPath>{localdir}/connector/taos-jdbcdriver-2.0.0-dist.jar</systemPath>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 源码编译打包
|
### 源码编译打包
|
||||||
|
@ -1099,3 +1094,18 @@ promise2.then(function(result) {
|
||||||
[这里](https://github.com/taosdata/TDengine/tree/master/tests/examples/nodejs/node-example-raw.js)同样是一个使用NodeJS 连接器建表,插入天气数据并查询插入的数据的代码示例,但和上面不同的是,该示例只使用`cursor`.
|
[这里](https://github.com/taosdata/TDengine/tree/master/tests/examples/nodejs/node-example-raw.js)同样是一个使用NodeJS 连接器建表,插入天气数据并查询插入的数据的代码示例,但和上面不同的是,该示例只使用`cursor`.
|
||||||
|
|
||||||
|
|
||||||
|
[1]: https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver
|
||||||
|
[2]: https://mvnrepository.com/artifact/com.taosdata.jdbc/taos-jdbcdriver
|
||||||
|
[3]: https://github.com/taosdata/TDengine
|
||||||
|
[4]: https://www.taosdata.com/blog/2019/12/03/jdbcdriver%e6%89%be%e4%b8%8d%e5%88%b0%e5%8a%a8%e6%80%81%e9%93%be%e6%8e%a5%e5%ba%93/
|
||||||
|
[5]: https://github.com/brettwooldridge/HikariCP
|
||||||
|
[6]: https://github.com/alibaba/druid
|
||||||
|
[7]: https://github.com/taosdata/TDengine/issues
|
||||||
|
[8]: https://search.maven.org/artifact/com.taosdata.jdbc/taos-jdbcdriver
|
||||||
|
[9]: https://mvnrepository.com/artifact/com.taosdata.jdbc/taos-jdbcdriver
|
||||||
|
[10]: https://maven.aliyun.com/mvn/search
|
||||||
|
[11]: https://github.com/taosdata/TDengine/tree/develop/tests/examples/JDBC/SpringJdbcTemplate
|
||||||
|
[12]: https://github.com/taosdata/TDengine/tree/develop/tests/examples/JDBC/springbootdemo
|
||||||
|
[13]: https://www.taosdata.com/cn/documentation20/administrator/#%E5%AE%A2%E6%88%B7%E7%AB%AF%E9%85%8D%E7%BD%AE
|
||||||
|
[14]: https://www.taosdata.com/cn/documentation20/connector/#Windows
|
||||||
|
[15]: https://www.taosdata.com/cn/getting-started/#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B
|
|
@ -47,7 +47,6 @@ cp ${compile_dir}/../packaging/cfg/taos.cfg ${pkg_dir}${install_home_pat
|
||||||
cp ${compile_dir}/../packaging/deb/taosd ${pkg_dir}${install_home_path}/init.d
|
cp ${compile_dir}/../packaging/deb/taosd ${pkg_dir}${install_home_path}/init.d
|
||||||
cp ${compile_dir}/../packaging/tools/post.sh ${pkg_dir}${install_home_path}/script
|
cp ${compile_dir}/../packaging/tools/post.sh ${pkg_dir}${install_home_path}/script
|
||||||
cp ${compile_dir}/../packaging/tools/preun.sh ${pkg_dir}${install_home_path}/script
|
cp ${compile_dir}/../packaging/tools/preun.sh ${pkg_dir}${install_home_path}/script
|
||||||
cp ${compile_dir}/build/bin/taosdump ${pkg_dir}${install_home_path}/bin
|
|
||||||
cp ${compile_dir}/build/bin/taosdemo ${pkg_dir}${install_home_path}/bin
|
cp ${compile_dir}/build/bin/taosdemo ${pkg_dir}${install_home_path}/bin
|
||||||
cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin
|
cp ${compile_dir}/build/bin/taosd ${pkg_dir}${install_home_path}/bin
|
||||||
cp ${compile_dir}/build/bin/taos ${pkg_dir}${install_home_path}/bin
|
cp ${compile_dir}/build/bin/taos ${pkg_dir}${install_home_path}/bin
|
||||||
|
|
|
@ -58,7 +58,6 @@ cp %{_compiledir}/../packaging/tools/preun.sh %{buildroot}%{homepath}/scri
|
||||||
cp %{_compiledir}/build/bin/taos %{buildroot}%{homepath}/bin
|
cp %{_compiledir}/build/bin/taos %{buildroot}%{homepath}/bin
|
||||||
cp %{_compiledir}/build/bin/taosd %{buildroot}%{homepath}/bin
|
cp %{_compiledir}/build/bin/taosd %{buildroot}%{homepath}/bin
|
||||||
cp %{_compiledir}/build/bin/taosdemo %{buildroot}%{homepath}/bin
|
cp %{_compiledir}/build/bin/taosdemo %{buildroot}%{homepath}/bin
|
||||||
cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin
|
|
||||||
cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver
|
cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver
|
||||||
cp %{_compiledir}/../src/inc/taos.h %{buildroot}%{homepath}/include
|
cp %{_compiledir}/../src/inc/taos.h %{buildroot}%{homepath}/include
|
||||||
cp %{_compiledir}/../src/inc/taoserror.h %{buildroot}%{homepath}/include
|
cp %{_compiledir}/../src/inc/taoserror.h %{buildroot}%{homepath}/include
|
||||||
|
@ -134,7 +133,6 @@ if [ $1 -eq 0 ];then
|
||||||
${csudo} rm -f ${bin_link_dir}/taos || :
|
${csudo} rm -f ${bin_link_dir}/taos || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosd || :
|
${csudo} rm -f ${bin_link_dir}/taosd || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosdemo || :
|
${csudo} rm -f ${bin_link_dir}/taosdemo || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosdump || :
|
|
||||||
${csudo} rm -f ${cfg_link_dir}/* || :
|
${csudo} rm -f ${cfg_link_dir}/* || :
|
||||||
${csudo} rm -f ${inc_link_dir}/taos.h || :
|
${csudo} rm -f ${inc_link_dir}/taos.h || :
|
||||||
${csudo} rm -f ${inc_link_dir}/taoserror.h || :
|
${csudo} rm -f ${inc_link_dir}/taoserror.h || :
|
||||||
|
|
|
@ -22,6 +22,7 @@ cfg_install_dir="/etc/taos"
|
||||||
|
|
||||||
bin_link_dir="/usr/bin"
|
bin_link_dir="/usr/bin"
|
||||||
lib_link_dir="/usr/lib"
|
lib_link_dir="/usr/lib"
|
||||||
|
lib64_link_dir="/usr/lib64"
|
||||||
inc_link_dir="/usr/include"
|
inc_link_dir="/usr/include"
|
||||||
|
|
||||||
#install main path
|
#install main path
|
||||||
|
@ -165,7 +166,6 @@ function install_bin() {
|
||||||
${csudo} rm -f ${bin_link_dir}/taos || :
|
${csudo} rm -f ${bin_link_dir}/taos || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosd || :
|
${csudo} rm -f ${bin_link_dir}/taosd || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosdemo || :
|
${csudo} rm -f ${bin_link_dir}/taosdemo || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosdump || :
|
|
||||||
${csudo} rm -f ${bin_link_dir}/rmtaos || :
|
${csudo} rm -f ${bin_link_dir}/rmtaos || :
|
||||||
${csudo} rm -f ${bin_link_dir}/tarbitrator || :
|
${csudo} rm -f ${bin_link_dir}/tarbitrator || :
|
||||||
|
|
||||||
|
@ -174,7 +174,6 @@ function install_bin() {
|
||||||
#Make link
|
#Make link
|
||||||
[ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
|
[ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || :
|
||||||
[ -x ${install_main_dir}/bin/taosd ] && ${csudo} ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || :
|
[ -x ${install_main_dir}/bin/taosd ] && ${csudo} ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || :
|
||||||
[ -x ${install_main_dir}/bin/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
|
|
||||||
[ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
|
[ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || :
|
||||||
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || :
|
[ -x ${install_main_dir}/bin/remove.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || :
|
||||||
[ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
|
[ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo} ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || :
|
||||||
|
@ -189,6 +188,7 @@ function install_bin() {
|
||||||
function install_lib() {
|
function install_lib() {
|
||||||
# Remove links
|
# Remove links
|
||||||
${csudo} rm -f ${lib_link_dir}/libtaos.* || :
|
${csudo} rm -f ${lib_link_dir}/libtaos.* || :
|
||||||
|
${csudo} rm -f ${lib64_link_dir}/libtaos.* || :
|
||||||
#${csudo} rm -rf ${v15_java_app_dir} || :
|
#${csudo} rm -rf ${v15_java_app_dir} || :
|
||||||
|
|
||||||
${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
|
${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
|
||||||
|
@ -196,6 +196,9 @@ function install_lib() {
|
||||||
${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
|
${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib_link_dir}/libtaos.so.1
|
||||||
${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
||||||
|
|
||||||
|
${csudo} ln -s ${install_main_dir}/driver/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
|
||||||
|
${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
|
||||||
|
|
||||||
#if [ "$verMode" == "cluster" ]; then
|
#if [ "$verMode" == "cluster" ]; then
|
||||||
# # Compatible with version 1.5
|
# # Compatible with version 1.5
|
||||||
# ${csudo} mkdir -p ${v15_java_app_dir}
|
# ${csudo} mkdir -p ${v15_java_app_dir}
|
||||||
|
|
|
@ -36,7 +36,7 @@ if [ "$pagMode" == "lite" ]; then
|
||||||
strip ${build_dir}/bin/taos
|
strip ${build_dir}/bin/taos
|
||||||
bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${script_dir}/remove.sh"
|
bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${script_dir}/remove.sh"
|
||||||
else
|
else
|
||||||
bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${build_dir}/bin/taosdump ${build_dir}/bin/tarbitrator ${script_dir}/remove.sh"
|
bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${build_dir}/bin/tarbitrator ${script_dir}/remove.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lib_files="${build_dir}/lib/libtaos.so.${version}"
|
lib_files="${build_dir}/lib/libtaos.so.${version}"
|
||||||
|
|
|
@ -21,6 +21,7 @@ inc_dir="/usr/local/taos/include"
|
||||||
cfg_install_dir="/etc/taos"
|
cfg_install_dir="/etc/taos"
|
||||||
bin_link_dir="/usr/bin"
|
bin_link_dir="/usr/bin"
|
||||||
lib_link_dir="/usr/lib"
|
lib_link_dir="/usr/lib"
|
||||||
|
lib64_link_dir="/usr/lib64"
|
||||||
inc_link_dir="/usr/include"
|
inc_link_dir="/usr/include"
|
||||||
|
|
||||||
service_config_dir="/etc/systemd/system"
|
service_config_dir="/etc/systemd/system"
|
||||||
|
@ -74,16 +75,19 @@ function install_include() {
|
||||||
|
|
||||||
function install_lib() {
|
function install_lib() {
|
||||||
${csudo} rm -f ${lib_link_dir}/libtaos* || :
|
${csudo} rm -f ${lib_link_dir}/libtaos* || :
|
||||||
|
${csudo} rm -f ${lib64_link_dir}/libtaos* || :
|
||||||
|
|
||||||
${csudo} ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1
|
${csudo} ln -s ${lib_dir}/libtaos.* ${lib_link_dir}/libtaos.so.1
|
||||||
${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so
|
||||||
|
|
||||||
|
${csudo} ln -s ${lib_dir}/libtaos.* ${lib64_link_dir}/libtaos.so.1 || :
|
||||||
|
${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || :
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_bin() {
|
function install_bin() {
|
||||||
# Remove links
|
# Remove links
|
||||||
${csudo} rm -f ${bin_link_dir}/taos || :
|
${csudo} rm -f ${bin_link_dir}/taos || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosd || :
|
${csudo} rm -f ${bin_link_dir}/taosd || :
|
||||||
${csudo} rm -f ${bin_link_dir}/taosdump || :
|
|
||||||
${csudo} rm -f ${bin_link_dir}/taosdemo || :
|
${csudo} rm -f ${bin_link_dir}/taosdemo || :
|
||||||
${csudo} rm -f ${bin_link_dir}/rmtaos || :
|
${csudo} rm -f ${bin_link_dir}/rmtaos || :
|
||||||
|
|
||||||
|
@ -92,7 +96,6 @@ function install_bin() {
|
||||||
#Make link
|
#Make link
|
||||||
[ -x ${bin_dir}/taos ] && ${csudo} ln -s ${bin_dir}/taos ${bin_link_dir}/taos || :
|
[ -x ${bin_dir}/taos ] && ${csudo} ln -s ${bin_dir}/taos ${bin_link_dir}/taos || :
|
||||||
[ -x ${bin_dir}/taosd ] && ${csudo} ln -s ${bin_dir}/taosd ${bin_link_dir}/taosd || :
|
[ -x ${bin_dir}/taosd ] && ${csudo} ln -s ${bin_dir}/taosd ${bin_link_dir}/taosd || :
|
||||||
[ -x ${bin_dir}/taosdump ] && ${csudo} ln -s ${bin_dir}/taosdump ${bin_link_dir}/taosdump || :
|
|
||||||
[ -x ${bin_dir}/taosdemo ] && ${csudo} ln -s ${bin_dir}/taosdemo ${bin_link_dir}/taosdemo || :
|
[ -x ${bin_dir}/taosdemo ] && ${csudo} ln -s ${bin_dir}/taosdemo ${bin_link_dir}/taosdemo || :
|
||||||
# [ -x ${bin_dir}/remove.sh ] && ${csudo} ln -s ${bin_dir}/remove.sh ${bin_link_dir}/rmtaos || :
|
# [ -x ${bin_dir}/remove.sh ] && ${csudo} ln -s ${bin_dir}/remove.sh ${bin_link_dir}/rmtaos || :
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ typedef struct SParamInfo {
|
||||||
int32_t idx;
|
int32_t idx;
|
||||||
char type;
|
char type;
|
||||||
uint8_t timePrec;
|
uint8_t timePrec;
|
||||||
short bytes;
|
int16_t bytes;
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
} SParamInfo;
|
} SParamInfo;
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TSDB_DATA_TYPE_BINARY:
|
case TSDB_DATA_TYPE_BINARY:
|
||||||
if ((*bind->length) > param->bytes) {
|
if ((*bind->length) > (uintptr_t)param->bytes) {
|
||||||
return TSDB_CODE_TSC_INVALID_VALUE;
|
return TSDB_CODE_TSC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
size = (short)*bind->length;
|
size = (short)*bind->length;
|
||||||
|
|
|
@ -1999,8 +1999,7 @@ int tscProcessUseDbRsp(SSqlObj *pSql) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tscProcessDropDbRsp(SSqlObj *pSql) {
|
int tscProcessDropDbRsp(SSqlObj *UNUSED_PARAM(pSql)) {
|
||||||
pSql->pTscObj->db[0] = 0;
|
|
||||||
taosCacheEmpty(tscCacheHandle);
|
taosCacheEmpty(tscCacheHandle);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ char tsMqttBrokerAddress[128] = {0};
|
||||||
char tsMqttBrokerClientId[128] = {0};
|
char tsMqttBrokerClientId[128] = {0};
|
||||||
|
|
||||||
// monitor
|
// monitor
|
||||||
int32_t tsEnableMonitorModule = 0;
|
int32_t tsEnableMonitorModule = 1;
|
||||||
char tsMonitorDbName[TSDB_DB_NAME_LEN] = "log";
|
char tsMonitorDbName[TSDB_DB_NAME_LEN] = "log";
|
||||||
char tsInternalPass[] = "secretkey";
|
char tsInternalPass[] = "secretkey";
|
||||||
int32_t tsMonitorInterval = 30; // seconds
|
int32_t tsMonitorInterval = 30; // seconds
|
||||||
|
|
|
@ -0,0 +1,218 @@
|
||||||
|
<!-- This xml is used for deploy taos-jdbcdriver to maven reprository, change name to pom.xml if you need to deploy new driver to maven reprository -->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.taosdata.jdbc</groupId>
|
||||||
|
<artifactId>taos-jdbcdriver</artifactId>
|
||||||
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
|
||||||
|
<name>JDBCDriver</name>
|
||||||
|
<url>https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc</url>
|
||||||
|
<description>TDengine JDBC Driver</description>
|
||||||
|
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>GNU AFFERO GENERAL PUBLIC LICENSE Version 3</name>
|
||||||
|
<url>https://github.com/taosdata/TDengine/blob/master/LICENSE</url>
|
||||||
|
<distribution>repo</distribution>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:git://github.com/taosdata/TDengine.git</connection>
|
||||||
|
<developerConnection>scm:git:git@github.com:taosdata/TDengine.git</developerConnection>
|
||||||
|
<url>https://github.com/taosdata/TDengine/tree/master/src/connector/jdbc</url>
|
||||||
|
<tag>HEAD</tag>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>taosdata</name>
|
||||||
|
<email>support@taosdata.com</email>
|
||||||
|
<organization>https://www.taosdata.com/</organization>
|
||||||
|
<organizationUrl>https://www.taosdata.com/</organizationUrl>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-logging</groupId>
|
||||||
|
<artifactId>commons-logging</artifactId>
|
||||||
|
<version>1.2</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>*</groupId>
|
||||||
|
<artifactId>*</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
<version>3.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>src/main/assembly/assembly-jar.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
<configuration>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<source>11</source>
|
||||||
|
<target>11</target>
|
||||||
|
<debug>true</debug>
|
||||||
|
<showDeprecation>true</showDeprecation>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
<docencoding>UTF-8</docencoding>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<doclint>none</doclint>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>1.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<version>2.8.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>default-deploy</id>
|
||||||
|
<phase>deploy</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>deploy</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.22.2</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
|
<version>1.6.7</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<serverId>ossrh-td</serverId>
|
||||||
|
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
||||||
|
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
|
<version>2.5.3</version>
|
||||||
|
<configuration>
|
||||||
|
<localCheckout>true</localCheckout>
|
||||||
|
<pushChanges>false</pushChanges>
|
||||||
|
<mavenExecutorId>forked-path</mavenExecutorId>
|
||||||
|
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
|
||||||
|
</configuration>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
|
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||||
|
<version>1.11.2</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>ossrh-td</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
<repository>
|
||||||
|
<id>ossrh-td</id>
|
||||||
|
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
</project>
|
|
@ -97,7 +97,7 @@ public class TSDBJNIConnector {
|
||||||
|
|
||||||
this.taos = this.connectImp(host, port, dbName, user, password);
|
this.taos = this.connectImp(host, port, dbName, user, password);
|
||||||
if (this.taos == TSDBConstants.JNI_NULL_POINTER) {
|
if (this.taos == TSDBConstants.JNI_NULL_POINTER) {
|
||||||
throw new SQLException(TSDBConstants.WrapErrMsg(this.getErrMsg(null)), "", this.getErrCode(null));
|
throw new SQLException(TSDBConstants.WrapErrMsg(this.getErrMsg(0L)), "", this.getErrCode(0l));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -115,7 +115,7 @@ public class TSDBJNIConnector {
|
||||||
freeResultSet(taosResultSetPointer);
|
freeResultSet(taosResultSetPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
long pSql = 0l;
|
Long pSql = 0l;
|
||||||
try {
|
try {
|
||||||
pSql = this.executeQueryImp(sql.getBytes(TaosGlobalConfig.getCharset()), this.taos);
|
pSql = this.executeQueryImp(sql.getBytes(TaosGlobalConfig.getCharset()), this.taos);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -124,16 +124,11 @@ public class TSDBJNIConnector {
|
||||||
throw new SQLException(TSDBConstants.WrapErrMsg("Unsupported encoding"));
|
throw new SQLException(TSDBConstants.WrapErrMsg("Unsupported encoding"));
|
||||||
}
|
}
|
||||||
int code = this.getErrCode(pSql);
|
int code = this.getErrCode(pSql);
|
||||||
|
if (code != 0) {
|
||||||
if (code < 0) {
|
|
||||||
affectedRows = -1;
|
affectedRows = -1;
|
||||||
if (code == TSDBConstants.JNI_TDENGINE_ERROR) {
|
String err_msg = this.getErrMsg(pSql);
|
||||||
this.freeResultSet(pSql);
|
this.freeResultSet(pSql);
|
||||||
throw new SQLException(TSDBConstants.WrapErrMsg(this.getErrMsg(pSql)), "", this.getErrCode(pSql));
|
throw new SQLException(TSDBConstants.WrapErrMsg(err_msg), "", code);
|
||||||
} else {
|
|
||||||
this.freeResultSet(pSql);
|
|
||||||
throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode(pSql));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try retrieving result set for the executed SQL using the current connection pointer. If the executed
|
// Try retrieving result set for the executed SQL using the current connection pointer. If the executed
|
||||||
|
@ -151,20 +146,20 @@ public class TSDBJNIConnector {
|
||||||
/**
|
/**
|
||||||
* Get recent error code by connection
|
* Get recent error code by connection
|
||||||
*/
|
*/
|
||||||
public int getErrCode(Long pSql) {
|
public int getErrCode(long pSql) {
|
||||||
return Math.abs(this.getErrCodeImp(this.taos, pSql));
|
return this.getErrCodeImp(this.taos, pSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native int getErrCodeImp(long connection, Long pSql);
|
private native int getErrCodeImp(long connection, long pSql);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get recent error message by connection
|
* Get recent error message by connection
|
||||||
*/
|
*/
|
||||||
public String getErrMsg(Long pSql) {
|
public String getErrMsg(long pSql) {
|
||||||
return this.getErrMsgImp(this.taos, pSql);
|
return this.getErrMsgImp(pSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native String getErrMsgImp(long connection, Long pSql);
|
private native String getErrMsgImp(long pSql);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get resultset pointer
|
* Get resultset pointer
|
||||||
|
@ -248,7 +243,7 @@ public class TSDBJNIConnector {
|
||||||
public void closeConnection() throws SQLException {
|
public void closeConnection() throws SQLException {
|
||||||
int code = this.closeConnectionImp(this.taos);
|
int code = this.closeConnectionImp(this.taos);
|
||||||
if (code < 0) {
|
if (code < 0) {
|
||||||
throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode(null));
|
throw new SQLException(TSDBConstants.FixErrMsg(code), "", this.getErrCode(0l));
|
||||||
} else if (code == 0) {
|
} else if (code == 0) {
|
||||||
this.taos = TSDBConstants.JNI_NULL_POINTER;
|
this.taos = TSDBConstants.JNI_NULL_POINTER;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -42,7 +42,8 @@ public class AsyncSubscribeTest extends BaseTest {
|
||||||
long ts = System.currentTimeMillis();
|
long ts = System.currentTimeMillis();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
ts += i;
|
ts += i;
|
||||||
statement.executeUpdate("insert into \" + dbName + \".\" + tName + \" values (" + ts + ", " + (100 + i) + ", " + i + ")");
|
String sql = "insert into " + dbName + "." + tName + " values (" + ts + ", " + (100 + i) + ", " + i + ")";
|
||||||
|
statement.executeUpdate(sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class ResultSetTest extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
statement.executeQuery("select * from " + dbName + "." + tName);
|
statement.executeQuery("select * from " + dbName + "." + tName + " where ts = " + ts);
|
||||||
resSet = statement.getResultSet();
|
resSet = statement.getResultSet();
|
||||||
System.out.println(((TSDBResultSet) resSet).getRowData());
|
System.out.println(((TSDBResultSet) resSet).getRowData());
|
||||||
while (resSet.next()) {
|
while (resSet.next()) {
|
||||||
|
@ -806,9 +806,9 @@ public class ResultSetTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatch() throws SQLException {
|
public void testBatch() throws SQLException {
|
||||||
String[] sqls = new String[]{"insert into test.t0 values (1496732686001,2147483600,1496732687000,3.1415925,3.1415926\n" +
|
String[] sqls = new String[]{"insert into test.t0 values (1496732686001,2147483600,1496732687000,3.1415925,3.1415926535897," +
|
||||||
"535897,\"涛思数据,强~!\",12,12,\"TDengine is powerful\")", "insert into test.t0 values (1496732686002,2147483600,1496732687000,3.1415925,3.1415926\n" +
|
"'涛思数据,强~',12,0,'TDengine is powerful')", "insert into test.t0 values (1496732686002,2147483600,1496732687000,3.1415925,3.1415926535897," +
|
||||||
"535897,\"涛思数据,强~!\",12,12,\"TDengine is powerful\")"};
|
"'涛思数据,强~',12,1,'TDengine is powerful')"};
|
||||||
for (String sql : sqls) {
|
for (String sql : sqls) {
|
||||||
statement.addBatch(sql);
|
statement.addBatch(sql);
|
||||||
}
|
}
|
||||||
|
@ -816,7 +816,6 @@ public class ResultSetTest extends BaseTest {
|
||||||
assertEquals(res.length, 2);
|
assertEquals(res.length, 2);
|
||||||
statement.clearBatch();
|
statement.clearBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void close() throws Exception {
|
public static void close() throws Exception {
|
||||||
statement.executeUpdate("drop database " + dbName);
|
statement.executeUpdate("drop database " + dbName);
|
||||||
|
|
|
@ -41,7 +41,8 @@ public class SubscribeTest extends BaseTest {
|
||||||
long ts = System.currentTimeMillis();
|
long ts = System.currentTimeMillis();
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
ts += i;
|
ts += i;
|
||||||
statement.executeUpdate("insert into \" + dbName + \".\" + tName + \" values (" + ts + ", " + (100 + i) + ", " + i + ")");
|
String sql = "insert into " + dbName + "." + tName + " values (" + ts + ", " + (100 + i) + ", " + i + ")";
|
||||||
|
statement.executeUpdate(sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,16 @@
|
||||||
#include "tsocket.h"
|
#include "tsocket.h"
|
||||||
#include "tbuffer.h"
|
#include "tbuffer.h"
|
||||||
#include "mnode.h"
|
#include "mnode.h"
|
||||||
|
#include "mnodeDef.h"
|
||||||
|
#include "mnodeDb.h"
|
||||||
|
#include "mnodeDnode.h"
|
||||||
#include "mnodeCluster.h"
|
#include "mnodeCluster.h"
|
||||||
|
#include "mnodeDnode.h"
|
||||||
|
#include "mnodeVgroup.h"
|
||||||
|
#include "mnodeMnode.h"
|
||||||
|
#include "mnodeTable.h"
|
||||||
#include "mnodeSdb.h"
|
#include "mnodeSdb.h"
|
||||||
|
#include "mnodeAcct.h"
|
||||||
#include "dnode.h"
|
#include "dnode.h"
|
||||||
#include "dnodeInt.h"
|
#include "dnodeInt.h"
|
||||||
#include "dnodeTelemetry.h"
|
#include "dnodeTelemetry.h"
|
||||||
|
@ -170,18 +178,23 @@ static void addVersionInfo(SBufferWriter* bw) {
|
||||||
addStringField(bw, "version", version);
|
addStringField(bw, "version", version);
|
||||||
addStringField(bw, "buildInfo", buildinfo);
|
addStringField(bw, "buildInfo", buildinfo);
|
||||||
addStringField(bw, "gitInfo", gitinfo);
|
addStringField(bw, "gitInfo", gitinfo);
|
||||||
//addStringField(&bw, "installAt", "2020-08-01T00:00:00Z");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void addRuntimeInfo(SBufferWriter* bw) {
|
static void addRuntimeInfo(SBufferWriter* bw) {
|
||||||
// addIntField(&bw, "numOfDnode", 1);
|
addIntField(bw, "numOfDnode", mnodeGetDnodesNum());
|
||||||
// addIntField(&bw, "numOfVnode", 1);
|
addIntField(bw, "numOfMnode", mnodeGetMnodesNum());
|
||||||
// addIntField(&bw, "numOfStable", 1);
|
addIntField(bw, "numOfVgroup", mnodeGetVgroupNum());
|
||||||
// addIntField(&bw, "numOfTable", 1);
|
addIntField(bw, "numOfDatabase", mnodeGetDbNum());
|
||||||
// addIntField(&bw, "numOfRows", 1);
|
addIntField(bw, "numOfSuperTable", mnodeGetSuperTableNum());
|
||||||
// addStringField(&bw, "startAt", "2020-08-01T00:00:00Z");
|
addIntField(bw, "numOfChildTable", mnodeGetChildTableNum());
|
||||||
// addStringField(&bw, "memoryUsage", "10240 kB");
|
|
||||||
// addStringField(&bw, "diskUsage", "10240 MB");
|
SAcctInfo info;
|
||||||
|
mnodeGetStatOfAllAcct(&info);
|
||||||
|
addIntField(bw, "numOfColumn", info.numOfTimeSeries);
|
||||||
|
addIntField(bw, "numOfPoint", info.totalPoints);
|
||||||
|
addIntField(bw, "totalStorage", info.totalStorage);
|
||||||
|
addIntField(bw, "compStorage", info.compStorage);
|
||||||
|
// addStringField(bw, "installTime", "2020-08-01T00:00:00Z");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendTelemetryReport() {
|
static void sendTelemetryReport() {
|
||||||
|
@ -230,18 +243,13 @@ static void sendTelemetryReport() {
|
||||||
static void* telemetryThread(void* param) {
|
static void* telemetryThread(void* param) {
|
||||||
struct timespec end = {0};
|
struct timespec end = {0};
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
end.tv_sec += 300; // wait 5 minutes to send first report
|
end.tv_sec += 300; // wait 5 minutes before send first report
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
while (1) {
|
if (sem_timedwait(&tsExitSem, &end) == 0) {
|
||||||
if (sem_timedwait(&tsExitSem, &end) == 0) {
|
break;
|
||||||
return NULL;
|
} else if (errno != ETIMEDOUT) {
|
||||||
}
|
continue;
|
||||||
struct timespec now = {0};
|
|
||||||
clock_gettime(CLOCK_REALTIME, &now);
|
|
||||||
if (now.tv_sec > end.tv_sec || (now.tv_sec == end.tv_sec && now.tv_nsec >= end.tv_nsec)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdbIsMaster()) {
|
if (sdbIsMaster()) {
|
||||||
|
|
|
@ -72,8 +72,8 @@ DLL_EXPORT void taos_close(TAOS *taos);
|
||||||
typedef struct TAOS_BIND {
|
typedef struct TAOS_BIND {
|
||||||
int buffer_type;
|
int buffer_type;
|
||||||
void * buffer;
|
void * buffer;
|
||||||
unsigned long buffer_length; // unused
|
uintptr_t buffer_length; // unused
|
||||||
unsigned long *length;
|
uintptr_t *length;
|
||||||
int * is_null;
|
int * is_null;
|
||||||
int is_unsigned; // unused
|
int is_unsigned; // unused
|
||||||
int * error; // unused
|
int * error; // unused
|
||||||
|
|
|
@ -4,4 +4,6 @@ PROJECT(TDengine)
|
||||||
ADD_SUBDIRECTORY(shell)
|
ADD_SUBDIRECTORY(shell)
|
||||||
ADD_SUBDIRECTORY(taosdemo)
|
ADD_SUBDIRECTORY(taosdemo)
|
||||||
ADD_SUBDIRECTORY(taosdump)
|
ADD_SUBDIRECTORY(taosdump)
|
||||||
ADD_SUBDIRECTORY(taosmigrate)
|
ADD_SUBDIRECTORY(taosmigrate)
|
||||||
|
#ADD_SUBDIRECTORY(taosClusterTest)
|
||||||
|
ADD_SUBDIRECTORY(taosnetwork)
|
||||||
|
|
|
@ -43,9 +43,10 @@ extern char configDir[];
|
||||||
#define MAX_DB_NAME_SIZE 64
|
#define MAX_DB_NAME_SIZE 64
|
||||||
#define MAX_TB_NAME_SIZE 64
|
#define MAX_TB_NAME_SIZE 64
|
||||||
#define MAX_DATA_SIZE 1024
|
#define MAX_DATA_SIZE 1024
|
||||||
#define MAX_NUM_DATATYPE 8
|
#define MAX_NUM_DATATYPE 30
|
||||||
#define OPT_ABORT 1 /* –abort */
|
#define OPT_ABORT 1 /* –abort */
|
||||||
#define STRING_LEN 512
|
#define STRING_LEN 512
|
||||||
|
#define MAX_PREPARED_RAND 1000000
|
||||||
|
|
||||||
/* The options we understand. */
|
/* The options we understand. */
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
|
@ -175,6 +176,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
}
|
}
|
||||||
sptr[index++] = token;
|
sptr[index++] = token;
|
||||||
token = strsep(&running, ", ");
|
token = strsep(&running, ", ");
|
||||||
|
if (index >= MAX_NUM_DATATYPE) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -311,6 +313,8 @@ int generateData(char *res, char **data_type, int num_of_cols, int64_t timestamp
|
||||||
|
|
||||||
void rand_string(char *str, int size);
|
void rand_string(char *str, int size);
|
||||||
|
|
||||||
|
void init_rand_data();
|
||||||
|
|
||||||
double getCurrentTime();
|
double getCurrentTime();
|
||||||
|
|
||||||
void callBack(void *param, TAOS_RES *res, int code);
|
void callBack(void *param, TAOS_RES *res, int code);
|
||||||
|
@ -361,7 +365,7 @@ int main(int argc, char *argv[]) {
|
||||||
arguments.num_of_DPT = 100000;
|
arguments.num_of_DPT = 100000;
|
||||||
arguments.num_of_RPR = 1000;
|
arguments.num_of_RPR = 1000;
|
||||||
arguments.use_metric = true;
|
arguments.use_metric = true;
|
||||||
arguments.insert_only = false;
|
arguments.insert_only = true;
|
||||||
// end change
|
// end change
|
||||||
|
|
||||||
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
||||||
|
@ -403,6 +407,7 @@ int main(int argc, char *argv[]) {
|
||||||
taos_close(qtaos);
|
taos_close(qtaos);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
init_rand_data();
|
||||||
|
|
||||||
memset(dataString, 0, STRING_LEN);
|
memset(dataString, 0, STRING_LEN);
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -411,7 +416,7 @@ int main(int argc, char *argv[]) {
|
||||||
do_aggreFunc = false;
|
do_aggreFunc = false;
|
||||||
}
|
}
|
||||||
for (; count_data_type <= MAX_NUM_DATATYPE; count_data_type++) {
|
for (; count_data_type <= MAX_NUM_DATATYPE; count_data_type++) {
|
||||||
if (strcasecmp(data_type[count_data_type], "") == 0) {
|
if (data_type[count_data_type] == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1169,6 +1174,66 @@ double getCurrentTime() {
|
||||||
return tv.tv_sec + tv.tv_usec / 1E6;
|
return tv.tv_sec + tv.tv_usec / 1E6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t randint[MAX_PREPARED_RAND];
|
||||||
|
int64_t randbigint[MAX_PREPARED_RAND];
|
||||||
|
float randfloat[MAX_PREPARED_RAND];
|
||||||
|
double randdouble[MAX_PREPARED_RAND];
|
||||||
|
|
||||||
|
int32_t rand_tinyint(){
|
||||||
|
static int cursor;
|
||||||
|
cursor++;
|
||||||
|
cursor = cursor % MAX_PREPARED_RAND;
|
||||||
|
return randint[cursor] % 128;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t rand_smallint(){
|
||||||
|
static int cursor;
|
||||||
|
cursor++;
|
||||||
|
cursor = cursor % MAX_PREPARED_RAND;
|
||||||
|
return randint[cursor] % 32767;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t rand_int(){
|
||||||
|
static int cursor;
|
||||||
|
cursor++;
|
||||||
|
cursor = cursor % MAX_PREPARED_RAND;
|
||||||
|
return randint[cursor];
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t rand_bigint(){
|
||||||
|
static int cursor;
|
||||||
|
cursor++;
|
||||||
|
cursor = cursor % MAX_PREPARED_RAND;
|
||||||
|
return randbigint[cursor];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float rand_float(){
|
||||||
|
static int cursor;
|
||||||
|
cursor++;
|
||||||
|
cursor = cursor % MAX_PREPARED_RAND;
|
||||||
|
return randfloat[cursor];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double rand_double() {
|
||||||
|
static int cursor;
|
||||||
|
cursor++;
|
||||||
|
cursor = cursor % MAX_PREPARED_RAND;
|
||||||
|
return randdouble[cursor];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_rand_data(){
|
||||||
|
for (int i = 0; i < MAX_PREPARED_RAND; i++){
|
||||||
|
randint[i] = (int)(rand() % 10);
|
||||||
|
randbigint[i] = (int64_t)(rand() % 2147483648);
|
||||||
|
randfloat[i] = (float)(rand() / 1000.0);
|
||||||
|
randdouble[i] = (double)(rand() / 1000000.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t timestamp, int len_of_binary) {
|
int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t timestamp, int len_of_binary) {
|
||||||
memset(res, 0, MAX_DATA_SIZE);
|
memset(res, 0, MAX_DATA_SIZE);
|
||||||
char *pstr = res;
|
char *pstr = res;
|
||||||
|
@ -1176,7 +1241,7 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
for (; c < MAX_NUM_DATATYPE; c++) {
|
for (; c < MAX_NUM_DATATYPE; c++) {
|
||||||
if (strcasecmp(data_type[c], "") == 0) {
|
if (data_type[c] == NULL) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1188,17 +1253,17 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times
|
||||||
|
|
||||||
for (int i = 0; i < num_of_cols; i++) {
|
for (int i = 0; i < num_of_cols; i++) {
|
||||||
if (strcasecmp(data_type[i % c], "tinyint") == 0) {
|
if (strcasecmp(data_type[i % c], "tinyint") == 0) {
|
||||||
pstr += sprintf(pstr, ", %d", (int)(rand() % 128));
|
pstr += sprintf(pstr, ", %d", rand_tinyint() );
|
||||||
} else if (strcasecmp(data_type[i % c], "smallint") == 0) {
|
} else if (strcasecmp(data_type[i % c], "smallint") == 0) {
|
||||||
pstr += sprintf(pstr, ", %d", (int)(rand() % 32767));
|
pstr += sprintf(pstr, ", %d", rand_smallint());
|
||||||
} else if (strcasecmp(data_type[i % c], "int") == 0) {
|
} else if (strcasecmp(data_type[i % c], "int") == 0) {
|
||||||
pstr += sprintf(pstr, ", %d", (int)(rand() % 10));
|
pstr += sprintf(pstr, ", %d", rand_int());
|
||||||
} else if (strcasecmp(data_type[i % c], "bigint") == 0) {
|
} else if (strcasecmp(data_type[i % c], "bigint") == 0) {
|
||||||
pstr += sprintf(pstr, ", %" PRId64, rand() % 2147483648);
|
pstr += sprintf(pstr, ", %" PRId64, rand_bigint());
|
||||||
} else if (strcasecmp(data_type[i % c], "float") == 0) {
|
} else if (strcasecmp(data_type[i % c], "float") == 0) {
|
||||||
pstr += sprintf(pstr, ", %10.4f", (float)(rand() / 1000.0));
|
pstr += sprintf(pstr, ", %10.4f", rand_float());
|
||||||
} else if (strcasecmp(data_type[i % c], "double") == 0) {
|
} else if (strcasecmp(data_type[i % c], "double") == 0) {
|
||||||
double t = (double)(rand() / 1000000.0);
|
double t = rand_double();
|
||||||
pstr += sprintf(pstr, ", %20.8f", t);
|
pstr += sprintf(pstr, ", %20.8f", t);
|
||||||
} else if (strcasecmp(data_type[i % c], "bool") == 0) {
|
} else if (strcasecmp(data_type[i % c], "bool") == 0) {
|
||||||
bool b = rand() & 1;
|
bool b = rand() & 1;
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||||
|
PROJECT(TDengine)
|
||||||
|
|
||||||
|
IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
|
||||||
|
AUX_SOURCE_DIRECTORY(. SRC)
|
||||||
|
ADD_EXECUTABLE(taosClient client.c)
|
||||||
|
ADD_EXECUTABLE(taosServer server.c)
|
||||||
|
TARGET_LINK_LIBRARIES( taosServer -lpthread -lm -lrt )
|
||||||
|
TARGET_LINK_LIBRARIES( taosClient -lpthread -lm -lrt )
|
||||||
|
ENDIF ()
|
|
@ -28,23 +28,27 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define BUFFER_SIZE 200
|
#define MAX_PKG_LEN (64*1000)
|
||||||
|
#define BUFFER_SIZE (MAX_PKG_LEN + 1024)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int port;
|
int port;
|
||||||
char *host[15];
|
char *host;
|
||||||
} info;
|
uint16_t pktLen;
|
||||||
|
} info_s;
|
||||||
|
|
||||||
typedef struct Arguments {
|
typedef struct Arguments {
|
||||||
char * host;
|
char * host;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
uint16_t max_port;
|
uint16_t max_port;
|
||||||
|
uint16_t pktLen;
|
||||||
} SArguments;
|
} SArguments;
|
||||||
|
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
|
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
|
||||||
{0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6041.", 1},
|
{0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6030.", 1},
|
||||||
{0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6050.", 2}};
|
{0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6060.", 2},
|
||||||
|
{0, 'l', "test pkg len", 0, "The len of pkg for test. Default is 1000 Bytes, max not greater than 64k Bytes.\nNotes: This parameter must be consistent between the client and the server.", 3}};
|
||||||
|
|
||||||
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
|
|
||||||
|
@ -59,16 +63,21 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
case 'm':
|
case 'm':
|
||||||
arguments->max_port = atoi(arg);
|
arguments->max_port = atoi(arg);
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
arguments->pktLen = atoi(arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return ARGP_ERR_UNKNOWN;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct argp argp = {options, parse_opt, 0, 0};
|
static struct argp argp = {options, parse_opt, 0, 0};
|
||||||
|
|
||||||
void *checkPort(void *sarg) {
|
int checkTcpPort(info_s *info) {
|
||||||
info *pinfo = (info *)sarg;
|
int port = info->port;
|
||||||
int port = pinfo->port;
|
char *host = info->host;
|
||||||
char *host = *pinfo->host;
|
|
||||||
int clientSocket;
|
int clientSocket;
|
||||||
|
|
||||||
struct sockaddr_in serverAddr;
|
struct sockaddr_in serverAddr;
|
||||||
|
@ -76,39 +85,65 @@ void *checkPort(void *sarg) {
|
||||||
char recvbuf[BUFFER_SIZE];
|
char recvbuf[BUFFER_SIZE];
|
||||||
int iDataNum;
|
int iDataNum;
|
||||||
if ((clientSocket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
if ((clientSocket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
perror("socket");
|
printf("socket() fail: %s\n", strerror(errno));
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
serverAddr.sin_family = AF_INET;
|
serverAddr.sin_family = AF_INET;
|
||||||
serverAddr.sin_port = htons(port);
|
serverAddr.sin_port = htons(port);
|
||||||
|
|
||||||
serverAddr.sin_addr.s_addr = inet_addr(host);
|
serverAddr.sin_addr.s_addr = inet_addr(host);
|
||||||
|
|
||||||
printf("=================================\n");
|
//printf("=================================\n");
|
||||||
if (connect(clientSocket, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) < 0) {
|
if (connect(clientSocket, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) < 0) {
|
||||||
perror("connect");
|
printf("connect() fail: %s\n", strerror(errno));
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
printf("Connect to: %s:%d...success\n", host, port);
|
//printf("Connect to: %s:%d...success\n", host, port);
|
||||||
|
memset(sendbuf, 0, BUFFER_SIZE);
|
||||||
|
memset(recvbuf, 0, BUFFER_SIZE);
|
||||||
|
|
||||||
sprintf(sendbuf, "send port_%d", port);
|
sprintf(sendbuf, "client send tcp pkg to %s:%d, content: 1122334455", host, port);
|
||||||
send(clientSocket, sendbuf, strlen(sendbuf), 0);
|
sprintf(sendbuf + info->pktLen - 16, "1122334455667788");
|
||||||
printf("Send msg_%d: %s\n", port, sendbuf);
|
|
||||||
|
|
||||||
recvbuf[0] = '\0';
|
send(clientSocket, sendbuf, info->pktLen, 0);
|
||||||
iDataNum = recv(clientSocket, recvbuf, BUFFER_SIZE, 0);
|
|
||||||
recvbuf[iDataNum] = '\0';
|
memset(recvbuf, 0, BUFFER_SIZE);
|
||||||
printf("Read ack msg_%d: %s\n", port, recvbuf);
|
int nleft, nread;
|
||||||
|
char *ptr = recvbuf;
|
||||||
|
nleft = info->pktLen;
|
||||||
|
while (nleft > 0) {
|
||||||
|
nread = recv(clientSocket, ptr, BUFFER_SIZE, 0);;
|
||||||
|
|
||||||
|
if (nread == 0) {
|
||||||
|
break;
|
||||||
|
} else if (nread < 0) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
printf("recv ack pkg from TCP port: %d fail:%s.\n", port, strerror(errno));
|
||||||
|
close(clientSocket);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nleft -= nread;
|
||||||
|
ptr += nread;
|
||||||
|
iDataNum += nread;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iDataNum < info->pktLen) {
|
||||||
|
printf("recv ack pkg len: %d, less than req pkg len: %d from tcp port: %d\n", iDataNum, info->pktLen, port);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
//printf("Read ack pkg len:%d from tcp port: %d, buffer: %s %s\n", info->pktLen, port, recvbuf, recvbuf+iDataNum-8);
|
||||||
|
|
||||||
printf("=================================\n");
|
|
||||||
close(clientSocket);
|
close(clientSocket);
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *checkUPort(void *sarg) {
|
int checkUdpPort(info_s *info) {
|
||||||
info *pinfo = (info *)sarg;
|
int port = info->port;
|
||||||
int port = pinfo->port;
|
char *host = info->host;
|
||||||
char *host = *pinfo->host;
|
|
||||||
int clientSocket;
|
int clientSocket;
|
||||||
|
|
||||||
struct sockaddr_in serverAddr;
|
struct sockaddr_in serverAddr;
|
||||||
|
@ -117,56 +152,76 @@ void *checkUPort(void *sarg) {
|
||||||
int iDataNum;
|
int iDataNum;
|
||||||
if ((clientSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
if ((clientSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
serverAddr.sin_family = AF_INET;
|
serverAddr.sin_family = AF_INET;
|
||||||
serverAddr.sin_port = htons(port);
|
serverAddr.sin_port = htons(port);
|
||||||
|
|
||||||
serverAddr.sin_addr.s_addr = inet_addr(host);
|
serverAddr.sin_addr.s_addr = inet_addr(host);
|
||||||
|
|
||||||
|
memset(sendbuf, 0, BUFFER_SIZE);
|
||||||
|
memset(recvbuf, 0, BUFFER_SIZE);
|
||||||
|
|
||||||
printf("=================================\n");
|
sprintf(sendbuf, "client send udp pkg to %s:%d, content: 1122334455", host, port);
|
||||||
|
sprintf(sendbuf + info->pktLen - 16, "1122334455667788");
|
||||||
sprintf(sendbuf, "send msg port_%d by udp", port);
|
|
||||||
|
|
||||||
socklen_t sin_size = sizeof(*(struct sockaddr *)&serverAddr);
|
socklen_t sin_size = sizeof(*(struct sockaddr *)&serverAddr);
|
||||||
|
|
||||||
sendto(clientSocket, sendbuf, strlen(sendbuf), 0, (struct sockaddr *)&serverAddr, (int)sin_size);
|
int code = sendto(clientSocket, sendbuf, info->pktLen, 0, (struct sockaddr *)&serverAddr, (int)sin_size);
|
||||||
|
if (code < 0) {
|
||||||
|
perror("sendto");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
printf("Send msg_%d by udp: %s\n", port, sendbuf);
|
|
||||||
|
|
||||||
recvbuf[0] = '\0';
|
|
||||||
iDataNum = recvfrom(clientSocket, recvbuf, BUFFER_SIZE, 0, (struct sockaddr *)&serverAddr, &sin_size);
|
iDataNum = recvfrom(clientSocket, recvbuf, BUFFER_SIZE, 0, (struct sockaddr *)&serverAddr, &sin_size);
|
||||||
recvbuf[iDataNum] = '\0';
|
|
||||||
printf("Read ack msg_%d from udp: %s\n", port, recvbuf);
|
|
||||||
|
|
||||||
printf("=================================\n");
|
if (iDataNum < info->pktLen) {
|
||||||
|
printf("Read ack pkg len: %d, less than req pkg len: %d from udp port: %d\n", iDataNum, info->pktLen, port);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//printf("Read ack pkg len:%d from udp port: %d, buffer: %s %s\n", info->pktLen, port, recvbuf, recvbuf+iDataNum-8);
|
||||||
close(clientSocket);
|
close(clientSocket);
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
SArguments arguments = {"127.0.0.1", 6041, 6050};
|
SArguments arguments = {"127.0.0.1", 6030, 6060, 1000};
|
||||||
|
info_s info;
|
||||||
|
int ret;
|
||||||
|
|
||||||
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
||||||
|
if (arguments.pktLen > MAX_PKG_LEN) {
|
||||||
|
printf("test pkg len overflow: %d, max len not greater than %d bytes\n", arguments.pktLen, MAX_PKG_LEN);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
printf("host: %s\tport: %d\tmax_port: %d\n", arguments.host, arguments.port, arguments.max_port);
|
printf("host: %s\tport: %d\tmax_port: %d\tpkgLen: %d\n", arguments.host, arguments.port, arguments.max_port, arguments.pktLen);
|
||||||
|
|
||||||
int port = arguments.port;
|
int port = arguments.port;
|
||||||
char *host = arguments.host;
|
|
||||||
info *tinfo = malloc(sizeof(info));
|
|
||||||
info *uinfo = malloc(sizeof(info));
|
|
||||||
|
|
||||||
for (; port < arguments.max_port; port++) {
|
info.host = arguments.host;
|
||||||
printf("For test: %s:%d\n", host, port);
|
info.pktLen = arguments.pktLen;
|
||||||
|
|
||||||
*tinfo->host = host;
|
for (; port <= arguments.max_port; port++) {
|
||||||
tinfo->port = port;
|
//printf("test: %s:%d\n", info.host, port);
|
||||||
checkPort(tinfo);
|
printf("\n");
|
||||||
|
|
||||||
*uinfo->host = host;
|
info.port = port;
|
||||||
uinfo->port = port;
|
ret = checkTcpPort(&info);
|
||||||
checkUPort(uinfo);
|
if (ret != 0) {
|
||||||
|
printf("tcp port:%d test fail.\t\t", port);
|
||||||
|
} else {
|
||||||
|
printf("tcp port:%d test ok.\t\t", port);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = checkUdpPort(&info);
|
||||||
|
if (ret != 0) {
|
||||||
|
printf("udp port:%d test fail.\t\t", port);
|
||||||
|
} else {
|
||||||
|
printf("udp port:%d test ok.\t\t", port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free(tinfo);
|
printf("\n");
|
||||||
free(uinfo);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,24 +27,28 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#define BUFFER_SIZE 200
|
#define MAX_PKG_LEN (64*1000)
|
||||||
|
#define BUFFER_SIZE (MAX_PKG_LEN + 1024)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int port;
|
int port;
|
||||||
int type; // 0: tcp, 1: udo, default: 0
|
uint16_t pktLen;
|
||||||
} info;
|
} info_s;
|
||||||
|
|
||||||
typedef struct Arguments {
|
typedef struct Arguments {
|
||||||
char * host;
|
char * host;
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
uint16_t max_port;
|
uint16_t max_port;
|
||||||
|
uint16_t pktLen;
|
||||||
} SArguments;
|
} SArguments;
|
||||||
|
|
||||||
static struct argp_option options[] = {
|
static struct argp_option options[] = {
|
||||||
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
|
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0},
|
||||||
{0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6020.", 1},
|
{0, 'p', "port", 0, "The TCP or UDP port number to use for the connection. Default is 6041.", 1},
|
||||||
{0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6050.", 2}};
|
{0, 'm', "max port", 0, "The max TCP or UDP port number to use for the connection. Default is 6060.", 2},
|
||||||
|
{0, 'l', "test pkg len", 0, "The len of pkg for test. Default is 1000 Bytes, max not greater than 64k Bytes.\nNotes: This parameter must be consistent between the client and the server.", 3}};
|
||||||
|
|
||||||
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
|
|
||||||
|
@ -59,16 +63,21 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
|
||||||
case 'm':
|
case 'm':
|
||||||
arguments->max_port = atoi(arg);
|
arguments->max_port = atoi(arg);
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
arguments->pktLen = atoi(arg);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return ARGP_ERR_UNKNOWN;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct argp argp = {options, parse_opt, 0, 0};
|
static struct argp argp = {options, parse_opt, 0, 0};
|
||||||
|
|
||||||
static void *bindPort(void *sarg) {
|
static void *bindTcpPort(void *sarg) {
|
||||||
info *pinfo = (info *)sarg;
|
info_s *pinfo = (info_s *)sarg;
|
||||||
int port = pinfo->port;
|
int port = pinfo->port;
|
||||||
int type = pinfo->type;
|
|
||||||
int serverSocket;
|
int serverSocket;
|
||||||
|
|
||||||
struct sockaddr_in server_addr;
|
struct sockaddr_in server_addr;
|
||||||
|
@ -76,10 +85,10 @@ static void *bindPort(void *sarg) {
|
||||||
int addr_len = sizeof(clientAddr);
|
int addr_len = sizeof(clientAddr);
|
||||||
int client;
|
int client;
|
||||||
char buffer[BUFFER_SIZE];
|
char buffer[BUFFER_SIZE];
|
||||||
int iDataNum;
|
int iDataNum = 0;
|
||||||
|
|
||||||
if ((serverSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
|
if ((serverSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
|
||||||
perror("socket");
|
printf("socket() fail: %s", strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,65 +98,67 @@ static void *bindPort(void *sarg) {
|
||||||
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||||
|
|
||||||
if (bind(serverSocket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
|
if (bind(serverSocket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
|
||||||
perror("connect");
|
printf("port:%d bind() fail: %s", port, strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listen(serverSocket, 5) < 0) {
|
if (listen(serverSocket, 5) < 0) {
|
||||||
perror("listen");
|
printf("listen() fail: %s", strerror(errno));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Bind port: %d success\n", port);
|
//printf("Bind port: %d success\n", port);
|
||||||
while (1) {
|
while (1) {
|
||||||
client = accept(serverSocket, (struct sockaddr *)&clientAddr, (socklen_t *)&addr_len);
|
client = accept(serverSocket, (struct sockaddr *)&clientAddr, (socklen_t *)&addr_len);
|
||||||
if (client < 0) {
|
if (client < 0) {
|
||||||
perror("accept");
|
printf("accept() fail: %s", strerror(errno));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
printf("=================================\n");
|
|
||||||
|
|
||||||
printf("Client ip is %s, Server port is %d\n", inet_ntoa(clientAddr.sin_addr), port);
|
memset(buffer, 0, BUFFER_SIZE);
|
||||||
while (1) {
|
int nleft, nread;
|
||||||
buffer[0] = '\0';
|
char *ptr = buffer;
|
||||||
iDataNum = recv(client, buffer, BUFFER_SIZE, 0);
|
nleft = pinfo->pktLen;
|
||||||
|
while (nleft > 0) {
|
||||||
|
nread = recv(client, ptr, BUFFER_SIZE, 0);
|
||||||
|
|
||||||
if (iDataNum < 0) {
|
if (nread == 0) {
|
||||||
perror("recv null");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (iDataNum > 0) {
|
|
||||||
buffer[iDataNum] = '\0';
|
|
||||||
printf("read msg:%s\n", buffer);
|
|
||||||
if (strcmp(buffer, "quit") == 0) break;
|
|
||||||
buffer[0] = '\0';
|
|
||||||
|
|
||||||
sprintf(buffer, "ack port_%d", port);
|
|
||||||
printf("send ack msg:%s\n", buffer);
|
|
||||||
|
|
||||||
send(client, buffer, strlen(buffer), 0);
|
|
||||||
break;
|
break;
|
||||||
}
|
} else if (nread < 0) {
|
||||||
|
if (errno == EINTR) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
printf("recv Client: %s pkg from TCP port: %d fail:%s.\n", inet_ntoa(clientAddr.sin_addr), port, strerror(errno));
|
||||||
|
close(serverSocket);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nleft -= nread;
|
||||||
|
ptr += nread;
|
||||||
|
iDataNum += nread;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("recv Client: %s pkg from TCP port: %d, pkg len: %d\n", inet_ntoa(clientAddr.sin_addr), port, iDataNum);
|
||||||
|
if (iDataNum > 0) {
|
||||||
|
send(client, buffer, iDataNum, 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
printf("=================================\n");
|
|
||||||
}
|
}
|
||||||
close(serverSocket);
|
close(serverSocket);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *bindUPort(void *sarg) {
|
static void *bindUdpPort(void *sarg) {
|
||||||
info *pinfo = (info *)sarg;
|
info_s *pinfo = (info_s *)sarg;
|
||||||
int port = pinfo->port;
|
int port = pinfo->port;
|
||||||
int type = pinfo->type;
|
|
||||||
int serverSocket;
|
int serverSocket;
|
||||||
|
|
||||||
struct sockaddr_in server_addr;
|
struct sockaddr_in server_addr;
|
||||||
struct sockaddr_in clientAddr;
|
struct sockaddr_in clientAddr;
|
||||||
int addr_len = sizeof(clientAddr);
|
|
||||||
int client;
|
|
||||||
char buffer[BUFFER_SIZE];
|
char buffer[BUFFER_SIZE];
|
||||||
int iDataNum;
|
int iDataNum;
|
||||||
|
|
||||||
if ((serverSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
if ((serverSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -164,10 +175,9 @@ static void *bindUPort(void *sarg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
socklen_t sin_size;
|
socklen_t sin_size;
|
||||||
printf("Bind port: %d success\n", port);
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
buffer[0] = '\0';
|
memset(buffer, 0, BUFFER_SIZE);
|
||||||
|
|
||||||
sin_size = sizeof(*(struct sockaddr *)&server_addr);
|
sin_size = sizeof(*(struct sockaddr *)&server_addr);
|
||||||
|
|
||||||
|
@ -178,21 +188,10 @@ static void *bindUPort(void *sarg) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (iDataNum > 0) {
|
if (iDataNum > 0) {
|
||||||
printf("=================================\n");
|
printf("recv Client: %s pkg from UDP port: %d, pkg len: %d\n", inet_ntoa(clientAddr.sin_addr), port, iDataNum);
|
||||||
|
//printf("Read msg from udp:%s ... %s\n", buffer, buffer+iDataNum-16);
|
||||||
|
|
||||||
printf("Client ip is %s, Server port is %d\n", inet_ntoa(clientAddr.sin_addr), port);
|
sendto(serverSocket, buffer, iDataNum, 0, (struct sockaddr *)&clientAddr, (int)sin_size);
|
||||||
buffer[iDataNum] = '\0';
|
|
||||||
printf("Read msg from udp:%s\n", buffer);
|
|
||||||
if (strcmp(buffer, "quit") == 0) break;
|
|
||||||
buffer[0] = '\0';
|
|
||||||
|
|
||||||
sprintf(buffer, "ack port_%d by udp", port);
|
|
||||||
printf("Send ack msg by udp:%s\n", buffer);
|
|
||||||
|
|
||||||
sendto(serverSocket, buffer, strlen(buffer), 0, (struct sockaddr *)&clientAddr, (int)sin_size);
|
|
||||||
|
|
||||||
send(client, buffer, strlen(buffer), 0);
|
|
||||||
printf("=================================\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,39 +201,44 @@ static void *bindUPort(void *sarg) {
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
SArguments arguments = {"127.0.0.1", 6020, 6050};
|
SArguments arguments = {"127.0.0.1", 6030, 6060, 1000};
|
||||||
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
argp_parse(&argp, argc, argv, 0, 0, &arguments);
|
||||||
|
if (arguments.pktLen > MAX_PKG_LEN) {
|
||||||
|
printf("test pkg len overflow: %d, max len not greater than %d bytes\n", arguments.pktLen, MAX_PKG_LEN);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
int port = arguments.port;
|
int port = arguments.port;
|
||||||
|
|
||||||
int num = arguments.max_port - arguments.port;
|
int num = arguments.max_port - arguments.port + 1;
|
||||||
|
|
||||||
if (num < 0) {
|
if (num < 0) {
|
||||||
num = 1;
|
num = 1;
|
||||||
}
|
}
|
||||||
pthread_t *pids = malloc(2 * num * sizeof(pthread_t));
|
pthread_t *pids = malloc(2 * num * sizeof(pthread_t));
|
||||||
info * infos = malloc(num * sizeof(info));
|
info_s * tinfos = malloc(num * sizeof(info_s));
|
||||||
info * uinfos = malloc(num * sizeof(info));
|
info_s * uinfos = malloc(num * sizeof(info_s));
|
||||||
|
|
||||||
for (size_t i = 0; i < num; i++) {
|
for (size_t i = 0; i < num; i++) {
|
||||||
info *pinfo = infos++;
|
info_s *tcpInfo = tinfos + i;
|
||||||
pinfo->port = port;
|
tcpInfo->port = port + i;
|
||||||
|
tcpInfo->pktLen = arguments.pktLen;
|
||||||
|
|
||||||
if (pthread_create(pids + i, NULL, bindPort, pinfo) != 0) //创建线程
|
if (pthread_create(pids + i, NULL, bindTcpPort, tcpInfo) != 0)
|
||||||
{ //创建线程失败
|
{
|
||||||
printf("创建线程失败: %d.\n", port);
|
printf("create thread fail, port:%d.\n", port);
|
||||||
exit(0);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
info *uinfo = uinfos++;
|
info_s *udpInfo = uinfos + i;
|
||||||
uinfo->port = port;
|
udpInfo->port = port + i;
|
||||||
uinfo->type = 1;
|
if (pthread_create(pids + num + i, NULL, bindUdpPort, udpInfo) != 0)
|
||||||
port++;
|
{
|
||||||
if (pthread_create(pids + num + i, NULL, bindUPort, uinfo) != 0) //创建线程
|
printf("create thread fail, port:%d.\n", port);
|
||||||
{ //创建线程失败
|
exit(-1);
|
||||||
printf("创建线程失败: %d.\n", port);
|
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < num; i++) {
|
for (int i = 0; i < num; i++) {
|
||||||
pthread_join(pids[i], NULL);
|
pthread_join(pids[i], NULL);
|
||||||
pthread_join(pids[(num + i)], NULL);
|
pthread_join(pids[(num + i)], NULL);
|
||||||
|
|
|
@ -24,6 +24,7 @@ extern "C" {
|
||||||
|
|
||||||
int32_t mnodeInitAccts();
|
int32_t mnodeInitAccts();
|
||||||
void mnodeCleanupAccts();
|
void mnodeCleanupAccts();
|
||||||
|
void mnodeGetStatOfAllAcct(SAcctInfo* pAcctInfo);
|
||||||
void * mnodeGetAcct(char *acctName);
|
void * mnodeGetAcct(char *acctName);
|
||||||
void * mnodeGetNextAcct(void *pIter, SAcctObj **pAcct);
|
void * mnodeGetNextAcct(void *pIter, SAcctObj **pAcct);
|
||||||
void mnodeIncAcctRef(SAcctObj *pAcct);
|
void mnodeIncAcctRef(SAcctObj *pAcct);
|
||||||
|
|
|
@ -30,6 +30,7 @@ enum _TSDB_DB_STATUS {
|
||||||
// api
|
// api
|
||||||
int32_t mnodeInitDbs();
|
int32_t mnodeInitDbs();
|
||||||
void mnodeCleanupDbs();
|
void mnodeCleanupDbs();
|
||||||
|
int64_t mnodeGetDbNum();
|
||||||
SDbObj *mnodeGetDb(char *db);
|
SDbObj *mnodeGetDb(char *db);
|
||||||
SDbObj *mnodeGetDbByTableId(char *db);
|
SDbObj *mnodeGetDbByTableId(char *db);
|
||||||
void * mnodeGetNextDb(void *pIter, SDbObj **pDb);
|
void * mnodeGetNextDb(void *pIter, SDbObj **pDb);
|
||||||
|
|
|
@ -24,6 +24,8 @@ extern "C" {
|
||||||
|
|
||||||
int32_t mnodeInitTables();
|
int32_t mnodeInitTables();
|
||||||
void mnodeCleanupTables();
|
void mnodeCleanupTables();
|
||||||
|
int64_t mnodeGetSuperTableNum();
|
||||||
|
int64_t mnodeGetChildTableNum();
|
||||||
void * mnodeGetTable(char *tableId);
|
void * mnodeGetTable(char *tableId);
|
||||||
void mnodeIncTableRef(void *pTable);
|
void mnodeIncTableRef(void *pTable);
|
||||||
void mnodeDecTableRef(void *pTable);
|
void mnodeDecTableRef(void *pTable);
|
||||||
|
|
|
@ -24,6 +24,7 @@ struct SMnodeMsg;
|
||||||
|
|
||||||
int32_t mnodeInitVgroups();
|
int32_t mnodeInitVgroups();
|
||||||
void mnodeCleanupVgroups();
|
void mnodeCleanupVgroups();
|
||||||
|
int64_t mnodeGetVgroupNum();
|
||||||
SVgObj *mnodeGetVgroup(int32_t vgId);
|
SVgObj *mnodeGetVgroup(int32_t vgId);
|
||||||
void mnodeIncVgroupRef(SVgObj *pVgroup);
|
void mnodeIncVgroupRef(SVgObj *pVgroup);
|
||||||
void mnodeDecVgroupRef(SVgObj *pVgroup);
|
void mnodeDecVgroupRef(SVgObj *pVgroup);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "mnodeDb.h"
|
#include "mnodeDb.h"
|
||||||
#include "mnodeSdb.h"
|
#include "mnodeSdb.h"
|
||||||
#include "mnodeUser.h"
|
#include "mnodeUser.h"
|
||||||
|
#include "mnodeVgroup.h"
|
||||||
|
|
||||||
#include "tglobal.h"
|
#include "tglobal.h"
|
||||||
|
|
||||||
|
@ -130,6 +131,37 @@ void mnodeCleanupAccts() {
|
||||||
tsAcctSdb = NULL;
|
tsAcctSdb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mnodeGetStatOfAllAcct(SAcctInfo* pAcctInfo) {
|
||||||
|
memset(pAcctInfo, 0, sizeof(*pAcctInfo));
|
||||||
|
|
||||||
|
void *pIter = NULL;
|
||||||
|
SAcctObj *pAcct = NULL;
|
||||||
|
while (1) {
|
||||||
|
pIter = mnodeGetNextAcct(pIter, &pAcct);
|
||||||
|
if (pAcct == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pAcctInfo->numOfDbs += pAcct->acctInfo.numOfDbs;
|
||||||
|
pAcctInfo->numOfTimeSeries += pAcct->acctInfo.numOfTimeSeries;
|
||||||
|
mnodeDecAcctRef(pAcct);
|
||||||
|
}
|
||||||
|
sdbFreeIter(pIter);
|
||||||
|
|
||||||
|
SVgObj *pVgroup = NULL;
|
||||||
|
pIter = NULL;
|
||||||
|
while (1) {
|
||||||
|
pIter = mnodeGetNextVgroup(pIter, &pVgroup);
|
||||||
|
if (pVgroup == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pAcctInfo->totalStorage += pVgroup->totalStorage;
|
||||||
|
pAcctInfo->compStorage += pVgroup->compStorage;
|
||||||
|
pAcctInfo->totalPoints += pVgroup->pointsWritten;
|
||||||
|
mnodeDecVgroupRef(pVgroup);
|
||||||
|
}
|
||||||
|
sdbFreeIter(pIter);
|
||||||
|
}
|
||||||
|
|
||||||
void *mnodeGetAcct(char *name) {
|
void *mnodeGetAcct(char *name) {
|
||||||
return sdbGetRow(tsAcctSdb, name);
|
return sdbGetRow(tsAcctSdb, name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,6 +61,10 @@ static int32_t mnodeDbActionDestroy(SSdbOper *pOper) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t mnodeGetDbNum() {
|
||||||
|
return sdbGetNumOfRows(tsDbSdb);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t mnodeDbActionInsert(SSdbOper *pOper) {
|
static int32_t mnodeDbActionInsert(SSdbOper *pOper) {
|
||||||
SDbObj *pDb = pOper->pObj;
|
SDbObj *pDb = pOper->pObj;
|
||||||
SAcctObj *pAcct = mnodeGetAcct(pDb->acct);
|
SAcctObj *pAcct = mnodeGetAcct(pDb->acct);
|
||||||
|
|
|
@ -75,6 +75,11 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mnodeProcessPeerRsp(SRpcMsg *pMsg) {
|
void mnodeProcessPeerRsp(SRpcMsg *pMsg) {
|
||||||
|
if (!sdbIsMaster()) {
|
||||||
|
mError("%p, msg:%s is not processed for it is not master", pMsg->ahandle, taosMsg[pMsg->msgType]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (tsMnodeProcessPeerRspFp[pMsg->msgType]) {
|
if (tsMnodeProcessPeerRspFp[pMsg->msgType]) {
|
||||||
(*tsMnodeProcessPeerRspFp[pMsg->msgType])(pMsg);
|
(*tsMnodeProcessPeerRspFp[pMsg->msgType])(pMsg);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -375,6 +375,14 @@ static void mnodeCleanupChildTables() {
|
||||||
tsChildTableSdb = NULL;
|
tsChildTableSdb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t mnodeGetSuperTableNum() {
|
||||||
|
return sdbGetNumOfRows(tsSuperTableSdb);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t mnodeGetChildTableNum() {
|
||||||
|
return sdbGetNumOfRows(tsChildTableSdb);
|
||||||
|
}
|
||||||
|
|
||||||
static void mnodeAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) {
|
static void mnodeAddTableIntoStable(SSuperTableObj *pStable, SChildTableObj *pCtable) {
|
||||||
atomic_add_fetch_32(&pStable->numOfTables, 1);
|
atomic_add_fetch_32(&pStable->numOfTables, 1);
|
||||||
|
|
||||||
|
@ -1345,7 +1353,7 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows,
|
||||||
|
|
||||||
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
|
||||||
|
|
||||||
int16_t len = strnlen(stableName, TSDB_DB_NAME_LEN - 1);
|
int16_t len = strnlen(stableName, TSDB_TABLE_NAME_LEN - 1);
|
||||||
*(int16_t*) pWrite = len;
|
*(int16_t*) pWrite = len;
|
||||||
pWrite += sizeof(int16_t); // todo refactor
|
pWrite += sizeof(int16_t); // todo refactor
|
||||||
|
|
||||||
|
|
|
@ -164,9 +164,9 @@ static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) {
|
||||||
|
|
||||||
|
|
||||||
// reset vgid status on vgroup changed
|
// reset vgid status on vgroup changed
|
||||||
mDebug("vgId:%d, reset sync status to unsynced", pVgroup->vgId);
|
mDebug("vgId:%d, reset sync status to offline", pVgroup->vgId);
|
||||||
for (int32_t v = 0; v < pVgroup->numOfVnodes; ++v) {
|
for (int32_t v = 0; v < pVgroup->numOfVnodes; ++v) {
|
||||||
pVgroup->vnodeGid[v].role = TAOS_SYNC_ROLE_UNSYNCED;
|
pVgroup->vnodeGid[v].role = TAOS_SYNC_ROLE_OFFLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mnodeDecVgroupRef(pVgroup);
|
mnodeDecVgroupRef(pVgroup);
|
||||||
|
@ -309,7 +309,7 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl
|
||||||
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
|
for (int32_t i = 0; i < pVgroup->numOfVnodes; ++i) {
|
||||||
SVnodeGid *pVgid = &pVgroup->vnodeGid[i];
|
SVnodeGid *pVgid = &pVgroup->vnodeGid[i];
|
||||||
if (pVgid->pDnode == pDnode) {
|
if (pVgid->pDnode == pDnode) {
|
||||||
mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d", pVgroup->vgId, pDnode->dnodeId, pVgid->role);
|
mTrace("dnode:%d, receive status from dnode, vgId:%d status is %d", pDnode->dnodeId, pVgroup->vgId, pVgid->role);
|
||||||
pVgid->role = pVload->role;
|
pVgid->role = pVload->role;
|
||||||
if (pVload->role == TAOS_SYNC_ROLE_MASTER) {
|
if (pVload->role == TAOS_SYNC_ROLE_MASTER) {
|
||||||
pVgroup->inUse = i;
|
pVgroup->inUse = i;
|
||||||
|
@ -605,6 +605,10 @@ void mnodeCleanupVgroups() {
|
||||||
tsVgroupSdb = NULL;
|
tsVgroupSdb = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t mnodeGetVgroupNum() {
|
||||||
|
return sdbGetNumOfRows(tsVgroupSdb);
|
||||||
|
}
|
||||||
|
|
||||||
static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
|
static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
|
||||||
SDbObj *pDb = mnodeGetDb(pShow->db);
|
SDbObj *pDb = mnodeGetDb(pShow->db);
|
||||||
if (pDb == NULL) {
|
if (pDb == NULL) {
|
||||||
|
|
|
@ -32,7 +32,14 @@ function buildTDengine {
|
||||||
echo "repo need to pull"
|
echo "repo need to pull"
|
||||||
git reset --hard
|
git reset --hard
|
||||||
git pull
|
git pull
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -d $TDENGINE_DIR/debug ] || mkdir $TDENGINE_DIR/debug
|
||||||
|
cd $TDENGINE_DIR/debug
|
||||||
|
[ -f $TDENGINE_DIR/debug/build/bin/taosd ] || need_rebuild=true
|
||||||
|
|
||||||
|
if $need_rebuild ; then
|
||||||
|
echo "rebuild.."
|
||||||
LOCAL_COMMIT=`git rev-parse --short @`
|
LOCAL_COMMIT=`git rev-parse --short @`
|
||||||
|
|
||||||
rm -rf *
|
rm -rf *
|
||||||
|
@ -46,10 +53,9 @@ function buildTDengine {
|
||||||
function runGeneralCaseOneByOne {
|
function runGeneralCaseOneByOne {
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
if [[ $line =~ ^./test.sh* ]]; then
|
if [[ $line =~ ^./test.sh* ]]; then
|
||||||
general_case=`echo $line | grep -w general`
|
case=`echo $line | grep -w "general\|unique\/mnode\/mgmt33.sim\|unique\/stable\/dnode3.sim\|unique\/cluster\/balance3.sim\|unique\/arbitrator\/offline_replica2_alterTable_online.sim"|awk '{print $NF}'`
|
||||||
|
|
||||||
if [ -n "$general_case" ]; then
|
if [ -n "$case" ]; then
|
||||||
case=`echo $line |grep general| awk '{print $NF}'`
|
|
||||||
./test.sh -f $case > /dev/null 2>&1 && \
|
./test.sh -f $case > /dev/null 2>&1 && \
|
||||||
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \
|
echo -e "${GREEN}$case success${NC}" | tee -a $TDENGINE_COVERAGE_REPORT || \
|
||||||
echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
|
echo -e "${RED}$case failed${NC}" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
@ -90,14 +96,14 @@ function runTest {
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
cd $TDENGINE_DIR/src/connector/jdbc
|
cd $TDENGINE_DIR/src/connector/jdbc
|
||||||
mvn clean package
|
mvn clean package > /dev/null 2>&1
|
||||||
mvn test | tee -a $TDENGINE_COVERAGE_REPORT
|
mvn test > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
|
||||||
# Test C Demo
|
# Test C Demo
|
||||||
stopTaosd
|
stopTaosd
|
||||||
$TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null &
|
$TDENGINE_DIR/debug/build/bin/taosd -c $TDENGINE_DIR/debug/test/cfg > /dev/null &
|
||||||
sleep 10
|
sleep 10
|
||||||
yes | $TDENGINE_DIR/debug/build/bin/demo 127.0.0.1 | tee -a $TDENGINE_COVERAGE_REPORT
|
yes | $TDENGINE_DIR/debug/build/bin/demo 127.0.0.1 > /dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
|
|
||||||
# Test waltest
|
# Test waltest
|
||||||
dataDir=`grep dataDir $TDENGINE_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'`
|
dataDir=`grep dataDir $TDENGINE_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'`
|
||||||
|
@ -105,14 +111,14 @@ function runTest {
|
||||||
echo "dataDir: $dataDir" | tee -a $TDENGINE_COVERAGE_REPORT
|
echo "dataDir: $dataDir" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
echo "walDir: $walDir" | tee -a $TDENGINE_COVERAGE_REPORT
|
echo "walDir: $walDir" | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
if [ -n "$walDir" ]; then
|
if [ -n "$walDir" ]; then
|
||||||
yes | $TDENGINE_DIR/debug/build/bin/waltest -p $walDir | tee -a $TDENGINE_COVERAGE_REPORT
|
yes | $TDENGINE_DIR/debug/build/bin/waltest -p $walDir > dev/null 2>&1 | tee -a $TDENGINE_COVERAGE_REPORT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# run Unit Test
|
# run Unit Test
|
||||||
echo "Run Unit Test: utilTest, queryTest and cliTest"
|
echo "Run Unit Test: utilTest, queryTest and cliTest"
|
||||||
$TDENGINE_DIR/debug/build/bin/utilTest > /dev/null && echo "utilTest pass!" || echo "utilTest failed!"
|
$TDENGINE_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!"
|
||||||
$TDENGINE_DIR/debug/build/bin/queryTest > /dev/null && echo "queryTest pass!" || echo "queryTest failed!"
|
$TDENGINE_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!"
|
||||||
$TDENGINE_DIR/debug/build/bin/cliTest > /dev/null && echo "cliTest pass!" || echo "cliTest failed!"
|
$TDENGINE_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!"
|
||||||
|
|
||||||
stopTaosd
|
stopTaosd
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,23 +100,30 @@ function runTest {
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
cd $TDINTERNAL_DIR/community/src/connector/jdbc
|
cd $TDINTERNAL_DIR/community/src/connector/jdbc
|
||||||
mvn clean package
|
mvn clean package > /dev/null
|
||||||
mvn test | tee -a $TDINTERNAL_COVERAGE_REPORT
|
mvn test > /dev/null | tee -a $TDINTERNAL_COVERAGE_REPORT
|
||||||
|
|
||||||
# Test C Demo
|
# Test C Demo
|
||||||
stopTaosd
|
stopTaosd
|
||||||
$TDINTERNAL_DIR/debug/build/bin/taosd -c $TDINTERNAL_DIR/debug/test/cfg > /dev/null &
|
$TDINTERNAL_DIR/debug/build/bin/taosd -c $TDINTERNAL_DIR/debug/test/cfg > /dev/null &
|
||||||
sleep 10
|
sleep 10
|
||||||
yes | $TDINTERNAL_DIR/debug/build/bin/demo 127.0.0.1 | tee -a $TDINTERNAL_COVERAGE_REPORT
|
yes | $TDINTERNAL_DIR/debug/build/bin/demo 127.0.0.1 > /dev/null | tee -a $TDINTERNAL_COVERAGE_REPORT
|
||||||
|
|
||||||
# Test waltest
|
# Test waltest
|
||||||
dataDir=`grep dataDir $TDINTERNAL_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'`
|
dataDir=`grep dataDir $TDINTERNAL_DIR/debug/test/cfg/taos.cfg|awk '{print $2}'`
|
||||||
walDir=`find $dataDir -name "wal"|head -n1`
|
walDir=`find $dataDir -name "wal"|head -n1`
|
||||||
echo "dataDir: $dataDir\nwalDir: $walDir" | tee -a $TDINTERNAL_COVERAGE_REPORT
|
echo "dataDir: $dataDir" | tee -a $TDINTERNAL_COVERAGE_REPORT
|
||||||
|
echo "walDir: $walDir" | tee -a $TDINTERNAL_COVERAGE_REPORT
|
||||||
if [ -n "$walDir" ]; then
|
if [ -n "$walDir" ]; then
|
||||||
yes | $TDINTERNAL_DIR/debug/build/bin/waltest -p $walDir | tee -a $TDINTERNAL_COVERAGE_REPORT
|
yes | $TDINTERNAL_DIR/debug/build/bin/waltest -p $walDir > /dev/null | tee -a $TDINTERNAL_COVERAGE_REPORT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# run Unit Test
|
||||||
|
echo "Run Unit Test: utilTest, queryTest and cliTest"
|
||||||
|
$TDINTERNAL_DIR/debug/build/bin/utilTest > /dev/null 2>&1 && echo "utilTest pass!" || echo "utilTest failed!"
|
||||||
|
$TDINTERNAL_DIR/debug/build/bin/queryTest > /dev/null 2>&1 && echo "queryTest pass!" || echo "queryTest failed!"
|
||||||
|
$TDINTERNAL_DIR/debug/build/bin/cliTest > /dev/null 2>&1 && echo "cliTest pass!" || echo "cliTest failed!"
|
||||||
|
|
||||||
stopTaosd
|
stopTaosd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue