Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c4b6a99c
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c4b6a99c
编写于
1月 08, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into fix/long_query
上级
d7ec7ed9
a3b5fca0
变更
37
显示空白变更内容
内联
并排
Showing
37 changed file
with
350 addition
and
469 deletion
+350
-469
include/util/taoserror.h
include/util/taoserror.h
+2
-0
packaging/release.sh
packaging/release.sh
+0
-319
packaging/tools/post.sh
packaging/tools/post.sh
+26
-0
source/client/inc/clientSml.h
source/client/inc/clientSml.h
+1
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+6
-2
source/client/src/clientHb.c
source/client/src/clientHb.c
+20
-6
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+67
-21
source/client/src/clientJniConnector.c
source/client/src/clientJniConnector.c
+5
-1
source/client/src/clientMain.c
source/client/src/clientMain.c
+31
-11
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+7
-3
source/client/src/clientRawBlockWrite.c
source/client/src/clientRawBlockWrite.c
+17
-4
source/client/src/clientSml.c
source/client/src/clientSml.c
+14
-6
source/client/src/clientSmlJson.c
source/client/src/clientSmlJson.c
+9
-2
source/client/src/clientSmlLine.c
source/client/src/clientSmlLine.c
+8
-2
source/client/src/clientSmlTelnet.c
source/client/src/clientSmlTelnet.c
+5
-1
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+4
-2
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+4
-1
source/dnode/mgmt/node_mgmt/src/dmNodes.c
source/dnode/mgmt/node_mgmt/src/dmNodes.c
+3
-3
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+3
-0
source/dnode/vnode/src/sma/smaOpen.c
source/dnode/vnode/src/sma/smaOpen.c
+0
-4
source/dnode/vnode/src/sma/smaSnapshot.c
source/dnode/vnode/src/sma/smaSnapshot.c
+2
-2
source/libs/function/inc/tpercentile.h
source/libs/function/inc/tpercentile.h
+2
-2
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+5
-6
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+29
-28
source/os/src/osFile.c
source/os/src/osFile.c
+9
-0
source/os/src/osLocale.c
source/os/src/osLocale.c
+1
-1
source/os/src/osString.c
source/os/src/osString.c
+3
-3
source/util/src/terror.c
source/util/src/terror.c
+2
-0
tools/shell/CMakeLists.txt
tools/shell/CMakeLists.txt
+4
-0
tools/shell/inc/shellAuto.h
tools/shell/inc/shellAuto.h
+2
-2
tools/shell/inc/shellInt.h
tools/shell/inc/shellInt.h
+3
-2
tools/shell/inc/shellTire.h
tools/shell/inc/shellTire.h
+1
-1
tools/shell/src/shellArguments.c
tools/shell/src/shellArguments.c
+25
-10
tools/shell/src/shellAuto.c
tools/shell/src/shellAuto.c
+21
-16
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+3
-2
tools/shell/src/shellUtil.c
tools/shell/src/shellUtil.c
+5
-5
tools/shell/src/shellWebsocket.c
tools/shell/src/shellWebsocket.c
+1
-1
未找到文件。
include/util/taoserror.h
浏览文件 @
c4b6a99c
...
...
@@ -159,6 +159,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TSC_NO_EXEC_NODE TAOS_DEF_ERROR_CODE(0, 0X022E)
#define TSDB_CODE_TSC_NOT_STABLE_ERROR TAOS_DEF_ERROR_CODE(0, 0X022F)
#define TSDB_CODE_TSC_STMT_CACHE_ERROR TAOS_DEF_ERROR_CODE(0, 0X0230)
#define TSDB_CODE_TSC_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0X0231)
// mnode-common
// #define TSDB_CODE_MND_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0300) // 2.x
...
...
@@ -700,6 +701,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SML_INVALID_DATA TAOS_DEF_ERROR_CODE(0, 0x3002)
#define TSDB_CODE_SML_INVALID_DB_CONF TAOS_DEF_ERROR_CODE(0, 0x3003)
#define TSDB_CODE_SML_NOT_SAME_TYPE TAOS_DEF_ERROR_CODE(0, 0x3004)
#define TSDB_CODE_SML_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x3005)
//tsma
#define TSDB_CODE_TSMA_INIT_FAILED TAOS_DEF_ERROR_CODE(0, 0x3100)
...
...
packaging/release.sh
已删除
100755 → 0
浏览文件 @
d7ec7ed9
#!/bin/bash
#
# Generate the deb package for ubuntu, or rpm package for centos, or tar.gz package for other linux os
set
-e
# set -x
# release.sh -v [cluster | edge]
# -c [aarch32 | aarch64 | x64 | x86 | mips64 | loongarch64...]
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
# -V [stable | beta]
# -l [full | lite]
# -s [static | dynamic]
# -d [taos | ...]
# -n [2.0.0.3]
# -m [2.0.0.0]
# -H [ false | true]
# set parameters by default value
verMode
=
edge
# [cluster, edge, cloud]
verType
=
stable
# [stable, beta]
cpuType
=
x64
# [aarch32 | aarch64 | x64 | x86 | mips64 loongarch64...]
osType
=
Linux
# [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...]
pagMode
=
full
# [full | lite]
soMode
=
dynamic
# [static | dynamic]
dbName
=
taos
# [taos | ...]
allocator
=
glibc
# [glibc | jemalloc]
verNumber
=
""
verNumberComp
=
"3.0.0.0"
httpdBuild
=
false
while
getopts
"hv:V:c:o:l:s:d:a:n:m:H:"
arg
;
do
case
$arg
in
v
)
#echo "verMode=$OPTARG"
verMode
=
$(
echo
$OPTARG
)
;;
V
)
#echo "verType=$OPTARG"
verType
=
$(
echo
$OPTARG
)
;;
c
)
#echo "cpuType=$OPTARG"
cpuType
=
$(
echo
$OPTARG
)
;;
l
)
#echo "pagMode=$OPTARG"
pagMode
=
$(
echo
$OPTARG
)
;;
s
)
#echo "soMode=$OPTARG"
soMode
=
$(
echo
$OPTARG
)
;;
d
)
#echo "dbName=$OPTARG"
dbName
=
$(
echo
$OPTARG
)
;;
a
)
#echo "allocator=$OPTARG"
allocator
=
$(
echo
$OPTARG
)
;;
n
)
#echo "verNumber=$OPTARG"
verNumber
=
$(
echo
$OPTARG
)
;;
m
)
#echo "verNumberComp=$OPTARG"
verNumberComp
=
$(
echo
$OPTARG
)
;;
o
)
#echo "osType=$OPTARG"
osType
=
$(
echo
$OPTARG
)
;;
H
)
#echo "httpdBuild=$OPTARG"
httpdBuild
=
$(
echo
$OPTARG
)
;;
h
)
echo
"Usage:
$(
basename
$0
)
-v [cluster | edge] "
echo
" -c [aarch32 | aarch64 | x64 | x86 | mips64 | loongarch64 ...] "
echo
" -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | Ningsi60 | Ningsi80 |...] "
echo
" -V [stable | beta] "
echo
" -l [full | lite] "
echo
" -a [glibc | jemalloc] "
echo
" -s [static | dynamic] "
echo
" -d [taos | ...] "
echo
" -n [version number] "
echo
" -m [compatible version number] "
echo
" -H [false | true] "
exit
0
;;
?
)
#unknow option
echo
"unkonw argument"
exit
1
;;
esac
done
osType
=
$(
uname
)
echo
"verMode=
${
verMode
}
verType=
${
verType
}
cpuType=
${
cpuType
}
osType=
${
osType
}
pagMode=
${
pagMode
}
soMode=
${
soMode
}
dbName=
${
dbName
}
allocator=
${
allocator
}
verNumber=
${
verNumber
}
verNumberComp=
${
verNumberComp
}
httpdBuild=
${
httpdBuild
}
"
curr_dir
=
$(
pwd
)
if
[
"
$osType
"
==
"Darwin"
]
;
then
script_dir
=
$(
dirname
$0
)
cd
${
script_dir
}
script_dir
=
"
$(
pwd
)
"
top_dir
=
${
script_dir
}
/..
else
script_dir
=
"
$(
dirname
$(
readlink
-f
$0
))
"
top_dir
=
"
$(
readlink
-f
${
script_dir
}
/..
)
"
fi
csudo
=
""
#if command -v sudo > /dev/null; then
# csudo="sudo "
#fi
function
is_valid_version
()
{
[
-z
$1
]
&&
return
1
||
:
rx
=
'^([0-9]+\.){3}(\*|[0-9]+)$'
if
[[
$1
=
~
$rx
]]
;
then
return
0
fi
return
1
}
function
vercomp
()
{
if
[[
$1
==
$2
]]
;
then
echo
0
exit
0
fi
local
IFS
=
.
local
i
ver1
=(
$1
)
ver2
=(
$2
)
# fill empty fields in ver1 with zeros
for
((
i
=
${#
ver1
[@]
}
;
i <
${#
ver2
[@]
}
;
i++
))
;
do
ver1[i]
=
0
done
for
((
i
=
0
;
i <
${#
ver1
[@]
}
;
i++
))
;
do
if
[[
-z
${
ver2
[i]
}
]]
;
then
# fill empty fields in ver2 with zeros
ver2[i]
=
0
fi
if
((
10#
${
ver1
[i]
}
>
10#
${
ver2
[i]
}
))
;
then
echo
1
exit
0
fi
if
((
10#
${
ver1
[i]
}
< 10#
${
ver2
[i]
}
))
;
then
echo
2
exit
0
fi
done
echo
0
}
# 1. check version information
if
(
(!
is_valid_version
$verNumber
)
||
(!
is_valid_version
$verNumberComp
)
||
[[
"
$(
vercomp
$verNumber
$verNumberComp
)
"
==
'2'
]])
;
then
echo
"please enter correct version"
exit
0
fi
echo
"=======================new version number:
${
verNumber
}
, compatible version:
${
verNumberComp
}
======================================"
build_time
=
$(
date
+
"%F %R"
)
# get commint id from git
gitinfo
=
$(
git rev-parse
--verify
HEAD
)
if
[[
"
$verMode
"
==
"cluster"
]]
||
[[
"
$verMode
"
==
"cloud"
]]
;
then
enterprise_dir
=
"
${
top_dir
}
/../enterprise"
cd
${
enterprise_dir
}
gitinfoOfInternal
=
$(
git rev-parse
--verify
HEAD
)
else
gitinfoOfInternal
=
NULL
fi
cd
"
${
curr_dir
}
"
# 2. cmake executable file
compile_dir
=
"
${
top_dir
}
/debug"
if
[
-d
${
compile_dir
}
]
;
then
rm
-rf
${
compile_dir
}
fi
mkdir
-p
${
compile_dir
}
cd
${
compile_dir
}
if
[[
"
$allocator
"
==
"jemalloc"
]]
;
then
allocator_macro
=
"-DJEMALLOC_ENABLED=true"
else
allocator_macro
=
""
fi
if
[[
"
$dbName
"
!=
"taos"
]]
;
then
source
${
enterprise_dir
}
/packaging/oem/sed_
$dbName
.sh
replace_community_
$dbName
fi
if
[[
"
$httpdBuild
"
==
"true"
]]
;
then
BUILD_HTTP
=
true
else
BUILD_HTTP
=
false
fi
if
[[
"
$verMode
"
==
"cluster"
]]
||
[[
"
$verMode
"
==
"cloud"
]]
;
then
BUILD_HTTP
=
internal
fi
if
[[
"
$pagMode
"
==
"full"
]]
;
then
BUILD_TOOLS
=
true
else
BUILD_TOOLS
=
false
fi
# check support cpu type
if
[[
"
$cpuType
"
==
"x64"
]]
||
[[
"
$cpuType
"
==
"aarch64"
]]
||
[[
"
$cpuType
"
==
"aarch32"
]]
||
[[
"
$cpuType
"
==
"arm64"
]]
||
[[
"
$cpuType
"
==
"arm32"
]]
||
[[
"
$cpuType
"
==
"mips64"
]]
||
[[
"
$cpuType
"
==
"loongarch64"
]]
;
then
if
[
"
$verMode
"
==
"edge"
]
;
then
# community-version compile
cmake ../
-DCPUTYPE
=
${
cpuType
}
-DWEBSOCKET
=
true
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DPAGMODE
=
${
pagMode
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
-DBUILD_TOOLS
=
${
BUILD_TOOLS
}
${
allocator_macro
}
elif
[
"
$verMode
"
==
"cloud"
]
;
then
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-DWEBSOCKET
=
true
-DBUILD_TAOSX
=
true
-DBUILD_CLOUD
=
true
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
-DBUILD_TOOLS
=
${
BUILD_TOOLS
}
${
allocator_macro
}
elif
[
"
$verMode
"
==
"cluster"
]
;
then
if
[[
"
$dbName
"
!=
"taos"
]]
;
then
replace_enterprise_
$dbName
fi
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-DWEBSOCKET
=
true
-DBUILD_TAOSX
=
true
-DOSTYPE
=
${
osType
}
-DSOMODE
=
${
soMode
}
-DDBNAME
=
${
dbName
}
-DVERTYPE
=
${
verType
}
-DVERDATE
=
"
${
build_time
}
"
-DGITINFO
=
${
gitinfo
}
-DGITINFOI
=
${
gitinfoOfInternal
}
-DVERNUMBER
=
${
verNumber
}
-DVERCOMPATIBLE
=
${
verNumberComp
}
-DBUILD_HTTP
=
${
BUILD_HTTP
}
-DBUILD_TOOLS
=
${
BUILD_TOOLS
}
${
allocator_macro
}
fi
else
echo
"input cpuType=
${
cpuType
}
error!!!"
exit
1
fi
ostype
=
`
uname
`
if
[
"
${
ostype
}
"
==
"Darwin"
]
;
then
CORES
=
$(
sysctl
-n
hw.ncpu
)
else
CORES
=
$(
grep
-c
^processor /proc/cpuinfo
)
fi
if
[[
"
$allocator
"
==
"jemalloc"
]]
;
then
# jemalloc need compile first, so disable parallel build
make
-j
${
CORES
}
&&
${
csudo
}
make
install
else
make
-j
${
CORES
}
&&
${
csudo
}
make
install
fi
cd
${
curr_dir
}
# 3. Call the corresponding script for packaging
if
[
"
$osType
"
!=
"Darwin"
]
;
then
if
[[
"
$verMode
"
!=
"cluster"
]]
&&
[[
"
$verMode
"
!=
"cloud"
]]
&&
[[
"
$pagMode
"
==
"full"
]]
&&
[[
"
$cpuType
"
==
"x64"
]]
&&
[[
"
$dbName
"
==
"taos"
]]
;
then
ret
=
'0'
command
-v
dpkg
>
/dev/null 2>&1
||
{
ret
=
'1'
;
}
if
[
"
$ret
"
-eq
0
]
;
then
echo
"====do deb package for the ubuntu system===="
output_dir
=
"
${
top_dir
}
/debs"
if
[
-d
${
output_dir
}
]
;
then
rm
-rf
${
output_dir
}
fi
mkdir
-p
${
output_dir
}
cd
${
script_dir
}
/deb
${
csudo
}
./makedeb.sh
${
compile_dir
}
${
output_dir
}
${
verNumber
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
if
[[
"
$pagMode
"
==
"full"
]]
;
then
if
[
-d
${
top_dir
}
/tools/taos-tools/packaging/deb
]
;
then
cd
${
top_dir
}
/tools/taos-tools/packaging/deb
taos_tools_ver
=
$(
git tag |grep
-v
taos |
sort
|
tail
-1
)
[
-z
"
$taos_tools_ver
"
]
&&
taos_tools_ver
=
"0.1.0"
${
csudo
}
./make-taos-tools-deb.sh
${
top_dir
}
\
${
compile_dir
}
${
output_dir
}
${
taos_tools_ver
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
fi
fi
else
echo
"==========dpkg command not exist, so not release deb package!!!"
fi
ret
=
'0'
command
-v
rpmbuild
>
/dev/null 2>&1
||
{
ret
=
'1'
;
}
if
[
"
$ret
"
-eq
0
]
;
then
echo
"====do rpm package for the centos system===="
output_dir
=
"
${
top_dir
}
/rpms"
if
[
-d
${
output_dir
}
]
;
then
rm
-rf
${
output_dir
}
fi
mkdir
-p
${
output_dir
}
cd
${
script_dir
}
/rpm
${
csudo
}
./makerpm.sh
${
compile_dir
}
${
output_dir
}
${
verNumber
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
if
[[
"
$pagMode
"
==
"full"
]]
;
then
if
[
-d
${
top_dir
}
/tools/taos-tools/packaging/rpm
]
;
then
cd
${
top_dir
}
/tools/taos-tools/packaging/rpm
taos_tools_ver
=
$(
git tag |grep
-v
taos |
sort
|
tail
-1
)
[
-z
"
$taos_tools_ver
"
]
&&
taos_tools_ver
=
"0.1.0"
${
csudo
}
./make-taos-tools-rpm.sh
${
top_dir
}
\
${
compile_dir
}
${
output_dir
}
${
taos_tools_ver
}
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
fi
fi
else
echo
"==========rpmbuild command not exist, so not release rpm package!!!"
fi
fi
echo
"====do tar.gz package for all systems===="
cd
${
script_dir
}
/tools
${
csudo
}
./makepkg.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
verNumberComp
}
${
dbName
}
${
csudo
}
./makeclient.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
dbName
}
else
cd
${
script_dir
}
/tools
./makepkg.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
verNumberComp
}
${
dbName
}
./makeclient.sh
${
compile_dir
}
${
verNumber
}
"
${
build_time
}
"
${
cpuType
}
${
osType
}
${
verMode
}
${
verType
}
${
pagMode
}
${
dbName
}
fi
packaging/tools/post.sh
浏览文件 @
c4b6a99c
...
...
@@ -109,6 +109,13 @@ function kill_taosadapter() {
fi
}
function
kill_taoskeeper
()
{
pid
=
$(
ps
-ef
|
grep
"taoskeeper"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
if
[
-n
"
$pid
"
]
;
then
${
csudo
}
kill
-9
$pid
||
:
fi
}
function
kill_taosd
()
{
# ${csudo}pkill -f taosd || :
pid
=
$(
ps
-ef
|
grep
"taosd"
|
grep
-v
"grep"
|
awk
'{print $2}'
)
...
...
@@ -161,6 +168,7 @@ function install_bin() {
${
csudo
}
rm
-f
${
bin_link_dir
}
/udfd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosadapter
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosBenchmark
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taoskeeper
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
...
...
@@ -179,6 +187,7 @@ function install_bin() {
[
-x
${
bin_dir
}
/taosdump
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/taosdump
${
bin_link_dir
}
/taosdump
||
:
[
-x
${
bin_dir
}
/set_core.sh
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/set_core.sh
${
bin_link_dir
}
/set_core
||
:
[
-x
${
bin_dir
}
/remove.sh
]
&&
${
csudo
}
ln
-s
${
bin_dir
}
/remove.sh
${
bin_link_dir
}
/rmtaos
||
:
[
-x
${
bin_dir
}
/taoskeeper
]
&&
${
csudo
}
ln
-sf
${
bin_dir
}
/taoskeeper
${
bin_link_dir
}
/taoskeeper
||
:
}
function
add_newHostname_to_hosts
()
{
...
...
@@ -351,6 +360,22 @@ function install_taosadapter_config() {
${
csudo
}
ln
-s
${
cfg_install_dir
}
/taosadapter.toml
${
cfg_dir
}
}
function
install_taoskeeper_config
()
{
if
[
!
-f
"
${
cfg_install_dir
}
/keeper.toml"
]
;
then
[
!
-d
%
{
cfg_install_dir
}
]
&&
${
csudo
}${
csudo
}
mkdir
-p
${
cfg_install_dir
}
[
-f
${
cfg_dir
}
/keeper.toml
]
&&
${
csudo
}
cp
${
cfg_dir
}
/keeper.toml
${
cfg_install_dir
}
[
-f
${
cfg_install_dir
}
/keeper.toml
]
&&
${
csudo
}
chmod
644
${
cfg_install_dir
}
/keeper.toml
fi
[
-f
${
cfg_dir
}
/keeper.toml
]
&&
${
csudo
}
mv
${
cfg_dir
}
/keeper.toml
${
cfg_dir
}
/keeper.toml.new
[
-f
${
cfg_install_dir
}
/keeper.toml
]
&&
${
csudo
}
ln
-s
${
cfg_install_dir
}
/keeper.toml
${
cfg_dir
}
}
function
install_config
()
{
if
[
!
-f
"
${
cfg_install_dir
}
/taos.cfg"
]
;
then
${
csudo
}${
csudo
}
mkdir
-p
${
cfg_install_dir
}
...
...
@@ -583,6 +608,7 @@ function install_TDengine() {
install_bin
install_config
install_taosadapter_config
install_taoskeeper_config
install_taosadapter_service
install_service
install_app
...
...
source/client/inc/clientSml.h
浏览文件 @
c4b6a99c
...
...
@@ -232,6 +232,7 @@ int32_t smlClearForRerun(SSmlHandle *info);
int32_t
smlParseValue
(
SSmlKv
*
pVal
,
SSmlMsgBuf
*
msg
);
uint8_t
smlGetTimestampLen
(
int64_t
num
);
void
clearColValArray
(
SArray
*
pCols
);
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
);
int32_t
smlParseInfluxString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
int32_t
smlParseTelnetString
(
SSmlHandle
*
info
,
char
*
sql
,
char
*
sqlEnd
,
SSmlLineInfo
*
elements
);
...
...
source/client/src/clientEnv.c
浏览文件 @
c4b6a99c
...
...
@@ -62,7 +62,10 @@ static int32_t registerRequest(SRequestObj *pRequest, STscObj *pTscObj) {
static
void
deregisterRequest
(
SRequestObj
*
pRequest
)
{
const
static
int64_t
SLOW_QUERY_INTERVAL
=
3000000L
;
// todo configurable
assert
(
pRequest
!=
NULL
);
if
(
pRequest
==
NULL
){
tscError
(
"pRequest == NULL"
);
return
;
}
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
SAppClusterSummary
*
pActivity
=
&
pTscObj
->
pAppInfo
->
summary
;
...
...
@@ -412,7 +415,8 @@ void taos_init_imp(void) {
initQueryModuleMsgHandle
();
if
(
taosConvInit
()
!=
0
)
{
ASSERTS
(
0
,
"failed to init conv"
);
tscError
(
"failed to init conv"
);
return
;
}
rpcInit
();
...
...
source/client/src/clientHb.c
浏览文件 @
c4b6a99c
...
...
@@ -376,7 +376,6 @@ int32_t hbBuildQueryDesc(SQueryHbReqBasic *hbBasic, STscObj *pObj) {
desc
.
subPlanNum
=
0
;
}
desc
.
subPlanNum
=
taosArrayGetSize
(
desc
.
subDesc
);
ASSERT
(
desc
.
subPlanNum
==
taosArrayGetSize
(
desc
.
subDesc
));
}
else
{
desc
.
subDesc
=
NULL
;
}
...
...
@@ -813,7 +812,10 @@ static void hbStopThread() {
}
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
)
{
hbMgrInit
();
if
(
hbMgrInit
()
!=
0
){
terrno
=
TSDB_CODE_TSC_INTERNAL_ERROR
;
return
NULL
;
}
SAppHbMgr
*
pAppHbMgr
=
taosMemoryMalloc
(
sizeof
(
SAppHbMgr
));
if
(
pAppHbMgr
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -899,16 +901,28 @@ int hbMgrInit() {
TdThreadMutexAttr
attr
=
{
0
};
int
ret
=
taosThreadMutexAttrInit
(
&
attr
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexAttrInit error"
)
return
ret
;
}
ret
=
taosThreadMutexAttrSetType
(
&
attr
,
PTHREAD_MUTEX_RECURSIVE
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexAttrSetType error"
)
return
ret
;
}
ret
=
taosThreadMutexInit
(
&
clientHbMgr
.
lock
,
&
attr
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexInit error"
)
return
ret
;
}
ret
=
taosThreadMutexAttrDestroy
(
&
attr
);
assert
(
ret
==
0
);
if
(
ret
!=
0
){
uError
(
"hbMgrInit:taosThreadMutexAttrDestroy error"
)
return
ret
;
}
// init handle funcs
hbMgrInitHandle
();
...
...
source/client/src/clientImpl.c
浏览文件 @
c4b6a99c
...
...
@@ -452,7 +452,10 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra
}
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SSchema
*
pSchema
,
int32_t
numOfCols
)
{
ASSERT
(
pSchema
!=
NULL
&&
numOfCols
>
0
);
if
(
pResInfo
==
NULL
||
pSchema
==
NULL
||
numOfCols
<=
0
){
tscError
(
"invalid paras, pResInfo == NULL || pSchema == NULL || numOfCols <= 0"
);
return
;
}
pResInfo
->
numOfCols
=
numOfCols
;
if
(
pResInfo
->
fields
!=
NULL
)
{
...
...
@@ -463,7 +466,10 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t
}
pResInfo
->
fields
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
TAOS_FIELD
));
pResInfo
->
userFields
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
TAOS_FIELD
));
ASSERT
(
numOfCols
==
pResInfo
->
numOfCols
);
if
(
numOfCols
!=
pResInfo
->
numOfCols
){
tscError
(
"numOfCols:%d != pResInfo->numOfCols:%d"
,
numOfCols
,
pResInfo
->
numOfCols
);
return
;
}
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
pResInfo
->
fields
[
i
].
bytes
=
pSchema
[
i
].
bytes
;
...
...
@@ -1339,7 +1345,10 @@ int32_t doProcessMsgFromServer(void* param) {
SEpSet
*
pEpSet
=
arg
->
pEpset
;
SMsgSendInfo
*
pSendInfo
=
(
SMsgSendInfo
*
)
pMsg
->
info
.
ahandle
;
assert
(
pMsg
->
info
.
ahandle
!=
NULL
);
if
(
pMsg
->
info
.
ahandle
==
NULL
){
tscError
(
"doProcessMsgFromServer pMsg->info.ahandle == NULL"
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
STscObj
*
pTscObj
=
NULL
;
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
...
...
@@ -1352,8 +1361,10 @@ int32_t doProcessMsgFromServer(void* param) {
if
(
pSendInfo
->
requestObjRefId
!=
0
)
{
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
taosAcquireRef
(
clientReqRefPool
,
pSendInfo
->
requestObjRefId
);
if
(
pRequest
)
{
assert
(
pRequest
->
self
==
pSendInfo
->
requestObjRefId
);
if
(
pRequest
->
self
!=
pSendInfo
->
requestObjRefId
){
tscError
(
"doProcessMsgFromServer pRequest->self:%"
PRId64
" != pSendInfo->requestObjRefId:%"
PRId64
,
pRequest
->
self
,
pSendInfo
->
requestObjRefId
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
pRequest
->
metric
.
rsp
=
taosGetTimestampUs
();
pTscObj
=
pRequest
->
pTscObj
;
/*
...
...
@@ -1495,7 +1506,9 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
}
void
*
doFetchRows
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
)
{
assert
(
pRequest
!=
NULL
);
if
(
pRequest
==
NULL
){
return
NULL
;
}
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
...
...
@@ -1549,7 +1562,9 @@ static void syncFetchFn(void* param, TAOS_RES* res, int32_t numOfRows) {
}
void
*
doAsyncFetchRows
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
)
{
assert
(
pRequest
!=
NULL
);
if
(
pRequest
==
NULL
){
return
NULL
;
}
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
...
...
@@ -1613,8 +1628,10 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
char
*
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
ASSERT
(
len
<=
bytes
);
ASSERT
((
p
+
len
)
<
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
]));
if
(
len
>
bytes
||
(
p
+
len
)
>=
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
])){
tscError
(
"doConvertUCS4 error, invalid data. len:%d, bytes:%d, (p + len):%p, (pResultInfo->convertBuf[i] + colLength[i]):%p"
,
len
,
bytes
,
(
p
+
len
),
(
pResultInfo
->
convertBuf
[
i
]
+
colLength
[
i
]));
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
varDataSetLen
(
p
,
len
);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
...
...
@@ -1631,9 +1648,6 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
}
int32_t
getVersion1BlockMetaSize
(
const
char
*
p
,
int32_t
numOfCols
)
{
int32_t
cols
=
*
(
int32_t
*
)(
p
+
sizeof
(
int32_t
)
*
3
);
ASSERT
(
numOfCols
==
cols
);
return
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
*
3
+
sizeof
(
uint64_t
)
+
numOfCols
*
(
sizeof
(
int8_t
)
+
sizeof
(
int32_t
));
}
...
...
@@ -1643,6 +1657,12 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i
// | version | total length | total rows | total columns | flag seg| block group id | column schema | each column
// length |
int32_t
cols
=
*
(
int32_t
*
)(
p
+
sizeof
(
int32_t
)
*
3
);
if
(
ASSERT
(
numOfCols
==
cols
)){
tscError
(
"estimateJsonLen error: numOfCols:%d != cols:%d"
,
numOfCols
,
cols
);
return
-
1
;
}
int32_t
len
=
getVersion1BlockMetaSize
(
p
,
numOfCols
);
int32_t
*
colLength
=
(
int32_t
*
)(
p
+
len
);
len
+=
sizeof
(
int32_t
)
*
numOfCols
;
...
...
@@ -1676,7 +1696,8 @@ static int32_t estimateJsonLen(SReqResultInfo* pResultInfo, int32_t numOfCols, i
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BOOL
)
{
len
+=
(
VARSTR_HEADER_SIZE
+
5
);
}
else
{
ASSERT
(
0
);
tscError
(
"estimateJsonLen error: invalid type:%d"
,
jsonInnerType
);
return
-
1
;
}
}
}
else
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
...
...
@@ -1710,12 +1731,21 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
char
*
p
=
(
char
*
)
pResultInfo
->
pData
;
int32_t
dataLen
=
estimateJsonLen
(
pResultInfo
,
numOfCols
,
numOfRows
);
if
(
dataLen
<=
0
){
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
pResultInfo
->
convertJson
=
taosMemoryCalloc
(
1
,
dataLen
);
if
(
pResultInfo
->
convertJson
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
char
*
p1
=
pResultInfo
->
convertJson
;
int32_t
totalLen
=
0
;
int32_t
cols
=
*
(
int32_t
*
)(
p
+
sizeof
(
int32_t
)
*
3
);
if
(
ASSERT
(
numOfCols
==
cols
)){
tscError
(
"doConvertJson error: numOfCols:%d != cols:%d"
,
numOfCols
,
cols
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
int32_t
len
=
getVersion1BlockMetaSize
(
p
,
numOfCols
);
memcpy
(
p1
,
p
,
len
);
...
...
@@ -1736,8 +1766,10 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
int32_t
colLen
=
htonl
(
colLength
[
i
]);
int32_t
colLen1
=
htonl
(
colLength1
[
i
]);
ASSERT
(
colLen
<
dataLen
);
if
(
ASSERT
(
colLen
<
dataLen
)){
tscError
(
"doConvertJson error: colLen:%d >= dataLen:%d"
,
colLen
,
dataLen
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
pResultInfo
->
fields
[
i
].
type
==
TSDB_DATA_TYPE_JSON
)
{
int32_t
*
offset
=
(
int32_t
*
)
pStart
;
int32_t
*
offset1
=
(
int32_t
*
)
pStart1
;
...
...
@@ -1782,7 +1814,8 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
sprintf
(
varDataVal
(
dst
),
"%s"
,
(
*
((
char
*
)
jsonInnerData
)
==
1
)
?
"true"
:
"false"
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
{
ASSERT
(
0
);
tscError
(
"doConvertJson error: invalid type:%d"
,
jsonInnerType
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
offset1
[
j
]
=
len
;
...
...
@@ -1820,7 +1853,10 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
,
bool
convertUcs4
)
{
assert
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
);
if
(
ASSERT
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
)){
tscError
(
"setResultDataPtr paras error"
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
numOfRows
==
0
)
{
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1849,7 +1885,10 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
int32_t
cols
=
*
(
int32_t
*
)
p
;
p
+=
sizeof
(
int32_t
);
ASSERT
(
rows
==
numOfRows
&&
cols
==
numOfCols
);
if
(
ASSERT
(
rows
==
numOfRows
&&
cols
==
numOfCols
)){
tscError
(
"setResultDataPtr paras error:rows;%d numOfRows:%d cols:%d numOfCols:%d"
,
rows
,
numOfRows
,
cols
,
numOfCols
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
int32_t
hasColumnSeg
=
*
(
int32_t
*
)
p
;
p
+=
sizeof
(
int32_t
);
...
...
@@ -1876,7 +1915,7 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
colLength
[
i
]
=
htonl
(
colLength
[
i
]);
if
(
colLength
[
i
]
>=
dataLen
)
{
tscError
(
"invalid colLength %d, dataLen %d"
,
colLength
[
i
],
dataLen
);
ASSERT
(
0
)
;
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
...
...
@@ -1914,7 +1953,11 @@ char* getDbOfConnection(STscObj* pObj) {
}
void
setConnectionDB
(
STscObj
*
pTscObj
,
const
char
*
db
)
{
assert
(
db
!=
NULL
&&
pTscObj
!=
NULL
);
if
(
db
==
NULL
||
pTscObj
==
NULL
){
tscError
(
"setConnectionDB para is NULL"
);
return
;
}
taosThreadMutexLock
(
&
pTscObj
->
mutex
);
tstrncpy
(
pTscObj
->
db
,
db
,
tListLen
(
pTscObj
->
db
));
taosThreadMutexUnlock
(
&
pTscObj
->
mutex
);
...
...
@@ -1932,7 +1975,10 @@ void resetConnectDB(STscObj* pTscObj) {
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
,
bool
convertUcs4
,
bool
freeAfterUse
)
{
assert
(
pResultInfo
!=
NULL
&&
pRsp
!=
NULL
);
if
(
pResultInfo
==
NULL
||
pRsp
==
NULL
){
tscError
(
"setQueryResultFromRsp paras is null"
);
return
TSDB_CODE_TSC_INTERNAL_ERROR
;
}
if
(
freeAfterUse
)
taosMemoryFreeClear
(
pResultInfo
->
pRspMsg
);
...
...
source/client/src/clientJniConnector.c
浏览文件 @
c4b6a99c
...
...
@@ -574,7 +574,11 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchBlockImp(JNI
TAOS_RES
*
tres
=
(
TAOS_RES
*
)
res
;
int32_t
numOfFields
=
taos_num_fields
(
tres
);
assert
(
numOfFields
>
0
);
if
(
numOfFields
<=
0
){
jniError
(
"jobj:%p, conn:%p, query interrupted. taos_num_fields error code:%d, msg:%s"
,
jobj
,
tscon
,
numOfFields
,
taos_errstr
(
tres
));
return
JNI_RESULT_SET_NULL
;
}
void
*
data
;
int32_t
numOfRows
;
...
...
source/client/src/clientMain.c
浏览文件 @
c4b6a99c
...
...
@@ -291,7 +291,6 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
tscError
(
"invalid result passed to taos_fetch_row"
);
return
NULL
;
}
return
NULL
;
}
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
)
{
...
...
@@ -355,9 +354,13 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
case
TSDB_DATA_TYPE_NCHAR
:
{
int32_t
charLen
=
varDataLen
((
char
*
)
row
[
i
]
-
VARSTR_HEADER_SIZE
);
if
(
fields
[
i
].
type
==
TSDB_DATA_TYPE_BINARY
)
{
assert
(
charLen
<=
fields
[
i
].
bytes
&&
charLen
>=
0
);
if
(
ASSERT
(
charLen
<=
fields
[
i
].
bytes
&&
charLen
>=
0
)){
tscError
(
"taos_print_row error binary. charLen:%d, fields[i].bytes:%d"
,
charLen
,
fields
[
i
].
bytes
);
}
}
else
{
assert
(
charLen
<=
fields
[
i
].
bytes
*
TSDB_NCHAR_SIZE
&&
charLen
>=
0
);
if
(
ASSERT
(
charLen
<=
fields
[
i
].
bytes
*
TSDB_NCHAR_SIZE
&&
charLen
>=
0
)){
tscError
(
"taos_print_row error. charLen:%d, fields[i].bytes:%d"
,
charLen
,
fields
[
i
].
bytes
);
}
}
memcpy
(
str
+
len
,
row
[
i
],
charLen
);
...
...
@@ -577,7 +580,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
(
*
numOfRows
)
=
pResultInfo
->
numOfRows
;
return
0
;
}
else
{
ASSERT
(
0
);
tscError
(
"taos_fetch_block_s invalid res type"
);
return
-
1
;
}
}
...
...
@@ -1000,8 +1003,14 @@ static void fetchCallback(void *pResult, void *param, int32_t code) {
}
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
)
{
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
);
ASSERT
(
TD_RES_QUERY
(
res
));
if
(
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
)){
tscError
(
"taos_fetch_rows_a invalid paras"
);
return
;
}
if
(
ASSERT
(
TD_RES_QUERY
(
res
))){
tscError
(
"taos_fetch_rows_a res is NULL"
);
return
;
}
SRequestObj
*
pRequest
=
res
;
pRequest
->
body
.
fetchFp
=
fp
;
...
...
@@ -1044,9 +1053,14 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
}
void
taos_fetch_raw_block_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
)
{
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
);
ASSERT
(
TD_RES_QUERY
(
res
));
if
(
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
)){
tscError
(
"taos_fetch_rows_a invalid paras"
);
return
;
}
if
(
ASSERT
(
TD_RES_QUERY
(
res
))){
tscError
(
"taos_fetch_rows_a res is NULL"
);
return
;
}
SRequestObj
*
pRequest
=
res
;
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
...
...
@@ -1058,8 +1072,14 @@ void taos_fetch_raw_block_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
}
const
void
*
taos_get_raw_block
(
TAOS_RES
*
res
)
{
ASSERT
(
res
!=
NULL
);
ASSERT
(
TD_RES_QUERY
(
res
));
if
(
ASSERT
(
res
!=
NULL
)){
tscError
(
"taos_fetch_rows_a invalid paras"
);
return
NULL
;
}
if
(
ASSERT
(
TD_RES_QUERY
(
res
))){
tscError
(
"taos_fetch_rows_a res is NULL"
);
return
NULL
;
}
SRequestObj
*
pRequest
=
res
;
return
pRequest
->
body
.
resInfo
.
pData
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
c4b6a99c
...
...
@@ -149,7 +149,6 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pRequest) {
pMsgSendInfo
->
msgType
=
pRequest
->
type
;
pMsgSendInfo
->
target
.
type
=
TARGET_TYPE_MNODE
;
assert
(
pRequest
!=
NULL
);
pMsgSendInfo
->
msgInfo
=
pRequest
->
body
.
requestMsg
;
pMsgSendInfo
->
fp
=
getMsgRspHandle
(
pRequest
->
type
);
return
pMsgSendInfo
;
...
...
@@ -273,7 +272,9 @@ int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) {
}
int32_t
processCreateSTableRsp
(
void
*
param
,
SDataBuf
*
pMsg
,
int32_t
code
)
{
assert
(
pMsg
!=
NULL
&&
param
!=
NULL
);
if
(
pMsg
==
NULL
||
param
==
NULL
){
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
SRequestObj
*
pRequest
=
param
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -454,7 +455,10 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) {
(
*
pRsp
)
->
numOfCols
=
htonl
(
SHOW_VARIABLES_RESULT_COLS
);
int32_t
len
=
blockEncode
(
pBlock
,
(
*
pRsp
)
->
data
,
SHOW_VARIABLES_RESULT_COLS
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
if
(
len
!=
rspSize
-
sizeof
(
SRetrieveTableRsp
)){
uError
(
"buildShowVariablesRsp error, len:%d != rspSize - sizeof(SRetrieveTableRsp):%"
PRIu64
,
len
,
(
uint64_t
)
(
rspSize
-
sizeof
(
SRetrieveTableRsp
)));
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
...
...
source/client/src/clientRawBlockWrite.c
浏览文件 @
c4b6a99c
...
...
@@ -373,7 +373,10 @@ static char* processCreateTable(SMqMetaRsp* metaRsp) {
}
static
char
*
processAutoCreateTable
(
STaosxRsp
*
rsp
)
{
ASSERT
(
rsp
->
createTableNum
!=
0
);
if
(
rsp
->
createTableNum
<=
0
){
uError
(
"WriteRaw:processAutoCreateTable rsp->createTableNum <= 0"
);
goto
_exit
;
}
SDecoder
*
decoder
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SDecoder
));
SVCreateTbReq
*
pCreateReq
=
taosMemoryCalloc
(
rsp
->
createTableNum
,
sizeof
(
SVCreateTbReq
));
...
...
@@ -389,7 +392,10 @@ static char* processAutoCreateTable(STaosxRsp* rsp) {
goto
_exit
;
}
ASSERT
(
pCreateReq
[
iReq
].
type
==
TSDB_CHILD_TABLE
);
if
(
pCreateReq
[
iReq
].
type
!=
TSDB_CHILD_TABLE
){
uError
(
"WriteRaw:processAutoCreateTable pCreateReq[iReq].type != TSDB_CHILD_TABLE"
);
goto
_exit
;
}
}
string
=
buildCreateCTableJson
(
pCreateReq
,
rsp
->
createTableNum
);
...
...
@@ -494,7 +500,10 @@ static char* processAlterTable(SMqMetaRsp* metaRsp) {
char
*
buf
=
NULL
;
if
(
vAlterTbReq
.
tagType
==
TSDB_DATA_TYPE_JSON
)
{
ASSERT
(
tTagIsJson
(
vAlterTbReq
.
pTagVal
)
==
true
);
if
(
!
tTagIsJson
(
vAlterTbReq
.
pTagVal
)){
uError
(
"processAlterTable isJson false"
);
goto
_exit
;
}
buf
=
parseTagDatatoJson
(
vAlterTbReq
.
pTagVal
);
}
else
{
buf
=
taosMemoryCalloc
(
vAlterTbReq
.
nTagVal
+
1
,
1
);
...
...
@@ -1610,7 +1619,11 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
goto
end
;
}
ASSERT
(
pCreateReq
.
type
==
TSDB_CHILD_TABLE
);
if
(
pCreateReq
.
type
!=
TSDB_CHILD_TABLE
){
uError
(
"WriteRaw:pCreateReq.type != TSDB_CHILD_TABLE. table name: %s"
,
tbName
);
code
=
TSDB_CODE_TSC_INVALID_VALUE
;
goto
end
;
}
if
(
strcmp
(
tbName
,
pCreateReq
.
name
)
==
0
)
{
strcpy
(
pName
.
tname
,
pCreateReq
.
ctb
.
stbName
);
tDecoderClear
(
&
decoderTmp
);
...
...
source/client/src/clientSml.c
浏览文件 @
c4b6a99c
...
...
@@ -523,7 +523,10 @@ STableMeta *smlGetMeta(SSmlHandle *info, const void *measure, int32_t measureLen
memset
(
pName
.
tname
,
0
,
TSDB_TABLE_NAME_LEN
);
memcpy
(
pName
.
tname
,
measure
,
measureLen
);
catalogGetSTableMeta
(
info
->
pCatalog
,
&
conn
,
&
pName
,
&
pTableMeta
);
int32_t
code
=
catalogGetSTableMeta
(
info
->
pCatalog
,
&
conn
,
&
pName
,
&
pTableMeta
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
return
NULL
;
}
return
pTableMeta
;
}
...
...
@@ -996,7 +999,10 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
}
}
else
{
size_t
tmp
=
taosArrayGetSize
(
metaArray
);
ASSERT
(
tmp
<=
INT16_MAX
);
if
(
tmp
>
INT16_MAX
){
uError
(
"too many cols or tags"
);
return
-
1
;
}
int16_t
size
=
tmp
;
int
ret
=
taosHashPut
(
metaHash
,
kv
->
key
,
kv
->
keyLen
,
&
size
,
SHORT_BYTES
);
if
(
ret
==
0
)
{
...
...
@@ -1008,7 +1014,7 @@ static int32_t smlUpdateMeta(SHashObj *metaHash, SArray *metaArray, SArray *cols
return
TSDB_CODE_SUCCESS
;
}
static
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
)
{
void
smlDestroyTableInfo
(
SSmlHandle
*
info
,
SSmlTableInfo
*
tag
)
{
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
tag
->
cols
);
i
++
)
{
SHashObj
*
kvHash
=
(
SHashObj
*
)
taosArrayGetP
(
tag
->
cols
,
i
);
taosHashCleanup
(
kvHash
);
...
...
@@ -1229,7 +1235,10 @@ static int32_t smlInsertData(SSmlHandle *info) {
SSmlSTableMeta
*
pMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
tableData
->
sTableName
,
tableData
->
sTableNameLen
,
NULL
);
ASSERT
(
NULL
!=
pMeta
);
if
(
unlikely
(
NULL
==
pMeta
||
NULL
==
pMeta
->
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == pMeta. table name: %s"
,
info
->
id
,
tableData
->
childTableName
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
// use tablemeta of stable to save vgid and uid of child table
pMeta
->
tableMeta
->
vgId
=
vg
.
vgId
;
...
...
@@ -1365,9 +1374,8 @@ static int32_t smlParseLine(SSmlHandle *info, char *lines[], char *rawLine, char
}
else
{
code
=
smlParseTelnetString
(
info
,
(
char
*
)
tmp
,
(
char
*
)
tmp
+
len
,
info
->
lines
+
i
);
}
}
else
{
ASSERT
(
0
)
;
code
=
TSDB_CODE_SML_INVALID_PROTOCOL_TYPE
;
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"SML:0x%"
PRIx64
" smlParseLine failed. line %d : %s"
,
info
->
id
,
i
,
tmp
);
...
...
source/client/src/clientSmlJson.c
浏览文件 @
c4b6a99c
...
...
@@ -143,7 +143,10 @@ while(*(start)){\
// if(unlikely(kv.length > preKV->length)){
// preKV->length = kv.length;
// SSmlSTableMeta *tableMeta = (SSmlSTableMeta *)nodeListGet(info->superTables, elements->measure, elements->measureLen, NULL);
// ASSERT(tableMeta != NULL);
// if(unlikely(NULL == tableMeta)){
// uError("SML:0x%" PRIx64 " NULL == tableMeta", info->id);
// return TSDB_CODE_SML_INTERNAL_ERROR;
// }
//
// SSmlKv *oldKV = (SSmlKv *)taosArrayGet(tableMeta->tags, cnt);
// oldKV->length = kv.length;
...
...
@@ -723,7 +726,10 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
if
(
unlikely
(
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
tags
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
@@ -780,6 +786,7 @@ static int32_t smlParseTagsFromJSON(SSmlHandle *info, cJSON *tags, SSmlLineInfo
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
...
...
source/client/src/clientSmlLine.c
浏览文件 @
c4b6a99c
...
...
@@ -259,7 +259,10 @@ static int32_t smlParseTagKv(SSmlHandle *info, char **sql, char *sqlEnd,
if
(
unlikely
(
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
tags
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
@@ -484,7 +487,10 @@ static int32_t smlParseColKv(SSmlHandle *info, char **sql, char *sqlEnd,
if
(
unlikely
(
IS_VAR_DATA_TYPE
(
kv
.
type
)
&&
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
currElement
->
measure
,
currElement
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
cols
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
source/client/src/clientSmlTelnet.c
浏览文件 @
c4b6a99c
...
...
@@ -184,7 +184,10 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
if
(
unlikely
(
kv
.
length
>
maxKV
->
length
)){
maxKV
->
length
=
kv
.
length
;
SSmlSTableMeta
*
tableMeta
=
(
SSmlSTableMeta
*
)
nodeListGet
(
info
->
superTables
,
elements
->
measure
,
elements
->
measureLen
,
NULL
);
ASSERT
(
tableMeta
!=
NULL
);
if
(
unlikely
(
NULL
==
tableMeta
)){
uError
(
"SML:0x%"
PRIx64
" NULL == tableMeta"
,
info
->
id
);
return
TSDB_CODE_SML_INTERNAL_ERROR
;
}
SSmlKv
*
oldKV
=
(
SSmlKv
*
)
taosArrayGet
(
tableMeta
->
tags
,
cnt
);
oldKV
->
length
=
kv
.
length
;
...
...
@@ -240,6 +243,7 @@ static int32_t smlParseTelnetTags(SSmlHandle *info, char *data, char *sqlEnd, SS
tinfo
->
tableDataCtx
=
smlInitTableDataCtx
(
info
->
pQuery
,
info
->
currSTableMeta
);
if
(
tinfo
->
tableDataCtx
==
NULL
)
{
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"smlInitTableDataCtx error"
,
NULL
);
smlDestroyTableInfo
(
info
,
tinfo
);
return
TSDB_CODE_SML_INVALID_DATA
;
}
}
...
...
source/client/src/clientStmt.c
浏览文件 @
c4b6a99c
...
...
@@ -296,7 +296,6 @@ int32_t stmtCleanExecInfo(STscStmt* pStmt, bool keepTable, bool deepClean) {
STableMeta
*
pMeta
=
qGetTableMetaInDataBlock
(
pBlocks
);
if
(
keepTable
&&
pBlocks
==
pStmt
->
exec
.
pCurrBlock
)
{
ASSERT
(
NULL
==
pBlocks
->
pData
);
TSWAP
(
pBlocks
->
pData
,
pStmt
->
exec
.
pCurrTbData
);
STMT_ERR_RET
(
qResetStmtDataBlock
(
pBlocks
,
false
));
...
...
@@ -394,7 +393,10 @@ int32_t stmtGetFromCache(STscStmt* pStmt) {
if
(
NULL
==
pStmt
->
sql
.
pTableCache
||
taosHashGetSize
(
pStmt
->
sql
.
pTableCache
)
<=
0
)
{
if
(
pStmt
->
bInfo
.
inExecCache
)
{
ASSERT
(
taosHashGetSize
(
pStmt
->
exec
.
pBlockHash
)
==
1
);
if
(
ASSERT
(
taosHashGetSize
(
pStmt
->
exec
.
pBlockHash
)
==
1
)){
tscError
(
"stmtGetFromCache error"
);
return
TSDB_CODE_TSC_STMT_CACHE_ERROR
;
}
pStmt
->
bInfo
.
needParse
=
false
;
tscDebug
(
"reuse stmt block for tb %s in execBlock"
,
pStmt
->
bInfo
.
tbFName
);
return
TSDB_CODE_SUCCESS
;
...
...
source/client/src/clientTmq.c
浏览文件 @
c4b6a99c
...
...
@@ -418,7 +418,10 @@ int32_t tmqCommitDone(SMqCommitCbParamSet* pParamSet) {
static
void
tmqCommitRspCountDown
(
SMqCommitCbParamSet
*
pParamSet
)
{
int32_t
waitingRspNum
=
atomic_sub_fetch_32
(
&
pParamSet
->
waitingRspNum
,
1
);
ASSERT
(
waitingRspNum
>=
0
);
if
(
ASSERT
(
waitingRspNum
>=
0
)){
tscError
(
"tmqCommitRspCountDown error:%d"
,
waitingRspNum
);
return
;
}
if
(
waitingRspNum
==
0
)
{
tmqCommitDone
(
pParamSet
);
}
...
...
source/dnode/mgmt/node_mgmt/src/dmNodes.c
浏览文件 @
c4b6a99c
...
...
@@ -109,8 +109,8 @@ static int32_t dmStartNodes(SDnode *pDnode) {
}
}
dInfo
(
"T
Dengine
initialized successfully"
);
dmReportStartup
(
"T
Dengine
"
,
"initialized successfully"
);
dInfo
(
"T
he daemon
initialized successfully"
);
dmReportStartup
(
"T
he daemon
"
,
"initialized successfully"
);
return
0
;
}
...
...
@@ -142,7 +142,7 @@ int32_t dmRunDnode(SDnode *pDnode) {
while
(
1
)
{
if
(
pDnode
->
stop
)
{
dInfo
(
"T
Dengine
is about to stop"
);
dInfo
(
"T
he daemon
is about to stop"
);
dmSetStatus
(
pDnode
,
DND_STAT_STOPPED
);
dmStopNodes
(
pDnode
);
dmCloseNodes
(
pDnode
);
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
c4b6a99c
...
...
@@ -353,6 +353,7 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
ret
=
tdbTbcGet
(
pTbDbc
,
NULL
,
NULL
,
&
pData
,
&
nData
);
if
(
ret
<
0
)
{
tdbTbcClose
(
pUidIdxc
);
tdbTbcClose
(
pTbDbc
);
terrno
=
TSDB_CODE_TDB_STB_NOT_EXIST
;
...
...
@@ -1210,6 +1211,8 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
ret
=
metaDecodeEntry
(
&
dc
,
&
entry
);
if
(
ret
!=
0
)
{
tDecoderClear
(
&
dc
);
tdbTbcClose
(
pUidIdxc
);
tdbTbcClose
(
pTbDbc
);
metaError
(
"meta/table: invalide ret: %"
PRId32
" alt tb options failed."
,
ret
);
return
-
1
;
}
...
...
source/dnode/vnode/src/sma/smaOpen.c
浏览文件 @
c4b6a99c
...
...
@@ -148,10 +148,6 @@ int32_t smaOpen(SVnode *pVnode, int8_t rollback) {
SMA_OPEN_RSMA_IMPL
(
pVnode
,
1
);
}
else
if
(
i
==
TSDB_RETENTION_L2
)
{
SMA_OPEN_RSMA_IMPL
(
pVnode
,
2
);
}
else
{
code
=
TSDB_CODE_APP_ERROR
;
smaError
(
"vgId:%d, sma open failed since %s, level:%d"
,
TD_VID
(
pVnode
),
tstrerror
(
code
),
i
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
...
...
source/dnode/vnode/src/sma/smaSnapshot.c
浏览文件 @
c4b6a99c
...
...
@@ -237,8 +237,8 @@ int32_t rsmaSnapRead(SRSmaSnapReader* pReader, uint8_t** ppData) {
_exit:
if
(
code
)
{
rsmaSnapReaderClose
(
&
pReader
);
smaError
(
"vgId:%d, vnode snapshot rsma read failed since %s"
,
SMA_VID
(
pReader
->
pSma
),
tstrerror
(
code
));
rsmaSnapReaderClose
(
&
pReader
);
}
else
{
smaInfo
(
"vgId:%d, vnode snapshot rsma read succeed"
,
SMA_VID
(
pReader
->
pSma
));
}
...
...
@@ -432,7 +432,7 @@ _exit:
if
(
pInFD
)
taosCloseFile
(
&
pInFD
);
smaError
(
"vgId:%d, vnode snapshot rsma writer close failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
code
));
}
else
{
smaInfo
(
"vgId:%d, vnode snapshot rsma writer close succeed"
,
SMA_VID
(
pSma
)
);
smaInfo
(
"vgId:%d, vnode snapshot rsma writer close succeed"
,
pSma
?
SMA_VID
(
pSma
)
:
0
);
}
return
code
;
...
...
source/libs/function/inc/tpercentile.h
浏览文件 @
c4b6a99c
...
...
@@ -73,7 +73,7 @@ void tMemBucketDestroy(tMemBucket *pBucket);
int32_t
tMemBucketPut
(
tMemBucket
*
pBucket
,
const
void
*
data
,
size_t
size
);
double
getPercentile
(
tMemBucket
*
pMemBucket
,
double
percen
t
);
int32_t
getPercentile
(
tMemBucket
*
pMemBucket
,
double
percent
,
double
*
resul
t
);
#endif // TDENGINE_TPERCENTILE_H
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
c4b6a99c
...
...
@@ -1670,15 +1670,14 @@ int32_t percentileFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
tMemBucket
*
pMemBucket
=
ppInfo
->
pMemBucket
;
if
(
pMemBucket
!=
NULL
&&
pMemBucket
->
total
>
0
)
{
// check for null
SET_DOUBLE_VAL
(
&
ppInfo
->
result
,
getPercentile
(
pMemBucket
,
v
));
}
int32_t
code
=
getPercentile
(
pMemBucket
,
v
,
&
ppInfo
->
result
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tMemBucketDestroy
(
pMemBucket
);
if
(
ppInfo
->
result
<
0
)
{
return
TSDB_CODE_NO_AVAIL_DISK
;
return
code
;
}
}
tMemBucketDestroy
(
pMemBucket
);
return
functionFinalize
(
pCtx
,
pBlock
);
}
...
...
source/libs/function/src/tpercentile.c
浏览文件 @
c4b6a99c
...
...
@@ -97,7 +97,7 @@ static void resetPosInfo(SSlotInfo *pInfo) {
pInfo
->
data
=
NULL
;
}
double
findOnlyResult
(
tMemBucket
*
pMemBucke
t
)
{
int32_t
findOnlyResult
(
tMemBucket
*
pMemBucket
,
double
*
resul
t
)
{
ASSERT
(
pMemBucket
->
total
==
1
);
for
(
int32_t
i
=
0
;
i
<
pMemBucket
->
numOfSlots
;
++
i
)
{
...
...
@@ -115,17 +115,17 @@ double findOnlyResult(tMemBucket *pMemBucket) {
int32_t
*
pageId
=
taosArrayGet
(
list
,
0
);
SFilePage
*
pPage
=
getBufPage
(
pMemBucket
->
pBuffer
,
*
pageId
);
if
(
pPage
==
NULL
)
{
return
-
1
;
return
TSDB_CODE_NO_AVAIL_DISK
;
}
ASSERT
(
pPage
->
num
==
1
);
double
v
=
0
;
GET_TYPED_DATA
(
v
,
double
,
pMemBucket
->
type
,
pPage
->
data
);
return
v
;
GET_TYPED_DATA
(
*
result
,
double
,
pMemBucket
->
type
,
pPage
->
data
);
return
TSDB_CODE_SUCCESS
;
}
}
return
0
;
*
result
=
0
.
0
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
tBucketIntHash
(
tMemBucket
*
pBucket
,
const
void
*
value
)
{
...
...
@@ -447,7 +447,7 @@ static double getIdenticalDataVal(tMemBucket *pMemBucket, int32_t slotIndex) {
return
finalResult
;
}
double
getPercentileImpl
(
tMemBucket
*
pMemBucket
,
int32_t
count
,
double
fraction
)
{
int32_t
getPercentileImpl
(
tMemBucket
*
pMemBucket
,
int32_t
count
,
double
fraction
,
double
*
result
)
{
int32_t
num
=
0
;
for
(
int32_t
i
=
0
;
i
<
pMemBucket
->
numOfSlots
;
++
i
)
{
...
...
@@ -480,15 +480,15 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
ASSERT
(
minOfNextSlot
>
maxOfThisSlot
);
double
val
=
(
1
-
fraction
)
*
maxOfThisSlot
+
fraction
*
minOfNextSlot
;
return
val
;
*
result
=
(
1
-
fraction
)
*
maxOfThisSlot
+
fraction
*
minOfNextSlot
;
return
TSDB_CODE_SUCCESS
;
}
if
(
pSlot
->
info
.
size
<=
pMemBucket
->
maxCapacity
)
{
// data in buffer and file are merged together to be processed.
SFilePage
*
buffer
=
loadDataFromFilePage
(
pMemBucket
,
i
);
if
(
buffer
==
NULL
)
{
return
-
1
;
return
TSDB_CODE_NO_AVAIL_DISK
;
}
int32_t
currentIdx
=
count
-
num
;
...
...
@@ -499,13 +499,14 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
GET_TYPED_DATA
(
td
,
double
,
pMemBucket
->
type
,
thisVal
);
GET_TYPED_DATA
(
nd
,
double
,
pMemBucket
->
type
,
nextVal
);
double
val
=
(
1
-
fraction
)
*
td
+
fraction
*
nd
;
*
result
=
(
1
-
fraction
)
*
td
+
fraction
*
nd
;
taosMemoryFreeClear
(
buffer
);
return
val
;
return
TSDB_CODE_SUCCESS
;
}
else
{
// incur a second round bucket split
if
(
isIdenticalData
(
pMemBucket
,
i
))
{
return
getIdenticalDataVal
(
pMemBucket
,
i
);
*
result
=
getIdenticalDataVal
(
pMemBucket
,
i
);
return
TSDB_CODE_SUCCESS
;
}
// try next round
...
...
@@ -534,37 +535,37 @@ double getPercentileImpl(tMemBucket *pMemBucket, int32_t count, double fraction)
int32_t
*
pageId
=
taosArrayGet
(
list
,
f
);
SFilePage
*
pg
=
getBufPage
(
pMemBucket
->
pBuffer
,
*
pageId
);
if
(
pg
==
NULL
)
{
return
-
1
;
return
TSDB_CODE_NO_AVAIL_DISK
;
}
int32_t
code
=
tMemBucketPut
(
pMemBucket
,
pg
->
data
,
(
int32_t
)
pg
->
num
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
-
1
;
return
code
;
}
setBufPageDirty
(
pg
,
true
);
releaseBufPage
(
pMemBucket
->
pBuffer
,
pg
);
}
return
getPercentileImpl
(
pMemBucket
,
count
-
num
,
fraction
);
return
getPercentileImpl
(
pMemBucket
,
count
-
num
,
fraction
,
result
);
}
}
else
{
num
+=
pSlot
->
info
.
size
;
}
}
return
0
;
*
result
=
0
;
return
TSDB_CODE_SUCCESS
;
}
double
getPercentile
(
tMemBucket
*
pMemBucket
,
double
percen
t
)
{
int32_t
getPercentile
(
tMemBucket
*
pMemBucket
,
double
percent
,
double
*
resul
t
)
{
if
(
pMemBucket
->
total
==
0
)
{
return
0
.
0
;
*
result
=
0
.
0
;
return
TSDB_CODE_SUCCESS
;
}
// if only one elements exists, return it
if
(
pMemBucket
->
total
==
1
)
{
if
(
findOnlyResult
(
pMemBucket
)
<
0
)
{
return
-
1
;
}
return
findOnlyResult
(
pMemBucket
,
result
);
}
percent
=
fabs
(
percent
);
...
...
@@ -574,21 +575,21 @@ double getPercentile(tMemBucket *pMemBucket, double percent) {
MinMaxEntry
*
pRange
=
&
pMemBucket
->
range
;
if
(
IS_SIGNED_NUMERIC_TYPE
(
pMemBucket
->
type
))
{
double
v
=
(
double
)(
fabs
(
percent
-
100
)
<
DBL_EPSILON
?
pRange
->
i64MaxVal
:
pRange
->
i64MinVal
);
return
v
;
*
result
=
(
double
)(
fabs
(
percent
-
100
)
<
DBL_EPSILON
?
pRange
->
i64MaxVal
:
pRange
->
i64MinVal
);
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
pMemBucket
->
type
))
{
double
v
=
(
double
)(
fabs
(
percent
-
100
)
<
DBL_EPSILON
?
pRange
->
u64MaxVal
:
pRange
->
u64MinVal
);
return
v
;
*
result
=
(
double
)(
fabs
(
percent
-
100
)
<
DBL_EPSILON
?
pRange
->
u64MaxVal
:
pRange
->
u64MinVal
);
}
else
{
return
fabs
(
percent
-
100
)
<
DBL_EPSILON
?
pRange
->
dMaxVal
:
pRange
->
dMinVal
;
*
result
=
fabs
(
percent
-
100
)
<
DBL_EPSILON
?
pRange
->
dMaxVal
:
pRange
->
dMinVal
;
}
return
TSDB_CODE_SUCCESS
;
}
double
percentVal
=
(
percent
*
(
pMemBucket
->
total
-
1
))
/
((
double
)
100
.
0
);
// do put data by using buckets
int32_t
orderIdx
=
(
int32_t
)
percentVal
;
return
getPercentileImpl
(
pMemBucket
,
orderIdx
,
percentVal
-
orderIdx
);
return
getPercentileImpl
(
pMemBucket
,
orderIdx
,
percentVal
-
orderIdx
,
result
);
}
/*
...
...
source/os/src/osFile.c
浏览文件 @
c4b6a99c
...
...
@@ -368,6 +368,9 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
#endif
ASSERT
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
if
(
pFile
->
fd
<
0
)
{
#if FILE_WITH_LOCK
taosThreadRwlockUnlock
(
&
(
pFile
->
rwlock
));
#endif
return
-
1
;
}
int64_t
leftbytes
=
count
;
...
...
@@ -415,6 +418,9 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
#endif
ASSERT
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
if
(
pFile
->
fd
<
0
)
{
#if FILE_WITH_LOCK
taosThreadRwlockUnlock
(
&
(
pFile
->
rwlock
));
#endif
return
-
1
;
}
#ifdef WINDOWS
...
...
@@ -479,6 +485,9 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
#endif
ASSERT
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
if
(
pFile
->
fd
<
0
)
{
#if FILE_WITH_LOCK
taosThreadRwlockUnlock
(
&
(
pFile
->
rwlock
));
#endif
return
0
;
}
#ifdef WINDOWS
...
...
source/os/src/osLocale.c
浏览文件 @
c4b6a99c
...
...
@@ -71,7 +71,7 @@ char *taosCharsetReplace(char *charsetstr) {
* seems does not response as expected.
*
* In some Linux systems, setLocale(LC_CTYPE, "") may return NULL, in which case the launch of
* both the
TDengine
Server and the Client may be interrupted.
* both the Server and the Client may be interrupted.
*
* In case that the setLocale failed to be executed, the right charset needs to be set.
*/
...
...
source/os/src/osString.c
浏览文件 @
c4b6a99c
...
...
@@ -217,7 +217,7 @@ void taosReleaseConv(int32_t idx, iconv_t conv, ConvType type) {
bool
taosMbsToUcs4
(
const
char
*
mbs
,
size_t
mbsLength
,
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
int32_t
*
len
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile
TDengine
.
\n
"
);
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile.
\n
"
);
return
-
1
;
#else
memset
(
ucs4
,
0
,
ucs4_max_len
);
...
...
@@ -245,7 +245,7 @@ bool taosMbsToUcs4(const char *mbs, size_t mbsLength, TdUcs4 *ucs4, int32_t ucs4
int32_t
taosUcs4ToMbs
(
TdUcs4
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile
TDengine
.
\n
"
);
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile.
\n
"
);
return
-
1
;
#else
...
...
@@ -263,7 +263,7 @@ int32_t taosUcs4ToMbs(TdUcs4 *ucs4, int32_t ucs4_max_len, char *mbs) {
}
bool
taosValidateEncodec
(
const
char
*
encodec
)
{
#ifdef DISALLOW_NCHAR_WITHOUT_ICONV
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile
TDengine
.
\n
"
);
printf
(
"Nchar cannot be read and written without iconv, please install iconv library and recompile.
\n
"
);
return
true
;
#else
iconv_t
cd
=
iconv_open
(
encodec
,
DEFAULT_UNICODE_ENCODEC
);
...
...
source/util/src/terror.c
浏览文件 @
c4b6a99c
...
...
@@ -138,6 +138,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSC_QUERY_KILLED, "Query killed")
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_NO_EXEC_NODE
,
"No available execution node in current query policy configuration"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_NOT_STABLE_ERROR
,
"Table is not a super table"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_STMT_CACHE_ERROR
,
"Stmt cache error"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSC_INTERNAL_ERROR
,
"Internal error"
)
// mnode-common
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_NO_RIGHTS
,
"Insufficient privilege for operation"
)
...
...
@@ -578,6 +579,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SML_INVALID_PRECISION_TYPE, "Invalid timestamp p
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_INVALID_DATA
,
"Invalid data format"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_INVALID_DB_CONF
,
"Invalid schemaless db config"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_NOT_SAME_TYPE
,
"Not the same type like before"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_SML_INTERNAL_ERROR
,
"Internal error"
)
//tsma
TAOS_DEFINE_ERROR
(
TSDB_CODE_TSMA_INIT_FAILED
,
"Tsma init failed"
)
...
...
tools/shell/CMakeLists.txt
浏览文件 @
c4b6a99c
...
...
@@ -26,6 +26,10 @@ ELSE ()
SET
(
LINK_WEBSOCKET
""
)
ENDIF
()
IF
(
CUS_NAME OR CUS_PROMPT
)
ADD_DEFINITIONS
(
-I
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../../enterprise/packaging
)
ENDIF
(
CUS_NAME
)
if
(
TD_WINDOWS
)
target_link_libraries
(
shell PUBLIC taos_static
${
LINK_WEBSOCKET
}
)
else
()
...
...
tools/shell/inc/shellAuto.h
浏览文件 @
c4b6a99c
...
...
@@ -24,13 +24,13 @@ void pressTabKey(SShellCmd* cmd);
// press othr key
void
pressOtherKey
(
char
c
);
// init shell auto func
it
on , shell start call once
// init shell auto func
ti
on , shell start call once
bool
shellAutoInit
();
// set conn
void
shellSetConn
(
TAOS
*
conn
);
// exit shell auto func
it
on, shell exit call once
// exit shell auto func
ti
on, shell exit call once
void
shellAutoExit
();
// callback autotab module
...
...
tools/shell/inc/shellInt.h
浏览文件 @
c4b6a99c
...
...
@@ -80,8 +80,9 @@ typedef struct {
}
SShellArgs
;
typedef
struct
{
const
char
*
clientVersion
;
const
char
*
promptHeader
;
const
char
*
clientVersion
;
char
cusName
[
32
];
char
promptHeader
[
32
];
const
char
*
promptContinue
;
const
char
*
osname
;
int32_t
promptSize
;
...
...
tools/shell/inc/shellTire.h
浏览文件 @
c4b6a99c
...
...
@@ -19,7 +19,7 @@
//
// The prefix search tree is a efficient storage words and search words tree, it support 95 visible ascii code character
//
#define FIRST_ASCII 40 // first visi
a
ble char is '0'
#define FIRST_ASCII 40 // first visible char is '0'
#define LAST_ASCII 122 // last visilbe char is 'z'
// capacity save char is 95
...
...
tools/shell/src/shellArguments.c
浏览文件 @
c4b6a99c
...
...
@@ -19,10 +19,25 @@
#include "shellInt.h"
#define TAOS_CONSOLE_PROMPT_HEADER "taos> "
#ifndef CUS_NAME
char
cusName
[]
=
"TDengine"
;
#endif
#ifndef CUS_PROMPT
char
cusPrompt
[]
=
"taos"
;
#endif
#ifndef CUS_EMAIL
char
cusEmail
[]
=
"<support@taosdata.com>"
;
#endif
#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL)
#include "cus_name.h"
#endif
#define TAOS_CONSOLE_PROMPT_CONTINUE " -> "
#define SHELL_HOST "T
Dengin
e server FQDN to connect. The default host is localhost."
#define SHELL_HOST "T
h
e server FQDN to connect. The default host is localhost."
#define SHELL_PORT "The TCP/IP port number to use for the connection."
#define SHELL_USER "The user name to use when connecting to the server."
#define SHELL_PASSWORD "The password to use when connecting to the server."
...
...
@@ -41,7 +56,6 @@
#define SHELL_PKT_LEN "Packet length used for net test, default is 1024 bytes."
#define SHELL_PKT_NUM "Packet numbers used for net test, default is 100."
#define SHELL_VERSION "Print program version."
#define SHELL_EMAIL "<support@taosdata.com>"
#ifdef WEBSOCKET
#define SHELL_DSN "The dsn to use when connecting to cloud server."
...
...
@@ -78,7 +92,7 @@ void shellPrintHelp() {
#endif
printf
(
"%s%s%s%s
\r\n
"
,
indent
,
"-w,"
,
indent
,
SHELL_WIDTH
);
printf
(
"%s%s%s%s
\r\n
"
,
indent
,
"-V,"
,
indent
,
SHELL_VERSION
);
printf
(
"
\r\n\r\n
Report bugs to %s.
\r\n
"
,
SHELL_EMAIL
);
printf
(
"
\r\n\r\n
Report bugs to %s.
\r\n
"
,
cusEmail
);
}
#ifdef LINUX
...
...
@@ -86,7 +100,7 @@ void shellPrintHelp() {
#include <termio.h>
const
char
*
argp_program_version
=
version
;
const
char
*
argp_program_bug_address
=
SHELL_EMAIL
;
const
char
*
argp_program_bug_address
=
cusEmail
;
static
struct
argp_option
shellOptions
[]
=
{
{
"host"
,
'h'
,
"HOST"
,
0
,
SHELL_HOST
},
...
...
@@ -389,11 +403,12 @@ static int32_t shellCheckArgs() {
int32_t
shellParseArgs
(
int32_t
argc
,
char
*
argv
[])
{
shellInitArgs
(
argc
,
argv
);
shell
.
info
.
clientVersion
=
"Welcome to the TDengine Command Line Interface, Client Version:%s
\r\n
"
"Copyright (c) 2022 by TDengine, all rights reserved.
\r\n\r\n
"
;
shell
.
info
.
promptHeader
=
TAOS_CONSOLE_PROMPT_HEADER
;
"Welcome to the %s Command Line Interface, Client Version:%s
\r\n
"
"Copyright (c) 2022 by %s, all rights reserved.
\r\n\r\n
"
;
strcpy
(
shell
.
info
.
cusName
,
cusName
);
sprintf
(
shell
.
info
.
promptHeader
,
"%s> "
,
cusPrompt
);
shell
.
info
.
promptContinue
=
TAOS_CONSOLE_PROMPT_CONTINUE
;
shell
.
info
.
promptSize
=
6
;
shell
.
info
.
promptSize
=
strlen
(
shell
.
info
.
promptHeader
)
;
snprintf
(
shell
.
info
.
programVersion
,
sizeof
(
shell
.
info
.
programVersion
),
"version: %s"
,
version
);
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
...
...
tools/shell/src/shellAuto.c
浏览文件 @
c4b6a99c
...
...
@@ -264,7 +264,7 @@ char* key_tags[] = {"tags("};
char
*
key_select
[]
=
{
"select "
};
//
// ------- gobal variant define ---------
// ------- g
l
obal variant define ---------
//
int32_t
firstMatchIndex
=
-
1
;
// first match shellCommands index
int32_t
lastMatchIndex
=
-
1
;
// last match shellCommands index
...
...
@@ -329,7 +329,15 @@ int cntDel = 0; // delete byte count after next press tab
// show auto tab introduction
void
printfIntroduction
()
{
printf
(
" ****************************** Tab Completion **********************************
\n
"
);
printf
(
" * The TDengine CLI supports tab completion for a variety of items, *
\n
"
);
char
secondLine
[
160
]
=
"
\0
"
;
sprintf
(
secondLine
,
" * The %s CLI supports tab completion for a variety of items, "
,
shell
.
info
.
cusName
);
printf
(
"%s"
,
secondLine
);
int
secondLineLen
=
strlen
(
secondLine
);
while
(
84
-
(
secondLineLen
++
)
>
0
)
{
printf
(
" "
);
}
printf
(
"*
\n
"
);
printf
(
" * including database names, table names, function names and keywords. *
\n
"
);
printf
(
" * The full list of shortcut keys is as follows: *
\n
"
);
printf
(
" * [ TAB ] ...... complete the current word *
\n
"
);
...
...
@@ -344,7 +352,7 @@ void printfIntroduction() {
}
void
showHelp
()
{
printf
(
"
\n
The
TDengine CLI supports the following commands:"
);
printf
(
"
\n
The
%s CLI supports the following commands:"
,
shell
.
info
.
cusName
);
printf
(
"
\n
\
----- A -----
\n
\
...
...
@@ -595,7 +603,7 @@ void GenerateVarType(int type, char** p, int count) {
// -------------------- shell auto ----------------
//
// init shell auto func
it
on , shell start call once
// init shell auto func
ti
on , shell start call once
bool
shellAutoInit
()
{
// command
int32_t
count
=
SHELL_COMMAND_COUNT
();
...
...
@@ -628,7 +636,7 @@ bool shellAutoInit() {
// set conn
void
shellSetConn
(
TAOS
*
conn
)
{
varCon
=
conn
;
}
// exit shell auto func
it
on, shell exit call once
// exit shell auto func
ti
on, shell exit call once
void
shellAutoExit
()
{
// free command
int32_t
count
=
SHELL_COMMAND_COUNT
();
...
...
@@ -645,7 +653,7 @@ void shellAutoExit() {
}
}
taosThreadMutexUnlock
(
&
tiresMutex
);
// dest
or
y
// dest
ro
y
taosThreadMutexDestroy
(
&
tiresMutex
);
// free threads
...
...
@@ -666,7 +674,7 @@ void shellAutoExit() {
//
// ------------------- auto ptr for tires --------------------------
//
bool
setNewAu
ot
Ptr
(
int
type
,
STire
*
pNew
)
{
bool
setNewAu
to
Ptr
(
int
type
,
STire
*
pNew
)
{
if
(
pNew
==
NULL
)
return
false
;
taosThreadMutexLock
(
&
tiresMutex
);
...
...
@@ -709,16 +717,13 @@ void putBackAutoPtr(int type, STire* tire) {
if
(
tires
[
type
]
!=
tire
)
{
// update by out, can't put back , so free
if
(
--
tire
->
ref
==
1
)
{
// support multi thread getAu
ot
Ptr
// support multi thread getAu
to
Ptr
freeTire
(
tire
);
}
}
else
{
tires
[
type
]
->
ref
--
;
ASSERT
(
tires
[
type
]
->
ref
>
0
);
if
(
tires
[
type
]
->
ref
<=
0
)
{
return
;
}
}
taosThreadMutexUnlock
(
&
tiresMutex
);
...
...
@@ -767,7 +772,7 @@ int writeVarNames(int type, TAOS_RES* tres) {
}
while
(
row
!=
NULL
);
// replace old tire
setNewAu
ot
Ptr
(
type
,
tire
);
setNewAu
to
Ptr
(
type
,
tire
);
return
numOfRows
;
}
...
...
@@ -1035,7 +1040,7 @@ SWords* matchCommand(SWords* input, bool continueSearch) {
for
(
int32_t
i
=
0
;
i
<
count
;
i
++
)
{
SWords
*
shellCommand
=
shellCommands
+
i
;
if
(
continueSearch
&&
lastMatchIndex
!=
-
1
&&
i
<=
lastMatchIndex
)
{
// new match must greate than lastMatchIndex
// new match must greate
r
than lastMatchIndex
if
(
varMode
&&
i
==
lastMatchIndex
)
{
// do nothing, var match on lastMatchIndex
}
else
{
...
...
@@ -1164,7 +1169,7 @@ void createInputFromFirst(SWords* input, SWords* firstMatch) {
for
(
int
i
=
0
;
i
<
firstMatch
->
matchIndex
&&
word
;
i
++
)
{
// combine source from each word
strncpy
(
input
->
source
+
input
->
source_len
,
word
->
word
,
word
->
len
);
strcat
(
input
->
source
,
" "
);
// append blank sp
lit
e
strcat
(
input
->
source
,
" "
);
// append blank sp
ac
e
input
->
source_len
+=
word
->
len
+
1
;
// 1 is blank length
// move next
word
=
word
->
next
;
...
...
@@ -1393,7 +1398,7 @@ bool appendAfterSelect(TAOS* con, SShellCmd* cmd, char* sql, int32_t len) {
return
true
;
}
// fill func
it
on
// fill func
ti
on
if
(
fieldEnd
)
{
// fields is end , need match keyword
ret
=
fillWithType
(
con
,
cmd
,
last
,
WT_VAR_KEYWORD
);
...
...
@@ -1576,7 +1581,7 @@ bool matchCreateTable(TAOS* con, SShellCmd* cmd) {
// tb options
if
(
!
ret
)
{
// find like create ta
lb
e st (...) tags(..) <here is fill tb option area>
// find like create ta
bl
e st (...) tags(..) <here is fill tb option area>
char
*
p1
=
strchr
(
ps
,
')'
);
// first ')' end
if
(
p1
)
{
if
(
strchr
(
p1
+
1
,
')'
))
{
// second ')' end
...
...
tools/shell/src/shellEngine.c
浏览文件 @
c4b6a99c
...
...
@@ -1072,7 +1072,8 @@ void *shellThreadLoop(void *arg) {
}
int32_t
shellExecute
()
{
printf
(
shell
.
info
.
clientVersion
,
taos_get_client_info
());
printf
(
shell
.
info
.
clientVersion
,
shell
.
info
.
cusName
,
taos_get_client_info
(),
shell
.
info
.
cusName
);
fflush
(
stdout
);
SShellArgs
*
pArgs
=
&
shell
.
args
;
...
...
@@ -1127,7 +1128,7 @@ int32_t shellExecute() {
}
if
(
tsem_init
(
&
shell
.
cancelSem
,
0
,
0
)
!=
0
)
{
printf
(
"failed to create cancel semphore
\r\n
"
);
printf
(
"failed to create cancel sem
a
phore
\r\n
"
);
return
-
1
;
}
...
...
tools/shell/src/shellUtil.c
浏览文件 @
c4b6a99c
...
...
@@ -50,19 +50,19 @@ bool shellRegexMatch(const char *s, const char *reg, int32_t cflags) {
int32_t
shellCheckIntSize
()
{
if
(
sizeof
(
int8_t
)
!=
1
)
{
printf
(
"
taos
int8 size is %d(!= 1)"
,
(
int
)
sizeof
(
int8_t
));
printf
(
"int8 size is %d(!= 1)"
,
(
int
)
sizeof
(
int8_t
));
return
-
1
;
}
if
(
sizeof
(
int16_t
)
!=
2
)
{
printf
(
"
taos
int16 size is %d(!= 2)"
,
(
int
)
sizeof
(
int16_t
));
printf
(
"int16 size is %d(!= 2)"
,
(
int
)
sizeof
(
int16_t
));
return
-
1
;
}
if
(
sizeof
(
int32_t
)
!=
4
)
{
printf
(
"
taos
int32 size is %d(!= 4)"
,
(
int
)
sizeof
(
int32_t
));
printf
(
"int32 size is %d(!= 4)"
,
(
int
)
sizeof
(
int32_t
));
return
-
1
;
}
if
(
sizeof
(
int64_t
)
!=
8
)
{
printf
(
"
taos
int64 size is %d(!= 8)"
,
(
int
)
sizeof
(
int64_t
));
printf
(
"int64 size is %d(!= 8)"
,
(
int
)
sizeof
(
int64_t
));
return
-
1
;
}
return
0
;
...
...
@@ -80,7 +80,7 @@ void shellGenerateAuth() {
void
shellDumpConfig
()
{
SConfig
*
pCfg
=
taosGetCfg
();
if
(
pCfg
==
NULL
)
{
printf
(
"
TDengine
read global config failed!
\r\n
"
);
printf
(
"read global config failed!
\r\n
"
);
}
else
{
cfgDumpCfg
(
pCfg
,
1
,
true
);
}
...
...
tools/shell/src/shellWebsocket.c
浏览文件 @
c4b6a99c
...
...
@@ -235,7 +235,7 @@ void shellRunSingleCommandWebsocketImp(char *command) {
if
(
reconnectNum
==
0
)
{
continue
;
}
else
{
fprintf
(
stderr
,
"T
Dengin
e server is disconnected, will try to reconnect
\n
"
);
fprintf
(
stderr
,
"T
h
e server is disconnected, will try to reconnect
\n
"
);
}
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录