Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3d6030a4
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
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看板
提交
3d6030a4
编写于
4月 10, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
差异文件
handle conflict
上级
70f5abeb
ccd3f27f
变更
158
展开全部
隐藏空白更改
内联
并排
Showing
158 changed file
with
8217 addition
and
5704 deletion
+8217
-5704
cmake/bdb_CMakeLists.txt.in.bak
cmake/bdb_CMakeLists.txt.in.bak
+0
-0
cmake/cmake.define
cmake/cmake.define
+5
-3
cmake/cmake.options
cmake/cmake.options
+0
-11
cmake/cmake.platform
cmake/cmake.platform
+1
-1
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+3
-3
contrib/test/CMakeLists.txt
contrib/test/CMakeLists.txt
+3
-3
include/common/tcommon.h
include/common/tcommon.h
+5
-4
include/common/tdatablock.h
include/common/tdatablock.h
+61
-10
include/common/tdataformat.h
include/common/tdataformat.h
+22
-10
include/common/tmsg.h
include/common/tmsg.h
+44
-17
include/common/tmsgdef.h
include/common/tmsgdef.h
+10
-0
include/common/trow.h
include/common/trow.h
+193
-43
include/common/ttokendef.h
include/common/ttokendef.h
+163
-158
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+3
-0
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+114
-45
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+4
-4
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+21
-3
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+1
-0
include/libs/parser/parser.h
include/libs/parser/parser.h
+8
-2
include/os/osSysinfo.h
include/os/osSysinfo.h
+2
-2
include/util/taoserror.h
include/util/taoserror.h
+31
-34
include/util/tdef.h
include/util/tdef.h
+10
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+24
-11
source/client/src/tmq.c
source/client/src/tmq.c
+5
-4
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+163
-211
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+8
-3
source/common/src/tglobal.c
source/common/src/tglobal.c
+4
-4
source/common/src/tmsg.c
source/common/src/tmsg.c
+61
-10
source/common/src/trow.c
source/common/src/trow.c
+257
-33
source/dnode/mgmt/bm/bmHandle.c
source/dnode/mgmt/bm/bmHandle.c
+34
-5
source/dnode/mgmt/bm/bmWorker.c
source/dnode/mgmt/bm/bmWorker.c
+71
-15
source/dnode/mgmt/dm/dmFile.c
source/dnode/mgmt/dm/dmFile.c
+1
-1
source/dnode/mgmt/dm/dmHandle.c
source/dnode/mgmt/dm/dmHandle.c
+5
-4
source/dnode/mgmt/dm/dmMonitor.c
source/dnode/mgmt/dm/dmMonitor.c
+150
-62
source/dnode/mgmt/dm/dmWorker.c
source/dnode/mgmt/dm/dmWorker.c
+7
-6
source/dnode/mgmt/inc/bmInt.h
source/dnode/mgmt/inc/bmInt.h
+4
-0
source/dnode/mgmt/inc/dmInt.h
source/dnode/mgmt/inc/dmInt.h
+3
-2
source/dnode/mgmt/inc/dndInt.h
source/dnode/mgmt/inc/dndInt.h
+8
-16
source/dnode/mgmt/inc/mmInt.h
source/dnode/mgmt/inc/mmInt.h
+3
-0
source/dnode/mgmt/inc/qmInt.h
source/dnode/mgmt/inc/qmInt.h
+3
-0
source/dnode/mgmt/inc/smInt.h
source/dnode/mgmt/inc/smInt.h
+3
-0
source/dnode/mgmt/inc/vmInt.h
source/dnode/mgmt/inc/vmInt.h
+5
-0
source/dnode/mgmt/main/dndExec.c
source/dnode/mgmt/main/dndExec.c
+1
-1
source/dnode/mgmt/main/dndFile.c
source/dnode/mgmt/main/dndFile.c
+2
-2
source/dnode/mgmt/main/dndTransport.c
source/dnode/mgmt/main/dndTransport.c
+8
-4
source/dnode/mgmt/mm/mmFile.c
source/dnode/mgmt/mm/mmFile.c
+1
-1
source/dnode/mgmt/mm/mmHandle.c
source/dnode/mgmt/mm/mmHandle.c
+37
-5
source/dnode/mgmt/mm/mmInt.c
source/dnode/mgmt/mm/mmInt.c
+0
-5
source/dnode/mgmt/mm/mmWorker.c
source/dnode/mgmt/mm/mmWorker.c
+25
-8
source/dnode/mgmt/qm/qmHandle.c
source/dnode/mgmt/qm/qmHandle.c
+34
-5
source/dnode/mgmt/qm/qmWorker.c
source/dnode/mgmt/qm/qmWorker.c
+58
-10
source/dnode/mgmt/sm/smHandle.c
source/dnode/mgmt/sm/smHandle.c
+34
-5
source/dnode/mgmt/sm/smWorker.c
source/dnode/mgmt/sm/smWorker.c
+54
-4
source/dnode/mgmt/test/bnode/dbnode.cpp
source/dnode/mgmt/test/bnode/dbnode.cpp
+20
-20
source/dnode/mgmt/test/mnode/dmnode.cpp
source/dnode/mgmt/test/mnode/dmnode.cpp
+9
-9
source/dnode/mgmt/test/qnode/dqnode.cpp
source/dnode/mgmt/test/qnode/dqnode.cpp
+20
-20
source/dnode/mgmt/test/snode/dsnode.cpp
source/dnode/mgmt/test/snode/dsnode.cpp
+20
-20
source/dnode/mgmt/test/vnode/vnode.cpp
source/dnode/mgmt/test/vnode/vnode.cpp
+2
-2
source/dnode/mgmt/vm/vmFile.c
source/dnode/mgmt/vm/vmFile.c
+1
-1
source/dnode/mgmt/vm/vmHandle.c
source/dnode/mgmt/vm/vmHandle.c
+70
-2
source/dnode/mgmt/vm/vmInt.c
source/dnode/mgmt/vm/vmInt.c
+14
-29
source/dnode/mgmt/vm/vmWorker.c
source/dnode/mgmt/vm/vmWorker.c
+32
-3
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+0
-1
source/dnode/mnode/impl/inc/mndShow.h
source/dnode/mnode/impl/inc/mndShow.h
+0
-1
source/dnode/mnode/impl/inc/mndSma.h
source/dnode/mnode/impl/inc/mndSma.h
+1
-0
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+56
-98
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+0
-40
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+0
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+54
-136
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+3
-69
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+0
-1
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+25
-6
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+4
-59
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+0
-2
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+76
-122
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+0
-70
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+33
-1
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+59
-104
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+7
-60
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+0
-1
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+11
-9
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+0
-1
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+0
-1
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+0
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+0
-43
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+5
-1
source/dnode/mnode/impl/test/CMakeLists.txt
source/dnode/mnode/impl/test/CMakeLists.txt
+12
-12
source/dnode/mnode/impl/test/bnode/bnode.cpp
source/dnode/mnode/impl/test/bnode/bnode.cpp
+28
-28
source/dnode/mnode/impl/test/mnode/mnode.cpp
source/dnode/mnode/impl/test/mnode/mnode.cpp
+26
-26
source/dnode/mnode/impl/test/qnode/qnode.cpp
source/dnode/mnode/impl/test/qnode/qnode.cpp
+28
-28
source/dnode/mnode/impl/test/snode/snode.cpp
source/dnode/mnode/impl/test/snode/snode.cpp
+28
-28
source/dnode/mnode/impl/test/trans/trans.cpp
source/dnode/mnode/impl/test/trans/trans.cpp
+10
-10
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-1
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+6
-3
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+6
-4
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+18
-25
source/dnode/vnode/src/tsdb/tsdbFile.c
source/dnode/vnode/src/tsdb/tsdbFile.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+12
-5
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
+20
-1
source/dnode/vnode/src/tsdb/tsdbSma.c
source/dnode/vnode/src/tsdb/tsdbSma.c
+13
-5
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+51
-3
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+4
-3
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+58
-29
source/libs/executor/inc/tsort.h
source/libs/executor/inc/tsort.h
+10
-10
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+26
-70
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+341
-524
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+261
-60
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+20
-7
source/libs/executor/src/tlinearhash.c
source/libs/executor/src/tlinearhash.c
+1
-0
source/libs/executor/src/tsimplehash.c
source/libs/executor/src/tsimplehash.c
+1
-0
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+75
-72
source/libs/executor/test/sortTests.cpp
source/libs/executor/test/sortTests.cpp
+218
-91
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+9
-0
source/libs/monitor/inc/monInt.h
source/libs/monitor/inc/monInt.h
+19
-30
source/libs/monitor/src/monMain.c
source/libs/monitor/src/monMain.c
+242
-89
source/libs/monitor/src/monMsg.c
source/libs/monitor/src/monMsg.c
+532
-0
source/libs/monitor/test/CMakeLists.txt
source/libs/monitor/test/CMakeLists.txt
+4
-4
source/libs/monitor/test/monTest.cpp
source/libs/monitor/test/monTest.cpp
+124
-83
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+0
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+33
-16
source/libs/nodes/src/nodesToSQLFuncs.c
source/libs/nodes/src/nodesToSQLFuncs.c
+6
-2
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+67
-13
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+2
-2
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+17
-6
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+8
-6
source/libs/parser/src/parCalcConst.c
source/libs/parser/src/parCalcConst.c
+39
-8
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+1
-1
source/libs/parser/src/parTokenizer.c
source/libs/parser/src/parTokenizer.c
+5
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+279
-99
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2480
-2427
source/libs/parser/test/parserAstTest.cpp
source/libs/parser/test/parserAstTest.cpp
+42
-0
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+3
-1
source/libs/planner/test/plannerTest.cpp
source/libs/planner/test/plannerTest.cpp
+10
-0
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+37
-0
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+16
-4
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+13
-4
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+10
-7
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+100
-15
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+4
-2
source/libs/tdb/src/db/tdbPCache.c
source/libs/tdb/src/db/tdbPCache.c
+1
-0
source/libs/transport/src/rpcMain.c
source/libs/transport/src/rpcMain.c
+1
-1
source/libs/transport/src/thttp.c
source/libs/transport/src/thttp.c
+1
-1
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+20
-18
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+42
-10
source/util/src/tcompare.c
source/util/src/tcompare.c
+13
-31
source/util/src/tconfig.c
source/util/src/tconfig.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+17
-21
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+5
-9
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+9
-0
tests/script/tsim/bnode/basic1.sim
tests/script/tsim/bnode/basic1.sim
+135
-0
tests/script/tsim/insert/backquote.sim
tests/script/tsim/insert/backquote.sim
+6
-3
tests/script/tsim/qnode/basic1.sim
tests/script/tsim/qnode/basic1.sim
+135
-0
tests/script/tsim/query/stddev.sim
tests/script/tsim/query/stddev.sim
+13
-7
tests/script/tsim/snode/basic1.sim
tests/script/tsim/snode/basic1.sim
+135
-0
tests/script/tsim/testCaseSuite.sim
tests/script/tsim/testCaseSuite.sim
+1
-1
tests/script/tsim/tmq/basic1.sim
tests/script/tsim/tmq/basic1.sim
+1
-0
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+1
-7
未找到文件。
cmake/bdb_CMakeLists.txt.in
→
cmake/bdb_CMakeLists.txt.in
.bak
浏览文件 @
3d6030a4
文件已移动
cmake/cmake.define
浏览文件 @
3d6030a4
...
...
@@ -36,11 +36,13 @@ IF (TD_WINDOWS)
ENDIF ()
ELSE ()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -fPIC -gdwarf-2 -g3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -fPIC -gdwarf-2 -g3")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -g3")
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -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 -g3")
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Werror=return-type -fPIC -gdwarf-2 -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 -g3")
MESSAGE("System processor ID: ${CMAKE_SYSTEM_PROCESSOR}")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64"
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64"
)
ADD_DEFINITIONS("-D_TD_ARM_")
ELSE ()
ADD_DEFINITIONS("-msse4.2 -mfma")
...
...
cmake/cmake.options
浏览文件 @
3d6030a4
...
...
@@ -55,17 +55,6 @@ option(
OFF
)
IF(${TD_WINDOWS})
MESSAGE("Not build BDB on Windows")
ELSE ()
option(
BUILD_WITH_BDB
"If build with BerkleyDB"
ON
)
ENDIF ()
option(
BUILD_WITH_LUCENE
"If build with lucene"
...
...
cmake/cmake.platform
浏览文件 @
3d6030a4
...
...
@@ -42,7 +42,7 @@ IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "Darwin
SET(TD_DARWIN TRUE)
SET(OSTYPE "macOS")
ADD_DEFINITIONS("-DDARWIN -Wno-tautological-pointer-compare
-Wno-return-type
")
ADD_DEFINITIONS("-DDARWIN -Wno-tautological-pointer-compare")
MESSAGE("Current system processor is ${CMAKE_SYSTEM_PROCESSOR}.")
IF (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64" OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64")
...
...
contrib/CMakeLists.txt
浏览文件 @
3d6030a4
...
...
@@ -63,9 +63,9 @@ if(${BUILD_WITH_UV})
endif
(
${
BUILD_WITH_UV
}
)
# bdb
if
(
${
BUILD_WITH_BDB
}
)
cat
(
"
${
CMAKE_SUPPORT_DIR
}
/bdb_CMakeLists.txt.in"
${
CONTRIB_TMP_FILE
}
)
endif
(
${
BUILD_WITH_BDB
}
)
#
if(${BUILD_WITH_BDB})
#
cat("${CMAKE_SUPPORT_DIR}/bdb_CMakeLists.txt.in" ${CONTRIB_TMP_FILE})
#
endif(${BUILD_WITH_BDB})
# sqlite
if
(
${
BUILD_WITH_SQLITE
}
)
...
...
contrib/test/CMakeLists.txt
浏览文件 @
3d6030a4
...
...
@@ -7,9 +7,9 @@ if(${BUILD_WITH_LUCENE})
add_subdirectory
(
lucene
)
endif
(
${
BUILD_WITH_LUCENE
}
)
if
(
${
BUILD_WITH_BDB
}
)
add_subdirectory
(
bdb
)
endif
(
${
BUILD_WITH_BDB
}
)
#
if(${BUILD_WITH_BDB})
#
add_subdirectory(bdb)
#
endif(${BUILD_WITH_BDB})
if
(
${
BUILD_WITH_SQLITE
}
)
add_subdirectory
(
sqlite
)
...
...
include/common/tcommon.h
浏览文件 @
3d6030a4
...
...
@@ -65,13 +65,14 @@ typedef struct SDataBlockInfo {
STimeWindow
window
;
int32_t
rows
;
int32_t
rowSize
;
int16_t
numOfCols
;
int16_t
hasVarCol
;
union
{
int64_t
uid
;
int64_t
uid
;
// from which table of uid, comes from this data block
int64_t
blockId
;
};
int64_t
groupId
;
// no need to serialize
uint64_t
groupId
;
// no need to serialize
int16_t
numOfCols
;
int16_t
hasVarCol
;
int16_t
capacity
;
}
SDataBlockInfo
;
typedef
struct
SSDataBlock
{
...
...
include/common/tdatablock.h
浏览文件 @
3d6030a4
...
...
@@ -17,6 +17,7 @@
#define _TD_COMMON_EP_H_
#include "tcommon.h"
#include "tcompression.h"
#include "tmsg.h"
#ifdef __cplusplus
...
...
@@ -115,11 +116,11 @@ static FORCE_INLINE void colDataAppendNULL(SColumnInfoData* pColumnInfoData, uin
static
FORCE_INLINE
void
colDataAppendNNULL
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
start
,
size_t
nRows
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
pColumnInfoData
->
varmeta
.
offset
[
i
]
=
-
1
;
// it is a null value of VAR type.
}
}
else
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
for
(
int32_t
i
=
start
;
i
<
start
+
nRows
;
++
i
)
{
colDataSetNull_f
(
pColumnInfoData
->
nullbitmap
,
i
);
}
}
...
...
@@ -127,39 +128,39 @@ static FORCE_INLINE void colDataAppendNNULL(SColumnInfoData* pColumnInfoData, ui
pColumnInfoData
->
hasNull
=
true
;
}
static
FORCE_INLINE
int32_t
colDataAppendInt8
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int8_t
*
v
)
{
static
FORCE_INLINE
void
colDataAppendInt8
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int8_t
*
v
)
{
ASSERT
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_TINYINT
||
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_UTINYINT
||
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_BOOL
);
char
*
p
=
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
;
*
(
int8_t
*
)
p
=
*
(
int8_t
*
)
v
;
}
static
FORCE_INLINE
int32_t
colDataAppendInt16
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int16_t
*
v
)
{
static
FORCE_INLINE
void
colDataAppendInt16
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int16_t
*
v
)
{
ASSERT
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_SMALLINT
||
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_USMALLINT
);
char
*
p
=
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
;
*
(
int16_t
*
)
p
=
*
(
int16_t
*
)
v
;
}
static
FORCE_INLINE
int32_t
colDataAppendInt32
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int32_t
*
v
)
{
static
FORCE_INLINE
void
colDataAppendInt32
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int32_t
*
v
)
{
ASSERT
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_INT
||
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_UINT
);
char
*
p
=
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
;
*
(
int32_t
*
)
p
=
*
(
int32_t
*
)
v
;
}
static
FORCE_INLINE
int32_t
colDataAppendInt64
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int64_t
*
v
)
{
static
FORCE_INLINE
void
colDataAppendInt64
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
int64_t
*
v
)
{
int32_t
type
=
pColumnInfoData
->
info
.
type
;
ASSERT
(
type
==
TSDB_DATA_TYPE_BIGINT
||
type
==
TSDB_DATA_TYPE_UBIGINT
||
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
char
*
p
=
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
;
*
(
int64_t
*
)
p
=
*
(
int64_t
*
)
v
;
}
static
FORCE_INLINE
int32_t
colDataAppendFloat
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
float
*
v
)
{
static
FORCE_INLINE
void
colDataAppendFloat
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
float
*
v
)
{
ASSERT
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_FLOAT
);
char
*
p
=
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
;
*
(
float
*
)
p
=
*
(
float
*
)
v
;
}
static
FORCE_INLINE
int32_t
colDataAppendDouble
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
double
*
v
)
{
static
FORCE_INLINE
void
colDataAppendDouble
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
double
*
v
)
{
ASSERT
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_DOUBLE
);
char
*
p
=
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
;
*
(
double
*
)
p
=
*
(
double
*
)
v
;
...
...
@@ -177,11 +178,12 @@ void colDataTrim(SColumnInfoData* pColumnInfoData);
size_t
blockDataGetNumOfCols
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetNumOfRows
(
const
SSDataBlock
*
pBlock
);
int32_t
blockDataMerge
(
SSDataBlock
*
pDest
,
const
SSDataBlock
*
pSrc
);
int32_t
blockDataMerge
(
SSDataBlock
*
pDest
,
const
SSDataBlock
*
pSrc
,
SArray
*
pIndexMap
);
int32_t
blockDataSplitRows
(
SSDataBlock
*
pBlock
,
bool
hasVarCol
,
int32_t
startIndex
,
int32_t
*
stopIndex
,
int32_t
pageSize
);
int32_t
blockDataToBuf
(
char
*
buf
,
const
SSDataBlock
*
pBlock
);
int32_t
blockDataFromBuf
(
SSDataBlock
*
pBlock
,
const
char
*
buf
);
int32_t
blockDataFromBuf1
(
SSDataBlock
*
pBlock
,
const
char
*
buf
,
size_t
capacity
);
SSDataBlock
*
blockDataExtractBlock
(
SSDataBlock
*
pBlock
,
int32_t
startIndex
,
int32_t
rowCount
);
...
...
@@ -195,16 +197,65 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
int32_t
colInfoDataEnsureCapacity
(
SColumnInfoData
*
pColumn
,
uint32_t
numOfRows
);
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
);
void
colInfoDataCleanup
(
SColumnInfoData
*
pColumn
,
uint32_t
numOfRows
);
void
blockDataCleanup
(
SSDataBlock
*
pDataBlock
);
size_t
blockDataGetCapacityInRow
(
const
SSDataBlock
*
pBlock
,
size_t
pageSize
);
void
*
blockDataDestroy
(
SSDataBlock
*
pBlock
);
int32_t
blockDataTrimFirstNRows
(
SSDataBlock
*
pBlock
,
size_t
n
);
int32_t
blockDataTrimFirstNRows
(
SSDataBlock
*
pBlock
,
size_t
n
);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
);
void
blockDebugShowData
(
const
SArray
*
dataBlocks
);
static
FORCE_INLINE
int32_t
blockCompressColData
(
SColumnInfoData
*
pColRes
,
int32_t
numOfRows
,
char
*
data
,
int8_t
compressed
)
{
int32_t
colSize
=
colDataGetLength
(
pColRes
,
numOfRows
);
return
(
*
(
tDataTypes
[
pColRes
->
info
.
type
].
compFunc
))(
pColRes
->
pData
,
colSize
,
numOfRows
,
data
,
colSize
+
COMP_OVERFLOW_BYTES
,
compressed
,
NULL
,
0
);
}
static
FORCE_INLINE
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
int8_t
needCompress
)
{
int32_t
*
colSizes
=
(
int32_t
*
)
data
;
data
+=
numOfCols
*
sizeof
(
int32_t
);
*
dataLen
=
(
numOfCols
*
sizeof
(
int32_t
));
int32_t
numOfRows
=
pBlock
->
info
.
rows
;
for
(
int32_t
col
=
0
;
col
<
numOfCols
;
++
col
)
{
SColumnInfoData
*
pColRes
=
(
SColumnInfoData
*
)
taosArrayGet
(
pBlock
->
pDataBlock
,
col
);
// copy the null bitmap
if
(
IS_VAR_DATA_TYPE
(
pColRes
->
info
.
type
))
{
size_t
metaSize
=
numOfRows
*
sizeof
(
int32_t
);
memcpy
(
data
,
pColRes
->
varmeta
.
offset
,
metaSize
);
data
+=
metaSize
;
(
*
dataLen
)
+=
metaSize
;
}
else
{
int32_t
len
=
BitmapLen
(
numOfRows
);
memcpy
(
data
,
pColRes
->
nullbitmap
,
len
);
data
+=
len
;
(
*
dataLen
)
+=
len
;
}
if
(
needCompress
)
{
colSizes
[
col
]
=
blockCompressColData
(
pColRes
,
numOfRows
,
data
,
needCompress
);
data
+=
colSizes
[
col
];
(
*
dataLen
)
+=
colSizes
[
col
];
}
else
{
colSizes
[
col
]
=
colDataGetLength
(
pColRes
,
numOfRows
);
(
*
dataLen
)
+=
colSizes
[
col
];
memmove
(
data
,
pColRes
->
pData
,
colSizes
[
col
]);
data
+=
colSizes
[
col
];
}
colSizes
[
col
]
=
htonl
(
colSizes
[
col
]);
}
}
#ifdef __cplusplus
}
#endif
...
...
include/common/tdataformat.h
浏览文件 @
3d6030a4
...
...
@@ -131,12 +131,17 @@ typedef struct {
STColumn
*
columns
;
}
STSchemaBuilder
;
#define TD_VTYPE_BITS 2 // val type
#define TD_VTYPE_PARTS 4 // 8 bits / TD_VTYPE_BITS = 4
#define TD_VTYPE_OPTR 3 // TD_VTYPE_PARTS - 1, utilize to get remainder
#define TD_BITMAP_BYTES(cnt) (ceil((double)(cnt) / TD_VTYPE_PARTS))
#define TD_BIT_TO_BYTES(cnt) (ceil((double)(cnt) / 8))
// use 2 bits for bitmap(default: STSRow/sub block)
#define TD_VTYPE_BITS 2
#define TD_VTYPE_PARTS 4 // PARTITIONS: 1 byte / 2 bits
#define TD_VTYPE_OPTR 3 // OPERATOR: 4 - 1, utilize to get remainder
#define TD_BITMAP_BYTES(cnt) (((cnt) + TD_VTYPE_OPTR) >> 2)
// use 1 bit for bitmap(super block)
#define TD_VTYPE_BITS_I 1
#define TD_VTYPE_PARTS_I 8 // PARTITIONS: 1 byte / 1 bit
#define TD_VTYPE_OPTR_I 7 // OPERATOR: 8 - 1, utilize to get remainder
#define TD_BITMAP_BYTES_I(cnt) (((cnt) + TD_VTYPE_OPTR_I) >> 3)
int32_t
tdInitTSchemaBuilder
(
STSchemaBuilder
*
pBuilder
,
schema_ver_t
version
);
void
tdDestroyTSchemaBuilder
(
STSchemaBuilder
*
pBuilder
);
...
...
@@ -367,9 +372,10 @@ static FORCE_INLINE void tdCopyColOfRowBySchema(SDataRow dst, STSchema *pDstSche
// ----------------- Data column structure
// SDataCol arrangement: data => bitmap => dataOffset
typedef
struct
SDataCol
{
int8_t
type
;
// column type
uint8_t
bitmap
:
1
;
// 0: has bitmap if has NULL/NORM rows, 1: no bitmap if all rows are NORM
uint8_t
reserve
:
7
;
int8_t
type
;
// column type
uint8_t
bitmap
:
1
;
// 0: no bitmap if all rows are NORM, 1: has bitmap if has NULL/NORM rows
uint8_t
bitmapMode
:
1
;
// default is 0(2 bits), otherwise 1(1 bit)
uint8_t
reserve
:
6
;
int16_t
colId
;
// column ID
int32_t
bytes
;
// column data bytes defined
int32_t
offset
;
// data offset in a SDataRow (including the header size)
...
...
@@ -381,6 +387,8 @@ typedef struct SDataCol {
TSKEY
ts
;
// only used in last NULL column
}
SDataCol
;
#define isAllRowsNull(pCol) ((pCol)->len == 0)
#define isAllRowsNone(pCol) ((pCol)->len == 0)
static
FORCE_INLINE
void
dataColReset
(
SDataCol
*
pDataCol
)
{
pDataCol
->
len
=
0
;
}
...
...
@@ -421,10 +429,14 @@ typedef struct {
col_id_t
numOfCols
;
// Total number of cols
int32_t
maxPoints
;
// max number of points
int32_t
numOfRows
;
int32_t
sversion
;
// TODO: set sversion
int32_t
bitmapMode
:
1
;
// default is 0(2 bits), otherwise 1(1 bit)
int32_t
sversion
:
31
;
// TODO: set sversion(not used yet)
SDataCol
*
cols
;
}
SDataCols
;
static
FORCE_INLINE
bool
tdDataColsIsBitmapI
(
SDataCols
*
pCols
)
{
return
pCols
->
bitmapMode
!=
0
;
}
static
FORCE_INLINE
void
tdDataColsSetBitmapI
(
SDataCols
*
pCols
)
{
pCols
->
bitmapMode
=
1
;
}
#define keyCol(pCols) (&((pCols)->cols[0])) // Key column
#define dataColsTKeyAt(pCols, idx) ((TKEY *)(keyCol(pCols)->pData))[(idx)] // the idx row of column-wised data
#define dataColsKeyAt(pCols, idx) tdGetKey(dataColsTKeyAt(pCols, idx))
...
...
include/common/tmsg.h
浏览文件 @
3d6030a4
...
...
@@ -483,7 +483,8 @@ typedef struct {
int32_t
tz
;
// query client timezone
char
intervalUnit
;
char
slidingUnit
;
char
offsetUnit
;
// TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration.
char
offsetUnit
;
// TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration.
int8_t
precision
;
int64_t
interval
;
int64_t
sliding
;
...
...
@@ -588,7 +589,7 @@ int32_t tDeserializeSUseDbRspImp(SCoder* pDecoder, SUseDbRsp* pRsp);
void
tFreeSUsedbRsp
(
SUseDbRsp
*
pRsp
);
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
}
SDbCfgReq
;
int32_t
tSerializeSDbCfgReq
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgReq
*
pReq
);
...
...
@@ -621,7 +622,6 @@ typedef struct {
int32_t
tSerializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SDbCfgRsp
*
pRsp
);
int32_t
tDeserializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
SDbCfgRsp
*
pRsp
);
typedef
struct
{
int32_t
rowNum
;
}
SQnodeListReq
;
...
...
@@ -716,6 +716,18 @@ typedef struct {
char
charset
[
TD_LOCALE_LEN
];
// tsCharset
}
SClusterCfg
;
typedef
struct
{
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
int64_t
numOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
int64_t
errors
;
}
SVnodesStat
;
typedef
struct
{
int32_t
vgId
;
int8_t
role
;
...
...
@@ -1010,10 +1022,12 @@ int32_t tDeserializeSMCfgDnodeReq(void* buf, int32_t bufLen, SMCfgDnodeReq* pReq
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
,
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
,
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
int32_t
tSerializeS
MCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateM
nodeReq
*
pReq
);
int32_t
tDeserializeS
MCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateM
nodeReq
*
pReq
);
int32_t
tSerializeS
CreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQ
nodeReq
*
pReq
);
int32_t
tDeserializeS
CreateDropMQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQ
nodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
...
...
@@ -1024,14 +1038,6 @@ typedef struct {
int32_t
tSerializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
);
int32_t
tDeserializeSDCreateMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCreateMnodeReq
*
pReq
);
typedef
struct
{
int32_t
dnodeId
;
}
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
SMCreateSnodeReq
,
SMDropSnodeReq
,
SDCreateSnodeReq
,
SDDropSnodeReq
,
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
int32_t
tSerializeSMCreateDropQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
int32_t
tDeserializeSMCreateDropQSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
);
typedef
struct
{
char
sql
[
TSDB_SHOW_SQL_LEN
];
int32_t
queryId
;
...
...
@@ -2308,6 +2314,24 @@ typedef struct {
int32_t
tSerializeSMDropFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropFullTextReq
*
pReq
);
int32_t
tDeserializeSMDropFullTextReq
(
void
*
buf
,
int32_t
bufLen
,
SMDropFullTextReq
*
pReq
);
typedef
struct
{
char
indexFName
[
TSDB_INDEX_FNAME_LEN
];
}
SUserIndexReq
;
int32_t
tSerializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
);
int32_t
tDeserializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
);
typedef
struct
{
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
tblFName
[
TSDB_TABLE_FNAME_LEN
];
char
colName
[
TSDB_COL_NAME_LEN
];
char
indexType
[
TSDB_INDEX_TYPE_LEN
];
char
indexExts
[
TSDB_INDEX_EXTS_LEN
];
}
SUserIndexRsp
;
int32_t
tSerializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUserIndexRsp
*
pRsp
);
int32_t
tDeserializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexRsp
*
pRsp
);
typedef
struct
{
int8_t
mqMsgType
;
int32_t
code
;
...
...
@@ -2324,8 +2348,9 @@ typedef struct {
int8_t
withSchema
;
char
cgroup
[
TSDB_CGROUP_LEN
];
int64_t
currentOffset
;
char
topic
[
TSDB_TOPIC_FNAME_LEN
];
int64_t
currentOffset
;
uint64_t
reqId
;
char
topic
[
TSDB_TOPIC_FNAME_LEN
];
}
SMqPollReq
;
typedef
struct
{
...
...
@@ -2377,7 +2402,9 @@ static FORCE_INLINE void* tDecodeSMqSubVgEp(void* buf, SMqSubVgEp* pVgEp) {
return
buf
;
}
static
FORCE_INLINE
void
tDeleteSMqCMGetSubEpRsp
(
SMqCMGetSubEpRsp
*
pRsp
)
{
taosArrayDestroyEx
(
pRsp
->
topics
,
(
void
(
*
)(
void
*
))
tDeleteSMqSubTopicEp
);
}
static
FORCE_INLINE
void
tDeleteSMqCMGetSubEpRsp
(
SMqCMGetSubEpRsp
*
pRsp
)
{
taosArrayDestroyEx
(
pRsp
->
topics
,
(
void
(
*
)(
void
*
))
tDeleteSMqSubTopicEp
);
}
static
FORCE_INLINE
int32_t
tEncodeSMqSubTopicEp
(
void
**
buf
,
const
SMqSubTopicEp
*
pTopicEp
)
{
int32_t
tlen
=
0
;
...
...
include/common/tmsgdef.h
浏览文件 @
3d6030a4
...
...
@@ -158,6 +158,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_INDEX
,
"mnode-create-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_INDEX
,
"mnode-drop-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_DB_CFG
,
"mnode-get-db-cfg"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_INDEX
,
"mnode-get-index"
,
NULL
,
NULL
)
// Requests handled by VNODE
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
...
...
@@ -220,6 +221,15 @@ enum {
TD_NEW_MSG_SEG
(
TDMT_SCH_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_SCH_LINK_BROKEN
,
"scheduler-link-broken"
,
NULL
,
NULL
)
// Monitor info exchange between processes
TD_NEW_MSG_SEG
(
TDMT_MON_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_MON_MM_INFO
,
"monitor-minfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_VM_INFO
,
"monitor-vinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_QM_INFO
,
"monitor-qinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_SM_INFO
,
"monitor-sinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_BM_INFO
,
"monitor-binfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_VM_LOAD
,
"monitor-vload"
,
NULL
,
NULL
)
#if defined(TD_MSG_NUMBER_)
TDMT_MAX
#endif
...
...
include/common/trow.h
浏览文件 @
3d6030a4
...
...
@@ -40,21 +40,20 @@ extern "C" {
#define TD_ROW_KV 0x01U
/**
* @brief val type
* - for data from client input and STSRow in memory, 3 types of val none/null/norm available
* - for data in
* @brief value type
* - for data from client input and STSRow in memory, 3 types of value none/null/norm available
*/
#define TD_VTYPE_NO
NE 0x0U // none or unknown/undefined
#define TD_VTYPE_NO
RM 0x00U // normal val: not none, not null(no need assign value)
#define TD_VTYPE_NULL 0x01U // null val
#define TD_VTYPE_NO
RM 0x02U // normal val: not none, not null
#define TD_VTYPE_MAX
0x03U
//
#define TD_VTYPE_NO
NE 0x02U // none or unknown/undefined
#define TD_VTYPE_MAX
0x03U
//
#define TD_VTYPE_NO
NE
_BYTE 0x0U
#define TD_VTYPE_NO
RM
_BYTE 0x0U
#define TD_VTYPE_NULL_BYTE 0x55U
#define TD_VTYPE_NO
RM
_BYTE 0xAAU
#define TD_VTYPE_NO
NE
_BYTE 0xAAU
#define TD_ROWS_ALL_NORM
0x01
U
#define TD_ROWS_NULL_NORM 0x0U
#define TD_ROWS_ALL_NORM
0x00
U
#define TD_ROWS_NULL_NORM 0x0
1
U
#define TD_COL_ROWS_NORM(c) ((c)->bitmap == TD_ROWS_ALL_NORM) // all rows of SDataCol/SBlockCol is NORM
#define TD_SET_COL_ROWS_BTIMAP(c, v) ((c)->bitmap = (v))
...
...
@@ -126,15 +125,15 @@ typedef struct {
uint32_t
info
;
struct
{
/// row type
uint
32
_t
type
:
2
;
uint
16
_t
type
:
2
;
/// is delete row(0 not delete, 1 delete)
uint
32
_t
del
:
1
;
uint
16
_t
del
:
1
;
/// endian(0 little endian, 1 big endian)
uint
32
_t
endian
:
1
;
uint
16
_t
endian
:
1
;
/// reserved for back compatibility
uint
32
_t
reserve
:
12
;
uint
16
_t
reserve
:
12
;
/// row schema version
uint
32_t
sver
:
16
;
uint
16_t
sver
;
};
};
/// row total length
...
...
@@ -216,11 +215,16 @@ static FORCE_INLINE void *tdKVRowColVal(STSRow *pRow, SKvRowIdx *pIdx) { return
#define TD_ROW_OFFSET(p) ((p)->toffset); // During ParseInsert when without STSchema, how to get the offset for STpRow?
void
tdMergeBitmap
(
uint8_t
*
srcBitmap
,
int32_t
srcLen
,
uint8_t
*
dstBitmap
);
static
FORCE_INLINE
void
tdRowCopy
(
void
*
dst
,
STSRow
*
row
)
{
memcpy
(
dst
,
row
,
TD_ROW_LEN
(
row
));
}
static
FORCE_INLINE
int32_t
tdSetBitmapValType
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
);
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
);
static
FORCE_INLINE
int32_t
tdGetBitmapValType
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
);
int32_t
tdAppendValToDataCol
(
SDataCol
*
pCol
,
TDRowValT
valType
,
const
void
*
val
,
int32_t
numOfRows
,
int32_t
maxPoints
);
static
FORCE_INLINE
int32_t
tdSetBitmapValTypeI
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
);
static
FORCE_INLINE
int32_t
tdSetBitmapValTypeII
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
);
static
FORCE_INLINE
int32_t
tdSetBitmapValType
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
,
int8_t
bitmapMode
);
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
,
int8_t
bitmapMode
);
static
FORCE_INLINE
int32_t
tdGetBitmapValTypeI
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
);
static
FORCE_INLINE
int32_t
tdGetBitmapValTypeII
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
);
int32_t
tdAppendValToDataCol
(
SDataCol
*
pCol
,
TDRowValT
valType
,
const
void
*
val
,
int32_t
numOfRows
,
int32_t
maxPoints
,
int8_t
bitmapMode
);
static
FORCE_INLINE
int32_t
tdAppendColValToTpRow
(
SRowBuilder
*
pBuilder
,
TDRowValT
valType
,
const
void
*
val
,
bool
isCopyVarData
,
int8_t
colType
,
int16_t
colIdx
,
int32_t
offset
);
static
FORCE_INLINE
int32_t
tdAppendColValToKvRow
(
SRowBuilder
*
pBuilder
,
TDRowValT
valType
,
const
void
*
val
,
...
...
@@ -259,15 +263,32 @@ static FORCE_INLINE void *tdGetBitmapAddr(STSRow *pRow, uint8_t rowType, uint32_
return
NULL
;
}
static
FORCE_INLINE
int32_t
tdSetBitmapValType
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
,
int8_t
bitmapMode
)
{
switch
(
bitmapMode
)
{
case
0
:
tdSetBitmapValTypeII
(
pBitmap
,
colIdx
,
valType
);
break
;
case
-
1
:
case
1
:
tdSetBitmapValTypeI
(
pBitmap
,
colIdx
,
valType
);
break
;
default:
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
TSDB_CODE_FAILED
;
}
return
TSDB_CODE_SUCCESS
;
}
/**
* @brief
* @brief
Use 2 bits at default
*
* @param pBitmap
* @param colIdx The relative index of colId, may have minus value as parameter.
* @param valType
* @return FORCE_INLINE
*/
static
FORCE_INLINE
int32_t
tdSetBitmapValType
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
)
{
static
FORCE_INLINE
int32_t
tdSetBitmapValType
II
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
)
{
if
(
!
pBitmap
||
colIdx
<
0
)
{
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
...
...
@@ -276,18 +297,24 @@ static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TD
int16_t
nBytes
=
colIdx
/
TD_VTYPE_PARTS
;
int16_t
nOffset
=
colIdx
&
TD_VTYPE_OPTR
;
char
*
pDestByte
=
(
char
*
)
POINTER_SHIFT
(
pBitmap
,
nBytes
);
// use literal value directly and not use formula to simplify the codes
switch
(
nOffset
)
{
case
0
:
*
pDestByte
=
((
*
pDestByte
)
&
0x3F
)
|
(
valType
<<
6
);
// *pDestByte = ((*pDestByte) & 0x3F) | (valType << 6);
// set the value and clear other partitions for offset 0
*
pDestByte
=
(
valType
<<
6
);
break
;
case
1
:
*
pDestByte
=
((
*
pDestByte
)
&
0xCF
)
|
(
valType
<<
4
);
// *pDestByte = ((*pDestByte) & 0xCF) | (valType << 4);
*
pDestByte
|=
(
valType
<<
4
);
break
;
case
2
:
*
pDestByte
=
((
*
pDestByte
)
&
0xF3
)
|
(
valType
<<
2
);
// *pDestByte = ((*pDestByte) & 0xF3) | (valType << 2);
*
pDestByte
|=
(
valType
<<
2
);
break
;
case
3
:
*
pDestByte
=
((
*
pDestByte
)
&
0xFC
)
|
valType
;
// *pDestByte = ((*pDestByte) & 0xFC) | valType;
*
pDestByte
|=
(
valType
);
break
;
default:
TASSERT
(
0
);
...
...
@@ -297,15 +324,32 @@ static FORCE_INLINE int32_t tdSetBitmapValType(void *pBitmap, int16_t colIdx, TD
return
TSDB_CODE_SUCCESS
;
}
static
FORCE_INLINE
int32_t
tdGetBitmapValType
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
,
int8_t
bitmapMode
)
{
switch
(
bitmapMode
)
{
case
0
:
tdGetBitmapValTypeII
(
pBitmap
,
colIdx
,
pValType
);
break
;
case
-
1
:
case
1
:
tdGetBitmapValTypeI
(
pBitmap
,
colIdx
,
pValType
);
break
;
default:
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
TSDB_CODE_FAILED
;
}
return
TSDB_CODE_SUCCESS
;
}
/**
* @brief
* @brief
Use 2 bits at default
*
* @param pBitmap
* @param colIdx The relative index of colId, may have minus value as parameter.
* @param pValType
* @return FORCE_INLINE
*/
static
FORCE_INLINE
int32_t
tdGetBitmapValType
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
)
{
static
FORCE_INLINE
int32_t
tdGetBitmapValType
II
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
)
{
if
(
!
pBitmap
||
colIdx
<
0
)
{
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
...
...
@@ -314,6 +358,7 @@ static FORCE_INLINE int32_t tdGetBitmapValType(void *pBitmap, int16_t colIdx, TD
int16_t
nBytes
=
colIdx
/
TD_VTYPE_PARTS
;
int16_t
nOffset
=
colIdx
&
TD_VTYPE_OPTR
;
char
*
pDestByte
=
(
char
*
)
POINTER_SHIFT
(
pBitmap
,
nBytes
);
// use literal value directly and not use formula to simplify the codes
switch
(
nOffset
)
{
case
0
:
*
pValType
=
(((
*
pDestByte
)
&
0xC0
)
>>
6
);
...
...
@@ -335,6 +380,117 @@ static FORCE_INLINE int32_t tdGetBitmapValType(void *pBitmap, int16_t colIdx, TD
return
TSDB_CODE_SUCCESS
;
}
/**
* @brief
*
* @param pBitmap
* @param colIdx The relative index of colId, may have minus value as parameter.
* @param valType
* @return FORCE_INLINE
*/
static
FORCE_INLINE
int32_t
tdSetBitmapValTypeI
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
valType
)
{
if
(
!
pBitmap
||
colIdx
<
0
)
{
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
int16_t
nBytes
=
colIdx
/
TD_VTYPE_PARTS_I
;
int16_t
nOffset
=
colIdx
&
TD_VTYPE_OPTR_I
;
char
*
pDestByte
=
(
char
*
)
POINTER_SHIFT
(
pBitmap
,
nBytes
);
// use literal value directly and not use formula to simplify the codes
switch
(
nOffset
)
{
case
0
:
// *pDestByte = ((*pDestByte) & 0x7F) | (valType << 7);
// set the value and clear other partitions for offset 0
*
pDestByte
=
(
valType
<<
7
);
break
;
case
1
:
// *pDestByte = ((*pDestByte) & 0xBF) | (valType << 6);
*
pDestByte
|=
(
valType
<<
6
);
break
;
case
2
:
// *pDestByte = ((*pDestByte) & 0xDF) | (valType << 5);
*
pDestByte
|=
(
valType
<<
5
);
break
;
case
3
:
// *pDestByte = ((*pDestByte) & 0xEF) | (valType << 4);
*
pDestByte
|=
(
valType
<<
4
);
break
;
case
4
:
// *pDestByte = ((*pDestByte) & 0xF7) | (valType << 3);
*
pDestByte
|=
(
valType
<<
3
);
break
;
case
5
:
// *pDestByte = ((*pDestByte) & 0xFB) | (valType << 2);
*
pDestByte
|=
(
valType
<<
2
);
break
;
case
6
:
// *pDestByte = ((*pDestByte) & 0xFD) | (valType << 1);
*
pDestByte
|=
(
valType
<<
1
);
break
;
case
7
:
// *pDestByte = ((*pDestByte) & 0xFE) | valType;
*
pDestByte
|=
(
valType
);
break
;
default:
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
TSDB_CODE_SUCCESS
;
}
/**
* @brief
*
* @param pBitmap
* @param colIdx The relative index of colId, may have minus value as parameter.
* @param pValType
* @return FORCE_INLINE
*/
static
FORCE_INLINE
int32_t
tdGetBitmapValTypeI
(
void
*
pBitmap
,
int16_t
colIdx
,
TDRowValT
*
pValType
)
{
if
(
!
pBitmap
||
colIdx
<
0
)
{
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
int16_t
nBytes
=
colIdx
/
TD_VTYPE_PARTS_I
;
int16_t
nOffset
=
colIdx
&
TD_VTYPE_OPTR_I
;
char
*
pDestByte
=
(
char
*
)
POINTER_SHIFT
(
pBitmap
,
nBytes
);
// use literal value directly and not use formula to simplify the codes
switch
(
nOffset
)
{
case
0
:
*
pValType
=
(((
*
pDestByte
)
&
0x80
)
>>
7
);
break
;
case
1
:
*
pValType
=
(((
*
pDestByte
)
&
0x40
)
>>
6
);
break
;
case
2
:
*
pValType
=
(((
*
pDestByte
)
&
0x20
)
>>
5
);
break
;
case
3
:
*
pValType
=
(((
*
pDestByte
)
&
0x10
)
>>
4
);
break
;
case
4
:
*
pValType
=
(((
*
pDestByte
)
&
0x08
)
>>
3
);
break
;
case
5
:
*
pValType
=
(((
*
pDestByte
)
&
0x04
)
>>
2
);
break
;
case
6
:
*
pValType
=
(((
*
pDestByte
)
&
0x02
)
>>
1
);
break
;
case
7
:
*
pValType
=
((
*
pDestByte
)
&
0x01
);
break
;
default:
TASSERT
(
0
);
terrno
=
TSDB_CODE_INVALID_PARA
;
return
terrno
;
}
return
TSDB_CODE_SUCCESS
;
}
// ----------------- Tuple row structure(STpRow)
/*
* |<----------------------------- tlen ---------------------------------->|
...
...
@@ -552,7 +708,7 @@ static FORCE_INLINE int32_t tdAppendColValToTpRow(SRowBuilder *pBuilder, TDRowVa
--
colIdx
;
#ifdef TD_SUPPORT_BITMAP
if
(
tdSetBitmapValType
(
pBuilder
->
pBitmap
,
colIdx
,
valType
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tdSetBitmapValType
(
pBuilder
->
pBitmap
,
colIdx
,
valType
,
0
)
!=
TSDB_CODE_SUCCESS
)
{
return
terrno
;
}
#endif
...
...
@@ -610,7 +766,7 @@ static FORCE_INLINE int32_t tdAppendColValToKvRow(SRowBuilder *pBuilder, TDRowVa
--
colIdx
;
#ifdef TD_SUPPORT_BITMAP
if
(
tdSetBitmapValType
(
pBuilder
->
pBitmap
,
colIdx
,
valType
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tdSetBitmapValType
(
pBuilder
->
pBitmap
,
colIdx
,
valType
,
0
)
!=
TSDB_CODE_SUCCESS
)
{
return
terrno
;
}
#endif
...
...
@@ -691,12 +847,6 @@ static FORCE_INLINE int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t
if
(
colId
==
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
TD_ROW_KEY
(
pRow
)
=
*
(
TSKEY
*
)
val
;
// The primary TS key is Norm all the time, thus its valType is not stored in bitmap.
// #ifdef TD_SUPPORT_BITMAP
// pBitmap = tdGetBitmapAddr(pRow, pRow->type, pBuilder->flen, pRow->ncols);
// if (tdSetBitmapValType(pBitmap, colIdx, valType) != TSDB_CODE_SUCCESS) {
// return terrno;
// }
// #endif
return
TSDB_CODE_SUCCESS
;
}
// TODO: We can avoid the type judegement by FP, but would prevent the inline scheme.
...
...
@@ -712,7 +862,7 @@ static FORCE_INLINE int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t
static
FORCE_INLINE
int32_t
tdGetTpRowValOfCol
(
SCellVal
*
output
,
STSRow
*
pRow
,
void
*
pBitmap
,
int8_t
colType
,
int32_t
offset
,
int16_t
colIdx
)
{
#ifdef TD_SUPPORT_BITMAP
if
(
tdGetBitmapValType
(
pBitmap
,
colIdx
,
&
output
->
valType
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tdGetBitmapValType
(
pBitmap
,
colIdx
,
&
output
->
valType
,
0
)
!=
TSDB_CODE_SUCCESS
)
{
output
->
valType
=
TD_VTYPE_NONE
;
return
terrno
;
}
...
...
@@ -748,7 +898,7 @@ static FORCE_INLINE int32_t tdGetKvRowValOfCol(SCellVal *output, STSRow *pRow, v
int16_t
colIdx
)
{
#ifdef TD_SUPPORT_BITMAP
TASSERT
(
colIdx
<
tdRowGetNCols
(
pRow
)
-
1
);
if
(
tdGetBitmapValType
(
pBitmap
,
colIdx
,
&
output
->
valType
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tdGetBitmapValType
(
pBitmap
,
colIdx
,
&
output
->
valType
,
0
)
!=
TSDB_CODE_SUCCESS
)
{
output
->
valType
=
TD_VTYPE_NONE
;
return
terrno
;
}
...
...
@@ -868,7 +1018,7 @@ static FORCE_INLINE bool tdGetTpRowDataOfCol(STSRowIter *pIter, col_type_t colTy
}
#ifdef TD_SUPPORT_BITMAP
if
(
tdGetBitmapValType
(
pIter
->
pBitmap
,
pIter
->
colIdx
-
1
,
&
pVal
->
valType
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tdGetBitmapValType
(
pIter
->
pBitmap
,
pIter
->
colIdx
-
1
,
&
pVal
->
valType
,
0
)
!=
TSDB_CODE_SUCCESS
)
{
pVal
->
valType
=
TD_VTYPE_NONE
;
}
#else
...
...
@@ -905,7 +1055,7 @@ static FORCE_INLINE bool tdGetKvRowValOfColEx(STSRowIter *pIter, col_id_t colId,
#ifdef TD_SUPPORT_BITMAP
int16_t
colIdx
=
-
1
;
if
(
pKvIdx
)
colIdx
=
POINTER_DISTANCE
(
TD_ROW_COL_IDX
(
pRow
),
pKvIdx
)
/
sizeof
(
SKvRowIdx
);
if
(
tdGetBitmapValType
(
pIter
->
pBitmap
,
colIdx
,
&
pVal
->
valType
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tdGetBitmapValType
(
pIter
->
pBitmap
,
colIdx
,
&
pVal
->
valType
,
0
)
!=
TSDB_CODE_SUCCESS
)
{
pVal
->
valType
=
TD_VTYPE_NONE
;
}
#else
...
...
@@ -962,7 +1112,7 @@ static FORCE_INLINE bool tdSTSRowIterNext(STSRowIter *pIter, col_id_t colId, col
STSRow
*
mergeTwoRows
(
void
*
buffer
,
STSRow
*
row1
,
STSRow
*
row2
,
STSchema
*
pSchema1
,
STSchema
*
pSchema2
);
// Get the data pointer from a column-wised data
static
FORCE_INLINE
int32_t
tdGetColDataOfRow
(
SCellVal
*
pVal
,
SDataCol
*
pCol
,
int32_t
row
)
{
static
FORCE_INLINE
int32_t
tdGetColDataOfRow
(
SCellVal
*
pVal
,
SDataCol
*
pCol
,
int32_t
row
,
int8_t
bitmapMode
)
{
if
(
isAllRowsNone
(
pCol
))
{
pVal
->
valType
=
TD_VTYPE_NULL
;
#ifdef TD_SUPPORT_READ2
...
...
@@ -975,7 +1125,7 @@ static FORCE_INLINE int32_t tdGetColDataOfRow(SCellVal *pVal, SDataCol *pCol, in
if
(
TD_COL_ROWS_NORM
(
pCol
))
{
pVal
->
valType
=
TD_VTYPE_NORM
;
}
else
if
(
tdGetBitmapValType
(
pCol
->
pBitmap
,
row
,
&
(
pVal
->
valType
))
<
0
)
{
}
else
if
(
tdGetBitmapValType
(
pCol
->
pBitmap
,
row
,
&
(
pVal
->
valType
)
,
bitmapMode
)
<
0
)
{
return
terrno
;
}
...
...
@@ -1018,14 +1168,14 @@ static FORCE_INLINE bool tdSKvRowGetVal(STSRow *pRow, col_id_t colId, uint32_t o
return
true
;
}
static
FORCE_INLINE
int32_t
dataColGetNEleLen
(
SDataCol
*
pDataCol
,
int32_t
rows
)
{
static
FORCE_INLINE
int32_t
dataColGetNEleLen
(
SDataCol
*
pDataCol
,
int32_t
rows
,
int8_t
bitmapMode
)
{
ASSERT
(
rows
>
0
);
int32_t
result
=
0
;
if
(
IS_VAR_DATA_TYPE
(
pDataCol
->
type
))
{
result
+=
pDataCol
->
dataOff
[
rows
-
1
];
SCellVal
val
=
{
0
};
if
(
tdGetColDataOfRow
(
&
val
,
pDataCol
,
rows
-
1
)
<
0
)
{
if
(
tdGetColDataOfRow
(
&
val
,
pDataCol
,
rows
-
1
,
bitmapMode
)
<
0
)
{
TASSERT
(
0
);
}
...
...
include/common/ttokendef.h
浏览文件 @
3d6030a4
...
...
@@ -59,164 +59,169 @@
#define TK_LOCAL 41
#define TK_QNODE 42
#define TK_ON 43
#define TK_DATABASE 44
#define TK_USE 45
#define TK_IF 46
#define TK_NOT 47
#define TK_EXISTS 48
#define TK_BLOCKS 49
#define TK_CACHE 50
#define TK_CACHELAST 51
#define TK_COMP 52
#define TK_DAYS 53
#define TK_NK_VARIABLE 54
#define TK_FSYNC 55
#define TK_MAXROWS 56
#define TK_MINROWS 57
#define TK_KEEP 58
#define TK_PRECISION 59
#define TK_QUORUM 60
#define TK_REPLICA 61
#define TK_TTL 62
#define TK_WAL 63
#define TK_VGROUPS 64
#define TK_SINGLE_STABLE 65
#define TK_STREAM_MODE 66
#define TK_RETENTIONS 67
#define TK_NK_COMMA 68
#define TK_NK_COLON 69
#define TK_TABLE 70
#define TK_NK_LP 71
#define TK_NK_RP 72
#define TK_STABLE 73
#define TK_ADD 74
#define TK_COLUMN 75
#define TK_MODIFY 76
#define TK_RENAME 77
#define TK_TAG 78
#define TK_SET 79
#define TK_NK_EQ 80
#define TK_USING 81
#define TK_TAGS 82
#define TK_NK_DOT 83
#define TK_COMMENT 84
#define TK_BOOL 85
#define TK_TINYINT 86
#define TK_SMALLINT 87
#define TK_INT 88
#define TK_INTEGER 89
#define TK_BIGINT 90
#define TK_FLOAT 91
#define TK_DOUBLE 92
#define TK_BINARY 93
#define TK_TIMESTAMP 94
#define TK_NCHAR 95
#define TK_UNSIGNED 96
#define TK_JSON 97
#define TK_VARCHAR 98
#define TK_MEDIUMBLOB 99
#define TK_BLOB 100
#define TK_VARBINARY 101
#define TK_DECIMAL 102
#define TK_SMA 103
#define TK_ROLLUP 104
#define TK_FILE_FACTOR 105
#define TK_NK_FLOAT 106
#define TK_DELAY 107
#define TK_SHOW 108
#define TK_DATABASES 109
#define TK_TABLES 110
#define TK_STABLES 111
#define TK_MNODES 112
#define TK_MODULES 113
#define TK_QNODES 114
#define TK_FUNCTIONS 115
#define TK_INDEXES 116
#define TK_FROM 117
#define TK_ACCOUNTS 118
#define TK_APPS 119
#define TK_CONNECTIONS 120
#define TK_LICENCE 121
#define TK_QUERIES 122
#define TK_SCORES 123
#define TK_TOPICS 124
#define TK_VARIABLES 125
#define TK_LIKE 126
#define TK_INDEX 127
#define TK_FULLTEXT 128
#define TK_FUNCTION 129
#define TK_INTERVAL 130
#define TK_TOPIC 131
#define TK_AS 132
#define TK_DESC 133
#define TK_DESCRIBE 134
#define TK_RESET 135
#define TK_QUERY 136
#define TK_EXPLAIN 137
#define TK_ANALYZE 138
#define TK_VERBOSE 139
#define TK_NK_BOOL 140
#define TK_RATIO 141
#define TK_COMPACT 142
#define TK_VNODES 143
#define TK_IN 144
#define TK_OUTPUTTYPE 145
#define TK_AGGREGATE 146
#define TK_BUFSIZE 147
#define TK_STREAM 148
#define TK_INTO 149
#define TK_KILL 150
#define TK_CONNECTION 151
#define TK_MERGE 152
#define TK_VGROUP 153
#define TK_REDISTRIBUTE 154
#define TK_SPLIT 155
#define TK_SYNCDB 156
#define TK_NULL 157
#define TK_FIRST 158
#define TK_LAST 159
#define TK_NOW 160
#define TK_ROWTS 161
#define TK_TBNAME 162
#define TK_QSTARTTS 163
#define TK_QENDTS 164
#define TK_WSTARTTS 165
#define TK_WENDTS 166
#define TK_WDURATION 167
#define TK_BETWEEN 168
#define TK_IS 169
#define TK_NK_LT 170
#define TK_NK_GT 171
#define TK_NK_LE 172
#define TK_NK_GE 173
#define TK_NK_NE 174
#define TK_MATCH 175
#define TK_NMATCH 176
#define TK_JOIN 177
#define TK_INNER 178
#define TK_SELECT 179
#define TK_DISTINCT 180
#define TK_WHERE 181
#define TK_PARTITION 182
#define TK_BY 183
#define TK_SESSION 184
#define TK_STATE_WINDOW 185
#define TK_SLIDING 186
#define TK_FILL 187
#define TK_VALUE 188
#define TK_NONE 189
#define TK_PREV 190
#define TK_LINEAR 191
#define TK_NEXT 192
#define TK_GROUP 193
#define TK_HAVING 194
#define TK_ORDER 195
#define TK_SLIMIT 196
#define TK_SOFFSET 197
#define TK_LIMIT 198
#define TK_OFFSET 199
#define TK_ASC 200
#define TK_NULLS 201
#define TK_BNODE 44
#define TK_SNODE 45
#define TK_MNODE 46
#define TK_DATABASE 47
#define TK_USE 48
#define TK_IF 49
#define TK_NOT 50
#define TK_EXISTS 51
#define TK_BLOCKS 52
#define TK_CACHE 53
#define TK_CACHELAST 54
#define TK_COMP 55
#define TK_DAYS 56
#define TK_NK_VARIABLE 57
#define TK_FSYNC 58
#define TK_MAXROWS 59
#define TK_MINROWS 60
#define TK_KEEP 61
#define TK_PRECISION 62
#define TK_QUORUM 63
#define TK_REPLICA 64
#define TK_TTL 65
#define TK_WAL 66
#define TK_VGROUPS 67
#define TK_SINGLE_STABLE 68
#define TK_STREAM_MODE 69
#define TK_RETENTIONS 70
#define TK_NK_COMMA 71
#define TK_NK_COLON 72
#define TK_TABLE 73
#define TK_NK_LP 74
#define TK_NK_RP 75
#define TK_STABLE 76
#define TK_ADD 77
#define TK_COLUMN 78
#define TK_MODIFY 79
#define TK_RENAME 80
#define TK_TAG 81
#define TK_SET 82
#define TK_NK_EQ 83
#define TK_USING 84
#define TK_TAGS 85
#define TK_NK_DOT 86
#define TK_COMMENT 87
#define TK_BOOL 88
#define TK_TINYINT 89
#define TK_SMALLINT 90
#define TK_INT 91
#define TK_INTEGER 92
#define TK_BIGINT 93
#define TK_FLOAT 94
#define TK_DOUBLE 95
#define TK_BINARY 96
#define TK_TIMESTAMP 97
#define TK_NCHAR 98
#define TK_UNSIGNED 99
#define TK_JSON 100
#define TK_VARCHAR 101
#define TK_MEDIUMBLOB 102
#define TK_BLOB 103
#define TK_VARBINARY 104
#define TK_DECIMAL 105
#define TK_SMA 106
#define TK_ROLLUP 107
#define TK_FILE_FACTOR 108
#define TK_NK_FLOAT 109
#define TK_DELAY 110
#define TK_SHOW 111
#define TK_DATABASES 112
#define TK_TABLES 113
#define TK_STABLES 114
#define TK_MNODES 115
#define TK_MODULES 116
#define TK_QNODES 117
#define TK_FUNCTIONS 118
#define TK_INDEXES 119
#define TK_FROM 120
#define TK_ACCOUNTS 121
#define TK_APPS 122
#define TK_CONNECTIONS 123
#define TK_LICENCE 124
#define TK_QUERIES 125
#define TK_SCORES 126
#define TK_TOPICS 127
#define TK_VARIABLES 128
#define TK_BNODES 129
#define TK_SNODES 130
#define TK_LIKE 131
#define TK_INDEX 132
#define TK_FULLTEXT 133
#define TK_FUNCTION 134
#define TK_INTERVAL 135
#define TK_TOPIC 136
#define TK_AS 137
#define TK_DESC 138
#define TK_DESCRIBE 139
#define TK_RESET 140
#define TK_QUERY 141
#define TK_EXPLAIN 142
#define TK_ANALYZE 143
#define TK_VERBOSE 144
#define TK_NK_BOOL 145
#define TK_RATIO 146
#define TK_COMPACT 147
#define TK_VNODES 148
#define TK_IN 149
#define TK_OUTPUTTYPE 150
#define TK_AGGREGATE 151
#define TK_BUFSIZE 152
#define TK_STREAM 153
#define TK_INTO 154
#define TK_KILL 155
#define TK_CONNECTION 156
#define TK_MERGE 157
#define TK_VGROUP 158
#define TK_REDISTRIBUTE 159
#define TK_SPLIT 160
#define TK_SYNCDB 161
#define TK_NULL 162
#define TK_FIRST 163
#define TK_LAST 164
#define TK_NOW 165
#define TK_ROWTS 166
#define TK_TBNAME 167
#define TK_QSTARTTS 168
#define TK_QENDTS 169
#define TK_WSTARTTS 170
#define TK_WENDTS 171
#define TK_WDURATION 172
#define TK_BETWEEN 173
#define TK_IS 174
#define TK_NK_LT 175
#define TK_NK_GT 176
#define TK_NK_LE 177
#define TK_NK_GE 178
#define TK_NK_NE 179
#define TK_MATCH 180
#define TK_NMATCH 181
#define TK_JOIN 182
#define TK_INNER 183
#define TK_SELECT 184
#define TK_DISTINCT 185
#define TK_WHERE 186
#define TK_PARTITION 187
#define TK_BY 188
#define TK_SESSION 189
#define TK_STATE_WINDOW 190
#define TK_SLIDING 191
#define TK_FILL 192
#define TK_VALUE 193
#define TK_NONE 194
#define TK_PREV 195
#define TK_LINEAR 196
#define TK_NEXT 197
#define TK_GROUP 198
#define TK_HAVING 199
#define TK_ORDER 200
#define TK_SLIMIT 201
#define TK_SOFFSET 202
#define TK_LIMIT 203
#define TK_OFFSET 204
#define TK_ASC 205
#define TK_NULLS 206
#define TK_NK_SPACE 300
#define TK_NK_COMMENT 301
...
...
include/libs/catalog/catalog.h
浏览文件 @
3d6030a4
...
...
@@ -78,6 +78,7 @@ typedef struct SDbVgVersion {
}
SDbVgVersion
;
typedef
SDbCfgRsp
SDbCfgInfo
;
typedef
SUserIndexRsp
SIndexInfo
;
int32_t
catalogInit
(
SCatalogCfg
*
cfg
);
...
...
@@ -221,6 +222,8 @@ int32_t catalogGetExpiredDBs(SCatalog* pCatalog, SDbVgVersion **dbs, uint32_t *n
int32_t
catalogGetDBCfg
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
dbFName
,
SDbCfgInfo
*
pDbCfg
);
int32_t
catalogGetIndexInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
pInfo
);
/**
* Destroy catalog and relase all resources
...
...
include/libs/monitor/monitor.h
浏览文件 @
3d6030a4
...
...
@@ -19,6 +19,7 @@
#include "tarray.h"
#include "tdef.h"
#include "tlog.h"
#include "tmsg.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -29,6 +30,44 @@ extern "C" {
#define MON_VER_LEN 12
#define MON_LOG_LEN 1024
typedef
struct
{
int64_t
ts
;
ELogLevel
level
;
char
content
[
MON_LOG_LEN
];
}
SMonLogItem
;
typedef
struct
{
SArray
*
logs
;
// array of SMonLogItem
int32_t
numOfErrorLogs
;
int32_t
numOfInfoLogs
;
int32_t
numOfDebugLogs
;
int32_t
numOfTraceLogs
;
}
SMonLogs
;
typedef
struct
{
char
name
[
TSDB_FILENAME_LEN
];
int8_t
level
;
SDiskSize
size
;
}
SMonDiskDesc
;
typedef
struct
{
double
cpu_engine
;
double
cpu_system
;
float
cpu_cores
;
int64_t
mem_engine
;
// KB
int64_t
mem_system
;
// KB
int64_t
mem_total
;
// KB
int64_t
disk_engine
;
// Byte
int64_t
disk_used
;
// Byte
int64_t
disk_total
;
// Byte
int64_t
net_in
;
// bytes
int64_t
net_out
;
// bytes
int64_t
io_read
;
// bytes
int64_t
io_write
;
// bytes
int64_t
io_read_disk
;
// bytes
int64_t
io_write_disk
;
// bytes
}
SMonSysInfo
;
typedef
struct
{
int32_t
dnode_id
;
char
dnode_ep
[
TSDB_EP_LEN
];
...
...
@@ -36,6 +75,19 @@ typedef struct {
int32_t
protocol
;
}
SMonBasicInfo
;
typedef
struct
{
float
uptime
;
// day
int8_t
has_mnode
;
SMonDiskDesc
logdir
;
SMonDiskDesc
tempdir
;
}
SMonDnodeInfo
;
typedef
struct
{
SMonBasicInfo
basic
;
SMonDnodeInfo
dnode
;
SMonSysInfo
sys
;
}
SMonDmInfo
;
typedef
struct
{
int32_t
dnode_id
;
char
dnode_ep
[
TSDB_EP_LEN
];
...
...
@@ -87,46 +139,65 @@ typedef struct {
}
SMonGrantInfo
;
typedef
struct
{
float
uptime
;
// day
double
cpu_engine
;
double
cpu_system
;
float
cpu_cores
;
int64_t
mem_engine
;
// KB
int64_t
mem_system
;
// KB
int64_t
mem_total
;
// KB
int64_t
disk_engine
;
// Byte
int64_t
disk_used
;
// Byte
int64_t
disk_total
;
// Byte
int64_t
net_in
;
// bytes
int64_t
net_out
;
// bytes
int64_t
io_read
;
// bytes
int64_t
io_write
;
// bytes
int64_t
io_read_disk
;
// bytes
int64_t
io_write_disk
;
// bytes
int64_t
req_select
;
int64_t
req_insert
;
int64_t
req_insert_success
;
int64_t
req_insert_batch
;
int64_t
req_insert_batch_success
;
int32_t
errors
;
int32_t
vnodes_num
;
int32_t
masters
;
int8_t
has_mnode
;
}
SMonDnodeInfo
;
SMonClusterInfo
cluster
;
SMonVgroupInfo
vgroup
;
SMonGrantInfo
grant
;
SMonSysInfo
sys
;
SMonLogs
log
;
}
SMonMmInfo
;
typedef
struct
{
char
name
[
TSDB_FILENAME_LEN
];
int8_t
level
;
SDiskSize
size
;
}
SMonDiskDesc
;
int32_t
tSerializeSMonMmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMmInfo
*
pInfo
);
int32_t
tDeserializeSMonMmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMmInfo
*
pInfo
);
void
tFreeSMonMmInfo
(
SMonMmInfo
*
pInfo
);
typedef
struct
{
SArray
*
datadirs
;
// array of SMonDiskDesc
SMonDiskDesc
logdir
;
SMonDiskDesc
tempdir
;
SArray
*
datadirs
;
// array of SMonDiskDesc
}
SMonDiskInfo
;
typedef
struct
SMonInfo
SMonInfo
;
typedef
struct
{
SMonDiskInfo
tfs
;
SVnodesStat
vstat
;
SMonSysInfo
sys
;
SMonLogs
log
;
}
SMonVmInfo
;
int32_t
tSerializeSMonVmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVmInfo
*
pInfo
);
int32_t
tDeserializeSMonVmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVmInfo
*
pInfo
);
void
tFreeSMonVmInfo
(
SMonVmInfo
*
pInfo
);
typedef
struct
{
SMonSysInfo
sys
;
SMonLogs
log
;
}
SMonQmInfo
;
int32_t
tSerializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
);
int32_t
tDeserializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
);
void
tFreeSMonQmInfo
(
SMonQmInfo
*
pInfo
);
typedef
struct
{
SMonSysInfo
sys
;
SMonLogs
log
;
}
SMonSmInfo
;
int32_t
tSerializeSMonSmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonSmInfo
*
pInfo
);
int32_t
tDeserializeSMonSmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonSmInfo
*
pInfo
);
void
tFreeSMonSmInfo
(
SMonSmInfo
*
pInfo
);
typedef
struct
{
SMonSysInfo
sys
;
SMonLogs
log
;
}
SMonBmInfo
;
int32_t
tSerializeSMonBmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonBmInfo
*
pInfo
);
int32_t
tDeserializeSMonBmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonBmInfo
*
pInfo
);
void
tFreeSMonBmInfo
(
SMonBmInfo
*
pInfo
);
typedef
struct
{
SArray
*
pVloads
;
// SVnodeLoad
}
SMonVloadInfo
;
int32_t
tSerializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
);
int32_t
tDeserializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
);
void
tFreeSMonVloadInfo
(
SMonVloadInfo
*
pInfo
);
typedef
struct
{
const
char
*
server
;
...
...
@@ -138,16 +209,14 @@ typedef struct {
int32_t
monInit
(
const
SMonCfg
*
pCfg
);
void
monCleanup
();
void
monRecordLog
(
int64_t
ts
,
ELogLevel
level
,
const
char
*
content
);
SMonInfo
*
monCreateMonitorInfo
();
void
monSetBasicInfo
(
SMonInfo
*
pMonitor
,
SMonBasicInfo
*
pInfo
);
void
monSetClusterInfo
(
SMonInfo
*
pMonitor
,
SMonClusterInfo
*
pInfo
);
void
monSetVgroupInfo
(
SMonInfo
*
pMonitor
,
SMonVgroupInfo
*
pInfo
);
void
monSetGrantInfo
(
SMonInfo
*
pMonitor
,
SMonGrantInfo
*
pInfo
);
void
monSetDnodeInfo
(
SMonInfo
*
pMonitor
,
SMonDnodeInfo
*
pInfo
);
void
monSetDiskInfo
(
SMonInfo
*
pMonitor
,
SMonDiskInfo
*
pInfo
);
void
monSendReport
(
SMonInfo
*
pMonitor
);
void
monCleanupMonitorInfo
(
SMonInfo
*
pMonitor
);
int32_t
monGetLogs
(
SMonLogs
*
logs
);
void
monSetDmInfo
(
SMonDmInfo
*
pInfo
);
void
monSetMmInfo
(
SMonMmInfo
*
pInfo
);
void
monSetVmInfo
(
SMonVmInfo
*
pInfo
);
void
monSetQmInfo
(
SMonQmInfo
*
pInfo
);
void
monSetSmInfo
(
SMonSmInfo
*
pInfo
);
void
monSetBmInfo
(
SMonBmInfo
*
pInfo
);
void
monSendReport
();
#ifdef __cplusplus
}
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
3d6030a4
...
...
@@ -230,15 +230,15 @@ typedef struct SDropIndexStmt {
char
tableName
[
TSDB_TABLE_NAME_LEN
];
}
SDropIndexStmt
;
typedef
struct
SCreate
Qn
odeStmt
{
typedef
struct
SCreate
ComponentN
odeStmt
{
ENodeType
type
;
int32_t
dnodeId
;
}
SCreate
Qn
odeStmt
;
}
SCreate
ComponentN
odeStmt
;
typedef
struct
SDrop
Qn
odeStmt
{
typedef
struct
SDrop
ComponentN
odeStmt
{
ENodeType
type
;
int32_t
dnodeId
;
}
SDrop
Qn
odeStmt
;
}
SDrop
ComponentN
odeStmt
;
typedef
struct
SCreateTopicStmt
{
ENodeType
type
;
...
...
include/libs/nodes/nodes.h
浏览文件 @
3d6030a4
...
...
@@ -30,11 +30,19 @@ extern "C" {
#define FOREACH(node, list) \
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false)); cell = cell->pNext)
// only be use in FOREACH
#define ERASE_NODE(list) cell = nodesListErase(list, cell);
#define REPLACE_NODE(newNode) cell->pNode = (SNode*)(newNode)
#define INSERT_LIST(target, src) nodesListInsertList((target), cell, src)
#define WHERE_EACH(node, list) \
SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); \
while (NULL != cell ? (node = cell->pNode, true) : (node = NULL, false))
#define WHERE_NEXT cell = cell->pNext
// only be use in WHERE_EACH
#define ERASE_NODE(list) cell = nodesListErase((list), cell)
#define FORBOTH(node1, list1, node2, list2) \
for (SListCell* cell1 = (NULL != (list1) ? (list1)->pHead : NULL), *cell2 = (NULL != (list2) ? (list2)->pHead : NULL); \
(NULL == cell1 ? (node1 = NULL, false) : (node1 = cell1->pNode, true)), (NULL == cell2 ? (node2 = NULL, false) : (node2 = cell2->pNode, true)), (node1 != NULL && node2 != NULL); \
...
...
@@ -97,6 +105,12 @@ typedef enum ENodeType {
QUERY_NODE_DROP_INDEX_STMT
,
QUERY_NODE_CREATE_QNODE_STMT
,
QUERY_NODE_DROP_QNODE_STMT
,
QUERY_NODE_CREATE_BNODE_STMT
,
QUERY_NODE_DROP_BNODE_STMT
,
QUERY_NODE_CREATE_SNODE_STMT
,
QUERY_NODE_DROP_SNODE_STMT
,
QUERY_NODE_CREATE_MNODE_STMT
,
QUERY_NODE_DROP_MNODE_STMT
,
QUERY_NODE_CREATE_TOPIC_STMT
,
QUERY_NODE_DROP_TOPIC_STMT
,
QUERY_NODE_ALTER_LOCAL_STMT
,
...
...
@@ -134,6 +148,8 @@ typedef enum ENodeType {
QUERY_NODE_SHOW_SCORES_STMT
,
QUERY_NODE_SHOW_TOPICS_STMT
,
QUERY_NODE_SHOW_VARIABLE_STMT
,
QUERY_NODE_SHOW_BNODES_STMT
,
QUERY_NODE_SHOW_SNODES_STMT
,
QUERY_NODE_KILL_CONNECTION_STMT
,
QUERY_NODE_KILL_QUERY_STMT
,
...
...
@@ -202,7 +218,9 @@ int32_t nodesListStrictAppend(SNodeList* pList, SNodeptr pNode);
int32_t
nodesListMakeAppend
(
SNodeList
**
pList
,
SNodeptr
pNode
);
int32_t
nodesListAppendList
(
SNodeList
*
pTarget
,
SNodeList
*
pSrc
);
int32_t
nodesListStrictAppendList
(
SNodeList
*
pTarget
,
SNodeList
*
pSrc
);
int32_t
nodesListPushFront
(
SNodeList
*
pList
,
SNodeptr
pNode
);
SListCell
*
nodesListErase
(
SNodeList
*
pList
,
SListCell
*
pCell
);
void
nodesListInsertList
(
SNodeList
*
pTarget
,
SListCell
*
pPos
,
SNodeList
*
pSrc
);
SNodeptr
nodesListGetNode
(
SNodeList
*
pList
,
int32_t
index
);
void
nodesDestroyList
(
SNodeList
*
pList
);
// Only clear the linked list structure, without releasing the elements inside
...
...
include/libs/nodes/querynodes.h
浏览文件 @
3d6030a4
...
...
@@ -238,6 +238,7 @@ typedef struct SSelectStmt {
SNode
*
pSlimit
;
char
stmtName
[
TSDB_TABLE_NAME_LEN
];
uint8_t
precision
;
bool
isEmptyResult
;
}
SSelectStmt
;
typedef
enum
ESetOperatorType
{
...
...
include/libs/parser/parser.h
浏览文件 @
3d6030a4
...
...
@@ -44,8 +44,15 @@ typedef struct SCmdMsgInfo {
void
*
pExtension
;
// todo remove it soon
}
SCmdMsgInfo
;
typedef
enum
EQueryExecMode
{
QUERY_EXEC_MODE_LOCAL
=
1
,
QUERY_EXEC_MODE_RPC
,
QUERY_EXEC_MODE_SCHEDULE
,
QUERY_EXEC_MODE_EMPTY_RESULT
}
EQueryExecMode
;
typedef
struct
SQuery
{
bool
directRpc
;
EQueryExecMode
execMode
;
bool
haveResultSet
;
SNode
*
pRoot
;
int32_t
numOfResCols
;
...
...
@@ -55,7 +62,6 @@ typedef struct SQuery {
SArray
*
pDbList
;
SArray
*
pTableList
;
bool
showRewrite
;
bool
localCmd
;
}
SQuery
;
int32_t
qParseQuerySql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
...
...
include/os/osSysinfo.h
浏览文件 @
3d6030a4
...
...
@@ -44,8 +44,8 @@ int32_t taosGetTotalMemory(int64_t *totalKB);
int32_t
taosGetProcMemory
(
int64_t
*
usedKB
);
int32_t
taosGetSysMemory
(
int64_t
*
usedKB
);
int32_t
taosGetDiskSize
(
char
*
dataDir
,
SDiskSize
*
diskSize
);
int32_t
taosGetProcIO
(
int64_t
*
rchars
,
int64_t
*
wchars
,
int64_t
*
read_bytes
,
int64_t
*
write_bytes
);
int32_t
taosGetCardInfo
(
int64_t
*
receive_bytes
,
int64_t
*
transmit_bytes
);
void
taosGetProcIODelta
(
int64_t
*
rchars
,
int64_t
*
wchars
,
int64_t
*
read_bytes
,
int64_t
*
write_bytes
);
void
taosGetCardInfoDelta
(
int64_t
*
receive_bytes
,
int64_t
*
transmit_bytes
);
void
taosKillSystem
();
int32_t
taosGetSystemUUID
(
char
*
uid
,
int32_t
uidlen
);
...
...
include/util/taoserror.h
浏览文件 @
3d6030a4
...
...
@@ -64,31 +64,35 @@ int32_t* taosGetErrno();
#define TSDB_CODE_RPC_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0016)
//common & util
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100)
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0101)
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0102)
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0103)
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0104)
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x0106)
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0107)
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0108)
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0109)
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x010A)
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x010B)
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x010C)
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x010D)
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x010E)
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x010F)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0110)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0111)
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0112)
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0113)
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0114)
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0115)
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x0120)
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x0121)
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x0122)
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0123)
#define TSDB_CODE_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0100)
#define TSDB_CODE_OUT_OF_RANGE TAOS_DEF_ERROR_CODE(0, 0x0101)
#define TSDB_CODE_OUT_OF_SHM_MEM TAOS_DEF_ERROR_CODE(0, 0x0102)
#define TSDB_CODE_INVALID_SHM_ID TAOS_DEF_ERROR_CODE(0, 0x0103)
#define TSDB_CODE_INVALID_PTR TAOS_DEF_ERROR_CODE(0, 0x0104)
#define TSDB_CODE_INVALID_MSG TAOS_DEF_ERROR_CODE(0, 0x0105)
#define TSDB_CODE_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x0106)
#define TSDB_CODE_INVALID_PARA TAOS_DEF_ERROR_CODE(0, 0x0107)
#define TSDB_CODE_INVALID_CFG TAOS_DEF_ERROR_CODE(0, 0x0108)
#define TSDB_CODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x0109)
#define TSDB_CODE_INVALID_JSON_FORMAT TAOS_DEF_ERROR_CODE(0, 0x010A)
#define TSDB_CODE_INVALID_VERSION_NUMBER TAOS_DEF_ERROR_CODE(0, 0x010B)
#define TSDB_CODE_INVALID_VERSION_STRING TAOS_DEF_ERROR_CODE(0, 0x010C)
#define TSDB_CODE_VERSION_NOT_COMPATIBLE TAOS_DEF_ERROR_CODE(0, 0x010D)
#define TSDB_CODE_MEMORY_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010E)
#define TSDB_CODE_FILE_CORRUPTED TAOS_DEF_ERROR_CODE(0, 0x010F)
#define TSDB_CODE_CHECKSUM_ERROR TAOS_DEF_ERROR_CODE(0, 0x0110)
#define TSDB_CODE_COMPRESS_ERROR TAOS_DEF_ERROR_CODE(0, 0x0111)
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0112)
#define TSDB_CODE_MSG_NOT_PROCESSED TAOS_DEF_ERROR_CODE(0, 0x0113)
#define TSDB_CODE_CFG_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0114)
#define TSDB_CODE_REPEAT_INIT TAOS_DEF_ERROR_CODE(0, 0x0115)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0140)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0141)
#define TSDB_CODE_REF_ID_REMOVED TAOS_DEF_ERROR_CODE(0, 0x0152)
#define TSDB_CODE_REF_INVALID_ID TAOS_DEF_ERROR_CODE(0, 0x0153)
#define TSDB_CODE_REF_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0154)
#define TSDB_CODE_REF_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0155)
//client
#define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200)
...
...
@@ -217,6 +221,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_INVALID_DB_OPTION TAOS_DEF_ERROR_CODE(0, 0x0385)
#define TSDB_CODE_MND_INVALID_DB_ACCT TAOS_DEF_ERROR_CODE(0, 0x0386)
#define TSDB_CODE_MND_DB_OPTION_UNCHANGED TAOS_DEF_ERROR_CODE(0, 0x0387)
#define TSDB_CODE_MND_DB_INDEX_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0388)
// mnode-vgroup
#define TSDB_CODE_MND_VGROUP_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0390)
...
...
@@ -283,17 +288,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_INVALID_SMA_OPTION TAOS_DEF_ERROR_CODE(0, 0x0402)
// dnode
#define TSDB_CODE_DND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x04A0)
#define TSDB_CODE_DND_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
#define TSDB_CODE_DND_INVALID_MSG_LEN TAOS_DEF_ERROR_CODE(0, 0x04A2)
#define TSDB_CODE_NODE_OFFLINE TAOS_DEF_ERROR_CODE(0, 0x04A1)
#define TSDB_CODE_NODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A3)
#define TSDB_CODE_NODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A4)
#define TSDB_CODE_NODE_PARSE_FILE_ERROR TAOS_DEF_ERROR_CODE(0, 0x04A5)
#define TSDB_CODE_NODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A6)
#define TSDB_CODE_DND_VNODE_ALREADY_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A7)
#define TSDB_CODE_DND_VNODE_NOT_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x04A8)
#define TSDB_CODE_DND_VNODE_INVALID_OPTION TAOS_DEF_ERROR_CODE(0, 0x04A9)
#define TSDB_CODE_DND_VNODE_TOO_MANY_VNODES TAOS_DEF_ERROR_CODE(0, 0x04AA)
// vnode
#define TSDB_CODE_VND_ACTION_IN_PROGRESS TAOS_DEF_ERROR_CODE(0, 0x0500)
...
...
include/util/tdef.h
浏览文件 @
3d6030a4
...
...
@@ -99,6 +99,8 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_INS_TABLE_MNODES "mnodes"
#define TSDB_INS_TABLE_MODULES "modules"
#define TSDB_INS_TABLE_QNODES "qnodes"
#define TSDB_INS_TABLE_BNODES "bnodes"
#define TSDB_INS_TABLE_CLUSTER "cluster"
#define TSDB_INS_TABLE_USER_DATABASES "user_databases"
#define TSDB_INS_TABLE_USER_FUNCTIONS "user_functions"
#define TSDB_INS_TABLE_USER_INDEXES "user_indexes"
...
...
@@ -108,6 +110,11 @@ extern const int32_t TYPE_BYTES[15];
#define TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED "user_table_distributed"
#define TSDB_INS_TABLE_USER_USERS "user_users"
#define TSDB_INS_TABLE_VGROUPS "vgroups"
#define TSDB_INS_TABLE_BNODES "bnodes"
#define TSDB_INS_TABLE_SNODES "snodes"
#define TSDB_INDEX_TYPE_SMA "SMA"
#define TSDB_INDEX_TYPE_FULLTEXT "FULLTEXT"
#define TSDB_INS_USER_STABLES_DBNAME_COLID 2
...
...
@@ -213,6 +220,9 @@ typedef enum ELogicConditionType {
#define TSDB_FUNC_MAX_RETRIEVE 1024
#define TSDB_INDEX_NAME_LEN 65 // 64 + 1 '\0'
#define TSDB_INDEX_TYPE_LEN 10
#define TSDB_INDEX_EXTS_LEN 256
#define TSDB_INDEX_FNAME_LEN (TSDB_DB_FNAME_LEN + TSDB_INDEX_NAME_LEN + TSDB_NAME_DELIMITER_LEN)
#define TSDB_TYPE_STR_MAX_LEN 32
#define TSDB_TABLE_FNAME_LEN (TSDB_DB_FNAME_LEN + TSDB_TABLE_NAME_LEN + TSDB_NAME_DELIMITER_LEN)
#define TSDB_TOPIC_FNAME_LEN TSDB_TABLE_FNAME_LEN
...
...
source/client/src/clientImpl.c
浏览文件 @
3d6030a4
...
...
@@ -281,22 +281,35 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
SRequestObj
*
execQueryImpl
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
)
{
SRequestObj
*
pRequest
=
NULL
;
SQuery
*
pQuery
=
NULL
;
int32_t
code
=
0
;
SArray
*
pNodeList
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
));
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
CHECK_CODE_GOTO
(
parseSql
(
pRequest
,
false
,
&
pQuery
),
_return
);
int32_t
code
=
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
parseSql
(
pRequest
,
false
,
&
pQuery
);
}
if
(
pQuery
->
localCmd
)
{
CHECK_CODE_GOTO
(
execLocalCmd
(
pRequest
,
pQuery
),
_return
);
}
else
if
(
pQuery
->
directRpc
)
{
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQuery
),
_return
);
}
else
{
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
pNodeList
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
pRequest
->
body
.
pDag
,
pNodeList
),
_return
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
switch
(
pQuery
->
execMode
)
{
case
QUERY_EXEC_MODE_LOCAL
:
code
=
execLocalCmd
(
pRequest
,
pQuery
);
break
;
case
QUERY_EXEC_MODE_RPC
:
code
=
execDdlQuery
(
pRequest
,
pQuery
);
break
;
case
QUERY_EXEC_MODE_SCHEDULE
:
code
=
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
pNodeList
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
scheduleQuery
(
pRequest
,
pRequest
->
body
.
pDag
,
pNodeList
);
}
break
;
case
QUERY_EXEC_MODE_EMPTY_RESULT
:
pRequest
->
type
=
TSDB_SQL_RETRIEVE_EMPTY_RESULT
;
break
;
default:
break
;
}
}
_return:
taosArrayDestroy
(
pNodeList
);
qDestroyQuery
(
pQuery
);
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
code
)
{
...
...
source/client/src/tmq.c
浏览文件 @
3d6030a4
...
...
@@ -1044,7 +1044,7 @@ int32_t tmqAskEp(tmq_t* tmq, bool sync) {
int8_t
epStatus
=
atomic_val_compare_exchange_8
(
&
tmq
->
epStatus
,
0
,
1
);
if
(
epStatus
==
1
)
{
int32_t
epSkipCnt
=
atomic_add_fetch_32
(
&
tmq
->
epSkipCnt
,
1
);
tsc
Debug
(
"consumer %ld skip ask ep cnt %d"
,
tmq
->
consumerId
,
epSkipCnt
);
tsc
Trace
(
"consumer %ld skip ask ep cnt %d"
,
tmq
->
consumerId
,
epSkipCnt
);
if
(
epSkipCnt
<
5000
)
return
0
;
}
atomic_store_32
(
&
tmq
->
epSkipCnt
,
0
);
...
...
@@ -1149,6 +1149,7 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t blockingTime, SMqClientTo
pReq
->
consumerId
=
tmq
->
consumerId
;
pReq
->
epoch
=
tmq
->
epoch
;
pReq
->
currentOffset
=
reqOffset
;
pReq
->
reqId
=
generateRequestId
();
pReq
->
head
.
vgId
=
htonl
(
pVg
->
vgId
);
pReq
->
head
.
contLen
=
htonl
(
sizeof
(
SMqPollReq
));
...
...
@@ -1234,7 +1235,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
int32_t
vgStatus
=
atomic_val_compare_exchange_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
,
TMQ_VG_STATUS__WAIT
);
if
(
vgStatus
!=
TMQ_VG_STATUS__IDLE
)
{
int32_t
vgSkipCnt
=
atomic_add_fetch_32
(
&
pVg
->
vgSkipCnt
,
1
);
tsc
Debug
(
"consumer %ld epoch %d skip vg %d skip cnt %d"
,
tmq
->
consumerId
,
tmq
->
epoch
,
pVg
->
vgId
,
vgSkipCnt
);
tsc
Trace
(
"consumer %ld epoch %d skip vg %d skip cnt %d"
,
tmq
->
consumerId
,
tmq
->
epoch
,
pVg
->
vgId
,
vgSkipCnt
);
continue
;
/*if (vgSkipCnt < 10000) continue;*/
#if 0
...
...
@@ -1279,7 +1280,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
.
len
=
sizeof
(
SMqPollReq
),
.
handle
=
NULL
,
};
sendInfo
->
requestId
=
generateRequestId
()
;
sendInfo
->
requestId
=
pReq
->
reqId
;
sendInfo
->
requestObjRefId
=
0
;
sendInfo
->
param
=
pParam
;
sendInfo
->
fp
=
tmqPollCb
;
...
...
@@ -1288,7 +1289,7 @@ int32_t tmqPollImpl(tmq_t* tmq, int64_t blockingTime) {
int64_t
transporterId
=
0
;
/*printf("send poll\n");*/
atomic_add_fetch_32
(
&
tmq
->
waitingRequest
,
1
);
tscDebug
(
"consumer %ld send poll
: vg %d, epoch %d, req offset %ld"
,
tmq
->
consumerId
,
pVg
->
vgId
,
tmq
->
epoch
,
pVg
->
currentOffset
);
tscDebug
(
"consumer %ld send poll
to %s : vg %d, epoch %d, req offset %ld, reqId %lu"
,
tmq
->
consumerId
,
pTopic
->
topicName
,
pVg
->
vgId
,
tmq
->
epoch
,
pVg
->
currentOffset
,
pReq
->
reqId
);
/*printf("send vg %d %ld\n", pVg->vgId, pVg->currentOffset);*/
asyncSendMsgToServer
(
tmq
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
pVg
->
epSet
,
&
transporterId
,
sendInfo
);
pVg
->
pollCnt
++
;
...
...
source/common/src/tdatablock.c
浏览文件 @
3d6030a4
...
...
@@ -17,6 +17,7 @@
#include "tdatablock.h"
#include "tcompare.h"
#include "tglobal.h"
#include "tlog.h"
int32_t
taosGetFqdnPortFromEp
(
const
char
*
ep
,
SEp
*
pEp
)
{
pEp
->
port
=
0
;
...
...
@@ -83,6 +84,14 @@ int32_t colDataGetLength(const SColumnInfoData* pColumnInfoData, int32_t numOfRo
}
}
int32_t
colDataGetFullLength
(
const
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRows
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
return
pColumnInfoData
->
varmeta
.
length
+
sizeof
(
int32_t
)
*
numOfRows
;
}
else
{
return
pColumnInfoData
->
info
.
bytes
*
numOfRows
+
BitmapLen
(
numOfRows
);
}
}
void
colDataTrim
(
SColumnInfoData
*
pColumnInfoData
)
{
// TODO
}
...
...
@@ -130,44 +139,7 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
memcpy
(
pColumnInfoData
->
pData
+
len
,
pData
,
varDataTLen
(
pData
));
pColumnInfoData
->
varmeta
.
length
+=
varDataTLen
(
pData
);
}
else
{
char
*
p
=
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
;
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
{
*
(
bool
*
)
p
=
*
(
bool
*
)
pData
;
break
;
}
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_UTINYINT
:
{
*
(
int8_t
*
)
p
=
*
(
int8_t
*
)
pData
;
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
{
*
(
int16_t
*
)
p
=
*
(
int16_t
*
)
pData
;
break
;
}
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
{
*
(
int32_t
*
)
p
=
*
(
int32_t
*
)
pData
;
break
;
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
{
*
(
int64_t
*
)
p
=
*
(
int64_t
*
)
pData
;
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
*
(
float
*
)
p
=
*
(
float
*
)
pData
;
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
*
(
double
*
)
p
=
*
(
double
*
)
pData
;
break
;
}
default:
assert
(
0
);
}
memcpy
(
pColumnInfoData
->
pData
+
pColumnInfoData
->
info
.
bytes
*
currentRow
,
pData
,
pColumnInfoData
->
info
.
bytes
);
}
return
0
;
...
...
@@ -175,6 +147,8 @@ int32_t colDataAppend(SColumnInfoData* pColumnInfoData, uint32_t currentRow, con
static
void
doBitmapMerge
(
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRow1
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRow2
)
{
if
(
numOfRow2
<=
0
)
return
;
uint32_t
total
=
numOfRow1
+
numOfRow2
;
if
(
BitmapLen
(
numOfRow1
)
<
BitmapLen
(
total
))
{
...
...
@@ -189,22 +163,32 @@ static void doBitmapMerge(SColumnInfoData* pColumnInfoData, int32_t numOfRow1, c
if
(
remindBits
==
0
)
{
// no need to shift bits of bitmap
memcpy
(
pColumnInfoData
->
nullbitmap
+
BitmapLen
(
numOfRow1
),
pSource
->
nullbitmap
,
BitmapLen
(
numOfRow2
));
}
else
{
int32_t
len
=
BitmapLen
(
numOfRow2
);
int32_t
i
=
0
;
return
;
}
uint8_t
*
p
=
(
uint8_t
*
)
pSource
->
nullbitmap
;
pColumnInfoData
->
nullbitmap
[
BitmapLen
(
numOfRow1
)
-
1
]
|=
(
p
[
0
]
>>
remindBits
);
uint8_t
*
p
=
(
uint8_t
*
)
pSource
->
nullbitmap
;
pColumnInfoData
->
nullbitmap
[
BitmapLen
(
numOfRow1
)
-
1
]
|=
(
p
[
0
]
>>
remindBits
);
// copy remind bits
uint8_t
*
start
=
(
uint8_t
*
)
&
pColumnInfoData
->
nullbitmap
[
BitmapLen
(
numOfRow1
)];
while
(
i
<
len
)
{
start
[
i
]
|=
(
p
[
i
]
<<
shiftBits
);
i
+=
1
;
if
(
BitmapLen
(
numOfRow1
)
==
BitmapLen
(
total
))
{
return
;
}
if
(
i
>
1
)
{
start
[
i
-
1
]
|=
(
p
[
i
]
>>
remindBits
);
}
int32_t
len
=
BitmapLen
(
numOfRow2
);
int32_t
i
=
0
;
uint8_t
*
start
=
(
uint8_t
*
)
&
pColumnInfoData
->
nullbitmap
[
BitmapLen
(
numOfRow1
)];
int32_t
overCount
=
BitmapLen
(
total
)
-
BitmapLen
(
numOfRow1
);
while
(
i
<
len
)
{
// size limit of pSource->nullbitmap
if
(
i
>=
1
)
{
start
[
i
-
1
]
|=
(
p
[
i
]
>>
remindBits
);
//copy remind bits
}
if
(
i
>=
overCount
)
{
// size limit of pColumnInfoData->nullbitmap
return
;
}
start
[
i
]
|=
(
p
[
i
]
<<
shiftBits
);
//copy shift bits
i
+=
1
;
}
}
...
...
@@ -216,6 +200,9 @@ int32_t colDataMergeCol(SColumnInfoData* pColumnInfoData, uint32_t numOfRow1, co
return
numOfRow1
;
}
if
(
pSource
->
hasNull
)
{
pColumnInfoData
->
hasNull
=
pSource
->
hasNull
;
}
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
))
{
// Handle the bitmap
char
*
p
=
taosMemoryRealloc
(
pColumnInfoData
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
(
numOfRow1
+
numOfRow2
));
...
...
@@ -336,13 +323,18 @@ int32_t blockDataUpdateTsWindow(SSDataBlock* pDataBlock) {
return
0
;
}
int32_t
blockDataMerge
(
SSDataBlock
*
pDest
,
const
SSDataBlock
*
pSrc
)
{
assert
(
pSrc
!=
NULL
&&
pDest
!=
NULL
&&
pDest
->
info
.
numOfCols
==
pSrc
->
info
.
numOfCols
);
// if pIndexMap = NULL, merger one column by on column
int32_t
blockDataMerge
(
SSDataBlock
*
pDest
,
const
SSDataBlock
*
pSrc
,
SArray
*
pIndexMap
)
{
assert
(
pSrc
!=
NULL
&&
pDest
!=
NULL
);
int32_t
numOfCols
=
p
Src
->
info
.
numOfCols
;
int32_t
numOfCols
=
p
Dest
->
info
.
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
int32_t
mapIndex
=
i
;
if
(
pIndexMap
)
{
mapIndex
=
*
(
int32_t
*
)
taosArrayGet
(
pIndexMap
,
i
);
}
SColumnInfoData
*
pCol2
=
taosArrayGet
(
pDest
->
pDataBlock
,
i
);
SColumnInfoData
*
pCol1
=
taosArrayGet
(
pSrc
->
pDataBlock
,
i
);
SColumnInfoData
*
pCol1
=
taosArrayGet
(
pSrc
->
pDataBlock
,
mapIndex
);
uint32_t
oldLen
=
colDataGetLength
(
pCol2
,
pDest
->
info
.
rows
);
uint32_t
newLen
=
colDataGetLength
(
pCol1
,
pSrc
->
info
.
rows
);
...
...
@@ -369,13 +361,7 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) {
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
total
+=
colDataGetLength
(
pColInfoData
,
pBlock
->
info
.
rows
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
total
+=
sizeof
(
int32_t
)
*
pBlock
->
info
.
rows
;
}
else
{
total
+=
BitmapLen
(
pBlock
->
info
.
rows
);
}
total
+=
colDataGetFullLength
(
pColInfoData
,
pBlock
->
info
.
rows
);
}
return
total
;
...
...
@@ -399,52 +385,49 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
// TODO speedup by checking if the whole page can fit in firstly.
if
(
!
hasVarCol
)
{
size_t
rowSize
=
blockDataGetRowSize
(
pBlock
);
int32_t
capacity
=
(
payloadSize
/
(
rowSize
*
8
+
bitmapChar
*
numOfCols
))
*
8
;
int32_t
capacity
=
payloadSize
/
(
rowSize
+
numOfCols
*
bitmapChar
/
8
.
0
);
ASSERT
(
capacity
>
0
);
*
stopIndex
=
startIndex
+
capacity
;
*
stopIndex
=
startIndex
+
capacity
-
1
;
if
(
*
stopIndex
>=
numOfRows
)
{
*
stopIndex
=
numOfRows
-
1
;
}
return
TSDB_CODE_SUCCESS
;
}
else
{
// iterate the rows that can be fit in this buffer page
int32_t
size
=
(
headerSize
+
colHeaderSize
);
for
(
int32_t
j
=
startIndex
;
j
<
numOfRows
;
++
j
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
TARRAY_GET_ELEM
(
pBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
bool
isNull
=
colDataIsNull
(
pColInfoData
,
numOfRows
,
j
,
NULL
);
if
(
isNull
)
{
// do nothing
}
else
{
char
*
p
=
colDataGetData
(
pColInfoData
,
j
);
size
+=
varDataTLen
(
p
);
}
size
+=
sizeof
(
pColInfoData
->
varmeta
.
offset
[
0
]);
}
else
{
size
+=
pColInfoData
->
info
.
bytes
;
if
(((
j
-
startIndex
)
&
0x07
)
==
0
)
{
size
+=
1
;
// the space for null bitmap
}
}
// iterate the rows that can be fit in this buffer page
int32_t
size
=
(
headerSize
+
colHeaderSize
);
for
(
int32_t
j
=
startIndex
;
j
<
numOfRows
;
++
j
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
TARRAY_GET_ELEM
(
pBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
if
(
pColInfoData
->
varmeta
.
offset
[
j
]
!=
-
1
)
{
char
*
p
=
colDataGetData
(
pColInfoData
,
j
);
size
+=
varDataTLen
(
p
);
}
}
if
(
size
>
pageSize
)
{
*
stopIndex
=
j
-
1
;
ASSERT
(
*
stopIndex
>
startIndex
)
;
size
+=
sizeof
(
pColInfoData
->
varmeta
.
offset
[
0
]);
}
else
{
size
+=
pColInfoData
->
info
.
bytes
;
return
TSDB_CODE_SUCCESS
;
if
(((
j
-
startIndex
)
&
0x07
)
==
0
)
{
size
+=
1
;
// the space for null bitmap
}
}
}
// all fit in
*
stopIndex
=
numOfRows
-
1
;
return
TSDB_CODE_SUCCESS
;
if
(
size
>
pageSize
)
{
// pageSize must be able to hold one row
*
stopIndex
=
j
-
1
;
ASSERT
(
*
stopIndex
>=
startIndex
);
return
TSDB_CODE_SUCCESS
;
}
}
// all fit in
*
stopIndex
=
numOfRows
-
1
;
return
TSDB_CODE_SUCCESS
;
}
SSDataBlock
*
blockDataExtractBlock
(
SSDataBlock
*
pBlock
,
int32_t
startIndex
,
int32_t
rowCount
)
{
...
...
@@ -547,8 +530,13 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
size_t
metaSize
=
pBlock
->
info
.
rows
*
sizeof
(
int32_t
);
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
size_t
metaSize
=
pBlock
->
info
.
rows
*
sizeof
(
int32_t
);
char
*
tmp
=
taosMemoryRealloc
(
pCol
->
varmeta
.
offset
,
metaSize
);
// preview calloc is too small
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pCol
->
varmeta
.
offset
=
(
int32_t
*
)
tmp
;
memcpy
(
pCol
->
varmeta
.
offset
,
pStart
,
metaSize
);
pStart
+=
metaSize
;
}
else
{
...
...
@@ -581,6 +569,49 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
return
TSDB_CODE_SUCCESS
;
}
int32_t
blockDataFromBuf1
(
SSDataBlock
*
pBlock
,
const
char
*
buf
,
size_t
capacity
)
{
pBlock
->
info
.
rows
=
*
(
int32_t
*
)
buf
;
int32_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
const
char
*
pStart
=
buf
+
sizeof
(
uint32_t
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pCol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
size_t
metaSize
=
capacity
*
sizeof
(
int32_t
);
memcpy
(
pCol
->
varmeta
.
offset
,
pStart
,
metaSize
);
pStart
+=
metaSize
;
}
else
{
memcpy
(
pCol
->
nullbitmap
,
pStart
,
BitmapLen
(
capacity
));
pStart
+=
BitmapLen
(
capacity
);
}
int32_t
colLength
=
*
(
int32_t
*
)
pStart
;
pStart
+=
sizeof
(
int32_t
);
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
if
(
pCol
->
varmeta
.
allocLen
<
colLength
)
{
char
*
tmp
=
taosMemoryRealloc
(
pCol
->
pData
,
colLength
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pCol
->
pData
=
tmp
;
pCol
->
varmeta
.
allocLen
=
colLength
;
}
pCol
->
varmeta
.
length
=
colLength
;
ASSERT
(
pCol
->
varmeta
.
length
<=
pCol
->
varmeta
.
allocLen
);
}
memcpy
(
pCol
->
pData
,
pStart
,
colLength
);
pStart
+=
pCol
->
info
.
bytes
*
capacity
;
}
return
TSDB_CODE_SUCCESS
;
}
size_t
blockDataGetRowSize
(
SSDataBlock
*
pBlock
)
{
ASSERT
(
pBlock
!=
NULL
);
if
(
pBlock
->
info
.
rowSize
==
0
)
{
...
...
@@ -665,23 +696,13 @@ int32_t dataBlockCompar(const void* p1, const void* p2, const void* param) {
void
*
left1
=
colDataGetData
(
pColInfoData
,
left
);
void
*
right1
=
colDataGetData
(
pColInfoData
,
right
);
switch
(
pColInfoData
->
info
.
type
)
{
case
TSDB_DATA_TYPE_INT
:
{
int32_t
leftx
=
*
(
int32_t
*
)
left1
;
int32_t
rightx
=
*
(
int32_t
*
)
right1
;
if
(
leftx
==
rightx
)
{
break
;
}
else
{
if
(
pOrder
->
order
==
TSDB_ORDER_ASC
)
{
return
(
leftx
<
rightx
)
?
-
1
:
1
;
}
else
{
return
(
leftx
<
rightx
)
?
1
:
-
1
;
}
}
}
default:
assert
(
0
);
__compar_fn_t
fn
=
getKeyComparFunc
(
pColInfoData
->
info
.
type
,
pOrder
->
order
);
int
ret
=
fn
(
left1
,
right1
);
if
(
ret
==
0
)
{
continue
;
}
else
{
return
ret
;
}
}
...
...
@@ -735,61 +756,12 @@ static int32_t blockDataAssign(SColumnInfoData* pCols, const SSDataBlock* pDataB
pDst
->
varmeta
.
offset
[
j
]
=
pSrc
->
varmeta
.
offset
[
index
[
j
]];
}
}
else
{
switch
(
pSrc
->
info
.
type
)
{
case
TSDB_DATA_TYPE_UINT
:
case
TSDB_DATA_TYPE_INT
:
{
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
rows
;
++
j
)
{
int32_t
*
p
=
(
int32_t
*
)
pDst
->
pData
;
int32_t
*
srclist
=
(
int32_t
*
)
pSrc
->
pData
;
p
[
j
]
=
srclist
[
index
[
j
]];
if
(
colDataIsNull_f
(
pSrc
->
nullbitmap
,
index
[
j
]))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
j
);
}
}
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
{
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
rows
;
++
j
)
{
int32_t
*
p
=
(
int32_t
*
)
pDst
->
pData
;
int32_t
*
srclist
=
(
int32_t
*
)
pSrc
->
pData
;
p
[
j
]
=
srclist
[
index
[
j
]];
if
(
colDataIsNull_f
(
pSrc
->
nullbitmap
,
index
[
j
]))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
j
);
}
}
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
{
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
rows
;
++
j
)
{
int32_t
*
p
=
(
int32_t
*
)
pDst
->
pData
;
int32_t
*
srclist
=
(
int32_t
*
)
pSrc
->
pData
;
p
[
j
]
=
srclist
[
index
[
j
]];
if
(
colDataIsNull_f
(
pSrc
->
nullbitmap
,
index
[
j
]))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
j
);
}
}
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
case
TSDB_DATA_TYPE_BIGINT
:
{
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
rows
;
++
j
)
{
int32_t
*
p
=
(
int32_t
*
)
pDst
->
pData
;
int32_t
*
srclist
=
(
int32_t
*
)
pSrc
->
pData
;
p
[
j
]
=
srclist
[
index
[
j
]];
if
(
colDataIsNull_f
(
pSrc
->
nullbitmap
,
index
[
j
]))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
j
);
}
}
break
;
for
(
int32_t
j
=
0
;
j
<
pDataBlock
->
info
.
rows
;
++
j
)
{
if
(
colDataIsNull_f
(
pSrc
->
nullbitmap
,
index
[
j
]))
{
colDataSetNull_f
(
pDst
->
nullbitmap
,
j
);
continue
;
}
default:
assert
(
0
);
memcpy
(
pDst
->
pData
+
j
*
pDst
->
info
.
bytes
,
pSrc
->
pData
+
index
[
j
]
*
pDst
->
info
.
bytes
,
pDst
->
info
.
bytes
);
}
}
}
...
...
@@ -862,33 +834,6 @@ static int32_t* createTupleIndex(size_t rows) {
static
void
destroyTupleIndex
(
int32_t
*
index
)
{
taosMemoryFreeClear
(
index
);
}
static
__compar_fn_t
getComparFn
(
int32_t
type
,
int32_t
order
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
return
order
==
TSDB_ORDER_ASC
?
compareInt8Val
:
compareInt8ValDesc
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
order
==
TSDB_ORDER_ASC
?
compareInt16Val
:
compareInt16ValDesc
;
case
TSDB_DATA_TYPE_INT
:
return
order
==
TSDB_ORDER_ASC
?
compareInt32Val
:
compareInt32ValDesc
;
case
TSDB_DATA_TYPE_BIGINT
:
return
order
==
TSDB_ORDER_ASC
?
compareInt64Val
:
compareInt64ValDesc
;
case
TSDB_DATA_TYPE_FLOAT
:
return
order
==
TSDB_ORDER_ASC
?
compareFloatVal
:
compareFloatValDesc
;
case
TSDB_DATA_TYPE_DOUBLE
:
return
order
==
TSDB_ORDER_ASC
?
compareDoubleVal
:
compareDoubleValDesc
;
case
TSDB_DATA_TYPE_UTINYINT
:
return
order
==
TSDB_ORDER_ASC
?
compareUint8Val
:
compareUint8ValDesc
;
case
TSDB_DATA_TYPE_USMALLINT
:
return
order
==
TSDB_ORDER_ASC
?
compareUint16Val
:
compareUint16ValDesc
;
case
TSDB_DATA_TYPE_UINT
:
return
order
==
TSDB_ORDER_ASC
?
compareUint32Val
:
compareUint32ValDesc
;
case
TSDB_DATA_TYPE_UBIGINT
:
return
order
==
TSDB_ORDER_ASC
?
compareUint64Val
:
compareUint64ValDesc
;
default:
return
order
==
TSDB_ORDER_ASC
?
compareInt32Val
:
compareInt32ValDesc
;
}
}
int32_t
blockDataSort
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
)
{
ASSERT
(
pDataBlock
!=
NULL
&&
pOrderInfo
!=
NULL
);
if
(
pDataBlock
->
info
.
rows
<=
1
)
{
...
...
@@ -922,11 +867,11 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
int64_t
p0
=
taosGetTimestampUs
();
__compar_fn_t
fn
=
get
ComparFn
(
pColInfoData
->
info
.
type
,
pOrder
->
order
);
__compar_fn_t
fn
=
get
KeyComparFunc
(
pColInfoData
->
info
.
type
,
pOrder
->
order
);
qsort
(
pColInfoData
->
pData
,
pDataBlock
->
info
.
rows
,
pColInfoData
->
info
.
bytes
,
fn
);
int64_t
p1
=
taosGetTimestampUs
();
printf
(
"sor
t:%"
PRId64
", rows:%d
\n
"
,
p1
-
p0
,
pDataBlock
->
info
.
rows
);
uDebug
(
"blockDataSort easy cos
t:%"
PRId64
", rows:%d
\n
"
,
p1
-
p0
,
pDataBlock
->
info
.
rows
);
return
TSDB_CODE_SUCCESS
;
}
else
{
// var data type
...
...
@@ -955,24 +900,21 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
SColumnInfoData
*
pCols
=
createHelpColInfoData
(
pDataBlock
);
if
(
pCols
==
NULL
)
{
destroyTupleIndex
(
index
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
terrno
;
}
int64_t
p2
=
taosGetTimestampUs
();
int32_t
code
=
blockDataAssign
(
pCols
,
pDataBlock
,
index
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
terrno
=
code
;
return
code
;
}
blockDataAssign
(
pCols
,
pDataBlock
,
index
);
int64_t
p3
=
taosGetTimestampUs
();
copyBackToBlock
(
pDataBlock
,
pCols
);
int64_t
p4
=
taosGetTimestampUs
();
printf
(
"
sort:%"
PRId64
", create:%"
PRId64
", assign:%"
PRId64
", copyback:%"
PRId64
", rows:%d
\n
"
,
p1
-
p0
,
p2
-
p1
,
uDebug
(
"blockDataSort complex
sort:%"
PRId64
", create:%"
PRId64
", assign:%"
PRId64
", copyback:%"
PRId64
", rows:%d
\n
"
,
p1
-
p0
,
p2
-
p1
,
p3
-
p2
,
p4
-
p3
,
rows
);
destroyTupleIndex
(
index
);
...
...
@@ -1127,15 +1069,9 @@ int32_t blockDataSort_rv(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullF
void
blockDataCleanup
(
SSDataBlock
*
pDataBlock
)
{
pDataBlock
->
info
.
rows
=
0
;
if
(
pDataBlock
->
info
.
hasVarCol
)
{
for
(
int32_t
i
=
0
;
i
<
pDataBlock
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
p
->
info
.
type
))
{
p
->
varmeta
.
length
=
0
;
}
}
for
(
int32_t
i
=
0
;
i
<
pDataBlock
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
colInfoDataCleanup
(
p
,
pDataBlock
->
info
.
capacity
);
}
}
...
...
@@ -1176,8 +1112,21 @@ int32_t colInfoDataEnsureCapacity(SColumnInfoData* pColumn, uint32_t numOfRows)
return
TSDB_CODE_SUCCESS
;
}
void
colInfoDataCleanup
(
SColumnInfoData
*
pColumn
,
uint32_t
numOfRows
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumn
->
info
.
type
))
{
pColumn
->
varmeta
.
length
=
0
;
}
else
{
memset
(
pColumn
->
nullbitmap
,
0
,
BitmapLen
(
numOfRows
));
}
}
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
)
{
int32_t
code
=
0
;
if
(
numOfRows
==
0
)
{
return
TSDB_CODE_SUCCESS
;
}
pDataBlock
->
info
.
capacity
=
numOfRows
;
for
(
int32_t
i
=
0
;
i
<
pDataBlock
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
...
...
@@ -1201,6 +1150,9 @@ void* blockDataDestroy(SSDataBlock* pBlock) {
}
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
)
{
if
(
pDataBlock
==
NULL
){
return
NULL
;
}
int32_t
numOfCols
=
pDataBlock
->
info
.
numOfCols
;
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
...
...
@@ -1220,7 +1172,7 @@ SSDataBlock* createOneDataBlock(const SSDataBlock* pDataBlock) {
}
size_t
blockDataGetCapacityInRow
(
const
SSDataBlock
*
pBlock
,
size_t
pageSize
)
{
return
pageSize
/
(
blockDataGetSerialRowSize
(
pBlock
)
+
blockDataGetSerialMeta
Size
(
pBlock
));
return
(
int32_t
)
((
pageSize
-
blockDataGetSerialMetaSize
(
pBlock
))
/
blockDataGetSerialRow
Size
(
pBlock
));
}
void
colDataDestroy
(
SColumnInfoData
*
pColData
)
{
...
...
source/common/src/tdataformat.c
浏览文件 @
3d6030a4
...
...
@@ -266,6 +266,8 @@ void dataColInit(SDataCol *pDataCol, STColumn *pCol, int maxPoints) {
pDataCol
->
len
=
0
;
}
#if 0
// value from timestamp should be TKEY here instead of TSKEY
int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints) {
ASSERT(pCol != NULL && value != NULL);
...
...
@@ -297,7 +299,7 @@ int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPo
}
return 0;
}
#endif
static
FORCE_INLINE
const
void
*
tdGetColDataOfRowUnsafe
(
SDataCol
*
pCol
,
int
row
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
return
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
dataOff
[
row
]);
...
...
@@ -314,6 +316,7 @@ bool isNEleNull(SDataCol *pCol, int nEle) {
return
true
;
}
#if 0
static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index) {
if (IS_VAR_DATA_TYPE(pCol->type)) {
pCol->dataOff[index] = pCol->len;
...
...
@@ -326,7 +329,7 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index) {
}
}
static
void
dataColSetNEleNull
(
SDataCol
*
pCol
,
int
nEle
)
{
static void dataColSetNEleNull(SDataCol *pCol, int nEle
, int8_t bitmapMode
) {
if (IS_VAR_DATA_TYPE(pCol->type)) {
pCol->len = 0;
for (int i = 0; i < nEle; ++i) {
...
...
@@ -337,7 +340,7 @@ static void dataColSetNEleNull(SDataCol *pCol, int nEle) {
pCol->len = TYPE_BYTES[pCol->type] * nEle;
}
}
#endif
void
*
dataColSetOffset
(
SDataCol
*
pCol
,
int
nEle
)
{
ASSERT
(((
pCol
->
type
==
TSDB_DATA_TYPE_BINARY
)
||
(
pCol
->
type
==
TSDB_DATA_TYPE_NCHAR
)));
...
...
@@ -364,6 +367,7 @@ SDataCols *tdNewDataCols(int maxCols, int maxRows) {
pCols
->
maxCols
=
maxCols
;
pCols
->
numOfRows
=
0
;
pCols
->
numOfCols
=
0
;
// pCols->bitmapMode = 0; // calloc already set 0
if
(
maxCols
>
0
)
{
pCols
->
cols
=
(
SDataCol
*
)
taosMemoryCalloc
(
maxCols
,
sizeof
(
SDataCol
));
...
...
@@ -472,6 +476,7 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
void
tdResetDataCols
(
SDataCols
*
pCols
)
{
if
(
pCols
!=
NULL
)
{
pCols
->
numOfRows
=
0
;
pCols
->
bitmapMode
=
0
;
for
(
int
i
=
0
;
i
<
pCols
->
maxCols
;
++
i
)
{
dataColReset
(
pCols
->
cols
+
i
);
}
...
...
source/common/src/tglobal.c
浏览文件 @
3d6030a4
...
...
@@ -394,7 +394,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"numOfMnodeReadThreads"
,
tsNumOfMnodeReadThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfVnodeQueryThreads
=
tsNumOfCores
/
2
;
tsNumOfVnodeQueryThreads
=
TM
IN
(
tsNumOfVnodeQueryThreads
,
1
);
tsNumOfVnodeQueryThreads
=
TM
AX
(
tsNumOfVnodeQueryThreads
,
1
);
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeQueryThreads"
,
tsNumOfVnodeQueryThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfVnodeFetchThreads
=
tsNumOfCores
/
2
;
...
...
@@ -402,11 +402,11 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeFetchThreads"
,
tsNumOfVnodeFetchThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfVnodeWriteThreads
=
tsNumOfCores
;
tsNumOfVnodeWriteThreads
=
TM
IN
(
tsNumOfVnodeWriteThreads
,
1
);
tsNumOfVnodeWriteThreads
=
TM
AX
(
tsNumOfVnodeWriteThreads
,
1
);
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeWriteThreads"
,
tsNumOfVnodeWriteThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfVnodeSyncThreads
=
tsNumOfCores
/
2
;
tsNumOfVnodeSyncThreads
=
TM
IN
(
tsNumOfVnodeSyncThreads
,
1
);
tsNumOfVnodeSyncThreads
=
TM
AX
(
tsNumOfVnodeSyncThreads
,
1
);
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeSyncThreads"
,
tsNumOfVnodeSyncThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfVnodeMergeThreads
=
tsNumOfCores
/
8
;
...
...
@@ -414,7 +414,7 @@ static int32_t taosAddServerCfg(SConfig *pCfg) {
if
(
cfgAddInt32
(
pCfg
,
"numOfVnodeMergeThreads"
,
tsNumOfVnodeMergeThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfQnodeQueryThreads
=
tsNumOfCores
/
2
;
tsNumOfQnodeQueryThreads
=
TM
IN
(
tsNumOfQnodeQueryThreads
,
1
);
tsNumOfQnodeQueryThreads
=
TM
AX
(
tsNumOfQnodeQueryThreads
,
1
);
if
(
cfgAddInt32
(
pCfg
,
"numOfQnodeQueryThreads"
,
tsNumOfQnodeQueryThreads
,
1
,
1024
,
0
)
!=
0
)
return
-
1
;
tsNumOfQnodeFetchThreads
=
tsNumOfCores
/
2
;
...
...
source/common/src/tmsg.c
浏览文件 @
3d6030a4
...
...
@@ -1254,7 +1254,7 @@ int32_t tDeserializeSGetUserAuthRsp(void *buf, int32_t bufLen, SGetUserAuthRsp *
return
0
;
}
int32_t
tSerializeS
MCreateDrop
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tSerializeS
CreateDropM
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
...
@@ -1267,7 +1267,7 @@ int32_t tSerializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQnod
return
tlen
;
}
int32_t
tDeserializeS
MCreateDrop
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
int32_t
tDeserializeS
CreateDropM
QSBNodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateQnodeReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
...
...
@@ -1308,14 +1308,6 @@ int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq
return
0
;
}
int32_t
tSerializeSMCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateMnodeReq
*
pReq
)
{
return
tSerializeSMCreateDropQSBNodeReq
(
buf
,
bufLen
,
(
SMCreateQnodeReq
*
)
pReq
);
}
int32_t
tDeserializeSMCreateDropMnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCreateMnodeReq
*
pReq
)
{
return
tDeserializeSMCreateDropQSBNodeReq
(
buf
,
bufLen
,
(
SMCreateQnodeReq
*
)
pReq
);
}
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
...
@@ -2084,6 +2076,64 @@ int32_t tDeserializeSDbCfgRsp(void* buf, int32_t bufLen, SDbCfgRsp* pRsp) {
return
0
;
}
int32_t
tSerializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSUserIndexReq
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
indexFName
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SUserIndexRsp
*
pRsp
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
tblFName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
colName
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
indexType
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
indexExts
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSUserIndexRsp
(
void
*
buf
,
int32_t
bufLen
,
SUserIndexRsp
*
pRsp
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
dbFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
tblFName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
colName
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
indexType
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
indexExts
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSShowReq
(
void
*
buf
,
int32_t
bufLen
,
SShowReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
...
...
@@ -2696,6 +2746,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
int32_t
tFreeSCreateVnodeReq
(
SCreateVnodeReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pRetensions
);
pReq
->
pRetensions
=
NULL
;
return
0
;
}
int32_t
tSerializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
)
{
...
...
source/common/src/trow.c
浏览文件 @
3d6030a4
...
...
@@ -22,11 +22,224 @@ const uint8_t tdVTypeByte[3] = {
TD_VTYPE_NULL_BYTE
,
// TD_VTYPE_NULL
};
// declaration
static
uint8_t
tdGetBitmapByte
(
uint8_t
byte
);
// implementation
/**
* @brief Compress bitmap bytes comprised of 2-bits to counterpart of 1-bit.
* e.g.
* TD_VTYPE_NORM 0x00U(00000000) to 00000000 Normal
* TD_VTYPE_NULL 0x01U(00000001) to 00000001 Null
* TD_VTYPE_NONE 0x02U(00000010) to 00000001 Null
*
* 00000000 0x00 0x00
* 01000000 0x40 0x08
* 10000000 0x80 0x08
* ...
* @param byte
* @return uint8_t
*/
static
uint8_t
tdGetMergedBitmapByte
(
uint8_t
byte
)
{
switch
(
byte
)
{
case
0x00
:
return
0x00
;
case
0x40
:
return
0x08
;
case
0x80
:
return
0x08
;
case
0x10
:
return
0x04
;
case
0x50
:
return
0x0c
;
case
0x90
:
return
0x0c
;
case
0x20
:
return
0x04
;
case
0x60
:
return
0x0c
;
case
0xa0
:
return
0x0c
;
case
0x04
:
return
0x02
;
case
0x44
:
return
0x0a
;
case
0x84
:
return
0x0a
;
case
0x14
:
return
0x06
;
case
0x54
:
return
0x0e
;
case
0x94
:
return
0x0e
;
case
0x24
:
return
0x06
;
case
0x64
:
return
0x0e
;
case
0xa4
:
return
0x0e
;
case
0x08
:
return
0x02
;
case
0x48
:
return
0x0a
;
case
0x88
:
return
0x0a
;
case
0x18
:
return
0x06
;
case
0x58
:
return
0x0e
;
case
0x98
:
return
0x0e
;
case
0x28
:
return
0x06
;
case
0x68
:
return
0x0e
;
case
0xa8
:
return
0x0e
;
case
0x01
:
return
0x01
;
case
0x41
:
return
0x09
;
case
0x81
:
return
0x09
;
case
0x11
:
return
0x05
;
case
0x51
:
return
0x0d
;
case
0x91
:
return
0x0d
;
case
0x21
:
return
0x05
;
case
0x61
:
return
0x0d
;
case
0xa1
:
return
0x0d
;
case
0x05
:
return
0x03
;
case
0x45
:
return
0x0b
;
case
0x85
:
return
0x0b
;
case
0x15
:
return
0x07
;
case
0x55
:
return
0x0f
;
case
0x95
:
return
0x0f
;
case
0x25
:
return
0x07
;
case
0x65
:
return
0x0f
;
case
0xa5
:
return
0x0f
;
case
0x09
:
return
0x03
;
case
0x49
:
return
0x0b
;
case
0x89
:
return
0x0b
;
case
0x19
:
return
0x07
;
case
0x59
:
return
0x0f
;
case
0x99
:
return
0x0f
;
case
0x29
:
return
0x07
;
case
0x69
:
return
0x0f
;
case
0xa9
:
return
0x0f
;
case
0x02
:
return
0x01
;
case
0x42
:
return
0x09
;
case
0x82
:
return
0x09
;
case
0x12
:
return
0x05
;
case
0x52
:
return
0x0d
;
case
0x92
:
return
0x0d
;
case
0x22
:
return
0x05
;
case
0x62
:
return
0x0d
;
case
0xa2
:
return
0x0d
;
case
0x06
:
return
0x03
;
case
0x46
:
return
0x0b
;
case
0x86
:
return
0x0b
;
case
0x16
:
return
0x07
;
case
0x56
:
return
0x0f
;
case
0x96
:
return
0x0f
;
case
0x26
:
return
0x07
;
case
0x66
:
return
0x0f
;
case
0xa6
:
return
0x0f
;
case
0x0a
:
return
0x03
;
case
0x4a
:
return
0x0b
;
case
0x8a
:
return
0x0b
;
case
0x1a
:
return
0x07
;
case
0x5a
:
return
0x0f
;
case
0x9a
:
return
0x0f
;
case
0x2a
:
return
0x07
;
case
0x6a
:
return
0x0f
;
case
0xaa
:
return
0x0f
;
default:
// make sure the bitmap area is set to 0 firstly
ASSERT
(
0
);
return
0x0f
;
// return NULL bitmap for exception
}
}
/**
* @brief Merge bitmap from 2 bits to 1 bits, and the memory buffer should be guaranteed by the invoker.
*
* @param srcBitmap
* @param srcLen
* @param dstBitmap
*/
void
tdMergeBitmap
(
uint8_t
*
srcBitmap
,
int32_t
srcLen
,
uint8_t
*
dstBitmap
)
{
int32_t
i
=
0
,
j
=
0
;
if
(
srcLen
>
0
)
{
dstBitmap
[
j
]
=
(
tdGetMergedBitmapByte
(
srcBitmap
[
i
])
<<
4
);
}
while
((
++
i
)
<
srcLen
)
{
if
((
i
&
1
)
==
0
)
{
dstBitmap
[
j
]
=
(
tdGetMergedBitmapByte
(
srcBitmap
[
i
])
<<
4
);
}
else
{
dstBitmap
[
j
]
|=
tdGetMergedBitmapByte
(
srcBitmap
[
i
]);
++
j
;
}
}
}
// static void dataColSetNEleNull(SDataCol *pCol, int nEle);
static
void
tdMergeTwoDataCols
(
SDataCols
*
target
,
SDataCols
*
src1
,
int
*
iter1
,
int
limit1
,
SDataCols
*
src2
,
int
*
iter2
,
int
limit2
,
int
tRows
,
bool
forceSetNull
);
static
FORCE_INLINE
void
dataColSetNullAt
(
SDataCol
*
pCol
,
int
index
,
bool
setBitmap
)
{
static
FORCE_INLINE
void
dataColSetNullAt
(
SDataCol
*
pCol
,
int
index
,
bool
setBitmap
,
int8_t
bitmapMode
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
pCol
->
dataOff
[
index
]
=
pCol
->
len
;
char
*
ptr
=
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
len
);
...
...
@@ -37,7 +250,7 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBit
pCol
->
len
+=
TYPE_BYTES
[
pCol
->
type
];
}
if
(
setBitmap
)
{
tdSetBitmapValType
(
pCol
->
pBitmap
,
index
,
TD_VTYPE_NONE
);
tdSetBitmapValType
(
pCol
->
pBitmap
,
index
,
TD_VTYPE_NONE
,
bitmapMode
);
}
}
...
...
@@ -53,7 +266,7 @@ static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index, bool setBit
// }
// }
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
)
{
int32_t
tdSetBitmapValTypeN
(
void
*
pBitmap
,
int16_t
nEle
,
TDRowValT
valType
,
int8_t
bitmapMode
)
{
TASSERT
(
valType
<
TD_VTYPE_MAX
);
int16_t
nBytes
=
nEle
/
TD_VTYPE_PARTS
;
for
(
int
i
=
0
;
i
<
nBytes
;
++
i
)
{
...
...
@@ -63,12 +276,12 @@ int32_t tdSetBitmapValTypeN(void *pBitmap, int16_t nEle, TDRowValT valType) {
int16_t
nLeft
=
nEle
-
nBytes
*
TD_VTYPE_BITS
;
for
(
int
j
=
0
;
j
<
nLeft
;
++
j
)
{
tdSetBitmapValType
(
pBitmap
,
j
,
valType
);
tdSetBitmapValType
(
pBitmap
,
j
,
valType
,
bitmapMode
);
}
return
TSDB_CODE_SUCCESS
;
}
static
FORCE_INLINE
void
dataColSetNoneAt
(
SDataCol
*
pCol
,
int
index
,
bool
setBitmap
)
{
static
FORCE_INLINE
void
dataColSetNoneAt
(
SDataCol
*
pCol
,
int
index
,
bool
setBitmap
,
int8_t
bitmapMode
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
pCol
->
dataOff
[
index
]
=
pCol
->
len
;
char
*
ptr
=
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
len
);
...
...
@@ -79,22 +292,22 @@ static FORCE_INLINE void dataColSetNoneAt(SDataCol *pCol, int index, bool setBit
pCol
->
len
+=
TYPE_BYTES
[
pCol
->
type
];
}
if
(
setBitmap
)
{
tdSetBitmapValType
(
pCol
->
pBitmap
,
index
,
TD_VTYPE_NONE
);
tdSetBitmapValType
(
pCol
->
pBitmap
,
index
,
TD_VTYPE_NONE
,
bitmapMode
);
}
}
static
void
dataColSetNEleNone
(
SDataCol
*
pCol
,
int
nEle
)
{
static
void
dataColSetNEleNone
(
SDataCol
*
pCol
,
int
nEle
,
int8_t
bitmapMode
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
pCol
->
len
=
0
;
for
(
int
i
=
0
;
i
<
nEle
;
++
i
)
{
dataColSetNoneAt
(
pCol
,
i
,
false
);
dataColSetNoneAt
(
pCol
,
i
,
false
,
bitmapMode
);
}
}
else
{
setNullN
(
pCol
->
pData
,
pCol
->
type
,
pCol
->
bytes
,
nEle
);
pCol
->
len
=
TYPE_BYTES
[
pCol
->
type
]
*
nEle
;
}
#ifdef TD_SUPPORT_BITMAP
tdSetBitmapValTypeN
(
pCol
->
pBitmap
,
nEle
,
TD_VTYPE_NONE
);
tdSetBitmapValTypeN
(
pCol
->
pBitmap
,
nEle
,
TD_VTYPE_NONE
,
bitmapMode
);
#endif
}
...
...
@@ -126,7 +339,18 @@ STSRow *tdRowDup(STSRow *row) {
return
trow
;
}
int
tdAppendValToDataCol
(
SDataCol
*
pCol
,
TDRowValT
valType
,
const
void
*
val
,
int
numOfRows
,
int
maxPoints
)
{
/**
* @brief
*
* @param pCol
* @param valType
* @param val
* @param numOfRows
* @param maxPoints
* @param bitmapMode default is 0(2 bits), otherwise 1(1 bit)
* @return int
*/
int
tdAppendValToDataCol
(
SDataCol
*
pCol
,
TDRowValT
valType
,
const
void
*
val
,
int
numOfRows
,
int
maxPoints
,
int8_t
bitmapMode
)
{
TASSERT
(
pCol
!=
NULL
);
// Assume that the columns not specified during insert/upsert mean None.
...
...
@@ -139,7 +363,7 @@ int tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int
if
(
tdAllocMemForCol
(
pCol
,
maxPoints
)
<
0
)
return
-
1
;
if
(
numOfRows
>
0
)
{
// Find the first not None value, fill all previous values as None
dataColSetNEleNone
(
pCol
,
numOfRows
);
dataColSetNEleNone
(
pCol
,
numOfRows
,
bitmapMode
);
}
}
if
(
!
tdValTypeIsNorm
(
valType
))
{
...
...
@@ -161,7 +385,8 @@ int tdAppendValToDataCol(SDataCol *pCol, TDRowValT valType, const void *val, int
pCol
->
len
+=
pCol
->
bytes
;
}
#ifdef TD_SUPPORT_BITMAP
tdSetBitmapValType
(
pCol
->
pBitmap
,
numOfRows
,
valType
);
tdSetBitmapValType
(
pCol
->
pBitmap
,
numOfRows
,
valType
,
bitmapMode
);
#endif
return
0
;
}
...
...
@@ -175,14 +400,13 @@ static int32_t tdAppendTpRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
void
*
pBitmap
=
tdGetBitmapAddrTp
(
pRow
,
pSchema
->
flen
);
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
0
]);
if
(
pDataCol
->
colId
==
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NORM
,
&
pRow
->
ts
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
}
ASSERT
(
pDataCol
->
colId
==
PRIMARYKEY_TIMESTAMP_COL_ID
);
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NORM
,
&
pRow
->
ts
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
while
(
dcol
<
pCols
->
numOfCols
)
{
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
schemaNCols
(
pSchema
))
{
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
++
dcol
;
continue
;
}
...
...
@@ -193,13 +417,13 @@ static int32_t tdAppendTpRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
if
(
tdGetTpRowValOfCol
(
&
sVal
,
pRow
,
pBitmap
,
pRowCol
->
type
,
pRowCol
->
offset
-
sizeof
(
TSKEY
),
rcol
-
1
)
<
0
)
{
return
terrno
;
}
tdAppendValToDataCol
(
pDataCol
,
sVal
.
valType
,
sVal
.
val
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
tdAppendValToDataCol
(
pDataCol
,
sVal
.
valType
,
sVal
.
val
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
++
dcol
;
++
rcol
;
}
else
if
(
pRowCol
->
colId
<
pDataCol
->
colId
)
{
++
rcol
;
}
else
{
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
++
dcol
;
}
}
...
...
@@ -218,14 +442,13 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
void
*
pBitmap
=
tdGetBitmapAddrKv
(
pRow
,
tdRowGetNCols
(
pRow
));
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
0
]);
if
(
pDataCol
->
colId
==
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NORM
,
&
pRow
->
ts
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
}
ASSERT
(
pDataCol
->
colId
==
PRIMARYKEY_TIMESTAMP_COL_ID
);
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NORM
,
&
pRow
->
ts
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
while
(
dcol
<
pCols
->
numOfCols
)
{
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
tRowCols
||
rcol
>=
tSchemaCols
)
{
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
++
dcol
;
continue
;
}
...
...
@@ -240,13 +463,13 @@ static int32_t tdAppendKvRowToDataCol(STSRow *pRow, STSchema *pSchema, SDataCols
if
(
tdGetKvRowValOfCol
(
&
sVal
,
pRow
,
pBitmap
,
pIdx
->
offset
,
colIdx
)
<
0
)
{
return
terrno
;
}
tdAppendValToDataCol
(
pDataCol
,
sVal
.
valType
,
sVal
.
val
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
tdAppendValToDataCol
(
pDataCol
,
sVal
.
valType
,
sVal
.
val
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
++
dcol
;
++
rcol
;
}
else
if
(
pIdx
->
colId
<
pDataCol
->
colId
)
{
++
rcol
;
}
else
{
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
tdAppendValToDataCol
(
pDataCol
,
TD_VTYPE_NULL
,
NULL
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
pCols
->
bitmapMode
);
++
dcol
;
}
}
...
...
@@ -291,10 +514,10 @@ int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge, int *
for
(
int
j
=
0
;
j
<
source
->
numOfCols
;
j
++
)
{
if
(
source
->
cols
[
j
].
len
>
0
||
target
->
cols
[
j
].
len
>
0
)
{
SCellVal
sVal
=
{
0
};
if
(
tdGetColDataOfRow
(
&
sVal
,
source
->
cols
+
j
,
i
+
(
*
pOffset
))
<
0
)
{
if
(
tdGetColDataOfRow
(
&
sVal
,
source
->
cols
+
j
,
i
+
(
*
pOffset
)
,
source
->
bitmapMode
)
<
0
)
{
TASSERT
(
0
);
}
tdAppendValToDataCol
(
target
->
cols
+
j
,
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
);
tdAppendValToDataCol
(
target
->
cols
+
j
,
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
,
target
->
bitmapMode
);
}
}
++
target
->
numOfRows
;
...
...
@@ -338,10 +561,10 @@ static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, i
ASSERT
(
target
->
cols
[
i
].
type
==
src1
->
cols
[
i
].
type
);
if
(
src1
->
cols
[
i
].
len
>
0
||
target
->
cols
[
i
].
len
>
0
)
{
SCellVal
sVal
=
{
0
};
if
(
tdGetColDataOfRow
(
&
sVal
,
src1
->
cols
+
i
,
*
iter1
)
<
0
)
{
if
(
tdGetColDataOfRow
(
&
sVal
,
src1
->
cols
+
i
,
*
iter1
,
src1
->
bitmapMode
)
<
0
)
{
TASSERT
(
0
);
}
tdAppendValToDataCol
(
&
(
target
->
cols
[
i
]),
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
);
tdAppendValToDataCol
(
&
(
target
->
cols
[
i
]),
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
,
target
->
bitmapMode
);
}
}
...
...
@@ -353,18 +576,18 @@ static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, i
for
(
int
i
=
0
;
i
<
src2
->
numOfCols
;
i
++
)
{
SCellVal
sVal
=
{
0
};
ASSERT
(
target
->
cols
[
i
].
type
==
src2
->
cols
[
i
].
type
);
if
(
tdGetColDataOfRow
(
&
sVal
,
src2
->
cols
+
i
,
*
iter2
)
<
0
)
{
if
(
tdGetColDataOfRow
(
&
sVal
,
src2
->
cols
+
i
,
*
iter2
,
src2
->
bitmapMode
)
<
0
)
{
TASSERT
(
0
);
}
if
(
src2
->
cols
[
i
].
len
>
0
&&
!
tdValTypeIsNull
(
sVal
.
valType
))
{
tdAppendValToDataCol
(
&
(
target
->
cols
[
i
]),
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
);
tdAppendValToDataCol
(
&
(
target
->
cols
[
i
]),
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
,
target
->
bitmapMode
);
}
else
if
(
!
forceSetNull
&&
key1
==
key2
&&
src1
->
cols
[
i
].
len
>
0
)
{
if
(
tdGetColDataOfRow
(
&
sVal
,
src1
->
cols
+
i
,
*
iter1
)
<
0
)
{
if
(
tdGetColDataOfRow
(
&
sVal
,
src1
->
cols
+
i
,
*
iter1
,
src1
->
bitmapMode
)
<
0
)
{
TASSERT
(
0
);
}
tdAppendValToDataCol
(
&
(
target
->
cols
[
i
]),
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
);
tdAppendValToDataCol
(
&
(
target
->
cols
[
i
]),
sVal
.
valType
,
sVal
.
val
,
target
->
numOfRows
,
target
->
maxPoints
,
target
->
bitmapMode
);
}
else
if
(
target
->
cols
[
i
].
len
>
0
)
{
dataColSetNullAt
(
&
target
->
cols
[
i
],
target
->
numOfRows
,
true
);
dataColSetNullAt
(
&
target
->
cols
[
i
],
target
->
numOfRows
,
true
,
target
->
bitmapMode
);
}
}
target
->
numOfRows
++
;
...
...
@@ -480,6 +703,7 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
if
(
pRet
==
NULL
)
return
NULL
;
pRet
->
numOfCols
=
pDataCols
->
numOfCols
;
pRet
->
bitmapMode
=
pDataCols
->
bitmapMode
;
pRet
->
sversion
=
pDataCols
->
sversion
;
if
(
keepData
)
pRet
->
numOfRows
=
pDataCols
->
numOfRows
;
...
...
source/dnode/mgmt/bm/bmHandle.c
浏览文件 @
3d6030a4
...
...
@@ -16,18 +16,45 @@
#define _DEFAULT_SOURCE
#include "bmInt.h"
void
bmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonBmInfo
*
bmInfo
)
{}
int32_t
bmProcessGetMonBmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonBmInfo
bmInfo
=
{
0
};
bmGetMonitorInfo
(
pWrapper
,
&
bmInfo
);
dmGetMonitorSysInfo
(
&
bmInfo
.
sys
);
monGetLogs
(
&
bmInfo
.
log
);
int32_t
rspLen
=
tSerializeSMonBmInfo
(
NULL
,
0
,
&
bmInfo
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonBmInfo
(
pRsp
,
rspLen
,
&
bmInfo
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
tFreeSMonBmInfo
(
&
bmInfo
);
return
0
;
}
int32_t
bmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateBnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create bnode since %s, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
pDnode
->
dnodeId
);
return
-
1
;
}
else
{
...
...
@@ -40,13 +67,13 @@ int32_t bmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropBnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop bnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -54,4 +81,6 @@ int32_t bmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
}
void
bmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{}
void
bmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
dndSetMsgHandle
(
pWrapper
,
TDMT_MON_BM_INFO
,
bmProcessMonitorMsg
,
DEFAULT_HANDLE
);
}
source/dnode/mgmt/bm/bmWorker.c
浏览文件 @
3d6030a4
...
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "bmInt.h"
static
void
bmSendErrorRsp
(
S
MgmtWrapper
*
pWrapper
,
S
NodeMsg
*
pMsg
,
int32_t
code
)
{
static
void
bmSendErrorRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
};
tmsgSendRsp
(
&
rpcRsp
);
...
...
@@ -25,30 +25,65 @@ static void bmSendErrorRsp(SMgmtWrapper *pWrapper, SNodeMsg *pMsg, int32_t code)
taosFreeQitem
(
pMsg
);
}
static
void
bmSendErrorRsps
(
S
MgmtWrapper
*
pWrapper
,
S
TaosQall
*
qall
,
int32_t
numOfMsgs
,
int32_t
code
)
{
static
void
bmSendErrorRsps
(
STaosQall
*
qall
,
int32_t
numOfMsgs
,
int32_t
code
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SNodeMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
bmSendErrorRsp
(
pWrapper
,
pMsg
,
code
);
if
(
pMsg
!=
NULL
)
{
bmSendErrorRsp
(
pMsg
,
code
);
}
}
}
static
void
bmProcessQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
SMgmtWrapper
*
pWrapper
=
pMgmt
->
pWrapper
;
static
inline
void
bmSendRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
.
pCont
=
pMsg
->
pRsp
,
.
contLen
=
pMsg
->
rspLen
};
tmsgSendRsp
(
&
rsp
);
}
static
void
bmProcessMonitorQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, get from bnode-monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_BM_INFO
)
{
code
=
bmProcessGetMonBmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
bmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
rpcFreeCont
(
pRpc
->
pCont
);
taosFreeQitem
(
pMsg
);
}
static
void
bmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SBnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SNodeMsg
*
));
if
(
pArray
==
NULL
)
{
bmSendErrorRsps
(
pWrapper
,
qall
,
numOfMsgs
,
TSDB_CODE_OUT_OF_MEMORY
);
bmSendErrorRsps
(
qall
,
numOfMsgs
,
TSDB_CODE_OUT_OF_MEMORY
);
return
;
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SNodeMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"msg:%p, will be processed in bnode queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
bmSendErrorRsp
(
pWrapper
,
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
if
(
pMsg
!=
NULL
)
{
dTrace
(
"msg:%p, get from bnode-write queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
bmSendErrorRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
}
}
}
...
...
@@ -56,9 +91,11 @@ static void bmProcessQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs
for
(
size_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SNodeMsg
*
pMsg
=
*
(
SNodeMsg
**
)
taosArrayGet
(
pArray
,
i
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
taosFreeQitem
(
pMsg
);
if
(
pMsg
!=
NULL
)
{
dTrace
(
"msg:%p, is freed"
,
pMsg
);
rpcFreeCont
(
pMsg
->
rpcMsg
.
pCont
);
taosFreeQitem
(
pMsg
);
}
}
taosArrayDestroy
(
pArray
);
}
...
...
@@ -72,18 +109,37 @@ int32_t bmProcessWriteMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
}
int32_t
bmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SBnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
int32_t
bmStartWorker
(
SBnodeMgmt
*
pMgmt
)
{
SMultiWorkerCfg
cfg
=
{.
max
=
1
,
.
name
=
"bnode-write"
,
.
fp
=
(
FItems
)
bmProcessQueue
,
.
param
=
pMgmt
};
SMultiWorkerCfg
cfg
=
{.
max
=
1
,
.
name
=
"bnode-write"
,
.
fp
=
(
FItems
)
bmProcess
Write
Queue
,
.
param
=
pMgmt
};
if
(
tMultiWorkerInit
(
&
pMgmt
->
writeWorker
,
&
cfg
)
!=
0
)
{
dError
(
"failed to start bnode
write worker since %s"
,
terrstr
());
dError
(
"failed to start bnode
-
write worker since %s"
,
terrstr
());
return
-
1
;
}
if
(
tsMultiProcess
)
{
SSingleWorkerCfg
mCfg
=
{
.
min
=
1
,
.
max
=
1
,
.
name
=
"bnode-monitor"
,
.
fp
=
(
FItem
)
bmProcessMonitorQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start bnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
}
dDebug
(
"bnode workers are initialized"
);
return
0
;
}
void
bmStopWorker
(
SBnodeMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
monitorWorker
);
tMultiWorkerCleanup
(
&
pMgmt
->
writeWorker
);
dDebug
(
"bnode workers are closed"
);
}
source/dnode/mgmt/dm/dmFile.c
浏览文件 @
3d6030a4
...
...
@@ -21,7 +21,7 @@ static bool dmIsEpChanged(SDnodeMgmt *pMgmt, int32_t dnodeId, const char *ep);
static
void
dmResetDnodes
(
SDnodeMgmt
*
pMgmt
,
SArray
*
dnodeEps
);
int32_t
dmReadFile
(
SDnodeMgmt
*
pMgmt
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int32_t
len
=
0
;
int32_t
maxLen
=
256
*
1024
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
...
...
source/dnode/mgmt/dm/dmHandle.c
浏览文件 @
3d6030a4
...
...
@@ -42,8 +42,9 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
VNODES
);
if
(
pWrapper
!=
NULL
)
{
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
vmMonitorVnodeLoads
(
pWrapper
,
req
.
pVloads
);
SMonVloadInfo
info
=
{
0
};
dmGetVnodeLoads
(
pWrapper
,
&
info
);
req
.
pVloads
=
info
.
pVloads
;
dndReleaseWrapper
(
pWrapper
);
}
...
...
@@ -96,6 +97,7 @@ int32_t dmProcessStatusRsp(SDnodeMgmt *pMgmt, SNodeMsg *pMsg) {
}
pMgmt
->
statusSent
=
0
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
dmProcessAuthRsp
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
...
...
@@ -117,7 +119,6 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SNodeMsg *pMsg) {
return
TSDB_CODE_OPS_NOT_SUPPORT
;
}
static
int32_t
dmProcessCreateNodeMsg
(
SDnode
*
pDnode
,
EDndType
ntype
,
SNodeMsg
*
pMsg
)
{
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
ntype
);
if
(
pWrapper
!=
NULL
)
{
...
...
@@ -209,7 +210,7 @@ void dmInitMsgHandle(SMgmtWrapper *pWrapper) {
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_NETWORK_TEST
,
dmProcessMgmtMsg
,
DEFAULT_HANDLE
);
// Requests handled by MNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_STATUS_RSP
,
dmProcess
Status
Msg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_STATUS_RSP
,
dmProcess
Monitor
Msg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GRANT_RSP
,
dmProcessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_AUTH_RSP
,
dmProcessMgmtMsg
,
DEFAULT_HANDLE
);
}
source/dnode/mgmt/dm/dmMonitor.c
浏览文件 @
3d6030a4
...
...
@@ -14,21 +14,7 @@
*/
#define _DEFAULT_SOURCE
#include "dndInt.h"
static
int32_t
dmGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
pInfo
->
logdir
.
size
=
tsLogSpace
.
size
;
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
VNODES
);
if
(
pWrapper
!=
NULL
)
{
vmMonitorTfsInfo
(
pWrapper
,
pInfo
);
dndReleaseWrapper
(
pWrapper
);
}
return
0
;
}
#include "dmInt.h"
static
void
dmGetMonitorBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
pInfo
->
protocol
=
1
;
...
...
@@ -39,69 +25,171 @@ static void dmGetMonitorBasicInfo(SDnode *pDnode, SMonBasicInfo *pInfo) {
static
void
dmGetMonitorDnodeInfo
(
SDnode
*
pDnode
,
SMonDnodeInfo
*
pInfo
)
{
pInfo
->
uptime
=
(
taosGetTimestampMs
()
-
pDnode
->
rebootTime
)
/
(
86400000
.
0
f
);
taosGetCpuUsage
(
&
pInfo
->
cpu_engine
,
&
pInfo
->
cpu_system
);
taosGetCpuCores
(
&
pInfo
->
cpu_cores
);
taosGetProcMemory
(
&
pInfo
->
mem_engine
);
taosGetSysMemory
(
&
pInfo
->
mem_system
);
pInfo
->
mem_total
=
tsTotalMemoryKB
;
pInfo
->
disk_engine
=
0
;
pInfo
->
disk_used
=
tsDataSpace
.
size
.
used
;
pInfo
->
disk_total
=
tsDataSpace
.
size
.
total
;
taosGetCardInfo
(
&
pInfo
->
net_in
,
&
pInfo
->
net_out
);
taosGetProcIO
(
&
pInfo
->
io_read
,
&
pInfo
->
io_write
,
&
pInfo
->
io_read_disk
,
&
pInfo
->
io_write_disk
);
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
VNODES
);
if
(
pWrapper
!=
NULL
)
{
vmMonitorVnodeReqs
(
pWrapper
,
pInfo
);
dndReleaseWrapper
(
pWrapper
);
}
pWrapper
=
dndAcquireWrapper
(
pDnode
,
MNODE
);
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
MNODE
);
if
(
pWrapper
!=
NULL
)
{
pInfo
->
has_mnode
=
pWrapper
->
required
;
dndReleaseWrapper
(
pWrapper
);
}
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
pInfo
->
logdir
.
size
=
tsLogSpace
.
size
;
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
}
static
void
dmGetMonitorInfo
(
SDnode
*
pDnode
,
SMonDmInfo
*
pInfo
)
{
dmGetMonitorBasicInfo
(
pDnode
,
&
pInfo
->
basic
);
dmGetMonitorSysInfo
(
&
pInfo
->
sys
);
dmGetMonitorDnodeInfo
(
pDnode
,
&
pInfo
->
dnode
);
}
void
dmSendMonitorReport
(
SDnode
*
pDnode
)
{
if
(
!
tsEnableMonitor
||
tsMonitorFqdn
[
0
]
==
0
||
tsMonitorPort
==
0
)
return
;
dTrace
(
"send monitor report to %s:%u"
,
tsMonitorFqdn
,
tsMonitorPort
);
SMonInfo
*
pMonitor
=
monCreateMonitorInfo
();
if
(
pMonitor
==
NULL
)
return
;
SMonBasicInfo
basicInfo
=
{
0
};
dmGetMonitorBasicInfo
(
pDnode
,
&
basicInfo
);
monSetBasicInfo
(
pMonitor
,
&
basicInfo
);
SMonDmInfo
dmInfo
=
{
0
};
SMonMmInfo
mmInfo
=
{
0
};
SMonVmInfo
vmInfo
=
{
0
};
SMonQmInfo
qmInfo
=
{
0
};
SMonSmInfo
smInfo
=
{
0
};
SMonBmInfo
bmInfo
=
{
0
};
SRpcMsg
req
=
{
0
};
SRpcMsg
rsp
;
SEpSet
epset
=
{.
inUse
=
0
,
.
numOfEps
=
1
};
tstrncpy
(
epset
.
eps
[
0
].
fqdn
,
tsLocalFqdn
,
TSDB_FQDN_LEN
);
epset
.
eps
[
0
].
port
=
tsServerPort
;
SMgmtWrapper
*
pWrapper
=
NULL
;
dmGetMonitorInfo
(
pDnode
,
&
dmInfo
);
bool
getFromAPI
=
!
tsMultiProcess
;
pWrapper
=
&
pDnode
->
wrappers
[
MNODE
];
if
(
getFromAPI
)
{
if
(
dndMarkWrapper
(
pWrapper
)
!=
0
)
{
mmGetMonitorInfo
(
pWrapper
,
&
mmInfo
);
dndReleaseWrapper
(
pWrapper
);
}
}
else
{
if
(
pWrapper
->
required
)
{
req
.
msgType
=
TDMT_MON_MM_INFO
;
dndSendRecv
(
pDnode
,
&
epset
,
&
req
,
&
rsp
);
if
(
rsp
.
code
==
0
&&
rsp
.
contLen
>
0
)
{
tDeserializeSMonMmInfo
(
rsp
.
pCont
,
rsp
.
contLen
,
&
mmInfo
);
}
rpcFreeCont
(
rsp
.
pCont
);
}
}
SMonClusterInfo
clusterInfo
=
{
0
};
SMonVgroupInfo
vgroupInfo
=
{
0
};
SMonGrantInfo
grantInfo
=
{
0
};
pWrapper
=
&
pDnode
->
wrappers
[
VNODES
];
if
(
getFromAPI
)
{
if
(
dndMarkWrapper
(
pWrapper
)
!=
0
)
{
vmGetMonitorInfo
(
pWrapper
,
&
vmInfo
);
dndReleaseWrapper
(
pWrapper
);
}
}
else
{
if
(
pWrapper
->
required
)
{
req
.
msgType
=
TDMT_MON_VM_INFO
;
dndSendRecv
(
pDnode
,
&
epset
,
&
req
,
&
rsp
);
if
(
rsp
.
code
==
0
&&
rsp
.
contLen
>
0
)
{
tDeserializeSMonVmInfo
(
rsp
.
pCont
,
rsp
.
contLen
,
&
vmInfo
);
}
rpcFreeCont
(
rsp
.
pCont
);
}
}
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
MNODE
);
if
(
pWrapper
!=
NULL
)
{
if
(
mmMonitorMnodeInfo
(
pWrapper
,
&
clusterInfo
,
&
vgroupInfo
,
&
grantInfo
)
==
0
)
{
monSetClusterInfo
(
pMonitor
,
&
clusterInfo
);
monSetVgroupInfo
(
pMonitor
,
&
vgroupInfo
);
monSetGrantInfo
(
pMonitor
,
&
grantInfo
);
pWrapper
=
&
pDnode
->
wrappers
[
QNODE
];
if
(
getFromAPI
)
{
if
(
dndMarkWrapper
(
pWrapper
)
!=
0
)
{
qmGetMonitorInfo
(
pWrapper
,
&
qmInfo
);
dndReleaseWrapper
(
pWrapper
);
}
}
else
{
if
(
pWrapper
->
required
)
{
req
.
msgType
=
TDMT_MON_QM_INFO
;
dndSendRecv
(
pDnode
,
&
epset
,
&
req
,
&
rsp
);
if
(
rsp
.
code
==
0
&&
rsp
.
contLen
>
0
)
{
tDeserializeSMonQmInfo
(
rsp
.
pCont
,
rsp
.
contLen
,
&
qmInfo
);
}
rpcFreeCont
(
rsp
.
pCont
);
}
dndReleaseWrapper
(
pWrapper
);
}
SMonDnodeInfo
dnodeInfo
=
{
0
};
dmGetMonitorDnodeInfo
(
pDnode
,
&
dnodeInfo
);
monSetDnodeInfo
(
pMonitor
,
&
dnodeInfo
);
pWrapper
=
&
pDnode
->
wrappers
[
SNODE
];
if
(
getFromAPI
)
{
if
(
dndMarkWrapper
(
pWrapper
)
!=
0
)
{
smGetMonitorInfo
(
pWrapper
,
&
smInfo
);
dndReleaseWrapper
(
pWrapper
);
}
}
else
{
if
(
pWrapper
->
required
)
{
req
.
msgType
=
TDMT_MON_SM_INFO
;
dndSendRecv
(
pDnode
,
&
epset
,
&
req
,
&
rsp
);
if
(
rsp
.
code
==
0
&&
rsp
.
contLen
>
0
)
{
tDeserializeSMonSmInfo
(
rsp
.
pCont
,
rsp
.
contLen
,
&
smInfo
);
}
rpcFreeCont
(
rsp
.
pCont
);
}
}
SMonDiskInfo
diskInfo
=
{
0
};
if
(
dmGetMonitorDiskInfo
(
pDnode
,
&
diskInfo
)
==
0
)
{
monSetDiskInfo
(
pMonitor
,
&
diskInfo
);
pWrapper
=
&
pDnode
->
wrappers
[
BNODE
];
if
(
getFromAPI
)
{
if
(
dndMarkWrapper
(
pWrapper
)
!=
0
)
{
bmGetMonitorInfo
(
pWrapper
,
&
bmInfo
);
dndReleaseWrapper
(
pWrapper
);
}
}
else
{
if
(
pWrapper
->
required
)
{
req
.
msgType
=
TDMT_MON_BM_INFO
;
dndSendRecv
(
pDnode
,
&
epset
,
&
req
,
&
rsp
);
if
(
rsp
.
code
==
0
&&
rsp
.
contLen
>
0
)
{
tDeserializeSMonBmInfo
(
rsp
.
pCont
,
rsp
.
contLen
,
&
bmInfo
);
}
rpcFreeCont
(
rsp
.
pCont
);
}
}
taosArrayDestroy
(
clusterInfo
.
dnodes
);
taosArrayDestroy
(
clusterInfo
.
mnodes
);
taosArrayDestroy
(
vgroupInfo
.
vgroups
);
taosArrayDestroy
(
diskInfo
.
datadirs
);
monSetDmInfo
(
&
dmInfo
);
monSetMmInfo
(
&
mmInfo
);
monSetVmInfo
(
&
vmInfo
);
monSetQmInfo
(
&
qmInfo
);
monSetSmInfo
(
&
smInfo
);
monSetBmInfo
(
&
bmInfo
);
tFreeSMonMmInfo
(
&
mmInfo
);
tFreeSMonVmInfo
(
&
vmInfo
);
tFreeSMonQmInfo
(
&
qmInfo
);
tFreeSMonSmInfo
(
&
smInfo
);
tFreeSMonBmInfo
(
&
bmInfo
);
monSendReport
();
}
void
dmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
)
{
bool
getFromAPI
=
!
tsMultiProcess
;
if
(
getFromAPI
)
{
vmGetVnodeLoads
(
pWrapper
,
pInfo
);
}
else
{
SRpcMsg
req
=
{.
msgType
=
TDMT_MON_VM_LOAD
};
SRpcMsg
rsp
=
{
0
};
SEpSet
epset
=
{.
inUse
=
0
,
.
numOfEps
=
1
};
tstrncpy
(
epset
.
eps
[
0
].
fqdn
,
tsLocalFqdn
,
TSDB_FQDN_LEN
);
epset
.
eps
[
0
].
port
=
tsServerPort
;
dndSendRecv
(
pWrapper
->
pDnode
,
&
epset
,
&
req
,
&
rsp
);
if
(
rsp
.
code
==
0
&&
rsp
.
contLen
>
0
)
{
tDeserializeSMonVloadInfo
(
rsp
.
pCont
,
rsp
.
contLen
,
pInfo
);
}
rpcFreeCont
(
rsp
.
pCont
);
}
}
monSendReport
(
pMonitor
);
monCleanupMonitorInfo
(
pMonitor
);
}
\ No newline at end of file
void
dmGetMonitorSysInfo
(
SMonSysInfo
*
pInfo
)
{
taosGetCpuUsage
(
&
pInfo
->
cpu_engine
,
&
pInfo
->
cpu_system
);
taosGetCpuCores
(
&
pInfo
->
cpu_cores
);
taosGetProcMemory
(
&
pInfo
->
mem_engine
);
taosGetSysMemory
(
&
pInfo
->
mem_system
);
pInfo
->
mem_total
=
tsTotalMemoryKB
;
pInfo
->
disk_engine
=
0
;
pInfo
->
disk_used
=
tsDataSpace
.
size
.
used
;
pInfo
->
disk_total
=
tsDataSpace
.
size
.
total
;
taosGetCardInfoDelta
(
&
pInfo
->
net_in
,
&
pInfo
->
net_out
);
taosGetProcIODelta
(
&
pInfo
->
io_read
,
&
pInfo
->
io_write
,
&
pInfo
->
io_read_disk
,
&
pInfo
->
io_write_disk
);
}
source/dnode/mgmt/dm/dmWorker.c
浏览文件 @
3d6030a4
...
...
@@ -44,6 +44,7 @@ static void *dmThreadRoutine(void *param) {
lastMonitorTime
=
curTime
;
}
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
dmStartThread
(
SDnodeMgmt
*
pMgmt
)
{
...
...
@@ -101,9 +102,9 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
return
-
1
;
}
SSingleWorkerCfg
scfg
=
{.
min
=
1
,
.
max
=
1
,
.
name
=
"dnode-
status
"
,
.
fp
=
(
FItem
)
dmProcessQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
status
Worker
,
&
scfg
)
!=
0
)
{
dError
(
"failed to start dnode
status
worker since %s"
,
terrstr
());
SSingleWorkerCfg
scfg
=
{.
min
=
1
,
.
max
=
1
,
.
name
=
"dnode-
monitor
"
,
.
fp
=
(
FItem
)
dmProcessQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitor
Worker
,
&
scfg
)
!=
0
)
{
dError
(
"failed to start dnode
monitor
worker since %s"
,
terrstr
());
return
-
1
;
}
...
...
@@ -113,7 +114,7 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
void
dmStopWorker
(
SDnodeMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
mgmtWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
status
Worker
);
tSingleWorkerCleanup
(
&
pMgmt
->
monitor
Worker
);
if
(
pMgmt
->
threadId
!=
NULL
)
{
taosDestoryThread
(
pMgmt
->
threadId
);
...
...
@@ -131,9 +132,9 @@ int32_t dmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
}
int32_t
dmProcess
Status
Msg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
dmProcess
Monitor
Msg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
status
Worker
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitor
Worker
;
dTrace
(
"msg:%p, put into worker %s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
...
...
source/dnode/mgmt/inc/bmInt.h
浏览文件 @
3d6030a4
...
...
@@ -17,6 +17,7 @@
#define _TD_DND_BNODE_INT_H_
#include "dndInt.h"
#include "bnode.h"
#ifdef __cplusplus
...
...
@@ -29,6 +30,7 @@ typedef struct SBnodeMgmt {
SMgmtWrapper
*
pWrapper
;
const
char
*
path
;
SMultiWorker
writeWorker
;
SSingleWorker
monitorWorker
;
}
SBnodeMgmt
;
// bmInt.c
...
...
@@ -39,11 +41,13 @@ int32_t bmDrop(SMgmtWrapper *pWrapper);
void
bmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
bmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
bmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
bmProcessGetMonBmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
// bmWorker.c
int32_t
bmStartWorker
(
SBnodeMgmt
*
pMgmt
);
void
bmStopWorker
(
SBnodeMgmt
*
pMgmt
);
int32_t
bmProcessWriteMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
bmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/dmInt.h
浏览文件 @
3d6030a4
...
...
@@ -32,7 +32,7 @@ typedef struct SDnodeMgmt {
TdThread
*
threadId
;
SRWLatch
latch
;
SSingleWorker
mgmtWorker
;
SSingleWorker
status
Worker
;
SSingleWorker
monitor
Worker
;
SMsgCb
msgCb
;
const
char
*
path
;
SDnode
*
pDnode
;
...
...
@@ -54,6 +54,7 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SNodeMsg *pMsg);
int32_t
dmProcessCDnodeReq
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
// dmMonitor.c
void
dmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
);
void
dmSendMonitorReport
(
SDnode
*
pDnode
);
// dmWorker.c
...
...
@@ -61,7 +62,7 @@ int32_t dmStartThread(SDnodeMgmt *pMgmt);
int32_t
dmStartWorker
(
SDnodeMgmt
*
pMgmt
);
void
dmStopWorker
(
SDnodeMgmt
*
pMgmt
);
int32_t
dmProcessMgmtMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
dmProcess
Status
Msg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
dmProcess
Monitor
Msg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/dndInt.h
浏览文件 @
3d6030a4
...
...
@@ -169,6 +169,7 @@ void dndCleanupTrans(SDnode *pDnode);
SMsgCb
dndCreateMsgcb
(
SMgmtWrapper
*
pWrapper
);
SProcCfg
dndGenProcCfg
(
SMgmtWrapper
*
pWrapper
);
int32_t
dndInitMsgHandle
(
SDnode
*
pDnode
);
void
dndSendRecv
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
// mgmt
void
dmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
...
...
@@ -182,22 +183,13 @@ void dmGetMnodeEpSet(SDnodeMgmt *pMgmt, SEpSet *pEpSet);
void
dmUpdateMnodeEpSet
(
SDnodeMgmt
*
pMgmt
,
SEpSet
*
pEpSet
);
void
dmSendRedirectRsp
(
SDnodeMgmt
*
pMgmt
,
const
SRpcMsg
*
pMsg
);
typedef
struct
{
int32_t
openVnodes
;
int32_t
totalVnodes
;
int32_t
masterNum
;
int64_t
numOfSelectReqs
;
int64_t
numOfInsertReqs
;
int64_t
numOfInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
}
SVnodesStat
;
void
vmMonitorVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SArray
*
pLoads
);
int32_t
vmMonitorTfsInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDiskInfo
*
pInfo
);
void
vmMonitorVnodeReqs
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
);
int32_t
mmMonitorMnodeInfo
(
SMgmtWrapper
*
pWrapper
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
);
void
dmGetMonitorSysInfo
(
SMonSysInfo
*
pInfo
);
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
);
void
mmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonMmInfo
*
mmInfo
);
void
vmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonVmInfo
*
vmInfo
);
void
qmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonQmInfo
*
qmInfo
);
void
smGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonSmInfo
*
smInfo
);
void
bmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonBmInfo
*
bmInfo
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/mmInt.h
浏览文件 @
3d6030a4
...
...
@@ -32,6 +32,7 @@ typedef struct SMnodeMgmt {
SSingleWorker
readWorker
;
SSingleWorker
writeWorker
;
SSingleWorker
syncWorker
;
SSingleWorker
monitorWorker
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
int8_t
replica
;
int8_t
selfIndex
;
...
...
@@ -51,6 +52,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper);
int32_t
mmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessAlterReq
(
SMnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessGetMonMmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
// mmWorker.c
int32_t
mmStartWorker
(
SMnodeMgmt
*
pMgmt
);
...
...
@@ -59,6 +61,7 @@ int32_t mmProcessWriteMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
int32_t
mmProcessSyncMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessReadMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessQueryMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmPutMsgToQueryQueue
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
);
int32_t
mmPutMsgToReadQueue
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
);
int32_t
mmPutMsgToWriteQueue
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
);
...
...
source/dnode/mgmt/inc/qmInt.h
浏览文件 @
3d6030a4
...
...
@@ -30,6 +30,7 @@ typedef struct SQnodeMgmt {
const
char
*
path
;
SSingleWorker
queryWorker
;
SSingleWorker
fetchWorker
;
SSingleWorker
monitorWorker
;
}
SQnodeMgmt
;
// qmInt.c
...
...
@@ -40,6 +41,7 @@ int32_t qmDrop(SMgmtWrapper *pWrapper);
void
qmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
qmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessGetMonQmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
// qmWorker.c
int32_t
qmPutMsgToQueryQueue
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
...
...
@@ -50,6 +52,7 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt);
void
qmStopWorker
(
SQnodeMgmt
*
pMgmt
);
int32_t
qmProcessQueryMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessFetchMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
qmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/smInt.h
浏览文件 @
3d6030a4
...
...
@@ -32,6 +32,7 @@ typedef struct SSnodeMgmt {
int8_t
uniqueWorkerInUse
;
SArray
*
uniqueWorkers
;
// SArray<SMultiWorker*>
SSingleWorker
sharedWorker
;
SSingleWorker
monitorWorker
;
}
SSnodeMgmt
;
// smInt.c
...
...
@@ -42,6 +43,7 @@ int32_t smDrop(SMgmtWrapper *pWrapper);
void
smInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
smProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessGetMonSmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
// smWorker.c
int32_t
smStartWorker
(
SSnodeMgmt
*
pMgmt
);
...
...
@@ -50,6 +52,7 @@ int32_t smProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
int32_t
smProcessUniqueMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessSharedMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessExecMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
smProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/inc/vmInt.h
浏览文件 @
3d6030a4
...
...
@@ -28,6 +28,7 @@ typedef struct SVnodesMgmt {
SHashObj
*
hash
;
SRWLatch
latch
;
SVnodesStat
state
;
SVnodesStat
lastState
;
STfs
*
pTfs
;
SQWorkerPool
queryPool
;
SQWorkerPool
fetchPool
;
...
...
@@ -38,6 +39,7 @@ typedef struct SVnodesMgmt {
SDnode
*
pDnode
;
SMgmtWrapper
*
pWrapper
;
SSingleWorker
mgmtWorker
;
SSingleWorker
monitorWorker
;
}
SVnodesMgmt
;
typedef
struct
{
...
...
@@ -91,6 +93,8 @@ int32_t vmProcessAlterVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pReq);
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessSyncVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessCompactVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessGetMonVmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
int32_t
vmProcessGetVnodeLoadsReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
// vmFile.c
int32_t
vmGetVnodesFromFile
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
);
...
...
@@ -114,6 +118,7 @@ int32_t vmProcessQueryMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
int32_t
vmProcessFetchMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessMergeMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessMgmtMsg
(
SMgmtWrapper
*
pWrappert
,
SNodeMsg
*
pMsg
);
int32_t
vmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/main/dndExec.c
浏览文件 @
3d6030a4
...
...
@@ -90,7 +90,7 @@ static int32_t dndNewProc(SMgmtWrapper *pWrapper, EDndType n) {
static
void
dndProcessProcHandle
(
void
*
handle
)
{
dWarn
(
"handle:%p, the child process dies and send an offline rsp"
,
handle
);
SRpcMsg
rpcMsg
=
{.
handle
=
handle
,
.
code
=
TSDB_CODE_
DND
_OFFLINE
};
SRpcMsg
rpcMsg
=
{.
handle
=
handle
,
.
code
=
TSDB_CODE_
NODE
_OFFLINE
};
rpcSendResponse
(
&
rpcMsg
);
}
...
...
source/dnode/mgmt/main/dndFile.c
浏览文件 @
3d6030a4
...
...
@@ -19,7 +19,7 @@
#define MAXLEN 1024
int32_t
dndReadFile
(
SMgmtWrapper
*
pWrapper
,
bool
*
pDeployed
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int64_t
len
=
0
;
char
content
[
MAXLEN
+
1
]
=
{
0
};
cJSON
*
root
=
NULL
;
...
...
@@ -159,7 +159,7 @@ int32_t dndReadShmFile(SDnode *pDnode) {
if
(
taosReadFile
(
pFile
,
content
,
MAXLEN
)
>
0
)
{
root
=
cJSON_Parse
(
content
);
if
(
root
==
NULL
)
{
terrno
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
terrno
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
dError
(
"failed to read %s since invalid json format"
,
file
);
goto
_OVER
;
}
...
...
source/dnode/mgmt/main/dndTransport.c
浏览文件 @
3d6030a4
...
...
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "dndInt.h"
...
...
@@ -121,7 +121,7 @@ static void dndProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
if
(
isReq
&&
pMsg
->
pCont
==
NULL
)
{
dError
(
"req:%s not processed since its empty, handle:%p app:%p"
,
TMSG_INFO
(
msgType
),
pMsg
->
handle
,
pMsg
->
ahandle
);
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_
DND_
INVALID_MSG_LEN
,
.
ahandle
=
pMsg
->
ahandle
};
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_INVALID_MSG_LEN
,
.
ahandle
=
pMsg
->
ahandle
};
rpcSendResponse
(
&
rspMsg
);
return
;
}
...
...
@@ -338,7 +338,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
static
int32_t
dndSendRpcReq
(
STransMgmt
*
pMgmt
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
if
(
pMgmt
->
clientRpc
==
NULL
)
{
terrno
=
TSDB_CODE_
DND
_OFFLINE
;
terrno
=
TSDB_CODE_
NODE
_OFFLINE
;
return
-
1
;
}
...
...
@@ -359,7 +359,7 @@ static void dndSendRpcRsp(SMgmtWrapper *pWrapper, const SRpcMsg *pRsp) {
static
int32_t
dndSendReq
(
SMgmtWrapper
*
pWrapper
,
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
)
{
if
(
dndGetStatus
(
pWrapper
->
pDnode
)
!=
DND_STAT_RUNNING
)
{
terrno
=
TSDB_CODE_
DND
_OFFLINE
;
terrno
=
TSDB_CODE_
NODE
_OFFLINE
;
dError
(
"failed to send rpc msg since %s, handle:%p"
,
terrstr
(),
pReq
->
handle
);
return
-
1
;
}
...
...
@@ -482,4 +482,8 @@ SProcCfg dndGenProcCfg(SMgmtWrapper *pWrapper) {
.
parent
=
pWrapper
,
.
name
=
pWrapper
->
name
};
return
cfg
;
}
void
dndSendRecv
(
SDnode
*
pDnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
)
{
rpcSendRecv
(
pDnode
->
trans
.
clientRpc
,
pEpSet
,
pReq
,
pRsp
);
}
\ No newline at end of file
source/dnode/mgmt/mm/mmFile.c
浏览文件 @
3d6030a4
...
...
@@ -17,7 +17,7 @@
#include "mmInt.h"
int32_t
mmReadFile
(
SMnodeMgmt
*
pMgmt
,
bool
*
pDeployed
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int32_t
len
=
0
;
int32_t
maxLen
=
4096
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
...
...
source/dnode/mgmt/mm/mmHandle.c
浏览文件 @
3d6030a4
...
...
@@ -16,6 +16,36 @@
#define _DEFAULT_SOURCE
#include "mmInt.h"
void
mmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonMmInfo
*
mmInfo
)
{
SMnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
mndGetMonitorInfo
(
pMgmt
->
pMnode
,
&
mmInfo
->
cluster
,
&
mmInfo
->
vgroup
,
&
mmInfo
->
grant
);
}
int32_t
mmProcessGetMonMmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonMmInfo
mmInfo
=
{
0
};
mmGetMonitorInfo
(
pWrapper
,
&
mmInfo
);
dmGetMonitorSysInfo
(
&
mmInfo
.
sys
);
monGetLogs
(
&
mmInfo
.
log
);
int32_t
rspLen
=
tSerializeSMonMmInfo
(
NULL
,
0
,
&
mmInfo
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonMmInfo
(
pRsp
,
rspLen
,
&
mmInfo
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
tFreeSMonMmInfo
(
&
mmInfo
);
return
0
;
}
int32_t
mmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
...
...
@@ -27,7 +57,7 @@ int32_t mmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
if
(
createReq
.
replica
<=
1
||
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create mnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -40,13 +70,13 @@ int32_t mmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDropMn
odeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropMQSBN
odeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop mnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -65,7 +95,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
}
if
(
alterReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to alter mnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -74,6 +104,8 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
}
void
mmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
dndSetMsgHandle
(
pWrapper
,
TDMT_MON_MM_INFO
,
mmProcessMonitorMsg
,
DEFAULT_HANDLE
);
// Requests handled by DNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_MNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
...
...
@@ -147,6 +179,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_CREATE_STREAM
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_DB_CFG
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MND_GET_INDEX
,
mmProcessReadMsg
,
DEFAULT_HANDLE
);
// Requests handled by VNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CONN_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
...
...
@@ -163,5 +196,4 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_FETCH
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_TASK
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
}
source/dnode/mgmt/mm/mmInt.c
浏览文件 @
3d6030a4
...
...
@@ -241,8 +241,3 @@ void mmSetMgmtFp(SMgmtWrapper *pWrapper) {
pWrapper
->
fp
=
mgmtFp
;
}
int32_t
mmMonitorMnodeInfo
(
SMgmtWrapper
*
pWrapper
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
)
{
SMnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
return
mndGetMonitorInfo
(
pMgmt
->
pMnode
,
pClusterInfo
,
pVgroupInfo
,
pGrantInfo
);
}
source/dnode/mgmt/mm/mmWorker.c
浏览文件 @
3d6030a4
...
...
@@ -23,19 +23,18 @@ static void mmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
!=
TDMT_DND_ALTER_MNODE
)
{
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_DND_ALTER_MNODE
)
{
code
=
mmProcessAlterReq
(
pMgmt
,
pMsg
);
}
else
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_MM_INFO
)
{
code
=
mmProcessGetMonMmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
pMsg
->
pNode
=
pMgmt
->
pMnode
;
code
=
mndProcessMsg
(
pMsg
);
}
else
{
code
=
mmProcessAlterReq
(
pMgmt
,
pMsg
);
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
pRpc
->
handle
!=
NULL
&&
code
!=
TSDB_CODE_MND_ACTION_IN_PROGRESS
)
{
if
(
code
!=
0
)
{
code
=
terrno
;
dError
(
"msg:%p, failed to process since %s"
,
pMsg
,
terrstr
());
}
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
SRpcMsg
rsp
=
{.
handle
=
pRpc
->
handle
,
.
code
=
code
,
.
contLen
=
pMsg
->
rspLen
,
.
pCont
=
pMsg
->
pRsp
};
tmsgSendRsp
(
&
rsp
);
}
...
...
@@ -98,6 +97,15 @@ int32_t mmProcessQueryMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
}
int32_t
mmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SMnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
static
int32_t
mmPutRpcMsgToWorker
(
SSingleWorker
*
pWorker
,
SRpcMsg
*
pRpc
)
{
SNodeMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SNodeMsg
));
if
(
pMsg
==
NULL
)
return
-
1
;
...
...
@@ -157,15 +165,24 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
SSingleWorkerCfg
sCfg
=
{.
min
=
1
,
.
max
=
1
,
.
name
=
"mnode-sync"
,
.
fp
=
(
FItem
)
mmProcessQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
syncWorker
,
&
sCfg
)
!=
0
)
{
dError
(
"failed to start mnode
sync-
worker since %s"
,
terrstr
());
dError
(
"failed to start mnode
mnode-sync
worker since %s"
,
terrstr
());
return
-
1
;
}
if
(
tsMultiProcess
)
{
SSingleWorkerCfg
mCfg
=
{.
min
=
1
,
.
max
=
1
,
.
name
=
"mnode-monitor"
,
.
fp
=
(
FItem
)
mmProcessQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start mnode mnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
}
dDebug
(
"mnode workers are initialized"
);
return
0
;
}
void
mmStopWorker
(
SMnodeMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
monitorWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
queryWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
readWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
writeWorker
);
...
...
source/dnode/mgmt/qm/qmHandle.c
浏览文件 @
3d6030a4
...
...
@@ -16,19 +16,46 @@
#define _DEFAULT_SOURCE
#include "qmInt.h"
void
qmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonQmInfo
*
qmInfo
)
{}
int32_t
qmProcessGetMonQmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonQmInfo
qmInfo
=
{
0
};
qmGetMonitorInfo
(
pWrapper
,
&
qmInfo
);
dmGetMonitorSysInfo
(
&
qmInfo
.
sys
);
monGetLogs
(
&
qmInfo
.
log
);
int32_t
rspLen
=
tSerializeSMonQmInfo
(
NULL
,
0
,
&
qmInfo
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonQmInfo
(
pRsp
,
rspLen
,
&
qmInfo
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
tFreeSMonQmInfo
(
&
qmInfo
);
return
0
;
}
int32_t
qmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateQnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
dError
(
"failed to create qnode since %s
, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
pDnode
->
dnodeId
);
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create qnode since %s
"
,
terrstr
()
);
return
-
1
;
}
else
{
return
qmOpen
(
pWrapper
);
...
...
@@ -40,13 +67,13 @@ int32_t qmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropQnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop qnode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -55,6 +82,8 @@ int32_t qmProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
void
qmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
dndSetMsgHandle
(
pWrapper
,
TDMT_MON_QM_INFO
,
qmProcessMonitorMsg
,
DEFAULT_HANDLE
);
// Requests handled by VNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY
,
qmProcessQueryMsg
,
QNODE_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_CONTINUE
,
qmProcessQueryMsg
,
QNODE_HANDLE
);
...
...
source/dnode/mgmt/qm/qmWorker.c
浏览文件 @
3d6030a4
...
...
@@ -16,18 +16,47 @@
#define _DEFAULT_SOURCE
#include "qmInt.h"
static
void
qmSendRsp
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
};
static
inline
void
qmSendRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
.
pCont
=
pMsg
->
pRsp
,
.
contLen
=
pMsg
->
rspLen
};
tmsgSendRsp
(
&
rsp
);
}
static
void
qmProcessMonitorQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, get from qnode-monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_SM_INFO
)
{
code
=
qmProcessGetMonQmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
qmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
rpcFreeCont
(
pRpc
->
pCont
);
taosFreeQitem
(
pMsg
);
}
static
void
qmProcessQueryQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, will be processed in qnode-query queue"
,
pMsg
);
int32_t
code
=
qndProcessQueryMsg
(
pMgmt
->
pQnode
,
&
pMsg
->
rpcMsg
);
if
(
code
!=
0
)
{
qmSendRsp
(
pMgmt
->
pWrapper
,
pMsg
,
code
);
dTrace
(
"msg:%p, get from qnode-query queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
qndProcessQueryMsg
(
pMgmt
->
pQnode
,
pRpc
);
if
(
pRpc
->
msgType
&
1U
&&
code
!=
0
)
{
qmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
...
...
@@ -38,10 +67,12 @@ static void qmProcessQueryQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
static
void
qmProcessFetchQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, will be processed in qnode-fetch queue"
,
pMsg
);
int32_t
code
=
qndProcessFetchMsg
(
pMgmt
->
pQnode
,
&
pMsg
->
rpcMsg
);
if
(
code
!=
0
)
{
qmSendRsp
(
pMgmt
->
pWrapper
,
pMsg
,
code
);
dTrace
(
"msg:%p, get from qnode-fetch queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
qndProcessFetchMsg
(
pMgmt
->
pQnode
,
pRpc
);
if
(
pRpc
->
msgType
&
1U
&&
code
!=
0
)
{
qmSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
...
...
@@ -66,6 +97,12 @@ int32_t qmProcessFetchMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
}
int32_t
qmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SQnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
qmPutMsgToWorker
(
&
pMgmt
->
monitorWorker
,
pMsg
);
return
0
;
}
static
int32_t
qmPutRpcMsgToWorker
(
SQnodeMgmt
*
pMgmt
,
SSingleWorker
*
pWorker
,
SRpcMsg
*
pRpc
)
{
SNodeMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SNodeMsg
));
if
(
pMsg
==
NULL
)
{
...
...
@@ -91,6 +128,7 @@ int32_t qmPutMsgToFetchQueue(SMgmtWrapper *pWrapper, SRpcMsg *pRpc) {
int32_t
qmGetQueueSize
(
SMgmtWrapper
*
pWrapper
,
int32_t
vgId
,
EQueueType
qtype
)
{
int32_t
size
=
-
1
;
SQnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
switch
(
qtype
)
{
case
QUERY_QUEUE
:
size
=
taosQueueSize
(
pMgmt
->
queryWorker
.
queue
);
...
...
@@ -128,11 +166,21 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
return
-
1
;
}
if
(
tsMultiProcess
)
{
SSingleWorkerCfg
mCfg
=
{
.
min
=
1
,
.
max
=
1
,
.
name
=
"qnode-monitor"
,
.
fp
=
(
FItem
)
qmProcessMonitorQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start qnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
}
dDebug
(
"qnode workers are initialized"
);
return
0
;
}
void
qmStopWorker
(
SQnodeMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
monitorWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
queryWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
fetchWorker
);
dDebug
(
"qnode workers are closed"
);
...
...
source/dnode/mgmt/sm/smHandle.c
浏览文件 @
3d6030a4
...
...
@@ -16,19 +16,46 @@
#define _DEFAULT_SOURCE
#include "smInt.h"
void
smGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonSmInfo
*
smInfo
)
{}
int32_t
smProcessGetMonSmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonSmInfo
smInfo
=
{
0
};
smGetMonitorInfo
(
pWrapper
,
&
smInfo
);
dmGetMonitorSysInfo
(
&
smInfo
.
sys
);
monGetLogs
(
&
smInfo
.
log
);
int32_t
rspLen
=
tSerializeSMonSmInfo
(
NULL
,
0
,
&
smInfo
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonSmInfo
(
pRsp
,
rspLen
,
&
smInfo
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
tFreeSMonSmInfo
(
&
smInfo
);
return
0
;
}
int32_t
smProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCreateSnodeReq
createReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
createReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
createReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
dError
(
"failed to create snode since %s
, input:%d cur:%d"
,
terrstr
(),
createReq
.
dnodeId
,
pDnode
->
dnodeId
);
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to create snode since %s
"
,
terrstr
()
);
return
-
1
;
}
else
{
return
smOpen
(
pWrapper
);
...
...
@@ -40,13 +67,13 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDDropSnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDrop
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropM
QSBNodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
dropReq
.
dnodeId
!=
pDnode
->
dnodeId
)
{
terrno
=
TSDB_CODE_
NODE_
INVALID_OPTION
;
terrno
=
TSDB_CODE_INVALID_OPTION
;
dError
(
"failed to drop snode since %s"
,
terrstr
());
return
-
1
;
}
else
{
...
...
@@ -55,6 +82,8 @@ int32_t smProcessDropReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
void
smInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
dndSetMsgHandle
(
pWrapper
,
TDMT_MON_SM_INFO
,
smProcessMonitorMsg
,
DEFAULT_HANDLE
);
// Requests handled by SNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_SND_TASK_DEPLOY
,
smProcessMgmtMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_SND_TASK_EXEC
,
smProcessExecMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mgmt/sm/smWorker.c
浏览文件 @
3d6030a4
...
...
@@ -16,6 +16,38 @@
#define _DEFAULT_SOURCE
#include "smInt.h"
static
inline
void
smSendRsp
(
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
.
pCont
=
pMsg
->
pRsp
,
.
contLen
=
pMsg
->
rspLen
};
tmsgSendRsp
(
&
rsp
);
}
static
void
smProcessMonitorQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p, get from snode-monitor queue"
,
pMsg
);
SRpcMsg
*
pRpc
=
&
pMsg
->
rpcMsg
;
int32_t
code
=
-
1
;
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_SM_INFO
)
{
code
=
smProcessGetMonSmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
}
if
(
pRpc
->
msgType
&
1U
)
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
smSendRsp
(
pMsg
,
code
);
}
dTrace
(
"msg:%p, is freed, result:0x%04x:%s"
,
pMsg
,
code
&
0XFFFF
,
tstrerror
(
code
));
rpcFreeCont
(
pRpc
->
pCont
);
taosFreeQitem
(
pMsg
);
}
static
void
smProcessUniqueQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
...
...
@@ -23,7 +55,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
SNodeMsg
*
pMsg
=
NULL
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"msg:%p,
will be processed in snode
unique queue"
,
pMsg
);
dTrace
(
"msg:%p,
get from snode-
unique queue"
,
pMsg
);
sndProcessUMsg
(
pMgmt
->
pSnode
,
&
pMsg
->
rpcMsg
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
...
...
@@ -35,7 +67,7 @@ static void smProcessUniqueQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t num
static
void
smProcessSharedQueue
(
SQueueInfo
*
pInfo
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
dTrace
(
"msg:%p,
will be processed in snode
shared queue"
,
pMsg
);
dTrace
(
"msg:%p,
get from snode-
shared queue"
,
pMsg
);
sndProcessSMsg
(
pMgmt
->
pSnode
,
&
pMsg
->
rpcMsg
);
dTrace
(
"msg:%p, is freed"
,
pMsg
);
...
...
@@ -58,7 +90,6 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
}
SMultiWorkerCfg
cfg
=
{.
max
=
1
,
.
name
=
"snode-unique"
,
.
fp
=
smProcessUniqueQueue
,
.
param
=
pMgmt
};
if
(
tMultiWorkerInit
(
pUniqueWorker
,
&
cfg
)
!=
0
)
{
dError
(
"failed to start snode-unique worker since %s"
,
terrstr
());
return
-
1
;
...
...
@@ -80,11 +111,21 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
return
-
1
;
}
if
(
tsMultiProcess
)
{
SSingleWorkerCfg
mCfg
=
{
.
min
=
1
,
.
max
=
1
,
.
name
=
"snode-monitor"
,
.
fp
=
(
FItem
)
smProcessMonitorQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start snode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
}
dDebug
(
"snode workers are initialized"
);
return
0
;
}
void
smStopWorker
(
SSnodeMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
monitorWorker
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pMgmt
->
uniqueWorkers
);
i
++
)
{
SMultiWorker
*
pWorker
=
taosArrayGetP
(
pMgmt
->
uniqueWorkers
,
i
);
tMultiWorkerCleanup
(
pWorker
);
...
...
@@ -120,6 +161,15 @@ int32_t smProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
}
int32_t
smProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
int32_t
smProcessUniqueMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SSnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
int32_t
index
=
smGetSWIdFromMsg
(
&
pMsg
->
rpcMsg
);
...
...
@@ -144,7 +194,7 @@ int32_t smProcessSharedMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
}
int32_t
smProcessExecMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
workerType
=
smGetSWTypeFromMsg
(
&
pMsg
->
rpcMsg
);
int32_t
workerType
=
smGetSWTypeFromMsg
(
&
pMsg
->
rpcMsg
);
if
(
workerType
==
SND_WORKER_TYPE__SHARED
)
{
return
smProcessSharedMsg
(
pWrapper
,
pMsg
);
}
else
{
...
...
source/dnode/mgmt/test/bnode/dbnode.cpp
浏览文件 @
3d6030a4
...
...
@@ -33,22 +33,22 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -59,9 +59,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -74,9 +74,9 @@ TEST_F(DndTestBnode, 01_Create_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_ALREADY_DEPLOYED
);
...
...
@@ -88,22 +88,22 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -114,9 +114,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -129,9 +129,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDDropBnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -142,9 +142,9 @@ TEST_F(DndTestBnode, 02_Drop_Bnode) {
SDCreateBnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_BNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/mnode/dmnode.cpp
浏览文件 @
3d6030a4
...
...
@@ -96,7 +96,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
...
...
@@ -113,7 +113,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
...
...
@@ -139,22 +139,22 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -165,9 +165,9 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
SDDropMnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDropMn
odeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropMQSBN
odeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDropMn
odeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropMQSBN
odeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/qnode/dqnode.cpp
浏览文件 @
3d6030a4
...
...
@@ -30,22 +30,22 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -56,9 +56,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -71,9 +71,9 @@ TEST_F(DndTestQnode, 01_Create_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -86,22 +86,22 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -112,9 +112,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -127,9 +127,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDDropQnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -140,9 +140,9 @@ TEST_F(DndTestQnode, 02_Drop_Qnode) {
SDCreateQnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_QNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/snode/dsnode.cpp
浏览文件 @
3d6030a4
...
...
@@ -30,22 +30,22 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -56,9 +56,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -71,9 +71,9 @@ TEST_F(DndTestSnode, 01_Create_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -86,22 +86,22 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
2
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
NODE_
INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
{
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -112,9 +112,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -127,9 +127,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDDropSnodeReq
dropReq
=
{
0
};
dropReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
dropReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
dropReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_DROP_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
@@ -140,9 +140,9 @@ TEST_F(DndTestSnode, 01_Drop_Snode) {
SDCreateSnodeReq
createReq
=
{
0
};
createReq
.
dnodeId
=
1
;
int32_t
contLen
=
tSerializeS
MCreateDrop
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeS
CreateDropM
QSBNodeReq
(
NULL
,
0
,
&
createReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeS
MCreateDrop
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
tSerializeS
CreateDropM
QSBNodeReq
(
pReq
,
contLen
,
&
createReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_DND_CREATE_SNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
...
...
source/dnode/mgmt/test/vnode/vnode.cpp
浏览文件 @
3d6030a4
...
...
@@ -67,7 +67,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
DND_V
NODE_ALREADY_DEPLOYED
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_ALREADY_DEPLOYED
);
}
}
}
...
...
@@ -301,7 +301,7 @@ TEST_F(DndTestVnode, 06_Drop_Vnode) {
ASSERT_EQ
(
pRsp
->
code
,
0
);
test
.
Restart
();
}
else
{
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_
DND_V
NODE_NOT_DEPLOYED
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_NOT_DEPLOYED
);
}
}
}
\ No newline at end of file
source/dnode/mgmt/vm/vmFile.c
浏览文件 @
3d6030a4
...
...
@@ -45,7 +45,7 @@ SVnodeObj **vmGetVnodesFromHash(SVnodesMgmt *pMgmt, int32_t *numOfVnodes) {
}
int32_t
vmGetVnodesFromFile
(
SVnodesMgmt
*
pMgmt
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
)
{
int32_t
code
=
TSDB_CODE_
NODE_PARSE_FILE_ERROR
;
int32_t
code
=
TSDB_CODE_
INVALID_JSON_FORMAT
;
int32_t
len
=
0
;
int32_t
maxLen
=
30000
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
...
...
source/dnode/mgmt/vm/vmHandle.c
浏览文件 @
3d6030a4
...
...
@@ -16,6 +16,71 @@
#define _DEFAULT_SOURCE
#include "vmInt.h"
void
vmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonVmInfo
*
vmInfo
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
tfsGetMonitorInfo
(
pMgmt
->
pTfs
,
&
vmInfo
->
tfs
);
taosWLockLatch
(
&
pMgmt
->
latch
);
vmInfo
->
vstat
.
totalVnodes
=
pMgmt
->
state
.
totalVnodes
;
vmInfo
->
vstat
.
masterNum
=
pMgmt
->
state
.
masterNum
;
vmInfo
->
vstat
.
numOfSelectReqs
=
pMgmt
->
state
.
numOfSelectReqs
-
pMgmt
->
lastState
.
numOfSelectReqs
;
vmInfo
->
vstat
.
numOfInsertReqs
=
pMgmt
->
state
.
numOfInsertReqs
-
pMgmt
->
lastState
.
numOfInsertReqs
;
vmInfo
->
vstat
.
numOfInsertSuccessReqs
=
pMgmt
->
state
.
numOfInsertSuccessReqs
-
pMgmt
->
lastState
.
numOfInsertSuccessReqs
;
vmInfo
->
vstat
.
numOfBatchInsertReqs
=
pMgmt
->
state
.
numOfBatchInsertReqs
-
pMgmt
->
lastState
.
numOfBatchInsertReqs
;
vmInfo
->
vstat
.
numOfBatchInsertSuccessReqs
=
pMgmt
->
state
.
numOfBatchInsertSuccessReqs
-
pMgmt
->
lastState
.
numOfBatchInsertSuccessReqs
;
pMgmt
->
lastState
=
pMgmt
->
state
;
taosWUnLockLatch
(
&
pMgmt
->
latch
);
}
int32_t
vmProcessGetMonVmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonVmInfo
vmInfo
=
{
0
};
vmGetMonitorInfo
(
pWrapper
,
&
vmInfo
);
dmGetMonitorSysInfo
(
&
vmInfo
.
sys
);
monGetLogs
(
&
vmInfo
.
log
);
int32_t
rspLen
=
tSerializeSMonVmInfo
(
NULL
,
0
,
&
vmInfo
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonVmInfo
(
pRsp
,
rspLen
,
&
vmInfo
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
tFreeSMonVmInfo
(
&
vmInfo
);
return
0
;
}
int32_t
vmProcessGetVnodeLoadsReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonVloadInfo
vloads
=
{
0
};
vmGetVnodeLoads
(
pWrapper
,
&
vloads
);
int32_t
rspLen
=
tSerializeSMonVloadInfo
(
NULL
,
0
,
&
vloads
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonVloadInfo
(
pRsp
,
rspLen
,
&
vloads
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
tFreeSMonVloadInfo
(
&
vloads
);
return
0
;
}
static
void
vmGenerateVnodeCfg
(
SCreateVnodeReq
*
pCreate
,
SVnodeCfg
*
pCfg
)
{
pCfg
->
vgId
=
pCreate
->
vgId
;
pCfg
->
wsize
=
pCreate
->
cacheBlockSize
;
...
...
@@ -74,7 +139,7 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
tFreeSCreateVnodeReq
(
&
createReq
);
dDebug
(
"vgId:%d, already exist"
,
createReq
.
vgId
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
terrno
=
TSDB_CODE_
DND_V
NODE_ALREADY_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
return
-
1
;
}
...
...
@@ -173,7 +238,7 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to drop since %s"
,
vgId
,
terrstr
());
terrno
=
TSDB_CODE_
DND_V
NODE_NOT_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
return
-
1
;
}
...
...
@@ -239,6 +304,9 @@ int32_t vmProcessCompactVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
}
void
vmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
dndSetMsgHandle
(
pWrapper
,
TDMT_MON_VM_INFO
,
vmProcessMonitorMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_MON_VM_LOAD
,
vmProcessMonitorMsg
,
DEFAULT_HANDLE
);
// Requests handled by VNODE
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_SUBMIT
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dndSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY
,
(
NodeMsgFp
)
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
...
...
source/dnode/mgmt/vm/vmInt.c
浏览文件 @
3d6030a4
...
...
@@ -344,38 +344,21 @@ void vmSetMgmtFp(SMgmtWrapper *pWrapper) {
pWrapper
->
fp
=
mgmtFp
;
}
int32_t
vmMonitorTfsInfo
(
SMgmtWrapper
*
pWrapper
,
SMonDisk
Info
*
pInfo
)
{
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVload
Info
*
pInfo
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
-
1
;
return
tfsGetMonitorInfo
(
pMgmt
->
pTfs
,
pInfo
);
}
void
vmMonitorVnodeReqs
(
SMgmtWrapper
*
pWrapper
,
SMonDnodeInfo
*
pInfo
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
;
SVnodesStat
*
pStat
=
&
pMgmt
->
state
;
pInfo
->
req_select
=
pStat
->
numOfSelectReqs
;
pInfo
->
req_insert
=
pStat
->
numOfInsertReqs
;
pInfo
->
req_insert_success
=
pStat
->
numOfInsertSuccessReqs
;
pInfo
->
req_insert_batch
=
pStat
->
numOfBatchInsertReqs
;
pInfo
->
req_insert_batch_success
=
pStat
->
numOfBatchInsertSuccessReqs
;
pInfo
->
errors
=
tsNumOfErrorLogs
;
pInfo
->
vnodes_num
=
pStat
->
totalVnodes
;
pInfo
->
masters
=
pStat
->
masterNum
;
}
SArray
*
pLoads
=
taosArrayInit
(
pMgmt
->
state
.
totalVnodes
,
sizeof
(
SVnodeLoad
));
void
vmMonitorVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SArray
*
pLoads
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SVnodesStat
*
pStat
=
&
pMgmt
->
state
;
int
32_t
totalVnode
s
=
0
;
int
32_t
masterNum
=
0
;
int64_t
numOfSelec
tReqs
=
0
;
int64_t
numOfInsert
Reqs
=
0
;
int64_t
numOfInsertSuccessReqs
=
0
;
int64_t
numOfBatchInsertReqs
=
0
;
i
nt64_t
numOfBatchInsertSuccessReqs
=
0
;
int32_t
totalVnodes
=
0
;
int32_t
masterNum
=
0
;
int64_t
numOfSelectReqs
=
0
;
int
64_t
numOfInsertReq
s
=
0
;
int
64_t
numOfInsertSuccessReqs
=
0
;
int64_t
numOfBatchInser
tReqs
=
0
;
int64_t
numOfBatchInsertSuccess
Reqs
=
0
;
pInfo
->
pVloads
=
pLoads
;
i
f
(
pLoads
==
NULL
)
return
;
taosRLockLatch
(
&
pMgmt
->
latch
);
...
...
@@ -402,6 +385,7 @@ void vmMonitorVnodeLoads(SMgmtWrapper *pWrapper, SArray *pLoads) {
taosRUnLockLatch
(
&
pMgmt
->
latch
);
taosWLockLatch
(
&
pMgmt
->
latch
);
pStat
->
totalVnodes
=
totalVnodes
;
pStat
->
masterNum
=
masterNum
;
pStat
->
numOfSelectReqs
=
numOfSelectReqs
;
...
...
@@ -409,4 +393,5 @@ void vmMonitorVnodeLoads(SMgmtWrapper *pWrapper, SArray *pLoads) {
pStat
->
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
;
pStat
->
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
pStat
->
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
taosWUnLockLatch
(
&
pMgmt
->
latch
);
}
\ No newline at end of file
source/dnode/mgmt/vm/vmWorker.c
浏览文件 @
3d6030a4
...
...
@@ -16,8 +16,12 @@
#define _DEFAULT_SOURCE
#include "vmInt.h"
static
void
vmSendRsp
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
};
static
inline
void
vmSendRsp
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
,
int32_t
code
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
ahandle
=
pMsg
->
rpcMsg
.
ahandle
,
.
code
=
code
,
.
pCont
=
pMsg
->
pRsp
,
.
contLen
=
pMsg
->
rspLen
};
tmsgSendRsp
(
&
rsp
);
}
...
...
@@ -26,9 +30,15 @@ static void vmProcessMgmtQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
int32_t
code
=
-
1
;
tmsg_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
dTrace
(
"msg:%p, will be processed in vnode-m
gmt
queue"
,
pMsg
);
dTrace
(
"msg:%p, will be processed in vnode-m queue"
,
pMsg
);
switch
(
msgType
)
{
case
TDMT_MON_VM_INFO
:
code
=
vmProcessGetMonVmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
break
;
case
TDMT_MON_VM_LOAD
:
code
=
vmProcessGetVnodeLoadsReq
(
pMgmt
->
pWrapper
,
pMsg
);
break
;
case
TDMT_DND_CREATE_VNODE
:
code
=
vmProcessCreateVnodeReq
(
pMgmt
,
pMsg
);
break
;
...
...
@@ -255,6 +265,15 @@ int32_t vmProcessMgmtMsg(SMgmtWrapper *pWrapper, SNodeMsg *pMsg) {
return
0
;
}
int32_t
vmProcessMonitorMsg
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into worker:%s"
,
pMsg
,
pWorker
->
name
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
static
int32_t
vmPutRpcMsgToQueue
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
,
EQueueType
qtype
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SMsgHead
*
pHead
=
pRpc
->
pCont
;
...
...
@@ -412,11 +431,21 @@ int32_t vmStartWorker(SVnodesMgmt *pMgmt) {
return
-
1
;
}
if
(
tsMultiProcess
)
{
SSingleWorkerCfg
mCfg
=
{
.
min
=
1
,
.
max
=
1
,
.
name
=
"vnode-monitor"
,
.
fp
=
(
FItem
)
vmProcessMgmtQueue
,
.
param
=
pMgmt
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
dError
(
"failed to start mnode vnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
}
dDebug
(
"vnode workers are initialized"
);
return
0
;
}
void
vmStopWorker
(
SVnodesMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
monitorWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
mgmtWorker
);
tQWorkerCleanup
(
&
pMgmt
->
fetchPool
);
tQWorkerCleanup
(
&
pMgmt
->
queryPool
);
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
3d6030a4
...
...
@@ -69,7 +69,6 @@ typedef struct {
typedef
struct
{
int64_t
showId
;
ShowMetaFp
metaFps
[
TSDB_MGMT_TABLE_MAX
];
ShowRetrieveFp
retrieveFps
[
TSDB_MGMT_TABLE_MAX
];
ShowFreeIterFp
freeIterFps
[
TSDB_MGMT_TABLE_MAX
];
SCacheObj
*
cache
;
...
...
source/dnode/mnode/impl/inc/mndShow.h
浏览文件 @
3d6030a4
...
...
@@ -24,7 +24,6 @@ extern "C" {
int32_t
mndInitShow
(
SMnode
*
pMnode
);
void
mndCleanupShow
(
SMnode
*
pMnode
);
void
mndAddShowMetaHandle
(
SMnode
*
pMnode
,
EShowType
showType
,
ShowMetaFp
fp
);
void
mndAddShowRetrieveHandle
(
SMnode
*
pMnode
,
EShowType
showType
,
ShowRetrieveFp
fp
);
void
mndAddShowFreeIterHandle
(
SMnode
*
pMnode
,
EShowType
msgType
,
ShowFreeIterFp
fp
);
void
mndVacuumResult
(
char
*
data
,
int32_t
numOfCols
,
int32_t
rows
,
int32_t
capacity
,
SShowObj
*
pShow
);
...
...
source/dnode/mnode/impl/inc/mndSma.h
浏览文件 @
3d6030a4
...
...
@@ -26,6 +26,7 @@ int32_t mndInitSma(SMnode *pMnode);
void
mndCleanupSma
(
SMnode
*
pMnode
);
SSmaObj
*
mndAcquireSma
(
SMnode
*
pMnode
,
char
*
smaName
);
void
mndReleaseSma
(
SMnode
*
pMnode
,
SSmaObj
*
pSma
);
int32_t
mndProcessGetSmaReq
(
SMnode
*
pMnode
,
SUserIndexReq
*
indexReq
,
SUserIndexRsp
*
rsp
,
bool
*
exist
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
3d6030a4
...
...
@@ -26,7 +26,6 @@ static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster);
static
int32_t
mndClusterActionDelete
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
pOldCluster
,
SClusterObj
*
pNewCluster
);
static
int32_t
mndCreateDefaultCluster
(
SMnode
*
pMnode
);
static
int32_t
mndGetClusterMeta
(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveClusters
(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextCluster
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
@@ -40,7 +39,6 @@ int32_t mndInitCluster(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndClusterActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndClusterActionDelete
};
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_CLUSTER
,
mndGetClusterMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CLUSTER
,
mndRetrieveClusters
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CLUSTER
,
mndCancelGetNextCluster
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
...
...
@@ -180,44 +178,6 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
return
sdbWrite
(
pMnode
->
pSdb
,
pRaw
);
}
static
int32_t
mndGetClusterMeta
(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchemas
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BIGINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"name"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pMeta
->
numOfColumns
=
cols
;
strcpy
(
pMeta
->
tbName
,
mndShowStr
(
pShow
->
type
));
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
for
(
int32_t
i
=
1
;
i
<
cols
;
++
i
)
{
pShow
->
offset
[
i
]
=
pShow
->
offset
[
i
-
1
]
+
pShow
->
bytes
[
i
-
1
];
}
pShow
->
numOfRows
=
1
;
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
strcpy
(
pMeta
->
tbName
,
mndShowStr
(
pShow
->
type
));
return
0
;
}
static
int32_t
mndRetrieveClusters
(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pMsg
->
pNode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
3d6030a4
...
...
@@ -35,7 +35,6 @@ static int32_t mndConsumerActionInsert(SSdb *pSdb, SMqConsumerObj *pConsumer);
static
int32_t
mndConsumerActionDelete
(
SSdb
*
pSdb
,
SMqConsumerObj
*
pConsumer
);
static
int32_t
mndConsumerActionUpdate
(
SSdb
*
pSdb
,
SMqConsumerObj
*
pConsumer
,
SMqConsumerObj
*
pNewConsumer
);
static
int32_t
mndProcessConsumerMetaMsg
(
SNodeMsg
*
pMsg
);
static
int32_t
mndGetConsumerMeta
(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveConsumer
(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextConsumer
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
3d6030a4
...
...
@@ -58,7 +58,6 @@ static int32_t mndProcessStatusReq(SNodeMsg *pReq);
static
int32_t
mndGetConfigMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveConfigs
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndGetDnodeMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveDnodes
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextDnode
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
@@ -78,10 +77,8 @@ int32_t mndInitDnode(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CONFIG_DNODE_RSP
,
mndProcessConfigDnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STATUS
,
mndProcessStatusReq
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_VARIABLES
,
mndGetConfigMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_VARIABLES
,
mndRetrieveConfigs
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_VARIABLES
,
mndCancelGetNextConfig
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_DNODE
,
mndGetDnodeMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_DNODE
,
mndRetrieveDnodes
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_DNODE
,
mndCancelGetNextDnode
);
...
...
@@ -237,7 +234,7 @@ int32_t mndGetDnodeSize(SMnode *pMnode) {
bool
mndIsDnodeOnline
(
SMnode
*
pMnode
,
SDnodeObj
*
pDnode
,
int64_t
curMs
)
{
int64_t
interval
=
TABS
(
pDnode
->
lastAccessTime
-
curMs
);
if
(
interval
>
3
5
00
*
tsStatusInterval
)
{
if
(
interval
>
3
00
00
*
tsStatusInterval
)
{
if
(
pDnode
->
rebootTime
>
0
)
{
pDnode
->
offlineReason
=
DND_REASON_STATUS_MSG_TIMEOUT
;
}
...
...
@@ -554,7 +551,7 @@ static int32_t mndProcessDropDnodeReq(SNodeMsg *pReq) {
SDnodeObj
*
pDnode
=
NULL
;
SMDropMnodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
MCreateDropMn
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
CreateDropMQSBN
odeReq
(
pReq
->
rpcMsg
.
pCont
,
pReq
->
rpcMsg
.
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
DROP_DNODE_OVER
;
}
...
...
@@ -630,6 +627,7 @@ static int32_t mndProcessConfigDnodeReq(SNodeMsg *pReq) {
static
int32_t
mndProcessConfigDnodeRsp
(
SNodeMsg
*
pRsp
)
{
mInfo
(
"app:%p config rsp from dnode"
,
pRsp
->
rpcMsg
.
ahandle
);
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndGetConfigMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
...
...
@@ -709,70 +707,6 @@ static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, i
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
)
{}
static
int32_t
mndGetDnodeMeta
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchemas
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"endpoint"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"vnodes"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"support_vnodes"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
10
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"status"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create_time"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pShow
->
bytes
[
cols
]
=
256
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"offline_reason"
);
pSchema
[
cols
].
bytes
=
pShow
->
bytes
[
cols
];
cols
++
;
pMeta
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
pShow
->
offset
[
0
]
=
0
;
for
(
int32_t
i
=
1
;
i
<
cols
;
++
i
)
{
pShow
->
offset
[
i
]
=
pShow
->
offset
[
i
-
1
]
+
pShow
->
bytes
[
i
-
1
];
}
pShow
->
numOfRows
=
sdbGetSize
(
pSdb
,
SDB_DNODE
);
pShow
->
rowSize
=
pShow
->
offset
[
cols
-
1
]
+
pShow
->
bytes
[
cols
-
1
];
strcpy
(
pMeta
->
tbName
,
mndShowStr
(
pShow
->
type
));
return
0
;
}
static
int32_t
mndRetrieveDnodes
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
3d6030a4
...
...
@@ -51,7 +51,6 @@ int32_t mndInitFunc(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_FUNC
,
mndProcessDropFuncReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_RETRIEVE_FUNC
,
mndProcessRetrieveFuncReq
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_FUNC
,
mndGetFuncMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_FUNC
,
mndRetrieveFuncs
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_FUNC
,
mndCancelGetNextFunc
);
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
3d6030a4
...
...
@@ -18,6 +18,7 @@
#define SYSTABLE_SCH_TABLE_NAME_LEN ((TSDB_TABLE_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_DB_NAME_LEN ((TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
#define SYSTABLE_SCH_COL_NAME_LEN ((TSDB_COL_NAME_LEN - 1) + VARSTR_HEADER_SIZE)
//!!!! Note: only APPEND columns in below tables, NO insert !!!!
static
const
SInfosTableSchema
dnodesSchema
[]
=
{
...
...
@@ -43,7 +44,22 @@ static const SInfosTableSchema modulesSchema[] = {
};
static
const
SInfosTableSchema
qnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
134
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
snodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
bnodesSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"endpoint"
,
.
bytes
=
TSDB_EP_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
clusterSchema
[]
=
{
{.
name
=
"id"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"name"
,
.
bytes
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
};
static
const
SInfosTableSchema
userDBSchema
[]
=
{
...
...
@@ -79,11 +95,11 @@ static const SInfosTableSchema userFuncSchema[] = {
{.
name
=
"status"
,
.
bytes
=
10
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
};
static
const
SInfosTableSchema
userIdxSchema
[]
=
{
{.
name
=
"db_name"
,
.
bytes
=
32
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_
DB
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_database"
,
.
bytes
=
32
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_name"
,
.
bytes
=
SYSTABLE_SCH_
DB
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"column_name"
,
.
bytes
=
64
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"db_name"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"table_name"
,
.
bytes
=
SYSTABLE_SCH_
TABLE
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_database"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_name"
,
.
bytes
=
SYSTABLE_SCH_
TABLE
_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"column_name"
,
.
bytes
=
SYSTABLE_SCH_COL_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_type"
,
.
bytes
=
10
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
{.
name
=
"index_extensions"
,
.
bytes
=
256
,
.
type
=
TSDB_DATA_TYPE_BINARY
},
};
...
...
@@ -183,6 +199,9 @@ static const SInfosTableMeta infosMeta[] = {
{
TSDB_INS_TABLE_MNODES
,
mnodesSchema
,
tListLen
(
mnodesSchema
)},
{
TSDB_INS_TABLE_MODULES
,
modulesSchema
,
tListLen
(
modulesSchema
)},
{
TSDB_INS_TABLE_QNODES
,
qnodesSchema
,
tListLen
(
qnodesSchema
)},
{
TSDB_INS_TABLE_BNODES
,
bnodesSchema
,
tListLen
(
bnodesSchema
)},
{
TSDB_INS_TABLE_CLUSTER
,
clusterSchema
,
tListLen
(
clusterSchema
)},
{
TSDB_INS_TABLE_SNODES
,
snodesSchema
,
tListLen
(
snodesSchema
)},
{
TSDB_INS_TABLE_USER_DATABASES
,
userDBSchema
,
tListLen
(
userDBSchema
)},
{
TSDB_INS_TABLE_USER_FUNCTIONS
,
userFuncSchema
,
tListLen
(
userFuncSchema
)},
{
TSDB_INS_TABLE_USER_INDEXES
,
userIdxSchema
,
tListLen
(
userIdxSchema
)},
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
3d6030a4
...
...
@@ -77,10 +77,8 @@ int32_t mndInitProfile(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQueryReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConnReq
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndGetConnsMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndRetrieveConns
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndCancelGetNextConn
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndGetQueryMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndRetrieveQueries
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndCancelGetNextQuery
);
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
3d6030a4
...
...
@@ -58,7 +58,6 @@ int32_t mndInitStream(SMnode *pMnode) {
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM, mndProcessDropStreamReq);*/
/*mndSetMsgHandle(pMnode, TDMT_MND_DROP_STREAM_RSP, mndProcessDropStreamInRsp);*/
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_TP
,
mndGetStreamMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_TP
,
mndRetrieveStream
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_TP
,
mndCancelGetNextStream
);
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/CMakeLists.txt
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/bnode/bnode.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/mnode/mnode.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/qnode/qnode.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/snode/snode.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/test/trans/trans.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/CMakeLists.txt
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tq.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbFile.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbSma.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/catalog/src/catalog.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/inc/executil.h
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/inc/executorimpl.h
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/inc/tsort.h
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/src/dataDispatcher.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/src/executorimpl.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/src/groupoperator.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/src/scanoperator.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/src/tlinearhash.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/src/tsimplehash.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/src/tsort.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/executor/test/sortTests.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/function/src/builtinsimpl.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/monitor/inc/monInt.h
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/monitor/src/mon
itor
.c
→
source/libs/monitor/src/mon
Main
.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/monitor/src/monMsg.c
0 → 100644
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/monitor/test/CMakeLists.txt
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/monitor/test/monTest.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesToSQLFuncs.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/inc/parAst.h
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/inc/sql.y
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/src/parAstCreater.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/src/parCalcConst.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsert.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/src/parTokenizer.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/src/sql.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/parser/test/parserAstTest.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/planner/src/planLogicCreater.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/planner/test/plannerTest.cpp
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/scalar/src/filter.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/scalar/src/scalar.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclvector.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/scheduler/src/scheduler.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/tdb/src/db/tdbPCache.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/transport/src/rpcMain.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/transport/src/thttp.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/os/src/osSysinfo.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/util/src/tcompare.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/util/src/tconfig.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
source/util/src/tpagedbuf.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/jenkins/basic.txt
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/tsim/bnode/basic1.sim
0 → 100644
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/tsim/insert/backquote.sim
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/tsim/qnode/basic1.sim
0 → 100644
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/tsim/query/stddev.sim
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/tsim/snode/basic1.sim
0 → 100644
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/tsim/testCaseSuite.sim
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/script/tsim/tmq/basic1.sim
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
tests/test/c/tmqSim.c
浏览文件 @
3d6030a4
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录