Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c7a09b78
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看板
提交
c7a09b78
编写于
8月 19, 2022
作者:
M
Minghao Li
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/3.0_mhli
上级
f393f585
240747ab
变更
23
隐藏空白更改
内联
并排
Showing
23 changed file
with
344 addition
and
256 deletion
+344
-256
cmake/cmake.install
cmake/cmake.install
+1
-31
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+0
-18
docs/zh/17-operation/03-tolerance.md
docs/zh/17-operation/03-tolerance.md
+0
-2
packaging/tools/make_install.bat
packaging/tools/make_install.bat
+41
-1
packaging/tools/make_install.sh
packaging/tools/make_install.sh
+3
-1
source/common/src/tglobal.c
source/common/src/tglobal.c
+3
-3
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+4
-2
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-1
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+2
-1
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+1
-1
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+36
-20
source/dnode/vnode/src/tsdb/tsdbOpen.c
source/dnode/vnode/src/tsdb/tsdbOpen.c
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+18
-18
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+55
-21
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+5
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+9
-8
source/libs/stream/src/streamTask.c
source/libs/stream/src/streamTask.c
+2
-1
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+13
-0
source/libs/transport/src/thttp.c
source/libs/transport/src/thttp.c
+71
-94
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+15
-6
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+13
-5
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+34
-18
tests/script/tsim/stream/basic0.sim
tests/script/tsim/stream/basic0.sim
+15
-2
未找到文件。
cmake/cmake.install
浏览文件 @
c7a09b78
IF
(
EXISTS
/
var
/
lib
/
taos
/
dnode
/
dnodeCfg
.
json
)
IF
(
TD_LINUX
)
INSTALL
(
CODE
"MESSAGE(
\"
The default data directory /var/lib/taos contains old data of tdengine 2.x, please clear it before installing!
\"
)"
)
ELSEIF
(
EXISTS
C
:/
TDengine
/
data
/
dnode
/
dnodeCfg
.
json
)
INSTALL
(
CODE
"MESSAGE(
\"
The default data directory C:/TDengine/data contains old data of tdengine 2.x, please clear it before installing!
\"
)"
)
ELSEIF
(
TD_LINUX
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.sh"
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.sh"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})"
)
INSTALL
(
CODE
"execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})"
)
ELSEIF
(
TD_WINDOWS
)
ELSEIF
(
TD_WINDOWS
)
SET
(
CMAKE_INSTALL_PREFIX
C
:/
TDengine
)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/go DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/nodejs DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/python DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/C\# DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/examples DESTINATION .)
INSTALL
(
CODE
"IF (NOT EXISTS ${CMAKE_INSTALL_PREFIX}/cfg/taos.cfg)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${TD_SOURCE_DIR}/packaging/cfg/taos.cfg ${CMAKE_INSTALL_PREFIX}/cfg/taos.cfg)
ENDIF ()"
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
client
/
taos
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
util
/
taoserror
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
libs
/
function
/
taosudf
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos_static
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
dll
DESTINATION
driver
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taos
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taosd
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
udfd
.
exe
DESTINATION
.
)
IF
(
BUILD_TOOLS
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taosBenchmark
.
exe
DESTINATION
.
)
ENDIF
()
IF
(
TD_MVN_INSTALLED
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
-
jdbcdriver
-
2.0.38
-
dist
.
jar
DESTINATION
connector
/
jdbc
)
ENDIF
()
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.bat"
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.bat"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER})"
)
INSTALL
(
CODE
"execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER})"
)
...
...
contrib/CMakeLists.txt
浏览文件 @
c7a09b78
...
@@ -135,24 +135,6 @@ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
...
@@ -135,24 +135,6 @@ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
# clear submodule
execute_process
(
COMMAND git submodule deinit -f tools/taos-tools
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached tools/taos-tools
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git submodule deinit -f tools/taosadapter
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached tools/taosadapter
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git submodule deinit -f tools/taosws-rs
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached tools/taosws-rs
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git submodule deinit -f examples/rust
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached examples/rust
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
# ================================================================================================
# ================================================================================================
# Build
# Build
...
...
docs/zh/17-operation/03-tolerance.md
浏览文件 @
c7a09b78
...
@@ -26,5 +26,3 @@ TDengine 集群中的时序数据的副本数是与数据库关联的,一个
...
@@ -26,5 +26,3 @@ TDengine 集群中的时序数据的副本数是与数据库关联的,一个
TDengine 集群的节点数必须大于等于副本数,否则创建表时将报错。
TDengine 集群的节点数必须大于等于副本数,否则创建表时将报错。
当 TDengine 集群中的节点部署在不同的物理机上,并设置多个副本数时,就实现了系统的高可靠性,无需再使用其他软件或工具。TDengine 企业版还可以将副本部署在不同机房,从而实现异地容灾。
当 TDengine 集群中的节点部署在不同的物理机上,并设置多个副本数时,就实现了系统的高可靠性,无需再使用其他软件或工具。TDengine 企业版还可以将副本部署在不同机房,从而实现异地容灾。
另外一种灾备方式是通过
`taosX`
将一个 TDengine 集群的数据同步复制到物理上位于不同数据中心的另一个 TDengine 集群。其详细使用方法请参考
[
taosX 参考手册
](
../../reference/taosX
)
packaging/tools/make_install.bat
浏览文件 @
c7a09b78
@echo
off
@echo
off
goto
%
1
goto
%
1
:needAdmin
:needAdmin
if
exist
C
:\\TDengine\\data\\dnode\\dnodeCfg.json
(
echo
The
default
data
directory
C
:/TDengine/data
contains
old
data
of
tdengine
2
.x
,
please
clear
it
before
installing
!
)
set
source_dir
=
%
2
set
source_dir
=
%source
_dir:/
=
\\
%
set
binary_dir
=
%
3
set
binary_dir
=
%binary
_dir:/
=
\\
%
set
osType
=
%
4
set
verNumber
=
%
5
set
tagert_dir
=
C
:\\TDengine
if
not
exist
%tagert_dir%
(
mkdir
%tagert_dir%
)
if
not
exist
%tagert_dir%
\\cfg
(
mkdir
%tagert_dir%
\\cfg
)
if
not
exist
%tagert_dir%
\\include
(
mkdir
%tagert_dir%
\\include
)
if
not
exist
%tagert_dir%
\\driver
(
mkdir
%tagert_dir%
\\driver
)
if
not
exist
C
:\\TDengine\\cfg\\taos.cfg
(
copy
%source_dir%
\\packaging\\cfg\\taos.cfg
%tagert_dir%
\\cfg\\taos.cfg
>
nul
)
copy
%source_dir%
\\include\\client\\taos.h
%tagert_dir%
\\include
>
nul
copy
%source_dir%
\\include\\util\\taoserror.h
%tagert_dir%
\\include
>
nul
copy
%source_dir%
\\include\\libs\\function\\taosudf.h
%tagert_dir%
\\include
>
nul
copy
%binary_dir%
\\build\\lib\\taos.lib
%tagert_dir%
\\driver
>
nul
copy
%binary_dir%
\\build\\lib\\taos_static.lib
%tagert_dir%
\\driver
>
nul
copy
%binary_dir%
\\build\\lib\\taos.dll
%tagert_dir%
\\driver
>
nul
copy
%binary_dir%
\\build\\bin\\taos.exe
%tagert_dir%
>
nul
copy
%binary_dir%
\\build\\bin\\taosd.exe
%tagert_dir%
>
nul
copy
%binary_dir%
\\build\\bin\\udfd.exe
%tagert_dir%
>
nul
if
exist
%binary_dir%
\\build\\bin\\taosBenchmark.exe
(
copy
%binary_dir%
\\build\\bin\\taosBenchmark.exe
%tagert_dir%
>
nul
)
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&&
echo
To
start
/stop
TDengine
with
administrator
privileges
:
sc
start
/stop
taosd
&
goto
:eof
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&&
echo
To
start
/stop
TDengine
with
administrator
privileges
:
sc
start
/stop
taosd
&
goto
:eof
:hasAdmin
:hasAdmin
c
p
-f
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
c
opy
/y
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
>
nul
sc
query
"taosd"
>
nul
||
sc
create
"taosd"
binPath
=
"C:\\TDengine\\taosd.exe --win_service"
start
=
DEMAND
sc
query
"taosd"
>
nul
||
sc
create
"taosd"
binPath
=
"C:\\TDengine\\taosd.exe --win_service"
start
=
DEMAND
packaging/tools/make_install.sh
浏览文件 @
c7a09b78
...
@@ -664,7 +664,9 @@ function install_TDengine() {
...
@@ -664,7 +664,9 @@ function install_TDengine() {
## ==============================Main program starts from here============================
## ==============================Main program starts from here============================
echo source
directory:
$1
echo source
directory:
$1
echo
binary directory:
$2
echo
binary directory:
$2
if
[
"
$osType
"
!=
"Darwin"
]
;
then
if
[
-x
${
data_dir
}
/dnode/dnodeCfg.json
]
;
then
echo
-e
"
\0
33[44;31;5mThe default data directory
${
data_dir
}
contains old data of tdengine 2.x, please clear it before installing!
\0
33[0m"
elif
[
"
$osType
"
!=
"Darwin"
]
;
then
if
[
-x
${
bin_dir
}
/
${
clientName
}
]
;
then
if
[
-x
${
bin_dir
}
/
${
clientName
}
]
;
then
update_TDengine
update_TDengine
else
else
...
...
source/common/src/tglobal.c
浏览文件 @
c7a09b78
...
@@ -75,7 +75,7 @@ int32_t tsMonitorMaxLogs = 100;
...
@@ -75,7 +75,7 @@ int32_t tsMonitorMaxLogs = 100;
bool
tsMonitorComp
=
false
;
bool
tsMonitorComp
=
false
;
// telem
// telem
bool
tsEnableTelem
=
fals
e
;
bool
tsEnableTelem
=
tru
e
;
int32_t
tsTelemInterval
=
86400
;
int32_t
tsTelemInterval
=
86400
;
char
tsTelemServer
[
TSDB_FQDN_LEN
]
=
"telemetry.taosdata.com"
;
char
tsTelemServer
[
TSDB_FQDN_LEN
]
=
"telemetry.taosdata.com"
;
uint16_t
tsTelemPort
=
80
;
uint16_t
tsTelemPort
=
80
;
...
@@ -166,7 +166,7 @@ int32_t tsTtlPushInterval = 86400;
...
@@ -166,7 +166,7 @@ int32_t tsTtlPushInterval = 86400;
int32_t
tsGrantHBInterval
=
60
;
int32_t
tsGrantHBInterval
=
60
;
#ifndef _STORAGE
#ifndef _STORAGE
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
)
{
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"dataDir"
);
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"dataDir"
);
memset
(
tsDataDir
,
0
,
PATH_MAX
);
memset
(
tsDataDir
,
0
,
PATH_MAX
);
...
@@ -180,7 +180,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
...
@@ -180,7 +180,7 @@ int32_t taosSetTfsCfg(SConfig *pCfg) {
uError
(
"failed to create dataDir:%s"
,
tsDataDir
);
uError
(
"failed to create dataDir:%s"
,
tsDataDir
);
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
}
}
#else
#else
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
);
int32_t
taosSetTfsCfg
(
SConfig
*
pCfg
);
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
c7a09b78
...
@@ -489,7 +489,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -489,7 +489,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
smaObj
.
uid
=
mndGenerateUid
(
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
smaObj
.
uid
=
mndGenerateUid
(
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
ASSERT
(
smaObj
.
uid
!=
0
);
ASSERT
(
smaObj
.
uid
!=
0
);
char
resultTbName
[
TSDB_TABLE_FNAME_LEN
+
16
]
=
{
0
};
char
resultTbName
[
TSDB_TABLE_FNAME_LEN
+
16
]
=
{
0
};
snprintf
(
resultTbName
,
TSDB_TABLE_FNAME_LEN
+
16
,
"%s_td_tsma_rst_tb"
,
pCreate
->
name
);
snprintf
(
resultTbName
,
TSDB_TABLE_FNAME_LEN
+
16
,
"%s_td_tsma_rst_tb"
,
pCreate
->
name
);
memcpy
(
smaObj
.
dstTbName
,
resultTbName
,
TSDB_TABLE_FNAME_LEN
);
memcpy
(
smaObj
.
dstTbName
,
resultTbName
,
TSDB_TABLE_FNAME_LEN
);
smaObj
.
dstTbUid
=
mndGenerateUid
(
smaObj
.
dstTbName
,
TSDB_TABLE_FNAME_LEN
);
smaObj
.
dstTbUid
=
mndGenerateUid
(
smaObj
.
dstTbName
,
TSDB_TABLE_FNAME_LEN
);
smaObj
.
stbUid
=
pStb
->
uid
;
smaObj
.
stbUid
=
pStb
->
uid
;
...
@@ -530,7 +530,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -530,7 +530,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
streamObj
.
sourceDbUid
=
pDb
->
uid
;
streamObj
.
sourceDbUid
=
pDb
->
uid
;
streamObj
.
targetDbUid
=
pDb
->
uid
;
streamObj
.
targetDbUid
=
pDb
->
uid
;
streamObj
.
version
=
1
;
streamObj
.
version
=
1
;
streamObj
.
sql
=
pCreate
->
sql
;
streamObj
.
sql
=
strdup
(
pCreate
->
sql
)
;
streamObj
.
smaId
=
smaObj
.
uid
;
streamObj
.
smaId
=
smaObj
.
uid
;
streamObj
.
watermark
=
pCreate
->
watermark
;
streamObj
.
watermark
=
pCreate
->
watermark
;
streamObj
.
trigger
=
STREAM_TRIGGER_WINDOW_CLOSE
;
streamObj
.
trigger
=
STREAM_TRIGGER_WINDOW_CLOSE
;
...
@@ -585,6 +585,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -585,6 +585,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
return
-
1
;
return
-
1
;
}
}
if
(
pAst
!=
NULL
)
nodesDestroyNode
(
pAst
);
if
(
pAst
!=
NULL
)
nodesDestroyNode
(
pAst
);
nodesDestroyNode
((
SNode
*
)
pPlan
);
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
);
...
@@ -609,6 +610,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -609,6 +610,7 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
code
=
0
;
code
=
0
;
_OVER:
_OVER:
tFreeStreamObj
(
&
streamObj
);
mndDestroySmaObj
(
&
smaObj
);
mndDestroySmaObj
(
&
smaObj
);
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
code
;
return
code
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
c7a09b78
...
@@ -509,6 +509,7 @@ int32_t mndAllocSmaVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup) {
...
@@ -509,6 +509,7 @@ int32_t mndAllocSmaVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup) {
pVgroup
->
replica
=
1
;
pVgroup
->
replica
=
1
;
if
(
mndGetAvailableDnode
(
pMnode
,
pDb
,
pVgroup
,
pArray
)
!=
0
)
return
-
1
;
if
(
mndGetAvailableDnode
(
pMnode
,
pDb
,
pVgroup
,
pArray
)
!=
0
)
return
-
1
;
taosArrayDestroy
(
pArray
);
mInfo
(
"db:%s, sma vgId:%d is alloced"
,
pDb
->
name
,
pVgroup
->
vgId
);
mInfo
(
"db:%s, sma vgId:%d is alloced"
,
pDb
->
name
,
pVgroup
->
vgId
);
return
0
;
return
0
;
...
@@ -1862,4 +1863,4 @@ _OVER:
...
@@ -1862,4 +1863,4 @@ _OVER:
#endif
#endif
}
}
bool
mndVgroupInDb
(
SVgObj
*
pVgroup
,
int64_t
dbUid
)
{
return
!
pVgroup
->
isTsma
&&
pVgroup
->
dbUid
==
dbUid
;
}
bool
mndVgroupInDb
(
SVgObj
*
pVgroup
,
int64_t
dbUid
)
{
return
!
pVgroup
->
isTsma
&&
pVgroup
->
dbUid
==
dbUid
;
}
\ No newline at end of file
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
c7a09b78
...
@@ -260,7 +260,7 @@ void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap);
...
@@ -260,7 +260,7 @@ void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap);
// tsdbCache
// tsdbCache
int32_t
tsdbOpenCache
(
STsdb
*
pTsdb
);
int32_t
tsdbOpenCache
(
STsdb
*
pTsdb
);
void
tsdbCloseCache
(
S
LRUCache
*
pCache
);
void
tsdbCloseCache
(
S
Tsdb
*
pTsdb
);
int32_t
tsdbCacheInsertLast
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STSRow
*
row
,
STsdb
*
pTsdb
);
int32_t
tsdbCacheInsertLast
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STSRow
*
row
,
STsdb
*
pTsdb
);
int32_t
tsdbCacheInsertLastrow
(
SLRUCache
*
pCache
,
STsdb
*
pTsdb
,
tb_uid_t
uid
,
STSRow
*
row
,
bool
dup
);
int32_t
tsdbCacheInsertLastrow
(
SLRUCache
*
pCache
,
STsdb
*
pTsdb
,
tb_uid_t
uid
,
STSRow
*
row
,
bool
dup
);
int32_t
tsdbCacheGetLastH
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STsdb
*
pTsdb
,
LRUHandle
**
h
);
int32_t
tsdbCacheGetLastH
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STsdb
*
pTsdb
,
LRUHandle
**
h
);
...
@@ -298,6 +298,7 @@ struct STsdb {
...
@@ -298,6 +298,7 @@ struct STsdb {
SMemTable
*
imem
;
SMemTable
*
imem
;
STsdbFS
fs
;
STsdbFS
fs
;
SLRUCache
*
lruCache
;
SLRUCache
*
lruCache
;
TdThreadMutex
lruMutex
;
};
};
struct
TSDBKEY
{
struct
TSDBKEY
{
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
c7a09b78
...
@@ -341,7 +341,7 @@ FAIL:
...
@@ -341,7 +341,7 @@ FAIL:
return
-
1
;
return
-
1
;
}
}
void
tqReaderSetColIdList
(
STqReader
*
pRead
Handle
,
SArray
*
pColIdList
)
{
pReadHandle
->
pColIdList
=
pColIdList
;
}
void
tqReaderSetColIdList
(
STqReader
*
pRead
er
,
SArray
*
pColIdList
)
{
pReader
->
pColIdList
=
pColIdList
;
}
int
tqReaderSetTbUidList
(
STqReader
*
pReader
,
const
SArray
*
tbUidList
)
{
int
tqReaderSetTbUidList
(
STqReader
*
pReader
,
const
SArray
*
tbUidList
)
{
if
(
pReader
->
tbIdHash
)
{
if
(
pReader
->
tbIdHash
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
c7a09b78
...
@@ -33,16 +33,21 @@ int32_t tsdbOpenCache(STsdb *pTsdb) {
...
@@ -33,16 +33,21 @@ int32_t tsdbOpenCache(STsdb *pTsdb) {
taosLRUCacheSetStrictCapacity
(
pCache
,
true
);
taosLRUCacheSetStrictCapacity
(
pCache
,
true
);
taosThreadMutexInit
(
&
pTsdb
->
lruMutex
,
NULL
);
_err:
_err:
pTsdb
->
lruCache
=
pCache
;
pTsdb
->
lruCache
=
pCache
;
return
code
;
return
code
;
}
}
void
tsdbCloseCache
(
SLRUCache
*
pCache
)
{
void
tsdbCloseCache
(
STsdb
*
pTsdb
)
{
SLRUCache
*
pCache
=
pTsdb
->
lruCache
;
if
(
pCache
)
{
if
(
pCache
)
{
taosLRUCacheEraseUnrefEntries
(
pCache
);
taosLRUCacheEraseUnrefEntries
(
pCache
);
taosLRUCacheCleanup
(
pCache
);
taosLRUCacheCleanup
(
pCache
);
taosThreadMutexDestroy
(
&
pTsdb
->
lruMutex
);
}
}
}
}
...
@@ -1100,29 +1105,40 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUH
...
@@ -1100,29 +1105,40 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUH
// getTableCacheKeyS(uid, "lr", key, &keyLen);
// getTableCacheKeyS(uid, "lr", key, &keyLen);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
if
(
!
h
)
{
}
else
{
taosThreadMutexLock
(
&
pTsdb
->
lruMutex
);
STSRow
*
pRow
=
NULL
;
bool
dup
=
false
;
// which is always false for now
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
code
=
mergeLastRow
(
uid
,
pTsdb
,
&
dup
,
&
pRow
);
if
(
!
h
)
{
// if table's empty or error, return code of -1
STSRow
*
pRow
=
NULL
;
if
(
code
<
0
||
pRow
==
NULL
)
{
bool
dup
=
false
;
// which is always false for now
if
(
!
dup
&&
pRow
)
{
code
=
mergeLastRow
(
uid
,
pTsdb
,
&
dup
,
&
pRow
);
taosMemoryFree
(
pRow
);
// if table's empty or error, return code of -1
if
(
code
<
0
||
pRow
==
NULL
)
{
if
(
!
dup
&&
pRow
)
{
taosMemoryFree
(
pRow
);
}
taosThreadMutexUnlock
(
&
pTsdb
->
lruMutex
);
*
handle
=
NULL
;
return
0
;
}
}
*
handle
=
NULL
;
_taos_lru_deleter_t
deleter
=
deleteTableCacheLastrow
;
return
0
;
LRUStatus
status
=
}
taosLRUCacheInsert
(
pCache
,
key
,
keyLen
,
pRow
,
TD_ROW_LEN
(
pRow
),
deleter
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
if
(
status
!=
TAOS_LRU_STATUS_OK
)
{
code
=
-
1
;
}
_taos_lru_deleter_t
deleter
=
deleteTableCacheLastrow
;
taosThreadMutexUnlock
(
&
pTsdb
->
lruMutex
);
LRUStatus
status
=
taosLRUCacheInsert
(
pCache
,
key
,
keyLen
,
pRow
,
TD_ROW_LEN
(
pRow
),
deleter
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
if
(
status
!=
TAOS_LRU_STATUS_OK
)
{
code
=
-
1
;
}
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
}
else
{
taosThreadMutexUnlock
(
&
pTsdb
->
lruMutex
);
}
}
}
*
handle
=
h
;
*
handle
=
h
;
...
...
source/dnode/vnode/src/tsdb/tsdbOpen.c
浏览文件 @
c7a09b78
...
@@ -86,7 +86,7 @@ int tsdbClose(STsdb **pTsdb) {
...
@@ -86,7 +86,7 @@ int tsdbClose(STsdb **pTsdb) {
if
(
*
pTsdb
)
{
if
(
*
pTsdb
)
{
taosThreadRwlockDestroy
(
&
(
*
pTsdb
)
->
rwLock
);
taosThreadRwlockDestroy
(
&
(
*
pTsdb
)
->
rwLock
);
tsdbFSClose
(
*
pTsdb
);
tsdbFSClose
(
*
pTsdb
);
tsdbCloseCache
(
(
*
pTsdb
)
->
lruCache
);
tsdbCloseCache
(
*
pTsdb
);
taosMemoryFreeClear
(
*
pTsdb
);
taosMemoryFreeClear
(
*
pTsdb
);
}
}
return
0
;
return
0
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
c7a09b78
...
@@ -3217,8 +3217,8 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
...
@@ -3217,8 +3217,8 @@ int32_t handleLimitOffset(SOperatorInfo* pOperator, SLimitInfo* pLimitInfo, SSDa
}
}
static
void
doApplyScalarCalculation
(
SOperatorInfo
*
pOperator
,
SSDataBlock
*
pBlock
,
int32_t
order
,
int32_t
scanFlag
);
static
void
doApplyScalarCalculation
(
SOperatorInfo
*
pOperator
,
SSDataBlock
*
pBlock
,
int32_t
order
,
int32_t
scanFlag
);
static
void
doHandleRemainBlockForNewGroupImpl
(
SOperatorInfo
*
pOperator
,
SFillOperatorInfo
*
pInfo
,
SResultInfo
*
pResult
Info
,
static
void
doHandleRemainBlockForNewGroupImpl
(
SOperatorInfo
*
pOperator
,
SFillOperatorInfo
*
p
Info
,
SExecTaskInfo
*
pTaskInfo
)
{
S
ResultInfo
*
pResultInfo
,
S
ExecTaskInfo
*
pTaskInfo
)
{
pInfo
->
totalInputRows
=
pInfo
->
existNewGroupBlock
->
info
.
rows
;
pInfo
->
totalInputRows
=
pInfo
->
existNewGroupBlock
->
info
.
rows
;
SSDataBlock
*
pResBlock
=
pInfo
->
pFinalRes
;
SSDataBlock
*
pResBlock
=
pInfo
->
pFinalRes
;
...
@@ -3242,8 +3242,8 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo *pOperator, SFillOp
...
@@ -3242,8 +3242,8 @@ static void doHandleRemainBlockForNewGroupImpl(SOperatorInfo *pOperator, SFillOp
pInfo
->
existNewGroupBlock
=
NULL
;
pInfo
->
existNewGroupBlock
=
NULL
;
}
}
static
void
doHandleRemainBlockFromNewGroup
(
SOperatorInfo
*
pOperator
,
SFillOperatorInfo
*
pInfo
,
SResultInfo
*
pResultInfo
,
static
void
doHandleRemainBlockFromNewGroup
(
SOperatorInfo
*
pOperator
,
SFillOperatorInfo
*
pInfo
,
SExecTaskInfo
*
pTaskInfo
)
{
S
ResultInfo
*
pResultInfo
,
S
ExecTaskInfo
*
pTaskInfo
)
{
if
(
taosFillHasMoreResults
(
pInfo
->
pFillInfo
))
{
if
(
taosFillHasMoreResults
(
pInfo
->
pFillInfo
))
{
int32_t
numOfResultRows
=
pResultInfo
->
capacity
-
pInfo
->
pFinalRes
->
info
.
rows
;
int32_t
numOfResultRows
=
pResultInfo
->
capacity
-
pInfo
->
pFinalRes
->
info
.
rows
;
taosFillResultDataBlock
(
pInfo
->
pFillInfo
,
pInfo
->
pFinalRes
,
numOfResultRows
);
taosFillResultDataBlock
(
pInfo
->
pFillInfo
,
pInfo
->
pFinalRes
,
numOfResultRows
);
...
@@ -3259,8 +3259,8 @@ static void doHandleRemainBlockFromNewGroup(SOperatorInfo* pOperator, SFillOpera
...
@@ -3259,8 +3259,8 @@ static void doHandleRemainBlockFromNewGroup(SOperatorInfo* pOperator, SFillOpera
static
void
doApplyScalarCalculation
(
SOperatorInfo
*
pOperator
,
SSDataBlock
*
pBlock
,
int32_t
order
,
int32_t
scanFlag
)
{
static
void
doApplyScalarCalculation
(
SOperatorInfo
*
pOperator
,
SSDataBlock
*
pBlock
,
int32_t
order
,
int32_t
scanFlag
)
{
SFillOperatorInfo
*
pInfo
=
pOperator
->
info
;
SFillOperatorInfo
*
pInfo
=
pOperator
->
info
;
SExprSupp
*
pSup
=
&
pOperator
->
exprSupp
;
SExprSupp
*
pSup
=
&
pOperator
->
exprSupp
;
SSDataBlock
*
pResBlock
=
pInfo
->
pFinalRes
;
SSDataBlock
*
pResBlock
=
pInfo
->
pFinalRes
;
setInputDataBlock
(
pOperator
,
pSup
->
pCtx
,
pBlock
,
order
,
scanFlag
,
false
);
setInputDataBlock
(
pOperator
,
pSup
->
pCtx
,
pBlock
,
order
,
scanFlag
,
false
);
projectApplyFunctions
(
pSup
->
pExprInfo
,
pInfo
->
pRes
,
pBlock
,
pSup
->
pCtx
,
pSup
->
numOfExprs
,
NULL
);
projectApplyFunctions
(
pSup
->
pExprInfo
,
pInfo
->
pRes
,
pBlock
,
pSup
->
pCtx
,
pSup
->
numOfExprs
,
NULL
);
...
@@ -3270,13 +3270,13 @@ static void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlo
...
@@ -3270,13 +3270,13 @@ static void doApplyScalarCalculation(SOperatorInfo* pOperator, SSDataBlock* pBlo
SColumnInfoData
*
pSrc
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pInfo
->
primarySrcSlotId
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pInfo
->
primarySrcSlotId
);
colDataAssign
(
pDst
,
pSrc
,
pInfo
->
pRes
->
info
.
rows
,
&
pResBlock
->
info
);
colDataAssign
(
pDst
,
pSrc
,
pInfo
->
pRes
->
info
.
rows
,
&
pResBlock
->
info
);
for
(
int32_t
i
=
0
;
i
<
pInfo
->
numOfNotFillExpr
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pInfo
->
numOfNotFillExpr
;
++
i
)
{
SFillColInfo
*
pCol
=
&
pInfo
->
pFillInfo
->
pFillCol
[
i
+
pInfo
->
numOfExpr
];
SFillColInfo
*
pCol
=
&
pInfo
->
pFillInfo
->
pFillCol
[
i
+
pInfo
->
numOfExpr
];
ASSERT
(
pCol
->
notFillCol
);
ASSERT
(
pCol
->
notFillCol
);
SExprInfo
*
pExpr
=
pCol
->
pExpr
;
SExprInfo
*
pExpr
=
pCol
->
pExpr
;
int32_t
srcSlotId
=
pExpr
->
base
.
pParam
[
0
].
pCol
->
slotId
;
int32_t
srcSlotId
=
pExpr
->
base
.
pParam
[
0
].
pCol
->
slotId
;
int32_t
dstSlotId
=
pExpr
->
base
.
resSchema
.
slotId
;
int32_t
dstSlotId
=
pExpr
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pDst1
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
dstSlotId
);
SColumnInfoData
*
pDst1
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
dstSlotId
);
SColumnInfoData
*
pSrc1
=
taosArrayGet
(
pBlock
->
pDataBlock
,
srcSlotId
);
SColumnInfoData
*
pSrc1
=
taosArrayGet
(
pBlock
->
pDataBlock
,
srcSlotId
);
...
@@ -3664,7 +3664,7 @@ void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -3664,7 +3664,7 @@ void destroyExchangeOperatorInfo(void* param, int32_t numOfOutput) {
taosRemoveRef
(
exchangeObjRefPool
,
pExInfo
->
self
);
taosRemoveRef
(
exchangeObjRefPool
,
pExInfo
->
self
);
}
}
void
freeSourceDataInfo
(
void
*
p
)
{
void
freeSourceDataInfo
(
void
*
p
)
{
SSourceDataInfo
*
pInfo
=
(
SSourceDataInfo
*
)
p
;
SSourceDataInfo
*
pInfo
=
(
SSourceDataInfo
*
)
p
;
taosMemoryFreeClear
(
pInfo
->
pRsp
);
taosMemoryFreeClear
(
pInfo
->
pRsp
);
}
}
...
@@ -3694,8 +3694,8 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t
...
@@ -3694,8 +3694,8 @@ static int32_t initFillInfo(SFillOperatorInfo* pInfo, SExprInfo* pExpr, int32_t
STimeWindow
w
=
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
win
.
skey
);
STimeWindow
w
=
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
win
.
skey
);
w
=
getFirstQualifiedTimeWindow
(
win
.
skey
,
&
w
,
pInterval
,
TSDB_ORDER_ASC
);
w
=
getFirstQualifiedTimeWindow
(
win
.
skey
,
&
w
,
pInterval
,
TSDB_ORDER_ASC
);
pInfo
->
pFillInfo
=
pInfo
->
pFillInfo
=
taosCreateFillInfo
(
w
.
skey
,
numOfCols
,
numOfNotFillCols
,
capacity
,
pInterval
,
fillType
,
pColInfo
,
taosCreateFillInfo
(
w
.
skey
,
numOfCols
,
numOfNotFillCols
,
capacity
,
pInterval
,
fillType
,
pColInfo
,
pInfo
->
primaryTsCol
,
order
,
id
);
pInfo
->
primaryTsCol
,
order
,
id
);
pInfo
->
win
=
win
;
pInfo
->
win
=
win
;
pInfo
->
p
=
taosMemoryCalloc
(
numOfCols
,
POINTER_BYTES
);
pInfo
->
p
=
taosMemoryCalloc
(
numOfCols
,
POINTER_BYTES
);
...
@@ -3721,10 +3721,10 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
...
@@ -3721,10 +3721,10 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
pFillExprs
,
NULL
,
&
pInfo
->
numOfExpr
);
SExprInfo
*
pExprInfo
=
createExprInfo
(
pPhyFillNode
->
pFillExprs
,
NULL
,
&
pInfo
->
numOfExpr
);
pInfo
->
pNotFillExprInfo
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
pInfo
->
numOfNotFillExpr
);
pInfo
->
pNotFillExprInfo
=
createExprInfo
(
pPhyFillNode
->
pNotFillExprs
,
NULL
,
&
pInfo
->
numOfNotFillExpr
);
SInterval
*
pInterval
=
SInterval
*
pInterval
=
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
QUERY_NODE_PHYSICAL_PLAN_MERGE_ALIGNED_INTERVAL
==
downstream
->
operatorType
?
&
((
SMergeAlignedIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
intervalAggOperatorInfo
->
interval
?
&
((
SMergeAlignedIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
intervalAggOperatorInfo
->
interval
:
&
((
SIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
interval
;
:
&
((
SIntervalAggOperatorInfo
*
)
downstream
->
info
)
->
interval
;
int32_t
order
=
(
pPhyFillNode
->
inputTsOrder
==
ORDER_ASC
)
?
TSDB_ORDER_ASC
:
TSDB_ORDER_DESC
;
int32_t
order
=
(
pPhyFillNode
->
inputTsOrder
==
ORDER_ASC
)
?
TSDB_ORDER_ASC
:
TSDB_ORDER_DESC
;
int32_t
type
=
convertFillType
(
pPhyFillNode
->
mode
);
int32_t
type
=
convertFillType
(
pPhyFillNode
->
mode
);
...
@@ -3741,9 +3741,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
...
@@ -3741,9 +3741,9 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SFillPhysiNode*
SArray
*
pColMatchColInfo
=
extractColMatchInfo
(
pPhyFillNode
->
pFillExprs
,
pPhyFillNode
->
node
.
pOutputDataBlockDesc
,
SArray
*
pColMatchColInfo
=
extractColMatchInfo
(
pPhyFillNode
->
pFillExprs
,
pPhyFillNode
->
node
.
pOutputDataBlockDesc
,
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
);
&
numOfOutputCols
,
COL_MATCH_FROM_SLOT_ID
);
int32_t
code
=
int32_t
code
=
initFillInfo
(
pInfo
,
pExprInfo
,
pInfo
->
numOfExpr
,
pInfo
->
pNotFillExprInfo
,
pInfo
->
numOfNotFillExpr
,
initFillInfo
(
pInfo
,
pExprInfo
,
pInfo
->
numOfExpr
,
pInfo
->
pNotFillExprInfo
,
pInfo
->
numOfNotFillExpr
,
(
SNodeListNode
*
)
pPhyFillNode
->
pValues
,
(
SNodeListNode
*
)
pPhyFillNode
->
pValues
,
pPhyFillNode
->
timeRange
,
pResultInfo
->
capacity
,
pPhyFillNode
->
timeRange
,
pResultInfo
->
capacity
,
pTaskInfo
->
id
.
str
,
pInterval
,
type
,
order
);
pTaskInfo
->
id
.
str
,
pInterval
,
type
,
order
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
c7a09b78
...
@@ -139,7 +139,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -139,7 +139,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
}
}
assert
(
w
.
ekey
>
pBlockInfo
->
window
.
ekey
);
assert
(
w
.
ekey
>
pBlockInfo
->
window
.
ekey
);
if
(
w
.
skey
<=
pBlockInfo
->
window
.
ekey
&&
w
.
skey
>
pBlockInfo
->
window
.
s
key
)
{
if
(
TMAX
(
w
.
skey
,
pBlockInfo
->
window
.
skey
)
<=
pBlockInfo
->
window
.
e
key
)
{
return
true
;
return
true
;
}
}
}
}
...
@@ -147,7 +147,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -147,7 +147,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
w
=
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
pBlockInfo
->
window
.
ekey
);
w
=
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
pBlockInfo
->
window
.
ekey
);
assert
(
w
.
skey
<=
pBlockInfo
->
window
.
ekey
);
assert
(
w
.
skey
<=
pBlockInfo
->
window
.
ekey
);
if
(
w
.
skey
>
pBlockInfo
->
window
.
skey
)
{
if
(
TMAX
(
w
.
skey
,
pBlockInfo
->
window
.
skey
)
<=
TMIN
(
w
.
ekey
,
pBlockInfo
->
window
.
ekey
)
)
{
return
true
;
return
true
;
}
}
...
@@ -158,7 +158,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -158,7 +158,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
}
}
assert
(
w
.
skey
<
pBlockInfo
->
window
.
skey
);
assert
(
w
.
skey
<
pBlockInfo
->
window
.
skey
);
if
(
w
.
ekey
<
pBlockInfo
->
window
.
ekey
&&
w
.
ekey
>=
pBlockInfo
->
window
.
skey
)
{
if
(
pBlockInfo
->
window
.
skey
<=
TMIN
(
w
.
ekey
,
pBlockInfo
->
window
.
ekey
)
)
{
return
true
;
return
true
;
}
}
}
}
...
@@ -1649,6 +1649,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
...
@@ -1649,6 +1649,8 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
}
}
taosArrayDestroy
(
tableIdList
);
taosArrayDestroy
(
tableIdList
);
memcpy
(
&
pTaskInfo
->
streamInfo
.
tableCond
,
&
pTSInfo
->
cond
,
sizeof
(
SQueryTableDataCond
));
memcpy
(
&
pTaskInfo
->
streamInfo
.
tableCond
,
&
pTSInfo
->
cond
,
sizeof
(
SQueryTableDataCond
));
}
else
{
taosArrayDestroy
(
pColIds
);
}
}
// create the pseduo columns info
// create the pseduo columns info
...
@@ -2038,10 +2040,34 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
...
@@ -2038,10 +2040,34 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
metaReaderClear
(
&
smr
);
metaReaderClear
(
&
smr
);
if
(
numOfRows
>=
pOperator
->
resultInfo
.
capacity
)
{
if
(
numOfRows
>=
pOperator
->
resultInfo
.
capacity
)
{
break
;
p
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
,
false
);
doFilterResult
(
pInfo
);
blockDataCleanup
(
p
);
numOfRows
=
0
;
if
(
pInfo
->
pRes
->
info
.
rows
>
0
)
{
break
;
}
}
}
}
}
if
(
numOfRows
>
0
)
{
p
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
,
false
);
doFilterResult
(
pInfo
);
blockDataCleanup
(
p
);
numOfRows
=
0
;
}
blockDataDestroy
(
p
);
// todo temporarily free the cursor here, the true reason why the free is not valid needs to be found
// todo temporarily free the cursor here, the true reason why the free is not valid needs to be found
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
metaCloseTbCursor
(
pInfo
->
pCur
);
metaCloseTbCursor
(
pInfo
->
pCur
);
...
@@ -2049,14 +2075,6 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
...
@@ -2049,14 +2075,6 @@ static SSDataBlock* sysTableScanUserTags(SOperatorInfo* pOperator) {
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
p
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
,
false
);
doFilterResult
(
pInfo
);
blockDataDestroy
(
p
);
pInfo
->
loadInfo
.
totalRows
+=
pInfo
->
pRes
->
info
.
rows
;
pInfo
->
loadInfo
.
totalRows
+=
pInfo
->
pRes
->
info
.
rows
;
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
}
}
...
@@ -2213,10 +2231,34 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
...
@@ -2213,10 +2231,34 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
colDataAppend
(
pColInfoData
,
numOfRows
,
n
,
false
);
colDataAppend
(
pColInfoData
,
numOfRows
,
n
,
false
);
if
(
++
numOfRows
>=
pOperator
->
resultInfo
.
capacity
)
{
if
(
++
numOfRows
>=
pOperator
->
resultInfo
.
capacity
)
{
break
;
p
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
,
false
);
doFilterResult
(
pInfo
);
blockDataCleanup
(
p
);
numOfRows
=
0
;
if
(
pInfo
->
pRes
->
info
.
rows
>
0
)
{
break
;
}
}
}
}
}
if
(
numOfRows
>
0
)
{
p
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
,
false
);
doFilterResult
(
pInfo
);
blockDataCleanup
(
p
);
numOfRows
=
0
;
}
blockDataDestroy
(
p
);
// todo temporarily free the cursor here, the true reason why the free is not valid needs to be found
// todo temporarily free the cursor here, the true reason why the free is not valid needs to be found
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
metaCloseTbCursor
(
pInfo
->
pCur
);
metaCloseTbCursor
(
pInfo
->
pCur
);
...
@@ -2224,14 +2266,6 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
...
@@ -2224,14 +2266,6 @@ static SSDataBlock* sysTableScanUserTables(SOperatorInfo* pOperator) {
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
p
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
relocateColumnData
(
pInfo
->
pRes
,
pInfo
->
scanCols
,
p
->
pDataBlock
,
false
);
doFilterResult
(
pInfo
);
blockDataDestroy
(
p
);
pInfo
->
loadInfo
.
totalRows
+=
pInfo
->
pRes
->
info
.
rows
;
pInfo
->
loadInfo
.
totalRows
+=
pInfo
->
pRes
->
info
.
rows
;
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
return
(
pInfo
->
pRes
->
info
.
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
}
}
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
c7a09b78
...
@@ -1706,14 +1706,19 @@ void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -1706,14 +1706,19 @@ void destroyStreamFinalIntervalOperatorInfo(void* param, int32_t numOfOutput) {
blockDataDestroy
(
pInfo
->
pPullDataRes
);
blockDataDestroy
(
pInfo
->
pPullDataRes
);
taosArrayDestroy
(
pInfo
->
pRecycledPages
);
taosArrayDestroy
(
pInfo
->
pRecycledPages
);
blockDataDestroy
(
pInfo
->
pUpdateRes
);
blockDataDestroy
(
pInfo
->
pUpdateRes
);
taosArrayDestroy
(
pInfo
->
pDelWins
);
blockDataDestroy
(
pInfo
->
pDelRes
);
if
(
pInfo
->
pChildren
)
{
if
(
pInfo
->
pChildren
)
{
int32_t
size
=
taosArrayGetSize
(
pInfo
->
pChildren
);
int32_t
size
=
taosArrayGetSize
(
pInfo
->
pChildren
);
for
(
int32_t
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
size
;
i
++
)
{
SOperatorInfo
*
pChildOp
=
taosArrayGetP
(
pInfo
->
pChildren
,
i
);
SOperatorInfo
*
pChildOp
=
taosArrayGetP
(
pInfo
->
pChildren
,
i
);
destroyStreamFinalIntervalOperatorInfo
(
pChildOp
->
info
,
numOfOutput
);
destroyStreamFinalIntervalOperatorInfo
(
pChildOp
->
info
,
numOfOutput
);
taosMemoryFree
(
pChildOp
->
pDownstream
);
cleanupExprSupp
(
&
pChildOp
->
exprSupp
);
taosMemoryFreeClear
(
pChildOp
);
taosMemoryFreeClear
(
pChildOp
);
}
}
taosArrayDestroy
(
pInfo
->
pChildren
);
}
}
nodesDestroyNode
((
SNode
*
)
pInfo
->
pPhyNode
);
nodesDestroyNode
((
SNode
*
)
pInfo
->
pPhyNode
);
colDataDestroy
(
&
pInfo
->
twAggSup
.
timeWindowData
);
colDataDestroy
(
&
pInfo
->
twAggSup
.
timeWindowData
);
...
@@ -2644,7 +2649,6 @@ void destroyTimeSliceOperatorInfo(void* param, int32_t numOfOutput) {
...
@@ -2644,7 +2649,6 @@ void destroyTimeSliceOperatorInfo(void* param, int32_t numOfOutput) {
taosMemoryFreeClear
(
param
);
taosMemoryFreeClear
(
param
);
}
}
SOperatorInfo
*
createTimeSliceOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
)
{
SOperatorInfo
*
createTimeSliceOperatorInfo
(
SOperatorInfo
*
downstream
,
SPhysiNode
*
pPhyNode
,
SExecTaskInfo
*
pTaskInfo
)
{
STimeSliceOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STimeSliceOperatorInfo
));
STimeSliceOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STimeSliceOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
c7a09b78
...
@@ -3970,16 +3970,16 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
...
@@ -3970,16 +3970,16 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
TSKEY
*
ptsList
=
(
int64_t
*
)
colDataGetData
(
pCol
,
0
);
TSKEY
*
ptsList
=
(
int64_t
*
)
colDataGetData
(
pCol
,
0
);
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
)
{
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
)
{
if
(
pCtx
->
start
.
key
==
INT64_MIN
)
{
if
(
pCtx
->
start
.
key
==
INT64_MIN
)
{
pInfo
->
max
=
pInfo
->
max
=
(
pInfo
->
max
<
ptsList
[
start
])
?
ptsList
[
start
]
:
pInfo
->
max
;
(
pInfo
->
max
<
ptsList
[
start
+
pInput
->
numOfRows
-
1
])
?
ptsList
[
start
+
pInput
->
numOfRows
-
1
]
:
pInfo
->
max
;
}
else
{
}
else
{
pInfo
->
max
=
pCtx
->
start
.
key
+
1
;
pInfo
->
max
=
pCtx
->
start
.
key
+
1
;
}
}
if
(
pCtx
->
end
.
key
!=
INT64_MIN
)
{
if
(
pCtx
->
end
.
key
==
INT64_MIN
)
{
pInfo
->
min
=
pCtx
->
end
.
key
;
pInfo
->
min
=
(
pInfo
->
min
>
ptsList
[
start
+
pInput
->
numOfRows
-
1
])
?
ptsList
[
start
+
pInput
->
numOfRows
-
1
]
:
pInfo
->
min
;
}
else
{
}
else
{
pInfo
->
min
=
p
tsList
[
start
]
;
pInfo
->
min
=
p
Ctx
->
end
.
key
;
}
}
}
else
{
}
else
{
if
(
pCtx
->
start
.
key
==
INT64_MIN
)
{
if
(
pCtx
->
start
.
key
==
INT64_MIN
)
{
...
@@ -3988,10 +3988,11 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
...
@@ -3988,10 +3988,11 @@ int32_t elapsedFunction(SqlFunctionCtx* pCtx) {
pInfo
->
min
=
pCtx
->
start
.
key
;
pInfo
->
min
=
pCtx
->
start
.
key
;
}
}
if
(
pCtx
->
end
.
key
!=
INT64_MIN
)
{
if
(
pCtx
->
end
.
key
==
INT64_MIN
)
{
pInfo
->
max
=
pCtx
->
end
.
key
+
1
;
pInfo
->
max
=
(
pInfo
->
max
<
ptsList
[
start
+
pInput
->
numOfRows
-
1
])
?
ptsList
[
start
+
pInput
->
numOfRows
-
1
]
:
pInfo
->
max
;
}
else
{
}
else
{
pInfo
->
max
=
p
tsList
[
start
+
pInput
->
numOfRows
-
1
]
;
pInfo
->
max
=
p
Ctx
->
end
.
key
+
1
;
}
}
}
}
}
}
...
...
source/libs/stream/src/streamTask.c
浏览文件 @
c7a09b78
...
@@ -152,11 +152,12 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
...
@@ -152,11 +152,12 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) {
}
}
void
tFreeSStreamTask
(
SStreamTask
*
pTask
)
{
void
tFreeSStreamTask
(
SStreamTask
*
pTask
)
{
qDebug
(
"free stream task %d"
,
pTask
->
taskId
);
if
(
pTask
->
inputQueue
)
streamQueueClose
(
pTask
->
inputQueue
);
if
(
pTask
->
inputQueue
)
streamQueueClose
(
pTask
->
inputQueue
);
if
(
pTask
->
outputQueue
)
streamQueueClose
(
pTask
->
outputQueue
);
if
(
pTask
->
outputQueue
)
streamQueueClose
(
pTask
->
outputQueue
);
if
(
pTask
->
exec
.
qmsg
)
taosMemoryFree
(
pTask
->
exec
.
qmsg
);
if
(
pTask
->
exec
.
qmsg
)
taosMemoryFree
(
pTask
->
exec
.
qmsg
);
if
(
pTask
->
exec
.
executor
)
qDestroyTask
(
pTask
->
exec
.
executor
);
if
(
pTask
->
exec
.
executor
)
qDestroyTask
(
pTask
->
exec
.
executor
);
taosArrayDestroy
(
pTask
->
childEpInfo
);
taosArrayDestroy
P
(
pTask
->
childEpInfo
,
taosMemoryFree
);
if
(
pTask
->
outputType
==
TASK_OUTPUT__TABLE
)
{
if
(
pTask
->
outputType
==
TASK_OUTPUT__TABLE
)
{
tDeleteSSchemaWrapper
(
pTask
->
tbSink
.
pSchemaWrapper
);
tDeleteSSchemaWrapper
(
pTask
->
tbSink
.
pSchemaWrapper
);
taosMemoryFree
(
pTask
->
tbSink
.
pTSchema
);
taosMemoryFree
(
pTask
->
tbSink
.
pTSchema
);
...
...
source/libs/transport/inc/transComm.h
浏览文件 @
c7a09b78
...
@@ -98,6 +98,17 @@ typedef void* queue[2];
...
@@ -98,6 +98,17 @@ typedef void* queue[2];
#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_RETRY_INTERVAL 15 // retry interval (ms)
#define TRANS_CONN_TIMEOUT 3 // connect timeout (s)
#define TRANS_CONN_TIMEOUT 3 // connect timeout (s)
#define TRANS_READ_TIMEOUT 3000 // read timeout (ms)
#define TRANS_READ_TIMEOUT 3000 // read timeout (ms)
#define TRANS_PACKET_LIMIT 1024 * 1024 * 512
#define TRANS_MAGIC_NUM 0x5f375a86
#define TRANS_NOVALID_PACKET(src) ((src) != TRANS_MAGIC_NUM ? 1 : 0)
#define TRANS_PACKET_LIMIT 1024 * 1024 * 512
#define TRANS_MAGIC_NUM 0x5f375a86
#define TRANS_NOVALID_PACKET(src) ((src) != TRANS_MAGIC_NUM ? 1 : 0)
typedef
SRpcMsg
STransMsg
;
typedef
SRpcMsg
STransMsg
;
typedef
SRpcCtx
STransCtx
;
typedef
SRpcCtx
STransCtx
;
...
@@ -151,6 +162,7 @@ typedef struct {
...
@@ -151,6 +162,7 @@ typedef struct {
char
hasEpSet
:
2
;
// contain epset or not, 0(default): no epset, 1: contain epset
char
hasEpSet
:
2
;
// contain epset or not, 0(default): no epset, 1: contain epset
char
user
[
TSDB_UNI_LEN
];
char
user
[
TSDB_UNI_LEN
];
uint32_t
magicNum
;
STraceId
traceId
;
STraceId
traceId
;
uint64_t
ahandle
;
// ahandle assigned by client
uint64_t
ahandle
;
// ahandle assigned by client
uint32_t
code
;
// del later
uint32_t
code
;
// del later
...
@@ -203,6 +215,7 @@ typedef struct SConnBuffer {
...
@@ -203,6 +215,7 @@ typedef struct SConnBuffer {
int
cap
;
int
cap
;
int
left
;
int
left
;
int
total
;
int
total
;
int
invalid
;
}
SConnBuffer
;
}
SConnBuffer
;
typedef
void
(
*
AsyncCB
)(
uv_async_t
*
handle
);
typedef
void
(
*
AsyncCB
)(
uv_async_t
*
handle
);
...
...
source/libs/transport/src/thttp.c
浏览文件 @
c7a09b78
...
@@ -14,15 +14,22 @@
...
@@ -14,15 +14,22 @@
*/
*/
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#ifdef USE_UV
#include <uv.h>
#endif
// clang-format off
// clang-format off
#include <uv.h>
#include "zlib.h"
#include "zlib.h"
#include "thttp.h"
#include "thttp.h"
#include "taoserror.h"
#include "taoserror.h"
#include "tlog.h"
#include "tlog.h"
typedef
struct
SHttpClient
{
uv_connect_t
conn
;
uv_tcp_t
tcp
;
uv_write_t
req
;
uv_buf_t
*
buf
;
char
*
addr
;
uint16_t
port
;
}
SHttpClient
;
static
int32_t
taosBuildHttpHeader
(
const
char
*
server
,
int32_t
contLen
,
char
*
pHead
,
int32_t
headLen
,
static
int32_t
taosBuildHttpHeader
(
const
char
*
server
,
int32_t
contLen
,
char
*
pHead
,
int32_t
headLen
,
EHttpCompFlag
flag
)
{
EHttpCompFlag
flag
)
{
if
(
flag
==
HTTP_FLAT
)
{
if
(
flag
==
HTTP_FLAT
)
{
...
@@ -45,7 +52,7 @@ static int32_t taosBuildHttpHeader(const char* server, int32_t contLen, char* pH
...
@@ -45,7 +52,7 @@ static int32_t taosBuildHttpHeader(const char* server, int32_t contLen, char* pH
}
}
}
}
int32_t
taosCompressHttpRport
(
char
*
pSrc
,
int32_t
srcLen
)
{
static
int32_t
taosCompressHttpRport
(
char
*
pSrc
,
int32_t
srcLen
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
int32_t
destLen
=
srcLen
;
int32_t
destLen
=
srcLen
;
void
*
pDest
=
taosMemoryMalloc
(
destLen
);
void
*
pDest
=
taosMemoryMalloc
(
destLen
);
...
@@ -114,84 +121,53 @@ _OVER:
...
@@ -114,84 +121,53 @@ _OVER:
return
code
;
return
code
;
}
}
#ifdef USE_UV
static
void
destroyHttpClient
(
SHttpClient
*
cli
)
{
taosMemoryFree
(
cli
->
buf
);
taosMemoryFree
(
cli
->
addr
);
taosMemoryFree
(
cli
);
}
static
void
clientCloseCb
(
uv_handle_t
*
handle
)
{
SHttpClient
*
cli
=
handle
->
data
;
destroyHttpClient
(
cli
);
}
static
void
clientSentCb
(
uv_write_t
*
req
,
int32_t
status
)
{
SHttpClient
*
cli
=
req
->
data
;
if
(
status
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
status
);
uError
(
"http-report failed to send data %s"
,
uv_strerror
(
status
));
}
else
{
uInfo
(
"http-report succ to send data"
);
}
uv_close
((
uv_handle_t
*
)
&
cli
->
tcp
,
clientCloseCb
);
}
static
void
clientConnCb
(
uv_connect_t
*
req
,
int32_t
status
)
{
static
void
clientConnCb
(
uv_connect_t
*
req
,
int32_t
status
)
{
if
(
status
<
0
)
{
SHttpClient
*
cli
=
req
->
data
;
if
(
status
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
status
);
terrno
=
TAOS_SYSTEM_ERROR
(
status
);
uError
(
"
connection error %s"
,
uv_strerror
(
status
)
);
uError
(
"
http-report failed to conn to server, reason:%s, dst:%s:%d"
,
uv_strerror
(
status
),
cli
->
addr
,
cli
->
port
);
uv_close
((
uv_handle_t
*
)
req
->
handle
,
NULL
);
uv_close
((
uv_handle_t
*
)
&
cli
->
tcp
,
clientCloseCb
);
return
;
return
;
}
}
uv_buf_t
*
wb
=
req
->
data
;
uv_write
(
&
cli
->
req
,
(
uv_stream_t
*
)
&
cli
->
tcp
,
cli
->
buf
,
2
,
clientSentCb
);
assert
(
wb
!=
NULL
);
uv_write_t
write_req
;
uv_write
(
&
write_req
,
req
->
handle
,
wb
,
2
,
NULL
);
uv_close
((
uv_handle_t
*
)
req
->
handle
,
NULL
);
}
}
int32_t
taosSendHttpReport
(
const
char
*
server
,
uint16_t
port
,
char
*
pCont
,
int32_t
contLen
,
EHttpCompFlag
flag
)
{
static
int32_t
taosBuildDstAddr
(
const
char
*
server
,
uint16_t
port
,
struct
sockaddr_in
*
dest
)
{
uint32_t
ip
v4
=
taosGetIpv4FromFqdn
(
server
);
uint32_t
ip
=
taosGetIpv4FromFqdn
(
server
);
if
(
ip
v4
==
0xffffffff
)
{
if
(
ip
==
0xffffffff
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to get http server:%s ip since %s"
,
server
,
terrstr
());
uError
(
"
http-report
failed to get http server:%s ip since %s"
,
server
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
char
buf
[
128
]
=
{
0
};
char
ipv4Buf
[
128
]
=
{
0
};
tinet_ntoa
(
buf
,
ip
);
tinet_ntoa
(
ipv4Buf
,
ipv4
);
uv_ip4_addr
(
buf
,
port
,
dest
);
return
0
;
struct
sockaddr_in
dest
=
{
0
};
uv_ip4_addr
(
ipv4Buf
,
port
,
&
dest
);
uv_tcp_t
socket_tcp
=
{
0
};
uv_loop_t
*
loop
=
uv_default_loop
();
uv_tcp_init
(
loop
,
&
socket_tcp
);
uv_connect_t
*
connect
=
(
uv_connect_t
*
)
taosMemoryMalloc
(
sizeof
(
uv_connect_t
));
if
(
flag
==
HTTP_GZIP
)
{
int32_t
dstLen
=
taosCompressHttpRport
(
pCont
,
contLen
);
if
(
dstLen
>
0
)
{
contLen
=
dstLen
;
}
else
{
flag
=
HTTP_FLAT
;
}
}
char
header
[
1024
]
=
{
0
};
int32_t
headLen
=
taosBuildHttpHeader
(
server
,
contLen
,
header
,
sizeof
(
header
),
flag
);
uv_buf_t
wb
[
2
];
wb
[
0
]
=
uv_buf_init
((
char
*
)
header
,
headLen
);
wb
[
1
]
=
uv_buf_init
((
char
*
)
pCont
,
contLen
);
connect
->
data
=
wb
;
terrno
=
0
;
uv_tcp_connect
(
connect
,
&
socket_tcp
,
(
const
struct
sockaddr
*
)
&
dest
,
clientConnCb
);
uv_run
(
loop
,
UV_RUN_DEFAULT
);
uv_loop_close
(
loop
);
taosMemoryFree
(
connect
);
return
terrno
;
}
}
#else
int32_t
taosSendHttpReport
(
const
char
*
server
,
uint16_t
port
,
char
*
pCont
,
int32_t
contLen
,
EHttpCompFlag
flag
)
{
int32_t
taosSendHttpReport
(
const
char
*
server
,
uint16_t
port
,
char
*
pCont
,
int32_t
contLen
,
EHttpCompFlag
flag
)
{
int32_t
code
=
-
1
;
struct
sockaddr_in
dest
=
{
0
};
TdSocketPtr
pSocket
=
NULL
;
if
(
taosBuildDstAddr
(
server
,
port
,
&
dest
)
<
0
)
{
return
-
1
;
uint32_t
ip
=
taosGetIpv4FromFqdn
(
server
);
if
(
ip
==
0xffffffff
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to get http server:%s ip since %s"
,
server
,
terrstr
());
goto
SEND_OVER
;
}
pSocket
=
taosOpenTcpClientSocket
(
ip
,
port
,
0
);
if
(
pSocket
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to create http socket to %s:%u since %s"
,
server
,
port
,
terrstr
());
goto
SEND_OVER
;
}
}
if
(
flag
==
HTTP_GZIP
)
{
if
(
flag
==
HTTP_GZIP
)
{
int32_t
dstLen
=
taosCompressHttpRport
(
pCont
,
contLen
);
int32_t
dstLen
=
taosCompressHttpRport
(
pCont
,
contLen
);
if
(
dstLen
>
0
)
{
if
(
dstLen
>
0
)
{
...
@@ -200,37 +176,38 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
...
@@ -200,37 +176,38 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32
flag
=
HTTP_FLAT
;
flag
=
HTTP_FLAT
;
}
}
}
}
terrno
=
0
;
char
header
[
1024
]
=
{
0
};
char
header
[
2048
]
=
{
0
};
int32_t
headLen
=
taosBuildHttpHeader
(
server
,
contLen
,
header
,
sizeof
(
header
),
flag
);
int32_t
headLen
=
taosBuildHttpHeader
(
server
,
contLen
,
header
,
sizeof
(
header
),
flag
);
if
(
taosWriteMsg
(
pSocket
,
header
,
headLen
)
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
uError
(
"failed to send http header to %s:%u since %s"
,
server
,
port
,
terrstr
());
goto
SEND_OVER
;
}
if
(
taosWriteMsg
(
pSocket
,
(
void
*
)
pCont
,
contLen
)
<
0
)
{
uv_buf_t
*
wb
=
taosMemoryCalloc
(
2
,
sizeof
(
uv_buf_t
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
wb
[
0
]
=
uv_buf_init
((
char
*
)
header
,
headLen
);
// stack var
uError
(
"failed to send http content to %s:%u since %s"
,
server
,
port
,
terrstr
());
wb
[
1
]
=
uv_buf_init
((
char
*
)
pCont
,
contLen
);
// heap var
goto
SEND_OVER
;
}
// read something to avoid nginx error 499
SHttpClient
*
cli
=
taosMemoryCalloc
(
1
,
sizeof
(
SHttpClient
));
if
(
taosWriteMsg
(
pSocket
,
header
,
10
)
<
0
)
{
cli
->
conn
.
data
=
cli
;
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
cli
->
tcp
.
data
=
cli
;
uError
(
"failed to receive response from %s:%u since %s"
,
server
,
port
,
terrstr
());
cli
->
req
.
data
=
cli
;
goto
SEND_OVER
;
cli
->
buf
=
wb
;
}
cli
->
addr
=
tstrdup
(
server
);
cli
->
port
=
port
;
uv_loop_t
*
loop
=
uv_default_loop
();
uv_tcp_init
(
loop
,
&
cli
->
tcp
);
// set up timeout to avoid stuck;
int32_t
fd
=
taosCreateSocketWithTimeout
(
5
);
uv_tcp_open
((
uv_tcp_t
*
)
&
cli
->
tcp
,
fd
);
code
=
0
;
SEND_OVER:
int32_t
ret
=
uv_tcp_connect
(
&
cli
->
conn
,
&
cli
->
tcp
,
(
const
struct
sockaddr
*
)
&
dest
,
clientConnCb
);
if
(
pSocket
!=
NULL
)
{
if
(
ret
!=
0
)
{
taosCloseSocket
(
&
pSocket
);
uError
(
"http-report failed to connect to server, reason:%s, dst:%s:%d"
,
uv_strerror
(
ret
),
cli
->
addr
,
cli
->
port
);
destroyHttpClient
(
cli
);
}
}
return
code
;
uv_run
(
loop
,
UV_RUN_DEFAULT
);
uv_loop_close
(
loop
);
return
terrno
;
}
}
// clang-format on
// clang-format on
#endif
source/libs/transport/src/transCli.c
浏览文件 @
c7a09b78
...
@@ -318,10 +318,17 @@ void cliHandleResp(SCliConn* conn) {
...
@@ -318,10 +318,17 @@ void cliHandleResp(SCliConn* conn) {
}
}
STransMsgHead
*
pHead
=
NULL
;
STransMsgHead
*
pHead
=
NULL
;
transDumpFromBuffer
(
&
conn
->
readBuf
,
(
char
**
)
&
pHead
);
if
(
transDumpFromBuffer
(
&
conn
->
readBuf
,
(
char
**
)
&
pHead
)
<=
0
)
{
tDebug
(
"%s conn %p recv invalid packet "
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
return
;
}
pHead
->
code
=
htonl
(
pHead
->
code
);
pHead
->
code
=
htonl
(
pHead
->
code
);
pHead
->
msgLen
=
htonl
(
pHead
->
msgLen
);
pHead
->
msgLen
=
htonl
(
pHead
->
msgLen
);
if
(
cliRecvReleaseReq
(
conn
,
pHead
))
{
return
;
}
STransMsg
transMsg
=
{
0
};
STransMsg
transMsg
=
{
0
};
transMsg
.
contLen
=
transContLenFromMsg
(
pHead
->
msgLen
);
transMsg
.
contLen
=
transContLenFromMsg
(
pHead
->
msgLen
);
transMsg
.
pCont
=
transContFromHead
((
char
*
)
pHead
);
transMsg
.
pCont
=
transContFromHead
((
char
*
)
pHead
);
...
@@ -333,10 +340,6 @@ void cliHandleResp(SCliConn* conn) {
...
@@ -333,10 +340,6 @@ void cliHandleResp(SCliConn* conn) {
SCliMsg
*
pMsg
=
NULL
;
SCliMsg
*
pMsg
=
NULL
;
STransConnCtx
*
pCtx
=
NULL
;
STransConnCtx
*
pCtx
=
NULL
;
if
(
cliRecvReleaseReq
(
conn
,
pHead
))
{
return
;
}
if
(
CONN_NO_PERSIST_BY_APP
(
conn
))
{
if
(
CONN_NO_PERSIST_BY_APP
(
conn
))
{
pMsg
=
transQueuePop
(
&
conn
->
cliMsgs
);
pMsg
=
transQueuePop
(
&
conn
->
cliMsgs
);
...
@@ -598,7 +601,12 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
...
@@ -598,7 +601,12 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
pBuf
->
len
+=
nread
;
pBuf
->
len
+=
nread
;
while
(
transReadComplete
(
pBuf
))
{
while
(
transReadComplete
(
pBuf
))
{
tTrace
(
"%s conn %p read complete"
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
tTrace
(
"%s conn %p read complete"
,
CONN_GET_INST_LABEL
(
conn
),
conn
);
cliHandleResp
(
conn
);
if
(
pBuf
->
invalid
)
{
cliHandleExcept
(
conn
);
break
;
}
else
{
cliHandleResp
(
conn
);
}
}
}
return
;
return
;
}
}
...
@@ -759,6 +767,7 @@ void cliSend(SCliConn* pConn) {
...
@@ -759,6 +767,7 @@ void cliSend(SCliConn* pConn) {
pHead
->
release
=
REQUEST_RELEASE_HANDLE
(
pCliMsg
)
?
1
:
0
;
pHead
->
release
=
REQUEST_RELEASE_HANDLE
(
pCliMsg
)
?
1
:
0
;
memcpy
(
pHead
->
user
,
pTransInst
->
user
,
strlen
(
pTransInst
->
user
));
memcpy
(
pHead
->
user
,
pTransInst
->
user
,
strlen
(
pTransInst
->
user
));
pHead
->
traceId
=
pMsg
->
info
.
traceId
;
pHead
->
traceId
=
pMsg
->
info
.
traceId
;
pHead
->
magicNum
=
htonl
(
TRANS_MAGIC_NUM
);
uv_buf_t
wb
=
uv_buf_init
((
char
*
)
pHead
,
msgLen
);
uv_buf_t
wb
=
uv_buf_init
((
char
*
)
pHead
,
msgLen
);
...
...
source/libs/transport/src/transComm.c
浏览文件 @
c7a09b78
...
@@ -91,6 +91,7 @@ int transInitBuffer(SConnBuffer* buf) {
...
@@ -91,6 +91,7 @@ int transInitBuffer(SConnBuffer* buf) {
buf
->
left
=
-
1
;
buf
->
left
=
-
1
;
buf
->
len
=
0
;
buf
->
len
=
0
;
buf
->
total
=
0
;
buf
->
total
=
0
;
buf
->
invalid
=
0
;
return
0
;
return
0
;
}
}
int
transDestroyBuffer
(
SConnBuffer
*
p
)
{
int
transDestroyBuffer
(
SConnBuffer
*
p
)
{
...
@@ -108,19 +109,25 @@ int transClearBuffer(SConnBuffer* buf) {
...
@@ -108,19 +109,25 @@ int transClearBuffer(SConnBuffer* buf) {
p
->
left
=
-
1
;
p
->
left
=
-
1
;
p
->
len
=
0
;
p
->
len
=
0
;
p
->
total
=
0
;
p
->
total
=
0
;
p
->
invalid
=
0
;
return
0
;
return
0
;
}
}
int
transDumpFromBuffer
(
SConnBuffer
*
connBuf
,
char
**
buf
)
{
int
transDumpFromBuffer
(
SConnBuffer
*
connBuf
,
char
**
buf
)
{
static
const
int
HEADSIZE
=
sizeof
(
STransMsgHead
);
SConnBuffer
*
p
=
connBuf
;
SConnBuffer
*
p
=
connBuf
;
if
(
p
->
left
!=
0
)
{
if
(
p
->
left
!=
0
)
{
return
-
1
;
return
-
1
;
}
}
int
total
=
connBuf
->
total
;
int
total
=
connBuf
->
total
;
*
buf
=
taosMemoryCalloc
(
1
,
total
);
if
(
total
>=
HEADSIZE
&&
!
p
->
invalid
)
{
memcpy
(
*
buf
,
p
->
buf
,
total
);
*
buf
=
taosMemoryCalloc
(
1
,
total
);
memcpy
(
*
buf
,
p
->
buf
,
total
);
transResetBuffer
(
connBuf
);
transResetBuffer
(
connBuf
);
}
else
{
total
=
-
1
;
}
return
total
;
return
total
;
}
}
...
@@ -173,6 +180,7 @@ bool transReadComplete(SConnBuffer* connBuf) {
...
@@ -173,6 +180,7 @@ bool transReadComplete(SConnBuffer* connBuf) {
memcpy
((
char
*
)
&
head
,
connBuf
->
buf
,
sizeof
(
head
));
memcpy
((
char
*
)
&
head
,
connBuf
->
buf
,
sizeof
(
head
));
int32_t
msgLen
=
(
int32_t
)
htonl
(
head
.
msgLen
);
int32_t
msgLen
=
(
int32_t
)
htonl
(
head
.
msgLen
);
p
->
total
=
msgLen
;
p
->
total
=
msgLen
;
p
->
invalid
=
TRANS_NOVALID_PACKET
(
htonl
(
head
.
magicNum
));
}
}
if
(
p
->
total
>=
p
->
len
)
{
if
(
p
->
total
>=
p
->
len
)
{
p
->
left
=
p
->
total
-
p
->
len
;
p
->
left
=
p
->
total
-
p
->
len
;
...
@@ -180,7 +188,7 @@ bool transReadComplete(SConnBuffer* connBuf) {
...
@@ -180,7 +188,7 @@ bool transReadComplete(SConnBuffer* connBuf) {
p
->
left
=
0
;
p
->
left
=
0
;
}
}
}
}
return
p
->
left
==
0
?
true
:
false
;
return
(
p
->
left
==
0
||
p
->
invalid
)
?
true
:
false
;
}
}
int
transSetConnOption
(
uv_tcp_t
*
stream
)
{
int
transSetConnOption
(
uv_tcp_t
*
stream
)
{
...
...
source/libs/transport/src/transSvr.c
浏览文件 @
c7a09b78
...
@@ -183,17 +183,25 @@ static void uvHandleActivityTimeout(uv_timer_t* handle) {
...
@@ -183,17 +183,25 @@ static void uvHandleActivityTimeout(uv_timer_t* handle) {
tDebug
(
"%p timeout since no activity"
,
conn
);
tDebug
(
"%p timeout since no activity"
,
conn
);
}
}
static
void
uvHandleReq
(
SSvrConn
*
pConn
)
{
static
bool
uvHandleReq
(
SSvrConn
*
pConn
)
{
STransMsgHead
*
msg
=
NULL
;
STrans
*
pTransInst
=
pConn
->
pTransInst
;
int
msgLen
=
0
;
msgLen
=
transDumpFromBuffer
(
&
pConn
->
readBuf
,
(
char
**
)
&
msg
);
STransMsgHead
*
msg
=
NULL
;
int
msgLen
=
transDumpFromBuffer
(
&
pConn
->
readBuf
,
(
char
**
)
&
msg
);
if
(
msgLen
<=
0
)
{
tError
(
"%s conn %p read invalid packet"
,
transLabel
(
pTransInst
),
pConn
);
return
false
;
}
STransMsgHead
*
pHead
=
(
STransMsgHead
*
)
msg
;
STransMsgHead
*
pHead
=
(
STransMsgHead
*
)
msg
;
pHead
->
code
=
htonl
(
pHead
->
code
);
pHead
->
code
=
htonl
(
pHead
->
code
);
pHead
->
msgLen
=
htonl
(
pHead
->
msgLen
);
pHead
->
msgLen
=
htonl
(
pHead
->
msgLen
);
memcpy
(
pConn
->
user
,
pHead
->
user
,
strlen
(
pHead
->
user
));
memcpy
(
pConn
->
user
,
pHead
->
user
,
strlen
(
pHead
->
user
));
if
(
uvRecvReleaseReq
(
pConn
,
pHead
))
{
return
true
;
}
// TODO(dengyihao): time-consuming task throwed into BG Thread
// TODO(dengyihao): time-consuming task throwed into BG Thread
// uv_work_t* wreq = taosMemoryMalloc(sizeof(uv_work_t));
// uv_work_t* wreq = taosMemoryMalloc(sizeof(uv_work_t));
// wreq->data = pConn;
// wreq->data = pConn;
...
@@ -201,10 +209,6 @@ static void uvHandleReq(SSvrConn* pConn) {
...
@@ -201,10 +209,6 @@ static void uvHandleReq(SSvrConn* pConn) {
// transRefSrvHandle(pConn);
// transRefSrvHandle(pConn);
// uv_queue_work(((SWorkThrd*)pConn->hostThrd)->loop, wreq, uvWorkDoTask, uvWorkAfterTask);
// uv_queue_work(((SWorkThrd*)pConn->hostThrd)->loop, wreq, uvWorkDoTask, uvWorkAfterTask);
if
(
uvRecvReleaseReq
(
pConn
,
pHead
))
{
return
;
}
STransMsg
transMsg
;
STransMsg
transMsg
;
memset
(
&
transMsg
,
0
,
sizeof
(
transMsg
));
memset
(
&
transMsg
,
0
,
sizeof
(
transMsg
));
transMsg
.
contLen
=
transContLenFromMsg
(
pHead
->
msgLen
);
transMsg
.
contLen
=
transContLenFromMsg
(
pHead
->
msgLen
);
...
@@ -220,7 +224,6 @@ static void uvHandleReq(SSvrConn* pConn) {
...
@@ -220,7 +224,6 @@ static void uvHandleReq(SSvrConn* pConn) {
tDebug
(
"conn %p acquired by server app"
,
pConn
);
tDebug
(
"conn %p acquired by server app"
,
pConn
);
}
}
}
}
STrans
*
pTransInst
=
pConn
->
pTransInst
;
STraceId
*
trace
=
&
pHead
->
traceId
;
STraceId
*
trace
=
&
pHead
->
traceId
;
if
(
pConn
->
status
==
ConnNormal
&&
pHead
->
noResp
==
0
)
{
if
(
pConn
->
status
==
ConnNormal
&&
pHead
->
noResp
==
0
)
{
transRefSrvHandle
(
pConn
);
transRefSrvHandle
(
pConn
);
...
@@ -258,21 +261,33 @@ static void uvHandleReq(SSvrConn* pConn) {
...
@@ -258,21 +261,33 @@ static void uvHandleReq(SSvrConn* pConn) {
transReleaseExHandle
(
transGetRefMgt
(),
pConn
->
refId
);
transReleaseExHandle
(
transGetRefMgt
(),
pConn
->
refId
);
(
*
pTransInst
->
cfp
)(
pTransInst
->
parent
,
&
transMsg
,
NULL
);
(
*
pTransInst
->
cfp
)(
pTransInst
->
parent
,
&
transMsg
,
NULL
);
return
true
;
}
}
void
uvOnRecvCb
(
uv_stream_t
*
cli
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
void
uvOnRecvCb
(
uv_stream_t
*
cli
,
ssize_t
nread
,
const
uv_buf_t
*
buf
)
{
// opt
SSvrConn
*
conn
=
cli
->
data
;
SSvrConn
*
conn
=
cli
->
data
;
STrans
*
pTransInst
=
conn
->
pTransInst
;
SConnBuffer
*
pBuf
=
&
conn
->
readBuf
;
SConnBuffer
*
pBuf
=
&
conn
->
readBuf
;
STrans
*
pTransInst
=
conn
->
pTransInst
;
if
(
nread
>
0
)
{
if
(
nread
>
0
)
{
pBuf
->
len
+=
nread
;
pBuf
->
len
+=
nread
;
tTrace
(
"%s conn %p total read:%d, current read:%d"
,
transLabel
(
pTransInst
),
conn
,
pBuf
->
len
,
(
int
)
nread
);
tTrace
(
"%s conn %p total read:%d, current read:%d"
,
transLabel
(
pTransInst
),
conn
,
pBuf
->
len
,
(
int
)
nread
);
while
(
transReadComplete
(
pBuf
))
{
if
(
pBuf
->
len
<=
TRANS_PACKET_LIMIT
)
{
tTrace
(
"%s conn %p alread read complete packet"
,
transLabel
(
pTransInst
),
conn
);
while
(
transReadComplete
(
pBuf
))
{
uvHandleReq
(
conn
);
tTrace
(
"%s conn %p alread read complete packet"
,
transLabel
(
pTransInst
),
conn
);
if
(
pBuf
->
invalid
)
{
tTrace
(
"%s conn %p alread read invalid packet"
,
transLabel
(
pTransInst
),
conn
);
destroyConn
(
conn
,
true
);
return
;
}
else
{
if
(
false
==
uvHandleReq
(
conn
))
break
;
}
}
return
;
}
else
{
destroyConn
(
conn
,
true
);
return
;
}
}
return
;
}
}
if
(
nread
==
0
)
{
if
(
nread
==
0
)
{
return
;
return
;
...
@@ -364,6 +379,7 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
...
@@ -364,6 +379,7 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
pHead
->
ahandle
=
(
uint64_t
)
pMsg
->
info
.
ahandle
;
pHead
->
ahandle
=
(
uint64_t
)
pMsg
->
info
.
ahandle
;
pHead
->
traceId
=
pMsg
->
info
.
traceId
;
pHead
->
traceId
=
pMsg
->
info
.
traceId
;
pHead
->
hasEpSet
=
pMsg
->
info
.
hasEpSet
;
pHead
->
hasEpSet
=
pMsg
->
info
.
hasEpSet
;
pHead
->
magicNum
=
htonl
(
TRANS_MAGIC_NUM
);
if
(
pConn
->
status
==
ConnNormal
)
{
if
(
pConn
->
status
==
ConnNormal
)
{
pHead
->
msgType
=
(
0
==
pMsg
->
msgType
?
pConn
->
inType
+
1
:
pMsg
->
msgType
);
pHead
->
msgType
=
(
0
==
pMsg
->
msgType
?
pConn
->
inType
+
1
:
pMsg
->
msgType
);
...
@@ -859,6 +875,7 @@ static int reallocConnRef(SSvrConn* conn) {
...
@@ -859,6 +875,7 @@ static int reallocConnRef(SSvrConn* conn) {
}
}
static
void
uvDestroyConn
(
uv_handle_t
*
handle
)
{
static
void
uvDestroyConn
(
uv_handle_t
*
handle
)
{
SSvrConn
*
conn
=
handle
->
data
;
SSvrConn
*
conn
=
handle
->
data
;
if
(
conn
==
NULL
)
{
if
(
conn
==
NULL
)
{
return
;
return
;
}
}
...
@@ -874,9 +891,8 @@ static void uvDestroyConn(uv_handle_t* handle) {
...
@@ -874,9 +891,8 @@ static void uvDestroyConn(uv_handle_t* handle) {
SSvrMsg
*
msg
=
transQueueGet
(
&
conn
->
srvMsgs
,
i
);
SSvrMsg
*
msg
=
transQueueGet
(
&
conn
->
srvMsgs
,
i
);
destroySmsg
(
msg
);
destroySmsg
(
msg
);
}
}
transReqQueueClear
(
&
conn
->
wreqQueue
);
transQueueDestroy
(
&
conn
->
srvMsgs
);
transQueueDestroy
(
&
conn
->
srvMsgs
);
transReqQueueClear
(
&
conn
->
wreqQueue
);
QUEUE_REMOVE
(
&
conn
->
queue
);
QUEUE_REMOVE
(
&
conn
->
queue
);
taosMemoryFree
(
conn
->
pTcp
);
taosMemoryFree
(
conn
->
pTcp
);
...
...
tests/script/tsim/stream/basic0.sim
浏览文件 @
c7a09b78
system sh/stop_dnodes.sh
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/
exec.sh -n dnode1 -s start
system sh/
cfg.sh -n dnode1 -c debugflag -v 131
s
leep 50
s
ystem sh/exec.sh -n dnode1 -s start -v
sql connect
sql connect
print =============== create database
print =============== create database
...
@@ -137,4 +137,17 @@ if $data13 != 789 then
...
@@ -137,4 +137,17 @@ if $data13 != 789 then
return -1
return -1
endi
endi
_OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s stop -x SIGINT
print =============== check
$null=
system_content sh/checkValgrind.sh -n dnode1
print cmd return result ----> [ $system_content ]
if $system_content > 0 then
return -1
endi
if $system_content == $null then
return -1
endi
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录