Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
51259460
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
51259460
编写于
11月 11, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
差异文件
merge from master
上级
c0a989fe
7fd66c21
变更
85
展开全部
显示空白变更内容
内联
并排
Showing
85 changed file
with
4548 addition
and
3462 deletion
+4548
-3462
.gitignore
.gitignore
+4
-0
Jenkinsfile
Jenkinsfile
+158
-33
cmake/define.inc
cmake/define.inc
+7
-2
cmake/install.inc
cmake/install.inc
+2
-4
cmake/platform.inc
cmake/platform.inc
+10
-5
cmake/version.inc
cmake/version.inc
+1
-1
documentation20/cn/09.connections/docs.md
documentation20/cn/09.connections/docs.md
+19
-9
documentation20/cn/14.devops/01.telegraf/docs.md
documentation20/cn/14.devops/01.telegraf/docs.md
+73
-0
documentation20/cn/14.devops/02.collectd/docs.md
documentation20/cn/14.devops/02.collectd/docs.md
+79
-0
documentation20/cn/images/connections/dashboard-15146.png
documentation20/cn/images/connections/dashboard-15146.png
+0
-0
documentation20/en/09.connections/docs.md
documentation20/en/09.connections/docs.md
+10
-5
documentation20/en/images/connections/dashboard-15146.png
documentation20/en/images/connections/dashboard-15146.png
+0
-0
packaging/deb/makedeb.sh
packaging/deb/makedeb.sh
+0
-6
packaging/release.sh
packaging/release.sh
+1
-0
packaging/rpm/tdengine.spec
packaging/rpm/tdengine.spec
+0
-6
packaging/tools/make_install.sh
packaging/tools/make_install.sh
+0
-5
packaging/tools/makeclient.sh
packaging/tools/makeclient.sh
+0
-5
packaging/tools/makeclient_power.sh
packaging/tools/makeclient_power.sh
+0
-5
packaging/tools/makeclient_pro.sh
packaging/tools/makeclient_pro.sh
+0
-5
packaging/tools/makeclient_tq.sh
packaging/tools/makeclient_tq.sh
+0
-5
packaging/tools/makepkg.sh
packaging/tools/makepkg.sh
+0
-5
packaging/tools/makepkg_power.sh
packaging/tools/makepkg_power.sh
+0
-5
packaging/tools/makepkg_pro.sh
packaging/tools/makepkg_pro.sh
+0
-5
packaging/tools/makepkg_tq.sh
packaging/tools/makepkg_tq.sh
+0
-5
snap/snapcraft.yaml
snap/snapcraft.yaml
+2
-2
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-0
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+10
-3
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+61
-16
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+2
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+47
-27
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+44
-42
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+25
-11
src/common/src/tglobal.c
src/common/src/tglobal.c
+115
-105
src/connector/jdbc/pom.xml
src/connector/jdbc/pom.xml
+1
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
...dbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
+4
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java
...main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java
+15
-26
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/HttpClientPoolUtilTest.java
.../java/com/taosdata/jdbc/utils/HttpClientPoolUtilTest.java
+76
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-1
src/inc/ttokendef.h
src/inc/ttokendef.h
+1
-1
src/kit/shell/src/shellImport.c
src/kit/shell/src/shellImport.c
+1
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+339
-190
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+1
-1
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+0
-24
src/os/src/darwin/dwSysInfo.c
src/os/src/darwin/dwSysInfo.c
+2
-0
src/os/src/detail/osSysinfo.c
src/os/src/detail/osSysinfo.c
+2
-0
src/os/src/windows/wSysinfo.c
src/os/src/windows/wSysinfo.c
+11
-0
src/plugins/http/inc/httpInt.h
src/plugins/http/inc/httpInt.h
+23
-22
src/plugins/http/src/httpContext.c
src/plugins/http/src/httpContext.c
+5
-1
src/plugins/http/src/httpHandle.c
src/plugins/http/src/httpHandle.c
+5
-6
src/plugins/http/src/httpSql.c
src/plugins/http/src/httpSql.c
+7
-0
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+3
-0
src/query/inc/sql.y
src/query/inc/sql.y
+1
-7
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+1
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+2
-2
src/query/src/queryMain.c
src/query/src/queryMain.c
+7
-1
src/query/src/sql.c
src/query/src/sql.c
+2600
-2600
src/sync/src/syncRetrieve.c
src/sync/src/syncRetrieve.c
+1
-1
src/tsdb/inc/tsdbMeta.h
src/tsdb/inc/tsdbMeta.h
+1
-0
src/tsdb/inc/tsdbint.h
src/tsdb/inc/tsdbint.h
+4
-3
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+1
-1
src/tsdb/src/tsdbCommitQueue.c
src/tsdb/src/tsdbCommitQueue.c
+3
-1
src/tsdb/src/tsdbCompact.c
src/tsdb/src/tsdbCompact.c
+3
-1
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+120
-18
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+7
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+22
-18
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+38
-3
src/util/inc/tconfig.h
src/util/inc/tconfig.h
+1
-1
src/util/src/talgo.c
src/util/src/talgo.c
+1
-1
src/util/src/tcompare.c
src/util/src/tcompare.c
+7
-1
src/util/src/tlog.c
src/util/src/tlog.c
+1
-1
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/query/bug5903.py
tests/pytest/query/bug5903.py
+36
-0
tests/pytest/query/query.py
tests/pytest/query/query.py
+16
-0
tests/pytest/query/udf.py
tests/pytest/query/udf.py
+368
-123
tests/pytest/table/create.py
tests/pytest/table/create.py
+3
-0
tests/pytest/tools/taosdemoTestTblAlt.py
tests/pytest/tools/taosdemoTestTblAlt.py
+20
-9
tests/script/api/batchprepare.c
tests/script/api/batchprepare.c
+46
-3
tests/script/general/parser/udf_dll.sim
tests/script/general/parser/udf_dll.sim
+1
-1
tests/script/general/parser/udf_dll_stable.sim
tests/script/general/parser/udf_dll_stable.sim
+1
-1
tests/script/sh/abs_max.c
tests/script/sh/abs_max.c
+31
-26
tests/script/sh/add_one.c
tests/script/sh/add_one.c
+5
-7
tests/script/sh/add_one_64232.c
tests/script/sh/add_one_64232.c
+2
-4
tests/script/sh/sum_double.c
tests/script/sh/sum_double.c
+26
-26
tests/tsim/inc/sim.h
tests/tsim/inc/sim.h
+2
-2
未找到文件。
.gitignore
浏览文件 @
51259460
...
...
@@ -81,6 +81,10 @@ tests/comparisonTest/opentsdb/opentsdbtest/.settings/
tests/examples/JDBC/JDBCDemo/.classpath
tests/examples/JDBC/JDBCDemo/.project
tests/examples/JDBC/JDBCDemo/.settings/
tests/script/api/batchprepare
tests/script/api/stmt
tests/script/api/stmtBatchTest
tests/script/api/stmtTest
# Emacs
# -*- mode: gitignore; -*-
...
...
Jenkinsfile
浏览文件 @
51259460
...
...
@@ -111,6 +111,77 @@ def pre_test(){
'''
return
1
}
def
pre_test_noinstall
(){
sh
'hostname'
sh
'''
cd ${WKC}
git reset --hard HEAD~10 >/dev/null
'''
script
{
if
(
env
.
CHANGE_TARGET
==
'master'
)
{
sh
'''
cd ${WKC}
git checkout master
'''
}
else
if
(
env
.
CHANGE_TARGET
==
'2.0'
){
sh
'''
cd ${WKC}
git checkout 2.0
'''
}
else
{
sh
'''
cd ${WKC}
git checkout develop
'''
}
}
sh
'''
cd ${WKC}
git pull >/dev/null
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
git clean -dfx
git submodule update --init --recursive
cd ${WK}
git reset --hard HEAD~10
'''
script
{
if
(
env
.
CHANGE_TARGET
==
'master'
)
{
sh
'''
cd ${WK}
git checkout master
'''
}
else
if
(
env
.
CHANGE_TARGET
==
'2.0'
){
sh
'''
cd ${WK}
git checkout 2.0
'''
}
else
{
sh
'''
cd ${WK}
git checkout develop
'''
}
}
sh
'''
cd ${WK}
git pull >/dev/null
export TZ=Asia/Harbin
date
git clean -dfx
mkdir debug
cd debug
cmake .. > /dev/null
make
'''
return
1
}
def
pre_test_win
(){
bat
'''
taskkill /f /t /im python.exe
...
...
@@ -179,9 +250,9 @@ def pre_test_win(){
git clean -dfx
mkdir debug
cd debug
call "C:\\Program Files (x86)\\Microsoft Visual Studio
14.0\\VC
\\vcvarsall.bat" amd64
call "C:\\Program Files (x86)\\Microsoft Visual Studio
\\2017\\Community\\VC\\Auxiliary\\Build
\\vcvarsall.bat" amd64
cmake ../ -G "NMake Makefiles"
nmake || exit 8
set CL=/MP nmake
nmake || exit 8
nmake install || exit 8
xcopy /e/y/i/f C:\\workspace\\TDinternal\\debug\\build\\lib\\taos.dll C:\\Windows\\System32 || exit 8
cd C:\\workspace\\TDinternal\\community\\src\\connector\\python
...
...
@@ -290,7 +361,7 @@ pipeline {
stage
(
'python_3_s6'
)
{
agent
{
label
" slave6 || slave16 "
}
steps
{
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
timeout
(
time:
6
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
@@ -396,7 +467,7 @@ pipeline {
stage
(
'test_b4_s7'
)
{
agent
{
label
" slave7 || slave17 "
}
steps
{
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
timeout
(
time:
10
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
@@ -428,7 +499,7 @@ pipeline {
stage
(
'test_b6_s9'
)
{
agent
{
label
" slave9 || slave19 "
}
steps
{
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
timeout
(
time:
10
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
@@ -451,36 +522,90 @@ pipeline {
}
}
}
stage
(
'arm64centos7'
)
{
agent
{
label
" arm64centos7 "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'arm64centos8'
)
{
agent
{
label
" arm64centos8 "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'arm32bionic'
)
{
agent
{
label
" arm32bionic "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'arm64bionic'
)
{
agent
{
label
" arm64bionic "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'arm64focal'
)
{
agent
{
label
" arm64focal "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'centos7'
)
{
agent
{
label
" centos7 "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'ubuntu:trusty'
)
{
agent
{
label
" trusty "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'ubuntu:xenial'
)
{
agent
{
label
" xenial "
}
steps
{
pre_test_noinstall
()
}
}
stage
(
'ubuntu:bionic'
)
{
agent
{
label
" bionic "
}
steps
{
pre_test_noinstall
()
}
}
//
stage('build'){
//
agent{label " wintest "}
//
steps {
//
pre_test()
//
script{
//
while(win_stop == 0){
//
sleep(1)
//
}
//
}
//
}
//
}
//
stage('test'){
//
agent{label "win"}
//
steps{
stage
(
'build'
){
agent
{
label
" wintest "
}
steps
{
pre_test
()
script
{
while
(
win_stop
==
0
){
sleep
(
1
)
}
}
}
}
stage
(
'test'
){
agent
{
label
"win"
}
steps
{
//
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
//
pre_test_win()
//
timeout(time: 20, unit: 'MINUTES'){
//
bat'''
//
cd C:\\workspace\\TDinternal\\community\\tests\\pytest
// .\\test-all.bat W
intest
//
'''
//
}
//
}
//
script{
//
win_stop=1
//
}
//
}
//
}
catchError
(
buildResult:
'FAILURE'
,
stageResult:
'FAILURE'
)
{
pre_test_win
()
timeout
(
time:
20
,
unit:
'MINUTES'
){
bat
'''
cd C:\\workspace\\TDinternal\\community\\tests\\pytest
.\\test-all.bat w
intest
'''
}
}
script
{
win_stop
=
1
}
}
}
}
...
...
cmake/define.inc
浏览文件 @
51259460
...
...
@@ -117,7 +117,7 @@ IF (TD_MIPS_32)
SET
(
COMMON_FLAGS
"-Wall -Werror -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGE_FILE"
)
ENDIF
()
IF
(
TD_A
PLH
INE
)
IF
(
TD_A
LP
INE
)
SET
(
COMMON_FLAGS
"${COMMON_FLAGS} -largp"
)
link_libraries
(
/
usr
/
lib
/
libargp
.
a
)
ADD_DEFINITIONS
(
-
D_ALPINE
)
...
...
@@ -136,7 +136,12 @@ IF (TD_LINUX)
ENDIF
()
IF
(
TD_MEMORY_SANITIZER
)
IF
(
TD_ARCHLINUX
)
SET
(
DEBUG_FLAGS
"-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -O0 -g3 -DDEBUG"
)
ELSE
()
SET
(
DEBUG_FLAGS
"-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment -static-libasan -O0 -g3 -DDEBUG"
)
ENDIF
()
MESSAGE
(
STATUS
"${BoldRed}Will compile with memory sanitizer! ${ColourReset}"
)
ELSE
()
SET
(
DEBUG_FLAGS
"-O0 -g3 -DDEBUG"
)
ENDIF
()
...
...
cmake/install.inc
浏览文件 @
51259460
IF
(
TD_LINUX
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"execute_process(COMMAND chmod 777 ${TD_MAKE_INSTALL_SH})"
)
INSTALL
(
CODE
"execute_process(COMMAND ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})"
)
INSTALL
(
CODE
"execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})"
)
ELSEIF
(
TD_WINDOWS
)
IF
(
TD_POWER
)
SET
(
CMAKE_INSTALL_PREFIX
C
:/
PowerDB
)
...
...
@@ -41,6 +40,5 @@ ELSEIF (TD_WINDOWS)
ELSEIF
(
TD_DARWIN
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_COMMUNITY_DIR}/packaging/tools/make_install.sh"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"execute_process(COMMAND chmod 777 ${TD_MAKE_INSTALL_SH})"
)
INSTALL
(
CODE
"execute_process(COMMAND ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Darwin ${TD_VER_NUMBER})"
)
INSTALL
(
CODE
"execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_COMMUNITY_DIR} ${PROJECT_BINARY_DIR} Darwin ${TD_VER_NUMBER})"
)
ENDIF
()
cmake/platform.inc
浏览文件 @
51259460
...
...
@@ -21,7 +21,7 @@ SET(TD_LINUX FALSE)
SET
(
TD_ARM_32
FALSE
)
SET
(
TD_MIPS_64
FALSE
)
SET
(
TD_MIPS_32
FALSE
)
SET
(
TD_A
PLH
INE
FALSE
)
SET
(
TD_A
LP
INE
FALSE
)
SET
(
TD_NINGSI
FALSE
)
SET
(
TD_NINGSI_60
FALSE
)
SET
(
TD_NINGSI_80
FALSE
)
...
...
@@ -36,7 +36,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
# Get OS information and store in variable TD_OS_INFO.
#
execute_process
(
COMMAND
chmod
777
$
{
TD_COMMUNITY_DIR
}
/
packaging
/
tools
/
get_os
.
sh
)
execute_process
(
COMMAND
$
{
TD_COMMUNITY_DIR
}
/
packaging
/
tools
/
get_os
.
sh
""
OUTPUT_VARIABLE
TD_OS_INFO
)
execute_process
(
COMMAND
sh
$
{
TD_COMMUNITY_DIR
}
/
packaging
/
tools
/
get_os
.
sh
""
OUTPUT_VARIABLE
TD_OS_INFO
)
MESSAGE
(
STATUS
"The current os is "
$
{
TD_OS_INFO
})
SET
(
TD_LINUX
TRUE
)
...
...
@@ -52,8 +52,13 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ENDIF
()
IF
(
$
{
TD_OS_INFO
}
MATCHES
"Alpine"
)
SET
(
TD_APLHINE
TRUE
)
MESSAGE
(
STATUS
"The current OS is Alpine, append extra flags"
)
SET
(
TD_ALPINE
TRUE
)
MESSAGE
(
STATUS
"The current OS is Alpine Linux, append extra flags"
)
ELSEIF
(
$
{
TD_OS_INFO
}
MATCHES
"Arch"
)
SET
(
TD_ARCHLINUX
TRUE
)
MESSAGE
(
STATUS
"The current OS is Arch Linux"
)
ELSE
()
MESSAGE
(
STATUS
"Ths distro is "
$
{
TD_OS_INFO
})
ENDIF
()
ELSEIF
(
$
{
CMAKE_SYSTEM_NAME
}
MATCHES
"Darwin"
)
SET
(
TD_DARWIN
TRUE
)
...
...
@@ -155,7 +160,7 @@ ELSEIF (${OSTYPE} MATCHES "Linux")
MESSAGE
(
STATUS
"input osType: Linux"
)
ELSEIF
(
$
{
OSTYPE
}
MATCHES
"Alpine"
)
MESSAGE
(
STATUS
"input osType: Alpine"
)
SET
(
TD_A
PLH
INE
TRUE
)
SET
(
TD_A
LP
INE
TRUE
)
ELSE
()
MESSAGE
(
STATUS
"The user specified osType is unknown: "
$
{
OSTYPE
})
ENDIF
()
cmake/version.inc
浏览文件 @
51259460
...
...
@@ -4,7 +4,7 @@ PROJECT(TDengine)
IF
(
DEFINED
VERNUMBER
)
SET
(
TD_VER_NUMBER
$
{
VERNUMBER
})
ELSE
()
SET
(
TD_VER_NUMBER
"2.2.1.
1
"
)
SET
(
TD_VER_NUMBER
"2.2.1.
3
"
)
ENDIF
()
IF
(
DEFINED
VERCOMPATIBLE
)
...
...
documentation20/cn/09.connections/docs.md
浏览文件 @
51259460
...
...
@@ -3,7 +3,7 @@
## <a class="anchor" id="grafana"></a>Grafana
TDengine
能够与开源数据可视化系统
[
Grafana
](
https://www.grafana.com/
)
快速集成搭建数据监测报警系统,整个过程无需任何代码开发,TDengine中数据表中内容可以在仪表盘(DashBoard)上进行可视化展现
。
TDengine
能够与开源数据可视化系统
[
Grafana
](
https://www.grafana.com/
)
快速集成搭建数据监测报警系统,整个过程无需任何代码开发,TDengine 中数据表中内容可以在仪表盘(DashBoard)上进行可视化展现。关于TDengine插件的使用您可以在
[
GitHub
](
https://github.com/taosdata/grafanaplugin/blob/master/README.md
)
中了解更多
。
### 安装Grafana
...
...
@@ -11,12 +11,24 @@ TDengine能够与开源数据可视化系统[Grafana](https://www.grafana.com/)
### 配置Grafana
TDengine
的Grafana插件在安装包的/usr/local/taos/connector/grafanaplugin目录下
。
TDengine
的 Grafana 插件请从
<https://github.com/taosdata/grafanaplugin/releases/latest>
下载
。
以CentOS 7.2操作系统为例,将grafanaplugin目录拷贝到/var/lib/grafana/plugins目录下,重新启动grafana即可。
```
bash
GF_VERSION
=
3.1.1
wget https://github.com/taosdata/grafanaplugin/releases/download/v
$GF_VERSION
/tdengine-datasource-
$GF_VERSION
.zip
```
以 CentOS 7.2 操作系统为例,将插件包解压到 /var/lib/grafana/plugins 目录下,重新启动 grafana 即可。
```
bash
sudo cp
-rf
/usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tdengine
sudo
unzip tdengine-datasource-
$GF_VERSION
.zip
-d
/var/lib/grafana/plugins/
```
Grafana 7.3+ / 8.x 版本会对插件进行签名检查,因此还需要在 grafana.ini 文件中增加如下行,才能正确使用插件:
```
ini
[plugins]
allow_loading_unsigned_plugins
=
tdengine-datasource
```
### 使用 Grafana
...
...
@@ -55,7 +67,6 @@ sudo cp -rf /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tde
*
ALIAS BY:可设置当前查询别名。
*
GENERATE SQL: 点击该按钮会自动替换相应变量,并生成最终执行的语句。
按照默认提示查询当前 TDengine 部署所在服务器指定间隔系统内存平均使用量如下:

...
...
@@ -64,16 +75,15 @@ sudo cp -rf /usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tde
#### 导入 Dashboard
在 Grafana 插件目录 /usr/local/taos/connector/grafana/tdengine/dashboard/ 下提供了一个
`tdengine-grafana.json`
可导入的 dashboard
。
我们提供一个 TDengine Dashboard 可以作为 TDengine 集群的监控可视化工具使用,见
[
Grafana Dashboard 15146
](
https://grafana.com/grafana/dashboards/15146
)
。
点击左侧
`Import`
按钮,
并上传
`tdengine-grafana.json`
文件
:
点击左侧
`Import`
按钮,
选择
**Grafana.com Dashboard**
,j将id
`15146`
填入并加载
:

导入完成之后可看到如下效果:


## <a class="anchor" id="matlab"></a>MATLAB
...
...
documentation20/cn/14.devops/01.telegraf/docs.md
0 → 100644
浏览文件 @
51259460
# 使用 TDengine + Telegraf + Grafana 快速搭建 IT 运维展示系统
## 背景介绍
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。自从 2019年 7 月开源以来,凭借创新的数据建模设计、快捷的安装方式、易用的编程接口和强大的数据写入查询性能博得了大量时序数据开发者的青睐。
IT 运维监测数据通常都是对时间特性比较敏感的数据,例如:
-
系统资源指标:CPU、内存、IO、带宽等。
-
软件系统指标:存活状态、连接数目、请求数目、超时数目、错误数目、响应时间、服务类型及其他与业务有关的指标。
当前主流的 IT 运维系统通常包含一个数据采集模块,一个数据存储模块,和一个可视化显示模块。Telegraf 和 Grafana 分别是当前最流行的数据采集模块和可视化显示模块之一。而数据存储模块可供选择的软件比较多,其中 OpenTSDB 或 InfluxDB 比较流行。而 TDengine 作为新兴的时序大数据平台,具备极强的高性能、高可靠、易管理、易维护的优势。
本文介绍不需要写一行代码,通过简单修改几行配置文件,就可以快速搭建一个基于 TDengine + Telegraf + Grafana 的 IT 运维系统。架构如下图:

## 安装步骤
### 安装 Telegraf,Grafana 和 TDengine
安装 Telegraf、Grafana 和 TDengine 请参考相关官方文档。
### Telegraf
请参考
[
官方文档
](
https://portal.influxdata.com/downloads/
)
。
### Grafana
请参考
[
官方文档
](
https://grafana.com/grafana/download
)
。
### 安装 TDengine
从涛思数据官网
[
下载
](
http://taosdata.com/cn/all-downloads/)页面下载最新
TDengine-server 2.3.0.0 或以上版本安装。
## 数据链路设置
### 下载 TDengine 插件到 grafana 插件目录
```
bash
1. wget
-c
https://github.com/taosdata/grafanaplugin/releases/download/v3.1.1/tdengine-datasource-3.1.1.zip
2.
sudo
unzip tdengine-datasource-3.1.1.zip
-d
/var/lib/grafana/plugins/
3.
sudo chown
grafana:grafana
-R
/var/lib/grafana/plugins/tdengine
4.
echo
-e
"[plugins]
\n
allow_loading_unsigned_plugins = tdengine-datasource
\n
"
|
sudo tee
-a
/etc/grafana/grafana.ini
5.
sudo
systemctl restart grafana-server.service
```
### 修改 /etc/telegraf/telegraf.conf
配置方法,在 /etc/telegraf/telegraf.conf 增加如下文字,其中 database name 请填写希望在 TDengine 保存 Telegraf 数据的数据库名,TDengine server/cluster host、username和 password 填写 TDengine 实际值:
```
[[outputs.http]]
url = "http://<TDengine server/cluster host>:6041/influxdb/v1/write?db=<database name>"
method = "POST"
timeout = "5s"
username = "<TDengine's username>"
password = "<TDengine's password>"
data_format = "influx"
influx_max_line_bytes = 250
```
然后重启 telegraf:
```
sudo systemctl start telegraf
```
### 导入 Dashboard
使用 Web 浏览器访问 IP:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
点击左侧加号图标并选择 Import,从 https://github.com/taosdata/grafanaplugin/blob/master/examples/telegraf/grafana/dashboards/telegraf-dashboard-v0.1.0.json 下载 dashboard JSON 文件后导入。之后可以看到如下界面的仪表盘:

## 总结
以上演示如何快速搭建一个完整的 IT 运维展示系统。得力于 TDengine 2.3.0.0 版本中新增的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统。TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品落地案例。
documentation20/cn/14.devops/02.collectd/docs.md
0 → 100644
浏览文件 @
51259460
# 使用 TDengine + collectd/StatsD + Grafana 快速搭建 IT 运维监控系统
## 背景介绍
TDengine是涛思数据专为物联网、车联网、工业互联网、IT运维等设计和优化的大数据平台。自从 2019年 7 月开源以来,凭借创新的数据建模设计、快捷的安装方式、易用的编程接口和强大的数据写入查询性能博得了大量时序数据开发者的青睐。
IT 运维监测数据通常都是对时间特性比较敏感的数据,例如:
-
系统资源指标:CPU、内存、IO、带宽等。
-
软件系统指标:存活状态、连接数目、请求数目、超时数目、错误数目、响应时间、服务类型及其他与业务有关的指标。
当前主流的 IT 运维系统通常包含一个数据采集模块,一个数据存储模块,和一个可视化显示模块。collectd / statsD 作为老牌开源数据采集工具,具有广泛的用户群。但是 collectd / StatsD 自身功能有限,往往需要配合 Telegraf、Grafana 以及时序数据库组合搭建成为完整的监控系统。而 TDengine 新版本支持多种数据协议接入,可以直接接受 collectd 和 statsD 的数据写入,并提供 Grafana dashboard 进行图形化展示。
本文介绍不需要写一行代码,通过简单修改几行配置文件,就可以快速搭建一个基于 TDengine + collectd / statsD + Grafana 的 IT 运维系统。架构如下图:

## 安装步骤
安装 collectd, StatsD, Grafana 和 TDengine 请参考相关官方文档。
### 安装 collectd
请参考
[
官方文档
](
https://collectd.org/documentation.shtml
)
。
### 安装 StatsD
请参考
[
官方文档
](
https://github.com/statsd/statsd
)
。
### 安装 Grafana
请参考
[
官方文档
](
https://grafana.com/grafana/download
)
。
### 安装 TDengine
从涛思数据官网
[
下载
](
http://taosdata.com/cn/all-downloads/)页面下载最新
TDengine-server 2.3.0.0 或以上版本安装。
## 数据链路设置
### 复制 TDengine 插件到 grafana 插件目录
```
bash
1. wget
-c
https://github.com/taosdata/grafanaplugin/releases/download/v3.1.1/tdengine-datasource-3.1.1.zip
2.
sudo
unzip tdengine-datasource-3.1.1.zip
-d
/var/lib/grafana/plugins/
3.
sudo chown
grafana:grafana
-R
/var/lib/grafana/plugins/tdengine
4.
echo
-e
"[plugins]
\n
allow_loading_unsigned_plugins = tdengine-datasource
\n
"
|
sudo tee
-a
/etc/grafana/grafana.ini
5.
sudo
systemctl restart grafana-server.service
```
### 配置 collectd
在 /etc/collectd/collectd.conf 文件中增加如下内容,其中 host 和 port 请填写 TDengine 和 BLM3 配置的实际值:
```
LoadPlugin network
<Plugin network>
Server "<TDengine cluster/server host>" "<port for collectd>"
</Plugin>
sudo systemctl start collectd
```
### 配置 StatsD
在 config.js 文件中增加如下内容后启动 StatsD,其中 host 和 port 请填写 TDengine 和 BLM3 配置的实际值:
```
backends 部分添加 "./backends/repeater"
repeater 部分添加 { host:'<TDengine server/cluster host>', port: <port for StatsD>}
```
### 导入 Dashboard
使用 Web 浏览器访问运行 Grafana 的服务器的3000端口 host:3000 登录 Grafana 界面,系统初始用户名密码为 admin/admin。
点击左侧齿轮图标并选择 Plugins,应该可以找到 TDengine data source 插件图标。
#### 导入 collectd 仪表盘
从 https://github.com/taosdata/grafanaplugin/blob/master/examples/collectd/grafana/dashboards/collect-metrics-with-tdengine-v0.1.0.json 下载 dashboard json 文件,点击左侧加号图标并选择 Import,按照界面提示选择 JSON 文件导入。之后可以看到如下界面的仪表盘:

#### 导入 StatsD 仪表盘
从 https://github.com/taosdata/grafanaplugin/blob/master/examples/statsd/dashboards/statsd-with-tdengine-v0.1.0.json 下载 dashboard json 文件,点击左侧加号图标并选择 Import,按照界面提示导入JSON文件。之后可以看到如下界面的仪表盘:

## 总结
TDengine 作为新兴的时序大数据平台,具备极强的高性能、高可靠、易管理、易维护的优势。得力于 TDengine 2.3.0.0 版本中新增的 schemaless 协议解析功能,以及强大的生态软件适配能力,用户可以短短数分钟就可以搭建一个高效易用的 IT 运维系统或者适配一个已存在的系统。
TDengine 强大的数据写入查询性能和其他丰富功能请参考官方文档和产品成功落地案例。
documentation20/cn/images/connections/dashboard-15146.png
0 → 100644
浏览文件 @
51259460
171.2 KB
documentation20/en/09.connections/docs.md
浏览文件 @
51259460
...
...
@@ -12,12 +12,17 @@ https://grafana.com/grafana/download.
### Configure Grafana
TDengine Grafana plugin is in the /usr/local/taos/connector/grafanaplugin directory.
Download grafana plugin from
<https://github.com/taosdata/grafanaplugin/releases/latest>
.
```
bash
GF_VERSION
=
3.1.1
wget https://github.com/taosdata/grafanaplugin/releases/download/v
$GF_VERSION
/tdengine-datasource-
$GF_VERSION
.zip
```
Taking Centos 7.2 as an example, just copy grafanaplugin directory to /var/lib/grafana/plugins directory and restart Grafana.
```
bash
sudo
cp
-rf
/usr/local/taos/connector/grafanaplugin /var/lib/grafana/plugins/tdengine
sudo
unzip tdengine-datasource-
$GF_VERSION
.zip /var/lib/grafana/plugins/
```
### Use Grafana
...
...
@@ -64,15 +69,15 @@ According to the default prompt, query the average system memory usage at the sp
#### Import Dashboard
A
`tdengine-grafana.json`
importable dashboard is provided under the Grafana plug-in directory/usr/local/taos/connector/grafana/tdengine/dashboard/.
We provide an example dashboard
[
Grafana Dashboard 15146
](
https://grafana.com/grafana/dashboards/15146
)
。
Click the
`Import`
button on the left panel and
upload the
`tdengine-grafana.json`
file
:
Click the
`Import`
button on the left panel and
load the grafana id
:

You can see as follows after Dashboard imported.


## <a class="anchor" id="matlab"></a> MATLAB
...
...
documentation20/en/images/connections/dashboard-15146.png
0 → 100644
浏览文件 @
51259460
171.2 KB
packaging/deb/makedeb.sh
浏览文件 @
51259460
...
...
@@ -58,12 +58,6 @@ cp ${compile_dir}/build/lib/${libfile} ${pkg_dir}${install_home_pat
cp
${
compile_dir
}
/../src/inc/taos.h
${
pkg_dir
}${
install_home_path
}
/include
cp
${
compile_dir
}
/../src/inc/taoserror.h
${
pkg_dir
}${
install_home_path
}
/include
cp
-r
${
top_dir
}
/tests/examples/
*
${
pkg_dir
}${
install_home_path
}
/examples
if
[
-d
"
${
top_dir
}
/src/connector/grafanaplugin/dist"
]
;
then
cp
-r
${
top_dir
}
/src/connector/grafanaplugin/dist
${
pkg_dir
}${
install_home_path
}
/connector/grafanaplugin
else
echo
"grafanaplugin bundled directory not found!"
exit
1
fi
cp
-r
${
top_dir
}
/src/connector/python
${
pkg_dir
}${
install_home_path
}
/connector
cp
-r
${
top_dir
}
/src/connector/go
${
pkg_dir
}${
install_home_path
}
/connector
cp
-r
${
top_dir
}
/src/connector/nodejs
${
pkg_dir
}${
install_home_path
}
/connector
...
...
packaging/release.sh
浏览文件 @
51259460
...
...
@@ -194,6 +194,7 @@ fi
if
[[
"
$dbName
"
==
"pro"
]]
;
then
sed
-i
"s/taos config/prodb config/g"
${
top_dir
}
/src/util/src/tconfig.c
sed
-i
"s/TDengine/ProDB/g"
${
top_dir
}
/src/dnode/src/dnodeSystem.c
fi
...
...
packaging/rpm/tdengine.spec
浏览文件 @
51259460
...
...
@@ -67,12 +67,6 @@ cp %{_compiledir}/build/bin/taosdump %{buildroot}%{homepath}/bin
cp %{_compiledir}/build/lib/${libfile} %{buildroot}%{homepath}/driver
cp %{_compiledir}/../src/inc/taos.h %{buildroot}%{homepath}/include
cp %{_compiledir}/../src/inc/taoserror.h %{buildroot}%{homepath}/include
if [ -d %{_compiledir}/../src/connector/grafanaplugin/dist ]; then
cp -r %{_compiledir}/../src/connector/grafanaplugin/dist %{buildroot}%{homepath}/connector/grafanaplugin
else
echo grafanaplugin bundled directory not found!
exit 1
fi
cp -r %{_compiledir}/../src/connector/python %{buildroot}%{homepath}/connector
cp -r %{_compiledir}/../src/connector/go %{buildroot}%{homepath}/connector
cp -r %{_compiledir}/../src/connector/nodejs %{buildroot}%{homepath}/connector
...
...
packaging/tools/make_install.sh
浏览文件 @
51259460
...
...
@@ -316,11 +316,6 @@ function install_data() {
}
function
install_connector
()
{
if
[
-d
"
${
source_dir
}
/src/connector/grafanaplugin/dist"
]
;
then
${
csudo
}
cp
-rf
${
source_dir
}
/src/connector/grafanaplugin/dist
${
install_main_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if
find
${
source_dir
}
/src/connector/go
-mindepth
1
-maxdepth
1 |
read
;
then
${
csudo
}
cp
-r
${
source_dir
}
/src/connector/go
${
install_main_dir
}
/connector
else
...
...
packaging/tools/makeclient.sh
浏览文件 @
51259460
...
...
@@ -150,11 +150,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if
[
"
$osType
"
!=
"Darwin"
]
;
then
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
||
:
fi
if
[
-d
"
${
connector_dir
}
/grafanaplugin/dist"
]
;
then
cp
-r
${
connector_dir
}
/grafanaplugin/dist
${
install_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if
find
${
connector_dir
}
/go
-mindepth
1
-maxdepth
1 |
read
;
then
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
else
...
...
packaging/tools/makeclient_power.sh
浏览文件 @
51259460
...
...
@@ -210,11 +210,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if
[
"
$osType
"
!=
"Darwin"
]
;
then
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
||
:
fi
if
[
-d
"
${
connector_dir
}
/grafanaplugin/dist"
]
;
then
cp
-r
${
connector_dir
}
/grafanaplugin/dist
${
install_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bunlded dir not found, please check if want to use it!"
fi
if
find
${
connector_dir
}
/go
-mindepth
1
-maxdepth
1 |
read
;
then
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
else
...
...
packaging/tools/makeclient_pro.sh
浏览文件 @
51259460
...
...
@@ -172,11 +172,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if
[
"
$osType
"
!=
"Darwin"
]
;
then
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
||
:
fi
if
[
-d
"
${
connector_dir
}
/grafanaplugin/dist"
]
;
then
cp
-r
${
connector_dir
}
/grafanaplugin/dist
${
install_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bunlded dir not found, please check if want to use it!"
fi
if
find
${
connector_dir
}
/go
-mindepth
1
-maxdepth
1 |
read
;
then
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
else
...
...
packaging/tools/makeclient_tq.sh
浏览文件 @
51259460
...
...
@@ -177,11 +177,6 @@ if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
if
[
"
$osType
"
!=
"Darwin"
]
;
then
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
||
:
fi
if
[
-d
"
${
connector_dir
}
/grafanaplugin/dist"
]
;
then
cp
-r
${
connector_dir
}
/grafanaplugin/dist
${
install_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bunlded dir not found, please check if want to use it!"
fi
if
find
${
connector_dir
}
/go
-mindepth
1
-maxdepth
1 |
read
;
then
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
else
...
...
packaging/tools/makepkg.sh
浏览文件 @
51259460
...
...
@@ -183,11 +183,6 @@ connector_dir="${code_dir}/connector"
mkdir
-p
${
install_dir
}
/connector
if
[[
"
$pagMode
"
!=
"lite"
]]
&&
[[
"
$cpuType
"
!=
"aarch32"
]]
;
then
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
||
:
if
[
-d
"
${
connector_dir
}
/grafanaplugin/dist"
]
;
then
cp
-r
${
connector_dir
}
/grafanaplugin/dist
${
install_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bundled dir not found, please check if you want to use it!"
fi
if
find
${
connector_dir
}
/go
-mindepth
1
-maxdepth
1 |
read
;
then
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
else
...
...
packaging/tools/makepkg_power.sh
浏览文件 @
51259460
...
...
@@ -167,11 +167,6 @@ mkdir -p ${install_dir}/connector
if
[[
"
$pagMode
"
!=
"lite"
]]
&&
[[
"
$cpuType
"
!=
"aarch32"
]]
;
then
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
||
:
if
[
-d
"
${
connector_dir
}
/grafanaplugin/dist"
]
;
then
cp
-r
${
connector_dir
}
/grafanaplugin/dist
${
install_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if
find
${
connector_dir
}
/go
-mindepth
1
-maxdepth
1 |
read
;
then
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
else
...
...
packaging/tools/makepkg_pro.sh
浏览文件 @
51259460
...
...
@@ -153,11 +153,6 @@ mkdir -p ${install_dir}/driver && cp ${lib_files} ${install_dir}/driver && echo
#if [[ "$pagMode" != "lite" ]] && [[ "$cpuType" != "aarch32" ]]; then
# cp ${build_dir}/lib/*.jar ${install_dir}/connector ||:
# if [ -d "${connector_dir}/grafanaplugin/dist" ]; then
# cp -r ${connector_dir}/grafanaplugin/dist ${install_dir}/connector/grafanaplugin
# else
# echo "WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
# fi
# if find ${connector_dir}/go -mindepth 1 -maxdepth 1 | read; then
# cp -r ${connector_dir}/go ${install_dir}/connector
# else
...
...
packaging/tools/makepkg_tq.sh
浏览文件 @
51259460
...
...
@@ -167,11 +167,6 @@ mkdir -p ${install_dir}/connector
if
[[
"
$pagMode
"
!=
"lite"
]]
&&
[[
"
$cpuType
"
!=
"aarch32"
]]
;
then
cp
${
build_dir
}
/lib/
*
.jar
${
install_dir
}
/connector
||
:
if
[
-d
"
${
connector_dir
}
/grafanaplugin/dist"
]
;
then
cp
-r
${
connector_dir
}
/grafanaplugin/dist
${
install_dir
}
/connector/grafanaplugin
else
echo
"WARNING: grafanaplugin bundled dir not found, please check if want to use it!"
fi
if
find
${
connector_dir
}
/go
-mindepth
1
-maxdepth
1 |
read
;
then
cp
-r
${
connector_dir
}
/go
${
install_dir
}
/connector
else
...
...
snap/snapcraft.yaml
浏览文件 @
51259460
name
:
tdengine
base
:
core18
version
:
'
2.2.1.
1
'
version
:
'
2.2.1.
3
'
icon
:
snap/gui/t-dengine.svg
summary
:
an open-source big data platform designed and optimized for IoT.
description
:
|
...
...
@@ -72,7 +72,7 @@ parts:
-
usr/bin/taosd
-
usr/bin/taos
-
usr/bin/taosdemo
-
usr/lib/libtaos.so.2.2.1.
1
-
usr/lib/libtaos.so.2.2.1.
3
-
usr/lib/libtaos.so.1
-
usr/lib/libtaos.so
...
...
src/client/inc/tscUtil.h
浏览文件 @
51259460
...
...
@@ -108,6 +108,7 @@ typedef struct SBlockKeyInfo {
int32_t
converToStr
(
char
*
str
,
int
type
,
void
*
buf
,
int32_t
bufSize
,
int32_t
*
len
);
int32_t
tscCreateDataBlock
(
size_t
initialSize
,
int32_t
rowSize
,
int32_t
startOffset
,
SName
*
name
,
STableMeta
*
pTableMeta
,
STableDataBlocks
**
dataBlocks
);
int32_t
tscCreateDataBlockData
(
STableDataBlocks
*
dataBuf
,
size_t
defaultSize
,
int32_t
rowSize
,
int32_t
startOffset
);
void
tscDestroyDataBlock
(
STableDataBlocks
*
pDataBlock
,
bool
removeMeta
);
void
tscSortRemoveDataBlockDupRowsRaw
(
STableDataBlocks
*
dataBuf
);
int
tscSortRemoveDataBlockDupRows
(
STableDataBlocks
*
dataBuf
,
SBlockKeyInfo
*
pBlkKeyInfo
);
...
...
src/client/src/tscLocal.c
浏览文件 @
51259460
...
...
@@ -358,9 +358,13 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) {
int
num_fields
=
taos_num_fields
(
pSql
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
pSql
);
char
buf
[
TSDB_COL_NAME_LEN
+
16
];
for
(
int
i
=
0
;
i
<
num_fields
;
i
++
)
{
memset
(
buf
,
0
,
sizeof
(
buf
));
char
*
buf
=
calloc
(
1
,
lengths
[
i
]
+
1
);
if
(
buf
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
memset
(
buf
,
0
,
lengths
[
i
]
+
1
);
int32_t
ret
=
tscGetNthFieldResult
(
row
,
fields
,
lengths
,
i
,
buf
);
if
(
i
==
0
)
{
...
...
@@ -373,6 +377,9 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) {
}
else
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s,"
,
buf
);
}
free
(
buf
);
if
(
i
==
num_fields
-
1
)
{
sprintf
(
result
+
strlen
(
result
)
-
1
,
"%s"
,
")"
);
}
...
...
src/client/src/tscPrepare.c
浏览文件 @
51259460
...
...
@@ -48,12 +48,14 @@ typedef struct SMultiTbStmt {
bool
nameSet
;
bool
tagSet
;
bool
subSet
;
bool
tagColSet
;
uint64_t
currentUid
;
char
*
sqlstr
;
uint32_t
tbNum
;
SStrToken
tbname
;
SStrToken
stbname
;
SStrToken
values
;
SStrToken
tagCols
;
SArray
*
tags
;
STableDataBlocks
*
lastBlock
;
SHashObj
*
pTableHash
;
...
...
@@ -1246,6 +1248,12 @@ static void insertBatchClean(STscStmt* pStmt) {
pCmd
->
insertParam
.
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
insertParam
.
pDataBlocks
);
pCmd
->
insertParam
.
numOfTables
=
0
;
STableDataBlocks
**
p
=
taosHashIterate
(
pCmd
->
insertParam
.
pTableBlockHashList
,
NULL
);
while
(
p
)
{
tfree
((
*
p
)
->
pData
);
p
=
taosHashIterate
(
pCmd
->
insertParam
.
pTableBlockHashList
,
p
);
}
taosHashClear
(
pCmd
->
insertParam
.
pTableBlockHashList
);
tscFreeSqlResult
(
pSql
);
tscFreeSubobj
(
pSql
);
...
...
@@ -1336,11 +1344,42 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) {
}
pStmt
->
mtb
.
stbname
=
sToken
;
sToken
=
tStrGetToken
(
pCmd
->
insertParam
.
sql
,
&
index
,
false
);
if
(
sToken
.
n
<=
0
||
((
sToken
.
type
!=
TK_TAGS
)
&&
(
sToken
.
type
!=
TK_LP
)))
{
tscError
(
"invalid token, sql:%s"
,
pCmd
->
insertParam
.
sql
);
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"invalid token"
,
sToken
.
z
?
sToken
.
z
:
pCmd
->
insertParam
.
sql
);
}
// ... (tag_col_list) TAGS(tag_val_list) ...
int32_t
tagColsCnt
=
0
;
if
(
sToken
.
type
==
TK_LP
)
{
pStmt
->
mtb
.
tagColSet
=
true
;
pStmt
->
mtb
.
tagCols
=
sToken
;
int32_t
tagColsStart
=
index
;
while
(
1
)
{
sToken
=
tStrGetToken
(
pCmd
->
insertParam
.
sql
,
&
index
,
false
);
if
(
sToken
.
type
==
TK_ILLEGAL
)
{
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"unrecognized token"
,
sToken
.
z
);
}
if
(
sToken
.
type
==
TK_ID
)
{
++
tagColsCnt
;
}
if
(
sToken
.
type
==
TK_RP
)
{
break
;
}
}
if
(
tagColsCnt
==
0
)
{
tscError
(
"tag column list expected, sql:%s"
,
pCmd
->
insertParam
.
sql
);
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"tag column list expected"
,
pCmd
->
insertParam
.
sql
);
}
pStmt
->
mtb
.
tagCols
.
n
=
index
-
tagColsStart
+
1
;
sToken
=
tStrGetToken
(
pCmd
->
insertParam
.
sql
,
&
index
,
false
);
if
(
sToken
.
n
<=
0
||
sToken
.
type
!=
TK_TAGS
)
{
tscError
(
"keyword TAGS expected, sql:%s"
,
pCmd
->
insertParam
.
sql
);
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"keyword TAGS expected"
,
sToken
.
z
?
sToken
.
z
:
pCmd
->
insertParam
.
sql
);
}
}
sToken
=
tStrGetToken
(
pCmd
->
insertParam
.
sql
,
&
index
,
false
);
if
(
sToken
.
n
<=
0
||
sToken
.
type
!=
TK_LP
)
{
...
...
@@ -1379,6 +1418,11 @@ int stmtParseInsertTbTags(SSqlObj* pSql, STscStmt* pStmt) {
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"no tags"
,
pCmd
->
insertParam
.
sql
);
}
if
(
tagColsCnt
>
0
&&
taosArrayGetSize
(
pStmt
->
mtb
.
tags
)
!=
tagColsCnt
)
{
tscError
(
"not match tags, sql:%s"
,
pCmd
->
insertParam
.
sql
);
return
tscSQLSyntaxErrMsg
(
pCmd
->
payload
,
"not match tags"
,
pCmd
->
insertParam
.
sql
);
}
sToken
=
tStrGetToken
(
pCmd
->
insertParam
.
sql
,
&
index
,
false
);
if
(
sToken
.
n
<=
0
||
(
sToken
.
type
!=
TK_VALUES
&&
sToken
.
type
!=
TK_LP
))
{
tscError
(
"sql error, sql:%s"
,
pCmd
->
insertParam
.
sql
);
...
...
@@ -1401,7 +1445,13 @@ int stmtGenInsertStatement(SSqlObj* pSql, STscStmt* pStmt, const char* name, TAO
int32_t
j
=
0
;
while
(
1
)
{
if
(
pStmt
->
mtb
.
tagColSet
)
{
len
=
(
size_t
)
snprintf
(
str
,
size
-
1
,
"insert into %s using %.*s %.*s tags("
,
name
,
pStmt
->
mtb
.
stbname
.
n
,
pStmt
->
mtb
.
stbname
.
z
,
pStmt
->
mtb
.
tagCols
.
n
,
pStmt
->
mtb
.
tagCols
.
z
);
}
else
{
len
=
(
size_t
)
snprintf
(
str
,
size
-
1
,
"insert into %s using %.*s tags("
,
name
,
pStmt
->
mtb
.
stbname
.
n
,
pStmt
->
mtb
.
stbname
.
z
);
}
if
(
len
>=
(
size
-
1
))
{
size
*=
2
;
free
(
str
);
...
...
@@ -1637,6 +1687,13 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
STMT_RET
(
TSDB_CODE_TSC_APP_ERROR
);
}
if
((
*
t1
)
->
pData
==
NULL
)
{
code
=
tscCreateDataBlockData
(
*
t1
,
TSDB_PAYLOAD_SIZE
,
(
*
t1
)
->
pTableMeta
->
tableInfo
.
rowSize
,
sizeof
(
SSubmitBlk
));
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
STMT_RET
(
code
);
}
}
SSubmitBlk
*
pBlk
=
(
SSubmitBlk
*
)
(
*
t1
)
->
pData
;
pCmd
->
batchSize
=
pBlk
->
numOfRows
;
if
(
pBlk
->
numOfRows
==
0
)
{
...
...
@@ -1695,7 +1752,6 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
STMT_RET
(
TSDB_CODE_SUCCESS
);
}
if
(
pStmt
->
mtb
.
tagSet
)
{
pStmt
->
mtb
.
tbname
=
tscReplaceStrToken
(
&
pSql
->
sqlstr
,
&
pStmt
->
mtb
.
tbname
,
name
);
}
else
{
...
...
@@ -1762,7 +1818,6 @@ int taos_stmt_set_tbname_tags(TAOS_STMT* stmt, const char* name, TAOS_BIND* tags
STMT_RET
(
code
);
}
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_CHECK
...
...
@@ -1770,8 +1825,6 @@ int taos_stmt_set_sub_tbname(TAOS_STMT* stmt, const char* name) {
return
taos_stmt_set_tbname_tags
(
stmt
,
name
,
NULL
);
}
int
taos_stmt_set_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_CHECK
...
...
@@ -1779,7 +1832,6 @@ int taos_stmt_set_tbname(TAOS_STMT* stmt, const char* name) {
return
taos_stmt_set_tbname_tags
(
stmt
,
name
,
NULL
);
}
int
taos_stmt_close
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
if
(
pStmt
==
NULL
||
pStmt
->
taos
==
NULL
)
{
...
...
@@ -1846,7 +1898,6 @@ int taos_stmt_bind_param(TAOS_STMT* stmt, TAOS_BIND* bind) {
}
}
int
taos_stmt_bind_param_batch
(
TAOS_STMT
*
stmt
,
TAOS_MULTI_BIND
*
bind
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
...
...
@@ -1910,8 +1961,6 @@ int taos_stmt_bind_single_param_batch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, in
STMT_RET
(
insertStmtBindParamBatch
(
pStmt
,
bind
,
colIdx
));
}
int
taos_stmt_add_batch
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
STMT_CHECK
...
...
@@ -2052,7 +2101,6 @@ int taos_stmt_get_param(TAOS_STMT *stmt, int idx, int *type, int *bytes) {
}
}
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
)
{
STscStmt
*
pStmt
=
(
STscStmt
*
)
stmt
;
...
...
@@ -2063,8 +2111,6 @@ char *taos_stmt_errstr(TAOS_STMT *stmt) {
return
taos_errstr
(
pStmt
->
pSql
);
}
const
char
*
taos_data_type
(
int
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_NULL
:
return
"TSDB_DATA_TYPE_NULL"
;
...
...
@@ -2081,4 +2127,3 @@ const char *taos_data_type(int type) {
default:
return
"UNKNOWN"
;
}
}
src/client/src/tscSQLParser.c
浏览文件 @
51259460
...
...
@@ -5610,7 +5610,7 @@ int32_t validateOrderbyNode(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SSqlNode* pSq
bool
udf
=
false
;
if
(
pQueryInfo
->
pUdfInfo
&&
taosArrayGetSize
(
pQueryInfo
->
pUdfInfo
)
>
0
)
{
int32_t
usize
=
taosArrayGetSize
(
pQueryInfo
->
pUdfInfo
);
int32_t
usize
=
(
int32_t
)
taosArrayGetSize
(
pQueryInfo
->
pUdfInfo
);
for
(
int32_t
i
=
0
;
i
<
usize
;
++
i
)
{
SUdfInfo
*
pUdfInfo
=
taosArrayGet
(
pQueryInfo
->
pUdfInfo
,
i
);
...
...
@@ -8406,7 +8406,7 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
for
(
int32_t
j
=
0
;
j
<
usize
;
++
j
)
{
SUdfInfo
*
pUdfInfo
=
taosArrayGet
(
pQueryInfo
->
pUdfInfo
,
j
);
int32_t
len
=
strlen
(
pUdfInfo
->
name
);
int32_t
len
=
(
int32_t
)
strlen
(
pUdfInfo
->
name
);
if
(
len
==
t
->
n
&&
strncasecmp
(
info
.
name
,
pUdfInfo
->
name
,
t
->
n
)
==
0
)
{
exist
=
1
;
break
;
...
...
src/client/src/tscUtil.c
浏览文件 @
51259460
...
...
@@ -919,23 +919,31 @@ SSDataBlock* doGetDataBlock(void* param, bool* newgroup) {
pBlock
->
info
.
rows
=
pRes
->
numOfRows
;
if
(
pRes
->
numOfRows
!=
0
)
{
doSetupSDataBlock
(
pRes
,
pBlock
,
pInput
->
pFilterInfo
,
pInput
->
numOfFilterCols
);
if
(
pBlock
->
info
.
rows
>
0
)
{
*
newgroup
=
false
;
return
pBlock
;
}
}
SSDataBlock
*
result
=
NULL
;
do
{
// No data block exists. So retrieve and transfer it into to SSDataBlock
TAOS_ROW
pRow
=
NULL
;
taos_fetch_block
(
pSql
,
&
pRow
);
if
(
pRes
->
numOfRows
==
0
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
return
NULL
;
result
=
NULL
;
break
;
}
pBlock
->
info
.
rows
=
pRes
->
numOfRows
;
doSetupSDataBlock
(
pRes
,
pBlock
,
pInput
->
pFilterInfo
,
pInput
->
numOfFilterCols
);
*
newgroup
=
false
;
return
pBlock
;
result
=
pBlock
;
}
while
(
result
->
info
.
rows
==
0
);
return
result
;
}
static
void
fetchNextBlockIfCompleted
(
SOperatorInfo
*
pOperator
,
bool
*
newgroup
)
{
...
...
@@ -1797,6 +1805,32 @@ int32_t tscCreateDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOff
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
int32_t
code
=
tscCreateDataBlockData
(
dataBuf
,
defaultSize
,
rowSize
,
startOffset
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
tfree
(
dataBuf
);
return
code
;
}
//Here we keep the tableMeta to avoid it to be remove by other threads.
dataBuf
->
pTableMeta
=
tscTableMetaDup
(
pTableMeta
);
SParsedDataColInfo
*
pColInfo
=
&
dataBuf
->
boundColumnInfo
;
SSchema
*
pSchema
=
tscGetTableSchema
(
dataBuf
->
pTableMeta
);
tscSetBoundColumnInfo
(
pColInfo
,
pSchema
,
dataBuf
->
pTableMeta
->
tableInfo
.
numOfColumns
);
dataBuf
->
vgId
=
dataBuf
->
pTableMeta
->
vgId
;
tNameAssign
(
&
dataBuf
->
tableName
,
name
);
assert
(
defaultSize
>
0
&&
pTableMeta
!=
NULL
&&
dataBuf
->
pTableMeta
!=
NULL
);
*
dataBlocks
=
dataBuf
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
tscCreateDataBlockData
(
STableDataBlocks
*
dataBuf
,
size_t
defaultSize
,
int32_t
rowSize
,
int32_t
startOffset
)
{
assert
(
dataBuf
!=
NULL
);
dataBuf
->
nAllocSize
=
(
uint32_t
)
defaultSize
;
dataBuf
->
headerSize
=
startOffset
;
...
...
@@ -1809,30 +1843,16 @@ int32_t tscCreateDataBlock(size_t defaultSize, int32_t rowSize, int32_t startOff
dataBuf
->
pData
=
malloc
(
dataBuf
->
nAllocSize
);
if
(
dataBuf
->
pData
==
NULL
)
{
tscError
(
"failed to allocated memory, reason:%s"
,
strerror
(
errno
));
tfree
(
dataBuf
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
memset
(
dataBuf
->
pData
,
0
,
sizeof
(
SSubmitBlk
));
//Here we keep the tableMeta to avoid it to be remove by other threads.
dataBuf
->
pTableMeta
=
tscTableMetaDup
(
pTableMeta
);
SParsedDataColInfo
*
pColInfo
=
&
dataBuf
->
boundColumnInfo
;
SSchema
*
pSchema
=
tscGetTableSchema
(
dataBuf
->
pTableMeta
);
tscSetBoundColumnInfo
(
pColInfo
,
pSchema
,
dataBuf
->
pTableMeta
->
tableInfo
.
numOfColumns
);
dataBuf
->
ordered
=
true
;
dataBuf
->
prevTS
=
INT64_MIN
;
dataBuf
->
rowSize
=
rowSize
;
dataBuf
->
size
=
startOffset
;
dataBuf
->
tsSource
=
-
1
;
dataBuf
->
vgId
=
dataBuf
->
pTableMeta
->
vgId
;
tNameAssign
(
&
dataBuf
->
tableName
,
name
);
assert
(
defaultSize
>
0
&&
pTableMeta
!=
NULL
&&
dataBuf
->
pTableMeta
!=
NULL
);
*
dataBlocks
=
dataBuf
;
return
TSDB_CODE_SUCCESS
;
}
...
...
src/common/inc/tglobal.h
浏览文件 @
51259460
...
...
@@ -62,10 +62,11 @@ extern int32_t tsCompressMsgSize;
extern
int32_t
tsMaxNumOfDistinctResults
;
extern
char
tsTempDir
[];
//query buffer management
//
query buffer management
extern
int32_t
tsQueryBufferSize
;
// maximum allowed usage buffer size in MB for each data node during query processing
extern
int64_t
tsQueryBufferSizeBytes
;
// maximum allowed usage buffer size in byte for each data node during query processing
extern
int32_t
tsRetrieveBlockingModel
;
// retrieve threads will be blocked
extern
int64_t
tsQueryBufferSizeBytes
;
// maximum allowed usage buffer size in byte for each data node during query processing
extern
int32_t
tsRetrieveBlockingModel
;
// retrieve threads will be blocked
extern
int8_t
tsKeepOriginalColumnName
;
...
...
@@ -126,6 +127,7 @@ extern int8_t tsHttpEnableCompress;
extern
int8_t
tsHttpEnableRecordSql
;
extern
int8_t
tsTelegrafUseFieldNum
;
extern
int8_t
tsHttpDbNameMandatory
;
extern
int32_t
tsHttpKeepAlive
;
// mqtt
extern
int8_t
tsEnableMqttModule
;
...
...
src/common/src/tdataformat.c
浏览文件 @
51259460
...
...
@@ -253,9 +253,10 @@ int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPo
}
if
(
tdAllocMemForCol
(
pCol
,
maxPoints
)
<
0
)
return
-
1
;
if
(
numOfRows
>
0
)
{
if
(((
rowOffset
==
0
)
&&
(
numOfRows
>
0
))
||
((
rowOffset
==
-
1
)
&&
(
numOfRows
>=
0
)))
{
// Find the first not null value, fill all previouse values as NULL
dataColSetNEleNull
(
pCol
,
numOfRows
);
dataColSetNEleNull
(
pCol
,
numOfRows
-
rowOffset
);
}
}
...
...
@@ -463,9 +464,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
int
rcol
=
0
;
int
dcol
=
0
;
while
(
dcol
<
pCols
->
numOfCols
)
{
bool
setCol
=
0
;
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
schemaNCols
(
pSchema
))
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
...
...
@@ -476,14 +475,22 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
STColumn
*
pRowCol
=
schemaColAt
(
pSchema
,
rcol
);
if
(
pRowCol
->
colId
==
pDataCol
->
colId
)
{
void
*
value
=
tdGetRowDataOfCol
(
row
,
pRowCol
->
type
,
pRowCol
->
offset
+
TD_DATA_ROW_HEAD_SIZE
);
if
(
!
isNull
(
value
,
pDataCol
->
type
))
setCol
=
1
;
if
(
rowOffset
==
0
)
{
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
}
else
if
(
rowOffset
==
-
1
)
{
// for update 2
if
(
!
isNull
(
value
,
pDataCol
->
type
))
{
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
}
}
else
{
ASSERT
(
0
);
}
dcol
++
;
rcol
++
;
}
else
if
(
pRowCol
->
colId
<
pDataCol
->
colId
)
{
rcol
++
;
}
else
{
if
(
forceSetNull
||
setCol
)
{
if
(
forceSetNull
)
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
}
dcol
++
;
...
...
@@ -501,7 +508,6 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
int
nRowCols
=
kvRowNCols
(
row
);
while
(
dcol
<
pCols
->
numOfCols
)
{
bool
setCol
=
0
;
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
nRowCols
||
rcol
>=
schemaNCols
(
pSchema
))
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
...
...
@@ -513,14 +519,22 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
if
(
colIdx
->
colId
==
pDataCol
->
colId
)
{
void
*
value
=
tdGetKvRowDataOfCol
(
row
,
colIdx
->
offset
);
if
(
!
isNull
(
value
,
pDataCol
->
type
))
setCol
=
1
;
if
(
rowOffset
==
0
)
{
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
}
else
if
(
rowOffset
==
-
1
)
{
// for update 2
if
(
!
isNull
(
value
,
pDataCol
->
type
))
{
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
}
}
else
{
ASSERT
(
0
);
}
++
dcol
;
++
rcol
;
}
else
if
(
colIdx
->
colId
<
pDataCol
->
colId
)
{
++
rcol
;
}
else
{
if
(
forceSetNull
||
setCol
)
{
if
(
forceSetNull
)
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
rowOffset
);
}
++
dcol
;
...
...
src/common/src/tglobal.c
浏览文件 @
51259460
...
...
@@ -14,18 +14,18 @@
*/
#define _DEFAULT_SOURCE
#include "tglobal.h"
#include "monitor.h"
#include "os.h"
#include "taosdef.h"
#include "taoserror.h"
#include "t
ulog
.h"
#include "t
compare
.h"
#include "tconfig.h"
#include "tglobal.h"
#include "monitor.h"
#include "tsocket.h"
#include "tutil.h"
#include "tlocale.h"
#include "tsocket.h"
#include "ttimezone.h"
#include "tcompare.h"
#include "tulog.h"
#include "tutil.h"
// TSDB
bool
tsdbForceKeepFile
=
false
;
...
...
@@ -53,7 +53,7 @@ int32_t tsDnodeId = 0;
// common
int32_t
tsRpcTimer
=
300
;
int32_t
tsRpcMaxTime
=
600
;
// seconds;
int32_t
tsRpcForceTcp
=
0
;
//
disable this, means query, show command use udp protocol as default
int32_t
tsRpcForceTcp
=
0
;
//
disable this, means query, show command use udp protocol as default
int32_t
tsMaxShellConns
=
50000
;
int32_t
tsMaxConnections
=
5000
;
int32_t
tsShellActivityTimer
=
3
;
// second
...
...
@@ -102,7 +102,7 @@ int32_t tsMaxStreamComputDelay = 20000;
int32_t
tsStreamCompStartDelay
=
10000
;
// the stream computing delay time after executing failed, change accordingly
int32_t
tsRetryStreamCompDelay
=
10
*
1000
;
int32_t
tsRetryStreamCompDelay
=
10
*
1000
;
// The delayed computing ration. 10% of the whole computing time window by default.
float
tsStreamComputDelayRatio
=
0
.
1
f
;
...
...
@@ -166,6 +166,7 @@ int8_t tsHttpEnableCompress = 1;
int8_t
tsHttpEnableRecordSql
=
0
;
int8_t
tsTelegrafUseFieldNum
=
0
;
int8_t
tsHttpDbNameMandatory
=
0
;
int32_t
tsHttpKeepAlive
=
30000
;
// mqtt
int8_t
tsEnableMqttModule
=
0
;
// not finished yet, not started it by default
...
...
@@ -260,7 +261,8 @@ int8_t tsClientMerge = 0;
//
// lossy compress 6
//
char
lossyColumns
[
32
]
=
""
;
// "float|double" means all float and double columns can be lossy compressed. set empty can close lossy compress.
char
lossyColumns
[
32
]
=
""
;
// "float|double" means all float and double columns can be lossy compressed. set empty
// can close lossy compress.
// below option can take effect when tsLossyColumns not empty
double
fPrecision
=
1E-8
;
// float column precision
double
dPrecision
=
1E-16
;
// double column precision
...
...
@@ -306,7 +308,8 @@ bool taosCfgDynamicOptions(char *msg) {
int32_t
vint
=
0
;
paGetToken
(
msg
,
&
option
,
&
olen
);
if
(
olen
==
0
)
return
false
;;
if
(
olen
==
0
)
return
false
;
;
paGetToken
(
option
+
olen
+
1
,
&
value
,
&
vlen
);
if
(
vlen
==
0
)
...
...
@@ -319,7 +322,7 @@ bool taosCfgDynamicOptions(char *msg) {
for
(
int32_t
i
=
0
;
i
<
tsGlobalConfigNum
;
++
i
)
{
SGlobalCfg
*
cfg
=
tsGlobalConfig
+
i
;
//if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_LOG)) continue;
//
if (!(cfg->cfgType & TSDB_CFG_CTYPE_B_LOG)) continue;
if
(
cfg
->
valType
!=
TAOS_CFG_VTYPE_INT32
&&
cfg
->
valType
!=
TAOS_CFG_VTYPE_INT8
)
continue
;
int32_t
cfgLen
=
(
int32_t
)
strlen
(
cfg
->
option
);
...
...
@@ -407,7 +410,7 @@ static void taosCheckDataDirCfg() {
}
static
int32_t
taosCheckTmpDir
(
void
)
{
if
(
strlen
(
tsTempDir
)
<=
0
){
if
(
strlen
(
tsTempDir
)
<=
0
)
{
uError
(
"tempDir is not set"
);
return
-
1
;
}
...
...
@@ -557,8 +560,8 @@ static void doInitGlobalConfig(void) {
cfg
.
ptr
=
&
tsMaxNumOfDistinctResults
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
minValue
=
10
*
10000
;
cfg
.
maxValue
=
10000
*
10000
;
cfg
.
minValue
=
10
*
10000
;
cfg
.
maxValue
=
10000
*
10000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
...
...
@@ -1280,6 +1283,17 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
// pContext in cache
cfg
.
option
=
"httpKeepAlive"
;
cfg
.
ptr
=
&
tsHttpKeepAlive
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
3000
;
cfg
.
maxValue
=
3600000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
// debug flag
cfg
.
option
=
"numOfLogLines"
;
cfg
.
ptr
=
&
tsNumOfLogLines
;
...
...
@@ -1361,7 +1375,6 @@ static void doInitGlobalConfig(void) {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"sdbDebugFlag"
;
cfg
.
ptr
=
&
sdbDebugFlag
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
...
...
@@ -1648,12 +1661,9 @@ static void doInitGlobalConfig(void) {
#else
assert
(
tsGlobalConfigNum
==
TSDB_CFG_MAX_NUM
-
5
);
#endif
}
void
taosInitGlobalCfg
()
{
pthread_once
(
&
tsInitGlobalCfgOnce
,
doInitGlobalConfig
);
}
void
taosInitGlobalCfg
()
{
pthread_once
(
&
tsInitGlobalCfgOnce
,
doInitGlobalConfig
);
}
int32_t
taosCheckGlobalCfg
()
{
char
fqdn
[
TSDB_FQDN_LEN
];
...
...
@@ -1711,8 +1721,8 @@ int32_t taosCheckGlobalCfg() {
}
if
(
tsMaxTablePerVnode
<
tsMinTablePerVnode
)
{
uError
(
"maxTablesPerVnode(%d) < minTablesPerVnode(%d), reset to minTablesPerVnode(%d)"
,
tsMaxTablePerVnode
,
tsMinTablePerVnode
,
tsMinTablePerVnode
);
uError
(
"maxTablesPerVnode(%d) < minTablesPerVnode(%d), reset to minTablesPerVnode(%d)"
,
tsMaxTablePerVnode
,
tsMinTablePerVnode
,
tsMinTablePerVnode
);
tsMaxTablePerVnode
=
tsMinTablePerVnode
;
}
...
...
@@ -1756,7 +1766,7 @@ int taosGetFqdnPortFromEp(const char *ep, char *fqdn, uint16_t *port) {
char
*
temp
=
strchr
(
fqdn
,
':'
);
if
(
temp
)
{
*
temp
=
0
;
*
port
=
atoi
(
temp
+
1
);
*
port
=
atoi
(
temp
+
1
);
}
if
(
*
port
==
0
)
{
...
...
src/connector/jdbc/pom.xml
浏览文件 @
51259460
...
...
@@ -112,6 +112,7 @@
<include>
**/*Test.java
</include>
</includes>
<excludes>
<exclude>
**/HttpClientPoolUtilTest.java
</exclude>
<exclude>
**/AppMemoryLeakTest.java
</exclude>
<exclude>
**/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java
</exclude>
<exclude>
**/DatetimeBefore1970Test.java
</exclude>
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
浏览文件 @
51259460
...
...
@@ -31,6 +31,8 @@ public class TSDBErrorNumbers {
public
static
final
int
ERROR_RESTFul_Client_IOException
=
0x2318
;
public
static
final
int
ERROR_USER_IS_REQUIRED
=
0x2319
;
// user is required
public
static
final
int
ERROR_PASSWORD_IS_REQUIRED
=
0x231a
;
// password is required
public
static
final
int
ERROR_INVALID_JSON_FORMAT
=
0x231b
;
public
static
final
int
ERROR_HTTP_ENTITY_IS_NULL
=
0x231c
;
//http entity is null
public
static
final
int
ERROR_UNKNOWN
=
0x2350
;
//unknown error
...
...
@@ -72,6 +74,8 @@ public class TSDBErrorNumbers {
errorNumbers
.
add
(
ERROR_RESTFul_Client_IOException
);
errorNumbers
.
add
(
ERROR_USER_IS_REQUIRED
);
errorNumbers
.
add
(
ERROR_PASSWORD_IS_REQUIRED
);
errorNumbers
.
add
(
ERROR_INVALID_JSON_FORMAT
);
errorNumbers
.
add
(
ERROR_HTTP_ENTITY_IS_NULL
);
errorNumbers
.
add
(
ERROR_RESTFul_Client_Protocol_Exception
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/HttpClientPoolUtil.java
浏览文件 @
51259460
...
...
@@ -5,6 +5,7 @@ import com.taosdata.jdbc.TSDBErrorNumbers;
import
org.apache.http.HeaderElement
;
import
org.apache.http.HeaderElementIterator
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.NoHttpResponseException
;
import
org.apache.http.client.ClientProtocolException
;
import
org.apache.http.client.HttpRequestRetryHandler
;
import
org.apache.http.client.config.RequestConfig
;
...
...
@@ -30,12 +31,12 @@ import java.sql.SQLException;
public
class
HttpClientPoolUtil
{
private
static
final
String
DEFAULT_CONTENT_TYPE
=
"application/json"
;
private
static
final
int
DEFAULT_MAX_TOTAL
=
200
;
private
static
final
int
DEFAULT_MAX_PER_ROUTE
=
20
;
private
static
final
int
DEFAULT_TIME_OUT
=
15000
;
private
static
final
int
DEFAULT_HTTP_KEEP_TIME
=
15000
;
private
static
final
int
DEFAULT_MAX_RETRY_COUNT
=
5
;
private
static
final
int
DEFAULT_MAX_TOTAL
=
50
;
private
static
final
int
DEFAULT_MAX_PER_ROUTE
=
5
;
private
static
final
int
DEFAULT_HTTP_KEEP_TIME
=
-
1
;
private
static
final
ConnectionKeepAliveStrategy
DEFAULT_KEEP_ALIVE_STRATEGY
=
(
response
,
context
)
->
{
HeaderElementIterator
it
=
new
BasicHeaderElementIterator
(
response
.
headerIterator
(
HTTP
.
CONN_KEEP_ALIVE
));
while
(
it
.
hasNext
())
{
...
...
@@ -52,29 +53,19 @@ public class HttpClientPoolUtil {
return
DEFAULT_HTTP_KEEP_TIME
*
1000
;
};
private
static
final
HttpRequestRetryHandler
retryHandler
=
(
exception
,
executionCount
,
httpContext
)
->
{
if
(
executionCount
>=
DEFAULT_MAX_RETRY_COUNT
)
// do not retry if over max retry count
return
false
;
if
(
exception
instanceof
InterruptedIOException
)
// timeout
return
false
;
if
(
exception
instanceof
UnknownHostException
)
// unknown host
return
false
;
if
(
exception
instanceof
SSLException
)
// SSL handshake exception
return
false
;
return
true
;
};
private
static
CloseableHttpClient
httpClient
;
static
{
PoolingHttpClientConnectionManager
connectionManager
=
new
PoolingHttpClientConnectionManager
();
connectionManager
.
setMaxTotal
(
DEFAULT_MAX_TOTAL
);
connectionManager
.
setDefaultMaxPerRoute
(
DEFAULT_MAX_PER_ROUTE
);
httpClient
=
HttpClients
.
custom
().
setKeepAliveStrategy
(
DEFAULT_KEEP_ALIVE_STRATEGY
).
setConnectionManager
(
connectionManager
).
setRetryHandler
(
retryHandler
).
build
();
httpClient
=
HttpClients
.
custom
()
.
setKeepAliveStrategy
(
DEFAULT_KEEP_ALIVE_STRATEGY
)
.
setConnectionManager
(
connectionManager
)
.
setRetryHandler
((
exception
,
executionCount
,
httpContext
)
->
executionCount
<
DEFAULT_MAX_RETRY_COUNT
)
.
build
();
}
/*** execute GET request ***/
...
...
@@ -118,9 +109,10 @@ public class HttpClientPoolUtil {
HttpContext
context
=
HttpClientContext
.
create
();
CloseableHttpResponse
httpResponse
=
httpClient
.
execute
(
method
,
context
);
httpEntity
=
httpResponse
.
getEntity
();
if
(
httpEntity
!
=
null
)
{
responseBody
=
EntityUtils
.
toString
(
httpEntity
,
StandardCharsets
.
UTF_8
);
if
(
httpEntity
=
=
null
)
{
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_HTTP_ENTITY_IS_NULL
,
"httpEntity is null, sql: "
+
data
);
}
responseBody
=
EntityUtils
.
toString
(
httpEntity
,
StandardCharsets
.
UTF_8
);
}
catch
(
ClientProtocolException
e
)
{
e
.
printStackTrace
();
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_RESTFul_Client_Protocol_Exception
,
e
.
getMessage
());
...
...
@@ -139,9 +131,6 @@ public class HttpClientPoolUtil {
private
static
HttpRequestBase
getRequest
(
String
uri
,
String
methodName
)
{
HttpRequestBase
method
;
RequestConfig
requestConfig
=
RequestConfig
.
custom
()
.
setSocketTimeout
(
DEFAULT_TIME_OUT
*
1000
)
.
setConnectTimeout
(
DEFAULT_TIME_OUT
*
1000
)
.
setConnectionRequestTimeout
(
DEFAULT_TIME_OUT
*
1000
)
.
setExpectContinueEnabled
(
false
)
.
build
();
if
(
HttpPut
.
METHOD_NAME
.
equalsIgnoreCase
(
methodName
))
{
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/HttpClientPoolUtilTest.java
0 → 100644
浏览文件 @
51259460
package
com.taosdata.jdbc.utils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.taosdata.jdbc.TSDBDriver
;
import
com.taosdata.jdbc.TSDBError
;
import
org.junit.Test
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.sql.SQLException
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
public
class
HttpClientPoolUtilTest
{
String
user
=
"root"
;
String
password
=
"taosdata"
;
String
host
=
"127.0.0.1"
;
String
dbname
=
"log"
;
@Test
public
void
test
()
{
// given
List
<
Thread
>
threads
=
IntStream
.
range
(
0
,
4000
).
mapToObj
(
i
->
new
Thread
(()
->
{
useDB
();
// try {
// TimeUnit.SECONDS.sleep(10);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
})).
collect
(
Collectors
.
toList
());
threads
.
forEach
(
Thread:
:
start
);
for
(
Thread
thread
:
threads
)
{
try
{
thread
.
join
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
private
void
useDB
()
{
try
{
user
=
URLEncoder
.
encode
(
user
,
StandardCharsets
.
UTF_8
.
displayName
());
password
=
URLEncoder
.
encode
(
password
,
StandardCharsets
.
UTF_8
.
displayName
());
String
loginUrl
=
"http://"
+
host
+
":"
+
6041
+
"/rest/login/"
+
user
+
"/"
+
password
+
""
;
String
result
=
HttpClientPoolUtil
.
execute
(
loginUrl
);
JSONObject
jsonResult
=
JSON
.
parseObject
(
result
);
String
status
=
jsonResult
.
getString
(
"status"
);
String
token
=
jsonResult
.
getString
(
"desc"
);
if
(!
status
.
equals
(
"succ"
))
{
throw
new
SQLException
(
jsonResult
.
getString
(
"desc"
));
}
String
url
=
"http://"
+
host
+
":6041/rest/sql"
;
String
sql
=
"use "
+
dbname
;
result
=
HttpClientPoolUtil
.
execute
(
url
,
sql
,
token
);
JSONObject
resultJson
=
JSON
.
parseObject
(
result
);
if
(
resultJson
.
getString
(
"status"
).
equals
(
"error"
))
{
throw
TSDBError
.
createSQLException
(
resultJson
.
getInteger
(
"code"
),
resultJson
.
getString
(
"desc"
));
}
}
catch
(
UnsupportedEncodingException
|
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
src/inc/taosmsg.h
浏览文件 @
51259460
...
...
@@ -400,7 +400,7 @@ typedef struct SColIndex {
int16_t
colId
;
// column id
int16_t
colIndex
;
// column index in colList if it is a normal column or index in tagColList if a tag
uint16_t
flag
;
// denote if it is a tag or a normal column
char
name
[
TSDB_COL_NAME_LEN
+
TSDB_
DB
_NAME_LEN
+
1
];
char
name
[
TSDB_COL_NAME_LEN
+
TSDB_
TABLE
_NAME_LEN
+
1
];
}
SColIndex
;
typedef
struct
SColumnFilterInfo
{
...
...
src/inc/ttokendef.h
浏览文件 @
51259460
...
...
@@ -211,6 +211,7 @@
#define TK_INSERT 193
#define TK_INTO 194
#define TK_VALUES 195
#define TK_FILE 196
#define TK_SPACE 300
...
...
@@ -219,7 +220,6 @@
#define TK_HEX 303 // hex number 0x123
#define TK_OCT 304 // oct number
#define TK_BIN 305 // bin format data 0b111
#define TK_FILE 306
#define TK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query
#endif
...
...
src/kit/shell/src/shellImport.c
浏览文件 @
51259460
...
...
@@ -25,7 +25,7 @@
static
char
**
shellSQLFiles
=
NULL
;
static
int32_t
shellSQLFileNum
=
0
;
static
char
shellTablesSQLFile
[
TSDB_FILENAME_LEN
]
=
{
0
};
static
char
shellTablesSQLFile
[
4096
]
=
{
0
};
typedef
struct
{
pthread_t
threadID
;
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
src/kit/taosdump/taosdump.c
浏览文件 @
51259460
...
...
@@ -1972,7 +1972,7 @@ static int getTableDes(
while
((
row
=
taos_fetch_row
(
res
))
!=
NULL
)
{
tstrncpy
(
tableDes
->
cols
[
colCount
].
field
,
(
char
*
)
row
[
TSDB_DESCRIBE_METRIC_FIELD_INDEX
],
min
(
TSDB_COL_NAME_LEN
+
1
,
min
(
TSDB_COL_NAME_LEN
,
fields
[
TSDB_DESCRIBE_METRIC_FIELD_INDEX
].
bytes
+
1
));
tstrncpy
(
tableDes
->
cols
[
colCount
].
type
,
(
char
*
)
row
[
TSDB_DESCRIBE_METRIC_TYPE_INDEX
],
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
51259460
...
...
@@ -1136,7 +1136,7 @@ static int32_t mnodeAlterDbFp(SMnodeMsg *pMsg) {
return
sdbUpdateRow
(
&
row
);
}
//
bnNotify();
bnNotify
();
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
51259460
...
...
@@ -742,19 +742,6 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
return
0
;
}
static
bool
mnodeFilterVgroups
(
SVgObj
*
pVgroup
,
STableObj
*
pTable
)
{
if
(
NULL
==
pTable
||
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
return
true
;
}
SCTableObj
*
pCTable
=
(
SCTableObj
*
)
pTable
;
if
(
pVgroup
->
vgId
==
pCTable
->
vgId
)
{
return
true
;
}
else
{
return
false
;
}
}
static
int32_t
mnodeRetrieveVgroups
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
)
{
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
...
...
@@ -770,11 +757,6 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v
return
0
;
}
STableObj
*
pTable
=
NULL
;
if
(
pShow
->
payloadLen
>
0
)
{
pTable
=
mnodeGetTable
(
pShow
->
payload
);
}
while
(
numOfRows
<
rows
)
{
pShow
->
pIter
=
mnodeGetNextVgroup
(
pShow
->
pIter
,
&
pVgroup
);
if
(
pVgroup
==
NULL
)
break
;
...
...
@@ -784,11 +766,6 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v
continue
;
}
if
(
!
mnodeFilterVgroups
(
pVgroup
,
pTable
))
{
mnodeDecVgroupRef
(
pVgroup
);
continue
;
}
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
@@ -842,7 +819,6 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v
mnodeVacuumResult
(
data
,
pShow
->
numOfColumns
,
numOfRows
,
rows
,
pShow
);
pShow
->
numOfReads
+=
numOfRows
;
mnodeDecTableRef
(
pTable
);
mnodeDecDbRef
(
pDb
);
return
numOfRows
;
...
...
src/os/src/darwin/dwSysInfo.c
浏览文件 @
51259460
...
...
@@ -65,6 +65,8 @@ static void taosGetSystemTimezone() {
struct
tm
tm1
;
localtime_r
(
&
tx1
,
&
tm1
);
tsDaylight
=
daylight
;
/*
* format example:
*
...
...
src/os/src/detail/osSysinfo.c
浏览文件 @
51259460
...
...
@@ -213,6 +213,8 @@ static void taosGetSystemTimezone() {
int32_t
tz
=
(
-
timezone
*
MILLISECOND_PER_SECOND
)
/
MILLISECOND_PER_HOUR
;
tz
+=
daylight
;
tsDaylight
=
daylight
;
/*
* format example:
*
...
...
src/os/src/windows/wSysinfo.c
浏览文件 @
51259460
...
...
@@ -91,6 +91,17 @@ static void taosGetSystemTimezone() {
strcpy
(
tsTimezone
,
tz
);
}
cfg_timezone
->
cfgStatus
=
TAOS_CFG_CSTATUS_DEFAULT
;
#ifdef _MSC_VER
#if _MSC_VER >= 1900
int64_t
timezone
=
_timezone
;
int32_t
daylight
=
_daylight
;
char
**
tzname
=
_tzname
;
#endif
#endif
tsDaylight
=
daylight
;
uInfo
(
"timezone not configured, use default"
);
}
}
...
...
src/plugins/http/inc/httpInt.h
浏览文件 @
51259460
...
...
@@ -154,12 +154,13 @@ typedef struct HttpContext {
char
db
[
/*TSDB_ACCT_ID_LEN + */
TSDB_DB_NAME_LEN
];
TAOS
*
taos
;
void
*
ppContext
;
pthread_mutex_t
ctxMutex
;
HttpSession
*
session
;
z_stream
gzipStream
;
HttpParser
*
parser
;
HttpSqlCmd
singleCmd
;
HttpSqlCmds
*
multiCmds
;
JsonBuf
*
jsonBuf
;
JsonBuf
*
jsonBuf
;
HttpEncodeMethod
*
encodeMethod
;
HttpDecodeMethod
*
decodeMethod
;
struct
HttpThread
*
pThread
;
...
...
src/plugins/http/src/httpContext.c
浏览文件 @
51259460
...
...
@@ -67,6 +67,8 @@ static void httpDestroyContext(void *data) {
pContext
->
parser
=
NULL
;
}
pthread_mutex_destroy
(
&
pContext
->
ctxMutex
);
tfree
(
pContext
);
}
...
...
@@ -121,13 +123,15 @@ HttpContext *httpCreateContext(SOCKET fd) {
TSDB_CACHE_PTR_TYPE
handleVal
=
(
TSDB_CACHE_PTR_TYPE
)
pContext
;
HttpContext
**
ppContext
=
taosCachePut
(
tsHttpServer
.
contextCache
,
&
handleVal
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
&
pContext
,
sizeof
(
TSDB_CACHE_PTR_TYPE
),
3000
);
sizeof
(
TSDB_CACHE_PTR_TYPE
),
tsHttpKeepAlive
);
pContext
->
ppContext
=
ppContext
;
httpDebug
(
"context:%p, fd:%d, is created, data:%p"
,
pContext
,
fd
,
ppContext
);
// set the ref to 0
taosCacheRelease
(
tsHttpServer
.
contextCache
,
(
void
**
)
&
ppContext
,
false
);
pthread_mutex_init
(
&
pContext
->
ctxMutex
,
NULL
);
return
pContext
;
}
...
...
src/plugins/http/src/httpHandle.c
浏览文件 @
51259460
...
...
@@ -45,15 +45,14 @@ bool httpProcessData(HttpContext* pContext) {
httpTrace
(
"context:%p, fd:%d, process options request"
,
pContext
,
pContext
->
fd
);
httpSendOptionResp
(
pContext
,
"process options request success"
);
}
else
{
if
(
!
httpDecodeRequest
(
pContext
))
{
/*
* httpCloseContextByApp has been called when parsing the error
*/
// httpCloseContextByApp(pContext);
}
else
{
pthread_mutex_lock
(
&
pContext
->
ctxMutex
);
if
(
httpDecodeRequest
(
pContext
))
{
httpClearParser
(
pContext
->
parser
);
httpProcessRequest
(
pContext
);
}
pthread_mutex_unlock
(
&
pContext
->
ctxMutex
);
}
return
true
;
...
...
src/plugins/http/src/httpSql.c
浏览文件 @
51259460
...
...
@@ -406,7 +406,14 @@ void httpProcessRequestCb(void *param, TAOS_RES *result, int32_t code) {
if
(
pContext
->
session
==
NULL
)
{
httpSendErrorResp
(
pContext
,
TSDB_CODE_HTTP_SESSION_FULL
);
}
else
{
// httpProcessRequestCb called by another thread and a subsequent thread calls this
// function again, if this function called by httpProcessRequestCb executes memset
// just before the subsequent thread executes *Cmd function, nativSql will be NULL
pthread_mutex_lock
(
&
pContext
->
ctxMutex
);
httpExecCmd
(
pContext
);
pthread_mutex_unlock
(
&
pContext
->
ctxMutex
);
}
}
...
...
src/query/inc/qExecutor.h
浏览文件 @
51259460
...
...
@@ -43,6 +43,8 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int
#define GET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:((_r)->outputBuf)->info.rows)
#define RESET_NUM_OF_RESULTS(_r) (((_r)->outputBuf) == NULL? 0:(((_r)->outputBuf)->info.rows = 0))
enum
{
// when query starts to execute, this status will set
QUERY_NOT_COMPLETED
=
0x1u
,
...
...
@@ -389,6 +391,7 @@ typedef struct SQInfo {
int32_t
dataReady
;
// denote if query result is ready or not
void
*
rspContext
;
// response context
int64_t
startExecTs
;
// start to exec timestamp
int64_t
lastRetrieveTs
;
// last retrieve timestamp
char
*
sql
;
// query sql string
SQueryCostInfo
summary
;
}
SQInfo
;
...
...
src/query/inc/sql.y
浏览文件 @
51259460
...
...
@@ -128,12 +128,6 @@ cmd ::= SHOW dbPrefix(X) VGROUPS. {
setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, 0);
}
cmd ::= SHOW dbPrefix(X) VGROUPS ids(Y). {
SStrToken token;
tSetDbName(&token, &X);
setShowOptions(pInfo, TSDB_MGMT_TABLE_VGROUP, &token, &Y);
}
//drop configure for tables
cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
X.n += Z.n;
...
...
@@ -919,4 +913,4 @@ cmd ::= KILL QUERY INTEGER(X) COLON(Z) INTEGER(Y). {X.n += (Z.n + Y.n); s
%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
NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT TBNAME JOIN STABLE NULL INSERT INTO VALUES.
NOW IPTOKEN SEMI NONE PREV LINEAR IMPORT TBNAME JOIN STABLE NULL INSERT INTO VALUES
FILE
.
src/query/src/qAggMain.c
浏览文件 @
51259460
...
...
@@ -758,7 +758,7 @@ static int32_t lastDistFuncRequired(SQLFunctionCtx *pCtx, STimeWindow* w, int32_
if
(
pInfo
->
hasResult
!=
DATA_SET_FLAG
)
{
return
BLK_DATA_ALL_NEEDED
;
}
else
{
return
(
pInfo
->
ts
>
w
->
ekey
)
?
BLK_DATA_NO_NEEDED
:
BLK_DATA_ALL_NEEDED
;
return
(
pInfo
->
ts
>
=
w
->
ekey
)
?
BLK_DATA_NO_NEEDED
:
BLK_DATA_ALL_NEEDED
;
}
}
...
...
src/query/src/qExecutor.c
浏览文件 @
51259460
...
...
@@ -2430,11 +2430,11 @@ bool isQueryKilled(SQInfo *pQInfo) {
// query has been executed more than tsShellActivityTimer, and the retrieve has not arrived
// abort current query execution.
if
(
pQInfo
->
owner
!=
0
&&
((
taosGetTimestampSec
()
-
pQInfo
->
startExecTs
)
>
getMaximumIdleDurationSec
())
&&
if
(
pQInfo
->
owner
!=
0
&&
((
taosGetTimestampSec
()
-
pQInfo
->
lastRetrieveTs
/
1000
)
>
getMaximumIdleDurationSec
())
&&
(
!
needBuildResAfterQueryComplete
(
pQInfo
)))
{
assert
(
pQInfo
->
startExecTs
!=
0
);
qDebug
(
"QInfo:%"
PRIu64
" retrieve not arrive beyond %d
sec
, abort current query execution, start:%"
PRId64
qDebug
(
"QInfo:%"
PRIu64
" retrieve not arrive beyond %d
ms
, abort current query execution, start:%"
PRId64
", current:%d"
,
pQInfo
->
qId
,
1
,
pQInfo
->
startExecTs
,
taosGetTimestampSec
());
return
true
;
}
...
...
src/query/src/queryMain.c
浏览文件 @
51259460
...
...
@@ -213,7 +213,10 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
}
*
qId
=
pQInfo
->
qId
;
pQInfo
->
startExecTs
=
taosGetTimestampSec
();
if
(
pQInfo
->
startExecTs
==
0
)
{
pQInfo
->
startExecTs
=
taosGetTimestampMs
();
pQInfo
->
lastRetrieveTs
=
pQInfo
->
startExecTs
;
}
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:0x%"
PRIx64
" it is already killed, abort"
,
pQInfo
->
qId
);
...
...
@@ -343,6 +346,9 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
setQueryStatus
(
pRuntimeEnv
,
QUERY_OVER
);
}
RESET_NUM_OF_RESULTS
(
&
(
pQInfo
->
runtimeEnv
));
pQInfo
->
lastRetrieveTs
=
taosGetTimestampMs
();
pQInfo
->
rspContext
=
NULL
;
pQInfo
->
dataReady
=
QUERY_RESULT_NOT_READY
;
...
...
src/query/src/sql.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
src/sync/src/syncRetrieve.c
浏览文件 @
51259460
...
...
@@ -233,7 +233,7 @@ static int64_t syncProcessLastWal(SSyncPeer *pPeer, char *wname, int64_t index)
int32_t
once
=
0
;
// last WAL has once ever been processed
int64_t
offset
=
0
;
uint64_t
fversion
=
0
;
char
fname
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
// full path to wal file
char
fname
[
TSDB_FILENAME_LEN
*
3
]
=
{
0
};
// full path to wal file
// get full path to wal file
snprintf
(
fname
,
sizeof
(
fname
),
"%s/%s"
,
pNode
->
path
,
wname
);
...
...
src/tsdb/inc/tsdbMeta.h
浏览文件 @
51259460
...
...
@@ -41,6 +41,7 @@ typedef struct STable {
int16_t
restoreColumnNum
;
bool
hasRestoreLastColumn
;
int
lastColSVersion
;
int16_t
cacheLastConfigVersion
;
T_REF_DECLARE
()
}
STable
;
...
...
src/tsdb/inc/tsdbint.h
浏览文件 @
51259460
...
...
@@ -80,7 +80,7 @@ struct STsdbRepo {
bool
config_changed
;
// config changed flag
pthread_mutex_t
save_mutex
;
// protect save config
uint8_t
hasCachedLastColum
n
;
int16_t
cacheLastConfigVersio
n
;
STsdbAppH
appH
;
STsdbStat
stat
;
...
...
@@ -110,7 +110,8 @@ int tsdbUnlockRepo(STsdbRepo* pRepo);
STsdbMeta
*
tsdbGetMeta
(
STsdbRepo
*
pRepo
);
int
tsdbCheckCommit
(
STsdbRepo
*
pRepo
);
int
tsdbRestoreInfo
(
STsdbRepo
*
pRepo
);
int
tsdbCacheLastData
(
STsdbRepo
*
pRepo
,
STsdbCfg
*
oldCfg
);
UNUSED_FUNC
int
tsdbCacheLastData
(
STsdbRepo
*
pRepo
,
STsdbCfg
*
oldCfg
);
int32_t
tsdbLoadLastCache
(
STsdbRepo
*
pRepo
,
STable
*
pTable
);
void
tsdbGetRootDir
(
int
repoid
,
char
dirName
[]);
void
tsdbGetDataDir
(
int
repoid
,
char
dirName
[]);
...
...
src/tsdb/src/tsdbCommit.c
浏览文件 @
51259460
...
...
@@ -223,7 +223,7 @@ int tsdbWriteBlockIdx(SDFile *pHeadf, SArray *pIdxA, void **ppBuf) {
SBlockIdx
*
pBlkIdx
;
size_t
nidx
=
taosArrayGetSize
(
pIdxA
);
int
tlen
=
0
,
size
;
int64_t
offset
;
int64_t
offset
=
0
;
if
(
nidx
<=
0
)
{
// All data are deleted
...
...
src/tsdb/src/tsdbCommitQueue.c
浏览文件 @
51259460
...
...
@@ -146,7 +146,9 @@ static void tsdbApplyRepoConfig(STsdbRepo *pRepo) {
if
(
oldCfg
.
cacheLastRow
!=
pRepo
->
config
.
cacheLastRow
)
{
if
(
tsdbLockRepo
(
pRepo
)
<
0
)
return
;
tsdbCacheLastData
(
pRepo
,
&
oldCfg
);
// tsdbCacheLastData(pRepo, &oldCfg);
// lazy load last cache when query or update
++
pRepo
->
cacheLastConfigVersion
;
tsdbUnlockRepo
(
pRepo
);
}
...
...
src/tsdb/src/tsdbCompact.c
浏览文件 @
51259460
...
...
@@ -64,7 +64,9 @@ int tsdbCompact(STsdbRepo *pRepo) { return tsdbAsyncCompact(pRepo); }
void
*
tsdbCompactImpl
(
STsdbRepo
*
pRepo
)
{
// Check if there are files in TSDB FS to compact
if
(
REPO_FS
(
pRepo
)
->
cstatus
->
pmf
==
NULL
)
{
tsdbInfo
(
"vgId:%d no file to compact in FS"
,
REPO_ID
(
pRepo
));
pRepo
->
compactState
=
TSDB_NO_COMPACT
;
tsem_post
(
&
(
pRepo
->
readyToCommit
));
tsdbInfo
(
"vgId:%d compact over, no file to compact in FS"
,
REPO_ID
(
pRepo
));
return
NULL
;
}
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
51259460
...
...
@@ -562,7 +562,7 @@ static STsdbRepo *tsdbNewRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) {
return
NULL
;
}
pRepo
->
config_changed
=
false
;
atomic_store_8
(
&
pRepo
->
hasCachedLastColumn
,
0
)
;
pRepo
->
cacheLastConfigVersion
=
0
;
code
=
tsem_init
(
&
(
pRepo
->
readyToCommit
),
0
,
1
);
if
(
code
!=
0
)
{
...
...
@@ -711,7 +711,7 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
tsdbGetBlockStatis
(
pReadh
,
pBlockStatis
,
(
int
)
numColumns
);
loadStatisData
=
true
;
}
TSDB_WLOCK_TABLE
(
pTable
);
// lock when update pTable->lastCols[]
for
(
int16_t
i
=
0
;
i
<
numColumns
&&
numColumns
>
pTable
->
restoreColumnNum
;
++
i
)
{
STColumn
*
pCol
=
schemaColAt
(
pSchema
,
i
);
// ignore loaded columns
...
...
@@ -760,6 +760,7 @@ static int tsdbRestoreLastColumns(STsdbRepo *pRepo, STable *pTable, SReadH* pRea
break
;
}
}
TSDB_WUNLOCK_TABLE
(
pTable
);
}
out:
...
...
@@ -774,7 +775,6 @@ out:
}
static
int
tsdbRestoreLastRow
(
STsdbRepo
*
pRepo
,
STable
*
pTable
,
SReadH
*
pReadh
,
SBlockIdx
*
pIdx
)
{
ASSERT
(
pTable
->
lastRow
==
NULL
);
if
(
tsdbLoadBlockInfo
(
pReadh
,
NULL
)
<
0
)
{
return
-
1
;
}
...
...
@@ -788,21 +788,32 @@ static int tsdbRestoreLastRow(STsdbRepo *pRepo, STable *pTable, SReadH* pReadh,
// Get the data in row
STSchema
*
pSchema
=
tsdbGetTableSchema
(
pTable
);
pTable
->
lastRow
=
taosTMalloc
(
memRowMaxBytesFromSchema
(
pSchema
));
if
(
pTable
->
lastRow
==
NULL
)
{
SMemRow
lastRow
=
taosTMalloc
(
memRowMaxBytesFromSchema
(
pSchema
));
if
(
lastRow
==
NULL
)
{
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
-
1
;
}
memRowSetType
(
pTable
->
lastRow
,
SMEM_ROW_DATA
);
tdInitDataRow
(
memRowDataBody
(
pTable
->
lastRow
),
pSchema
);
memRowSetType
(
lastRow
,
SMEM_ROW_DATA
);
tdInitDataRow
(
memRowDataBody
(
lastRow
),
pSchema
);
for
(
int
icol
=
0
;
icol
<
schemaNCols
(
pSchema
);
icol
++
)
{
STColumn
*
pCol
=
schemaColAt
(
pSchema
,
icol
);
SDataCol
*
pDataCol
=
pReadh
->
pDCols
[
0
]
->
cols
+
icol
;
tdAppendColVal
(
memRowDataBody
(
pTable
->
lastRow
),
tdGetColDataOfRow
(
pDataCol
,
pBlock
->
numOfRows
-
1
),
pCol
->
type
,
tdAppendColVal
(
memRowDataBody
(
lastRow
),
tdGetColDataOfRow
(
pDataCol
,
pBlock
->
numOfRows
-
1
),
pCol
->
type
,
pCol
->
offset
);
}
pTable
->
lastKey
=
memRowKey
(
pTable
->
lastRow
);
TSKEY
lastKey
=
memRowKey
(
lastRow
);
// during the load data in file, new data would be inserted and last row has been updated
TSDB_WLOCK_TABLE
(
pTable
);
if
(
pTable
->
lastRow
==
NULL
)
{
pTable
->
lastKey
=
lastKey
;
pTable
->
lastRow
=
lastRow
;
TSDB_WUNLOCK_TABLE
(
pTable
);
}
else
{
TSDB_WUNLOCK_TABLE
(
pTable
);
taosTZfree
(
lastRow
);
}
return
0
;
}
...
...
@@ -874,14 +885,105 @@ int tsdbRestoreInfo(STsdbRepo *pRepo) {
tsdbDestroyReadH
(
&
readh
);
if
(
CACHE_LAST_NULL_COLUMN
(
pCfg
))
{
atomic_store_8
(
&
pRepo
->
hasCachedLastColumn
,
1
);
// if (CACHE_LAST_NULL_COLUMN(pCfg)) {
// atomic_store_8(&pRepo->hasCachedLastColumn, 1);
// }
return
0
;
}
int32_t
tsdbLoadLastCache
(
STsdbRepo
*
pRepo
,
STable
*
pTable
)
{
SFSIter
fsiter
;
SReadH
readh
;
SDFileSet
*
pSet
;
int
cacheLastRowTableNum
=
0
;
int
cacheLastColTableNum
=
0
;
bool
cacheLastRow
=
CACHE_LAST_ROW
(
&
(
pRepo
->
config
));
bool
cacheLastCol
=
CACHE_LAST_NULL_COLUMN
(
&
(
pRepo
->
config
));
tsdbDebug
(
"tsdbLoadLastCache for %s, cacheLastRow:%d, cacheLastCol:%d"
,
pTable
->
name
->
data
,
cacheLastRow
,
cacheLastCol
);
pTable
->
cacheLastConfigVersion
=
pRepo
->
cacheLastConfigVersion
;
if
(
!
cacheLastRow
&&
pTable
->
lastRow
!=
NULL
)
{
taosTZfree
(
pTable
->
lastRow
);
pTable
->
lastRow
=
NULL
;
}
if
(
!
cacheLastCol
&&
pTable
->
lastCols
!=
NULL
)
{
tsdbFreeLastColumns
(
pTable
);
}
if
(
!
cacheLastRow
&&
!
cacheLastCol
)
{
return
0
;
}
cacheLastRowTableNum
=
(
cacheLastRow
&&
pTable
->
lastRow
==
NULL
)
?
1
:
0
;
cacheLastColTableNum
=
(
cacheLastCol
&&
pTable
->
lastCols
==
NULL
)
?
1
:
0
;
if
(
cacheLastRowTableNum
==
0
&&
cacheLastColTableNum
==
0
)
{
return
0
;
}
if
(
tsdbInitReadH
(
&
readh
,
pRepo
)
<
0
)
{
return
-
1
;
}
tsdbRLockFS
(
REPO_FS
(
pRepo
));
tsdbFSIterInit
(
&
fsiter
,
REPO_FS
(
pRepo
),
TSDB_FS_ITER_BACKWARD
);
while
((
cacheLastRowTableNum
>
0
||
cacheLastColTableNum
>
0
)
&&
(
pSet
=
tsdbFSIterNext
(
&
fsiter
))
!=
NULL
)
{
if
(
tsdbSetAndOpenReadFSet
(
&
readh
,
pSet
)
<
0
)
{
tsdbUnLockFS
(
REPO_FS
(
pRepo
));
tsdbDestroyReadH
(
&
readh
);
return
-
1
;
}
if
(
tsdbLoadBlockIdx
(
&
readh
)
<
0
)
{
tsdbUnLockFS
(
REPO_FS
(
pRepo
));
tsdbDestroyReadH
(
&
readh
);
return
-
1
;
}
// tsdbDebug("tsdbRestoreInfo restore vgId:%d,table:%s", REPO_ID(pRepo), pTable->name->data);
if
(
tsdbSetReadTable
(
&
readh
,
pTable
)
<
0
)
{
tsdbUnLockFS
(
REPO_FS
(
pRepo
));
tsdbDestroyReadH
(
&
readh
);
return
-
1
;
}
SBlockIdx
*
pIdx
=
readh
.
pBlkIdx
;
if
(
pIdx
&&
(
cacheLastRowTableNum
>
0
)
&&
(
pTable
->
lastRow
==
NULL
))
{
if
(
tsdbRestoreLastRow
(
pRepo
,
pTable
,
&
readh
,
pIdx
)
!=
0
)
{
tsdbUnLockFS
(
REPO_FS
(
pRepo
));
tsdbDestroyReadH
(
&
readh
);
return
-
1
;
}
cacheLastRowTableNum
-=
1
;
}
// restore NULL columns
if
(
pIdx
&&
(
cacheLastColTableNum
>
0
)
&&
!
pTable
->
hasRestoreLastColumn
)
{
if
(
tsdbRestoreLastColumns
(
pRepo
,
pTable
,
&
readh
)
!=
0
)
{
tsdbUnLockFS
(
REPO_FS
(
pRepo
));
tsdbDestroyReadH
(
&
readh
);
return
-
1
;
}
if
(
pTable
->
hasRestoreLastColumn
)
{
cacheLastColTableNum
-=
1
;
}
}
}
tsdbUnLockFS
(
REPO_FS
(
pRepo
));
tsdbDestroyReadH
(
&
readh
);
return
0
;
}
int
tsdbCacheLastData
(
STsdbRepo
*
pRepo
,
STsdbCfg
*
oldCfg
)
{
UNUSED_FUNC
int
tsdbCacheLastData
(
STsdbRepo
*
pRepo
,
STsdbCfg
*
oldCfg
)
{
bool
cacheLastRow
=
false
,
cacheLastCol
=
false
;
SFSIter
fsiter
;
SReadH
readh
;
...
...
@@ -915,9 +1017,9 @@ int tsdbCacheLastData(STsdbRepo *pRepo, STsdbCfg* oldCfg) {
// if close last option,need to free data
if
(
need_free_last_row
||
need_free_last_col
)
{
if
(
need_free_last_col
)
{
atomic_store_8
(
&
pRepo
->
hasCachedLastColumn
,
0
);
}
//
if (need_free_last_col) {
//
atomic_store_8(&pRepo->hasCachedLastColumn, 0);
//
}
tsdbInfo
(
"free cache last data since cacheLast option changed"
);
for
(
int
i
=
1
;
i
<=
maxTableIdx
;
i
++
)
{
STable
*
pTable
=
pMeta
->
tables
[
i
];
...
...
@@ -995,9 +1097,9 @@ int tsdbCacheLastData(STsdbRepo *pRepo, STsdbCfg* oldCfg) {
tsdbDestroyReadH
(
&
readh
);
if
(
cacheLastCol
)
{
atomic_store_8
(
&
pRepo
->
hasCachedLastColumn
,
1
);
}
//
if (cacheLastCol) {
//
atomic_store_8(&pRepo->hasCachedLastColumn, 1);
//
}
return
0
;
}
src/tsdb/src/tsdbMemTable.c
浏览文件 @
51259460
...
...
@@ -996,7 +996,8 @@ static void updateTableLatestColumn(STsdbRepo *pRepo, STable *pTable, SMemRow ro
if
((
value
==
NULL
)
||
isNull
(
value
,
pTCol
->
type
))
{
continue
;
}
// lock
TSDB_WLOCK_TABLE
(
pTable
);
SDataCol
*
pDataCol
=
&
(
pLatestCols
[
idx
]);
if
(
pDataCol
->
pData
==
NULL
)
{
pDataCol
->
pData
=
malloc
(
pTCol
->
bytes
);
...
...
@@ -1012,6 +1013,8 @@ static void updateTableLatestColumn(STsdbRepo *pRepo, STable *pTable, SMemRow ro
memcpy
(
pDataCol
->
pData
,
value
,
bytes
);
//tsdbInfo("updateTableLatestColumn vgId:%d cache column %d for %d,%s", REPO_ID(pRepo), j, pDataCol->bytes, (char*)pDataCol->pData);
pDataCol
->
ts
=
memRowKey
(
row
);
// unlock
TSDB_WUNLOCK_TABLE
(
pTable
);
}
}
...
...
@@ -1058,5 +1061,8 @@ static int tsdbUpdateTableLatestInfo(STsdbRepo *pRepo, STable *pTable, SMemRow r
updateTableLatestColumn
(
pRepo
,
pTable
,
row
);
}
}
pTable
->
cacheLastConfigVersion
=
pRepo
->
cacheLastConfigVersion
;
return
0
;
}
src/tsdb/src/tsdbMeta.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
src/tsdb/src/tsdbRead.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
src/util/inc/tconfig.h
浏览文件 @
51259460
...
...
@@ -20,7 +20,7 @@
extern
"C"
{
#endif
#define TSDB_CFG_MAX_NUM 12
0
#define TSDB_CFG_MAX_NUM 12
1
#define TSDB_CFG_PRINT_LEN 23
#define TSDB_CFG_OPTION_LEN 24
#define TSDB_CFG_VALUE_LEN 41
...
...
src/util/src/talgo.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
src/util/src/tcompare.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
src/util/src/tlog.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/pytest/fulltest.sh
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/pytest/query/bug5903.py
0 → 100644
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/pytest/query/query.py
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/pytest/query/udf.py
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/pytest/table/create.py
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/pytest/tools/taosdemoTestTblAlt.py
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/script/api/batchprepare.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/script/general/parser/udf_dll.sim
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/script/general/parser/udf_dll_stable.sim
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/script/sh/abs_max.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/script/sh/add_one.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/script/sh/add_one_64232.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/script/sh/sum_double.c
浏览文件 @
51259460
此差异已折叠。
点击以展开。
tests/tsim/inc/sim.h
浏览文件 @
51259460
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录