diff --git a/documentation/tdenginedocs-cn/taos-sql/index.html b/documentation/tdenginedocs-cn/taos-sql/index.html
index ec3e42d090..207bfe03fd 100644
--- a/documentation/tdenginedocs-cn/taos-sql/index.html
+++ b/documentation/tdenginedocs-cn/taos-sql/index.html
@@ -359,9 +359,9 @@ SELECT function_list FROM tb_name
SELECT function_list FROM stb_name
[WHERE where_condition]
- [GROUP BY tags]
+ [FILL ({ VALUE | PREV | NULL | LINEAR})]
INTERVAL (interval)
- [FILL ({ VALUE | PREV | NULL | LINEAR})]
+ [GROUP BY tags]
- 聚合时间段的长度由关键词INTERVAL指定,最短时间间隔10毫秒(10a)。聚合查询中,能够同时执行的聚合和选择函数仅限于单个输出的函数:count、avg、sum 、stddev、leastsquares、percentile、min、max、first、last,不能使用具有多行输出结果的函数(例如:top、bottom、diff以及四则运算)。
- WHERE语句可以指定查询的起止时间和其他过滤条件
diff --git a/documentation/webdocs/markdowndocs/Super Table-ch.md b/documentation/webdocs/markdowndocs/Super Table-ch.md
index c5b207b564..e75a8d46c3 100644
--- a/documentation/webdocs/markdowndocs/Super Table-ch.md
+++ b/documentation/webdocs/markdowndocs/Super Table-ch.md
@@ -54,7 +54,7 @@ STable从属于库,一个STable只属于一个库,但一个库可以有一
说明:
1. TAGS列总长度不能超过512 bytes;
- 2. TAGS列的数据类型不能是timestamp和nchar类型;
+ 2. TAGS列的数据类型不能是timestamp;
3. TAGS列名不能与其他列名相同;
4. TAGS列名不能为预留关键字.
@@ -218,7 +218,7 @@ GROUP BY location, type
```mysql
SELECT COUNT(*), AVG(degree), MAX(degree), MIN(degree)
FROM thermometer
-WHERE name<>'beijing' and ts>=now-1d
+WHERE location<>'beijing' and ts>=now-1d
INTERVAL(10M)
GROUP BY location, type
```
diff --git a/documentation/webdocs/markdowndocs/Super Table.md b/documentation/webdocs/markdowndocs/Super Table.md
index 79a1650924..609dd11bd2 100644
--- a/documentation/webdocs/markdowndocs/Super Table.md
+++ b/documentation/webdocs/markdowndocs/Super Table.md
@@ -23,7 +23,7 @@ New keyword "tags" is introduced, where tag_name is the tag name, and tag_type i
Note:
1. The bytes of all tags together shall be less than 512
-2. Tag's data type can not be time stamp or nchar
+2. Tag's data type can not be time stamp
3. Tag name shall be different from the field name
4. Tag name shall not be the same as system keywords
5. Maximum number of tags is 6
@@ -102,7 +102,7 @@ List the number of records, average, maximum, and minimum temperature every 10 m
```mysql
SELECT COUNT(*), AVG(degree), MAX(degree), MIN(degree)
FROM thermometer
-WHERE name='beijing' and type=10 and ts>=now-1d
+WHERE location='beijing' and type=10 and ts>=now-1d
INTERVAL(10M)
```
diff --git a/documentation/webdocs/markdowndocs/TAOS SQL-ch.md b/documentation/webdocs/markdowndocs/TAOS SQL-ch.md
index a6a1b4872a..6a8549bbd2 100644
--- a/documentation/webdocs/markdowndocs/TAOS SQL-ch.md
+++ b/documentation/webdocs/markdowndocs/TAOS SQL-ch.md
@@ -424,9 +424,9 @@ SELECT function_list FROM tb_name
SELECT function_list FROM stb_name
[WHERE where_condition]
- [GROUP BY tags]
INTERVAL (interval)
[FILL ({ VALUE | PREV | NULL | LINEAR})]
+ [GROUP BY tags]
```
- 聚合时间段的长度由关键词INTERVAL指定,最短时间间隔10毫秒(10a)。聚合查询中,能够同时执行的聚合和选择函数仅限于单个输出的函数:count、avg、sum 、stddev、leastsquares、percentile、min、max、first、last,不能使用具有多行输出结果的函数(例如:top、bottom、diff以及四则运算)。
diff --git a/documentation/webdocs/markdowndocs/TAOS SQL.md b/documentation/webdocs/markdowndocs/TAOS SQL.md
index 2431514fa5..870529417f 100644
--- a/documentation/webdocs/markdowndocs/TAOS SQL.md
+++ b/documentation/webdocs/markdowndocs/TAOS SQL.md
@@ -474,9 +474,9 @@ SELECT function_list FROM tb_name
SELECT function_list FROM stb_name
[WHERE where_condition]
- [GROUP BY tags]
INTERVAL (interval)
[FILL ({ VALUE | PREV | NULL | LINEAR})]
+ [GROUP BY tags]
```
The downsampling time window is defined by `interval`, which is at least 10 milliseconds. The query returns a new series of downsampled data that has a series of fixed timestamps with an increment of `interval`.
diff --git a/packaging/deb/DEBIAN/preinst b/packaging/deb/DEBIAN/preinst
index b313f90e90..352060556c 100644
--- a/packaging/deb/DEBIAN/preinst
+++ b/packaging/deb/DEBIAN/preinst
@@ -9,13 +9,13 @@ fi
if pidof taosd &> /dev/null; then
if pidof systemd &> /dev/null; then
${csudo} systemctl stop taosd || :
- elif $(which insserv &> /dev/null); then
- ${csudo} service taosd stop || :
- elif $(which update-rc.d &> /dev/null); then
+ elif $(which service &> /dev/null); then
${csudo} service taosd stop || :
else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 ${pid} || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
fi
echo "Stop taosd service success!"
sleep 1
diff --git a/packaging/deb/DEBIAN/prerm b/packaging/deb/DEBIAN/prerm
index 1af6a04943..d24502a1cb 100644
--- a/packaging/deb/DEBIAN/prerm
+++ b/packaging/deb/DEBIAN/prerm
@@ -35,6 +35,8 @@ else
${csudo} rm -f ${data_link_dir} || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 ${pid} || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
fi
diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh
index e4c795f1b8..5766bd6836 100755
--- a/packaging/deb/makedeb.sh
+++ b/packaging/deb/makedeb.sh
@@ -24,8 +24,7 @@ fi
mkdir -p ${pkg_dir}
cd ${pkg_dir}
-versioninfo=$(${script_dir}/../tools/get_version.sh ${script_dir}/../../src/util/src/version.c)
-libfile="libtaos.so.${versioninfo}"
+libfile="libtaos.so.${tdengine_ver}"
# create install dir
install_home_path="/usr/local/taos"
diff --git a/packaging/release.sh b/packaging/release.sh
index 2091bed220..6a00f0b79d 100755
--- a/packaging/release.sh
+++ b/packaging/release.sh
@@ -3,7 +3,9 @@
# Generate the deb package for ubunt, or rpm package for centos, or tar.gz package for other linux os
set -e
-#set -x
+# set -x
+
+armver=$1
curr_dir=$(pwd)
script_dir="$(dirname $(readlink -f $0))"
@@ -110,21 +112,28 @@ echo "char gitinfo[128] = \"$(git rev-parse --verify HEAD)\";" >> ${versioninfo
echo "char buildinfo[512] = \"Built by ${USER} at ${build_time}\";" >> ${versioninfo}
# 2. cmake executable file
-#default use debug mode
-compile_mode="debug"
-if [[ $1 == "Release" ]] || [[ $1 == "release" ]]; then
- compile_mode="Release"
-fi
-compile_dir="${top_dir}/${compile_mode}"
+compile_dir="${top_dir}/debug"
if [ -d ${compile_dir} ]; then
- ${csudo} rm -rf ${compile_dir}
+ ${csudo} rm -rf ${compile_dir}
fi
${csudo} mkdir -p ${compile_dir}
cd ${compile_dir}
-${csudo} cmake -DCMAKE_BUILD_TYPE=${compile_mode} ${top_dir}
-${csudo} make
+
+# arm only support lite ver
+if [ -z "$armver" ]; then
+ cmake ${top_dir}/../
+elif [ "$armver" == "arm64" ]; then
+ cmake ${top_dir}/../ -DVERSION=lite -DARMVER=arm64
+elif [ "$armver" == "arm32" ]; then
+ cmake ${top_dir}/../ -DVERSION=lite -DARMVER=arm32
+else
+ echo "input parameter error!!!"
+ return
+fi
+
+make
cd ${curr_dir}
@@ -153,7 +162,8 @@ ${csudo} ./makerpm.sh ${compile_dir} ${output_dir} ${version}
echo "do tar.gz package for all systems"
cd ${script_dir}/tools
-${csudo} ./makepkg.sh ${compile_dir} ${version} "${build_time}"
+${csudo} ./makepkg.sh ${compile_dir} ${version} "${build_time}" ${armver}
+${csudo} ./makeclient.sh ${compile_dir} ${version} "${build_time}" ${armver}
# 4. Clean up temporary compile directories
#${csudo} rm -rf ${compile_dir}
diff --git a/packaging/rpm/tdengine.spec b/packaging/rpm/tdengine.spec
index 9ede4102e7..c0c0eacfae 100644
--- a/packaging/rpm/tdengine.spec
+++ b/packaging/rpm/tdengine.spec
@@ -39,8 +39,7 @@ echo topdir: %{_topdir}
echo version: %{_version}
echo buildroot: %{buildroot}
-versioninfo=$(%{_compiledir}/../packaging/tools/get_version.sh ../../src/util/src/version.c)
-libfile="libtaos.so.${versioninfo}"
+libfile="libtaos.so.%{_version}"
# create install path, and cp file
mkdir -p %{buildroot}%{homepath}/bin
@@ -80,18 +79,17 @@ fi
if pidof taosd &> /dev/null; then
if pidof systemd &> /dev/null; then
${csudo} systemctl stop taosd || :
- elif $(which insserv &> /dev/null); then
- ${csudo} service taosd stop || :
- elif $(which update-rc.d &> /dev/null); then
+ elif $(which service &> /dev/null); then
${csudo} service taosd stop || :
else
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 ${pid} || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
fi
echo "Stop taosd service success!"
sleep 1
fi
-
# if taos.cfg already softlink, remove it
if [ -f %{cfg_install_dir}/taos.cfg ]; then
${csudo} rm -f %{homepath}/cfg/taos.cfg || :
@@ -146,7 +144,9 @@ if [ $1 -eq 0 ];then
${csudo} rm -f ${data_link_dir} || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 ${pid} || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
fi
fi
diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh
index 4b653dec9c..2911452fb4 100755
--- a/packaging/tools/install.sh
+++ b/packaging/tools/install.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# This file is used to install TAOS time-series database on linux systems. The operating system
+# This file is used to install database on linux systems. The operating system
# is required to use systemd to manage services at boot
set -e
@@ -41,19 +41,58 @@ if command -v sudo > /dev/null; then
csudo="sudo"
fi
+initd_mod=0
service_mod=2
if pidof systemd &> /dev/null; then
service_mod=0
-elif $(which update-rc.d &> /dev/null); then
+elif $(which service &> /dev/null); then
service_mod=1
- service_config_dir="/etc/init.d"
+ service_config_dir="/etc/init.d"
+ if $(which chkconfig &> /dev/null); then
+ initd_mod=1
+ elif $(which insserv &> /dev/null); then
+ initd_mod=2
+ elif $(which update-rc.d &> /dev/null); then
+ initd_mod=3
+ else
+ service_mod=2
+ fi
else
service_mod=2
fi
+
+# get the operating system type for using the corresponding init file
+# ubuntu/debian(deb), centos/fedora(rpm), others: opensuse, redhat, ..., no verification
+#osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
+osinfo=$(cat /etc/os-release | grep "NAME" | cut -d '"' -f2)
+#echo "osinfo: ${osinfo}"
+os_type=0
+if echo $osinfo | grep -qwi "ubuntu" ; then
+ echo "this is ubuntu system"
+ os_type=1
+elif echo $osinfo | grep -qwi "debian" ; then
+ echo "this is debian system"
+ os_type=1
+elif echo $osinfo | grep -qwi "Kylin" ; then
+ echo "this is Kylin system"
+ os_type=1
+elif echo $osinfo | grep -qwi "centos" ; then
+ echo "this is centos system"
+ os_type=2
+elif echo $osinfo | grep -qwi "fedora" ; then
+ echo "this is fedora system"
+ os_type=2
+else
+ echo "this is other linux system"
+ os_type=0
+fi
+
function kill_taosd() {
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 pid || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
}
function install_main_path() {
@@ -81,7 +120,7 @@ function install_bin() {
#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/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/remove.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || :
@@ -89,7 +128,7 @@ function install_bin() {
function install_lib() {
# Remove links
- ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
+ ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
@@ -98,7 +137,7 @@ function install_lib() {
}
function install_header() {
- ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
@@ -107,16 +146,17 @@ function install_header() {
function install_config() {
#${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
- if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
+ if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
${csudo} mkdir -p ${cfg_install_dir}
[ -f ${script_dir}/cfg/taos.cfg ] && ${csudo} cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
${csudo} chmod 644 ${cfg_install_dir}/*
fi
${csudo} cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
- ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
+ ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
}
+
function install_log() {
${csudo} rm -rf ${log_dir} || :
${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
@@ -139,14 +179,26 @@ function install_examples() {
}
function clean_service_on_sysvinit() {
- restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+
if pidof taosd &> /dev/null; then
${csudo} service taosd stop || :
fi
- ${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+
+ if ((${initd_mod}==1)); then
+ ${csudo} chkconfig --del taosd || :
+ elif ((${initd_mod}==2)); then
+ ${csudo} insserv -r taosd || :
+ elif ((${initd_mod}==3)); then
+ ${csudo} update-rc.d -f taosd remove || :
+ fi
+
${csudo} rm -f ${service_config_dir}/taosd || :
- ${csudo} update-rc.d -f taosd remove || :
- ${csudo} init q || :
+
+ if $(which init &> /dev/null); then
+ ${csudo} init q || :
+ fi
}
function install_service_on_sysvinit() {
@@ -155,14 +207,27 @@ function install_service_on_sysvinit() {
sleep 1
# Install taosd service
- ${csudo} cp -f ${script_dir}/init.d/taosd ${install_main_dir}/init.d
- ${csudo} cp ${script_dir}/init.d/taosd ${service_config_dir} && ${csudo} chmod a+x ${service_config_dir}/taosd
- restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
- ${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
- # TODO: for centos, change here
- ${csudo} update-rc.d taosd defaults
- # chkconfig mysqld on
+ if ((${os_type}==1)); then
+ ${csudo} cp -f ${script_dir}/init.d/taosd.deb ${install_main_dir}/init.d/taosd
+ ${csudo} cp ${script_dir}/init.d/taosd.deb ${service_config_dir}/taosd && ${csudo} chmod a+x ${service_config_dir}/taosd
+ elif ((${os_type}==2)); then
+ ${csudo} cp -f ${script_dir}/init.d/taosd.rpm ${install_main_dir}/init.d/taosd
+ ${csudo} cp ${script_dir}/init.d/taosd.rpm ${service_config_dir}/taosd && ${csudo} chmod a+x ${service_config_dir}/taosd
+ fi
+
+ #restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+
+ if ((${initd_mod}==1)); then
+ ${csudo} chkconfig --add taosd || :
+ ${csudo} chkconfig --level 2345 taosd on || :
+ elif ((${initd_mod}==2)); then
+ ${csudo} insserv taosd || :
+ ${csudo} insserv -d taosd || :
+ elif ((${initd_mod}==3)); then
+ ${csudo} update-rc.d taosd defaults || :
+ fi
}
function clean_service_on_systemd() {
@@ -212,7 +277,7 @@ function install_service() {
elif ((${service_mod}==1)); then
install_service_on_sysvinit
else
- # must manual start taosd
+ # must manual stop taosd
kill_taosd
fi
}
@@ -266,7 +331,7 @@ function update_TDengine() {
echo "File taos.tar.gz does not exist"
exit 1
fi
- tar -zxf taos.tar.gz
+ tar -zxf taos.tar.gz
# Check if version compatible
if ! is_version_compatible; then
@@ -274,7 +339,7 @@ function update_TDengine() {
return 1
fi
- echo -e "${GREEN}Start to update TDEngine...${NC}"
+ echo -e "${GREEN}Start to update TDengine...${NC}"
# Stop the service if running
if pidof taosd &> /dev/null; then
if ((${service_mod}==0)); then
@@ -306,8 +371,7 @@ function update_TDengine() {
if ((${service_mod}==0)); then
echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} update-rc.d taosd default ${RED} for the first time${NC}"
- echo -e " : ${csudo} service taosd start ${RED} after${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}"
else
echo -e "${GREEN_DARK}To start TDengine ${NC}: ./taosd${NC}"
fi
@@ -316,7 +380,7 @@ function update_TDengine() {
echo
echo -e "\033[44;32;1mTDengine is updated successfully!${NC}"
else
- install_bin $1
+ install_bin
install_config
echo
@@ -332,9 +396,9 @@ function install_TDengine() {
echo "File taos.tar.gz does not exist"
exit 1
fi
- tar -zxf taos.tar.gz
+ tar -zxf taos.tar.gz
- echo -e "${GREEN}Start to install TDEngine...${NC}"
+ echo -e "${GREEN}Start to install TDengine...${NC}"
install_main_path
@@ -362,10 +426,9 @@ function install_TDengine() {
if ((${service_mod}==0)); then
echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}"
elif ((${service_mod}==1)); then
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} update-rc.d taosd default ${RED} for the first time${NC}"
- echo -e " : ${csudo} service taosd start ${RED} after${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}"
else
- echo -e "${GREEN_DARK}To start TDengine ${NC}: ./taosd${NC}"
+ echo -e "${GREEN_DARK}To start TDengine ${NC}: taosd${NC}"
fi
echo -e "${GREEN_DARK}To access TDengine ${NC}: use ${GREEN_UNDERLINE}taos${NC} in shell${NC}"
diff --git a/packaging/tools/install_client.sh b/packaging/tools/install_client.sh
index 39437c145e..7560ebca41 100755
--- a/packaging/tools/install_client.sh
+++ b/packaging/tools/install_client.sh
@@ -1,4 +1,201 @@
#!/bin/bash
+#
+# This file is used to install TDengine client on linux systems. The operating system
+# is required to use systemd to manage services at boot
+set -e
+#set -x
+
+# -----------------------Variables definition---------------------
script_dir=$(dirname $(readlink -m "$0"))
-${script_dir}/install.sh client
+# Dynamic directory
+data_dir="/var/lib/taos"
+log_dir="/var/log/taos"
+
+log_link_dir="/usr/local/taos/log"
+
+cfg_install_dir="/etc/taos"
+
+bin_link_dir="/usr/bin"
+lib_link_dir="/usr/lib"
+inc_link_dir="/usr/include"
+
+#install main path
+install_main_dir="/usr/local/taos"
+
+# old bin dir
+bin_dir="/usr/local/taos/bin"
+
+
+# Color setting
+RED='\033[0;31m'
+GREEN='\033[1;32m'
+GREEN_DARK='\033[0;32m'
+GREEN_UNDERLINE='\033[4;32m'
+NC='\033[0m'
+
+csudo=""
+if command -v sudo > /dev/null; then
+ csudo="sudo"
+fi
+
+update_flag=0
+
+function kill_client() {
+ pid=$(ps -ef | grep "taos" | grep -v "grep" | awk '{print $2}')
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
+}
+
+function install_main_path() {
+ #create install main dir and all sub dir
+ ${csudo} rm -rf ${install_main_dir} || :
+ ${csudo} mkdir -p ${install_main_dir}
+ ${csudo} mkdir -p ${install_main_dir}/cfg
+ ${csudo} mkdir -p ${install_main_dir}/bin
+ ${csudo} mkdir -p ${install_main_dir}/connector
+ ${csudo} mkdir -p ${install_main_dir}/driver
+ ${csudo} mkdir -p ${install_main_dir}/examples
+ ${csudo} mkdir -p ${install_main_dir}/include
+}
+
+function install_bin() {
+ # Remove links
+ ${csudo} rm -f ${bin_link_dir}/taos || :
+ ${csudo} rm -f ${bin_link_dir}/taosdump || :
+ ${csudo} rm -f ${bin_link_dir}/rmtaos || :
+
+ ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/*
+
+ #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/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || :
+ [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/rmtaos || :
+}
+
+function clean_lib() {
+ sudo rm -f /usr/lib/libtaos.so || :
+ sudo rm -rf ${lib_dir} || :
+}
+
+function install_lib() {
+ # Remove links
+ ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
+
+ ${csudo} cp -rf ${script_dir}/driver/* ${install_main_dir}/driver && ${csudo} chmod 777 ${install_main_dir}/driver/*
+
+ ${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
+
+}
+
+function install_header() {
+ ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taoserror.h || :
+ ${csudo} cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo} chmod 644 ${install_main_dir}/include/*
+ ${csudo} ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h
+ ${csudo} ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h
+}
+
+function install_config() {
+ #${csudo} rm -f ${install_main_dir}/cfg/taos.cfg || :
+
+ if [ ! -f ${cfg_install_dir}/taos.cfg ]; then
+ ${csudo} mkdir -p ${cfg_install_dir}
+ [ -f ${script_dir}/cfg/taos.cfg ] && ${csudo} cp ${script_dir}/cfg/taos.cfg ${cfg_install_dir}
+ ${csudo} chmod 644 ${cfg_install_dir}/*
+ fi
+
+ ${csudo} cp -f ${script_dir}/cfg/taos.cfg ${install_main_dir}/cfg/taos.cfg.org
+ ${csudo} ln -s ${cfg_install_dir}/taos.cfg ${install_main_dir}/cfg
+}
+
+
+function install_log() {
+ ${csudo} rm -rf ${log_dir} || :
+ ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir}
+
+ ${csudo} ln -s ${log_dir} ${install_main_dir}/log
+}
+
+function install_connector() {
+ ${csudo} cp -rf ${script_dir}/connector/* ${install_main_dir}/connector
+}
+
+function install_examples() {
+ if [ -d ${script_dir}/examples ]; then
+ ${csudo} cp -rf ${script_dir}/examples/* ${install_main_dir}/examples
+ fi
+}
+
+function update_TDengine() {
+ # Start to update
+ if [ ! -e taos.tar.gz ]; then
+ echo "File taos.tar.gz does not exist"
+ exit 1
+ fi
+ tar -zxf taos.tar.gz
+
+ echo -e "${GREEN}Start to update TDengine client...${NC}"
+ # Stop the client shell if running
+ if pidof taos &> /dev/null; then
+ kill_client
+ sleep 1
+ fi
+
+ install_main_path
+
+ install_log
+ install_header
+ install_lib
+ install_connector
+ install_examples
+ install_bin
+ install_config
+
+ echo
+ echo -e "\033[44;32;1mTDengine client is updated successfully!${NC}"
+
+ rm -rf $(tar -tf taos.tar.gz)
+}
+
+function install_TDengine() {
+ # Start to install
+ if [ ! -e taos.tar.gz ]; then
+ echo "File taos.tar.gz does not exist"
+ exit 1
+ fi
+ tar -zxf taos.tar.gz
+
+ echo -e "${GREEN}Start to install TDengine client...${NC}"
+
+ install_main_path
+ install_log
+ install_header
+ install_lib
+ install_connector
+ install_examples
+ install_bin
+ install_config
+
+ echo
+ echo -e "\033[44;32;1mTDengine client is installed successfully!${NC}"
+
+ rm -rf $(tar -tf taos.tar.gz)
+}
+
+
+## ==============================Main program starts from here============================
+# Install or updata client and client
+# if server is already install, don't install client
+ if [ -e ${bin_dir}/taosd ]; then
+ echo -e "\033[44;32;1mThere are already installed TDengine server, so don't need install client!${NC}"
+ exit 0
+ fi
+
+ if [ -x ${bin_dir}/taos ]; then
+ update_flag=1
+ update_TDengine
+ else
+ install_TDengine
+ fi
diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh
new file mode 100755
index 0000000000..0e52e0970a
--- /dev/null
+++ b/packaging/tools/makeclient.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+#
+# Generate tar.gz package for linux client
+set -e
+set -x
+
+curr_dir=$(pwd)
+compile_dir=$1
+version=$2
+build_time=$3
+armver=$4
+
+script_dir="$(dirname $(readlink -f $0))"
+top_dir="$(readlink -m ${script_dir}/../..)"
+
+# create compressed install file.
+build_dir="${compile_dir}/build"
+code_dir="${top_dir}/src"
+release_dir="${top_dir}/release"
+community_dir="${script_dir}/../../../community/src"
+
+package_name='linux'
+install_dir="${release_dir}/TDengine-client-enterprise-${version}-${package_name}-$(echo ${build_time}| tr ': ' -)"
+
+# Directories and files.
+bin_files="${build_dir}/bin/taos ${build_dir}/bin/taosdump ${script_dir}/remove_client.sh"
+lib_files="${build_dir}/lib/libtaos.so.${version}"
+header_files="${community_dir}/inc/taos.h ${community_dir}/inc/taoserror.h"
+cfg_dir="${top_dir}/packaging/cfg"
+install_files="${script_dir}/install_client.sh"
+
+# make directories.
+mkdir -p ${install_dir}
+mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc
+mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/taos.cfg ${install_dir}/cfg/taos.cfg
+mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/*
+
+cd ${install_dir}
+tar -zcv -f taos.tar.gz * --remove-files || :
+
+cd ${curr_dir}
+cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install*
+
+# Copy example code
+mkdir -p ${install_dir}/examples
+cp -r ${top_dir}/tests/examples/c ${install_dir}/examples
+cp -r ${top_dir}/tests/examples/JDBC ${install_dir}/examples
+cp -r ${top_dir}/tests/examples/matlab ${install_dir}/examples
+cp -r ${top_dir}/tests/examples/python ${install_dir}/examples
+cp -r ${top_dir}/tests/examples/R ${install_dir}/examples
+cp -r ${top_dir}/tests/examples/go ${install_dir}/examples
+
+# Copy driver
+mkdir -p ${install_dir}/driver
+cp ${lib_files} ${install_dir}/driver
+
+# Copy connector
+connector_dir="${community_dir}/connector"
+mkdir -p ${install_dir}/connector
+cp ${build_dir}/lib/*.jar ${install_dir}/connector
+cp -r ${connector_dir}/grafana ${install_dir}/connector/
+cp -r ${connector_dir}/python ${install_dir}/connector/
+cp -r ${connector_dir}/go ${install_dir}/connector
+
+# Copy release note
+# cp ${script_dir}/release_note ${install_dir}
+
+# exit 1
+
+cd ${release_dir}
+if [ -z "$armver" ]; then
+ tar -zcv -f "$(basename ${install_dir}).tar.gz" $(basename ${install_dir}) --remove-files
+elif [ "$armver" == "arm64" ]; then
+ tar -zcv -f "$(basename ${install_dir})-arm64.tar.gz" $(basename ${install_dir}) --remove-files
+elif [ "$armver" == "arm32" ]; then
+ tar -zcv -f "$(basename ${install_dir})-arm32.tar.gz" $(basename ${install_dir}) --remove-files
+fi
+
+cd ${curr_dir}
diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh
index 967b14cee9..24f3a0b8d1 100755
--- a/packaging/tools/makepkg.sh
+++ b/packaging/tools/makepkg.sh
@@ -6,6 +6,7 @@ curr_dir=$(pwd)
compile_dir=$1
version=$2
build_time=$3
+armver=$4
script_dir="$(dirname $(readlink -f $0))"
top_dir="$(readlink -m ${script_dir}/../..)"
@@ -20,11 +21,10 @@ install_dir="${release_dir}/taos-${version}-${package_name}-$(echo ${build_time}
# Directories and files.
bin_files="${build_dir}/bin/taosd ${build_dir}/bin/taos ${build_dir}/bin/taosdemo ${build_dir}/bin/taosdump ${script_dir}/remove.sh"
-versioninfo=$(${script_dir}/get_version.sh ${code_dir}/util/src/version.c)
-lib_files="${build_dir}/lib/libtaos.so.${versioninfo}"
+lib_files="${build_dir}/lib/libtaos.so.${version}"
header_files="${code_dir}/inc/taos.h ${code_dir}/inc/taoserror.h"
-cfg_files="${top_dir}/packaging/cfg/*.cfg"
-install_files="${script_dir}/install.sh ${script_dir}/install_client.sh"
+cfg_dir="${top_dir}/packaging/cfg"
+install_files="${script_dir}/install.sh"
# Init file
#init_dir=${script_dir}/deb
@@ -33,29 +33,32 @@ install_files="${script_dir}/install.sh ${script_dir}/install_client.sh"
#fi
#init_files=${init_dir}/taosd
# temp use rpm's taosd. TODO: later modify according to os type
-init_files=${script_dir}/../rpm/taosd
+init_file_deb=${script_dir}/../deb/taosd
+init_file_rpm=${script_dir}/../rpm/taosd
# make directories.
mkdir -p ${install_dir}
mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc
-mkdir -p ${install_dir}/cfg && cp ${cfg_files} ${install_dir}/cfg
+mkdir -p ${install_dir}/cfg && cp ${cfg_dir}/taos.cfg ${install_dir}/cfg/taos.cfg
mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/*
-mkdir -p ${install_dir}/init.d && cp ${init_files} ${install_dir}/init.d
+mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/taosd.deb
+mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/taosd.rpm
cd ${install_dir}
-tar -zcv -f taos.tar.gz * --remove-files || :
+tar -zcv -f taos.tar.gz * --remove-files || :
cd ${curr_dir}
cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install*
# Copy example code
mkdir -p ${install_dir}/examples
-cp -r ${top_dir}/tests/examples/c ${install_dir}/examples
-cp -r ${top_dir}/tests/examples/JDBC ${install_dir}/examples
-cp -r ${top_dir}/tests/examples/matlab ${install_dir}/examples
-cp -r ${top_dir}/tests/examples/python ${install_dir}/examples
-cp -r ${top_dir}/tests/examples/R ${install_dir}/examples
-cp -r ${top_dir}/tests/examples/go ${install_dir}/examples
+examples_dir="${top_dir}/tests/examples"
+cp -r ${examples_dir}/c ${install_dir}/examples
+cp -r ${examples_dir}/JDBC ${install_dir}/examples
+cp -r ${examples_dir}/matlab ${install_dir}/examples
+cp -r ${examples_dir}/python ${install_dir}/examples
+cp -r ${examples_dir}/R ${install_dir}/examples
+cp -r ${examples_dir}/go ${install_dir}/examples
# Copy driver
mkdir -p ${install_dir}/driver
@@ -64,18 +67,23 @@ cp ${lib_files} ${install_dir}/driver
# Copy connector
connector_dir="${code_dir}/connector"
mkdir -p ${install_dir}/connector
+cp ${build_dir}/lib/*.jar ${install_dir}/connector
cp -r ${connector_dir}/grafana ${install_dir}/connector/
cp -r ${connector_dir}/python ${install_dir}/connector/
cp -r ${connector_dir}/go ${install_dir}/connector
-cp ${build_dir}/lib/*.jar ${install_dir}/connector
-
# Copy release note
-cp ${script_dir}/release_note ${install_dir}
+# cp ${script_dir}/release_note ${install_dir}
# exit 1
cd ${release_dir}
-tar -zcv -f "$(basename ${install_dir}).tar.gz" $(basename ${install_dir}) --remove-files
+if [ -z "$armver" ]; then
+ tar -zcv -f "$(basename ${install_dir}).tar.gz" $(basename ${install_dir}) --remove-files
+elif [ "$armver" == "arm64" ]; then
+ tar -zcv -f "$(basename ${install_dir})-arm64.tar.gz" $(basename ${install_dir}) --remove-files
+elif [ "$armver" == "arm32" ]; then
+ tar -zcv -f "$(basename ${install_dir})-arm32.tar.gz" $(basename ${install_dir}) --remove-files
+fi
cd ${curr_dir}
diff --git a/packaging/tools/post.sh b/packaging/tools/post.sh
index 11f3ab9a9b..a62f7a5eeb 100755
--- a/packaging/tools/post.sh
+++ b/packaging/tools/post.sh
@@ -42,14 +42,18 @@ initd_mod=0
service_mod=2
if pidof systemd &> /dev/null; then
service_mod=0
-elif $(which insserv &> /dev/null); then
+elif $(which service &> /dev/null); then
service_mod=1
- initd_mod=1
- service_config_dir="/etc/init.d"
-elif $(which update-rc.d &> /dev/null); then
- service_mod=1
- initd_mod=2
- service_config_dir="/etc/init.d"
+ service_config_dir="/etc/init.d"
+ if $(which chkconfig &> /dev/null); then
+ initd_mod=1
+ elif $(which insserv &> /dev/null); then
+ initd_mod=2
+ elif $(which update-rc.d &> /dev/null); then
+ initd_mod=3
+ else
+ service_mod=2
+ fi
else
service_mod=2
fi
@@ -57,7 +61,9 @@ fi
function kill_taosd() {
# ${csudo} pkill -f taosd || :
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 ${pid} || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
}
function install_include() {
@@ -103,20 +109,26 @@ function install_config() {
}
function clean_service_on_sysvinit() {
- restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+
if pidof taosd &> /dev/null; then
${csudo} service taosd stop || :
fi
- ${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
- ${csudo} rm -f ${service_config_dir}/taosd || :
-
+
if ((${initd_mod}==1)); then
- ${csudo} grep -q -F "taos" /etc/inittab && ${csudo} insserv -r taosd || :
+ ${csudo} chkconfig --del taosd || :
elif ((${initd_mod}==2)); then
- ${csudo} grep -q -F "taos" /etc/inittab && ${csudo} update-rc.d -f taosd remove || :
+ ${csudo} insserv -r taosd || :
+ elif ((${initd_mod}==3)); then
+ ${csudo} update-rc.d -f taosd remove || :
+ fi
+
+ ${csudo} rm -f ${service_config_dir}/taosd || :
+
+ if $(which init &> /dev/null); then
+ ${csudo} init q || :
fi
-# ${csudo} update-rc.d -f taosd remove || :
- ${csudo} init q || :
}
function install_service_on_sysvinit() {
@@ -127,18 +139,24 @@ function install_service_on_sysvinit() {
# Install taosd service
${csudo} cp %{init_d_dir}/taosd ${service_config_dir} && ${csudo} chmod a+x ${service_config_dir}/taosd
- restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
-
- ${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
- # TODO: for centos, change here
- ${csudo} update-rc.d taosd defaults
- # chkconfig mysqld on
+ #restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #${csudo} grep -q -F "$restart_config_str" /etc/inittab || ${csudo} bash -c "echo '${restart_config_str}' >> /etc/inittab"
+
+ if ((${initd_mod}==1)); then
+ ${csudo} chkconfig --add taosd || :
+ ${csudo} chkconfig --level 2345 taosd on || :
+ elif ((${initd_mod}==2)); then
+ ${csudo} insserv taosd || :
+ ${csudo} insserv -d taosd || :
+ elif ((${initd_mod}==3)); then
+ ${csudo} update-rc.d taosd defaults || :
+ fi
}
function clean_service_on_systemd() {
taosd_service_config="${service_config_dir}/taosd.service"
- # taosd service already is stoped before install
+ # taosd service already is stoped before install in preinst script
#if systemctl is-active --quiet taosd; then
# echo "TDengine is running, stopping it..."
# ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null
diff --git a/packaging/tools/preun.sh b/packaging/tools/preun.sh
index a08f4e304e..0533410802 100755
--- a/packaging/tools/preun.sh
+++ b/packaging/tools/preun.sh
@@ -26,22 +26,27 @@ initd_mod=0
service_mod=2
if pidof systemd &> /dev/null; then
service_mod=0
-elif $(which insserv &> /dev/null); then
+elif $(which service &> /dev/null); then
service_mod=1
- initd_mod=1
- service_config_dir="/etc/init.d"
-elif $(which update-rc.d &> /dev/null); then
- service_mod=1
- initd_mod=2
- service_config_dir="/etc/init.d"
+ service_config_dir="/etc/init.d"
+ if $(which chkconfig &> /dev/null); then
+ initd_mod=1
+ elif $(which insserv &> /dev/null); then
+ initd_mod=2
+ elif $(which update-rc.d &> /dev/null); then
+ initd_mod=3
+ else
+ service_mod=2
+ fi
else
service_mod=2
fi
-
function kill_taosd() {
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 ${pid} || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
}
function clean_service_on_systemd() {
@@ -57,20 +62,27 @@ function clean_service_on_systemd() {
}
function clean_service_on_sysvinit() {
- restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+
if pidof taosd &> /dev/null; then
+ echo "TDengine taosd is running, stopping it..."
${csudo} service taosd stop || :
fi
- ${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
- ${csudo} rm -f ${service_config_dir}/taosd || :
if ((${initd_mod}==1)); then
- ${csudo} grep -q -F "taos" /etc/inittab && ${csudo} insserv -r taosd || :
+ ${csudo} chkconfig --del taosd || :
elif ((${initd_mod}==2)); then
- ${csudo} grep -q -F "taos" /etc/inittab && ${csudo} update-rc.d -f taosd remove || :
+ ${csudo} insserv -r taosd || :
+ elif ((${initd_mod}==3)); then
+ ${csudo} update-rc.d -f taosd remove || :
+ fi
+
+ ${csudo} rm -f ${service_config_dir}/taosd || :
+
+ if $(which init &> /dev/null); then
+ ${csudo} init q || :
fi
-# ${csudo} update-rc.d -f taosd remove || :
- ${csudo} init q || :
}
function clean_service() {
@@ -79,7 +91,7 @@ function clean_service() {
elif ((${service_mod}==1)); then
clean_service_on_sysvinit
else
- # must manual start taosd
+ # must manual stop taosd
kill_taosd
fi
}
diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh
index 6c2c6d5ea8..3c9fd6bf7f 100755
--- a/packaging/tools/remove.sh
+++ b/packaging/tools/remove.sh
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Script to stop the service and uninstall tdengine, but retain the config, data and log files.
+# Script to stop the service and uninstall TDengine, but retain the config, data and log files.
RED='\033[0;31m'
GREEN='\033[1;32m'
@@ -27,21 +27,27 @@ initd_mod=0
service_mod=2
if pidof systemd &> /dev/null; then
service_mod=0
-elif $(which insserv &> /dev/null); then
+elif $(which service &> /dev/null); then
service_mod=1
- initd_mod=1
- service_config_dir="/etc/init.d"
-elif $(which update-rc.d &> /dev/null); then
- service_mod=1
- initd_mod=2
- service_config_dir="/etc/init.d"
+ service_config_dir="/etc/init.d"
+ if $(which chkconfig &> /dev/null); then
+ initd_mod=1
+ elif $(which insserv &> /dev/null); then
+ initd_mod=2
+ elif $(which update-rc.d &> /dev/null); then
+ initd_mod=3
+ else
+ service_mod=2
+ fi
else
service_mod=2
fi
function kill_taosd() {
pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}')
- ${csudo} kill -9 ${pid} || :
+ if [ -n "$pid" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
}
function clean_bin() {
@@ -87,20 +93,27 @@ function clean_service_on_systemd() {
}
function clean_service_on_sysvinit() {
- restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #restart_config_str="taos:2345:respawn:${service_config_dir}/taosd start"
+ #${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
+
if pidof taosd &> /dev/null; then
+ echo "TDengine taosd is running, stopping it..."
${csudo} service taosd stop || :
fi
- ${csudo} sed -i "\|${restart_config_str}|d" /etc/inittab || :
- ${csudo} rm -f ${service_config_dir}/taosd || :
if ((${initd_mod}==1)); then
- ${csudo} grep -q -F "taos" /etc/inittab && ${csudo} insserv -r taosd || :
+ ${csudo} chkconfig --del taosd || :
elif ((${initd_mod}==2)); then
- ${csudo} grep -q -F "taos" /etc/inittab && ${csudo} update-rc.d -f taosd remove || :
+ ${csudo} insserv -r taosd || :
+ elif ((${initd_mod}==3)); then
+ ${csudo} update-rc.d -f taosd remove || :
+ fi
+
+ ${csudo} rm -f ${service_config_dir}/taosd || :
+
+ if $(which init &> /dev/null); then
+ ${csudo} init q || :
fi
-# ${csudo} update-rc.d -f taosd remove || :
- ${csudo} init q || :
}
function clean_service() {
@@ -109,7 +122,7 @@ function clean_service() {
elif ((${service_mod}==1)); then
clean_service_on_sysvinit
else
- # must manual start taosd
+ # must manual stop taosd
kill_taosd
fi
}
@@ -140,4 +153,4 @@ elif echo $osinfo | grep -qwi "centos" ; then
${csudo} rpm -e --noscripts tdengine || :
fi
-echo -e "${GREEN}TDEngine is removed successfully!${NC}"
+echo -e "${GREEN}TDengine is removed successfully!${NC}"
diff --git a/packaging/tools/remove_client.sh b/packaging/tools/remove_client.sh
new file mode 100755
index 0000000000..206de34c1f
--- /dev/null
+++ b/packaging/tools/remove_client.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+# Script to stop the client and uninstall database, but retain the config and log files.
+set -e
+# set -x
+
+RED='\033[0;31m'
+GREEN='\033[1;32m'
+NC='\033[0m'
+
+#install main path
+install_main_dir="/usr/local/taos"
+
+log_link_dir="/usr/local/taos/log"
+cfg_link_dir="/usr/local/taos/cfg"
+bin_link_dir="/usr/bin"
+lib_link_dir="/usr/lib"
+inc_link_dir="/usr/include"
+
+csudo=""
+if command -v sudo > /dev/null; then
+ csudo="sudo"
+fi
+
+function kill_client() {
+ #pid=$(ps -ef | grep "taos" | grep -v "grep" | awk '{print $2}')
+ if [ -n "$(pidof taos)" ]; then
+ ${csudo} kill -9 $pid || :
+ fi
+}
+
+function clean_bin() {
+ # Remove link
+ ${csudo} rm -f ${bin_link_dir}/taos || :
+ ${csudo} rm -f ${bin_link_dir}/taosump || :
+ ${csudo} rm -f ${bin_link_dir}/rmtaos || :
+}
+
+function clean_lib() {
+ # Remove link
+ ${csudo} rm -f ${lib_link_dir}/libtaos.* || :
+}
+
+function clean_header() {
+ # Remove link
+ ${csudo} rm -f ${inc_link_dir}/taos.h || :
+ ${csudo} rm -f ${inc_link_dir}/taoserror.h || :
+}
+
+function clean_config() {
+ # Remove link
+ ${csudo} rm -f ${cfg_link_dir}/* || :
+}
+
+function clean_log() {
+ # Remove link
+ ${csudo} rm -rf ${log_link_dir} || :
+}
+
+# Stop client.
+kill_client
+# Remove binary file and links
+clean_bin
+# Remove header file.
+clean_header
+# Remove lib file
+clean_lib
+# Remove link log directory
+clean_log
+# Remove link configuration file
+clean_config
+
+${csudo} rm -rf ${install_main_dir}
+
+echo -e "${GREEN}TDengine client is removed successfully!${NC}"
diff --git a/src/client/inc/tscCache.h b/src/client/inc/tscCache.h
index 096a6618f6..4c6acec096 100644
--- a/src/client/inc/tscCache.h
+++ b/src/client/inc/tscCache.h
@@ -24,9 +24,9 @@ void *taosOpenConnCache(int maxSessions, void (*cleanFp)(void *), void *tmrCtrl,
void taosCloseConnCache(void *handle);
-void *taosAddConnIntoCache(void *handle, void *data, uint32_t ip, short port, char *user);
+void *taosAddConnIntoCache(void *handle, void *data, uint32_t ip, uint16_t port, char *user);
-void *taosGetConnFromCache(void *handle, uint32_t ip, short port, char *user);
+void *taosGetConnFromCache(void *handle, uint32_t ip, uint16_t port, char *user);
#ifdef __cplusplus
}
diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h
index a0c16f062d..6666fa24a6 100644
--- a/src/client/inc/tscUtil.h
+++ b/src/client/inc/tscUtil.h
@@ -106,6 +106,8 @@ void tscAddSpecialColumnForSelect(SSqlCmd* pCmd, int32_t outputColIndex, int16_t
SSchema* pColSchema, int16_t isTag);
void addRequiredTagColumn(SSqlCmd* pCmd, int32_t tagColIndex, int32_t tableIndex);
+
+//TODO refactor, remove
void SStringFree(SString* str);
void SStringCopy(SString* pDest, const SString* pSrc);
SString SStringCreate(const char* str);
@@ -125,7 +127,7 @@ int tscAllocPayload(SSqlCmd* pCmd, int size);
void tscFieldInfoSetValFromSchema(SFieldInfo* pFieldInfo, int32_t index, SSchema* pSchema);
void tscFieldInfoSetValFromField(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* pField);
-void tscFieldInfoSetValue(SFieldInfo* pFieldInfo, int32_t index, int8_t type, char* name, int16_t bytes);
+void tscFieldInfoSetValue(SFieldInfo* pFieldInfo, int32_t index, int8_t type, const char* name, int16_t bytes);
void tscFieldInfoUpdateVisible(SFieldInfo* pFieldInfo, int32_t index, bool visible);
void tscFieldInfoCalOffset(SSqlCmd* pCmd);
@@ -141,7 +143,9 @@ void tscClearFieldInfo(SFieldInfo* pFieldInfo);
void addExprParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes, int16_t tableIndex);
SSqlExpr* tscSqlExprInsert(SSqlCmd* pCmd, int32_t index, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
- int16_t size, /*int16_t colId,*/ int16_t interSize);
+ int16_t size, int16_t interSize);
+SSqlExpr* tscSqlExprInsertEmpty(SSqlCmd* pCmd, int32_t index, int16_t functionId);
+
SSqlExpr* tscSqlExprUpdate(SSqlCmd* pCmd, int32_t index, int16_t functionId, int16_t srcColumnIndex, int16_t type,
int16_t size);
@@ -224,7 +228,7 @@ void doAddGroupColumnForSubquery(SSqlCmd* pCmd, int32_t tagIndex);
int16_t tscGetJoinTagColIndexByUid(SSqlCmd* pCmd, uint64_t uid);
-TAOS* taos_connect_a(char* ip, char* user, char* pass, char* db, int port, void (*fp)(void*, TAOS_RES*, int),
+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 sortRemoveDuplicates(STableDataBlocks* dataBuf);
diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h
index 44bfc978a3..e074a115a8 100644
--- a/src/client/inc/tsclient.h
+++ b/src/client/inc/tsclient.h
@@ -92,7 +92,12 @@ enum _sql_cmd {
*/
TSDB_SQL_RETRIEVE_EMPTY_RESULT,
- TSDB_SQL_RESET_CACHE,
+ TSDB_SQL_RESET_CACHE, // 40
+ TSDB_SQL_SERV_STATUS,
+ TSDB_SQL_CURRENT_DB,
+ TSDB_SQL_SERV_VERSION,
+ TSDB_SQL_CLI_VERSION,
+ TSDB_SQL_CURRENT_USER,
TSDB_SQL_CFG_LOCAL,
TSDB_SQL_MAX
@@ -342,11 +347,11 @@ typedef struct _tsc_obj {
void * signature;
void * pTimer;
char mgmtIp[TSDB_USER_LEN];
- short mgmtPort;
+ uint16_t mgmtPort;
char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN];
char acctId[TSDB_DB_NAME_LEN];
- char db[TSDB_DB_NAME_LEN];
+ char db[TSDB_METER_ID_LEN];
char sversion[TSDB_VERSION_LEN];
char writeAuth : 1;
char superAuth : 1;
diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c
index aad0295959..8b324afc5e 100644
--- a/src/client/src/tscAsync.c
+++ b/src/client/src/tscAsync.c
@@ -24,6 +24,7 @@
#include "tsocket.h"
#include "tsql.h"
#include "tutil.h"
+#include "tnote.h"
void tscProcessFetchRow(SSchedMsg *pMsg);
void tscProcessAsyncRetrieve(void *param, TAOS_RES *tres, int numOfRows);
@@ -53,7 +54,9 @@ void taos_query_a(TAOS *taos, const char *sqlstr, void (*fp)(void *, TAOS_RES *,
tscError("sql string too long");
tscQueueAsyncError(fp, param);
return;
- }
+ }
+
+ taosNotePrintTsc(sqlstr);
SSqlObj *pSql = (SSqlObj *)malloc(sizeof(SSqlObj));
if (pSql == NULL) {
diff --git a/src/client/src/tscCache.c b/src/client/src/tscCache.c
index f508857ce1..1ac32d7502 100644
--- a/src/client/src/tscCache.c
+++ b/src/client/src/tscCache.c
@@ -25,7 +25,7 @@
typedef struct _c_hash_t {
uint32_t ip;
- short port;
+ uint16_t port;
struct _c_hash_t *prev;
struct _c_hash_t *next;
void * data;
@@ -45,14 +45,14 @@ typedef struct {
void *pTimer;
} SConnCache;
-int taosHashConn(void *handle, uint32_t ip, short port, char *user) {
+int taosHashConn(void *handle, uint32_t ip, uint16_t port, char *user) {
SConnCache *pObj = (SConnCache *)handle;
int hash = 0;
// size_t user_len = strlen(user);
hash = ip >> 16;
hash += (unsigned short)(ip & 0xFFFF);
- hash += (unsigned short)port;
+ hash += port;
while (*user != '\0') {
hash += *user;
user++;
@@ -74,7 +74,7 @@ void taosRemoveExpiredNodes(SConnCache *pObj, SConnHash *pNode, int hash, uint64
pNext = pNode->next;
pObj->total--;
pObj->count[hash]--;
- tscTrace("%p ip:0x%x:%d:%d:%p removed, connections in cache:%d", pNode->data, pNode->ip, pNode->port, hash, pNode,
+ tscTrace("%p ip:0x%x:%hu:%d:%p removed, connections in cache:%d", pNode->data, pNode->ip, pNode->port, hash, pNode,
pObj->count[hash]);
taosMemPoolFree(pObj->connHashMemPool, (char *)pNode);
pNode = pNext;
@@ -86,7 +86,7 @@ void taosRemoveExpiredNodes(SConnCache *pObj, SConnHash *pNode, int hash, uint64
pObj->connHashList[hash] = NULL;
}
-void *taosAddConnIntoCache(void *handle, void *data, uint32_t ip, short port, char *user) {
+void *taosAddConnIntoCache(void *handle, void *data, uint32_t ip, uint16_t port, char *user) {
int hash;
SConnHash * pNode;
SConnCache *pObj;
@@ -125,7 +125,7 @@ void *taosAddConnIntoCache(void *handle, void *data, uint32_t ip, short port, ch
pthread_mutex_unlock(&pObj->mutex);
- tscTrace("%p ip:0x%x:%d:%d:%p added, connections in cache:%d", data, ip, port, hash, pNode, pObj->count[hash]);
+ tscTrace("%p ip:0x%x:%hu:%d:%p added, connections in cache:%d", data, ip, port, hash, pNode, pObj->count[hash]);
return pObj;
}
@@ -152,7 +152,7 @@ void taosCleanConnCache(void *handle, void *tmrId) {
taosTmrReset(taosCleanConnCache, pObj->keepTimer * 2, pObj, pObj->tmrCtrl, &pObj->pTimer);
}
-void *taosGetConnFromCache(void *handle, uint32_t ip, short port, char *user) {
+void *taosGetConnFromCache(void *handle, uint32_t ip, uint16_t port, char *user) {
int hash;
SConnHash * pNode;
SConnCache *pObj;
@@ -201,7 +201,7 @@ void *taosGetConnFromCache(void *handle, uint32_t ip, short port, char *user) {
pthread_mutex_unlock(&pObj->mutex);
if (pData) {
- tscTrace("%p ip:0x%x:%d:%d:%p retrieved, connections in cache:%d", pData, ip, port, hash, pNode, pObj->count[hash]);
+ tscTrace("%p ip:0x%x:%hu:%d:%p retrieved, connections in cache:%d", pData, ip, port, hash, pNode, pObj->count[hash]);
}
return pData;
diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c
index d217d09588..5ae72acd57 100644
--- a/src/client/src/tscLocal.c
+++ b/src/client/src/tscLocal.c
@@ -26,7 +26,9 @@
#include "tschemautil.h"
#include "tsocket.h"
-static int32_t getToStringLength(char *pData, int32_t length, int32_t type) {
+static void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnName, size_t valueLength);
+
+static int32_t getToStringLength(const char *pData, int32_t length, int32_t type) {
char buf[512] = {0};
int32_t len = 0;
@@ -39,7 +41,7 @@ static int32_t getToStringLength(char *pData, int32_t length, int32_t type) {
case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0;
- *(int64_t*)(&dv) = *(int64_t*)pData;
+ *(int64_t *)(&dv) = *(int64_t *)pData;
len = sprintf(buf, "%f", dv);
#else
len = sprintf(buf, "%lf", *(double *)pData);
@@ -47,12 +49,11 @@ static int32_t getToStringLength(char *pData, int32_t length, int32_t type) {
if (strncasecmp("nan", buf, 3) == 0) {
len = 4;
}
- }
- break;
+ } break;
case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0;
- *(int32_t*)(&fv) = *(int32_t*)pData;
+ *(int32_t *)(&fv) = *(int32_t *)pData;
len = sprintf(buf, "%f", fv);
#else
len = sprintf(buf, "%f", *(float *)pData);
@@ -60,8 +61,7 @@ static int32_t getToStringLength(char *pData, int32_t length, int32_t type) {
if (strncasecmp("nan", buf, 3) == 0) {
len = 4;
}
- }
- break;
+ } break;
case TSDB_DATA_TYPE_TIMESTAMP:
case TSDB_DATA_TYPE_BIGINT:
len = sprintf(buf, "%lld", *(int64_t *)pData);
@@ -203,23 +203,21 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
case TSDB_DATA_TYPE_FLOAT: {
#ifdef _TD_ARM_32_
float fv = 0;
- *(int32_t*)(&fv) = *(int32_t*)pTagValue;
+ *(int32_t *)(&fv) = *(int32_t *)pTagValue;
sprintf(target, "%f", fv);
#else
sprintf(target, "%f", *(float *)pTagValue);
#endif
- }
- break;
+ } break;
case TSDB_DATA_TYPE_DOUBLE: {
#ifdef _TD_ARM_32_
double dv = 0;
- *(int64_t*)(&dv) = *(int64_t*)pTagValue;
+ *(int64_t *)(&dv) = *(int64_t *)pTagValue;
sprintf(target, "%lf", dv);
#else
sprintf(target, "%lf", *(double *)pTagValue);
#endif
- }
- break;
+ } break;
case TSDB_DATA_TYPE_TINYINT:
sprintf(target, "%d", *(int8_t *)pTagValue);
break;
@@ -391,6 +389,68 @@ static int tscProcessQueryTags(SSqlObj *pSql) {
}
}
+static void tscProcessCurrentUser(SSqlObj *pSql) {
+ SSqlExpr* pExpr = tscSqlExprGet(&pSql->cmd, 0);
+ tscSetLocalQueryResult(pSql, pSql->pTscObj->user, pExpr->aliasName, TSDB_USER_LEN);
+}
+
+static void tscProcessCurrentDB(SSqlObj *pSql) {
+ char db[TSDB_DB_NAME_LEN + 1] = {0};
+ extractDBName(pSql->pTscObj->db, db);
+
+ // no use db is invoked before.
+ if (strlen(db) == 0) {
+ setNull(db, TSDB_DATA_TYPE_BINARY, TSDB_DB_NAME_LEN);
+ }
+
+ SSqlExpr* pExpr = tscSqlExprGet(&pSql->cmd, 0);
+ tscSetLocalQueryResult(pSql, db, pExpr->aliasName, TSDB_DB_NAME_LEN);
+}
+
+static void tscProcessServerVer(SSqlObj *pSql) {
+ const char* v = pSql->pTscObj->sversion;
+
+ SSqlExpr* pExpr = tscSqlExprGet(&pSql->cmd, 0);
+ tscSetLocalQueryResult(pSql, v, pExpr->aliasName, tListLen(pSql->pTscObj->sversion));
+}
+
+static void tscProcessClientVer(SSqlObj *pSql) {
+ SSqlExpr* pExpr = tscSqlExprGet(&pSql->cmd, 0);
+ tscSetLocalQueryResult(pSql, version, pExpr->aliasName, strlen(version));
+}
+
+static void tscProcessServStatus(SSqlObj *pSql) {
+ STscObj* pObj = pSql->pTscObj;
+
+ if (pObj->pHb != NULL) {
+ if (pObj->pHb->res.code == TSDB_CODE_NETWORK_UNAVAIL) {
+ pSql->res.code = TSDB_CODE_NETWORK_UNAVAIL;
+ return;
+ }
+ } else {
+ if (pSql->res.code == TSDB_CODE_NETWORK_UNAVAIL) {
+ return;
+ }
+ }
+
+ SSqlExpr* pExpr = tscSqlExprGet(&pSql->cmd, 0);
+ tscSetLocalQueryResult(pSql, "1", pExpr->aliasName, 2);
+}
+
+void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnName, size_t valueLength) {
+ SSqlCmd *pCmd = &pSql->cmd;
+ SSqlRes *pRes = &pSql->res;
+
+ pCmd->numOfCols = 1;
+ pCmd->order.order = TSQL_SO_ASC;
+
+ tscFieldInfoSetValue(&pCmd->fieldsInfo, 0, TSDB_DATA_TYPE_BINARY, columnName, valueLength);
+ tscInitResObjForLocalQuery(pSql, 1, valueLength);
+
+ TAOS_FIELD *pField = tscFieldInfoGetField(pCmd, 0);
+ strncpy(pRes->data, val, pField->bytes);
+}
+
int tscProcessLocalCmd(SSqlObj *pSql) {
SSqlCmd *pCmd = &pSql->cmd;
@@ -402,13 +462,23 @@ int tscProcessLocalCmd(SSqlObj *pSql) {
pSql->res.code = (uint8_t)tscProcessQueryTags(pSql);
} else if (pCmd->command == TSDB_SQL_RETRIEVE_EMPTY_RESULT) {
/*
- * pass the qhandle check, in order to call partial release function to
- * free allocated resources and remove the SqlObj from linked list
+ * set the qhandle to be 1 in order to pass the qhandle check, and to call partial release function to
+ * free allocated resources and remove the SqlObj from sql query linked list
*/
- pSql->res.qhandle = 0x1; // pass the qhandle check
+ pSql->res.qhandle = 0x1;
pSql->res.numOfRows = 0;
} else if (pCmd->command == TSDB_SQL_RESET_CACHE) {
taosClearDataCache(tscCacheHandle);
+ } else if (pCmd->command == TSDB_SQL_SERV_VERSION) {
+ tscProcessServerVer(pSql);
+ } else if (pCmd->command == TSDB_SQL_CLI_VERSION) {
+ tscProcessClientVer(pSql);
+ } else if (pCmd->command == TSDB_SQL_CURRENT_USER) {
+ tscProcessCurrentUser(pSql);
+ } else if (pCmd->command == TSDB_SQL_CURRENT_DB) {
+ tscProcessCurrentDB(pSql);
+ } else if (pCmd->command == TSDB_SQL_SERV_STATUS) {
+ tscProcessServStatus(pSql);
} else {
pSql->res.code = TSDB_CODE_INVALID_SQL;
tscError("%p not support command:%d", pSql, pCmd->command);
diff --git a/src/client/src/tscProfile.c b/src/client/src/tscProfile.c
index 350167a3b3..61bc9dd99e 100644
--- a/src/client/src/tscProfile.c
+++ b/src/client/src/tscProfile.c
@@ -23,7 +23,7 @@
void tscSaveSlowQueryFp(void *handle, void *tmrId);
void *tscSlowQueryConn = NULL;
bool tscSlowQueryConnInitialized = false;
-TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, int port, void (*fp)(void *, TAOS_RES *, int),
+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 tscInitConnCb(void *param, TAOS_RES *result, int code) {
diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c
index c66d524fee..1f3da720f1 100644
--- a/src/client/src/tscSQLParser.c
+++ b/src/client/src/tscSQLParser.c
@@ -117,7 +117,8 @@ static int32_t optrToString(tSQLExpr* pExpr, char** exprString);
static SColumnList getColumnList(int32_t num, int16_t tableIndex, int32_t columnIndex);
static int32_t getMeterIndex(SSQLToken* pTableToken, SSqlCmd* pCmd, SColumnIndex* pIndex);
static int32_t doFunctionsCompatibleCheck(SSqlObj* pSql);
-
+static int32_t doLocalQueryProcess(SQuerySQL* pQuerySql, SSqlCmd* pCmd);
+
static int32_t tscQueryOnlyMetricTags(SSqlCmd* pCmd, bool* queryOnMetricTags) {
assert(QUERY_IS_STABLE_QUERY(pCmd->type));
@@ -877,7 +878,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
case TSQL_QUERY_METER: {
SQuerySQL* pQuerySql = pInfo->pQueryInfo;
- assert(pQuerySql != NULL && pQuerySql->from->nExpr > 0);
+ assert(pQuerySql != NULL && (pQuerySql->from == NULL || pQuerySql->from->nExpr > 0));
const char* msg0 = "invalid table name";
const char* msg1 = "table name too long";
@@ -895,6 +896,19 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
setErrMsg(pCmd, msg8);
return TSDB_CODE_INVALID_SQL;
}
+
+ /*
+ * handle the sql expression without from subclause
+ * select current_database();
+ * select server_version();
+ * select client_version();
+ * select server_state();
+ */
+ if (pQuerySql->from == NULL) {
+ assert(pQuerySql->fillType == NULL && pQuerySql->pGroupby == NULL && pQuerySql->pWhere == NULL &&
+ pQuerySql->pSortOrder == NULL);
+ return doLocalQueryProcess(pQuerySql, pCmd);
+ }
if (pQuerySql->from->nExpr > TSDB_MAX_JOIN_TABLE_NUM) {
setErrMsg(pCmd, msg7);
@@ -1120,7 +1134,7 @@ int32_t parseIntervalClause(SSqlCmd* pCmd, SQuerySQL* pQuerySql) {
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, 0);
- if (pQuerySql->interval.type == 0) {
+ if (pQuerySql->interval.type == 0 || pQuerySql->interval.n == 0) {
return TSDB_CODE_SUCCESS;
}
@@ -2669,7 +2683,7 @@ int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return TSDB_CODE_INVALID_SQL;
}
- int32_t port = strtol(portStr, NULL, 10);
+ uint16_t port = (uint16_t)strtol(portStr, NULL, 10);
if (port <= 0 || port > 65535) {
memset(pCmd->payload, 0, tListLen(pCmd->payload));
@@ -4971,8 +4985,8 @@ int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd) {
}
typedef struct SDNodeDynConfOption {
- char* name;
- int32_t len;
+ char* name; // command name
+ int32_t len; // name string length
} SDNodeDynConfOption;
int32_t validateDNodeConfig(tDCLSQL* pOptions) {
@@ -4980,7 +4994,7 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) {
return TSDB_CODE_INVALID_SQL;
}
- SDNodeDynConfOption DNODE_DYNAMIC_CFG_OPTIONS[14] = {
+ const SDNodeDynConfOption DNODE_DYNAMIC_CFG_OPTIONS[14] = {
{"resetLog", 8}, {"resetQueryCache", 15}, {"dDebugFlag", 10}, {"rpcDebugFlag", 12},
{"tmrDebugFlag", 12}, {"cDebugFlag", 10}, {"uDebugFlag", 10}, {"mDebugFlag", 10},
{"sdbDebugFlag", 12}, {"httpDebugFlag", 13}, {"monitorDebugFlag", 16}, {"qDebugflag", 10},
@@ -4991,7 +5005,7 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) {
if (pOptions->nTokens == 2) {
// reset log and reset query cache does not need value
for (int32_t i = 0; i < 2; ++i) {
- SDNodeDynConfOption* pOption = &DNODE_DYNAMIC_CFG_OPTIONS[i];
+ const SDNodeDynConfOption* pOption = &DNODE_DYNAMIC_CFG_OPTIONS[i];
if ((strncasecmp(pOption->name, pOptionToken->z, pOptionToken->n) == 0) && (pOption->len == pOptionToken->n)) {
return TSDB_CODE_SUCCESS;
}
@@ -5014,7 +5028,7 @@ int32_t validateDNodeConfig(tDCLSQL* pOptions) {
}
for (int32_t i = 2; i < tListLen(DNODE_DYNAMIC_CFG_OPTIONS) - 1; ++i) {
- SDNodeDynConfOption* pOption = &DNODE_DYNAMIC_CFG_OPTIONS[i];
+ const SDNodeDynConfOption* pOption = &DNODE_DYNAMIC_CFG_OPTIONS[i];
if ((strncasecmp(pOption->name, pOptionToken->z, pOptionToken->n) == 0) && (pOption->len == pOptionToken->n)) {
/* options is valid */
@@ -5031,8 +5045,10 @@ int32_t validateLocalConfig(tDCLSQL* pOptions) {
return TSDB_CODE_INVALID_SQL;
}
- SDNodeDynConfOption LOCAL_DYNAMIC_CFG_OPTIONS[6] = {{"resetLog", 8}, {"rpcDebugFlag", 12}, {"tmrDebugFlag", 12},
- {"cDebugFlag", 10}, {"uDebugFlag", 10}, {"debugFlag", 9}};
+ SDNodeDynConfOption LOCAL_DYNAMIC_CFG_OPTIONS[6] = {
+ {"resetLog", 8}, {"rpcDebugFlag", 12}, {"tmrDebugFlag", 12},
+ {"cDebugFlag", 10}, {"uDebugFlag", 10}, {"debugFlag", 9}
+ };
SSQLToken* pOptionToken = &pOptions->a[0];
@@ -5686,3 +5702,53 @@ int32_t doFunctionsCompatibleCheck(SSqlObj* pSql) {
return checkUpdateTagPrjFunctions(pCmd);
}
}
+
+int32_t doLocalQueryProcess(SQuerySQL* pQuerySql, SSqlCmd* pCmd) {
+ const char* msg1 = "only one expression allowed";
+ const char* msg2 = "invalid expression in select clause";
+ const char* msg3 = "invalid function";
+
+ tSQLExprList* pExprList = pQuerySql->pSelection;
+ if (pExprList->nExpr != 1) {
+ setErrMsg(pCmd, msg1);
+ return TSDB_CODE_INVALID_SQL;
+ }
+
+ tSQLExpr* pExpr = pExprList->a[0].pNode;
+ if (pExpr->operand.z == NULL) {
+ setErrMsg(pCmd, msg2);
+ return TSDB_CODE_INVALID_SQL;
+ }
+
+ SDNodeDynConfOption functionsInfo[5] = {
+ {"database()", 10}, {"server_version()", 16}, {"server_status()", 15}, {"client_version()", 16}, {"current_user()", 14}
+ };
+
+ int32_t index = -1;
+ for(int32_t i = 0; i < tListLen(functionsInfo); ++i) {
+ if (strncasecmp(functionsInfo[i].name, pExpr->operand.z, functionsInfo[i].len) == 0 &&
+ functionsInfo[i].len == pExpr->operand.n) {
+ index = i;
+ break;
+ }
+ }
+
+ SSqlExpr* pExpr1 = tscSqlExprInsertEmpty(pCmd, 0, TSDB_FUNC_TAG_DUMMY);
+ if (pExprList->a[0].aliasName != NULL) {
+ strncpy(pExpr1->aliasName, pExprList->a[0].aliasName, tListLen(pExpr1->aliasName));
+ } else {
+ strncpy(pExpr1->aliasName, functionsInfo[index].name, tListLen(pExpr1->aliasName));
+ }
+
+ switch(index) {
+ case 0: pCmd->command = TSDB_SQL_CURRENT_DB;return TSDB_CODE_SUCCESS;
+ case 1: pCmd->command = TSDB_SQL_SERV_VERSION;return TSDB_CODE_SUCCESS;
+ case 2: pCmd->command = TSDB_SQL_SERV_STATUS;return TSDB_CODE_SUCCESS;
+ case 3: pCmd->command = TSDB_SQL_CLI_VERSION;return TSDB_CODE_SUCCESS;
+ case 4: pCmd->command = TSDB_SQL_CURRENT_USER;return TSDB_CODE_SUCCESS;
+ default: {
+ setErrMsg(pCmd, msg3);
+ return TSDB_CODE_INVALID_SQL;
+ }
+ }
+}
diff --git a/src/client/src/tscSQLParserImpl.c b/src/client/src/tscSQLParserImpl.c
index 4fefe1665c..7715b32c3c 100644
--- a/src/client/src/tscSQLParserImpl.c
+++ b/src/client/src/tscSQLParserImpl.c
@@ -500,7 +500,7 @@ void tSQLSetColumnType(TAOS_FIELD *pField, SSQLToken *type) {
SQuerySQL *tSetQuerySQLElems(SSQLToken *pSelectToken, tSQLExprList *pSelection, tVariantList *pFrom, tSQLExpr *pWhere,
tVariantList *pGroupby, tVariantList *pSortOrder, SSQLToken *pInterval,
SSQLToken *pSliding, tVariantList *pFill, SLimitVal *pLimit, SLimitVal *pGLimit) {
- assert(pSelection != NULL && pFrom != NULL && pInterval != NULL && pLimit != NULL && pGLimit != NULL);
+ assert(pSelection != NULL);
SQuerySQL *pQuery = calloc(1, sizeof(SQuerySQL));
pQuery->selectToken = *pSelectToken;
@@ -512,13 +512,23 @@ SQuerySQL *tSetQuerySQLElems(SSQLToken *pSelectToken, tSQLExprList *pSelection,
pQuery->pSortOrder = pSortOrder;
pQuery->pWhere = pWhere;
- pQuery->limit = *pLimit;
- pQuery->slimit = *pGLimit;
+ if (pLimit != NULL) {
+ pQuery->limit = *pLimit;
+ }
+
+ if (pGLimit != NULL) {
+ pQuery->slimit = *pGLimit;
+ }
- pQuery->interval = *pInterval;
- pQuery->sliding = *pSliding;
+ if (pInterval != NULL) {
+ pQuery->interval = *pInterval;
+ }
+
+ if (pSliding != NULL) {
+ pQuery->sliding = *pSliding;
+ }
+
pQuery->fillType = pFill;
-
return pQuery;
}
diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c
index 436bfa327a..1f528bbda3 100644
--- a/src/client/src/tscServer.c
+++ b/src/client/src/tscServer.c
@@ -184,6 +184,15 @@ void tscGetConnToMgmt(SSqlObj *pSql, uint8_t *pCode) {
pSql->vnode = TSC_MGMT_VNODE;
#endif
}
+
+ // the pSql->res.code is the previous error(status) code.
+ if (pSql->thandle == NULL && pSql->retry >= pSql->maxRetry) {
+ if (pSql->res.code != TSDB_CODE_SUCCESS && pSql->res.code != TSDB_CODE_ACTION_IN_PROGRESS) {
+ *pCode = pSql->res.code;
+ }
+
+ tscError("%p reach the max retry:%d, code:%d", pSql, pSql->retry, *pCode);
+ }
}
void tscGetConnToVnode(SSqlObj *pSql, uint8_t *pCode) {
@@ -442,6 +451,9 @@ void *tscProcessMsgFromServer(char *msg, void *ahandle, void *thandle) {
tscTrace("%p it shall be redirected!", pSql);
taosAddConnIntoCache(tscConnCache, thandle, pSql->ip, pSql->vnode, pObj->user);
pSql->thandle = NULL;
+
+ // reset the retry times for a new mgmt node
+ pSql->retry = 0;
if (pCmd->command > TSDB_SQL_MGMT) {
tscProcessMgmtRedirect(pSql, pMsg->content + 1);
@@ -1795,7 +1807,7 @@ int tscBuildCreateDbMsg(SSqlObj *pSql) {
pMsg += sizeof(SMgmtHead);
pCreateDbMsg = (SCreateDbMsg *)pMsg;
- strcpy(pCreateDbMsg->db, pMeterMetaInfo->name);
+ strncpy(pCreateDbMsg->db, pMeterMetaInfo->name, tListLen(pCreateDbMsg->db));
pMsg += sizeof(SCreateDbMsg);
msgLen = pMsg - pStart;
@@ -2017,7 +2029,7 @@ int tscBuildDropDbMsg(SSqlObj *pSql) {
pMsg += sizeof(SMgmtHead);
pDropDbMsg = (SDropDbMsg *)pMsg;
- strcpy(pDropDbMsg->db, pMeterMetaInfo->name);
+ strncpy(pDropDbMsg->db, pMeterMetaInfo->name, tListLen(pDropDbMsg->db));
pDropDbMsg->ignoreNotExists = htons(pCmd->existsCheck ? 1 : 0);
@@ -3795,7 +3807,14 @@ void tscInitMsgs() {
tscProcessMsgRsp[TSDB_SQL_SHOW] = tscProcessShowRsp;
tscProcessMsgRsp[TSDB_SQL_RETRIEVE] = tscProcessRetrieveRspFromVnode; // rsp handled by same function.
tscProcessMsgRsp[TSDB_SQL_DESCRIBE_TABLE] = tscProcessDescribeTableRsp;
+
tscProcessMsgRsp[TSDB_SQL_RETRIEVE_TAGS] = tscProcessTagRetrieveRsp;
+ tscProcessMsgRsp[TSDB_SQL_CURRENT_DB] = tscProcessTagRetrieveRsp;
+ tscProcessMsgRsp[TSDB_SQL_CURRENT_USER] = tscProcessTagRetrieveRsp;
+ tscProcessMsgRsp[TSDB_SQL_SERV_VERSION] = tscProcessTagRetrieveRsp;
+ tscProcessMsgRsp[TSDB_SQL_CLI_VERSION] = tscProcessTagRetrieveRsp;
+ tscProcessMsgRsp[TSDB_SQL_SERV_STATUS] = tscProcessTagRetrieveRsp;
+
tscProcessMsgRsp[TSDB_SQL_RETRIEVE_EMPTY_RESULT] = tscProcessEmptyResultRsp;
tscProcessMsgRsp[TSDB_SQL_RETRIEVE_METRIC] = tscProcessRetrieveMetricRsp;
diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c
index 6131e96eab..bae576d99f 100644
--- a/src/client/src/tscSql.c
+++ b/src/client/src/tscSql.c
@@ -27,8 +27,9 @@
#include "tsql.h"
#include "ttimer.h"
#include "tutil.h"
+#include "tnote.h"
-TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const char *db, int port, void (*fp)(void *, TAOS_RES *, int),
+TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
void *param, void **taos) {
STscObj *pObj;
@@ -149,7 +150,7 @@ TAOS *taos_connect_imp(const char *ip, const char *user, const char *pass, const
return pObj;
}
-TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, int port) {
+TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
if (ip == NULL || (ip != NULL && (strcmp("127.0.0.1", ip) == 0 || strcasecmp("localhost", ip) == 0))) {
#ifdef CLUSTER
ip = tsMasterIp;
@@ -201,7 +202,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
return taos;
}
-TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, int port, void (*fp)(void *, TAOS_RES *, int),
+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) {
#ifndef CLUSTER
if (ip == NULL) {
@@ -241,9 +242,9 @@ int taos_query_imp(STscObj* pObj, SSqlObj* pSql) {
pRes->qhandle = 0;
pSql->thandle = NULL;
- if (pRes->code != TSDB_CODE_SUCCESS) return pRes->code;
-
- tscDoQuery(pSql);
+ if (pRes->code == TSDB_CODE_SUCCESS) {
+ tscDoQuery(pSql);
+ }
tscTrace("%p SQL result:%d, %s pObj:%p", pSql, pRes->code, taos_errstr(pObj), pObj);
if (pRes->code != TSDB_CODE_SUCCESS) {
@@ -270,6 +271,8 @@ int taos_query(TAOS *taos, const char *sqlstr) {
return pRes->code;
}
+ taosNotePrintTsc(sqlstr);
+
void *sql = realloc(pSql->sqlstr, sqlLen + 1);
if (sql == NULL) {
pRes->code = TSDB_CODE_CLI_OUT_OF_MEMORY;
diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c
index 2c5ad2939a..60b90ac328 100644
--- a/src/client/src/tscSystem.c
+++ b/src/client/src/tscSystem.c
@@ -45,6 +45,10 @@ extern int tscEmbedded;
int tscNumOfThreads;
static pthread_once_t tscinit = PTHREAD_ONCE_INIT;
+extern int tsTscEnableRecordSql;
+extern int tsNumOfLogLines;
+void taosInitNote(int numOfNoteLines, int maxNotes, char* lable);
+
void tscCheckDiskUsage(void *para, void *unused) {
taosGetDisk();
taosTmrReset(tscCheckDiskUsage, 1000, NULL, tscTmr, &tscCheckDiskUsageTmr);
@@ -85,6 +89,10 @@ void taos_init_imp() {
taosSetCoreDump();
+ if (tsTscEnableRecordSql != 0) {
+ taosInitNote(tsNumOfLogLines / 10, 1, (char*)"tsc_note");
+ }
+
#ifdef CLUSTER
tscMgmtIpList.numOfIps = 2;
strcpy(tscMgmtIpList.ipstr[0], tsMasterIp);
@@ -354,4 +362,4 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
atomic_store_32(&lock, 0);
return ret;
-}
\ No newline at end of file
+}
diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c
index fd23b183b1..b73ea5caaf 100644
--- a/src/client/src/tscUtil.c
+++ b/src/client/src/tscUtil.c
@@ -720,7 +720,7 @@ static void evic(SFieldInfo* pFieldInfo, int32_t index) {
}
}
-static void setValueImpl(TAOS_FIELD* pField, int8_t type, char* name, int16_t bytes) {
+static void setValueImpl(TAOS_FIELD* pField, int8_t type, const char* name, int16_t bytes) {
pField->type = type;
strncpy(pField->name, name, TSDB_COL_NAME_LEN);
pField->bytes = bytes;
@@ -764,7 +764,7 @@ void tscFieldInfoUpdateVisible(SFieldInfo* pFieldInfo, int32_t index, bool visib
}
}
-void tscFieldInfoSetValue(SFieldInfo* pFieldInfo, int32_t index, int8_t type, char* name, int16_t bytes) {
+void tscFieldInfoSetValue(SFieldInfo* pFieldInfo, int32_t index, int8_t type, const char* name, int16_t bytes) {
ensureSpace(pFieldInfo, pFieldInfo->numOfOutputCols + 1);
evic(pFieldInfo, index);
@@ -896,6 +896,19 @@ static void _exprEvic(SSqlExprInfo* pExprInfo, int32_t index) {
}
}
+SSqlExpr* tscSqlExprInsertEmpty(SSqlCmd* pCmd, int32_t index, int16_t functionId) {
+ SSqlExprInfo* pExprInfo = &pCmd->exprsInfo;
+
+ _exprCheckSpace(pExprInfo, pExprInfo->numOfExprs + 1);
+ _exprEvic(pExprInfo, index);
+
+ SSqlExpr* pExpr = &pExprInfo->pExprs[index];
+ pExpr->functionId = functionId;
+
+ pExprInfo->numOfExprs++;
+ return pExpr;
+}
+
SSqlExpr* tscSqlExprInsert(SSqlCmd* pCmd, int32_t index, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t interSize) {
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pColIndex->tableIndex);
@@ -1643,7 +1656,7 @@ int32_t SStringEnsureRemain(SString* pStr, int32_t size) {
}
// remain space is insufficient, allocate more spaces
- int32_t inc = (size < MIN_ALLOC_SIZE) ? size : MIN_ALLOC_SIZE;
+ int32_t inc = (size >= MIN_ALLOC_SIZE) ? size : MIN_ALLOC_SIZE;
if (inc < (pStr->alloc >> 1)) {
inc = (pStr->alloc >> 1);
}
@@ -1670,6 +1683,7 @@ int32_t SStringEnsureRemain(SString* pStr, int32_t size) {
}
memset(tmp + pStr->n, 0, inc);
+ pStr->alloc = newsize;
pStr->z = tmp;
return TSDB_CODE_SUCCESS;
diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
index 7881c06b6a..c297fb67b0 100755
--- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
+++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
@@ -273,6 +273,9 @@ public class TSDBDriver implements java.sql.Driver {
String user = "";
for (String queryStr : queryStrings) {
String[] kvPair = queryStr.trim().split("=");
+ if (kvPair.length < 2){
+ continue;
+ }
switch (kvPair[0].toLowerCase()) {
case PROPERTY_KEY_USER:
urlProps.setProperty(PROPERTY_KEY_USER, kvPair[1]);
diff --git a/src/inc/sdb.h b/src/inc/sdb.h
index f645039441..389aecfb7b 100644
--- a/src/inc/sdb.h
+++ b/src/inc/sdb.h
@@ -23,8 +23,8 @@ extern "C" {
#include "taosmsg.h"
#include "tsdb.h"
-extern short tsMgmtMgmtPort;
-extern short tsMgmtSyncPort;
+extern uint16_t tsMgmtMgmtPort;
+extern uint16_t tsMgmtSyncPort;
extern int sdbMaxNodes;
extern int tsMgmtPeerHBTimer; // seconds
extern char sdbZone[];
diff --git a/src/inc/sql.y b/src/inc/sql.y
index e04324c5de..0fb7f6ef60 100644
--- a/src/inc/sql.y
+++ b/src/inc/sql.y
@@ -26,7 +26,6 @@
#include
#include
#include
-
#include "tsql.h"
#include "tutil.h"
}
@@ -113,7 +112,7 @@ cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
}
cmd ::= DROP DATABASE ifexists(Y) ids(X). { setDCLSQLElems(pInfo, DROP_DATABASE, 2, &X, &Y); }
-cmd ::= DROP DNODE IP(X). { setDCLSQLElems(pInfo, DROP_DNODE, 1, &X); }
+cmd ::= DROP DNODE IPTOKEN(X). { setDCLSQLElems(pInfo, DROP_DNODE, 1, &X); }
cmd ::= DROP USER ids(X). { setDCLSQLElems(pInfo, DROP_USER, 1, &X); }
cmd ::= DROP ACCOUNT ids(X). { setDCLSQLElems(pInfo, DROP_ACCOUNT, 1, &X); }
@@ -129,8 +128,8 @@ cmd ::= DESCRIBE ids(X) cpxName(Y). {
/////////////////////////////////THE ALTER STATEMENT////////////////////////////////////////
cmd ::= ALTER USER ids(X) PASS ids(Y). { setDCLSQLElems(pInfo, ALTER_USER_PASSWD, 2, &X, &Y); }
cmd ::= ALTER USER ids(X) PRIVILEGE ids(Y). { setDCLSQLElems(pInfo, ALTER_USER_PRIVILEGES, 2, &X, &Y);}
-cmd ::= ALTER DNODE IP(X) ids(Y). { setDCLSQLElems(pInfo, ALTER_DNODE, 2, &X, &Y); }
-cmd ::= ALTER DNODE IP(X) ids(Y) ids(Z). { setDCLSQLElems(pInfo, ALTER_DNODE, 3, &X, &Y, &Z); }
+cmd ::= ALTER DNODE IPTOKEN(X) ids(Y). { setDCLSQLElems(pInfo, ALTER_DNODE, 2, &X, &Y); }
+cmd ::= ALTER DNODE IPTOKEN(X) ids(Y) ids(Z). { setDCLSQLElems(pInfo, ALTER_DNODE, 3, &X, &Y, &Z); }
cmd ::= ALTER LOCAL ids(X). { setDCLSQLElems(pInfo, ALTER_LOCAL, 1, &X); }
cmd ::= ALTER LOCAL ids(X) ids(Y). { setDCLSQLElems(pInfo, ALTER_LOCAL, 2, &X, &Y); }
cmd ::= ALTER DATABASE ids(X) alter_db_optr(Y). { SSQLToken t = {0}; setCreateDBSQL(pInfo, ALTER_DATABASE, &X, &Y, &t);}
@@ -155,7 +154,7 @@ ifnotexists(X) ::= . {X.n = 0;}
/////////////////////////////////THE CREATE STATEMENT///////////////////////////////////////
//create option for dnode/db/user/account
-cmd ::= CREATE DNODE IP(X). { setDCLSQLElems(pInfo, CREATE_DNODE, 1, &X);}
+cmd ::= CREATE DNODE IPTOKEN(X). { setDCLSQLElems(pInfo, CREATE_DNODE, 1, &X);}
cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z).
{ setCreateAcctSQL(pInfo, CREATE_ACCOUNT, &X, &Y, &Z);}
cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDBSQL(pInfo, CREATE_DATABASE, &X, &Y, &Z);}
@@ -219,7 +218,7 @@ comp(Y) ::= COMP INTEGER(X). { Y = X; }
prec(Y) ::= PRECISION STRING(X). { Y = X; }
%type db_optr {SCreateDBInfo}
-db_optr ::= . {}
+db_optr(Y) ::= . {memset(&Y, 0, sizeof(SCreateDBInfo));}
db_optr(Y) ::= db_optr(Z) tables(X). { Y = Z; Y.tablesPerVnode = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) cache(X). { Y = Z; Y.cacheBlockSize = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) replica(X). { Y = Z; Y.replica = strtol(X.z, NULL, 10); }
@@ -350,6 +349,14 @@ select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_opt(K) fill_
A = tSetQuerySQLElems(&T, W, X, Y, P, Z, &K, &S, F, &L, &G);
}
+// Support for the SQL exprssion without from & where subclauses, e.g.,
+// select current_database(),
+// select server_version(), select client_version(),
+// select server_state();
+select(A) ::= SELECT(T) selcollist(W). {
+ A = tSetQuerySQLElems(&T, W, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+}
+
// selcollist is a list of expressions that are to become the return
// values of the SELECT statement. The "*" in statements like
// "SELECT * FROM ..." is encoded as a special expression with an opcode of TK_ALL.
@@ -392,7 +399,7 @@ tmvar(A) ::= VARIABLE(X). {A = X;}
%type interval_opt {SSQLToken}
interval_opt(N) ::= INTERVAL LP tmvar(E) RP. {N = E; }
-interval_opt(N) ::= . {N.n = 0; }
+interval_opt(N) ::= . {N.n = 0; N.z = NULL; N.type = 0; }
%type fill_opt {tVariantList*}
%destructor fill_opt {tVariantListDestroy($$);}
@@ -413,7 +420,7 @@ fill_opt(N) ::= FILL LP ID(Y) RP. {
%type sliding_opt {SSQLToken}
sliding_opt(K) ::= SLIDING LP tmvar(E) RP. {K = E; }
-sliding_opt(K) ::= . {K.n = 0; }
+sliding_opt(K) ::= . {K.n = 0; K.z = NULL; K.type = 0; }
%type orderby_opt {tVariantList*}
%destructor orderby_opt {tVariantListDestroy($$);}
@@ -642,12 +649,12 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
}
////////////////////////////////////////kill statement///////////////////////////////////////
-cmd ::= KILL CONNECTION IP(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); setDCLSQLElems(pInfo, KILL_CONNECTION, 1, &X);}
-cmd ::= KILL STREAM IP(X) COLON(Z) INTEGER(Y) COLON(K) INTEGER(F). {X.n += (Z.n + Y.n + K.n + F.n); setDCLSQLElems(pInfo, KILL_STREAM, 1, &X);}
-cmd ::= KILL QUERY IP(X) COLON(Z) INTEGER(Y) COLON(K) INTEGER(F). {X.n += (Z.n + Y.n + K.n + F.n); setDCLSQLElems(pInfo, KILL_QUERY, 1, &X);}
+cmd ::= KILL CONNECTION IPTOKEN(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); setDCLSQLElems(pInfo, KILL_CONNECTION, 1, &X);}
+cmd ::= KILL STREAM IPTOKEN(X) COLON(Z) INTEGER(Y) COLON(K) INTEGER(F). {X.n += (Z.n + Y.n + K.n + F.n); setDCLSQLElems(pInfo, KILL_STREAM, 1, &X);}
+cmd ::= KILL QUERY IPTOKEN(X) COLON(Z) INTEGER(Y) COLON(K) INTEGER(F). {X.n += (Z.n + Y.n + K.n + F.n); setDCLSQLElems(pInfo, KILL_QUERY, 1, &X);}
%fallback ID ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CLUSTER CONFLICT COPY DATABASE DEFERRED
DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR GLOB IGNORE IMMEDIATE INITIALLY INSTEAD
LIKE MATCH KEY OF OFFSET RAISE REPLACE RESTRICT ROW STATEMENT TRIGGER VIEW ALL
COUNT SUM AVG MIN MAX FIRST LAST TOP BOTTOM STDDEV PERCENTILE APERCENTILE LEASTSQUARES HISTOGRAM DIFF
- SPREAD TWA INTERP LAST_ROW NOW IP SEMI NONE PREV LINEAR IMPORT METRIC TBNAME JOIN METRICS STABLE.
\ No newline at end of file
+ SPREAD TWA INTERP LAST_ROW NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT METRIC TBNAME JOIN METRICS STABLE NULL.
\ No newline at end of file
diff --git a/src/inc/taos.h b/src/inc/taos.h
index 05acc91551..2fd6d8be92 100644
--- a/src/inc/taos.h
+++ b/src/inc/taos.h
@@ -59,7 +59,7 @@ typedef struct taosField {
void taos_init();
int taos_options(TSDB_OPTION option, const void *arg, ...);
-TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, int port);
+TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port);
void taos_close(TAOS *taos);
typedef struct TAOS_BIND {
diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h
index e59db1debf..f62d0e6897 100644
--- a/src/inc/taosmsg.h
+++ b/src/inc/taosmsg.h
@@ -222,7 +222,7 @@ typedef struct {
// internal part
uint32_t destId;
char meterId[TSDB_UNI_LEN];
- short port; // for UDP only
+ uint16_t port; // for UDP only
char empty[1];
char msgType;
int32_t msgLen;
@@ -309,7 +309,7 @@ typedef struct {
} SCreateMsg;
typedef struct {
- char db[TSDB_DB_NAME_LEN];
+ char db[TSDB_METER_ID_LEN];
short ignoreNotExists;
} SDropDbMsg, SUseDbMsg;
@@ -594,7 +594,7 @@ typedef struct {
// NOTE: sizeof(SVnodeCfg) < TSDB_FILE_HEADER_LEN/4
typedef struct {
char acct[TSDB_USER_LEN];
- char db[TSDB_DB_NAME_LEN];
+ char db[TSDB_METER_ID_LEN+2]; // 8bytes align
uint32_t vgId;
int32_t maxSessions;
int32_t cacheBlockSize;
diff --git a/src/inc/tglobalcfg.h b/src/inc/tglobalcfg.h
index 09ced23c91..8f0cf79fe6 100644
--- a/src/inc/tglobalcfg.h
+++ b/src/inc/tglobalcfg.h
@@ -57,12 +57,12 @@ extern char scriptDir[];
extern char tsMasterIp[];
extern char tsSecondIp[];
-extern short tsMgmtVnodePort;
-extern short tsMgmtShellPort;
-extern short tsVnodeShellPort;
-extern short tsVnodeVnodePort;
-extern short tsMgmtMgmtPort;
-extern short tsMgmtSyncPort;
+extern uint16_t tsMgmtVnodePort;
+extern uint16_t tsMgmtShellPort;
+extern uint16_t tsVnodeShellPort;
+extern uint16_t tsVnodeVnodePort;
+extern uint16_t tsMgmtMgmtPort;
+extern uint16_t tsMgmtSyncPort;
extern int tsStatusInterval;
extern int tsShellActivityTimer;
@@ -141,7 +141,7 @@ extern int tsProjectExecInterval;
extern int64_t tsMaxRetentWindow;
extern char tsHttpIp[];
-extern short tsHttpPort;
+extern uint16_t tsHttpPort;
extern int tsHttpCacheSessions;
extern int tsHttpSessionExpire;
extern int tsHttpMaxThreads;
@@ -150,6 +150,8 @@ extern int tsHttpEnableRecordSql;
extern int tsTelegrafUseFieldNum;
extern int tsAdminRowLimit;
+extern int tsTscEnableRecordSql;
+
extern char tsMonitorDbName[];
extern char tsInternalPass[];
extern int tsMonitorInterval;
diff --git a/src/inc/tnote.h b/src/inc/tnote.h
new file mode 100644
index 0000000000..1b53be22a2
--- /dev/null
+++ b/src/inc/tnote.h
@@ -0,0 +1,64 @@
+/*
+ * 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 TDENGINE_TNOTE_H
+#define TDENGINE_TNOTE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "unistd.h"
+#include "os.h"
+#include "tutil.h"
+#include "tglobalcfg.h"
+
+#define MAX_NOTE_LINE_SIZE 66000
+#define NOTE_FILE_NAME_LEN 300
+
+typedef struct _taosNoteInfo {
+ int taosNoteFileNum ;
+ int taosNoteMaxLines;
+ int taosNoteLines;
+ char taosNoteName[NOTE_FILE_NAME_LEN];
+ int taosNoteFlag;
+ int taosNoteFd;
+ int taosNoteOpenInProgress;
+ pthread_mutex_t taosNoteMutex;
+}taosNoteInfo;
+
+void taosNotePrint(taosNoteInfo * pNote, const char * const format, ...);
+
+extern taosNoteInfo m_HttpNote;
+extern taosNoteInfo m_TscNote;
+
+extern int tsHttpEnableRecordSql;
+extern int tsTscEnableRecordSql;
+
+#define taosNotePrintHttp(...) \
+ if (tsHttpEnableRecordSql) { \
+ taosNotePrint(&m_HttpNote, __VA_ARGS__); \
+ }
+
+#define taosNotePrintTsc(...) \
+ if (tsTscEnableRecordSql) { \
+ taosNotePrint(&m_TscNote, __VA_ARGS__); \
+ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/inc/trpc.h b/src/inc/trpc.h
index ef86e672d1..97a0c905f8 100644
--- a/src/inc/trpc.h
+++ b/src/inc/trpc.h
@@ -47,7 +47,7 @@ extern "C" {
typedef struct {
char *localIp; // local IP used
- short localPort; // local port
+ uint16_t localPort; // local port
char *label; // for debug purpose
int numOfThreads; // number of threads to handle connections
void *(*fp)(char *, void *, void *); // function to process the incoming msg
@@ -72,7 +72,7 @@ typedef struct {
void * shandle; // pointer returned by taosOpenRpc
void * ahandle; // handle provided by app
char * peerIp; // peer IP string
- short peerPort; // peer port
+ uint16_t peerPort; // peer port
char spi; // security parameter index
char encrypt; // encrypt algorithm
char * secret; // key for authentication
@@ -107,7 +107,7 @@ int taosSendSimpleRsp(void *thandle, char rsptype, char code);
int taosSetSecurityInfo(int cid, int sid, char *id, int spi, int encrypt, char *secret, char *ckey);
-void taosGetRpcConnInfo(void *thandle, uint32_t *peerId, uint32_t *peerIp, short *peerPort, int *cid, int *sid);
+void taosGetRpcConnInfo(void *thandle, uint32_t *peerId, uint32_t *peerIp, uint16_t *peerPort, int *cid, int *sid);
int taosGetOutType(void *thandle);
diff --git a/src/inc/tsocket.h b/src/inc/tsocket.h
index 0a02fcf551..9eb4c26464 100644
--- a/src/inc/tsocket.h
+++ b/src/inc/tsocket.h
@@ -33,19 +33,19 @@ int taosWriteMsg(int fd, void *ptr, int nbytes);
int taosReadMsg(int fd, void *ptr, int nbytes);
-int taosOpenUdpSocket(char *ip, short port);
+int taosOpenUdpSocket(char *ip, uint16_t port);
-int taosOpenTcpClientSocket(char *ip, short port, char *localIp);
+int taosOpenTcpClientSocket(char *ip, uint16_t port, char *localIp);
-int taosOpenTcpServerSocket(char *ip, short port);
+int taosOpenTcpServerSocket(char *ip, uint16_t port);
int taosKeepTcpAlive(int sockFd);
void taosCloseTcpSocket(int sockFd);
-int taosOpenUDServerSocket(char *ip, short port);
+int taosOpenUDServerSocket(char *ip, uint16_t port);
-int taosOpenUDClientSocket(char *ip, short port);
+int taosOpenUDClientSocket(char *ip, uint16_t port);
int taosOpenRawSocket(char *ip);
diff --git a/src/inc/tsql.h b/src/inc/tsql.h
index 0bcd8ffa68..5b033c535e 100644
--- a/src/inc/tsql.h
+++ b/src/inc/tsql.h
@@ -31,6 +31,7 @@ extern "C" {
#define TK_OCT 204 // oct number
#define TK_BIN 205 // bin format data 0b111
#define TK_FILE 206
+#define TK_QUESTION 207 // denoting the placeholder of "?",when invoking statement bind query
#define TSQL_SO_ASC 1
#define TSQL_SO_DESC 0
diff --git a/src/inc/tsqldef.h b/src/inc/tsqldef.h
index 6d2c166eab..3d056f771c 100644
--- a/src/inc/tsqldef.h
+++ b/src/inc/tsqldef.h
@@ -80,7 +80,7 @@
#define TK_TABLE 62
#define TK_DATABASE 63
#define TK_DNODE 64
-#define TK_IP 65
+#define TK_IPTOKEN 65
#define TK_USER 66
#define TK_ACCOUNT 67
#define TK_USE 68
@@ -210,7 +210,6 @@
#define TK_JOIN 192
#define TK_METRICS 193
#define TK_STABLE 194
-#define TK_QUESTION 195
#endif
diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c
index 47ed92e2f7..37530e1e8c 100644
--- a/src/kit/taosdemo/taosdemo.c
+++ b/src/kit/taosdemo/taosdemo.c
@@ -67,7 +67,7 @@ static struct argp_option options[] = {
/* Used by main to communicate with parse_opt. */
struct arguments {
char *host;
- int port;
+ uint16_t port;
char *user;
char *password;
char *database;
@@ -310,7 +310,7 @@ int main(int argc, char *argv[]) {
enum MODE query_mode = arguments.mode;
char *ip_addr = arguments.host;
- int port = arguments.port;
+ uint16_t port = arguments.port;
char *user = arguments.user;
char *pass = arguments.password;
char *db_name = arguments.database;
@@ -343,7 +343,7 @@ int main(int argc, char *argv[]) {
struct tm tm = *localtime(&tTime);
fprintf(fp, "###################################################################\n");
- fprintf(fp, "# Server IP: %s:%d\n", ip_addr == NULL ? "localhost" : ip_addr, port);
+ fprintf(fp, "# Server IP: %s:%hu\n", ip_addr == NULL ? "localhost" : ip_addr, port);
fprintf(fp, "# User: %s\n", user);
fprintf(fp, "# Password: %s\n", pass);
fprintf(fp, "# Use metric: %s\n", use_metric ? "true" : "false");
diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c
index f168a0d90f..c8ef3bc048 100644
--- a/src/kit/taosdump/taosdump.c
+++ b/src/kit/taosdump/taosdump.c
@@ -172,7 +172,7 @@ struct arguments {
char *host;
char *user;
char *password;
- int port;
+ uint16_t port;
// output file
char output[TSDB_FILENAME_LEN + 1];
char input[TSDB_FILENAME_LEN + 1];
diff --git a/src/modules/http/inc/httpHandle.h b/src/modules/http/inc/httpHandle.h
index 4f34a43cbd..f6ca8aee53 100644
--- a/src/modules/http/inc/httpHandle.h
+++ b/src/modules/http/inc/httpHandle.h
@@ -210,7 +210,7 @@ typedef struct HttpThread {
typedef struct _http_server_obj_ {
char label[HTTP_LABEL_SIZE];
char serverIp[16];
- short serverPort;
+ uint16_t serverPort;
int cacheContext;
int sessionExpire;
int numOfThreads;
@@ -233,7 +233,7 @@ bool httpCheckUsedbSql(char *sql);
void httpTimeToString(time_t t, char *buf, int buflen);
// http init method
-void *httpInitServer(char *ip, short port, char *label, int numOfThreads, void *fp, void *shandle);
+void *httpInitServer(char *ip, uint16_t port, char *label, int numOfThreads, void *fp, void *shandle);
void httpCleanUpServer(HttpServer *pServer);
// http server connection
diff --git a/src/modules/http/src/httpSql.c b/src/modules/http/src/httpSql.c
index 9254658d58..732d0179ff 100644
--- a/src/modules/http/src/httpSql.c
+++ b/src/modules/http/src/httpSql.c
@@ -24,11 +24,11 @@
#include "httpResp.h"
#include "taos.h"
#include "tsclient.h"
+#include "tnote.h"
-void *taos_connect_a(char *ip, char *user, char *pass, char *db, int port, void (*fp)(void *, TAOS_RES *, int),
+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 taosNotePrint(const char * const format, ...);
void httpProcessMultiSqlRetrieveCallBack(void *param, TAOS_RES *result, int numOfRows) {
HttpContext *pContext = (HttpContext *)param;
@@ -165,7 +165,7 @@ void httpProcessMultiSql(HttpContext *pContext) {
char *sql = httpGetCmdsString(pContext, cmd->sql);
httpDump("context:%p, fd:%d, ip:%s, user:%s, process pos:%d, start query, sql:%s", pContext, pContext->fd,
pContext->ipstr, pContext->user, multiCmds->pos, sql);
- taosNotePrint(sql);
+ taosNotePrintHttp(sql);
taos_query_a(pContext->session->taos, sql, httpProcessMultiSqlCallBack, (void *)pContext);
}
@@ -298,7 +298,7 @@ void httpProcessSingleSqlCmd(HttpContext *pContext) {
httpDump("context:%p, fd:%d, ip:%s, user:%s, start query, sql:%s", pContext, pContext->fd, pContext->ipstr,
pContext->user, sql);
- taosNotePrint(sql);
+ taosNotePrintHttp(sql);
taos_query_a(pSession->taos, sql, httpProcessSingleSqlCallBack, (void *)pContext);
}
diff --git a/src/modules/http/src/httpSystem.c b/src/modules/http/src/httpSystem.c
index 25ab55aed9..efc24c15dd 100644
--- a/src/modules/http/src/httpSystem.c
+++ b/src/modules/http/src/httpSystem.c
@@ -42,7 +42,7 @@
#endif
static HttpServer *httpServer = NULL;
-void taosInitNote(int numOfNoteLines, int maxNotes);
+void taosInitNote(int numOfNoteLines, int maxNotes, char* lable);
int httpInitSystem() {
taos_init();
@@ -61,7 +61,7 @@ int httpInitSystem() {
pthread_mutex_init(&httpServer->serverMutex, NULL);
if (tsHttpEnableRecordSql != 0) {
- taosInitNote(tsNumOfLogLines / 10, 1);
+ taosInitNote(tsNumOfLogLines / 10, 1, (char*)"http_note");
}
restInitHandle(httpServer);
adminInitHandle(httpServer);
diff --git a/src/modules/monitor/src/monitorSystem.c b/src/modules/monitor/src/monitorSystem.c
index 4a8d17cda6..c5f65eef36 100644
--- a/src/modules/monitor/src/monitorSystem.c
+++ b/src/modules/monitor/src/monitorSystem.c
@@ -61,7 +61,7 @@ typedef struct {
MonitorConn *monitor = NULL;
-TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, int port, void (*fp)(void *, TAOS_RES *, int),
+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 monitorInitConn(void *para, void *unused);
void monitorInitConnCb(void *param, TAOS_RES *result, int code);
diff --git a/src/os/darwin/src/tdarwin.c b/src/os/darwin/src/tdarwin.c
index de37c76edd..133bb4893c 100644
--- a/src/os/darwin/src/tdarwin.c
+++ b/src/os/darwin/src/tdarwin.c
@@ -170,12 +170,12 @@ int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optle
return setsockopt(socketfd, level, optname, optval, (socklen_t)optlen);
}
-int taosOpenUDClientSocket(char *ip, short port) {
+int taosOpenUDClientSocket(char *ip, uint16_t port) {
int sockFd = 0;
struct sockaddr_un serverAddr;
int ret;
char name[128];
- sprintf(name, "%s.%d", ip, port);
+ sprintf(name, "%s.%hu", ip, port);
sockFd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -198,13 +198,13 @@ int taosOpenUDClientSocket(char *ip, short port) {
return sockFd;
}
-int taosOpenUDServerSocket(char *ip, short port) {
+int taosOpenUDServerSocket(char *ip, uint16_t port) {
struct sockaddr_un serverAdd;
int sockFd;
char name[128];
pTrace("open ud socket:%s", name);
- sprintf(name, "%s.%d", ip, port);
+ sprintf(name, "%s.%hu", ip, port);
bzero((char *)&serverAdd, sizeof(serverAdd));
serverAdd.sun_family = AF_UNIX;
@@ -295,7 +295,7 @@ void taosGetSystemInfo() {
taosGetSystemLocale();
}
-void *taosInitTcpClient(char *ip, short port, char *flabel, int num, void *fp, void *shandle) {
+void *taosInitTcpClient(char *ip, uint16_t port, char *flabel, int num, void *fp, void *shandle) {
tError("function taosInitTcpClient is not implemented in darwin system, exit!");
exit(0);
}
@@ -305,12 +305,12 @@ void taosCloseTcpClientConnection(void *chandle) {
exit(0);
}
-void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, short port) {
+void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, uint16_t port) {
tError("function taosOpenTcpClientConnection is not implemented in darwin system, exit!");
exit(0);
}
-int taosSendTcpClientData(unsigned int ip, short port, char *data, int len, void *chandle) {
+int taosSendTcpClientData(unsigned int ip, uint16_t port, char *data, int len, void *chandle) {
tError("function taosSendTcpClientData is not implemented in darwin system, exit!");
exit(0);
}
@@ -330,12 +330,12 @@ void taosCleanUpTcpServer(void *handle) {
exit(0);
}
-void *taosInitTcpServer(char *ip, short port, char *label, int numOfThreads, void *fp, void *shandle) {
+void *taosInitTcpServer(char *ip, uint16_t port, char *label, int numOfThreads, void *fp, void *shandle) {
tError("function taosInitTcpServer is not implemented in darwin system, exit!");
exit(0);
}
-int taosSendTcpServerData(unsigned int ip, short port, char *data, int len, void *chandle) {
+int taosSendTcpServerData(unsigned int ip, uint16_t port, char *data, int len, void *chandle) {
tError("function taosSendTcpServerData is not implemented in darwin system, exit!");
exit(0);
}
diff --git a/src/os/linux/src/tlinux.c b/src/os/linux/src/tlinux.c
index c4d9425b40..93ea014409 100644
--- a/src/os/linux/src/tlinux.c
+++ b/src/os/linux/src/tlinux.c
@@ -163,12 +163,12 @@ int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optle
return setsockopt(socketfd, level, optname, optval, (socklen_t)optlen);
}
-int taosOpenUDClientSocket(char *ip, short port) {
+int taosOpenUDClientSocket(char *ip, uint16_t port) {
int sockFd = 0;
struct sockaddr_un serverAddr;
int ret;
char name[128];
- sprintf(name, "%s.%d", ip, port);
+ sprintf(name, "%s.%hu", ip, port);
sockFd = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -191,13 +191,13 @@ int taosOpenUDClientSocket(char *ip, short port) {
return sockFd;
}
-int taosOpenUDServerSocket(char *ip, short port) {
+int taosOpenUDServerSocket(char *ip, uint16_t port) {
struct sockaddr_un serverAdd;
int sockFd;
char name[128];
pTrace("open ud socket:%s", name);
- sprintf(name, "%s.%d", ip, port);
+ sprintf(name, "%s.%hu", ip, port);
bzero((char *)&serverAdd, sizeof(serverAdd));
serverAdd.sun_family = AF_UNIX;
diff --git a/src/os/linux/src/tsystem.c b/src/os/linux/src/tsystem.c
index fa41e8e6d0..70b970e2a8 100644
--- a/src/os/linux/src/tsystem.c
+++ b/src/os/linux/src/tsystem.c
@@ -586,9 +586,13 @@ void taosKillSystem() {
kill(tsProcId, 2);
}
-
+extern int tsEnableCoreFile;
int _sysctl(struct __sysctl_args *args );
void taosSetCoreDump() {
+ if (0 == tsEnableCoreFile) {
+ return;
+ }
+
// 1. set ulimit -c unlimited
struct rlimit rlim;
struct rlimit rlim_new;
@@ -608,6 +612,7 @@ void taosSetCoreDump() {
pPrint("the new unlimited para: rlim_cur=%d, rlim_max=%d", rlim.rlim_cur, rlim.rlim_max);
}
+#ifndef _TD_ARM_
// 2. set the path for saving core file
struct __sysctl_args args;
int old_usespid = 0;
@@ -649,9 +654,10 @@ void taosSetCoreDump() {
}
pPrint("The new core_uses_pid[%d]: %d", old_len, old_usespid);
+#endif
#if 0
- // 3. set the path for saving core file
+ // 3. create the path for saving core file
int status;
char coredump_dir[32] = "/var/log/taosdump";
if (opendir(coredump_dir) == NULL) {
diff --git a/src/os/windows/src/twintcpclient.c b/src/os/windows/src/twintcpclient.c
index 17293c3915..9f40dae434 100644
--- a/src/os/windows/src/twintcpclient.c
+++ b/src/os/windows/src/twintcpclient.c
@@ -15,7 +15,7 @@
#include "tlog.h"
-void *taosInitTcpClient(char *ip, short port, char *label, int num, void *fp, void *shandle) {
+void *taosInitTcpClient(char *ip, uint16_t port, char *label, int num, void *fp, void *shandle) {
tError("InitTcpClient not support in windows");
return 0;
}
@@ -24,12 +24,12 @@ void taosCloseTcpClientConnection(void *chandle) {
tError("CloseTcpClientConnection not support in windows");
}
-void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, short port) {
+void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, uint16_t port) {
tError("OpenTcpClientConnection not support in windows");
return 0;
}
-int taosSendTcpClientData(unsigned int ip, short port, char *data, int len, void *chandle) {
+int taosSendTcpClientData(unsigned int ip, uint16_t port, char *data, int len, void *chandle) {
tError("SendTcpClientData not support in windows");
return 0;
}
diff --git a/src/os/windows/src/twintcpserver.c b/src/os/windows/src/twintcpserver.c
index a51d807aa2..d5e25693d0 100644
--- a/src/os/windows/src/twintcpserver.c
+++ b/src/os/windows/src/twintcpserver.c
@@ -23,12 +23,12 @@ void taosCleanUpTcpServer(void *handle) {
tError("CleanUpTcpServer not support in windows");
}
-void *taosInitTcpServer(char *ip, short port, char *label, int numOfThreads, void *fp, void *shandle) {
+void *taosInitTcpServer(char *ip, uint16_t port, char *label, int numOfThreads, void *fp, void *shandle) {
tError("InitTcpServer not support in windows");
return 0;
}
-int taosSendTcpServerData(unsigned int ip, short port, char *data, int len, void *chandle) {
+int taosSendTcpServerData(unsigned int ip, uint16_t port, char *data, int len, void *chandle) {
tError("SendTcpServerData not support in windows");
return 0;
}
diff --git a/src/rpc/inc/thaship.h b/src/rpc/inc/thaship.h
index 262673af62..4acf8b3fbb 100644
--- a/src/rpc/inc/thaship.h
+++ b/src/rpc/inc/thaship.h
@@ -18,8 +18,8 @@
void *taosOpenIpHash(int maxSessions);
void taosCloseIpHash(void *handle);
-void *taosAddIpHash(void *handle, void *pData, uint32_t ip, short port);
-void taosDeleteIpHash(void *handle, uint32_t ip, short port);
-void *taosGetIpHash(void *handle, uint32_t ip, short port);
+void *taosAddIpHash(void *handle, void *pData, uint32_t ip, uint16_t port);
+void taosDeleteIpHash(void *handle, uint32_t ip, uint16_t port);
+void *taosGetIpHash(void *handle, uint32_t ip, uint16_t port);
#endif
diff --git a/src/rpc/inc/ttcpclient.h b/src/rpc/inc/ttcpclient.h
index 8c2131f1f6..8427c6f162 100644
--- a/src/rpc/inc/ttcpclient.h
+++ b/src/rpc/inc/ttcpclient.h
@@ -18,10 +18,10 @@
#include "tsdb.h"
-void *taosInitTcpClient(char *ip, short port, char *label, int num, void *fp, void *shandle);
+void *taosInitTcpClient(char *ip, uint16_t port, char *label, int num, void *fp, void *shandle);
void taosCleanUpTcpClient(void *chandle);
-void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, short port);
+void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, uint16_t port);
void taosCloseTcpClientConnection(void *chandle);
-int taosSendTcpClientData(uint32_t ip, short port, char *data, int len, void *chandle);
+int taosSendTcpClientData(uint32_t ip, uint16_t port, char *data, int len, void *chandle);
#endif
diff --git a/src/rpc/inc/ttcpserver.h b/src/rpc/inc/ttcpserver.h
index 3e3feb4691..ba3bd25719 100644
--- a/src/rpc/inc/ttcpserver.h
+++ b/src/rpc/inc/ttcpserver.h
@@ -18,9 +18,9 @@
#include "tsdb.h"
-void *taosInitTcpServer(char *ip, short port, char *label, int numOfThreads, void *fp, void *shandle);
+void *taosInitTcpServer(char *ip, uint16_t port, char *label, int numOfThreads, void *fp, void *shandle);
void taosCleanUpTcpServer(void *param);
void taosCloseTcpServerConnection(void *param);
-int taosSendTcpServerData(uint32_t ip, short port, char *data, int len, void *chandle);
+int taosSendTcpServerData(uint32_t ip, uint16_t port, char *data, int len, void *chandle);
#endif
diff --git a/src/rpc/inc/tudp.h b/src/rpc/inc/tudp.h
index c90e21f510..27c7593090 100644
--- a/src/rpc/inc/tudp.h
+++ b/src/rpc/inc/tudp.h
@@ -18,11 +18,11 @@
#include "tsdb.h"
-void *taosInitUdpServer(char *ip, short port, char *label, int, void *fp, void *shandle);
-void *taosInitUdpClient(char *ip, short port, char *label, int, void *fp, void *shandle);
+void *taosInitUdpServer(char *ip, uint16_t port, char *label, int, void *fp, void *shandle);
+void *taosInitUdpClient(char *ip, uint16_t port, char *label, int, void *fp, void *shandle);
void taosCleanUpUdpConnection(void *handle);
-int taosSendUdpData(uint32_t ip, short port, char *data, int dataLen, void *chandle);
-void *taosOpenUdpConnection(void *shandle, void *thandle, char *ip, short port);
+int taosSendUdpData(uint32_t ip, uint16_t port, char *data, int dataLen, void *chandle);
+void *taosOpenUdpConnection(void *shandle, void *thandle, char *ip, uint16_t port);
void taosFreeMsgHdr(void *hdr);
int taosMsgHdrSize(void *hdr);
diff --git a/src/rpc/src/thaship.c b/src/rpc/src/thaship.c
index 2c46e53258..6b76c4b59e 100644
--- a/src/rpc/src/thaship.c
+++ b/src/rpc/src/thaship.c
@@ -19,7 +19,7 @@
typedef struct _ip_hash_t {
uint32_t ip;
- short port;
+ uint16_t port;
int hash;
struct _ip_hash_t *prev;
struct _ip_hash_t *next;
@@ -32,20 +32,20 @@ typedef struct {
int maxSessions;
} SHashObj;
-int taosHashIp(void *handle, uint32_t ip, short port) {
+int taosHashIp(void *handle, uint32_t ip, uint16_t port) {
SHashObj *pObj = (SHashObj *)handle;
int hash = 0;
hash = (int)(ip >> 16);
hash += (unsigned short)(ip & 0xFFFF);
- hash += (unsigned short)port;
+ hash += port;
hash = hash % pObj->maxSessions;
return hash;
}
-void *taosAddIpHash(void *handle, void *data, uint32_t ip, short port) {
+void *taosAddIpHash(void *handle, void *data, uint32_t ip, uint16_t port) {
int hash;
SIpHash * pNode;
SHashObj *pObj;
@@ -68,7 +68,7 @@ void *taosAddIpHash(void *handle, void *data, uint32_t ip, short port) {
return pObj;
}
-void taosDeleteIpHash(void *handle, uint32_t ip, short port) {
+void taosDeleteIpHash(void *handle, uint32_t ip, uint16_t port) {
int hash;
SIpHash * pNode;
SHashObj *pObj;
@@ -100,7 +100,7 @@ void taosDeleteIpHash(void *handle, uint32_t ip, short port) {
}
}
-void *taosGetIpHash(void *handle, uint32_t ip, short port) {
+void *taosGetIpHash(void *handle, uint32_t ip, uint16_t port) {
int hash;
SIpHash * pNode;
SHashObj *pObj;
diff --git a/src/rpc/src/trpc.c b/src/rpc/src/trpc.c
index 5403caac9d..643622dfa7 100644
--- a/src/rpc/src/trpc.c
+++ b/src/rpc/src/trpc.c
@@ -51,10 +51,10 @@ typedef struct {
uint8_t secret[TSDB_KEY_LEN];
uint8_t ckey[TSDB_KEY_LEN];
- short localPort; // for UDP only
+ uint16_t localPort; // for UDP only
uint32_t peerUid;
uint32_t peerIp; // peer IP
- short peerPort; // peer port
+ uint16_t peerPort; // peer port
char peerIpstr[20]; // peer IP string
uint16_t tranId; // outgoing transcation ID, for build message
uint16_t outTranId; // outgoing transcation ID
@@ -99,7 +99,7 @@ typedef struct rpc_server {
int idleTime; // milliseconds;
int noFree; // do not free the request msg when rsp is received
int index; // for UDP server, next thread for new connection
- short localPort;
+ uint16_t localPort;
char label[12];
void *(*fp)(char *, void *ahandle, void *thandle);
void (*efp)(int); // FP to report error
@@ -114,16 +114,16 @@ int tsRpcProgressTime = 10; // milliseocnds
int tsRpcMaxRetry;
int tsRpcHeadSize;
-void *(*taosInitConn[])(char *ip, short port, char *label, int threads, void *fp, void *shandle) = {
+void *(*taosInitConn[])(char *ip, uint16_t port, char *label, int threads, void *fp, void *shandle) = {
taosInitUdpServer, taosInitUdpClient, taosInitTcpServer, taosInitTcpClient};
void (*taosCleanUpConn[])(void *thandle) = {taosCleanUpUdpConnection, taosCleanUpUdpConnection, taosCleanUpTcpServer,
taosCleanUpTcpClient};
-int (*taosSendData[])(uint32_t ip, short port, char *data, int len, void *chandle) = {
+int (*taosSendData[])(uint32_t ip, uint16_t port, char *data, int len, void *chandle) = {
taosSendUdpData, taosSendUdpData, taosSendTcpServerData, taosSendTcpClientData};
-void *(*taosOpenConn[])(void *shandle, void *thandle, char *ip, short port) = {
+void *(*taosOpenConn[])(void *shandle, void *thandle, char *ip, uint16_t port) = {
taosOpenUdpConnection,
taosOpenUdpConnection,
NULL,
@@ -134,7 +134,7 @@ void (*taosCloseConn[])(void *chandle) = {NULL, NULL, taosCloseTcpServerConnecti
int taosReSendRspToPeer(SRpcConn *pConn);
void taosProcessTaosTimer(void *, void *);
-void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, short port, void *shandle, void *thandle,
+void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, uint16_t port, void *shandle, void *thandle,
void *chandle);
int taosSendDataToPeer(SRpcConn *pConn, char *data, int dataLen);
void taosProcessSchedMsg(SSchedMsg *pMsg);
@@ -720,7 +720,7 @@ void taosProcessResponse(SRpcConn *pConn) {
}
int taosProcessMsgHeader(STaosHeader *pHeader, SRpcConn **ppConn, STaosRpc *pServer, int dataLen, uint32_t ip,
- short port, void *chandle) {
+ uint16_t port, void *chandle) {
int chann, sid, code = 0;
SRpcConn * pConn = NULL;
SRpcChann *pChann;
@@ -1009,7 +1009,7 @@ void taosProcessIdleTimer(void *param, void *tmrId) {
pthread_mutex_unlock(&pChann->mutex);
}
-void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, short port, void *shandle, void *thandle,
+void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, uint16_t port, void *shandle, void *thandle,
void *chandle) {
STaosHeader *pHeader;
uint8_t code;
@@ -1075,6 +1075,7 @@ void *taosProcessDataFromPeer(char *data, int dataLen, uint32_t ip, short port,
// parsing error
if (pHeader->msgType & 1) {
+ memset(pReply, 0, sizeof(pReply));
msgLen = taosBuildErrorMsgToPeer(data, code, pReply);
(*taosSendData[pServer->type])(ip, port, pReply, msgLen, chandle);
tTrace("%s cid:%d sid:%d id:%s, %s is sent with error code:%u pConn:%p", pServer->label, chann, sid,
@@ -1311,7 +1312,7 @@ void taosProcessTaosTimer(void *param, void *tmrId) {
}
-void taosGetRpcConnInfo(void *thandle, uint32_t *peerId, uint32_t *peerIp, short *peerPort, int *cid, int *sid) {
+void taosGetRpcConnInfo(void *thandle, uint32_t *peerId, uint32_t *peerIp, uint16_t *peerPort, int *cid, int *sid) {
SRpcConn *pConn = (SRpcConn *)thandle;
*peerId = pConn->peerId;
diff --git a/src/rpc/src/ttcpclient.c b/src/rpc/src/ttcpclient.c
index 8e6f91a661..3d39be92fe 100644
--- a/src/rpc/src/ttcpclient.c
+++ b/src/rpc/src/ttcpclient.c
@@ -30,7 +30,7 @@ typedef struct _tcp_fd {
void * thandle;
uint32_t ip;
char ipstr[20];
- short port;
+ uint16_t port;
struct _tcp_client *pTcp;
struct _tcp_fd * prev, *next;
} STcpFd;
@@ -45,7 +45,7 @@ typedef struct _tcp_client {
char label[12];
char ipstr[20];
void * shandle; // handle passed by upper layer during server initialization
- void *(*processData)(char *data, int dataLen, unsigned int ip, short port, void *shandle, void *thandle,
+ void *(*processData)(char *data, int dataLen, unsigned int ip, uint16_t port, void *shandle, void *thandle,
void *chandle);
// char buffer[128000];
} STcpClient;
@@ -194,7 +194,7 @@ static void *taosReadTcpData(void *param) {
return NULL;
}
-void *taosInitTcpClient(char *ip, short port, char *label, int num, void *fp, void *shandle) {
+void *taosInitTcpClient(char *ip, uint16_t port, char *label, int num, void *fp, void *shandle) {
STcpClient * pTcp;
pthread_attr_t thattr;
@@ -229,7 +229,7 @@ void *taosInitTcpClient(char *ip, short port, char *label, int num, void *fp, vo
return NULL;
}
- tTrace("%s TCP client is initialized, ip:%s port:%u", label, ip, port);
+ tTrace("%s TCP client is initialized, ip:%s port:%hu", label, ip, port);
return pTcp;
}
@@ -242,7 +242,7 @@ void taosCloseTcpClientConnection(void *chandle) {
taosCleanUpTcpFdObj(pFdObj);
}
-void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, short port) {
+void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, uint16_t port) {
STcpClient * pTcp = (STcpClient *)shandle;
STcpFd * pFdObj;
struct epoll_event event;
@@ -301,12 +301,12 @@ void *taosOpenTcpClientConnection(void *shandle, void *thandle, char *ip, short
pthread_mutex_unlock(&(pTcp->mutex));
- tTrace("%s TCP connection to ip:%s port:%u is created, numOfFds:%d", pTcp->label, ip, port, pTcp->numOfFds);
+ tTrace("%s TCP connection to ip:%s port:%hu is created, numOfFds:%d", pTcp->label, ip, port, pTcp->numOfFds);
return pFdObj;
}
-int taosSendTcpClientData(uint32_t ip, short port, char *data, int len, void *chandle) {
+int taosSendTcpClientData(uint32_t ip, uint16_t port, char *data, int len, void *chandle) {
STcpFd *pFdObj = (STcpFd *)chandle;
if (chandle == NULL) return -1;
diff --git a/src/rpc/src/ttcpserver.c b/src/rpc/src/ttcpserver.c
index fee506256b..29ada20bc4 100644
--- a/src/rpc/src/ttcpserver.c
+++ b/src/rpc/src/ttcpserver.c
@@ -32,7 +32,7 @@ typedef struct _fd_obj {
void * thandle; // handle from upper layer, like TAOS
char ipstr[TAOS_IPv4ADDR_LEN];
unsigned int ip;
- unsigned short port;
+ uint16_t port;
struct _thread_obj *pThreadObj;
struct _fd_obj * prev, *next;
} SFdObj;
@@ -48,13 +48,13 @@ typedef struct _thread_obj {
char label[12];
// char buffer[128000]; // buffer to receive data
void *shandle; // handle passed by upper layer during server initialization
- void *(*processData)(char *data, int dataLen, unsigned int ip, short port, void *shandle, void *thandle,
+ void *(*processData)(char *data, int dataLen, unsigned int ip, uint16_t port, void *shandle, void *thandle,
void *chandle);
} SThreadObj;
typedef struct {
char ip[40];
- short port;
+ uint16_t port;
char label[12];
int numOfThreads;
void * shandle;
@@ -209,7 +209,7 @@ static void taosProcessTcpData(void *param) {
continue;
}
- pFdObj->thandle = (*(pThreadObj->processData))(buffer, dataLen, pFdObj->ip, (int16_t)pFdObj->port,
+ pFdObj->thandle = (*(pThreadObj->processData))(buffer, dataLen, pFdObj->ip, pFdObj->port,
pThreadObj->shandle, pFdObj->thandle, pFdObj);
if (pFdObj->thandle == NULL) taosCleanUpFdObj(pFdObj);
@@ -232,10 +232,10 @@ void taosAcceptTcpConnection(void *arg) {
sockFd = taosOpenTcpServerSocket(pServerObj->ip, pServerObj->port);
if (sockFd < 0) {
- tError("%s failed to open TCP socket, ip:%s, port:%u", pServerObj->label, pServerObj->ip, pServerObj->port);
+ tError("%s failed to open TCP socket, ip:%s, port:%hu", pServerObj->label, pServerObj->ip, pServerObj->port);
return;
} else {
- tTrace("%s TCP server is ready, ip:%s, port:%u", pServerObj->label, pServerObj->ip, pServerObj->port);
+ tTrace("%s TCP server is ready, ip:%s, port:%hu", pServerObj->label, pServerObj->ip, pServerObj->port);
}
while (1) {
@@ -247,7 +247,7 @@ void taosAcceptTcpConnection(void *arg) {
continue;
}
- tTrace("%s TCP connection from ip:%s port:%u", pServerObj->label, inet_ntoa(clientAddr.sin_addr),
+ tTrace("%s TCP connection from ip:%s port:%hu", pServerObj->label, inet_ntoa(clientAddr.sin_addr),
htons(clientAddr.sin_port));
taosKeepTcpAlive(connFd);
@@ -292,7 +292,7 @@ void taosAcceptTcpConnection(void *arg) {
pthread_mutex_unlock(&(pThreadObj->threadMutex));
- tTrace("%s TCP thread:%d, a new connection, ip:%s port:%u, numOfFds:%d", pServerObj->label, pThreadObj->threadId,
+ tTrace("%s TCP thread:%d, a new connection, ip:%s port:%hu, numOfFds:%d", pServerObj->label, pThreadObj->threadId,
pFdObj->ipstr, pFdObj->port, pThreadObj->numOfFds);
// pick up next thread for next connection
@@ -314,10 +314,10 @@ void taosAcceptUDConnection(void *arg) {
sockFd = taosOpenUDServerSocket(pServerObj->ip, pServerObj->port);
if (sockFd < 0) {
- tError("%s failed to open UD socket, ip:%s, port:%u", pServerObj->label, pServerObj->ip, pServerObj->port);
+ tError("%s failed to open UD socket, ip:%s, port:%hu", pServerObj->label, pServerObj->ip, pServerObj->port);
return;
} else {
- tTrace("%s UD server is ready, ip:%s, port:%u", pServerObj->label, pServerObj->ip, pServerObj->port);
+ tTrace("%s UD server is ready, ip:%s, port:%hu", pServerObj->label, pServerObj->ip, pServerObj->port);
}
while (1) {
@@ -374,7 +374,7 @@ void taosAcceptUDConnection(void *arg) {
}
}
-void *taosInitTcpServer(char *ip, short port, char *label, int numOfThreads, void *fp, void *shandle) {
+void *taosInitTcpServer(char *ip, uint16_t port, char *label, int numOfThreads, void *fp, void *shandle) {
int i;
SServerObj * pServerObj;
pthread_attr_t thattr;
@@ -442,7 +442,7 @@ void *taosInitTcpServer(char *ip, short port, char *label, int numOfThreads, voi
}
*/
pthread_attr_destroy(&thattr);
- tTrace("%s TCP server is initialized, ip:%s port:%u numOfThreads:%d", label, ip, port, numOfThreads);
+ tTrace("%s TCP server is initialized, ip:%s port:%hu numOfThreads:%d", label, ip, port, numOfThreads);
return (void *)pServerObj;
}
@@ -468,7 +468,7 @@ void taosListTcpConnection(void *handle, char *buffer) {
msg = msg + strlen(msg);
pFdObj = pThreadObj->pHead;
while (pFdObj) {
- sprintf(" ip:%s port:%u\n", pFdObj->ipstr, pFdObj->port);
+ sprintf(" ip:%s port:%hu\n", pFdObj->ipstr, pFdObj->port);
msg = msg + strlen(msg);
numOfFds++;
numOfConns++;
@@ -487,7 +487,7 @@ void taosListTcpConnection(void *handle, char *buffer) {
return;
}
-int taosSendTcpServerData(uint32_t ip, short port, char *data, int len, void *chandle) {
+int taosSendTcpServerData(uint32_t ip, uint16_t port, char *data, int len, void *chandle) {
SFdObj *pFdObj = (SFdObj *)chandle;
if (chandle == NULL) return -1;
diff --git a/src/rpc/src/tudp.c b/src/rpc/src/tudp.c
index 58a893f074..bfc95373fc 100644
--- a/src/rpc/src/tudp.c
+++ b/src/rpc/src/tudp.c
@@ -35,8 +35,8 @@ typedef struct {
void * signature;
int index;
int fd;
- short port; // peer port
- short localPort; // local port
+ uint16_t port; // peer port
+ uint16_t localPort; // local port
char label[12]; // copy from udpConnSet;
pthread_t thread;
pthread_mutex_t mutex;
@@ -44,7 +44,7 @@ typedef struct {
void * hash;
void * shandle; // handle passed by upper layer during server initialization
void * pSet;
- void *(*processData)(char *data, int dataLen, unsigned int ip, short port, void *shandle, void *thandle,
+ void *(*processData)(char *data, int dataLen, unsigned int ip, uint16_t port, void *shandle, void *thandle,
void *chandle);
char buffer[RPC_MAX_UDP_SIZE]; // buffer to receive data
} SUdpConn;
@@ -53,21 +53,21 @@ typedef struct {
int index;
int server;
char ip[16]; // local IP
- short port; // local Port
+ uint16_t port; // local Port
void * shandle; // handle passed by upper layer during server initialization
int threads;
char label[12];
void * tmrCtrl;
pthread_t tcpThread;
int tcpFd;
- void *(*fp)(char *data, int dataLen, uint32_t ip, short port, void *shandle, void *thandle, void *chandle);
+ void *(*fp)(char *data, int dataLen, uint32_t ip, uint16_t port, void *shandle, void *thandle, void *chandle);
SUdpConn udpConn[];
} SUdpConnSet;
typedef struct {
void * signature;
uint32_t ip; // dest IP
- short port; // dest Port
+ uint16_t port; // dest Port
SUdpConn * pConn;
struct sockaddr_in destAdd;
void * msgHdr;
@@ -144,12 +144,12 @@ void *taosReadTcpData(void *argv) {
pInfo->msgLen = (int32_t)htonl((uint32_t)pInfo->msgLen);
tinet_ntoa(ipstr, pMonitor->ip);
- tTrace("%s receive packet via TCP:%s:%d, msgLen:%d, handle:0x%x, source:0x%08x dest:0x%08x tranId:%d", pSet->label,
+ tTrace("%s receive packet via TCP:%s:%hu, msgLen:%d, handle:0x%x, source:0x%08x dest:0x%08x tranId:%d", pSet->label,
ipstr, pInfo->port, pInfo->msgLen, pInfo->handle, pHead->sourceId, pHead->destId, pHead->tranId);
fd = taosOpenTcpClientSocket(ipstr, (int16_t)pInfo->port, tsLocalIp);
if (fd < 0) {
- tError("%s failed to open TCP client socket ip:%s:%d", pSet->label, ipstr, pInfo->port);
+ tError("%s failed to open TCP client socket ip:%s:%hu", pSet->label, ipstr, pInfo->port);
pMonitor->pSet = NULL;
return NULL;
}
@@ -180,7 +180,7 @@ void *taosReadTcpData(void *argv) {
tError("%s failed to read data from server, msgLen:%d retLen:%d", pSet->label, pInfo->msgLen, retLen);
tfree(buffer);
} else {
- (*pSet->fp)(buffer, pInfo->msgLen, pMonitor->ip, (int16_t)pInfo->port, pSet->shandle, NULL, pMonitor->pConn);
+ (*pSet->fp)(buffer, pInfo->msgLen, pMonitor->ip, pInfo->port, pSet->shandle, NULL, pMonitor->pConn);
}
}
@@ -224,7 +224,7 @@ void *taosRecvUdpData(void *param) {
struct sockaddr_in sourceAdd;
unsigned int addLen, dataLen;
SUdpConn * pConn = (SUdpConn *)param;
- short port;
+ uint16_t port;
int minSize = sizeof(STaosHeader);
memset(&sourceAdd, 0, sizeof(sourceAdd));
@@ -242,7 +242,7 @@ void *taosRecvUdpData(void *param) {
continue;
}
- port = (int16_t)ntohs(sourceAdd.sin_port);
+ port = ntohs(sourceAdd.sin_port);
int processedLen = 0, leftLen = 0;
int msgLen = 0;
@@ -307,7 +307,7 @@ void *taosTransferDataViaTcp(void *argv) {
if (handle == 0) {
// receive a packet from client
- tTrace("%s data will be received via TCP from 0x%x:%d", pSet->label, pTransfer->ip, pTransfer->port);
+ tTrace("%s data will be received via TCP from 0x%x:%hu", pSet->label, pTransfer->ip, pTransfer->port);
retLen = taosReadMsg(connFd, &head, sizeof(STaosHeader));
if (retLen != (int)sizeof(STaosHeader)) {
tError("%s failed to read msg header, retLen:%d", pSet->label, retLen);
@@ -345,7 +345,7 @@ void *taosTransferDataViaTcp(void *argv) {
tError("%s failed to read data from client, leftLen:%d retLen:%d, error:%s", pSet->label, leftLen, retLen,
strerror(errno));
} else {
- tTrace("%s data is received from client via TCP from 0x%x:%d, msgLen:%d", pSet->label, pTransfer->ip,
+ tTrace("%s data is received from client via TCP from 0x%x:%hu, msgLen:%d", pSet->label, pTransfer->ip,
pTransfer->port, msgLen);
pSet->index = (pSet->index + 1) % pSet->threads;
SUdpConn *pConn = pSet->udpConn + pSet->index;
@@ -388,7 +388,7 @@ void *taosTransferDataViaTcp(void *argv) {
if (retLen != msgLen) {
tError("%s failed to send data to client, msgLen:%d retLen:%d", pSet->label, msgLen, retLen);
} else {
- tTrace("%s data is sent to client successfully via TCP to 0x%x:%d, size:%d", pSet->label, pTransfer->ip,
+ tTrace("%s data is sent to client successfully via TCP to 0x%x:%hu, size:%d", pSet->label, pTransfer->ip,
pTransfer->port, msgLen);
}
}
@@ -413,13 +413,13 @@ void *taosUdpTcpConnection(void *argv) {
pSet->tcpFd = taosOpenTcpServerSocket(pSet->ip, pSet->port);
if (pSet->tcpFd < 0) {
- tPrint("%s failed to create TCP socket %s:%d for UDP server, reason:%s", pSet->label, pSet->ip, pSet->port,
+ tPrint("%s failed to create TCP socket %s:%hu for UDP server, reason:%s", pSet->label, pSet->ip, pSet->port,
strerror(errno));
taosKillSystem();
return NULL;
}
- tTrace("%s UDP server is created, ip:%s:%d", pSet->label, pSet->ip, pSet->port);
+ tTrace("%s UDP server is created, ip:%s:%hu", pSet->label, pSet->ip, pSet->port);
pthread_attr_init(&thattr);
pthread_attr_setdetachstate(&thattr, PTHREAD_CREATE_DETACHED);
@@ -455,7 +455,7 @@ void *taosUdpTcpConnection(void *argv) {
return NULL;
}
-void *taosInitUdpConnection(char *ip, short port, char *label, int threads, void *fp, void *shandle) {
+void *taosInitUdpConnection(char *ip, uint16_t port, char *label, int threads, void *fp, void *shandle) {
pthread_attr_t thAttr;
SUdpConn * pConn;
SUdpConnSet * pSet;
@@ -488,13 +488,13 @@ void *taosInitUdpConnection(char *ip, short port, char *label, int threads, void
pthread_attr_init(&thAttr);
pthread_attr_setdetachstate(&thAttr, PTHREAD_CREATE_JOINABLE);
- short ownPort;
+ uint16_t ownPort;
for (int i = 0; i < threads; ++i) {
pConn = pSet->udpConn + i;
- ownPort = (int16_t)(port ? port + i : 0);
+ ownPort = (port ? port + i : 0);
pConn->fd = taosOpenUdpSocket(ip, ownPort);
if (pConn->fd < 0) {
- tError("%s failed to open UDP socket %s:%d", label, ip, port);
+ tError("%s failed to open UDP socket %s:%hu", label, ip, port);
taosCleanUpUdpConnection(pSet);
return NULL;
}
@@ -529,12 +529,12 @@ void *taosInitUdpConnection(char *ip, short port, char *label, int threads, void
}
pthread_attr_destroy(&thAttr);
- tTrace("%s UDP connection is initialized, ip:%s port:%u threads:%d", label, ip, port, threads);
+ tTrace("%s UDP connection is initialized, ip:%s port:%hu threads:%d", label, ip, port, threads);
return pSet;
}
-void *taosInitUdpServer(char *ip, short port, char *label, int threads, void *fp, void *shandle) {
+void *taosInitUdpServer(char *ip, uint16_t port, char *label, int threads, void *fp, void *shandle) {
SUdpConnSet *pSet;
pSet = taosInitUdpConnection(ip, port, label, threads, fp, shandle);
if (pSet == NULL) return NULL;
@@ -555,7 +555,7 @@ void *taosInitUdpServer(char *ip, short port, char *label, int threads, void *fp
return pSet;
}
-void *taosInitUdpClient(char *ip, short port, char *label, int threads, void *fp, void *shandle) {
+void *taosInitUdpClient(char *ip, uint16_t port, char *label, int threads, void *fp, void *shandle) {
return taosInitUdpConnection(ip, port, label, threads, fp, shandle);
}
@@ -591,7 +591,7 @@ void taosCleanUpUdpConnection(void *handle) {
tfree(pSet);
}
-void *taosOpenUdpConnection(void *shandle, void *thandle, char *ip, short port) {
+void *taosOpenUdpConnection(void *shandle, void *thandle, char *ip, uint16_t port) {
SUdpConnSet *pSet = (SUdpConnSet *)shandle;
pSet->index = (pSet->index + 1) % pSet->threads;
@@ -599,7 +599,7 @@ void *taosOpenUdpConnection(void *shandle, void *thandle, char *ip, short port)
SUdpConn *pConn = pSet->udpConn + pSet->index;
pConn->port = port;
- tTrace("%s UDP connection is setup, ip: %s:%d, local: %s:%d", pConn->label, ip, port, pSet->ip,
+ tTrace("%s UDP connection is setup, ip: %s:%hu, local: %s:%d", pConn->label, ip, port, pSet->ip,
ntohs((uint16_t)pConn->localPort));
return pConn;
@@ -643,7 +643,7 @@ void taosProcessUdpBufTimer(void *param, void *tmrId) {
if (pBuf) taosTmrReset(taosProcessUdpBufTimer, RPC_UDP_BUF_TIME, pBuf, pConn->tmrCtrl, &pBuf->timer);
}
-SUdpBuf *taosCreateUdpBuf(SUdpConn *pConn, uint32_t ip, short port) {
+SUdpBuf *taosCreateUdpBuf(SUdpConn *pConn, uint32_t ip, uint16_t port) {
SUdpBuf *pBuf = (SUdpBuf *)malloc(sizeof(SUdpBuf));
memset(pBuf, 0, sizeof(SUdpBuf));
@@ -653,7 +653,7 @@ SUdpBuf *taosCreateUdpBuf(SUdpConn *pConn, uint32_t ip, short port) {
pBuf->destAdd.sin_family = AF_INET;
pBuf->destAdd.sin_addr.s_addr = ip;
- pBuf->destAdd.sin_port = (uint16_t)htons((uint16_t)port);
+ pBuf->destAdd.sin_port = (uint16_t)htons(port);
taosInitMsgHdr(&(pBuf->msgHdr), &(pBuf->destAdd), RPC_MAX_UDP_PKTS);
pBuf->signature = pBuf;
taosTmrReset(taosProcessUdpBufTimer, RPC_UDP_BUF_TIME, pBuf, pConn->tmrCtrl, &pBuf->timer);
@@ -664,7 +664,7 @@ SUdpBuf *taosCreateUdpBuf(SUdpConn *pConn, uint32_t ip, short port) {
return pBuf;
}
-int taosSendPacketViaTcp(uint32_t ip, short port, char *data, int dataLen, void *chandle) {
+int taosSendPacketViaTcp(uint32_t ip, uint16_t port, char *data, int dataLen, void *chandle) {
SUdpConn * pConn = (SUdpConn *)chandle;
SUdpConnSet *pSet = (SUdpConnSet *)pConn->pSet;
int code = -1, retLen, msgLen;
@@ -681,13 +681,13 @@ int taosSendPacketViaTcp(uint32_t ip, short port, char *data, int dataLen, void
SPacketInfo *pInfo = (SPacketInfo *)pHead->content;
pInfo->handle = (uint64_t)data;
- pInfo->port = (uint16_t)pSet->port;
+ pInfo->port = pSet->port;
pInfo->msgLen = pHead->msgLen;
msgLen = sizeof(STaosHeader) + sizeof(SPacketInfo);
pHead->msgLen = (int32_t)htonl((uint32_t)msgLen);
code = taosSendUdpData(ip, port, buffer, msgLen, chandle);
- tTrace("%s data from server will be sent via TCP:%d, msgType:%d, length:%d, handle:0x%x", pSet->label, pInfo->port,
+ tTrace("%s data from server will be sent via TCP:%hu, msgType:%d, length:%d, handle:0x%x", pSet->label, pInfo->port,
pHead->msgType, htonl((uint32_t)pInfo->msgLen), pInfo->handle);
if (code > 0) code = dataLen;
} else {
@@ -707,7 +707,7 @@ int taosSendPacketViaTcp(uint32_t ip, short port, char *data, int dataLen, void
tinet_ntoa(ipstr, ip);
int fd = taosOpenTcpClientSocket(ipstr, pConn->port, tsLocalIp);
if (fd < 0) {
- tError("%s failed to open TCP socket to:%s:%u to send packet", pSet->label, ipstr, pConn->port);
+ tError("%s failed to open TCP socket to:%s:%hu to send packet", pSet->label, ipstr, pConn->port);
} else {
SHandleViaTcp handleViaTcp;
taosInitHandleViaTcp(&handleViaTcp, 0);
@@ -735,7 +735,7 @@ int taosSendPacketViaTcp(uint32_t ip, short port, char *data, int dataLen, void
return code;
}
-int taosSendUdpData(uint32_t ip, short port, char *data, int dataLen, void *chandle) {
+int taosSendUdpData(uint32_t ip, uint16_t port, char *data, int dataLen, void *chandle) {
SUdpConn *pConn = (SUdpConn *)chandle;
SUdpBuf * pBuf;
@@ -748,7 +748,7 @@ int taosSendUdpData(uint32_t ip, short port, char *data, int dataLen, void *chan
memset(&destAdd, 0, sizeof(destAdd));
destAdd.sin_family = AF_INET;
destAdd.sin_addr.s_addr = ip;
- destAdd.sin_port = htons((uint16_t)port);
+ destAdd.sin_port = htons(port);
int ret = (int)sendto(pConn->fd, data, (size_t)dataLen, 0, (struct sockaddr *)&destAdd, sizeof(destAdd));
tTrace("%s msg is sent to 0x%x:%hu len:%d ret:%d localPort:%hu chandle:0x%x", pConn->label, destAdd.sin_addr.s_addr,
diff --git a/src/system/detail/inc/mgmt.h b/src/system/detail/inc/mgmt.h
index 4de31325d0..27928648e5 100644
--- a/src/system/detail/inc/mgmt.h
+++ b/src/system/detail/inc/mgmt.h
@@ -146,7 +146,7 @@ typedef struct _vg_obj {
} SVgObj;
typedef struct _db_obj {
- char name[TSDB_DB_NAME_LEN + 1];
+ char name[TSDB_METER_ID_LEN + 1];
int64_t createdTime;
SDbCfg cfg;
int32_t numOfVgroups;
@@ -222,7 +222,7 @@ typedef struct _connObj {
uint32_t queryId; // query ID to be killed
uint32_t streamId; // stream ID to be killed
uint32_t ip; // shell IP
- short port; // shell port
+ uint16_t port; // shell port
void * thandle;
SQList * pQList; // query list
SSList * pSList; // stream list
diff --git a/src/system/detail/inc/vnodeShell.h b/src/system/detail/inc/vnodeShell.h
index e450983dd7..25646fbb1a 100644
--- a/src/system/detail/inc/vnodeShell.h
+++ b/src/system/detail/inc/vnodeShell.h
@@ -26,7 +26,7 @@ typedef struct {
int sid;
int vnode;
uint32_t ip;
- short port;
+ uint16_t port;
int count; // track the number of imports
int code; // track the code of imports
int numOfTotalPoints; // track the total number of points imported
diff --git a/src/system/detail/inc/vnodeUtil.h b/src/system/detail/inc/vnodeUtil.h
index 8705794660..b0f573ba2d 100644
--- a/src/system/detail/inc/vnodeUtil.h
+++ b/src/system/detail/inc/vnodeUtil.h
@@ -81,6 +81,8 @@ int32_t vnodeSetMeterState(SMeterObj* pMeterObj, int32_t state);
void vnodeClearMeterState(SMeterObj* pMeterObj, int32_t state);
bool vnodeIsMeterState(SMeterObj* pMeterObj, int32_t state);
void vnodeSetMeterDeleting(SMeterObj* pMeterObj);
+int32_t vnodeSetMeterInsertImportStateEx(SMeterObj* pObj, int32_t st);
+
bool vnodeIsSafeToDeleteMeter(SVnodeObj* pVnode, int32_t sid);
void vnodeFreeColumnInfo(SColumnInfo* pColumnInfo);
bool isGroupbyNormalCol(SSqlGroupbyExpr* pExpr);
diff --git a/src/system/detail/src/mgmtConn.c b/src/system/detail/src/mgmtConn.c
index 40385d2fc4..13275300a6 100644
--- a/src/system/detail/src/mgmtConn.c
+++ b/src/system/detail/src/mgmtConn.c
@@ -25,7 +25,7 @@ typedef struct {
char user[TSDB_METER_ID_LEN];
uint64_t stime;
uint32_t ip;
- short port;
+ uint16_t port;
} SConnInfo;
typedef struct {
diff --git a/src/system/detail/src/mgmtProfile.c b/src/system/detail/src/mgmtProfile.c
index bd5540e5ee..e7dbeaaa25 100644
--- a/src/system/detail/src/mgmtProfile.c
+++ b/src/system/detail/src/mgmtProfile.c
@@ -23,7 +23,7 @@
typedef struct {
uint32_t ip;
- short port;
+ uint16_t port;
char user[TSDB_METER_ID_LEN];
} SCDesc;
@@ -180,7 +180,7 @@ int mgmtKillQuery(char *qidstr, SConnObj *pConn) {
chr = strchr(temp, ':');
if (chr == NULL) goto _error;
*chr = 0;
- short port = htons(atoi(temp));
+ uint16_t port = htons(atoi(temp));
temp = chr + 1;
uint32_t queryId = atoi(temp);
@@ -448,7 +448,7 @@ int mgmtKillStream(char *qidstr, SConnObj *pConn) {
chr = strchr(temp, ':');
if (chr == NULL) goto _error;
*chr = 0;
- short port = htons(atoi(temp));
+ uint16_t port = htons(atoi(temp));
temp = chr + 1;
uint32_t streamId = atoi(temp);
diff --git a/src/system/detail/src/mgmtShell.c b/src/system/detail/src/mgmtShell.c
index 85705fe62d..f41d789001 100644
--- a/src/system/detail/src/mgmtShell.c
+++ b/src/system/detail/src/mgmtShell.c
@@ -1280,7 +1280,7 @@ void *mgmtProcessMsgFromShell(char *msg, void *ahandle, void *thandle) {
if (pConn->pUser) {
pConn->pAcct = mgmtGetAcct(pConn->pUser->acct);
mgmtEstablishConn(pConn);
- mTrace("login from:%x:%d", pConn->ip, htons(pConn->port));
+ mTrace("login from:%x:%hu", pConn->ip, htons(pConn->port));
}
}
diff --git a/src/system/detail/src/vnodeImport.c b/src/system/detail/src/vnodeImport.c
index 0d3cd2b338..4cc8e84e7e 100644
--- a/src/system/detail/src/vnodeImport.c
+++ b/src/system/detail/src/vnodeImport.c
@@ -286,12 +286,9 @@ void vnodeProcessImportTimer(void *param, void *tmrId) {
SShellObj *pShell = pImport->pShell;
pImport->retry++;
-
- //slow query will block the import operation
- int32_t state = vnodeSetMeterState(pObj, TSDB_METER_STATE_IMPORTING);
- if (state >= TSDB_METER_STATE_DELETING) {
- dError("vid:%d sid:%d id:%s, meter is deleted, failed to import, state:%d",
- pObj->vnode, pObj->sid, pObj->meterId, state);
+
+ int32_t code = vnodeSetMeterInsertImportStateEx(pObj, TSDB_METER_STATE_IMPORTING);
+ if (code == TSDB_CODE_NOT_ACTIVE_TABLE) {
return;
}
@@ -303,14 +300,14 @@ void vnodeProcessImportTimer(void *param, void *tmrId) {
//if the num == 0, it will never be increased before state is set to TSDB_METER_STATE_READY
int32_t commitInProcess = 0;
pthread_mutex_lock(&pPool->vmutex);
- if (((commitInProcess = pPool->commitInProcess) == 1) || num > 0 || state != TSDB_METER_STATE_READY) {
+ if (((commitInProcess = pPool->commitInProcess) == 1) || num > 0 || code == TSDB_CODE_ACTION_IN_PROGRESS) {
pthread_mutex_unlock(&pPool->vmutex);
vnodeClearMeterState(pObj, TSDB_METER_STATE_IMPORTING);
if (pImport->retry < 1000) {
dTrace("vid:%d sid:%d id:%s, import failed, retry later. commit in process or queries on it, or not ready."
"commitInProcess:%d, numOfQueries:%d, state:%d", pObj->vnode, pObj->sid, pObj->meterId,
- commitInProcess, num, state);
+ commitInProcess, num, pObj->state);
taosTmrStart(vnodeProcessImportTimer, 10, pImport, vnodeTmrCtrl);
return;
@@ -320,15 +317,14 @@ void vnodeProcessImportTimer(void *param, void *tmrId) {
} else {
pPool->commitInProcess = 1;
pthread_mutex_unlock(&pPool->vmutex);
- int code = vnodeImportData(pObj, pImport);
+ int32_t ret = vnodeImportData(pObj, pImport);
if (pShell) {
- pShell->code = code;
+ pShell->code = ret;
pShell->numOfTotalPoints += pImport->importedRows;
}
}
vnodeClearMeterState(pObj, TSDB_METER_STATE_IMPORTING);
-
pVnode->version++;
// send response back to shell
@@ -702,8 +698,8 @@ int vnodeFindKeyInFile(SImportInfo *pImport, int order) {
if (pImport->key != key && pImport->pos > 0) {
if ( pObj->sversion != pBlock->sversion ) {
- dError("vid:%d sid:%d id:%s, import sversion not matached, expected:%d received:%d", pObj->vnode, pObj->sid,
- pBlock->sversion, pObj->sversion);
+ dError("vid:%d sid:%d id:%s, import sversion not matched, expected:%d received:%d", pObj->vnode, pObj->sid,
+ pObj->meterId, pBlock->sversion, pObj->sversion);
code = TSDB_CODE_OTHERS;
} else {
pImport->offset = pBlock->offset;
@@ -912,16 +908,12 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
}
if (*((TSKEY *)(pSubmit->payLoad + (rows - 1) * pObj->bytesPerPoint)) > pObj->lastKey) {
- vnodeClearMeterState(pObj, TSDB_METER_STATE_IMPORTING);
- vnodeSetMeterState(pObj, TSDB_METER_STATE_INSERT);
code = vnodeInsertPoints(pObj, cont, contLen, TSDB_DATA_SOURCE_LOG, NULL, pObj->sversion, &pointsImported, now);
if (pShell) {
pShell->code = code;
pShell->numOfTotalPoints += pointsImported;
}
-
- vnodeClearMeterState(pObj, TSDB_METER_STATE_INSERT);
} else {
SImportInfo *pNew, import;
@@ -933,7 +925,11 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
import.pShell = pShell;
import.payload = payload;
import.rows = rows;
-
+
+ if ((code = vnodeSetMeterInsertImportStateEx(pObj, TSDB_METER_STATE_IMPORTING)) != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+
int32_t num = 0;
pthread_mutex_lock(&pVnode->vmutex);
num = pObj->numOfQueries;
@@ -944,7 +940,8 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
pthread_mutex_lock(&pPool->vmutex);
if (((commitInProcess = pPool->commitInProcess) == 1) || num > 0) {
pthread_mutex_unlock(&pPool->vmutex);
-
+ vnodeClearMeterState(pObj, TSDB_METER_STATE_IMPORTING);
+
pNew = (SImportInfo *)malloc(sizeof(SImportInfo));
memcpy(pNew, &import, sizeof(SImportInfo));
pNew->signature = pNew;
@@ -956,19 +953,25 @@ int vnodeImportPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
dTrace("vid:%d sid:%d id:%s, import later, commit in process:%d, numOfQueries:%d", pObj->vnode, pObj->sid,
pObj->meterId, commitInProcess, pObj->numOfQueries);
+ /*
+ * vnodeProcessImportTimer will set the import status for this table, so need to
+ * set the import flag here
+ */
taosTmrStart(vnodeProcessImportTimer, 10, pNew, vnodeTmrCtrl);
return 0;
} else {
pPool->commitInProcess = 1;
pthread_mutex_unlock(&pPool->vmutex);
- int code = vnodeImportData(pObj, &import);
+
+ int ret = vnodeImportData(pObj, &import);
if (pShell) {
- pShell->code = code;
+ pShell->code = ret;
pShell->numOfTotalPoints += import.importedRows;
}
}
}
+ vnodeClearMeterState(pObj, TSDB_METER_STATE_IMPORTING);
pVnode->version++;
if (pShell) {
diff --git a/src/system/detail/src/vnodeMeter.c b/src/system/detail/src/vnodeMeter.c
index 06135a7e9e..d3f672a886 100644
--- a/src/system/detail/src/vnodeMeter.c
+++ b/src/system/detail/src/vnodeMeter.c
@@ -572,7 +572,7 @@ int vnodeInsertPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
dTrace("vid:%d sid:%d id:%s, cache is full, freePoints:%d, notFreeSlots:%d", pObj->vnode, pObj->sid, pObj->meterId,
pObj->freePoints, pPool->notFreeSlots);
vnodeProcessCommitTimer(pVnode, NULL);
- return TSDB_CODE_ACTION_IN_PROGRESS;
+ return code;
}
// FIXME: Here should be after the comparison of sversions.
@@ -596,7 +596,7 @@ int vnodeInsertPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
}
pData = pSubmit->payLoad;
- code = 0;
+ code = TSDB_CODE_SUCCESS;
TSKEY firstKey = *((TSKEY *)pData);
TSKEY lastKey = *((TSKEY *)(pData + pObj->bytesPerPoint * (numOfPoints - 1)));
@@ -608,9 +608,12 @@ int vnodeInsertPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
pObj->vnode, pObj->sid, pObj->meterId, pVnode->lastKeyOnFile, numOfPoints,firstKey, lastKey, minAllowedKey, maxAllowedKey);
return TSDB_CODE_TIMESTAMP_OUT_OF_RANGE;
}
-
- for (i = 0; i < numOfPoints; ++i) {
- // meter will be dropped, abort current insertion
+
+ if ((code = vnodeSetMeterInsertImportStateEx(pObj, TSDB_METER_STATE_INSERT)) != TSDB_CODE_SUCCESS) {
+ goto _over;
+ }
+
+ for (i = 0; i < numOfPoints; ++i) { // meter will be dropped, abort current insertion
if (pObj->state >= TSDB_METER_STATE_DELETING) {
dWarn("vid:%d sid:%d id:%s, meter is dropped, abort insert, state:%d", pObj->vnode, pObj->sid, pObj->meterId,
pObj->state);
@@ -652,6 +655,7 @@ int vnodeInsertPoints(SMeterObj *pObj, char *cont, int contLen, char source, voi
pVnode->version++;
pthread_mutex_unlock(&(pVnode->vmutex));
+ vnodeClearMeterState(pObj, TSDB_METER_STATE_INSERT);
_over:
dTrace("vid:%d sid:%d id:%s, %d out of %d points are inserted, lastKey:%ld source:%d, vnode total storage: %ld",
diff --git a/src/system/detail/src/vnodeShell.c b/src/system/detail/src/vnodeShell.c
index d39fda8042..c0d149b0d1 100644
--- a/src/system/detail/src/vnodeShell.c
+++ b/src/system/detail/src/vnodeShell.c
@@ -48,7 +48,7 @@ void *vnodeProcessMsgFromShell(char *msg, void *ahandle, void *thandle) {
SShellObj *pObj = (SShellObj *)ahandle;
SIntMsg * pMsg = (SIntMsg *)msg;
uint32_t peerId, peerIp;
- short peerPort;
+ uint16_t peerPort;
char ipstr[20];
if (msg == NULL) {
@@ -566,40 +566,15 @@ int vnodeProcessShellSubmitRequest(char *pMsg, int msgLen, SShellObj *pObj) {
int subMsgLen = sizeof(pBlocks->numOfRows) + htons(pBlocks->numOfRows) * pMeterObj->bytesPerPoint;
int sversion = htonl(pBlocks->sversion);
- int32_t state = TSDB_METER_STATE_READY;
if (pSubmit->import) {
- state = vnodeSetMeterState(pMeterObj, TSDB_METER_STATE_IMPORTING);
+ code = vnodeImportPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, pObj,
+ sversion, &numOfPoints, now);
} else {
- state = vnodeSetMeterState(pMeterObj, TSDB_METER_STATE_INSERT);
+ code = vnodeInsertPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, NULL,
+ sversion, &numOfPoints, now);
}
- if (state == TSDB_METER_STATE_READY) {
- // meter status is ready for insert/import
- if (pSubmit->import) {
- code = vnodeImportPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, pObj,
- sversion, &numOfPoints, now);
- vnodeClearMeterState(pMeterObj, TSDB_METER_STATE_IMPORTING);
- } else {
- code = vnodeInsertPoints(pMeterObj, (char *) &(pBlocks->numOfRows), subMsgLen, TSDB_DATA_SOURCE_SHELL, NULL,
- sversion, &numOfPoints, now);
- vnodeClearMeterState(pMeterObj, TSDB_METER_STATE_INSERT);
- }
-
- if (code != TSDB_CODE_SUCCESS) {break;}
- } else {
- if (vnodeIsMeterState(pMeterObj, TSDB_METER_STATE_DELETING)) {
- dTrace("vid:%d sid:%d id:%s, it is removed, state:%d", pMeterObj->vnode, pMeterObj->sid, pMeterObj->meterId,
- pMeterObj->state);
- code = TSDB_CODE_NOT_ACTIVE_TABLE;
- break;
- } else {// waiting for 300ms by default and try again
- dTrace("vid:%d sid:%d id:%s, try submit again since in state:%d", pMeterObj->vnode, pMeterObj->sid,
- pMeterObj->meterId, pMeterObj->state);
-
- code = TSDB_CODE_ACTION_IN_PROGRESS;
- break;
- }
- }
+ if (code != TSDB_CODE_SUCCESS) {break;}
numOfTotalPoints += numOfPoints;
pBlocks = (SShellSubmitBlock *)((char *)pBlocks + sizeof(SShellSubmitBlock) +
diff --git a/src/system/detail/src/vnodeStream.c b/src/system/detail/src/vnodeStream.c
index 00447cced8..6b5f82a687 100644
--- a/src/system/detail/src/vnodeStream.c
+++ b/src/system/detail/src/vnodeStream.c
@@ -56,14 +56,11 @@ void vnodeProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) {
contLen += sizeof(SSubmitMsg);
int32_t numOfPoints = 0;
+ int32_t code = vnodeInsertPoints(pObj, (char *)pMsg, contLen, TSDB_DATA_SOURCE_SHELL, NULL, pObj->sversion,
+ &numOfPoints, taosGetTimestamp(vnodeList[pObj->vnode].cfg.precision));
- int32_t state = vnodeSetMeterState(pObj, TSDB_METER_STATE_INSERT);
- if (state == TSDB_METER_STATE_READY) {
- vnodeInsertPoints(pObj, (char *)pMsg, contLen, TSDB_DATA_SOURCE_SHELL, NULL, pObj->sversion, &numOfPoints, taosGetTimestamp(vnodeList[pObj->vnode].cfg.precision));
- vnodeClearMeterState(pObj, TSDB_METER_STATE_INSERT);
- } else {
- dError("vid:%d sid:%d id:%s, failed to insert continuous query results, state:%d", pObj->vnode, pObj->sid,
- pObj->meterId, state);
+ if (code != TSDB_CODE_SUCCESS) {
+ dError("vid:%d sid:%d id:%s, failed to insert continuous query results", pObj->vnode, pObj->sid, pObj->meterId);
}
assert(numOfPoints >= 0 && numOfPoints <= 1);
diff --git a/src/system/detail/src/vnodeUtil.c b/src/system/detail/src/vnodeUtil.c
index b8c463f50b..52b27f5d6d 100644
--- a/src/system/detail/src/vnodeUtil.c
+++ b/src/system/detail/src/vnodeUtil.c
@@ -668,6 +668,26 @@ void vnodeSetMeterDeleting(SMeterObj* pMeterObj) {
pMeterObj->state |= TSDB_METER_STATE_DELETING;
}
+int32_t vnodeSetMeterInsertImportStateEx(SMeterObj* pObj, int32_t st) {
+ int32_t code = TSDB_CODE_SUCCESS;
+
+ int32_t state = vnodeSetMeterState(pObj, st);
+ if (state != TSDB_METER_STATE_READY) {//return to denote import is not performed
+ if (vnodeIsMeterState(pObj, TSDB_METER_STATE_DELETING)) {
+ dTrace("vid:%d sid:%d id:%s, meter is deleted, state:%d", pObj->vnode, pObj->sid, pObj->meterId,
+ pObj->state);
+ code = TSDB_CODE_NOT_ACTIVE_TABLE;
+ } else {// waiting for 300ms by default and try again
+ dTrace("vid:%d sid:%d id:%s, try submit again since in state:%d", pObj->vnode, pObj->sid,
+ pObj->meterId, pObj->state);
+
+ code = TSDB_CODE_ACTION_IN_PROGRESS;
+ }
+ }
+
+ return code;
+}
+
bool vnodeIsSafeToDeleteMeter(SVnodeObj* pVnode, int32_t sid) {
SMeterObj* pObj = pVnode->meterList[sid];
diff --git a/src/util/src/sql.c b/src/util/src/sql.c
index 7e90e5f939..2922fd8672 100644
--- a/src/util/src/sql.c
+++ b/src/util/src/sql.c
@@ -30,7 +30,6 @@
#include
#include
#include
-
#include "tsql.h"
#include "tutil.h"
/**************** End of %include directives **********************************/
@@ -79,13 +78,15 @@
** defined, then do no error processing.
** YYNSTATE the combined number of states.
** YYNRULE the number of rules in the grammar
+** YYNTOKEN Number of terminal symbols
** YY_MAX_SHIFT Maximum value for shift actions
** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
-** YY_MIN_REDUCE Maximum value for reduce actions
** YY_ERROR_ACTION The yy_action[] code for syntax error
** YY_ACCEPT_ACTION The yy_action[] code for accept
** YY_NO_ACTION The yy_action[] code for no-op
+** YY_MIN_REDUCE Minimum value for reduce actions
+** YY_MAX_REDUCE Maximum value for reduce actions
*/
#ifndef INTERFACE
# define INTERFACE 1
@@ -122,21 +123,18 @@ typedef union {
#define ParseARG_STORE yypParser->pInfo = pInfo
#define YYFALLBACK 1
#define YYNSTATE 251
-#define YYNRULE 213
+#define YYNRULE 214
+#define YYNTOKEN 195
#define YY_MAX_SHIFT 250
#define YY_MIN_SHIFTREDUCE 401
-#define YY_MAX_SHIFTREDUCE 613
-#define YY_MIN_REDUCE 614
-#define YY_MAX_REDUCE 826
-#define YY_ERROR_ACTION 827
-#define YY_ACCEPT_ACTION 828
-#define YY_NO_ACTION 829
+#define YY_MAX_SHIFTREDUCE 614
+#define YY_ERROR_ACTION 615
+#define YY_ACCEPT_ACTION 616
+#define YY_NO_ACTION 617
+#define YY_MIN_REDUCE 618
+#define YY_MAX_REDUCE 831
/************* End control #defines *******************************************/
-/* The yyzerominor constant is used to initialize instances of
-** YYMINORTYPE objects to zero. */
-static const YYMINORTYPE yyzerominor = { 0 };
-
/* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise.
**
@@ -164,9 +162,6 @@ static const YYMINORTYPE yyzerominor = { 0 };
** N between YY_MIN_SHIFTREDUCE Shift to an arbitrary state then
** and YY_MAX_SHIFTREDUCE reduce by rule N-YY_MIN_SHIFTREDUCE.
**
-** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
-** and YY_MAX_REDUCE
-
** N == YY_ERROR_ACTION A syntax error has occurred.
**
** N == YY_ACCEPT_ACTION The parser accepts its input.
@@ -174,21 +169,22 @@ static const YYMINORTYPE yyzerominor = { 0 };
** N == YY_NO_ACTION No such action. Denotes unused
** slots in the yy_action[] table.
**
+** N between YY_MIN_REDUCE Reduce by rule N-YY_MIN_REDUCE
+** and YY_MAX_REDUCE
+**
** The action table is constructed as a single large table named yy_action[].
-** Given state S and lookahead X, the action is computed as
+** Given state S and lookahead X, the action is computed as either:
**
-** yy_action[ yy_shift_ofst[S] + X ]
+** (A) N = yy_action[ yy_shift_ofst[S] + X ]
+** (B) N = yy_default[S]
**
-** If the index value yy_shift_ofst[S]+X is out of range or if the value
-** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
-** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
-** and that yy_default[S] should be used instead.
+** The (A) formula is preferred. The B formula is used instead if
+** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
**
-** The formula above is for computing the action when the lookahead is
+** The formulas above are for computing the action when the lookahead is
** a terminal symbol. If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
-** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
-** YY_SHIFT_USE_DFLT.
+** the yy_shift_ofst[] array.
**
** The following are the tables generated in this section:
**
@@ -202,196 +198,214 @@ static const YYMINORTYPE yyzerominor = { 0 };
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (529)
+#define YY_ACTTAB_COUNT (530)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 439, 36, 35, 153, 249, 34, 33, 32, 440, 34,
- /* 10 */ 33, 32, 43, 45, 49, 37, 38, 74, 78, 244,
- /* 20 */ 31, 85, 77, 205, 41, 39, 42, 40, 80, 133,
- /* 30 */ 101, 50, 36, 35, 527, 171, 34, 33, 32, 43,
- /* 40 */ 45, 154, 37, 38, 114, 115, 224, 31, 65, 68,
- /* 50 */ 205, 41, 39, 42, 40, 76, 133, 828, 250, 36,
- /* 60 */ 35, 241, 241, 34, 33, 32, 43, 45, 155, 37,
- /* 70 */ 38, 128, 126, 245, 31, 89, 88, 205, 41, 39,
- /* 80 */ 42, 40, 202, 524, 59, 135, 36, 35, 439, 21,
- /* 90 */ 34, 33, 32, 520, 159, 596, 440, 10, 57, 172,
- /* 100 */ 135, 135, 227, 226, 101, 45, 439, 37, 38, 158,
- /* 110 */ 596, 595, 31, 156, 440, 205, 41, 39, 42, 40,
- /* 120 */ 232, 167, 564, 507, 36, 35, 166, 21, 34, 33,
- /* 130 */ 32, 510, 402, 403, 404, 405, 406, 407, 408, 409,
- /* 140 */ 410, 411, 412, 413, 510, 37, 38, 243, 132, 508,
- /* 150 */ 31, 220, 101, 205, 41, 39, 42, 40, 551, 168,
- /* 160 */ 200, 507, 36, 35, 97, 134, 34, 33, 32, 510,
- /* 170 */ 21, 139, 101, 17, 219, 242, 218, 217, 216, 215,
- /* 180 */ 214, 213, 212, 211, 492, 21, 481, 482, 483, 484,
- /* 190 */ 485, 486, 487, 488, 489, 490, 491, 163, 577, 11,
- /* 200 */ 243, 568, 228, 571, 507, 574, 550, 163, 577, 498,
- /* 210 */ 21, 568, 509, 571, 193, 574, 148, 233, 7, 507,
- /* 220 */ 561, 62, 111, 87, 86, 142, 60, 178, 242, 160,
- /* 230 */ 161, 147, 437, 204, 186, 124, 183, 230, 229, 160,
- /* 240 */ 161, 163, 577, 525, 506, 568, 570, 571, 573, 574,
- /* 250 */ 41, 39, 42, 40, 495, 61, 494, 27, 36, 35,
- /* 260 */ 545, 546, 34, 33, 32, 514, 28, 600, 511, 162,
- /* 270 */ 512, 29, 513, 160, 161, 192, 446, 566, 188, 124,
- /* 280 */ 248, 247, 422, 438, 522, 150, 124, 18, 601, 536,
- /* 290 */ 537, 44, 29, 47, 15, 594, 169, 170, 578, 14,
- /* 300 */ 576, 44, 14, 569, 518, 572, 519, 2, 52, 516,
- /* 310 */ 576, 517, 504, 567, 503, 575, 47, 592, 22, 591,
- /* 320 */ 209, 73, 72, 53, 22, 575, 9, 8, 84, 83,
- /* 330 */ 590, 151, 152, 140, 501, 44, 610, 141, 560, 143,
- /* 340 */ 144, 145, 146, 137, 576, 131, 138, 136, 164, 557,
- /* 350 */ 556, 165, 526, 231, 110, 98, 112, 113, 448, 575,
- /* 360 */ 543, 542, 210, 129, 515, 25, 223, 225, 609, 70,
- /* 370 */ 189, 608, 606, 116, 466, 26, 23, 130, 435, 79,
- /* 380 */ 433, 81, 431, 191, 430, 173, 125, 428, 427, 426,
- /* 390 */ 424, 91, 532, 194, 198, 54, 417, 127, 51, 521,
- /* 400 */ 421, 203, 419, 46, 102, 95, 201, 530, 103, 531,
- /* 410 */ 544, 195, 199, 197, 30, 27, 222, 235, 75, 234,
- /* 420 */ 236, 207, 238, 55, 237, 239, 240, 246, 149, 613,
- /* 430 */ 63, 66, 174, 429, 175, 176, 90, 92, 177, 423,
- /* 440 */ 119, 612, 118, 467, 117, 120, 121, 179, 122, 123,
- /* 450 */ 1, 505, 108, 104, 105, 106, 107, 109, 24, 180,
- /* 460 */ 181, 182, 611, 184, 185, 604, 12, 13, 187, 190,
- /* 470 */ 96, 533, 99, 157, 58, 538, 196, 100, 19, 4,
- /* 480 */ 579, 3, 16, 20, 64, 5, 206, 6, 208, 479,
- /* 490 */ 478, 477, 476, 475, 474, 473, 472, 470, 47, 221,
- /* 500 */ 443, 67, 445, 22, 500, 48, 499, 497, 464, 56,
- /* 510 */ 462, 454, 69, 460, 456, 71, 458, 452, 450, 471,
- /* 520 */ 469, 82, 441, 425, 415, 93, 614, 616, 94,
+ /* 0 */ 97, 439, 135, 101, 101, 156, 616, 250, 135, 440,
+ /* 10 */ 135, 159, 814, 43, 45, 21, 37, 38, 813, 158,
+ /* 20 */ 814, 31, 439, 727, 205, 41, 39, 42, 40, 10,
+ /* 30 */ 440, 153, 249, 36, 35, 745, 726, 34, 33, 32,
+ /* 40 */ 43, 45, 737, 37, 38, 166, 132, 167, 31, 724,
+ /* 50 */ 193, 205, 41, 39, 42, 40, 202, 769, 59, 200,
+ /* 60 */ 36, 35, 21, 727, 34, 33, 32, 43, 45, 134,
+ /* 70 */ 37, 38, 74, 78, 244, 31, 85, 77, 205, 41,
+ /* 80 */ 39, 42, 40, 80, 742, 220, 498, 36, 35, 439,
+ /* 90 */ 21, 34, 33, 32, 168, 101, 724, 440, 101, 57,
+ /* 100 */ 114, 115, 224, 727, 65, 68, 45, 7, 37, 38,
+ /* 110 */ 62, 111, 241, 31, 230, 229, 205, 41, 39, 42,
+ /* 120 */ 40, 232, 228, 565, 724, 36, 35, 21, 139, 34,
+ /* 130 */ 33, 32, 21, 402, 403, 404, 405, 406, 407, 408,
+ /* 140 */ 409, 410, 411, 412, 413, 810, 37, 38, 243, 768,
+ /* 150 */ 725, 31, 60, 178, 205, 41, 39, 42, 40, 233,
+ /* 160 */ 186, 724, 183, 36, 35, 809, 723, 34, 33, 32,
+ /* 170 */ 654, 171, 808, 124, 17, 219, 242, 218, 217, 216,
+ /* 180 */ 215, 214, 213, 212, 211, 709, 151, 698, 699, 700,
+ /* 190 */ 701, 702, 703, 704, 705, 706, 707, 708, 163, 578,
+ /* 200 */ 11, 133, 569, 133, 572, 76, 575, 663, 163, 578,
+ /* 210 */ 124, 241, 569, 154, 572, 155, 575, 148, 34, 33,
+ /* 220 */ 32, 248, 247, 422, 87, 86, 142, 243, 546, 547,
+ /* 230 */ 160, 161, 147, 523, 204, 172, 18, 152, 227, 226,
+ /* 240 */ 160, 161, 163, 578, 526, 712, 569, 711, 572, 140,
+ /* 250 */ 575, 41, 39, 42, 40, 242, 141, 61, 27, 36,
+ /* 260 */ 35, 73, 72, 34, 33, 32, 514, 655, 28, 511,
+ /* 270 */ 124, 512, 143, 513, 160, 161, 192, 36, 35, 188,
+ /* 280 */ 601, 34, 33, 32, 29, 571, 150, 574, 567, 128,
+ /* 290 */ 126, 245, 44, 89, 88, 602, 537, 169, 170, 29,
+ /* 300 */ 47, 577, 44, 162, 538, 595, 579, 144, 15, 14,
+ /* 310 */ 14, 577, 570, 49, 573, 504, 576, 52, 503, 47,
+ /* 320 */ 145, 209, 22, 146, 568, 22, 576, 518, 828, 519,
+ /* 330 */ 50, 516, 53, 517, 84, 83, 44, 9, 8, 718,
+ /* 340 */ 137, 2, 131, 138, 136, 577, 779, 744, 778, 164,
+ /* 350 */ 775, 774, 165, 231, 98, 761, 760, 112, 113, 665,
+ /* 360 */ 576, 110, 189, 210, 129, 515, 25, 223, 91, 225,
+ /* 370 */ 827, 70, 826, 824, 116, 683, 26, 23, 130, 652,
+ /* 380 */ 533, 79, 650, 54, 81, 648, 647, 173, 125, 645,
+ /* 390 */ 644, 643, 641, 634, 127, 638, 191, 636, 738, 194,
+ /* 400 */ 198, 95, 748, 749, 762, 51, 102, 46, 203, 103,
+ /* 410 */ 201, 199, 197, 195, 30, 27, 222, 75, 234, 235,
+ /* 420 */ 207, 55, 236, 240, 238, 237, 239, 63, 66, 149,
+ /* 430 */ 246, 614, 175, 174, 176, 646, 613, 90, 640, 119,
+ /* 440 */ 123, 177, 684, 117, 118, 120, 106, 104, 722, 122,
+ /* 450 */ 92, 121, 108, 105, 107, 109, 1, 24, 180, 179,
+ /* 460 */ 181, 182, 612, 184, 185, 605, 58, 12, 13, 99,
+ /* 470 */ 190, 187, 96, 534, 157, 539, 196, 100, 19, 64,
+ /* 480 */ 479, 580, 3, 20, 4, 16, 206, 6, 208, 478,
+ /* 490 */ 477, 476, 475, 5, 474, 473, 472, 470, 47, 443,
+ /* 500 */ 67, 445, 22, 221, 500, 48, 499, 497, 56, 464,
+ /* 510 */ 462, 454, 460, 69, 456, 71, 458, 452, 450, 471,
+ /* 520 */ 469, 82, 441, 425, 93, 415, 618, 617, 617, 94,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 1, 33, 34, 198, 199, 37, 38, 39, 9, 37,
- /* 10 */ 38, 39, 13, 14, 100, 16, 17, 62, 63, 64,
- /* 20 */ 21, 66, 67, 24, 25, 26, 27, 28, 73, 247,
- /* 30 */ 199, 117, 33, 34, 199, 61, 37, 38, 39, 13,
- /* 40 */ 14, 259, 16, 17, 62, 63, 64, 21, 66, 67,
- /* 50 */ 24, 25, 26, 27, 28, 71, 247, 196, 197, 33,
- /* 60 */ 34, 77, 77, 37, 38, 39, 13, 14, 259, 16,
- /* 70 */ 17, 62, 63, 64, 21, 66, 67, 24, 25, 26,
- /* 80 */ 27, 28, 251, 248, 253, 247, 33, 34, 1, 199,
- /* 90 */ 37, 38, 39, 232, 256, 257, 9, 247, 99, 125,
- /* 100 */ 247, 247, 128, 129, 199, 14, 1, 16, 17, 256,
- /* 110 */ 257, 257, 21, 216, 9, 24, 25, 26, 27, 28,
- /* 120 */ 199, 231, 96, 233, 33, 34, 216, 199, 37, 38,
- /* 130 */ 39, 234, 45, 46, 47, 48, 49, 50, 51, 52,
- /* 140 */ 53, 54, 55, 56, 234, 16, 17, 58, 247, 228,
- /* 150 */ 21, 216, 199, 24, 25, 26, 27, 28, 253, 231,
- /* 160 */ 255, 233, 33, 34, 199, 247, 37, 38, 39, 234,
- /* 170 */ 199, 247, 199, 84, 85, 86, 87, 88, 89, 90,
- /* 180 */ 91, 92, 93, 94, 215, 199, 217, 218, 219, 220,
- /* 190 */ 221, 222, 223, 224, 225, 226, 227, 1, 2, 44,
- /* 200 */ 58, 5, 231, 7, 233, 9, 253, 1, 2, 5,
- /* 210 */ 199, 5, 234, 7, 249, 9, 61, 231, 95, 233,
- /* 220 */ 229, 98, 99, 68, 69, 70, 253, 124, 86, 33,
- /* 230 */ 34, 76, 203, 37, 131, 206, 133, 33, 34, 33,
- /* 240 */ 34, 1, 2, 37, 233, 5, 5, 7, 7, 9,
- /* 250 */ 25, 26, 27, 28, 217, 235, 219, 102, 33, 34,
- /* 260 */ 110, 111, 37, 38, 39, 2, 246, 96, 5, 57,
- /* 270 */ 7, 100, 9, 33, 34, 120, 203, 1, 123, 206,
- /* 280 */ 58, 59, 60, 203, 100, 130, 206, 103, 96, 96,
- /* 290 */ 96, 95, 100, 100, 100, 96, 33, 34, 96, 100,
- /* 300 */ 104, 95, 100, 5, 5, 7, 7, 95, 100, 5,
- /* 310 */ 104, 7, 96, 37, 96, 119, 100, 247, 100, 247,
- /* 320 */ 96, 126, 127, 115, 100, 119, 126, 127, 71, 72,
- /* 330 */ 247, 247, 247, 247, 230, 95, 234, 247, 229, 247,
- /* 340 */ 247, 247, 247, 247, 104, 247, 247, 247, 229, 229,
- /* 350 */ 229, 229, 199, 229, 236, 199, 199, 199, 199, 119,
- /* 360 */ 254, 254, 199, 199, 101, 199, 199, 199, 199, 199,
- /* 370 */ 122, 199, 199, 199, 199, 199, 199, 199, 199, 199,
- /* 380 */ 199, 199, 199, 258, 199, 199, 199, 199, 199, 199,
- /* 390 */ 199, 57, 104, 250, 250, 114, 199, 199, 116, 245,
- /* 400 */ 199, 108, 199, 113, 244, 200, 112, 200, 243, 200,
- /* 410 */ 200, 105, 107, 106, 118, 102, 74, 49, 83, 82,
- /* 420 */ 79, 200, 53, 200, 81, 80, 78, 74, 200, 5,
- /* 430 */ 204, 204, 132, 200, 5, 132, 201, 201, 65, 200,
- /* 440 */ 208, 5, 212, 214, 213, 211, 209, 132, 210, 207,
- /* 450 */ 205, 232, 238, 242, 241, 240, 239, 237, 202, 5,
- /* 460 */ 132, 65, 5, 132, 65, 85, 95, 95, 124, 122,
- /* 470 */ 121, 96, 95, 1, 100, 96, 95, 95, 100, 109,
- /* 480 */ 96, 95, 95, 100, 71, 109, 97, 95, 97, 9,
- /* 490 */ 5, 5, 5, 5, 1, 5, 5, 5, 100, 15,
- /* 500 */ 75, 71, 65, 100, 5, 16, 5, 96, 5, 95,
- /* 510 */ 5, 5, 127, 5, 5, 127, 5, 5, 5, 5,
- /* 520 */ 5, 65, 75, 65, 57, 21, 0, 260, 21,
+ /* 0 */ 199, 1, 247, 199, 199, 216, 196, 197, 247, 9,
+ /* 10 */ 247, 256, 257, 13, 14, 199, 16, 17, 257, 256,
+ /* 20 */ 257, 21, 1, 234, 24, 25, 26, 27, 28, 247,
+ /* 30 */ 9, 198, 199, 33, 34, 199, 234, 37, 38, 39,
+ /* 40 */ 13, 14, 232, 16, 17, 216, 247, 231, 21, 233,
+ /* 50 */ 249, 24, 25, 26, 27, 28, 251, 253, 253, 255,
+ /* 60 */ 33, 34, 199, 234, 37, 38, 39, 13, 14, 247,
+ /* 70 */ 16, 17, 62, 63, 64, 21, 66, 67, 24, 25,
+ /* 80 */ 26, 27, 28, 73, 248, 216, 5, 33, 34, 1,
+ /* 90 */ 199, 37, 38, 39, 231, 199, 233, 9, 199, 99,
+ /* 100 */ 62, 63, 64, 234, 66, 67, 14, 95, 16, 17,
+ /* 110 */ 98, 99, 77, 21, 33, 34, 24, 25, 26, 27,
+ /* 120 */ 28, 199, 231, 96, 233, 33, 34, 199, 247, 37,
+ /* 130 */ 38, 39, 199, 45, 46, 47, 48, 49, 50, 51,
+ /* 140 */ 52, 53, 54, 55, 56, 247, 16, 17, 58, 253,
+ /* 150 */ 228, 21, 253, 124, 24, 25, 26, 27, 28, 231,
+ /* 160 */ 131, 233, 133, 33, 34, 247, 233, 37, 38, 39,
+ /* 170 */ 203, 61, 247, 206, 84, 85, 86, 87, 88, 89,
+ /* 180 */ 90, 91, 92, 93, 94, 215, 247, 217, 218, 219,
+ /* 190 */ 220, 221, 222, 223, 224, 225, 226, 227, 1, 2,
+ /* 200 */ 44, 247, 5, 247, 7, 71, 9, 203, 1, 2,
+ /* 210 */ 206, 77, 5, 259, 7, 259, 9, 61, 37, 38,
+ /* 220 */ 39, 58, 59, 60, 68, 69, 70, 58, 110, 111,
+ /* 230 */ 33, 34, 76, 100, 37, 125, 103, 247, 128, 129,
+ /* 240 */ 33, 34, 1, 2, 37, 217, 5, 219, 7, 247,
+ /* 250 */ 9, 25, 26, 27, 28, 86, 247, 235, 102, 33,
+ /* 260 */ 34, 126, 127, 37, 38, 39, 2, 203, 246, 5,
+ /* 270 */ 206, 7, 247, 9, 33, 34, 120, 33, 34, 123,
+ /* 280 */ 96, 37, 38, 39, 100, 5, 130, 7, 1, 62,
+ /* 290 */ 63, 64, 95, 66, 67, 96, 96, 33, 34, 100,
+ /* 300 */ 100, 104, 95, 57, 96, 96, 96, 247, 100, 100,
+ /* 310 */ 100, 104, 5, 100, 7, 96, 119, 100, 96, 100,
+ /* 320 */ 247, 96, 100, 247, 37, 100, 119, 5, 234, 7,
+ /* 330 */ 117, 5, 115, 7, 71, 72, 95, 126, 127, 230,
+ /* 340 */ 247, 95, 247, 247, 247, 104, 229, 199, 229, 229,
+ /* 350 */ 229, 229, 229, 229, 199, 254, 254, 199, 199, 199,
+ /* 360 */ 119, 236, 122, 199, 199, 101, 199, 199, 57, 199,
+ /* 370 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
+ /* 380 */ 104, 199, 199, 114, 199, 199, 199, 199, 199, 199,
+ /* 390 */ 199, 199, 199, 199, 199, 199, 258, 199, 245, 250,
+ /* 400 */ 250, 200, 200, 200, 200, 116, 244, 113, 108, 243,
+ /* 410 */ 112, 107, 106, 105, 118, 102, 74, 83, 82, 49,
+ /* 420 */ 200, 200, 79, 78, 53, 81, 80, 204, 204, 200,
+ /* 430 */ 74, 5, 5, 132, 132, 200, 5, 201, 200, 208,
+ /* 440 */ 207, 65, 214, 213, 212, 211, 240, 242, 232, 210,
+ /* 450 */ 201, 209, 238, 241, 239, 237, 205, 202, 5, 132,
+ /* 460 */ 132, 65, 5, 132, 65, 85, 100, 95, 95, 95,
+ /* 470 */ 122, 124, 121, 96, 1, 96, 95, 95, 100, 71,
+ /* 480 */ 9, 96, 95, 100, 109, 95, 97, 95, 97, 5,
+ /* 490 */ 5, 5, 5, 109, 1, 5, 5, 5, 100, 75,
+ /* 500 */ 71, 65, 100, 15, 5, 16, 5, 96, 95, 5,
+ /* 510 */ 5, 5, 5, 127, 5, 127, 5, 5, 5, 5,
+ /* 520 */ 5, 65, 75, 65, 21, 57, 0, 260, 260, 21,
+ /* 530 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 540 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 550 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 560 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 570 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 580 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 590 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 600 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 610 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 620 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 630 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 640 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 650 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 660 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 670 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 680 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 690 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 700 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 710 */ 260, 260, 260, 260, 260, 260, 260, 260, 260, 260,
+ /* 720 */ 260, 260, 260, 260, 260,
};
-#define YY_SHIFT_USE_DFLT (-87)
-#define YY_SHIFT_COUNT (250)
-#define YY_SHIFT_MIN (-86)
-#define YY_SHIFT_MAX (526)
-static const short yy_shift_ofst[] = {
- /* 0 */ 155, 89, 196, 240, 105, 105, 105, 105, 105, 105,
- /* 10 */ -1, 87, 240, 240, 240, 263, 263, 263, 105, 105,
- /* 20 */ 105, 105, 105, -16, 142, -15, -15, -87, 206, 240,
- /* 30 */ 240, 240, 240, 240, 240, 240, 240, 240, 240, 240,
- /* 40 */ 240, 240, 240, 240, 240, 240, 240, 263, 263, 204,
- /* 50 */ 204, 204, 204, 204, 204, 123, 204, 105, 105, 150,
- /* 60 */ 150, 184, 105, 105, 105, 105, 105, 105, 105, 105,
- /* 70 */ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
- /* 80 */ 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
- /* 90 */ 105, 105, 105, 105, 105, 248, 334, 334, 334, 288,
- /* 100 */ 288, 334, 281, 282, 290, 293, 294, 305, 307, 306,
- /* 110 */ 296, 313, 334, 334, 342, 342, 334, 335, 337, 368,
- /* 120 */ 341, 343, 369, 345, 348, 334, 353, 334, 353, -87,
- /* 130 */ -87, 26, 53, 53, 53, 53, 53, 91, 129, 225,
- /* 140 */ 225, 225, -45, -32, -32, -32, -32, -18, 9, -26,
- /* 150 */ 103, -28, -28, 222, 171, 192, 193, 194, 199, 202,
- /* 160 */ 241, 298, 276, 212, -86, 208, 216, 218, 224, 299,
- /* 170 */ 304, 195, 200, 257, 424, 300, 429, 303, 373, 436,
- /* 180 */ 315, 454, 328, 396, 457, 331, 399, 380, 344, 371,
- /* 190 */ 372, 347, 349, 374, 375, 377, 472, 381, 379, 382,
- /* 200 */ 378, 370, 383, 376, 384, 386, 387, 389, 392, 391,
- /* 210 */ 413, 480, 485, 486, 487, 488, 493, 490, 491, 492,
- /* 220 */ 398, 425, 484, 430, 437, 489, 385, 388, 403, 499,
- /* 230 */ 501, 411, 414, 403, 503, 505, 506, 508, 509, 511,
- /* 240 */ 512, 513, 514, 515, 456, 458, 447, 504, 507, 467,
+#define YY_SHIFT_COUNT (250)
+#define YY_SHIFT_MIN (0)
+#define YY_SHIFT_MAX (526)
+static const unsigned short int yy_shift_ofst[] = {
+ /* 0 */ 156, 90, 197, 241, 21, 21, 21, 21, 21, 21,
+ /* 10 */ 0, 88, 241, 241, 241, 264, 264, 264, 21, 21,
+ /* 20 */ 21, 21, 21, 134, 169, 35, 35, 530, 207, 241,
+ /* 30 */ 241, 241, 241, 241, 241, 241, 241, 241, 241, 241,
+ /* 40 */ 241, 241, 241, 241, 241, 241, 241, 264, 264, 81,
+ /* 50 */ 81, 81, 81, 81, 81, 12, 81, 21, 21, 118,
+ /* 60 */ 118, 133, 21, 21, 21, 21, 21, 21, 21, 21,
+ /* 70 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ /* 80 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ /* 90 */ 21, 21, 21, 21, 21, 240, 311, 311, 311, 276,
+ /* 100 */ 276, 311, 269, 289, 294, 300, 298, 304, 306, 308,
+ /* 110 */ 296, 313, 311, 311, 342, 342, 311, 334, 336, 370,
+ /* 120 */ 343, 344, 371, 346, 345, 311, 356, 311, 356, 530,
+ /* 130 */ 530, 27, 54, 54, 54, 54, 54, 92, 130, 226,
+ /* 140 */ 226, 226, 10, 244, 244, 244, 244, 38, 227, 110,
+ /* 150 */ 29, 181, 181, 163, 184, 199, 200, 208, 209, 210,
+ /* 160 */ 280, 307, 287, 246, 213, 217, 219, 222, 225, 322,
+ /* 170 */ 326, 135, 211, 263, 426, 301, 427, 302, 376, 431,
+ /* 180 */ 327, 453, 328, 396, 457, 331, 399, 380, 347, 372,
+ /* 190 */ 373, 348, 351, 366, 377, 374, 473, 381, 379, 382,
+ /* 200 */ 378, 375, 383, 384, 385, 387, 390, 389, 392, 391,
+ /* 210 */ 408, 471, 484, 485, 486, 487, 493, 490, 491, 492,
+ /* 220 */ 398, 424, 488, 429, 436, 489, 386, 388, 402, 499,
+ /* 230 */ 501, 411, 413, 402, 504, 505, 506, 507, 509, 511,
+ /* 240 */ 512, 513, 514, 515, 456, 458, 447, 503, 508, 468,
/* 250 */ 526,
};
-#define YY_REDUCE_USE_DFLT (-219)
#define YY_REDUCE_COUNT (130)
-#define YY_REDUCE_MIN (-218)
-#define YY_REDUCE_MAX (256)
+#define YY_REDUCE_MIN (-245)
+#define YY_REDUCE_MAX (255)
static const short yy_reduce_ofst[] = {
- /* 0 */ -139, -31, -162, -147, -95, -169, -110, -72, -29, -14,
- /* 10 */ -165, -195, -218, -191, -146, -103, -90, -65, -35, -47,
- /* 20 */ -27, -79, 11, 29, 37, 73, 80, 20, -150, -99,
- /* 30 */ -82, -76, 70, 72, 83, 84, 85, 86, 90, 92,
- /* 40 */ 93, 94, 95, 96, 98, 99, 100, -22, 102, -9,
- /* 50 */ 109, 119, 120, 121, 122, 104, 124, 153, 156, 106,
- /* 60 */ 107, 118, 157, 158, 159, 163, 164, 166, 167, 168,
- /* 70 */ 169, 170, 172, 173, 174, 175, 176, 177, 178, 179,
- /* 80 */ 180, 181, 182, 183, 185, 186, 187, 188, 189, 190,
- /* 90 */ 191, 197, 198, 201, 203, 125, 205, 207, 209, 143,
- /* 100 */ 144, 210, 154, 160, 165, 211, 213, 215, 217, 214,
- /* 110 */ 220, 219, 221, 223, 226, 227, 228, 229, 231, 230,
- /* 120 */ 232, 234, 237, 238, 242, 233, 235, 239, 236, 245,
- /* 130 */ 256,
+ /* 0 */ -190, -30, -245, -237, -196, -195, -184, -137, -109, -72,
+ /* 10 */ -164, -167, -46, -44, -239, -211, -171, -131, -199, -104,
+ /* 20 */ -101, -78, -67, -33, 28, 4, 64, 22, -218, -201,
+ /* 30 */ -178, -119, -102, -82, -75, -61, -10, 2, 9, 25,
+ /* 40 */ 60, 73, 76, 93, 95, 96, 97, -198, 94, 117,
+ /* 50 */ 119, 120, 121, 122, 123, 109, 124, 148, 155, 101,
+ /* 60 */ 102, 125, 158, 159, 160, 164, 165, 167, 168, 170,
+ /* 70 */ 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
+ /* 80 */ 182, 183, 185, 186, 187, 188, 189, 190, 191, 192,
+ /* 90 */ 193, 194, 195, 196, 198, 138, 201, 202, 203, 149,
+ /* 100 */ 150, 204, 153, 162, 166, 205, 212, 206, 215, 214,
+ /* 110 */ 218, 216, 220, 221, 223, 224, 229, 228, 230, 232,
+ /* 120 */ 231, 234, 242, 239, 233, 235, 236, 238, 249, 251,
+ /* 130 */ 255,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 827, 660, 811, 811, 827, 827, 827, 827, 827, 827,
- /* 10 */ 741, 627, 827, 827, 811, 827, 827, 827, 827, 827,
- /* 20 */ 827, 827, 827, 662, 649, 662, 662, 736, 827, 827,
- /* 30 */ 827, 827, 827, 827, 827, 827, 827, 827, 827, 827,
- /* 40 */ 827, 827, 827, 827, 827, 827, 827, 827, 827, 827,
- /* 50 */ 827, 827, 827, 827, 827, 827, 827, 827, 827, 760,
- /* 60 */ 760, 827, 827, 827, 827, 827, 827, 827, 827, 827,
- /* 70 */ 827, 827, 827, 827, 827, 827, 827, 827, 827, 647,
- /* 80 */ 827, 645, 827, 827, 827, 827, 827, 827, 827, 827,
- /* 90 */ 827, 827, 827, 827, 827, 827, 629, 629, 629, 827,
- /* 100 */ 827, 629, 767, 771, 765, 753, 761, 752, 748, 747,
- /* 110 */ 775, 827, 629, 629, 657, 657, 629, 678, 676, 674,
- /* 120 */ 666, 672, 668, 670, 664, 629, 655, 629, 655, 693,
- /* 130 */ 706, 827, 815, 816, 776, 810, 766, 794, 793, 806,
- /* 140 */ 800, 799, 827, 798, 797, 796, 795, 827, 827, 827,
- /* 150 */ 827, 802, 801, 827, 827, 827, 827, 827, 827, 827,
- /* 160 */ 827, 827, 827, 778, 772, 768, 827, 827, 827, 827,
- /* 170 */ 827, 827, 827, 827, 827, 827, 827, 827, 827, 827,
- /* 180 */ 827, 827, 827, 827, 827, 827, 827, 827, 827, 827,
- /* 190 */ 827, 812, 827, 742, 827, 827, 827, 827, 827, 827,
- /* 200 */ 762, 827, 754, 827, 827, 827, 827, 827, 827, 715,
- /* 210 */ 827, 827, 827, 827, 827, 827, 827, 827, 827, 827,
- /* 220 */ 681, 827, 827, 827, 827, 827, 827, 827, 820, 827,
- /* 230 */ 827, 827, 709, 818, 827, 827, 827, 827, 827, 827,
- /* 240 */ 827, 827, 827, 827, 827, 827, 827, 633, 631, 827,
- /* 250 */ 827,
+ /* 0 */ 615, 664, 816, 816, 615, 615, 615, 615, 615, 615,
+ /* 10 */ 746, 631, 615, 615, 816, 615, 615, 615, 615, 615,
+ /* 20 */ 615, 615, 615, 666, 653, 666, 666, 741, 615, 615,
+ /* 30 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+ /* 40 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+ /* 50 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 765,
+ /* 60 */ 765, 739, 615, 615, 615, 615, 615, 615, 615, 615,
+ /* 70 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 651,
+ /* 80 */ 615, 649, 615, 615, 615, 615, 615, 615, 615, 615,
+ /* 90 */ 615, 615, 615, 615, 615, 615, 633, 633, 633, 615,
+ /* 100 */ 615, 633, 772, 776, 770, 758, 766, 757, 753, 752,
+ /* 110 */ 780, 615, 633, 633, 661, 661, 633, 682, 680, 678,
+ /* 120 */ 670, 676, 672, 674, 668, 633, 659, 633, 659, 697,
+ /* 130 */ 710, 615, 820, 821, 781, 815, 771, 799, 798, 811,
+ /* 140 */ 805, 804, 615, 803, 802, 801, 800, 615, 615, 615,
+ /* 150 */ 615, 807, 806, 615, 615, 615, 615, 615, 615, 615,
+ /* 160 */ 615, 615, 615, 783, 777, 773, 615, 615, 615, 615,
+ /* 170 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+ /* 180 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+ /* 190 */ 615, 817, 615, 747, 615, 615, 615, 615, 615, 615,
+ /* 200 */ 767, 615, 759, 615, 615, 615, 615, 615, 615, 719,
+ /* 210 */ 615, 615, 615, 615, 615, 615, 615, 615, 615, 615,
+ /* 220 */ 685, 615, 615, 615, 615, 615, 615, 615, 825, 615,
+ /* 230 */ 615, 615, 713, 823, 615, 615, 615, 615, 615, 615,
+ /* 240 */ 615, 615, 615, 615, 615, 615, 615, 637, 635, 615,
+ /* 250 */ 615,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -476,7 +490,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* TABLE => nothing */
1, /* DATABASE => ID */
0, /* DNODE => nothing */
- 1, /* IP => ID */
+ 1, /* IPTOKEN => ID */
0, /* USER => nothing */
0, /* ACCOUNT => nothing */
0, /* USE => nothing */
@@ -512,7 +526,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* USING => nothing */
0, /* AS => nothing */
0, /* COMMA => nothing */
- 0, /* NULL => nothing */
+ 1, /* NULL => ID */
0, /* SELECT => nothing */
0, /* FROM => nothing */
0, /* VARIABLE => nothing */
@@ -637,17 +651,21 @@ typedef struct yyStackEntry yyStackEntry;
/* The state of the parser is completely contained in an instance of
** the following structure */
struct yyParser {
- int yyidx; /* Index of top element in stack */
+ yyStackEntry *yytos; /* Pointer to top element of the stack */
#ifdef YYTRACKMAXSTACKDEPTH
- int yyidxMax; /* Maximum value of yyidx */
+ int yyhwm; /* High-water mark of the stack */
#endif
+#ifndef YYNOERRORRECOVERY
int yyerrcnt; /* Shifts left before out of the error */
+#endif
ParseARG_SDECL /* A place to hold %extra_argument */
#if YYSTACKDEPTH<=0
int yystksz; /* Current side of the stack */
yyStackEntry *yystack; /* The parser's stack */
+ yyStackEntry yystk0; /* First stack entry */
#else
yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
+ yyStackEntry *yystackEnd; /* Last entry in the stack */
#endif
};
typedef struct yyParser yyParser;
@@ -684,77 +702,272 @@ void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
}
#endif /* NDEBUG */
-#ifndef NDEBUG
+#if defined(YYCOVERAGE) || !defined(NDEBUG)
/* For tracing shifts, the names of all terminals and nonterminals
** are required. The following table supplies these names */
static const char *const yyTokenName[] = {
- "$", "ID", "BOOL", "TINYINT",
- "SMALLINT", "INTEGER", "BIGINT", "FLOAT",
- "DOUBLE", "STRING", "TIMESTAMP", "BINARY",
- "NCHAR", "OR", "AND", "NOT",
- "EQ", "NE", "ISNULL", "NOTNULL",
- "IS", "LIKE", "GLOB", "BETWEEN",
- "IN", "GT", "GE", "LT",
- "LE", "BITAND", "BITOR", "LSHIFT",
- "RSHIFT", "PLUS", "MINUS", "DIVIDE",
- "TIMES", "STAR", "SLASH", "REM",
- "CONCAT", "UMINUS", "UPLUS", "BITNOT",
- "SHOW", "DATABASES", "MNODES", "DNODES",
- "ACCOUNTS", "USERS", "MODULES", "QUERIES",
- "CONNECTIONS", "STREAMS", "CONFIGS", "SCORES",
- "GRANTS", "DOT", "TABLES", "STABLES",
- "VGROUPS", "DROP", "TABLE", "DATABASE",
- "DNODE", "IP", "USER", "ACCOUNT",
- "USE", "DESCRIBE", "ALTER", "PASS",
- "PRIVILEGE", "LOCAL", "IF", "EXISTS",
- "CREATE", "PPS", "TSERIES", "DBS",
- "STORAGE", "QTIME", "CONNS", "STATE",
- "KEEP", "CACHE", "REPLICA", "DAYS",
- "ROWS", "ABLOCKS", "TBLOCKS", "CTIME",
- "CLOG", "COMP", "PRECISION", "LP",
- "RP", "TAGS", "USING", "AS",
- "COMMA", "NULL", "SELECT", "FROM",
- "VARIABLE", "INTERVAL", "FILL", "SLIDING",
- "ORDER", "BY", "ASC", "DESC",
- "GROUP", "HAVING", "LIMIT", "OFFSET",
- "SLIMIT", "SOFFSET", "WHERE", "NOW",
- "INSERT", "INTO", "VALUES", "RESET",
- "QUERY", "ADD", "COLUMN", "TAG",
- "CHANGE", "SET", "KILL", "CONNECTION",
- "COLON", "STREAM", "ABORT", "AFTER",
- "ATTACH", "BEFORE", "BEGIN", "CASCADE",
- "CLUSTER", "CONFLICT", "COPY", "DEFERRED",
- "DELIMITERS", "DETACH", "EACH", "END",
- "EXPLAIN", "FAIL", "FOR", "IGNORE",
- "IMMEDIATE", "INITIALLY", "INSTEAD", "MATCH",
- "KEY", "OF", "RAISE", "REPLACE",
- "RESTRICT", "ROW", "STATEMENT", "TRIGGER",
- "VIEW", "ALL", "COUNT", "SUM",
- "AVG", "MIN", "MAX", "FIRST",
- "LAST", "TOP", "BOTTOM", "STDDEV",
- "PERCENTILE", "APERCENTILE", "LEASTSQUARES", "HISTOGRAM",
- "DIFF", "SPREAD", "TWA", "INTERP",
- "LAST_ROW", "SEMI", "NONE", "PREV",
- "LINEAR", "IMPORT", "METRIC", "TBNAME",
- "JOIN", "METRICS", "STABLE", "error",
- "program", "cmd", "dbPrefix", "ids",
- "cpxName", "ifexists", "alter_db_optr", "acct_optr",
- "ifnotexists", "db_optr", "pps", "tseries",
- "dbs", "streams", "storage", "qtime",
- "users", "conns", "state", "keep",
- "tagitemlist", "tables", "cache", "replica",
- "days", "rows", "ablocks", "tblocks",
- "ctime", "clog", "comp", "prec",
- "typename", "signed", "create_table_args", "columnlist",
- "select", "column", "tagitem", "selcollist",
- "from", "where_opt", "interval_opt", "fill_opt",
- "sliding_opt", "groupby_opt", "orderby_opt", "having_opt",
- "slimit_opt", "limit_opt", "sclp", "expr",
- "as", "tablelist", "tmvar", "sortlist",
- "sortitem", "item", "sortorder", "grouplist",
- "exprlist", "expritem", "insert_value_list", "itemlist",
+ /* 0 */ "$",
+ /* 1 */ "ID",
+ /* 2 */ "BOOL",
+ /* 3 */ "TINYINT",
+ /* 4 */ "SMALLINT",
+ /* 5 */ "INTEGER",
+ /* 6 */ "BIGINT",
+ /* 7 */ "FLOAT",
+ /* 8 */ "DOUBLE",
+ /* 9 */ "STRING",
+ /* 10 */ "TIMESTAMP",
+ /* 11 */ "BINARY",
+ /* 12 */ "NCHAR",
+ /* 13 */ "OR",
+ /* 14 */ "AND",
+ /* 15 */ "NOT",
+ /* 16 */ "EQ",
+ /* 17 */ "NE",
+ /* 18 */ "ISNULL",
+ /* 19 */ "NOTNULL",
+ /* 20 */ "IS",
+ /* 21 */ "LIKE",
+ /* 22 */ "GLOB",
+ /* 23 */ "BETWEEN",
+ /* 24 */ "IN",
+ /* 25 */ "GT",
+ /* 26 */ "GE",
+ /* 27 */ "LT",
+ /* 28 */ "LE",
+ /* 29 */ "BITAND",
+ /* 30 */ "BITOR",
+ /* 31 */ "LSHIFT",
+ /* 32 */ "RSHIFT",
+ /* 33 */ "PLUS",
+ /* 34 */ "MINUS",
+ /* 35 */ "DIVIDE",
+ /* 36 */ "TIMES",
+ /* 37 */ "STAR",
+ /* 38 */ "SLASH",
+ /* 39 */ "REM",
+ /* 40 */ "CONCAT",
+ /* 41 */ "UMINUS",
+ /* 42 */ "UPLUS",
+ /* 43 */ "BITNOT",
+ /* 44 */ "SHOW",
+ /* 45 */ "DATABASES",
+ /* 46 */ "MNODES",
+ /* 47 */ "DNODES",
+ /* 48 */ "ACCOUNTS",
+ /* 49 */ "USERS",
+ /* 50 */ "MODULES",
+ /* 51 */ "QUERIES",
+ /* 52 */ "CONNECTIONS",
+ /* 53 */ "STREAMS",
+ /* 54 */ "CONFIGS",
+ /* 55 */ "SCORES",
+ /* 56 */ "GRANTS",
+ /* 57 */ "DOT",
+ /* 58 */ "TABLES",
+ /* 59 */ "STABLES",
+ /* 60 */ "VGROUPS",
+ /* 61 */ "DROP",
+ /* 62 */ "TABLE",
+ /* 63 */ "DATABASE",
+ /* 64 */ "DNODE",
+ /* 65 */ "IPTOKEN",
+ /* 66 */ "USER",
+ /* 67 */ "ACCOUNT",
+ /* 68 */ "USE",
+ /* 69 */ "DESCRIBE",
+ /* 70 */ "ALTER",
+ /* 71 */ "PASS",
+ /* 72 */ "PRIVILEGE",
+ /* 73 */ "LOCAL",
+ /* 74 */ "IF",
+ /* 75 */ "EXISTS",
+ /* 76 */ "CREATE",
+ /* 77 */ "PPS",
+ /* 78 */ "TSERIES",
+ /* 79 */ "DBS",
+ /* 80 */ "STORAGE",
+ /* 81 */ "QTIME",
+ /* 82 */ "CONNS",
+ /* 83 */ "STATE",
+ /* 84 */ "KEEP",
+ /* 85 */ "CACHE",
+ /* 86 */ "REPLICA",
+ /* 87 */ "DAYS",
+ /* 88 */ "ROWS",
+ /* 89 */ "ABLOCKS",
+ /* 90 */ "TBLOCKS",
+ /* 91 */ "CTIME",
+ /* 92 */ "CLOG",
+ /* 93 */ "COMP",
+ /* 94 */ "PRECISION",
+ /* 95 */ "LP",
+ /* 96 */ "RP",
+ /* 97 */ "TAGS",
+ /* 98 */ "USING",
+ /* 99 */ "AS",
+ /* 100 */ "COMMA",
+ /* 101 */ "NULL",
+ /* 102 */ "SELECT",
+ /* 103 */ "FROM",
+ /* 104 */ "VARIABLE",
+ /* 105 */ "INTERVAL",
+ /* 106 */ "FILL",
+ /* 107 */ "SLIDING",
+ /* 108 */ "ORDER",
+ /* 109 */ "BY",
+ /* 110 */ "ASC",
+ /* 111 */ "DESC",
+ /* 112 */ "GROUP",
+ /* 113 */ "HAVING",
+ /* 114 */ "LIMIT",
+ /* 115 */ "OFFSET",
+ /* 116 */ "SLIMIT",
+ /* 117 */ "SOFFSET",
+ /* 118 */ "WHERE",
+ /* 119 */ "NOW",
+ /* 120 */ "INSERT",
+ /* 121 */ "INTO",
+ /* 122 */ "VALUES",
+ /* 123 */ "RESET",
+ /* 124 */ "QUERY",
+ /* 125 */ "ADD",
+ /* 126 */ "COLUMN",
+ /* 127 */ "TAG",
+ /* 128 */ "CHANGE",
+ /* 129 */ "SET",
+ /* 130 */ "KILL",
+ /* 131 */ "CONNECTION",
+ /* 132 */ "COLON",
+ /* 133 */ "STREAM",
+ /* 134 */ "ABORT",
+ /* 135 */ "AFTER",
+ /* 136 */ "ATTACH",
+ /* 137 */ "BEFORE",
+ /* 138 */ "BEGIN",
+ /* 139 */ "CASCADE",
+ /* 140 */ "CLUSTER",
+ /* 141 */ "CONFLICT",
+ /* 142 */ "COPY",
+ /* 143 */ "DEFERRED",
+ /* 144 */ "DELIMITERS",
+ /* 145 */ "DETACH",
+ /* 146 */ "EACH",
+ /* 147 */ "END",
+ /* 148 */ "EXPLAIN",
+ /* 149 */ "FAIL",
+ /* 150 */ "FOR",
+ /* 151 */ "IGNORE",
+ /* 152 */ "IMMEDIATE",
+ /* 153 */ "INITIALLY",
+ /* 154 */ "INSTEAD",
+ /* 155 */ "MATCH",
+ /* 156 */ "KEY",
+ /* 157 */ "OF",
+ /* 158 */ "RAISE",
+ /* 159 */ "REPLACE",
+ /* 160 */ "RESTRICT",
+ /* 161 */ "ROW",
+ /* 162 */ "STATEMENT",
+ /* 163 */ "TRIGGER",
+ /* 164 */ "VIEW",
+ /* 165 */ "ALL",
+ /* 166 */ "COUNT",
+ /* 167 */ "SUM",
+ /* 168 */ "AVG",
+ /* 169 */ "MIN",
+ /* 170 */ "MAX",
+ /* 171 */ "FIRST",
+ /* 172 */ "LAST",
+ /* 173 */ "TOP",
+ /* 174 */ "BOTTOM",
+ /* 175 */ "STDDEV",
+ /* 176 */ "PERCENTILE",
+ /* 177 */ "APERCENTILE",
+ /* 178 */ "LEASTSQUARES",
+ /* 179 */ "HISTOGRAM",
+ /* 180 */ "DIFF",
+ /* 181 */ "SPREAD",
+ /* 182 */ "TWA",
+ /* 183 */ "INTERP",
+ /* 184 */ "LAST_ROW",
+ /* 185 */ "SEMI",
+ /* 186 */ "NONE",
+ /* 187 */ "PREV",
+ /* 188 */ "LINEAR",
+ /* 189 */ "IMPORT",
+ /* 190 */ "METRIC",
+ /* 191 */ "TBNAME",
+ /* 192 */ "JOIN",
+ /* 193 */ "METRICS",
+ /* 194 */ "STABLE",
+ /* 195 */ "error",
+ /* 196 */ "program",
+ /* 197 */ "cmd",
+ /* 198 */ "dbPrefix",
+ /* 199 */ "ids",
+ /* 200 */ "cpxName",
+ /* 201 */ "ifexists",
+ /* 202 */ "alter_db_optr",
+ /* 203 */ "acct_optr",
+ /* 204 */ "ifnotexists",
+ /* 205 */ "db_optr",
+ /* 206 */ "pps",
+ /* 207 */ "tseries",
+ /* 208 */ "dbs",
+ /* 209 */ "streams",
+ /* 210 */ "storage",
+ /* 211 */ "qtime",
+ /* 212 */ "users",
+ /* 213 */ "conns",
+ /* 214 */ "state",
+ /* 215 */ "keep",
+ /* 216 */ "tagitemlist",
+ /* 217 */ "tables",
+ /* 218 */ "cache",
+ /* 219 */ "replica",
+ /* 220 */ "days",
+ /* 221 */ "rows",
+ /* 222 */ "ablocks",
+ /* 223 */ "tblocks",
+ /* 224 */ "ctime",
+ /* 225 */ "clog",
+ /* 226 */ "comp",
+ /* 227 */ "prec",
+ /* 228 */ "typename",
+ /* 229 */ "signed",
+ /* 230 */ "create_table_args",
+ /* 231 */ "columnlist",
+ /* 232 */ "select",
+ /* 233 */ "column",
+ /* 234 */ "tagitem",
+ /* 235 */ "selcollist",
+ /* 236 */ "from",
+ /* 237 */ "where_opt",
+ /* 238 */ "interval_opt",
+ /* 239 */ "fill_opt",
+ /* 240 */ "sliding_opt",
+ /* 241 */ "groupby_opt",
+ /* 242 */ "orderby_opt",
+ /* 243 */ "having_opt",
+ /* 244 */ "slimit_opt",
+ /* 245 */ "limit_opt",
+ /* 246 */ "sclp",
+ /* 247 */ "expr",
+ /* 248 */ "as",
+ /* 249 */ "tablelist",
+ /* 250 */ "tmvar",
+ /* 251 */ "sortlist",
+ /* 252 */ "sortitem",
+ /* 253 */ "item",
+ /* 254 */ "sortorder",
+ /* 255 */ "grouplist",
+ /* 256 */ "exprlist",
+ /* 257 */ "expritem",
+ /* 258 */ "insert_value_list",
+ /* 259 */ "itemlist",
};
-#endif /* NDEBUG */
+#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
@@ -784,15 +997,15 @@ static const char *const yyRuleName[] = {
/* 21 */ "cmd ::= SHOW dbPrefix VGROUPS",
/* 22 */ "cmd ::= DROP TABLE ifexists ids cpxName",
/* 23 */ "cmd ::= DROP DATABASE ifexists ids",
- /* 24 */ "cmd ::= DROP DNODE IP",
+ /* 24 */ "cmd ::= DROP DNODE IPTOKEN",
/* 25 */ "cmd ::= DROP USER ids",
/* 26 */ "cmd ::= DROP ACCOUNT ids",
/* 27 */ "cmd ::= USE ids",
/* 28 */ "cmd ::= DESCRIBE ids cpxName",
/* 29 */ "cmd ::= ALTER USER ids PASS ids",
/* 30 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
- /* 31 */ "cmd ::= ALTER DNODE IP ids",
- /* 32 */ "cmd ::= ALTER DNODE IP ids ids",
+ /* 31 */ "cmd ::= ALTER DNODE IPTOKEN ids",
+ /* 32 */ "cmd ::= ALTER DNODE IPTOKEN ids ids",
/* 33 */ "cmd ::= ALTER LOCAL ids",
/* 34 */ "cmd ::= ALTER LOCAL ids ids",
/* 35 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
@@ -804,7 +1017,7 @@ static const char *const yyRuleName[] = {
/* 41 */ "ifexists ::=",
/* 42 */ "ifnotexists ::= IF NOT EXISTS",
/* 43 */ "ifnotexists ::=",
- /* 44 */ "cmd ::= CREATE DNODE IP",
+ /* 44 */ "cmd ::= CREATE DNODE IPTOKEN",
/* 45 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
/* 46 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
/* 47 */ "cmd ::= CREATE USER ids PASS ids",
@@ -881,122 +1094,133 @@ static const char *const yyRuleName[] = {
/* 118 */ "tagitem ::= PLUS FLOAT",
/* 119 */ "cmd ::= select",
/* 120 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt",
- /* 121 */ "sclp ::= selcollist COMMA",
- /* 122 */ "sclp ::=",
- /* 123 */ "selcollist ::= sclp expr as",
- /* 124 */ "selcollist ::= sclp STAR",
- /* 125 */ "as ::= AS ids",
- /* 126 */ "as ::= ids",
- /* 127 */ "as ::=",
- /* 128 */ "from ::= FROM tablelist",
- /* 129 */ "tablelist ::= ids cpxName",
- /* 130 */ "tablelist ::= tablelist COMMA ids cpxName",
- /* 131 */ "tmvar ::= VARIABLE",
- /* 132 */ "interval_opt ::= INTERVAL LP tmvar RP",
- /* 133 */ "interval_opt ::=",
- /* 134 */ "fill_opt ::=",
- /* 135 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
- /* 136 */ "fill_opt ::= FILL LP ID RP",
- /* 137 */ "sliding_opt ::= SLIDING LP tmvar RP",
- /* 138 */ "sliding_opt ::=",
- /* 139 */ "orderby_opt ::=",
- /* 140 */ "orderby_opt ::= ORDER BY sortlist",
- /* 141 */ "sortlist ::= sortlist COMMA item sortorder",
- /* 142 */ "sortlist ::= item sortorder",
- /* 143 */ "item ::= ids cpxName",
- /* 144 */ "sortorder ::= ASC",
- /* 145 */ "sortorder ::= DESC",
- /* 146 */ "sortorder ::=",
- /* 147 */ "groupby_opt ::=",
- /* 148 */ "groupby_opt ::= GROUP BY grouplist",
- /* 149 */ "grouplist ::= grouplist COMMA item",
- /* 150 */ "grouplist ::= item",
- /* 151 */ "having_opt ::=",
- /* 152 */ "having_opt ::= HAVING expr",
- /* 153 */ "limit_opt ::=",
- /* 154 */ "limit_opt ::= LIMIT signed",
- /* 155 */ "limit_opt ::= LIMIT signed OFFSET signed",
- /* 156 */ "limit_opt ::= LIMIT signed COMMA signed",
- /* 157 */ "slimit_opt ::=",
- /* 158 */ "slimit_opt ::= SLIMIT signed",
- /* 159 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
- /* 160 */ "slimit_opt ::= SLIMIT signed COMMA signed",
- /* 161 */ "where_opt ::=",
- /* 162 */ "where_opt ::= WHERE expr",
- /* 163 */ "expr ::= LP expr RP",
- /* 164 */ "expr ::= ID",
- /* 165 */ "expr ::= ID DOT ID",
- /* 166 */ "expr ::= ID DOT STAR",
- /* 167 */ "expr ::= INTEGER",
- /* 168 */ "expr ::= MINUS INTEGER",
- /* 169 */ "expr ::= PLUS INTEGER",
- /* 170 */ "expr ::= FLOAT",
- /* 171 */ "expr ::= MINUS FLOAT",
- /* 172 */ "expr ::= PLUS FLOAT",
- /* 173 */ "expr ::= STRING",
- /* 174 */ "expr ::= NOW",
- /* 175 */ "expr ::= VARIABLE",
- /* 176 */ "expr ::= BOOL",
- /* 177 */ "expr ::= ID LP exprlist RP",
- /* 178 */ "expr ::= ID LP STAR RP",
- /* 179 */ "expr ::= expr AND expr",
- /* 180 */ "expr ::= expr OR expr",
- /* 181 */ "expr ::= expr LT expr",
- /* 182 */ "expr ::= expr GT expr",
- /* 183 */ "expr ::= expr LE expr",
- /* 184 */ "expr ::= expr GE expr",
- /* 185 */ "expr ::= expr NE expr",
- /* 186 */ "expr ::= expr EQ expr",
- /* 187 */ "expr ::= expr PLUS expr",
- /* 188 */ "expr ::= expr MINUS expr",
- /* 189 */ "expr ::= expr STAR expr",
- /* 190 */ "expr ::= expr SLASH expr",
- /* 191 */ "expr ::= expr REM expr",
- /* 192 */ "expr ::= expr LIKE expr",
- /* 193 */ "expr ::= expr IN LP exprlist RP",
- /* 194 */ "exprlist ::= exprlist COMMA expritem",
- /* 195 */ "exprlist ::= expritem",
- /* 196 */ "expritem ::= expr",
- /* 197 */ "expritem ::=",
- /* 198 */ "cmd ::= INSERT INTO cpxName insert_value_list",
- /* 199 */ "insert_value_list ::= VALUES LP itemlist RP",
- /* 200 */ "insert_value_list ::= insert_value_list VALUES LP itemlist RP",
- /* 201 */ "itemlist ::= itemlist COMMA expr",
- /* 202 */ "itemlist ::= expr",
- /* 203 */ "cmd ::= RESET QUERY CACHE",
- /* 204 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
- /* 205 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
- /* 206 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
- /* 207 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
- /* 208 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
- /* 209 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
- /* 210 */ "cmd ::= KILL CONNECTION IP COLON INTEGER",
- /* 211 */ "cmd ::= KILL STREAM IP COLON INTEGER COLON INTEGER",
- /* 212 */ "cmd ::= KILL QUERY IP COLON INTEGER COLON INTEGER",
+ /* 121 */ "select ::= SELECT selcollist",
+ /* 122 */ "sclp ::= selcollist COMMA",
+ /* 123 */ "sclp ::=",
+ /* 124 */ "selcollist ::= sclp expr as",
+ /* 125 */ "selcollist ::= sclp STAR",
+ /* 126 */ "as ::= AS ids",
+ /* 127 */ "as ::= ids",
+ /* 128 */ "as ::=",
+ /* 129 */ "from ::= FROM tablelist",
+ /* 130 */ "tablelist ::= ids cpxName",
+ /* 131 */ "tablelist ::= tablelist COMMA ids cpxName",
+ /* 132 */ "tmvar ::= VARIABLE",
+ /* 133 */ "interval_opt ::= INTERVAL LP tmvar RP",
+ /* 134 */ "interval_opt ::=",
+ /* 135 */ "fill_opt ::=",
+ /* 136 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
+ /* 137 */ "fill_opt ::= FILL LP ID RP",
+ /* 138 */ "sliding_opt ::= SLIDING LP tmvar RP",
+ /* 139 */ "sliding_opt ::=",
+ /* 140 */ "orderby_opt ::=",
+ /* 141 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 142 */ "sortlist ::= sortlist COMMA item sortorder",
+ /* 143 */ "sortlist ::= item sortorder",
+ /* 144 */ "item ::= ids cpxName",
+ /* 145 */ "sortorder ::= ASC",
+ /* 146 */ "sortorder ::= DESC",
+ /* 147 */ "sortorder ::=",
+ /* 148 */ "groupby_opt ::=",
+ /* 149 */ "groupby_opt ::= GROUP BY grouplist",
+ /* 150 */ "grouplist ::= grouplist COMMA item",
+ /* 151 */ "grouplist ::= item",
+ /* 152 */ "having_opt ::=",
+ /* 153 */ "having_opt ::= HAVING expr",
+ /* 154 */ "limit_opt ::=",
+ /* 155 */ "limit_opt ::= LIMIT signed",
+ /* 156 */ "limit_opt ::= LIMIT signed OFFSET signed",
+ /* 157 */ "limit_opt ::= LIMIT signed COMMA signed",
+ /* 158 */ "slimit_opt ::=",
+ /* 159 */ "slimit_opt ::= SLIMIT signed",
+ /* 160 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
+ /* 161 */ "slimit_opt ::= SLIMIT signed COMMA signed",
+ /* 162 */ "where_opt ::=",
+ /* 163 */ "where_opt ::= WHERE expr",
+ /* 164 */ "expr ::= LP expr RP",
+ /* 165 */ "expr ::= ID",
+ /* 166 */ "expr ::= ID DOT ID",
+ /* 167 */ "expr ::= ID DOT STAR",
+ /* 168 */ "expr ::= INTEGER",
+ /* 169 */ "expr ::= MINUS INTEGER",
+ /* 170 */ "expr ::= PLUS INTEGER",
+ /* 171 */ "expr ::= FLOAT",
+ /* 172 */ "expr ::= MINUS FLOAT",
+ /* 173 */ "expr ::= PLUS FLOAT",
+ /* 174 */ "expr ::= STRING",
+ /* 175 */ "expr ::= NOW",
+ /* 176 */ "expr ::= VARIABLE",
+ /* 177 */ "expr ::= BOOL",
+ /* 178 */ "expr ::= ID LP exprlist RP",
+ /* 179 */ "expr ::= ID LP STAR RP",
+ /* 180 */ "expr ::= expr AND expr",
+ /* 181 */ "expr ::= expr OR expr",
+ /* 182 */ "expr ::= expr LT expr",
+ /* 183 */ "expr ::= expr GT expr",
+ /* 184 */ "expr ::= expr LE expr",
+ /* 185 */ "expr ::= expr GE expr",
+ /* 186 */ "expr ::= expr NE expr",
+ /* 187 */ "expr ::= expr EQ expr",
+ /* 188 */ "expr ::= expr PLUS expr",
+ /* 189 */ "expr ::= expr MINUS expr",
+ /* 190 */ "expr ::= expr STAR expr",
+ /* 191 */ "expr ::= expr SLASH expr",
+ /* 192 */ "expr ::= expr REM expr",
+ /* 193 */ "expr ::= expr LIKE expr",
+ /* 194 */ "expr ::= expr IN LP exprlist RP",
+ /* 195 */ "exprlist ::= exprlist COMMA expritem",
+ /* 196 */ "exprlist ::= expritem",
+ /* 197 */ "expritem ::= expr",
+ /* 198 */ "expritem ::=",
+ /* 199 */ "cmd ::= INSERT INTO cpxName insert_value_list",
+ /* 200 */ "insert_value_list ::= VALUES LP itemlist RP",
+ /* 201 */ "insert_value_list ::= insert_value_list VALUES LP itemlist RP",
+ /* 202 */ "itemlist ::= itemlist COMMA expr",
+ /* 203 */ "itemlist ::= expr",
+ /* 204 */ "cmd ::= RESET QUERY CACHE",
+ /* 205 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
+ /* 206 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
+ /* 207 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
+ /* 208 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
+ /* 209 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
+ /* 210 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
+ /* 211 */ "cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER",
+ /* 212 */ "cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER",
+ /* 213 */ "cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER",
};
#endif /* NDEBUG */
#if YYSTACKDEPTH<=0
/*
-** Try to increase the size of the parser stack.
+** Try to increase the size of the parser stack. Return the number
+** of errors. Return 0 on success.
*/
-static void yyGrowStack(yyParser *p){
+static int yyGrowStack(yyParser *p){
int newSize;
+ int idx;
yyStackEntry *pNew;
newSize = p->yystksz*2 + 100;
- pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
+ idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
+ if( p->yystack==&p->yystk0 ){
+ pNew = malloc(newSize*sizeof(pNew[0]));
+ if( pNew ) pNew[0] = p->yystk0;
+ }else{
+ pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
+ }
if( pNew ){
p->yystack = pNew;
- p->yystksz = newSize;
+ p->yytos = &p->yystack[idx];
#ifndef NDEBUG
if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
- yyTracePrompt, p->yystksz);
+ fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
+ yyTracePrompt, p->yystksz, newSize);
}
#endif
+ p->yystksz = newSize;
}
+ return pNew==0;
}
#endif
@@ -1009,6 +1233,34 @@ static void yyGrowStack(yyParser *p){
# define YYMALLOCARGTYPE size_t
#endif
+/* Initialize a new parser that has already been allocated.
+*/
+void ParseInit(void *yypParser){
+ yyParser *pParser = (yyParser*)yypParser;
+#ifdef YYTRACKMAXSTACKDEPTH
+ pParser->yyhwm = 0;
+#endif
+#if YYSTACKDEPTH<=0
+ pParser->yytos = NULL;
+ pParser->yystack = NULL;
+ pParser->yystksz = 0;
+ if( yyGrowStack(pParser) ){
+ pParser->yystack = &pParser->yystk0;
+ pParser->yystksz = 1;
+ }
+#endif
+#ifndef YYNOERRORRECOVERY
+ pParser->yyerrcnt = -1;
+#endif
+ pParser->yytos = pParser->yystack;
+ pParser->yystack[0].stateno = 0;
+ pParser->yystack[0].major = 0;
+#if YYSTACKDEPTH>0
+ pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
+#endif
+}
+
+#ifndef Parse_ENGINEALWAYSONSTACK
/*
** This function allocates a new parser.
** The only argument is a pointer to a function which works like
@@ -1024,19 +1276,11 @@ static void yyGrowStack(yyParser *p){
void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
yyParser *pParser;
pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
- if( pParser ){
- pParser->yyidx = -1;
-#ifdef YYTRACKMAXSTACKDEPTH
- pParser->yyidxMax = 0;
-#endif
-#if YYSTACKDEPTH<=0
- pParser->yystack = NULL;
- pParser->yystksz = 0;
- yyGrowStack(pParser);
-#endif
- }
+ if( pParser ) ParseInit(pParser);
return pParser;
}
+#endif /* Parse_ENGINEALWAYSONSTACK */
+
/* The following function deletes the "minor type" or semantic value
** associated with a symbol. The symbol can be either a terminal
@@ -1118,8 +1362,9 @@ tVariantDestroy(&(yypminor->yy186));
*/
static void yy_pop_parser_stack(yyParser *pParser){
yyStackEntry *yytos;
- assert( pParser->yyidx>=0 );
- yytos = &pParser->yystack[pParser->yyidx--];
+ assert( pParser->yytos!=0 );
+ assert( pParser->yytos > pParser->yystack );
+ yytos = pParser->yytos--;
#ifndef NDEBUG
if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sPopping %s\n",
@@ -1130,6 +1375,18 @@ static void yy_pop_parser_stack(yyParser *pParser){
yy_destructor(pParser, yytos->major, &yytos->minor);
}
+/*
+** Clear all secondary memory allocations from the parser
+*/
+void ParseFinalize(void *p){
+ yyParser *pParser = (yyParser*)p;
+ while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
+#if YYSTACKDEPTH<=0
+ if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
+#endif
+}
+
+#ifndef Parse_ENGINEALWAYSONSTACK
/*
** Deallocate and destroy a parser. Destructors are called for
** all stack elements before shutting the parser down.
@@ -1142,16 +1399,13 @@ void ParseFree(
void *p, /* The parser to be deleted */
void (*freeProc)(void*) /* Function used to reclaim memory */
){
- yyParser *pParser = (yyParser*)p;
#ifndef YYPARSEFREENEVERNULL
- if( pParser==0 ) return;
+ if( p==0 ) return;
#endif
- while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
-#if YYSTACKDEPTH<=0
- free(pParser->yystack);
-#endif
- (*freeProc)((void*)pParser);
+ ParseFinalize(p);
+ (*freeProc)(p);
}
+#endif /* Parse_ENGINEALWAYSONSTACK */
/*
** Return the peak depth of the stack for a parser.
@@ -1159,7 +1413,44 @@ void ParseFree(
#ifdef YYTRACKMAXSTACKDEPTH
int ParseStackPeak(void *p){
yyParser *pParser = (yyParser*)p;
- return pParser->yyidxMax;
+ return pParser->yyhwm;
+}
+#endif
+
+/* This array of booleans keeps track of the parser statement
+** coverage. The element yycoverage[X][Y] is set when the parser
+** is in state X and has a lookahead token Y. In a well-tested
+** systems, every element of this matrix should end up being set.
+*/
+#if defined(YYCOVERAGE)
+static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
+#endif
+
+/*
+** Write into out a description of every state/lookahead combination that
+**
+** (1) has not been used by the parser, and
+** (2) is not a syntax error.
+**
+** Return the number of missed state/lookahead combinations.
+*/
+#if defined(YYCOVERAGE)
+int ParseCoverage(FILE *out){
+ int stateno, iLookAhead, i;
+ int nMissed = 0;
+ for(stateno=0; statenoyystack[pParser->yyidx].stateno;
+ int stateno = pParser->yytos->stateno;
- if( stateno>=YY_MIN_REDUCE ) return stateno;
+ if( stateno>YY_MAX_SHIFT ) return stateno;
assert( stateno <= YY_SHIFT_COUNT );
+#if defined(YYCOVERAGE)
+ yycoverage[stateno][iLookAhead] = 1;
+#endif
do{
i = yy_shift_ofst[stateno];
- if( i==YY_SHIFT_USE_DFLT ) return yy_default[stateno];
+ assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) );
assert( iLookAhead!=YYNOCODE );
+ assert( iLookAhead < YYNTOKEN );
i += iLookAhead;
- if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
- if( iLookAhead>0 ){
+ if( yy_lookahead[i]!=iLookAhead ){
#ifdef YYFALLBACK
- YYCODETYPE iFallback; /* Fallback token */
- if( iLookAhead %s\n",
- yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
- }
-#endif
- assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
- iLookAhead = iFallback;
- continue;
+ if( yyTraceFILE ){
+ fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
+ yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
}
+#endif
+ assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
+ iLookAhead = iFallback;
+ continue;
+ }
#endif
#ifdef YYWILDCARD
- {
- int j = i - iLookAhead + YYWILDCARD;
- if(
+ {
+ int j = i - iLookAhead + YYWILDCARD;
+ if(
#if YY_SHIFT_MIN+YYWILDCARD<0
- j>=0 &&
+ j>=0 &&
#endif
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
- j0
+ ){
#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
- yyTracePrompt, yyTokenName[iLookAhead],
- yyTokenName[YYWILDCARD]);
- }
-#endif /* NDEBUG */
- return yy_action[j];
+ if( yyTraceFILE ){
+ fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
+ yyTracePrompt, yyTokenName[iLookAhead],
+ yyTokenName[YYWILDCARD]);
}
+#endif /* NDEBUG */
+ return yy_action[j];
}
-#endif /* YYWILDCARD */
}
+#endif /* YYWILDCARD */
return yy_default[stateno];
}else{
return yy_action[i];
@@ -1246,7 +1539,6 @@ static int yy_find_reduce_action(
assert( stateno<=YY_REDUCE_COUNT );
#endif
i = yy_reduce_ofst[stateno];
- assert( i!=YY_REDUCE_USE_DFLT );
assert( iLookAhead!=YYNOCODE );
i += iLookAhead;
#ifdef YYERRORSYMBOL
@@ -1263,15 +1555,14 @@ static int yy_find_reduce_action(
/*
** The following routine is called if the stack overflows.
*/
-static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
+static void yyStackOverflow(yyParser *yypParser){
ParseARG_FETCH;
- yypParser->yyidx--;
#ifndef NDEBUG
if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
}
#endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
+ while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
@@ -1283,20 +1574,21 @@ static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
** Print tracing information for a SHIFT action
*/
#ifndef NDEBUG
-static void yyTraceShift(yyParser *yypParser, int yyNewState){
+static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
if( yyTraceFILE ){
if( yyNewStateyystack[yypParser->yyidx].major],
+ fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
+ yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
yyNewState);
}else{
- fprintf(yyTraceFILE,"%sShift '%s'\n",
- yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major]);
+ fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
+ yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
+ yyNewState - YY_MIN_REDUCE);
}
}
}
#else
-# define yyTraceShift(X,Y)
+# define yyTraceShift(X,Y,Z)
#endif
/*
@@ -1306,256 +1598,262 @@ static void yy_shift(
yyParser *yypParser, /* The parser to be shifted */
int yyNewState, /* The new state to shift in */
int yyMajor, /* The major token to shift in */
- YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */
+ ParseTOKENTYPE yyMinor /* The minor token to shift in */
){
yyStackEntry *yytos;
- yypParser->yyidx++;
+ yypParser->yytos++;
#ifdef YYTRACKMAXSTACKDEPTH
- if( yypParser->yyidx>yypParser->yyidxMax ){
- yypParser->yyidxMax = yypParser->yyidx;
+ if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
+ yypParser->yyhwm++;
+ assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
}
#endif
#if YYSTACKDEPTH>0
- if( yypParser->yyidx>=YYSTACKDEPTH ){
- yyStackOverflow(yypParser, yypMinor);
+ if( yypParser->yytos>yypParser->yystackEnd ){
+ yypParser->yytos--;
+ yyStackOverflow(yypParser);
return;
}
#else
- if( yypParser->yyidx>=yypParser->yystksz ){
- yyGrowStack(yypParser);
- if( yypParser->yyidx>=yypParser->yystksz ){
- yyStackOverflow(yypParser, yypMinor);
+ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
+ if( yyGrowStack(yypParser) ){
+ yypParser->yytos--;
+ yyStackOverflow(yypParser);
return;
}
}
#endif
- yytos = &yypParser->yystack[yypParser->yyidx];
+ if( yyNewState > YY_MAX_SHIFT ){
+ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
+ }
+ yytos = yypParser->yytos;
yytos->stateno = (YYACTIONTYPE)yyNewState;
yytos->major = (YYCODETYPE)yyMajor;
- yytos->minor = *yypMinor;
- yyTraceShift(yypParser, yyNewState);
+ yytos->minor.yy0 = yyMinor;
+ yyTraceShift(yypParser, yyNewState, "Shift");
}
/* The following table contains information about every rule that
** is used during the reduce.
*/
static const struct {
- YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
- unsigned char nrhs; /* Number of right-hand side symbols in the rule */
+ YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
+ signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
- { 196, 1 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 197, 2 },
- { 198, 0 },
- { 198, 2 },
- { 200, 0 },
- { 200, 2 },
- { 197, 3 },
- { 197, 5 },
- { 197, 3 },
- { 197, 5 },
- { 197, 3 },
- { 197, 5 },
- { 197, 4 },
- { 197, 3 },
- { 197, 3 },
- { 197, 3 },
- { 197, 2 },
- { 197, 3 },
- { 197, 5 },
- { 197, 5 },
- { 197, 4 },
- { 197, 5 },
- { 197, 3 },
- { 197, 4 },
- { 197, 4 },
- { 197, 4 },
- { 197, 6 },
- { 199, 1 },
- { 199, 1 },
- { 201, 2 },
- { 201, 0 },
- { 204, 3 },
- { 204, 0 },
- { 197, 3 },
- { 197, 6 },
- { 197, 5 },
- { 197, 5 },
- { 206, 0 },
- { 206, 2 },
- { 207, 0 },
- { 207, 2 },
- { 208, 0 },
- { 208, 2 },
- { 209, 0 },
- { 209, 2 },
- { 210, 0 },
- { 210, 2 },
- { 211, 0 },
- { 211, 2 },
- { 212, 0 },
- { 212, 2 },
- { 213, 0 },
- { 213, 2 },
- { 214, 0 },
- { 214, 2 },
- { 203, 9 },
- { 215, 2 },
- { 217, 2 },
- { 218, 2 },
- { 219, 2 },
- { 220, 2 },
- { 221, 2 },
- { 222, 2 },
- { 223, 2 },
- { 224, 2 },
- { 225, 2 },
- { 226, 2 },
- { 227, 2 },
- { 205, 0 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 205, 2 },
- { 202, 0 },
- { 202, 2 },
- { 202, 2 },
- { 228, 1 },
- { 228, 4 },
- { 229, 1 },
- { 229, 2 },
- { 229, 2 },
- { 197, 6 },
- { 230, 3 },
- { 230, 7 },
- { 230, 7 },
- { 230, 2 },
- { 231, 3 },
- { 231, 1 },
- { 233, 2 },
- { 216, 3 },
- { 216, 1 },
- { 234, 1 },
- { 234, 1 },
- { 234, 1 },
- { 234, 1 },
- { 234, 1 },
- { 234, 2 },
- { 234, 2 },
- { 234, 2 },
- { 234, 2 },
- { 197, 1 },
- { 232, 12 },
- { 246, 2 },
- { 246, 0 },
- { 235, 3 },
- { 235, 2 },
- { 248, 2 },
- { 248, 1 },
- { 248, 0 },
- { 236, 2 },
- { 249, 2 },
- { 249, 4 },
- { 250, 1 },
- { 238, 4 },
- { 238, 0 },
- { 239, 0 },
- { 239, 6 },
- { 239, 4 },
- { 240, 4 },
- { 240, 0 },
- { 242, 0 },
- { 242, 3 },
- { 251, 4 },
- { 251, 2 },
- { 253, 2 },
- { 254, 1 },
- { 254, 1 },
- { 254, 0 },
- { 241, 0 },
- { 241, 3 },
- { 255, 3 },
- { 255, 1 },
- { 243, 0 },
- { 243, 2 },
- { 245, 0 },
- { 245, 2 },
- { 245, 4 },
- { 245, 4 },
- { 244, 0 },
- { 244, 2 },
- { 244, 4 },
- { 244, 4 },
- { 237, 0 },
- { 237, 2 },
- { 247, 3 },
- { 247, 1 },
- { 247, 3 },
- { 247, 3 },
- { 247, 1 },
- { 247, 2 },
- { 247, 2 },
- { 247, 1 },
- { 247, 2 },
- { 247, 2 },
- { 247, 1 },
- { 247, 1 },
- { 247, 1 },
- { 247, 1 },
- { 247, 4 },
- { 247, 4 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 3 },
- { 247, 5 },
- { 256, 3 },
- { 256, 1 },
- { 257, 1 },
- { 257, 0 },
- { 197, 4 },
- { 258, 4 },
- { 258, 5 },
- { 259, 3 },
- { 259, 1 },
- { 197, 3 },
- { 197, 7 },
- { 197, 7 },
- { 197, 7 },
- { 197, 7 },
- { 197, 8 },
- { 197, 9 },
- { 197, 5 },
- { 197, 7 },
- { 197, 7 },
+ { 196, -1 }, /* (0) program ::= cmd */
+ { 197, -2 }, /* (1) cmd ::= SHOW DATABASES */
+ { 197, -2 }, /* (2) cmd ::= SHOW MNODES */
+ { 197, -2 }, /* (3) cmd ::= SHOW DNODES */
+ { 197, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */
+ { 197, -2 }, /* (5) cmd ::= SHOW USERS */
+ { 197, -2 }, /* (6) cmd ::= SHOW MODULES */
+ { 197, -2 }, /* (7) cmd ::= SHOW QUERIES */
+ { 197, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */
+ { 197, -2 }, /* (9) cmd ::= SHOW STREAMS */
+ { 197, -2 }, /* (10) cmd ::= SHOW CONFIGS */
+ { 197, -2 }, /* (11) cmd ::= SHOW SCORES */
+ { 197, -2 }, /* (12) cmd ::= SHOW GRANTS */
+ { 198, 0 }, /* (13) dbPrefix ::= */
+ { 198, -2 }, /* (14) dbPrefix ::= ids DOT */
+ { 200, 0 }, /* (15) cpxName ::= */
+ { 200, -2 }, /* (16) cpxName ::= DOT ids */
+ { 197, -3 }, /* (17) cmd ::= SHOW dbPrefix TABLES */
+ { 197, -5 }, /* (18) cmd ::= SHOW dbPrefix TABLES LIKE ids */
+ { 197, -3 }, /* (19) cmd ::= SHOW dbPrefix STABLES */
+ { 197, -5 }, /* (20) cmd ::= SHOW dbPrefix STABLES LIKE ids */
+ { 197, -3 }, /* (21) cmd ::= SHOW dbPrefix VGROUPS */
+ { 197, -5 }, /* (22) cmd ::= DROP TABLE ifexists ids cpxName */
+ { 197, -4 }, /* (23) cmd ::= DROP DATABASE ifexists ids */
+ { 197, -3 }, /* (24) cmd ::= DROP DNODE IPTOKEN */
+ { 197, -3 }, /* (25) cmd ::= DROP USER ids */
+ { 197, -3 }, /* (26) cmd ::= DROP ACCOUNT ids */
+ { 197, -2 }, /* (27) cmd ::= USE ids */
+ { 197, -3 }, /* (28) cmd ::= DESCRIBE ids cpxName */
+ { 197, -5 }, /* (29) cmd ::= ALTER USER ids PASS ids */
+ { 197, -5 }, /* (30) cmd ::= ALTER USER ids PRIVILEGE ids */
+ { 197, -4 }, /* (31) cmd ::= ALTER DNODE IPTOKEN ids */
+ { 197, -5 }, /* (32) cmd ::= ALTER DNODE IPTOKEN ids ids */
+ { 197, -3 }, /* (33) cmd ::= ALTER LOCAL ids */
+ { 197, -4 }, /* (34) cmd ::= ALTER LOCAL ids ids */
+ { 197, -4 }, /* (35) cmd ::= ALTER DATABASE ids alter_db_optr */
+ { 197, -4 }, /* (36) cmd ::= ALTER ACCOUNT ids acct_optr */
+ { 197, -6 }, /* (37) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
+ { 199, -1 }, /* (38) ids ::= ID */
+ { 199, -1 }, /* (39) ids ::= STRING */
+ { 201, -2 }, /* (40) ifexists ::= IF EXISTS */
+ { 201, 0 }, /* (41) ifexists ::= */
+ { 204, -3 }, /* (42) ifnotexists ::= IF NOT EXISTS */
+ { 204, 0 }, /* (43) ifnotexists ::= */
+ { 197, -3 }, /* (44) cmd ::= CREATE DNODE IPTOKEN */
+ { 197, -6 }, /* (45) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
+ { 197, -5 }, /* (46) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
+ { 197, -5 }, /* (47) cmd ::= CREATE USER ids PASS ids */
+ { 206, 0 }, /* (48) pps ::= */
+ { 206, -2 }, /* (49) pps ::= PPS INTEGER */
+ { 207, 0 }, /* (50) tseries ::= */
+ { 207, -2 }, /* (51) tseries ::= TSERIES INTEGER */
+ { 208, 0 }, /* (52) dbs ::= */
+ { 208, -2 }, /* (53) dbs ::= DBS INTEGER */
+ { 209, 0 }, /* (54) streams ::= */
+ { 209, -2 }, /* (55) streams ::= STREAMS INTEGER */
+ { 210, 0 }, /* (56) storage ::= */
+ { 210, -2 }, /* (57) storage ::= STORAGE INTEGER */
+ { 211, 0 }, /* (58) qtime ::= */
+ { 211, -2 }, /* (59) qtime ::= QTIME INTEGER */
+ { 212, 0 }, /* (60) users ::= */
+ { 212, -2 }, /* (61) users ::= USERS INTEGER */
+ { 213, 0 }, /* (62) conns ::= */
+ { 213, -2 }, /* (63) conns ::= CONNS INTEGER */
+ { 214, 0 }, /* (64) state ::= */
+ { 214, -2 }, /* (65) state ::= STATE ids */
+ { 203, -9 }, /* (66) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
+ { 215, -2 }, /* (67) keep ::= KEEP tagitemlist */
+ { 217, -2 }, /* (68) tables ::= TABLES INTEGER */
+ { 218, -2 }, /* (69) cache ::= CACHE INTEGER */
+ { 219, -2 }, /* (70) replica ::= REPLICA INTEGER */
+ { 220, -2 }, /* (71) days ::= DAYS INTEGER */
+ { 221, -2 }, /* (72) rows ::= ROWS INTEGER */
+ { 222, -2 }, /* (73) ablocks ::= ABLOCKS ID */
+ { 223, -2 }, /* (74) tblocks ::= TBLOCKS INTEGER */
+ { 224, -2 }, /* (75) ctime ::= CTIME INTEGER */
+ { 225, -2 }, /* (76) clog ::= CLOG INTEGER */
+ { 226, -2 }, /* (77) comp ::= COMP INTEGER */
+ { 227, -2 }, /* (78) prec ::= PRECISION STRING */
+ { 205, 0 }, /* (79) db_optr ::= */
+ { 205, -2 }, /* (80) db_optr ::= db_optr tables */
+ { 205, -2 }, /* (81) db_optr ::= db_optr cache */
+ { 205, -2 }, /* (82) db_optr ::= db_optr replica */
+ { 205, -2 }, /* (83) db_optr ::= db_optr days */
+ { 205, -2 }, /* (84) db_optr ::= db_optr rows */
+ { 205, -2 }, /* (85) db_optr ::= db_optr ablocks */
+ { 205, -2 }, /* (86) db_optr ::= db_optr tblocks */
+ { 205, -2 }, /* (87) db_optr ::= db_optr ctime */
+ { 205, -2 }, /* (88) db_optr ::= db_optr clog */
+ { 205, -2 }, /* (89) db_optr ::= db_optr comp */
+ { 205, -2 }, /* (90) db_optr ::= db_optr prec */
+ { 205, -2 }, /* (91) db_optr ::= db_optr keep */
+ { 202, 0 }, /* (92) alter_db_optr ::= */
+ { 202, -2 }, /* (93) alter_db_optr ::= alter_db_optr replica */
+ { 202, -2 }, /* (94) alter_db_optr ::= alter_db_optr tables */
+ { 228, -1 }, /* (95) typename ::= ids */
+ { 228, -4 }, /* (96) typename ::= ids LP signed RP */
+ { 229, -1 }, /* (97) signed ::= INTEGER */
+ { 229, -2 }, /* (98) signed ::= PLUS INTEGER */
+ { 229, -2 }, /* (99) signed ::= MINUS INTEGER */
+ { 197, -6 }, /* (100) cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
+ { 230, -3 }, /* (101) create_table_args ::= LP columnlist RP */
+ { 230, -7 }, /* (102) create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
+ { 230, -7 }, /* (103) create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
+ { 230, -2 }, /* (104) create_table_args ::= AS select */
+ { 231, -3 }, /* (105) columnlist ::= columnlist COMMA column */
+ { 231, -1 }, /* (106) columnlist ::= column */
+ { 233, -2 }, /* (107) column ::= ids typename */
+ { 216, -3 }, /* (108) tagitemlist ::= tagitemlist COMMA tagitem */
+ { 216, -1 }, /* (109) tagitemlist ::= tagitem */
+ { 234, -1 }, /* (110) tagitem ::= INTEGER */
+ { 234, -1 }, /* (111) tagitem ::= FLOAT */
+ { 234, -1 }, /* (112) tagitem ::= STRING */
+ { 234, -1 }, /* (113) tagitem ::= BOOL */
+ { 234, -1 }, /* (114) tagitem ::= NULL */
+ { 234, -2 }, /* (115) tagitem ::= MINUS INTEGER */
+ { 234, -2 }, /* (116) tagitem ::= MINUS FLOAT */
+ { 234, -2 }, /* (117) tagitem ::= PLUS INTEGER */
+ { 234, -2 }, /* (118) tagitem ::= PLUS FLOAT */
+ { 197, -1 }, /* (119) cmd ::= select */
+ { 232, -12 }, /* (120) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
+ { 232, -2 }, /* (121) select ::= SELECT selcollist */
+ { 246, -2 }, /* (122) sclp ::= selcollist COMMA */
+ { 246, 0 }, /* (123) sclp ::= */
+ { 235, -3 }, /* (124) selcollist ::= sclp expr as */
+ { 235, -2 }, /* (125) selcollist ::= sclp STAR */
+ { 248, -2 }, /* (126) as ::= AS ids */
+ { 248, -1 }, /* (127) as ::= ids */
+ { 248, 0 }, /* (128) as ::= */
+ { 236, -2 }, /* (129) from ::= FROM tablelist */
+ { 249, -2 }, /* (130) tablelist ::= ids cpxName */
+ { 249, -4 }, /* (131) tablelist ::= tablelist COMMA ids cpxName */
+ { 250, -1 }, /* (132) tmvar ::= VARIABLE */
+ { 238, -4 }, /* (133) interval_opt ::= INTERVAL LP tmvar RP */
+ { 238, 0 }, /* (134) interval_opt ::= */
+ { 239, 0 }, /* (135) fill_opt ::= */
+ { 239, -6 }, /* (136) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ { 239, -4 }, /* (137) fill_opt ::= FILL LP ID RP */
+ { 240, -4 }, /* (138) sliding_opt ::= SLIDING LP tmvar RP */
+ { 240, 0 }, /* (139) sliding_opt ::= */
+ { 242, 0 }, /* (140) orderby_opt ::= */
+ { 242, -3 }, /* (141) orderby_opt ::= ORDER BY sortlist */
+ { 251, -4 }, /* (142) sortlist ::= sortlist COMMA item sortorder */
+ { 251, -2 }, /* (143) sortlist ::= item sortorder */
+ { 253, -2 }, /* (144) item ::= ids cpxName */
+ { 254, -1 }, /* (145) sortorder ::= ASC */
+ { 254, -1 }, /* (146) sortorder ::= DESC */
+ { 254, 0 }, /* (147) sortorder ::= */
+ { 241, 0 }, /* (148) groupby_opt ::= */
+ { 241, -3 }, /* (149) groupby_opt ::= GROUP BY grouplist */
+ { 255, -3 }, /* (150) grouplist ::= grouplist COMMA item */
+ { 255, -1 }, /* (151) grouplist ::= item */
+ { 243, 0 }, /* (152) having_opt ::= */
+ { 243, -2 }, /* (153) having_opt ::= HAVING expr */
+ { 245, 0 }, /* (154) limit_opt ::= */
+ { 245, -2 }, /* (155) limit_opt ::= LIMIT signed */
+ { 245, -4 }, /* (156) limit_opt ::= LIMIT signed OFFSET signed */
+ { 245, -4 }, /* (157) limit_opt ::= LIMIT signed COMMA signed */
+ { 244, 0 }, /* (158) slimit_opt ::= */
+ { 244, -2 }, /* (159) slimit_opt ::= SLIMIT signed */
+ { 244, -4 }, /* (160) slimit_opt ::= SLIMIT signed SOFFSET signed */
+ { 244, -4 }, /* (161) slimit_opt ::= SLIMIT signed COMMA signed */
+ { 237, 0 }, /* (162) where_opt ::= */
+ { 237, -2 }, /* (163) where_opt ::= WHERE expr */
+ { 247, -3 }, /* (164) expr ::= LP expr RP */
+ { 247, -1 }, /* (165) expr ::= ID */
+ { 247, -3 }, /* (166) expr ::= ID DOT ID */
+ { 247, -3 }, /* (167) expr ::= ID DOT STAR */
+ { 247, -1 }, /* (168) expr ::= INTEGER */
+ { 247, -2 }, /* (169) expr ::= MINUS INTEGER */
+ { 247, -2 }, /* (170) expr ::= PLUS INTEGER */
+ { 247, -1 }, /* (171) expr ::= FLOAT */
+ { 247, -2 }, /* (172) expr ::= MINUS FLOAT */
+ { 247, -2 }, /* (173) expr ::= PLUS FLOAT */
+ { 247, -1 }, /* (174) expr ::= STRING */
+ { 247, -1 }, /* (175) expr ::= NOW */
+ { 247, -1 }, /* (176) expr ::= VARIABLE */
+ { 247, -1 }, /* (177) expr ::= BOOL */
+ { 247, -4 }, /* (178) expr ::= ID LP exprlist RP */
+ { 247, -4 }, /* (179) expr ::= ID LP STAR RP */
+ { 247, -3 }, /* (180) expr ::= expr AND expr */
+ { 247, -3 }, /* (181) expr ::= expr OR expr */
+ { 247, -3 }, /* (182) expr ::= expr LT expr */
+ { 247, -3 }, /* (183) expr ::= expr GT expr */
+ { 247, -3 }, /* (184) expr ::= expr LE expr */
+ { 247, -3 }, /* (185) expr ::= expr GE expr */
+ { 247, -3 }, /* (186) expr ::= expr NE expr */
+ { 247, -3 }, /* (187) expr ::= expr EQ expr */
+ { 247, -3 }, /* (188) expr ::= expr PLUS expr */
+ { 247, -3 }, /* (189) expr ::= expr MINUS expr */
+ { 247, -3 }, /* (190) expr ::= expr STAR expr */
+ { 247, -3 }, /* (191) expr ::= expr SLASH expr */
+ { 247, -3 }, /* (192) expr ::= expr REM expr */
+ { 247, -3 }, /* (193) expr ::= expr LIKE expr */
+ { 247, -5 }, /* (194) expr ::= expr IN LP exprlist RP */
+ { 256, -3 }, /* (195) exprlist ::= exprlist COMMA expritem */
+ { 256, -1 }, /* (196) exprlist ::= expritem */
+ { 257, -1 }, /* (197) expritem ::= expr */
+ { 257, 0 }, /* (198) expritem ::= */
+ { 197, -4 }, /* (199) cmd ::= INSERT INTO cpxName insert_value_list */
+ { 258, -4 }, /* (200) insert_value_list ::= VALUES LP itemlist RP */
+ { 258, -5 }, /* (201) insert_value_list ::= insert_value_list VALUES LP itemlist RP */
+ { 259, -3 }, /* (202) itemlist ::= itemlist COMMA expr */
+ { 259, -1 }, /* (203) itemlist ::= expr */
+ { 197, -3 }, /* (204) cmd ::= RESET QUERY CACHE */
+ { 197, -7 }, /* (205) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ { 197, -7 }, /* (206) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ { 197, -7 }, /* (207) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ { 197, -7 }, /* (208) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ { 197, -8 }, /* (209) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ { 197, -9 }, /* (210) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ { 197, -5 }, /* (211) cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */
+ { 197, -7 }, /* (212) cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */
+ { 197, -7 }, /* (213) cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -1563,27 +1861,66 @@ static void yy_accept(yyParser*); /* Forward Declaration */
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
+**
+** The yyLookahead and yyLookaheadToken parameters provide reduce actions
+** access to the lookahead token (if any). The yyLookahead will be YYNOCODE
+** if the lookahead token has already been consumed. As this procedure is
+** only called from one place, optimizing compilers will in-line it, which
+** means that the extra parameters have no performance impact.
*/
static void yy_reduce(
yyParser *yypParser, /* The parser */
- int yyruleno /* Number of the rule by which to reduce */
+ unsigned int yyruleno, /* Number of the rule by which to reduce */
+ int yyLookahead, /* Lookahead token, or YYNOCODE if none */
+ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
){
int yygoto; /* The next state */
int yyact; /* The next action */
- YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
yyStackEntry *yymsp; /* The top of the parser's stack */
int yysize; /* Amount to pop the stack */
ParseARG_FETCH;
- yymsp = &yypParser->yystack[yypParser->yyidx];
+ (void)yyLookahead;
+ (void)yyLookaheadToken;
+ yymsp = yypParser->yytos;
#ifndef NDEBUG
- if( yyTraceFILE && yyruleno>=0
- && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
+ if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
yysize = yyRuleInfo[yyruleno].nrhs;
- fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
- yyRuleName[yyruleno], yymsp[-yysize].stateno);
+ if( yysize ){
+ fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n",
+ yyTracePrompt,
+ yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno);
+ }else{
+ fprintf(yyTraceFILE, "%sReduce %d [%s].\n",
+ yyTracePrompt, yyruleno, yyRuleName[yyruleno]);
+ }
}
#endif /* NDEBUG */
- yygotominor = yyzerominor;
+
+ /* Check that the stack is large enough to grow by a single entry
+ ** if the RHS of the rule is empty. This ensures that there is room
+ ** enough on the stack to push the LHS value */
+ if( yyRuleInfo[yyruleno].nrhs==0 ){
+#ifdef YYTRACKMAXSTACKDEPTH
+ if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
+ yypParser->yyhwm++;
+ assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack));
+ }
+#endif
+#if YYSTACKDEPTH>0
+ if( yypParser->yytos>=yypParser->yystackEnd ){
+ yyStackOverflow(yypParser);
+ return;
+ }
+#else
+ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
+ if( yyGrowStack(yypParser) ){
+ yyStackOverflow(yypParser);
+ return;
+ }
+ yymsp = yypParser->yytos;
+ }
+#endif
+ }
switch( yyruleno ){
/* Beginning here are the reduction cases. A typical example
@@ -1595,6 +1932,7 @@ static void yy_reduce(
** break;
*/
/********** Begin reduce actions **********************************************/
+ YYMINORTYPE yylhsminor;
case 0: /* program ::= cmd */
{}
break;
@@ -1637,16 +1975,17 @@ static void yy_reduce(
case 13: /* dbPrefix ::= */
case 41: /* ifexists ::= */ yytestcase(yyruleno==41);
case 43: /* ifnotexists ::= */ yytestcase(yyruleno==43);
-{yygotominor.yy0.n = 0;}
+{yymsp[1].minor.yy0.n = 0;}
break;
case 14: /* dbPrefix ::= ids DOT */
-{yygotominor.yy0 = yymsp[-1].minor.yy0; }
+{yylhsminor.yy0 = yymsp[-1].minor.yy0; }
+ yymsp[-1].minor.yy0 = yylhsminor.yy0;
break;
case 15: /* cpxName ::= */
-{yygotominor.yy0.n = 0; }
+{yymsp[1].minor.yy0.n = 0; }
break;
case 16: /* cpxName ::= DOT ids */
-{yygotominor.yy0 = yymsp[0].minor.yy0; yygotominor.yy0.n += 1; }
+{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n += 1; }
break;
case 17: /* cmd ::= SHOW dbPrefix TABLES */
{
@@ -1686,7 +2025,7 @@ static void yy_reduce(
case 23: /* cmd ::= DROP DATABASE ifexists ids */
{ setDCLSQLElems(pInfo, DROP_DATABASE, 2, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- case 24: /* cmd ::= DROP DNODE IP */
+ case 24: /* cmd ::= DROP DNODE IPTOKEN */
{ setDCLSQLElems(pInfo, DROP_DNODE, 1, &yymsp[0].minor.yy0); }
break;
case 25: /* cmd ::= DROP USER ids */
@@ -1710,10 +2049,10 @@ static void yy_reduce(
case 30: /* cmd ::= ALTER USER ids PRIVILEGE ids */
{ setDCLSQLElems(pInfo, ALTER_USER_PRIVILEGES, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
break;
- case 31: /* cmd ::= ALTER DNODE IP ids */
+ case 31: /* cmd ::= ALTER DNODE IPTOKEN ids */
{ setDCLSQLElems(pInfo, ALTER_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 32: /* cmd ::= ALTER DNODE IP ids ids */
+ case 32: /* cmd ::= ALTER DNODE IPTOKEN ids ids */
{ setDCLSQLElems(pInfo, ALTER_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
case 33: /* cmd ::= ALTER LOCAL ids */
@@ -1733,13 +2072,16 @@ static void yy_reduce(
break;
case 38: /* ids ::= ID */
case 39: /* ids ::= STRING */ yytestcase(yyruleno==39);
-{yygotominor.yy0 = yymsp[0].minor.yy0; }
+{yylhsminor.yy0 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 40: /* ifexists ::= IF EXISTS */
- case 42: /* ifnotexists ::= IF NOT EXISTS */ yytestcase(yyruleno==42);
-{yygotominor.yy0.n = 1;}
+{yymsp[-1].minor.yy0.n = 1;}
break;
- case 44: /* cmd ::= CREATE DNODE IP */
+ case 42: /* ifnotexists ::= IF NOT EXISTS */
+{yymsp[-2].minor.yy0.n = 1;}
+ break;
+ case 44: /* cmd ::= CREATE DNODE IPTOKEN */
{ setDCLSQLElems(pInfo, CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
break;
case 45: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
@@ -1760,9 +2102,7 @@ static void yy_reduce(
case 60: /* users ::= */ yytestcase(yyruleno==60);
case 62: /* conns ::= */ yytestcase(yyruleno==62);
case 64: /* state ::= */ yytestcase(yyruleno==64);
- case 133: /* interval_opt ::= */ yytestcase(yyruleno==133);
- case 138: /* sliding_opt ::= */ yytestcase(yyruleno==138);
-{yygotominor.yy0.n = 0; }
+{yymsp[1].minor.yy0.n = 0; }
break;
case 49: /* pps ::= PPS INTEGER */
case 51: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==51);
@@ -1773,23 +2113,24 @@ static void yy_reduce(
case 61: /* users ::= USERS INTEGER */ yytestcase(yyruleno==61);
case 63: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==63);
case 65: /* state ::= STATE ids */ yytestcase(yyruleno==65);
-{yygotominor.yy0 = yymsp[0].minor.yy0; }
+{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
case 66: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
- yygotominor.yy279.users = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
- yygotominor.yy279.dbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
- yygotominor.yy279.tseries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
- yygotominor.yy279.streams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
- yygotominor.yy279.pps = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
- yygotominor.yy279.storage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
- yygotominor.yy279.qtime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
- yygotominor.yy279.conns = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
- yygotominor.yy279.stat = yymsp[0].minor.yy0;
+ yylhsminor.yy279.users = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
+ yylhsminor.yy279.dbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
+ yylhsminor.yy279.tseries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
+ yylhsminor.yy279.streams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
+ yylhsminor.yy279.pps = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
+ yylhsminor.yy279.storage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
+ yylhsminor.yy279.qtime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
+ yylhsminor.yy279.conns = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
+ yylhsminor.yy279.stat = yymsp[0].minor.yy0;
}
+ yymsp[-8].minor.yy279 = yylhsminor.yy279;
break;
case 67: /* keep ::= KEEP tagitemlist */
-{ yygotominor.yy56 = yymsp[0].minor.yy56; }
+{ yymsp[-1].minor.yy56 = yymsp[0].minor.yy56; }
break;
case 68: /* tables ::= TABLES INTEGER */
case 69: /* cache ::= CACHE INTEGER */ yytestcase(yyruleno==69);
@@ -1802,65 +2143,84 @@ static void yy_reduce(
case 76: /* clog ::= CLOG INTEGER */ yytestcase(yyruleno==76);
case 77: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==77);
case 78: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==78);
- case 79: /* db_optr ::= */ yytestcase(yyruleno==79);
-{ yygotominor.yy0 = yymsp[0].minor.yy0; }
+{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
+ break;
+ case 79: /* db_optr ::= */
+{memset(&yymsp[1].minor.yy398, 0, sizeof(SCreateDBInfo));}
break;
case 80: /* db_optr ::= db_optr tables */
case 94: /* alter_db_optr ::= alter_db_optr tables */ yytestcase(yyruleno==94);
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.tablesPerVnode = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.tablesPerVnode = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 81: /* db_optr ::= db_optr cache */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 82: /* db_optr ::= db_optr replica */
case 93: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==93);
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 83: /* db_optr ::= db_optr days */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 84: /* db_optr ::= db_optr rows */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.rowPerFileBlock = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.rowPerFileBlock = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 85: /* db_optr ::= db_optr ablocks */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.numOfAvgCacheBlocks = strtod(yymsp[0].minor.yy0.z, NULL); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.numOfAvgCacheBlocks = strtod(yymsp[0].minor.yy0.z, NULL); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 86: /* db_optr ::= db_optr tblocks */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.numOfBlocksPerTable = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.numOfBlocksPerTable = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 87: /* db_optr ::= db_optr ctime */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 88: /* db_optr ::= db_optr clog */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.commitLog = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.commitLog = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 89: /* db_optr ::= db_optr comp */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 90: /* db_optr ::= db_optr prec */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.precision = yymsp[0].minor.yy0; }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.precision = yymsp[0].minor.yy0; }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 91: /* db_optr ::= db_optr keep */
-{ yygotominor.yy398 = yymsp[-1].minor.yy398; yygotominor.yy398.keep = yymsp[0].minor.yy56; }
+{ yylhsminor.yy398 = yymsp[-1].minor.yy398; yylhsminor.yy398.keep = yymsp[0].minor.yy56; }
+ yymsp[-1].minor.yy398 = yylhsminor.yy398;
break;
case 92: /* alter_db_optr ::= */
-{ memset(&yygotominor.yy398, 0, sizeof(SCreateDBInfo));}
+{ memset(&yymsp[1].minor.yy398, 0, sizeof(SCreateDBInfo));}
break;
case 95: /* typename ::= ids */
-{ tSQLSetColumnType (&yygotominor.yy223, &yymsp[0].minor.yy0); }
+{ tSQLSetColumnType (&yylhsminor.yy223, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy223 = yylhsminor.yy223;
break;
case 96: /* typename ::= ids LP signed RP */
{
yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy389; // negative value of name length
- tSQLSetColumnType(&yygotominor.yy223, &yymsp[-3].minor.yy0);
+ tSQLSetColumnType(&yylhsminor.yy223, &yymsp[-3].minor.yy0);
}
+ yymsp[-3].minor.yy223 = yylhsminor.yy223;
break;
case 97: /* signed ::= INTEGER */
- case 98: /* signed ::= PLUS INTEGER */ yytestcase(yyruleno==98);
-{ yygotominor.yy389 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yylhsminor.yy389 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[0].minor.yy389 = yylhsminor.yy389;
+ break;
+ case 98: /* signed ::= PLUS INTEGER */
+{ yymsp[-1].minor.yy389 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 99: /* signed ::= MINUS INTEGER */
-{ yygotominor.yy389 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
+{ yymsp[-1].minor.yy389 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
break;
case 100: /* cmd ::= CREATE TABLE ifnotexists ids cpxName create_table_args */
{
@@ -1870,54 +2230,61 @@ static void yy_reduce(
break;
case 101: /* create_table_args ::= LP columnlist RP */
{
- yygotominor.yy158 = tSetCreateSQLElems(yymsp[-1].minor.yy471, NULL, NULL, NULL, NULL, TSQL_CREATE_NORMAL_METER);
- setSQLInfo(pInfo, yygotominor.yy158, NULL, TSQL_CREATE_NORMAL_METER);
+ yymsp[-2].minor.yy158 = tSetCreateSQLElems(yymsp[-1].minor.yy471, NULL, NULL, NULL, NULL, TSQL_CREATE_NORMAL_METER);
+ setSQLInfo(pInfo, yymsp[-2].minor.yy158, NULL, TSQL_CREATE_NORMAL_METER);
}
break;
case 102: /* create_table_args ::= LP columnlist RP TAGS LP columnlist RP */
{
- yygotominor.yy158 = tSetCreateSQLElems(yymsp[-5].minor.yy471, yymsp[-1].minor.yy471, NULL, NULL, NULL, TSQL_CREATE_NORMAL_METRIC);
- setSQLInfo(pInfo, yygotominor.yy158, NULL, TSQL_CREATE_NORMAL_METRIC);
+ yymsp[-6].minor.yy158 = tSetCreateSQLElems(yymsp[-5].minor.yy471, yymsp[-1].minor.yy471, NULL, NULL, NULL, TSQL_CREATE_NORMAL_METRIC);
+ setSQLInfo(pInfo, yymsp[-6].minor.yy158, NULL, TSQL_CREATE_NORMAL_METRIC);
}
break;
case 103: /* create_table_args ::= USING ids cpxName TAGS LP tagitemlist RP */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
- yygotominor.yy158 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy56, NULL, TSQL_CREATE_METER_FROM_METRIC);
- setSQLInfo(pInfo, yygotominor.yy158, NULL, TSQL_CREATE_METER_FROM_METRIC);
+ yymsp[-6].minor.yy158 = tSetCreateSQLElems(NULL, NULL, &yymsp[-5].minor.yy0, yymsp[-1].minor.yy56, NULL, TSQL_CREATE_METER_FROM_METRIC);
+ setSQLInfo(pInfo, yymsp[-6].minor.yy158, NULL, TSQL_CREATE_METER_FROM_METRIC);
}
break;
case 104: /* create_table_args ::= AS select */
{
- yygotominor.yy158 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy24, TSQL_CREATE_STREAM);
- setSQLInfo(pInfo, yygotominor.yy158, NULL, TSQL_CREATE_STREAM);
+ yymsp[-1].minor.yy158 = tSetCreateSQLElems(NULL, NULL, NULL, NULL, yymsp[0].minor.yy24, TSQL_CREATE_STREAM);
+ setSQLInfo(pInfo, yymsp[-1].minor.yy158, NULL, TSQL_CREATE_STREAM);
}
break;
case 105: /* columnlist ::= columnlist COMMA column */
-{yygotominor.yy471 = tFieldListAppend(yymsp[-2].minor.yy471, &yymsp[0].minor.yy223); }
+{yylhsminor.yy471 = tFieldListAppend(yymsp[-2].minor.yy471, &yymsp[0].minor.yy223); }
+ yymsp[-2].minor.yy471 = yylhsminor.yy471;
break;
case 106: /* columnlist ::= column */
-{yygotominor.yy471 = tFieldListAppend(NULL, &yymsp[0].minor.yy223);}
+{yylhsminor.yy471 = tFieldListAppend(NULL, &yymsp[0].minor.yy223);}
+ yymsp[0].minor.yy471 = yylhsminor.yy471;
break;
case 107: /* column ::= ids typename */
{
- tSQLSetColumnInfo(&yygotominor.yy223, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy223);
+ tSQLSetColumnInfo(&yylhsminor.yy223, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy223);
}
+ yymsp[-1].minor.yy223 = yylhsminor.yy223;
break;
case 108: /* tagitemlist ::= tagitemlist COMMA tagitem */
-{ yygotominor.yy56 = tVariantListAppend(yymsp[-2].minor.yy56, &yymsp[0].minor.yy186, -1); }
+{ yylhsminor.yy56 = tVariantListAppend(yymsp[-2].minor.yy56, &yymsp[0].minor.yy186, -1); }
+ yymsp[-2].minor.yy56 = yylhsminor.yy56;
break;
case 109: /* tagitemlist ::= tagitem */
-{ yygotominor.yy56 = tVariantListAppend(NULL, &yymsp[0].minor.yy186, -1); }
+{ yylhsminor.yy56 = tVariantListAppend(NULL, &yymsp[0].minor.yy186, -1); }
+ yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
case 110: /* tagitem ::= INTEGER */
case 111: /* tagitem ::= FLOAT */ yytestcase(yyruleno==111);
case 112: /* tagitem ::= STRING */ yytestcase(yyruleno==112);
case 113: /* tagitem ::= BOOL */ yytestcase(yyruleno==113);
-{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yygotominor.yy186, &yymsp[0].minor.yy0); }
+{toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy186, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy186 = yylhsminor.yy186;
break;
case 114: /* tagitem ::= NULL */
-{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yygotominor.yy186, &yymsp[0].minor.yy0); }
+{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy186, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy186 = yylhsminor.yy186;
break;
case 115: /* tagitem ::= MINUS INTEGER */
case 116: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==116);
@@ -1927,8 +2294,9 @@ static void yy_reduce(
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
toTSDBType(yymsp[-1].minor.yy0.type);
- tVariantCreate(&yygotominor.yy186, &yymsp[-1].minor.yy0);
+ tVariantCreate(&yylhsminor.yy186, &yymsp[-1].minor.yy0);
}
+ yymsp[-1].minor.yy186 = yylhsminor.yy186;
break;
case 119: /* cmd ::= select */
{
@@ -1937,260 +2305,321 @@ static void yy_reduce(
break;
case 120: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{
- yygotominor.yy24 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy498, yymsp[-9].minor.yy56, yymsp[-8].minor.yy90, yymsp[-4].minor.yy56, yymsp[-3].minor.yy56, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy56, &yymsp[0].minor.yy294, &yymsp[-1].minor.yy294);
+ yylhsminor.yy24 = tSetQuerySQLElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy498, yymsp[-9].minor.yy56, yymsp[-8].minor.yy90, yymsp[-4].minor.yy56, yymsp[-3].minor.yy56, &yymsp[-7].minor.yy0, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy56, &yymsp[0].minor.yy294, &yymsp[-1].minor.yy294);
}
+ yymsp[-11].minor.yy24 = yylhsminor.yy24;
break;
- case 121: /* sclp ::= selcollist COMMA */
-{yygotominor.yy498 = yymsp[-1].minor.yy498;}
- break;
- case 122: /* sclp ::= */
-{yygotominor.yy498 = 0;}
- break;
- case 123: /* selcollist ::= sclp expr as */
+ case 121: /* select ::= SELECT selcollist */
{
- yygotominor.yy498 = tSQLExprListAppend(yymsp[-2].minor.yy498, yymsp[-1].minor.yy90, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
+ yylhsminor.yy24 = tSetQuerySQLElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy498, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
+ yymsp[-1].minor.yy24 = yylhsminor.yy24;
break;
- case 124: /* selcollist ::= sclp STAR */
+ case 122: /* sclp ::= selcollist COMMA */
+{yylhsminor.yy498 = yymsp[-1].minor.yy498;}
+ yymsp[-1].minor.yy498 = yylhsminor.yy498;
+ break;
+ case 123: /* sclp ::= */
+{yymsp[1].minor.yy498 = 0;}
+ break;
+ case 124: /* selcollist ::= sclp expr as */
+{
+ yylhsminor.yy498 = tSQLExprListAppend(yymsp[-2].minor.yy498, yymsp[-1].minor.yy90, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
+}
+ yymsp[-2].minor.yy498 = yylhsminor.yy498;
+ break;
+ case 125: /* selcollist ::= sclp STAR */
{
tSQLExpr *pNode = tSQLExprIdValueCreate(NULL, TK_ALL);
- yygotominor.yy498 = tSQLExprListAppend(yymsp[-1].minor.yy498, pNode, 0);
+ yylhsminor.yy498 = tSQLExprListAppend(yymsp[-1].minor.yy498, pNode, 0);
}
+ yymsp[-1].minor.yy498 = yylhsminor.yy498;
break;
- case 125: /* as ::= AS ids */
- case 126: /* as ::= ids */ yytestcase(yyruleno==126);
-{ yygotominor.yy0 = yymsp[0].minor.yy0; }
+ case 126: /* as ::= AS ids */
+{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
- case 127: /* as ::= */
-{ yygotominor.yy0.n = 0; }
+ case 127: /* as ::= ids */
+{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 128: /* from ::= FROM tablelist */
- case 140: /* orderby_opt ::= ORDER BY sortlist */ yytestcase(yyruleno==140);
- case 148: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==148);
-{yygotominor.yy56 = yymsp[0].minor.yy56;}
+ case 128: /* as ::= */
+{ yymsp[1].minor.yy0.n = 0; }
break;
- case 129: /* tablelist ::= ids cpxName */
-{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yygotominor.yy56 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);}
+ case 129: /* from ::= FROM tablelist */
+{yymsp[-1].minor.yy56 = yymsp[0].minor.yy56;}
break;
- case 130: /* tablelist ::= tablelist COMMA ids cpxName */
-{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yygotominor.yy56 = tVariantListAppendToken(yymsp[-3].minor.yy56, &yymsp[-1].minor.yy0, -1); }
+ case 130: /* tablelist ::= ids cpxName */
+{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy56 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);}
+ yymsp[-1].minor.yy56 = yylhsminor.yy56;
break;
- case 131: /* tmvar ::= VARIABLE */
-{yygotominor.yy0 = yymsp[0].minor.yy0;}
+ case 131: /* tablelist ::= tablelist COMMA ids cpxName */
+{ toTSDBType(yymsp[-1].minor.yy0.type); yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yylhsminor.yy56 = tVariantListAppendToken(yymsp[-3].minor.yy56, &yymsp[-1].minor.yy0, -1); }
+ yymsp[-3].minor.yy56 = yylhsminor.yy56;
break;
- case 132: /* interval_opt ::= INTERVAL LP tmvar RP */
- case 137: /* sliding_opt ::= SLIDING LP tmvar RP */ yytestcase(yyruleno==137);
-{yygotominor.yy0 = yymsp[-1].minor.yy0; }
+ case 132: /* tmvar ::= VARIABLE */
+{yylhsminor.yy0 = yymsp[0].minor.yy0;}
+ yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 134: /* fill_opt ::= */
-{yygotominor.yy56 = 0; }
+ case 133: /* interval_opt ::= INTERVAL LP tmvar RP */
+ case 138: /* sliding_opt ::= SLIDING LP tmvar RP */ yytestcase(yyruleno==138);
+{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; }
break;
- case 135: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ case 134: /* interval_opt ::= */
+ case 139: /* sliding_opt ::= */ yytestcase(yyruleno==139);
+{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
+ break;
+ case 135: /* fill_opt ::= */
+{yymsp[1].minor.yy56 = 0; }
+ break;
+ case 136: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
tVariant A = {0};
toTSDBType(yymsp[-3].minor.yy0.type);
tVariantCreate(&A, &yymsp[-3].minor.yy0);
tVariantListInsert(yymsp[-1].minor.yy56, &A, -1, 0);
- yygotominor.yy56 = yymsp[-1].minor.yy56;
+ yymsp[-5].minor.yy56 = yymsp[-1].minor.yy56;
}
break;
- case 136: /* fill_opt ::= FILL LP ID RP */
+ case 137: /* fill_opt ::= FILL LP ID RP */
{
toTSDBType(yymsp[-1].minor.yy0.type);
- yygotominor.yy56 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
+ yymsp[-3].minor.yy56 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
}
break;
- case 139: /* orderby_opt ::= */
- case 147: /* groupby_opt ::= */ yytestcase(yyruleno==147);
-{yygotominor.yy56 = 0;}
+ case 140: /* orderby_opt ::= */
+ case 148: /* groupby_opt ::= */ yytestcase(yyruleno==148);
+{yymsp[1].minor.yy56 = 0;}
break;
- case 141: /* sortlist ::= sortlist COMMA item sortorder */
+ case 141: /* orderby_opt ::= ORDER BY sortlist */
+ case 149: /* groupby_opt ::= GROUP BY grouplist */ yytestcase(yyruleno==149);
+{yymsp[-2].minor.yy56 = yymsp[0].minor.yy56;}
+ break;
+ case 142: /* sortlist ::= sortlist COMMA item sortorder */
{
- yygotominor.yy56 = tVariantListAppend(yymsp[-3].minor.yy56, &yymsp[-1].minor.yy186, yymsp[0].minor.yy332);
+ yylhsminor.yy56 = tVariantListAppend(yymsp[-3].minor.yy56, &yymsp[-1].minor.yy186, yymsp[0].minor.yy332);
}
+ yymsp[-3].minor.yy56 = yylhsminor.yy56;
break;
- case 142: /* sortlist ::= item sortorder */
+ case 143: /* sortlist ::= item sortorder */
{
- yygotominor.yy56 = tVariantListAppend(NULL, &yymsp[-1].minor.yy186, yymsp[0].minor.yy332);
+ yylhsminor.yy56 = tVariantListAppend(NULL, &yymsp[-1].minor.yy186, yymsp[0].minor.yy332);
}
+ yymsp[-1].minor.yy56 = yylhsminor.yy56;
break;
- case 143: /* item ::= ids cpxName */
+ case 144: /* item ::= ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
- tVariantCreate(&yygotominor.yy186, &yymsp[-1].minor.yy0);
+ tVariantCreate(&yylhsminor.yy186, &yymsp[-1].minor.yy0);
}
+ yymsp[-1].minor.yy186 = yylhsminor.yy186;
break;
- case 144: /* sortorder ::= ASC */
-{yygotominor.yy332 = TSQL_SO_ASC; }
+ case 145: /* sortorder ::= ASC */
+{yymsp[0].minor.yy332 = TSQL_SO_ASC; }
break;
- case 145: /* sortorder ::= DESC */
-{yygotominor.yy332 = TSQL_SO_DESC;}
+ case 146: /* sortorder ::= DESC */
+{yymsp[0].minor.yy332 = TSQL_SO_DESC;}
break;
- case 146: /* sortorder ::= */
-{yygotominor.yy332 = TSQL_SO_ASC;}
+ case 147: /* sortorder ::= */
+{yymsp[1].minor.yy332 = TSQL_SO_ASC;}
break;
- case 149: /* grouplist ::= grouplist COMMA item */
+ case 150: /* grouplist ::= grouplist COMMA item */
{
- yygotominor.yy56 = tVariantListAppend(yymsp[-2].minor.yy56, &yymsp[0].minor.yy186, -1);
+ yylhsminor.yy56 = tVariantListAppend(yymsp[-2].minor.yy56, &yymsp[0].minor.yy186, -1);
}
+ yymsp[-2].minor.yy56 = yylhsminor.yy56;
break;
- case 150: /* grouplist ::= item */
+ case 151: /* grouplist ::= item */
{
- yygotominor.yy56 = tVariantListAppend(NULL, &yymsp[0].minor.yy186, -1);
+ yylhsminor.yy56 = tVariantListAppend(NULL, &yymsp[0].minor.yy186, -1);
}
+ yymsp[0].minor.yy56 = yylhsminor.yy56;
break;
- case 151: /* having_opt ::= */
- case 161: /* where_opt ::= */ yytestcase(yyruleno==161);
- case 197: /* expritem ::= */ yytestcase(yyruleno==197);
-{yygotominor.yy90 = 0;}
+ case 152: /* having_opt ::= */
+ case 162: /* where_opt ::= */ yytestcase(yyruleno==162);
+ case 198: /* expritem ::= */ yytestcase(yyruleno==198);
+{yymsp[1].minor.yy90 = 0;}
break;
- case 152: /* having_opt ::= HAVING expr */
- case 162: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==162);
- case 196: /* expritem ::= expr */ yytestcase(yyruleno==196);
-{yygotominor.yy90 = yymsp[0].minor.yy90;}
+ case 153: /* having_opt ::= HAVING expr */
+ case 163: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==163);
+{yymsp[-1].minor.yy90 = yymsp[0].minor.yy90;}
break;
- case 153: /* limit_opt ::= */
- case 157: /* slimit_opt ::= */ yytestcase(yyruleno==157);
-{yygotominor.yy294.limit = -1; yygotominor.yy294.offset = 0;}
+ case 154: /* limit_opt ::= */
+ case 158: /* slimit_opt ::= */ yytestcase(yyruleno==158);
+{yymsp[1].minor.yy294.limit = -1; yymsp[1].minor.yy294.offset = 0;}
break;
- case 154: /* limit_opt ::= LIMIT signed */
- case 158: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==158);
-{yygotominor.yy294.limit = yymsp[0].minor.yy389; yygotominor.yy294.offset = 0;}
+ case 155: /* limit_opt ::= LIMIT signed */
+ case 159: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==159);
+{yymsp[-1].minor.yy294.limit = yymsp[0].minor.yy389; yymsp[-1].minor.yy294.offset = 0;}
break;
- case 155: /* limit_opt ::= LIMIT signed OFFSET signed */
- case 159: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==159);
-{yygotominor.yy294.limit = yymsp[-2].minor.yy389; yygotominor.yy294.offset = yymsp[0].minor.yy389;}
+ case 156: /* limit_opt ::= LIMIT signed OFFSET signed */
+ case 160: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ yytestcase(yyruleno==160);
+{yymsp[-3].minor.yy294.limit = yymsp[-2].minor.yy389; yymsp[-3].minor.yy294.offset = yymsp[0].minor.yy389;}
break;
- case 156: /* limit_opt ::= LIMIT signed COMMA signed */
- case 160: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==160);
-{yygotominor.yy294.limit = yymsp[0].minor.yy389; yygotominor.yy294.offset = yymsp[-2].minor.yy389;}
+ case 157: /* limit_opt ::= LIMIT signed COMMA signed */
+ case 161: /* slimit_opt ::= SLIMIT signed COMMA signed */ yytestcase(yyruleno==161);
+{yymsp[-3].minor.yy294.limit = yymsp[0].minor.yy389; yymsp[-3].minor.yy294.offset = yymsp[-2].minor.yy389;}
break;
- case 163: /* expr ::= LP expr RP */
-{yygotominor.yy90 = yymsp[-1].minor.yy90; }
+ case 164: /* expr ::= LP expr RP */
+{yymsp[-2].minor.yy90 = yymsp[-1].minor.yy90; }
break;
- case 164: /* expr ::= ID */
-{yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);}
+ case 165: /* expr ::= ID */
+{yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);}
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
- case 165: /* expr ::= ID DOT ID */
-{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);}
+ case 166: /* expr ::= ID DOT ID */
+{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 166: /* expr ::= ID DOT STAR */
-{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);}
+ case 167: /* expr ::= ID DOT STAR */
+{yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 167: /* expr ::= INTEGER */
-{yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);}
+ case 168: /* expr ::= INTEGER */
+{yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);}
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
- case 168: /* expr ::= MINUS INTEGER */
- case 169: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==169);
-{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);}
+ case 169: /* expr ::= MINUS INTEGER */
+ case 170: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==170);
+{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);}
+ yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
- case 170: /* expr ::= FLOAT */
-{yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);}
+ case 171: /* expr ::= FLOAT */
+{yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);}
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
- case 171: /* expr ::= MINUS FLOAT */
- case 172: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==172);
-{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);}
+ case 172: /* expr ::= MINUS FLOAT */
+ case 173: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==173);
+{yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);}
+ yymsp[-1].minor.yy90 = yylhsminor.yy90;
break;
- case 173: /* expr ::= STRING */
-{yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);}
+ case 174: /* expr ::= STRING */
+{yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);}
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
- case 174: /* expr ::= NOW */
-{yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); }
+ case 175: /* expr ::= NOW */
+{yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); }
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
- case 175: /* expr ::= VARIABLE */
-{yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);}
+ case 176: /* expr ::= VARIABLE */
+{yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);}
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
- case 176: /* expr ::= BOOL */
-{yygotominor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);}
+ case 177: /* expr ::= BOOL */
+{yylhsminor.yy90 = tSQLExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);}
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
break;
- case 177: /* expr ::= ID LP exprlist RP */
+ case 178: /* expr ::= ID LP exprlist RP */
{
- yygotominor.yy90 = tSQLExprCreateFunction(yymsp[-1].minor.yy498, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
+ yylhsminor.yy90 = tSQLExprCreateFunction(yymsp[-1].minor.yy498, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
}
+ yymsp[-3].minor.yy90 = yylhsminor.yy90;
break;
- case 178: /* expr ::= ID LP STAR RP */
+ case 179: /* expr ::= ID LP STAR RP */
{
- yygotominor.yy90 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
+ yylhsminor.yy90 = tSQLExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type);
}
+ yymsp[-3].minor.yy90 = yylhsminor.yy90;
break;
- case 179: /* expr ::= expr AND expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_AND);}
+ case 180: /* expr ::= expr AND expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_AND);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 180: /* expr ::= expr OR expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_OR); }
+ case 181: /* expr ::= expr OR expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_OR); }
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 181: /* expr ::= expr LT expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_LT);}
+ case 182: /* expr ::= expr LT expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_LT);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 182: /* expr ::= expr GT expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_GT);}
+ case 183: /* expr ::= expr GT expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_GT);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 183: /* expr ::= expr LE expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_LE);}
+ case 184: /* expr ::= expr LE expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_LE);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 184: /* expr ::= expr GE expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_GE);}
+ case 185: /* expr ::= expr GE expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_GE);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 185: /* expr ::= expr NE expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_NE);}
+ case 186: /* expr ::= expr NE expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_NE);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 186: /* expr ::= expr EQ expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_EQ);}
+ case 187: /* expr ::= expr EQ expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_EQ);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 187: /* expr ::= expr PLUS expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_PLUS); }
+ case 188: /* expr ::= expr PLUS expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_PLUS); }
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 188: /* expr ::= expr MINUS expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_MINUS); }
+ case 189: /* expr ::= expr MINUS expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_MINUS); }
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 189: /* expr ::= expr STAR expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_STAR); }
+ case 190: /* expr ::= expr STAR expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_STAR); }
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 190: /* expr ::= expr SLASH expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_DIVIDE);}
+ case 191: /* expr ::= expr SLASH expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_DIVIDE);}
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 191: /* expr ::= expr REM expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_REM); }
+ case 192: /* expr ::= expr REM expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_REM); }
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 192: /* expr ::= expr LIKE expr */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_LIKE); }
+ case 193: /* expr ::= expr LIKE expr */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-2].minor.yy90, yymsp[0].minor.yy90, TK_LIKE); }
+ yymsp[-2].minor.yy90 = yylhsminor.yy90;
break;
- case 193: /* expr ::= expr IN LP exprlist RP */
-{yygotominor.yy90 = tSQLExprCreate(yymsp[-4].minor.yy90, (tSQLExpr*)yymsp[-1].minor.yy498, TK_IN); }
+ case 194: /* expr ::= expr IN LP exprlist RP */
+{yylhsminor.yy90 = tSQLExprCreate(yymsp[-4].minor.yy90, (tSQLExpr*)yymsp[-1].minor.yy498, TK_IN); }
+ yymsp[-4].minor.yy90 = yylhsminor.yy90;
break;
- case 194: /* exprlist ::= exprlist COMMA expritem */
- case 201: /* itemlist ::= itemlist COMMA expr */ yytestcase(yyruleno==201);
-{yygotominor.yy498 = tSQLExprListAppend(yymsp[-2].minor.yy498,yymsp[0].minor.yy90,0);}
+ case 195: /* exprlist ::= exprlist COMMA expritem */
+ case 202: /* itemlist ::= itemlist COMMA expr */ yytestcase(yyruleno==202);
+{yylhsminor.yy498 = tSQLExprListAppend(yymsp[-2].minor.yy498,yymsp[0].minor.yy90,0);}
+ yymsp[-2].minor.yy498 = yylhsminor.yy498;
break;
- case 195: /* exprlist ::= expritem */
- case 202: /* itemlist ::= expr */ yytestcase(yyruleno==202);
-{yygotominor.yy498 = tSQLExprListAppend(0,yymsp[0].minor.yy90,0);}
+ case 196: /* exprlist ::= expritem */
+ case 203: /* itemlist ::= expr */ yytestcase(yyruleno==203);
+{yylhsminor.yy498 = tSQLExprListAppend(0,yymsp[0].minor.yy90,0);}
+ yymsp[0].minor.yy498 = yylhsminor.yy498;
break;
- case 198: /* cmd ::= INSERT INTO cpxName insert_value_list */
+ case 197: /* expritem ::= expr */
+{yylhsminor.yy90 = yymsp[0].minor.yy90;}
+ yymsp[0].minor.yy90 = yylhsminor.yy90;
+ break;
+ case 199: /* cmd ::= INSERT INTO cpxName insert_value_list */
{
tSetInsertSQLElems(pInfo, &yymsp[-1].minor.yy0, yymsp[0].minor.yy74);
}
break;
- case 199: /* insert_value_list ::= VALUES LP itemlist RP */
-{yygotominor.yy74 = tSQLListListAppend(NULL, yymsp[-1].minor.yy498);}
+ case 200: /* insert_value_list ::= VALUES LP itemlist RP */
+{yymsp[-3].minor.yy74 = tSQLListListAppend(NULL, yymsp[-1].minor.yy498);}
break;
- case 200: /* insert_value_list ::= insert_value_list VALUES LP itemlist RP */
-{yygotominor.yy74 = tSQLListListAppend(yymsp[-4].minor.yy74, yymsp[-1].minor.yy498);}
+ case 201: /* insert_value_list ::= insert_value_list VALUES LP itemlist RP */
+{yylhsminor.yy74 = tSQLListListAppend(yymsp[-4].minor.yy74, yymsp[-1].minor.yy498);}
+ yymsp[-4].minor.yy74 = yylhsminor.yy74;
break;
- case 203: /* cmd ::= RESET QUERY CACHE */
+ case 204: /* cmd ::= RESET QUERY CACHE */
{ setDCLSQLElems(pInfo, RESET_QUERY_CACHE, 0);}
break;
- case 204: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ case 205: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy471, NULL, ALTER_TABLE_ADD_COLUMN);
setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_ADD_COLUMN);
}
break;
- case 205: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ case 206: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -2201,14 +2630,14 @@ static void yy_reduce(
setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_DROP_COLUMN);
}
break;
- case 206: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ case 207: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableSQL* pAlterTable = tAlterTableSQLElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy471, NULL, ALTER_TABLE_TAGS_ADD);
setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_ADD);
}
break;
- case 207: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ case 208: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -2219,7 +2648,7 @@ static void yy_reduce(
setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_DROP);
}
break;
- case 208: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ case 209: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -2233,7 +2662,7 @@ static void yy_reduce(
setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_CHG);
}
break;
- case 209: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ case 210: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
@@ -2245,44 +2674,36 @@ static void yy_reduce(
setSQLInfo(pInfo, pAlterTable, NULL, ALTER_TABLE_TAGS_SET);
}
break;
- case 210: /* cmd ::= KILL CONNECTION IP COLON INTEGER */
+ case 211: /* cmd ::= KILL CONNECTION IPTOKEN COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setDCLSQLElems(pInfo, KILL_CONNECTION, 1, &yymsp[-2].minor.yy0);}
break;
- case 211: /* cmd ::= KILL STREAM IP COLON INTEGER COLON INTEGER */
+ case 212: /* cmd ::= KILL STREAM IPTOKEN COLON INTEGER COLON INTEGER */
{yymsp[-4].minor.yy0.n += (yymsp[-3].minor.yy0.n + yymsp[-2].minor.yy0.n + yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setDCLSQLElems(pInfo, KILL_STREAM, 1, &yymsp[-4].minor.yy0);}
break;
- case 212: /* cmd ::= KILL QUERY IP COLON INTEGER COLON INTEGER */
+ case 213: /* cmd ::= KILL QUERY IPTOKEN COLON INTEGER COLON INTEGER */
{yymsp[-4].minor.yy0.n += (yymsp[-3].minor.yy0.n + yymsp[-2].minor.yy0.n + yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setDCLSQLElems(pInfo, KILL_QUERY, 1, &yymsp[-4].minor.yy0);}
break;
default:
break;
/********** End reduce actions ************************************************/
};
- assert( yyruleno>=0 && yyrulenoyyidx -= yysize;
- yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
- if( yyact <= YY_MAX_SHIFTREDUCE ){
- if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
- /* If the reduce action popped at least
- ** one element off the stack, then we can push the new element back
- ** onto the stack here, and skip the stack overflow test in yy_shift().
- ** That gives a significant speed improvement. */
- if( yysize ){
- yypParser->yyidx++;
- yymsp -= yysize-1;
- yymsp->stateno = (YYACTIONTYPE)yyact;
- yymsp->major = (YYCODETYPE)yygoto;
- yymsp->minor = yygotominor;
- yyTraceShift(yypParser, yyact);
- }else{
- yy_shift(yypParser,yyact,yygoto,&yygotominor);
- }
- }else{
- assert( yyact == YY_ACCEPT_ACTION );
- yy_accept(yypParser);
- }
+ yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
+
+ /* There are no SHIFTREDUCE actions on nonterminals because the table
+ ** generator has simplified them to pure REDUCE actions. */
+ assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
+
+ /* It is not possible for a REDUCE to be followed by an error */
+ assert( yyact!=YY_ERROR_ACTION );
+
+ yymsp += yysize+1;
+ yypParser->yytos = yymsp;
+ yymsp->stateno = (YYACTIONTYPE)yyact;
+ yymsp->major = (YYCODETYPE)yygoto;
+ yyTraceShift(yypParser, yyact, "... then shift");
}
/*
@@ -2298,7 +2719,7 @@ static void yy_parse_failed(
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
}
#endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
+ while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will be executed whenever the
** parser fails */
/************ Begin %parse_failure code ***************************************/
@@ -2313,10 +2734,10 @@ static void yy_parse_failed(
static void yy_syntax_error(
yyParser *yypParser, /* The parser */
int yymajor, /* The major type of the error token */
- YYMINORTYPE yyminor /* The minor type of the error token */
+ ParseTOKENTYPE yyminor /* The minor type of the error token */
){
ParseARG_FETCH;
-#define TOKEN (yyminor.yy0)
+#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
pInfo->validSql = false;
@@ -2356,7 +2777,10 @@ static void yy_accept(
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
}
#endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
+#ifndef YYNOERRORRECOVERY
+ yypParser->yyerrcnt = -1;
+#endif
+ assert( yypParser->yytos==yypParser->yystack );
/* Here code is inserted which will be executed whenever the
** parser accepts */
/*********** Begin %parse_accept code *****************************************/
@@ -2391,7 +2815,7 @@ void Parse(
ParseARG_PDECL /* Optional %extra_argument parameter */
){
YYMINORTYPE yyminorunion;
- int yyact; /* The parser action. */
+ unsigned int yyact; /* The parser action. */
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
int yyendofinput; /* True if we are at the end of input */
#endif
@@ -2400,29 +2824,8 @@ void Parse(
#endif
yyParser *yypParser; /* The parser */
- /* (re)initialize the parser, if necessary */
yypParser = (yyParser*)yyp;
- if( yypParser->yyidx<0 ){
-#if YYSTACKDEPTH<=0
- if( yypParser->yystksz <=0 ){
- /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
- yyminorunion = yyzerominor;
- yyStackOverflow(yypParser, &yyminorunion);
- return;
- }
-#endif
- yypParser->yyidx = 0;
- yypParser->yyerrcnt = -1;
- yypParser->yystack[0].stateno = 0;
- yypParser->yystack[0].major = 0;
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sInitialize. Empty stack. State 0\n",
- yyTracePrompt);
- }
-#endif
- }
- yyminorunion.yy0 = yyminor;
+ assert( yypParser->yytos!=0 );
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
yyendofinput = (yymajor==0);
#endif
@@ -2430,21 +2833,34 @@ void Parse(
#ifndef NDEBUG
if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]);
+ int stateno = yypParser->yytos->stateno;
+ if( stateno < YY_MIN_REDUCE ){
+ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
+ yyTracePrompt,yyTokenName[yymajor],stateno);
+ }else{
+ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
+ yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE);
+ }
}
#endif
do{
yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
- if( yyact <= YY_MAX_SHIFTREDUCE ){
- if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
- yy_shift(yypParser,yyact,yymajor,&yyminorunion);
+ if( yyact >= YY_MIN_REDUCE ){
+ yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor);
+ }else if( yyact <= YY_MAX_SHIFTREDUCE ){
+ yy_shift(yypParser,yyact,yymajor,yyminor);
+#ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt--;
+#endif
yymajor = YYNOCODE;
- }else if( yyact <= YY_MAX_REDUCE ){
- yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
+ }else if( yyact==YY_ACCEPT_ACTION ){
+ yypParser->yytos--;
+ yy_accept(yypParser);
+ return;
}else{
assert( yyact == YY_ERROR_ACTION );
+ yyminorunion.yy0 = yyminor;
#ifdef YYERRORSYMBOL
int yymx;
#endif
@@ -2474,9 +2890,9 @@ void Parse(
**
*/
if( yypParser->yyerrcnt<0 ){
- yy_syntax_error(yypParser,yymajor,yyminorunion);
+ yy_syntax_error(yypParser,yymajor,yyminor);
}
- yymx = yypParser->yystack[yypParser->yyidx].major;
+ yymx = yypParser->yytos->major;
if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
if( yyTraceFILE ){
@@ -2484,26 +2900,26 @@ void Parse(
yyTracePrompt,yyTokenName[yymajor]);
}
#endif
- yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
+ yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
yymajor = YYNOCODE;
}else{
- while(
- yypParser->yyidx >= 0 &&
- yymx != YYERRORSYMBOL &&
- (yyact = yy_find_reduce_action(
- yypParser->yystack[yypParser->yyidx].stateno,
+ while( yypParser->yytos >= yypParser->yystack
+ && yymx != YYERRORSYMBOL
+ && (yyact = yy_find_reduce_action(
+ yypParser->yytos->stateno,
YYERRORSYMBOL)) >= YY_MIN_REDUCE
){
yy_pop_parser_stack(yypParser);
}
- if( yypParser->yyidx < 0 || yymajor==0 ){
+ if( yypParser->yytos < yypParser->yystack || yymajor==0 ){
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
yy_parse_failed(yypParser);
+#ifndef YYNOERRORRECOVERY
+ yypParser->yyerrcnt = -1;
+#endif
yymajor = YYNOCODE;
}else if( yymx!=YYERRORSYMBOL ){
- YYMINORTYPE u2;
- u2.YYERRSYMDT = 0;
- yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
+ yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
}
}
yypParser->yyerrcnt = 3;
@@ -2516,7 +2932,7 @@ void Parse(
** Applications can set this macro (for example inside %include) if
** they intend to abandon the parse upon the first syntax error seen.
*/
- yy_syntax_error(yypParser,yymajor,yyminorunion);
+ yy_syntax_error(yypParser,yymajor, yyminor);
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
yymajor = YYNOCODE;
@@ -2531,24 +2947,29 @@ void Parse(
** three input tokens have been successfully shifted.
*/
if( yypParser->yyerrcnt<=0 ){
- yy_syntax_error(yypParser,yymajor,yyminorunion);
+ yy_syntax_error(yypParser,yymajor, yyminor);
}
yypParser->yyerrcnt = 3;
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
if( yyendofinput ){
yy_parse_failed(yypParser);
+#ifndef YYNOERRORRECOVERY
+ yypParser->yyerrcnt = -1;
+#endif
}
yymajor = YYNOCODE;
#endif
}
- }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
+ }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG
if( yyTraceFILE ){
- int i;
+ yyStackEntry *i;
+ char cDiv = '[';
fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
- for(i=1; i<=yypParser->yyidx; i++)
- fprintf(yyTraceFILE,"%c%s", i==1 ? '[' : ' ',
- yyTokenName[yypParser->yystack[i].major]);
+ for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
+ fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
+ cDiv = ' ';
+ }
fprintf(yyTraceFILE,"]\n");
}
#endif
diff --git a/src/util/src/tglobalcfg.c b/src/util/src/tglobalcfg.c
index ab26eda348..a62523c61d 100644
--- a/src/util/src/tglobalcfg.c
+++ b/src/util/src/tglobalcfg.c
@@ -58,12 +58,12 @@ int64_t tsMsPerDay[] = {86400000L, 86400000000L};
char tsMasterIp[TSDB_IPv4ADDR_LEN] = {0};
char tsSecondIp[TSDB_IPv4ADDR_LEN] = {0};
-short tsMgmtShellPort = 6030; // udp[6030-6034] tcp[6030]
-short tsVnodeShellPort = 6035; // udp[6035-6039] tcp[6035]
-short tsMgmtVnodePort = 6040; // udp[6040-6044] tcp[6040]
-short tsVnodeVnodePort = 6045; // tcp[6045]
-short tsMgmtMgmtPort = 6050; // udp, numOfVnodes fixed to 1, range udp[6050]
-short tsMgmtSyncPort = 6050; // tcp, range tcp[6050]
+uint16_t tsMgmtShellPort = 6030; // udp[6030-6034] tcp[6030]
+uint16_t tsVnodeShellPort = 6035; // udp[6035-6039] tcp[6035]
+uint16_t tsMgmtVnodePort = 6040; // udp[6040-6044] tcp[6040]
+uint16_t tsVnodeVnodePort = 6045; // tcp[6045]
+uint16_t tsMgmtMgmtPort = 6050; // udp, numOfVnodes fixed to 1, range udp[6050]
+uint16_t tsMgmtSyncPort = 6050; // tcp, range tcp[6050]
int tsStatusInterval = 1; // second
int tsShellActivityTimer = 3; // second
@@ -152,8 +152,8 @@ int tsProjectExecInterval = 10000; // every 10sec, the projection will be
int64_t tsMaxRetentWindow = 24 * 3600L; // maximum time window tolerance
char tsHttpIp[TSDB_IPv4ADDR_LEN] = "0.0.0.0";
-short tsHttpPort = 6020; // only tcp, range tcp[6020]
-// short tsNginxPort = 6060; //only tcp, range tcp[6060]
+uint16_t tsHttpPort = 6020; // only tcp, range tcp[6020]
+// uint16_t tsNginxPort = 6060; //only tcp, range tcp[6060]
int tsHttpCacheSessions = 100;
int tsHttpSessionExpire = 36000;
int tsHttpMaxThreads = 2;
@@ -162,6 +162,9 @@ int tsHttpEnableRecordSql = 0;
int tsTelegrafUseFieldNum = 0;
int tsAdminRowLimit = 10240;
+int tsTscEnableRecordSql = 0;
+int tsEnableCoreFile = 0;
+
int tsRpcTimer = 300;
int tsRpcMaxTime = 600; // seconds;
@@ -767,6 +770,14 @@ static void doInitGlobalConfig() {
0, 255, 0,
TSDB_CFG_UTYPE_NONE);
+ tsInitConfigOption(cfg++, "tscEnableRecordSql", &tsTscEnableRecordSql, TSDB_CFG_VTYPE_INT,
+ TSDB_CFG_CTYPE_B_CONFIG,
+ 1, 100000, 0, TSDB_CFG_UTYPE_NONE);
+
+ tsInitConfigOption(cfg++, "enableCoreFile", &tsEnableCoreFile, TSDB_CFG_VTYPE_INT,
+ TSDB_CFG_CTYPE_B_CONFIG,
+ 1, 100000, 0, TSDB_CFG_UTYPE_NONE);
+
// version info
tsInitConfigOption(cfg++, "gitinfo", gitinfo, TSDB_CFG_VTYPE_STRING,
TSDB_CFG_CTYPE_B_SHOW | TSDB_CFG_CTYPE_B_CLIENT,
@@ -779,6 +790,7 @@ static void doInitGlobalConfig() {
0, 0, 0, TSDB_CFG_UTYPE_NONE);
tsGlobalConfigNum = (int)(cfg - tsGlobalConfig);
+ assert(tsGlobalConfigNum <= TSDB_CFG_MAX_NUM);
}
static pthread_once_t initGlobalConfig = PTHREAD_ONCE_INIT;
@@ -1156,4 +1168,4 @@ void tsPrintGlobalConfigSpec() {
pPrint(" dataDir: %s", dataDir);
}
-#endif
\ No newline at end of file
+#endif
diff --git a/src/util/src/tnote.c b/src/util/src/tnote.c
index 68228d377a..d12cc6e613 100644
--- a/src/util/src/tnote.c
+++ b/src/util/src/tnote.c
@@ -13,58 +13,50 @@
* along with this program. If not, see .
*/
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include "tnote.h"
-#include "os.h"
-#include "tutil.h"
-#include "tglobalcfg.h"
+taosNoteInfo m_HttpNote;
+taosNoteInfo m_TscNote;
-#define MAX_NOTE_LINE_SIZE 66000
-#define NOTE_FILE_NAME_LEN 300
+int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInfo * pNote);
-static int taosNoteFileNum = 1;
-static int taosNoteMaxLines = 0;
-static int taosNoteLines = 0;
-static char taosNoteName[NOTE_FILE_NAME_LEN];
-static int taosNoteFlag = 0;
-static int taosNoteFd = -1;
-static int taosNoteOpenInProgress = 0;
-static pthread_mutex_t taosNoteMutex;
-void taosNotePrint(const char * const format, ...);
-int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum);
-
-void taosInitNote(int numOfNoteLines, int maxNotes)
+void taosInitNote(int numOfNoteLines, int maxNotes, char* lable)
{
+ taosNoteInfo * pNote = NULL;
char temp[128] = { 0 };
- sprintf(temp, "%s/taosnote", logDir);
- if (taosOpenNoteWithMaxLines(temp, numOfNoteLines, maxNotes) < 0)
+
+ if (strcasecmp(lable, "http_note") == 0) {
+ pNote = &m_HttpNote;
+ sprintf(temp, "%s/httpnote", logDir);
+ } else if (strcasecmp(lable, "tsc_note") == 0) {
+ pNote = &m_TscNote;
+ sprintf(temp, "%s/tscnote-%d", logDir, getpid());
+ } else {
+ return;
+ }
+
+ memset(pNote, 0, sizeof(taosNoteInfo));
+ pNote->taosNoteFileNum = 1;
+ //pNote->taosNoteMaxLines = 0;
+ //pNote->taosNoteLines = 0;
+ //pNote->taosNoteFlag = 0;
+ pNote->taosNoteFd = -1;
+ //pNote->taosNoteOpenInProgress = 0;
+
+ if (taosOpenNoteWithMaxLines(temp, numOfNoteLines, maxNotes, pNote) < 0)
fprintf(stderr, "failed to init note file\n");
- taosNotePrint("==================================================");
- taosNotePrint("=================== new note ===================");
- taosNotePrint("==================================================");
+ taosNotePrint(pNote, "==================================================");
+ taosNotePrint(pNote, "=================== new note ===================");
+ taosNotePrint(pNote, "==================================================");
}
-void taosCloseNoteByFd(int oldFd);
-bool taosLockNote(int fd)
+void taosCloseNoteByFd(int oldFd, taosNoteInfo * pNote);
+bool taosLockNote(int fd, taosNoteInfo * pNote)
{
if (fd < 0) return false;
- if (taosNoteFileNum > 1) {
+ if (pNote->taosNoteFileNum > 1) {
int ret = (int)(flock(fd, LOCK_EX | LOCK_NB));
if (ret == 0) {
return true;
@@ -74,11 +66,11 @@ bool taosLockNote(int fd)
return false;
}
-void taosUnLockNote(int fd)
+void taosUnLockNote(int fd, taosNoteInfo * pNote)
{
if (fd < 0) return;
- if (taosNoteFileNum > 1) {
+ if (pNote->taosNoteFileNum > 1) {
flock(fd, LOCK_UN | LOCK_NB);
}
}
@@ -86,50 +78,51 @@ void taosUnLockNote(int fd)
void *taosThreadToOpenNewNote(void *param)
{
char name[NOTE_FILE_NAME_LEN];
+ taosNoteInfo * pNote = (taosNoteInfo *)param;
- taosNoteFlag ^= 1;
- taosNoteLines = 0;
- sprintf(name, "%s.%d", taosNoteName, taosNoteFlag);
+ pNote->taosNoteFlag ^= 1;
+ pNote->taosNoteLines = 0;
+ sprintf(name, "%s.%d", pNote->taosNoteName, pNote->taosNoteFlag);
umask(0);
int fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
- taosLockNote(fd);
+ taosLockNote(fd, pNote);
lseek(fd, 0, SEEK_SET);
- int oldFd = taosNoteFd;
- taosNoteFd = fd;
- taosNoteLines = 0;
- taosNoteOpenInProgress = 0;
- taosNotePrint("=============== new note is opened =============");
+ int oldFd = pNote->taosNoteFd;
+ pNote->taosNoteFd = fd;
+ pNote->taosNoteLines = 0;
+ pNote->taosNoteOpenInProgress = 0;
+ taosNotePrint(pNote, "=============== new note is opened =============");
- taosCloseNoteByFd(oldFd);
+ taosCloseNoteByFd(oldFd, pNote);
return NULL;
}
-int taosOpenNewNote()
+int taosOpenNewNote(taosNoteInfo * pNote)
{
- pthread_mutex_lock(&taosNoteMutex);
+ pthread_mutex_lock(&pNote->taosNoteMutex);
- if (taosNoteLines > taosNoteMaxLines && taosNoteOpenInProgress == 0) {
- taosNoteOpenInProgress = 1;
+ if (pNote->taosNoteLines > pNote->taosNoteMaxLines && pNote->taosNoteOpenInProgress == 0) {
+ pNote->taosNoteOpenInProgress = 1;
- taosNotePrint("=============== open new note ==================");
+ taosNotePrint(pNote, "=============== open new note ==================");
pthread_t pattern;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_create(&pattern, &attr, taosThreadToOpenNewNote, NULL);
+ pthread_create(&pattern, &attr, taosThreadToOpenNewNote, (void*)pNote);
pthread_attr_destroy(&attr);
}
- pthread_mutex_unlock(&taosNoteMutex);
+ pthread_mutex_unlock(&pNote->taosNoteMutex);
- return taosNoteFd;
+ return pNote->taosNoteFd;
}
-bool taosCheckNoteIsOpen(char *noteName)
+bool taosCheckNoteIsOpen(char *noteName, taosNoteInfo * pNote)
{
int exist = access(noteName, F_OK);
if (exist != 0) {
@@ -142,8 +135,8 @@ bool taosCheckNoteIsOpen(char *noteName)
return true;
}
- if (taosLockNote(fd)) {
- taosUnLockNote(fd);
+ if (taosLockNote(fd, pNote)) {
+ taosUnLockNote(fd, pNote);
close(fd);
return false;
}
@@ -153,80 +146,80 @@ bool taosCheckNoteIsOpen(char *noteName)
}
}
-void taosGetNoteName(char *fn)
+void taosGetNoteName(char *fn, taosNoteInfo * pNote)
{
- if (taosNoteFileNum > 1) {
- for (int i = 0; i < taosNoteFileNum; i++) {
+ if (pNote->taosNoteFileNum > 1) {
+ for (int i = 0; i < pNote->taosNoteFileNum; i++) {
char fileName[NOTE_FILE_NAME_LEN];
sprintf(fileName, "%s%d.0", fn, i);
- bool file1open = taosCheckNoteIsOpen(fileName);
+ bool file1open = taosCheckNoteIsOpen(fileName, pNote);
sprintf(fileName, "%s%d.1", fn, i);
- bool file2open = taosCheckNoteIsOpen(fileName);
+ bool file2open = taosCheckNoteIsOpen(fileName, pNote);
if (!file1open && !file2open) {
- sprintf(taosNoteName, "%s%d", fn, i);
+ sprintf(pNote->taosNoteName, "%s%d", fn, i);
return;
}
}
}
- strcpy(taosNoteName, fn);
+ strcpy(pNote->taosNoteName, fn);
}
-int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum)
+int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInfo * pNote)
{
char name[NOTE_FILE_NAME_LEN] = "\0";
struct stat notestat0, notestat1;
int size;
- taosNoteMaxLines = maxLines;
- taosNoteFileNum = maxNoteNum;
- taosGetNoteName(fn);
+ pNote->taosNoteMaxLines = maxLines;
+ pNote->taosNoteFileNum = maxNoteNum;
+ taosGetNoteName(fn, pNote);
strcpy(name, fn);
strcat(name, ".0");
// if none of the note files exist, open 0, if both exists, open the old one
if (stat(name, ¬estat0) < 0) {
- taosNoteFlag = 0;
+ pNote->taosNoteFlag = 0;
}
else {
strcpy(name, fn);
strcat(name, ".1");
if (stat(name, ¬estat1) < 0) {
- taosNoteFlag = 1;
+ pNote->taosNoteFlag = 1;
}
else {
- taosNoteFlag = (notestat0.st_mtime > notestat1.st_mtime) ? 0 : 1;
+ pNote->taosNoteFlag = (notestat0.st_mtime > notestat1.st_mtime) ? 0 : 1;
}
}
- sprintf(name, "%s.%d", taosNoteName, taosNoteFlag);
- pthread_mutex_init(&taosNoteMutex, NULL);
+ sprintf(name, "%s.%d", pNote->taosNoteName, pNote->taosNoteFlag);
+ pthread_mutex_init(&pNote->taosNoteMutex, NULL);
umask(0);
- taosNoteFd = open(name, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
+ pNote->taosNoteFd = open(name, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
- if (taosNoteFd < 0) {
+ if (pNote->taosNoteFd < 0) {
fprintf(stderr, "failed to open note file:%s reason:%s\n", name, strerror(errno));
return -1;
}
- taosLockNote(taosNoteFd);
+ taosLockNote(pNote->taosNoteFd, pNote);
// only an estimate for number of lines
struct stat filestat;
- fstat(taosNoteFd, &filestat);
+ fstat(pNote->taosNoteFd, &filestat);
size = (int)filestat.st_size;
- taosNoteLines = size / 60;
+ pNote->taosNoteLines = size / 60;
- lseek(taosNoteFd, 0, SEEK_END);
+ lseek(pNote->taosNoteFd, 0, SEEK_END);
return 0;
}
-void taosNotePrint(const char * const format, ...)
+void taosNotePrint(taosNoteInfo * pNote, const char * const format, ...)
{
va_list argpointer;
char buffer[MAX_NOTE_LINE_SIZE];
@@ -238,7 +231,7 @@ void taosNotePrint(const char * const format, ...)
gettimeofday(&timeSecs, NULL);
curTime = timeSecs.tv_sec;
ptm = localtime_r(&curTime, &Tm);
- len = sprintf(buffer, "%02d/%02d %02d:%02d:%02d.%06d ", ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)timeSecs.tv_usec);
+ len = sprintf(buffer, "%02d/%02d %02d:%02d:%02d.%06d %lx ", ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int)timeSecs.tv_usec, pthread_self());
va_start(argpointer, format);
len += vsnprintf(buffer + len, MAX_NOTE_LINE_SIZE - len, format, argpointer);
@@ -249,26 +242,26 @@ void taosNotePrint(const char * const format, ...)
buffer[len++] = '\n';
buffer[len] = 0;
- if (taosNoteFd >= 0) {
- twrite(taosNoteFd, buffer, (unsigned int)len);
+ if (pNote->taosNoteFd >= 0) {
+ twrite(pNote->taosNoteFd, buffer, (unsigned int)len);
- if (taosNoteMaxLines > 0) {
- taosNoteLines++;
- if ((taosNoteLines > taosNoteMaxLines) && (taosNoteOpenInProgress == 0))
- taosOpenNewNote();
+ if (pNote->taosNoteMaxLines > 0) {
+ pNote->taosNoteLines++;
+ if ((pNote->taosNoteLines > pNote->taosNoteMaxLines) && (pNote->taosNoteOpenInProgress == 0))
+ taosOpenNewNote(pNote);
}
}
}
-void taosCloseNote()
+void taosCloseNote(taosNoteInfo * pNote)
{
- taosCloseNoteByFd(taosNoteFd);
+ taosCloseNoteByFd(pNote->taosNoteFd, pNote);
}
-void taosCloseNoteByFd(int fd)
+void taosCloseNoteByFd(int fd, taosNoteInfo * pNote)
{
if (fd >= 0) {
- taosUnLockNote(fd);
+ taosUnLockNote(fd, pNote);
close(fd);
}
}
diff --git a/src/util/src/tsocket.c b/src/util/src/tsocket.c
index 9a2dafe377..6e8379c0a4 100644
--- a/src/util/src/tsocket.c
+++ b/src/util/src/tsocket.c
@@ -261,19 +261,19 @@ int taosReadn(int fd, char *ptr, int nbytes) {
return (nbytes - nleft);
}
-int taosOpenUdpSocket(char *ip, short port) {
+int taosOpenUdpSocket(char *ip, uint16_t port) {
struct sockaddr_in localAddr;
int sockFd;
int ttl = 128;
int reuse, nocheck;
int bufSize = 8192000;
- pTrace("open udp socket:%s:%d", ip, port);
+ pTrace("open udp socket:%s:%hu", ip, port);
memset((char *)&localAddr, 0, sizeof(localAddr));
localAddr.sin_family = AF_INET;
localAddr.sin_addr.s_addr = inet_addr(ip);
- localAddr.sin_port = (uint16_t)htons((uint16_t)port);
+ localAddr.sin_port = (uint16_t)htons(port);
if ((sockFd = (int)socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
pError("failed to open udp socket: %d (%s)", errno, strerror(errno));
@@ -319,7 +319,7 @@ int taosOpenUdpSocket(char *ip, short port) {
/* bind socket to local address */
if (bind(sockFd, (struct sockaddr *)&localAddr, sizeof(localAddr)) < 0) {
- pError("failed to bind udp socket: %d (%s), %s:%d", errno, strerror(errno), ip, port);
+ pError("failed to bind udp socket: %d (%s), %s:%hu", errno, strerror(errno), ip, port);
taosCloseSocket(sockFd);
return -1;
}
@@ -327,7 +327,7 @@ int taosOpenUdpSocket(char *ip, short port) {
return sockFd;
}
-int taosOpenTcpClientSocket(char *destIp, short destPort, char *clientIp) {
+int taosOpenTcpClientSocket(char *destIp, uint16_t destPort, char *clientIp) {
int sockFd = 0;
struct sockaddr_in serverAddr, clientAddr;
int ret;
@@ -364,7 +364,7 @@ int taosOpenTcpClientSocket(char *destIp, short destPort, char *clientIp) {
ret = connect(sockFd, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
if (ret != 0) {
- pError("failed to connect socket, ip:%s, port:%d, reason: %s", destIp, destPort, strerror(errno));
+ pError("failed to connect socket, ip:%s, port:%hu, reason: %s", destIp, destPort, strerror(errno));
taosCloseSocket(sockFd);
sockFd = -1;
}
@@ -422,17 +422,17 @@ int taosKeepTcpAlive(int sockFd) {
return 0;
}
-int taosOpenTcpServerSocket(char *ip, short port) {
+int taosOpenTcpServerSocket(char *ip, uint16_t port) {
struct sockaddr_in serverAdd;
int sockFd;
int reuse;
- pTrace("open tcp server socket:%s:%d", ip, port);
+ pTrace("open tcp server socket:%s:%hu", ip, port);
bzero((char *)&serverAdd, sizeof(serverAdd));
serverAdd.sin_family = AF_INET;
serverAdd.sin_addr.s_addr = inet_addr(ip);
- serverAdd.sin_port = (uint16_t)htons((uint16_t)port);
+ serverAdd.sin_port = (uint16_t)htons(port);
if ((sockFd = (int)socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
pError("failed to open TCP socket: %d (%s)", errno, strerror(errno));
@@ -449,7 +449,7 @@ int taosOpenTcpServerSocket(char *ip, short port) {
/* bind socket to server address */
if (bind(sockFd, (struct sockaddr *)&serverAdd, sizeof(serverAdd)) < 0) {
- pError("bind tcp server socket failed, %s:%d, reason:%d(%s)", ip, port, errno, strerror(errno));
+ pError("bind tcp server socket failed, %s:%hu, reason:%d(%s)", ip, port, errno, strerror(errno));
close(sockFd);
return -1;
}
@@ -457,7 +457,7 @@ int taosOpenTcpServerSocket(char *ip, short port) {
if (taosKeepTcpAlive(sockFd) < 0) return -1;
if (listen(sockFd, 10) < 0) {
- pError("listen tcp server socket failed, %s:%d, reason:%d(%s)", ip, port, errno, strerror(errno));
+ pError("listen tcp server socket failed, %s:%hu, reason:%d(%s)", ip, port, errno, strerror(errno));
return -1;
}
diff --git a/src/util/src/ttimer.c b/src/util/src/ttimer.c
index a1a356b13b..e278f5b9f8 100644
--- a/src/util/src/ttimer.c
+++ b/src/util/src/ttimer.c
@@ -14,6 +14,7 @@
*/
#include "os.h"
+#include
#include "tlog.h"
#include "tsched.h"
#include "ttime.h"
@@ -253,13 +254,13 @@ static void processExpiredTimer(void* handle, void* arg) {
timer->executedBy = taosGetPthreadId();
uint8_t state = atomic_val_compare_exchange_8(&timer->state, TIMER_STATE_WAITING, TIMER_STATE_EXPIRED);
if (state == TIMER_STATE_WAITING) {
- const char* fmt = "%s timer[id=%lld, fp=%p, param=%p] execution start.";
+ const char* fmt = "%s timer[id=" PRIuPTR ", fp=%p, param=%p] execution start.";
tmrTrace(fmt, timer->ctrl->label, timer->id, timer->fp, timer->param);
(*timer->fp)(timer->param, (tmr_h)timer->id);
atomic_store_8(&timer->state, TIMER_STATE_STOPPED);
- fmt = "%s timer[id=%lld, fp=%p, param=%p] execution end.";
+ fmt = "%s timer[id=" PRIuPTR ", fp=%p, param=%p] execution end.";
tmrTrace(fmt, timer->ctrl->label, timer->id, timer->fp, timer->param);
}
removeTimer(timer->id);
@@ -267,7 +268,7 @@ static void processExpiredTimer(void* handle, void* arg) {
}
static void addToExpired(tmr_obj_t* head) {
- const char* fmt = "%s adding expired timer[id=%lld, fp=%p, param=%p] to queue.";
+ const char* fmt = "%s adding expired timer[id=" PRIuPTR ", fp=%p, param=%p] to queue.";
while (head != NULL) {
uintptr_t id = head->id;
@@ -281,7 +282,7 @@ static void addToExpired(tmr_obj_t* head) {
schedMsg.thandle = NULL;
taosScheduleTask(tmrQhandle, &schedMsg);
- tmrTrace("timer[id=%lld] has been added to queue.", id);
+ tmrTrace("timer[id=" PRIuPTR "] has been added to queue.", id);
head = next;
}
}
@@ -295,7 +296,7 @@ static uintptr_t doStartTimer(tmr_obj_t* timer, TAOS_TMR_CALLBACK fp, int msecon
timer->ctrl = ctrl;
addTimer(timer);
- const char* fmt = "%s timer[id=%lld, fp=%p, param=%p] started";
+ const char* fmt = "%s timer[id=" PRIuPTR ", fp=%p, param=%p] started";
tmrTrace(fmt, ctrl->label, timer->id, timer->fp, timer->param);
if (mseconds == 0) {
@@ -380,40 +381,37 @@ static void taosTimerLoopFunc(int signo) {
}
static bool doStopTimer(tmr_obj_t* timer, uint8_t state) {
- bool reusable = false;
-
if (state == TIMER_STATE_WAITING) {
+ bool reusable = false;
if (removeFromWheel(timer)) {
removeTimer(timer->id);
// only safe to reuse the timer when timer is removed from the wheel.
// we cannot guarantee the thread safety of the timr in all other cases.
reusable = true;
}
- const char* fmt = "%s timer[id=%lld, fp=%p, param=%p] is cancelled.";
+ const char* fmt = "%s timer[id=" PRIuPTR ", fp=%p, param=%p] is cancelled.";
tmrTrace(fmt, timer->ctrl->label, timer->id, timer->fp, timer->param);
- } else if (state != TIMER_STATE_EXPIRED) {
+ return reusable;
+ }
+
+ if (state != TIMER_STATE_EXPIRED) {
// timer already stopped or cancelled, has nothing to do in this case
- } else if (timer->executedBy == taosGetPthreadId()) {
+ return false;
+ }
+
+ if (timer->executedBy == taosGetPthreadId()) {
// taosTmrReset is called in the timer callback, should do nothing in this
// case to avoid dead lock. note taosTmrReset must be the last statement
// of the callback funtion, will be a bug otherwise.
- } else {
- assert(timer->executedBy != taosGetPthreadId());
-
- const char* fmt = "%s timer[id=%lld, fp=%p, param=%p] fired, waiting...";
- tmrTrace(fmt, timer->ctrl->label, timer->id, timer->fp, timer->param);
-
- for (int i = 1; atomic_load_8(&timer->state) != TIMER_STATE_STOPPED; i++) {
- if (i % 1000 == 0) {
- sched_yield();
- }
- }
-
- fmt = "%s timer[id=%lld, fp=%p, param=%p] stopped.";
- tmrTrace(fmt, timer->ctrl->label, timer->id, timer->fp, timer->param);
+ return false;
}
-
- return reusable;
+
+ // timer callback is executing in another thread, we SHOULD wait it to stop,
+ // BUT this may result in dead lock if current thread are holding a lock which
+ // the timer callback need to acquire. so, we HAVE TO return directly.
+ const char* fmt = "%s timer[id=" PRIuPTR ", fp=%p, param=%p] is executing and cannot be stopped.";
+ tmrTrace(fmt, timer->ctrl->label, timer->id, timer->fp, timer->param);
+ return false;
}
bool taosTmrStop(tmr_h timerId) {
@@ -421,7 +419,7 @@ bool taosTmrStop(tmr_h timerId) {
tmr_obj_t* timer = findTimer(id);
if (timer == NULL) {
- tmrTrace("timer[id=%lld] does not exist", id);
+ tmrTrace("timer[id=" PRIuPTR "] does not exist", id);
return false;
}
@@ -448,7 +446,7 @@ bool taosTmrReset(TAOS_TMR_CALLBACK fp, int mseconds, void* param, void* handle,
bool stopped = false;
tmr_obj_t* timer = findTimer(id);
if (timer == NULL) {
- tmrTrace("%s timer[id=%lld] does not exist", ctrl->label, id);
+ tmrTrace("%s timer[id=" PRIuPTR "] does not exist", ctrl->label, id);
} else {
uint8_t state = atomic_val_compare_exchange_8(&timer->state, TIMER_STATE_WAITING, TIMER_STATE_CANCELED);
if (!doStopTimer(timer, state)) {
@@ -463,7 +461,7 @@ bool taosTmrReset(TAOS_TMR_CALLBACK fp, int mseconds, void* param, void* handle,
return stopped;
}
- tmrTrace("%s timer[id=%lld] is reused", ctrl->label, timer->id);
+ tmrTrace("%s timer[id=" PRIuPTR "] is reused", ctrl->label, timer->id);
// wait until there's no other reference to this timer,
// so that we can reuse this timer safely.
diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c
index 99f0f5bb91..85da925297 100644
--- a/src/util/src/ttokenizer.c
+++ b/src/util/src/ttokenizer.c
@@ -96,7 +96,6 @@ static SKeyword keywordTable[] = {
{"TABLE", TK_TABLE},
{"DATABASE", TK_DATABASE},
{"DNODE", TK_DNODE},
- {"IP", TK_IP},
{"USER", TK_USER},
{"ACCOUNT", TK_ACCOUNT},
{"USE", TK_USE},
@@ -523,7 +522,7 @@ uint32_t tSQLGetToken(char* z, uint32_t* tokenType) {
}
if (seg == 4) { // ip address
- *tokenType = TK_IP;
+ *tokenType = TK_IPTOKEN;
return i;
}