Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6874016b
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6874016b
编写于
6月 01, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/tq
上级
66899bd8
321e23fe
变更
106
展开全部
显示空白变更内容
内联
并排
Showing
106 changed file
with
5155 addition
and
626 deletion
+5155
-626
include/common/tmsg.h
include/common/tmsg.h
+33
-7
include/common/tmsgdef.h
include/common/tmsgdef.h
+1
-0
include/dnode/qnode/qnode.h
include/dnode/qnode/qnode.h
+0
-14
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+8
-0
include/libs/index/index.h
include/libs/index/index.h
+1
-0
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+5
-0
include/libs/qworker/qworker.h
include/libs/qworker/qworker.h
+14
-8
include/util/taoserror.h
include/util/taoserror.h
+3
-2
include/util/tdef.h
include/util/tdef.h
+2
-3
include/util/tencode.h
include/util/tencode.h
+12
-8
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+4
-1
source/client/src/clientHb.c
source/client/src/clientHb.c
+4
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+63
-13
source/common/src/systable.c
source/common/src/systable.c
+0
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+73
-10
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+2
-1
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+2
-0
source/dnode/mgmt/mgmt_dnode/src/dmInt.c
source/dnode/mgmt/mgmt_dnode/src/dmInt.c
+1
-0
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
+8
-0
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+2
-1
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+1
-1
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
+1
-0
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
+1
-0
source/dnode/mgmt/node_mgmt/src/dmEnv.c
source/dnode/mgmt/node_mgmt/src/dmEnv.c
+1
-0
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
+14
-0
source/dnode/mgmt/node_util/inc/dmUtil.h
source/dnode/mgmt/node_util/inc/dmUtil.h
+4
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+16
-65
source/dnode/mnode/impl/inc/mndQnode.h
source/dnode/mnode/impl/inc/mndQnode.h
+6
-0
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+3
-3
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+1
-1
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+2
-2
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+2
-5
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+3
-3
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+3
-3
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+10
-7
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+2
-2
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+11
-10
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+1
-1
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+4
-0
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+42
-29
source/dnode/mnode/impl/src/mndSma.c
source/dnode/mnode/impl/src/mndSma.c
+11
-5
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+2
-2
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+3
-3
source/dnode/mnode/impl/src/mndStream.c
source/dnode/mnode/impl/src/mndStream.c
+1
-1
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+6
-7
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+2
-2
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+93
-172
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+4
-8
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-0
source/dnode/mnode/impl/test/trans/trans2.cpp
source/dnode/mnode/impl/test/trans/trans2.cpp
+9
-5
source/dnode/mnode/impl/test/user/CMakeLists.txt
source/dnode/mnode/impl/test/user/CMakeLists.txt
+6
-4
source/dnode/qnode/src/qnode.c
source/dnode/qnode/src/qnode.c
+17
-5
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+14
-1
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+5
-3
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+97
-22
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+2
-2
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+1
-1
source/dnode/vnode/src/vnd/vnodeCfg.c
source/dnode/vnode/src/vnd/vnodeCfg.c
+3
-0
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+1
-1
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+7
-7
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+3
-3
source/libs/catalog/src/ctgCache.c
source/libs/catalog/src/ctgCache.c
+19
-19
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+1
-1
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+4
-4
source/libs/executor/inc/dataSinkInt.h
source/libs/executor/inc/dataSinkInt.h
+2
-0
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+23
-1
source/libs/executor/src/dataSinkMgt.c
source/libs/executor/src/dataSinkMgt.c
+14
-0
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+2
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+2
-0
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+30
-2
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+6
-1
source/libs/index/CMakeLists.txt
source/libs/index/CMakeLists.txt
+1
-0
source/libs/index/inc/indexCache.h
source/libs/index/inc/indexCache.h
+1
-0
source/libs/index/inc/indexComm.h
source/libs/index/inc/indexComm.h
+3
-2
source/libs/index/src/index.c
source/libs/index/src/index.c
+14
-9
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+5
-2
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+4
-1
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+61
-3
source/libs/index/src/indexJson.c
source/libs/index/src/indexJson.c
+3
-3
source/libs/monitor/src/monMsg.c
source/libs/monitor/src/monMsg.c
+47
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+1
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+8
-4
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+1
-1
source/libs/qworker/inc/qwInt.h
source/libs/qworker/inc/qwInt.h
+28
-8
source/libs/qworker/src/qwMsg.c
source/libs/qworker/src/qwMsg.c
+16
-7
source/libs/qworker/src/qwUtil.c
source/libs/qworker/src/qwUtil.c
+11
-10
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+24
-3
source/libs/scalar/test/scalar/CMakeLists.txt
source/libs/scalar/test/scalar/CMakeLists.txt
+6
-4
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+4
-5
source/libs/scheduler/src/schJob.c
source/libs/scheduler/src/schJob.c
+82
-29
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+2
-18
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+6
-2
source/libs/tdb/src/db/tdbTable.c
source/libs/tdb/src/db/tdbTable.c
+4
-4
source/util/src/terror.c
source/util/src/terror.c
+1
-0
tests/pytest/util/common.py
tests/pytest/util/common.py
+6
-2
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-1
tests/script/tsim/mnode/basic3.sim
tests/script/tsim/mnode/basic3.sim
+6
-1
tests/script/tsim/stable/tag_filter.sim
tests/script/tsim/stable/tag_filter.sim
+59
-0
tests/script/tsim/trans/create_db.sim
tests/script/tsim/trans/create_db.sim
+1
-17
tests/system-test/1-insert/influxdb_line_taosc_insert.py
tests/system-test/1-insert/influxdb_line_taosc_insert.py
+1333
-0
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
+1788
-0
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
...system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
+2
-2
tests/system-test/2-query/function_stateduration.py
tests/system-test/2-query/function_stateduration.py
+431
-0
tests/system-test/2-query/statecount.py
tests/system-test/2-query/statecount.py
+431
-0
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+4
-0
tests/test/c/sdbDump.c
tests/test/c/sdbDump.c
+2
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
6874016b
...
@@ -791,19 +791,24 @@ typedef struct {
...
@@ -791,19 +791,24 @@ typedef struct {
int32_t
tSerializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tSerializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
}
SQueryNodeAddr
;
typedef
struct
{
typedef
struct
{
SArray
*
addrsList
;
// SArray<SQueryNodeAddr>
SQueryNodeAddr
addr
;
uint64_t
load
;
}
SQueryNodeLoad
;
typedef
struct
{
SArray
*
qnodeList
;
// SArray<SQueryNodeLoad>
}
SQnodeListRsp
;
}
SQnodeListRsp
;
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
);
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
);
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
}
SQueryNodeAddr
;
typedef
struct
{
typedef
struct
{
SArray
*
pArray
;
// Array of SUseDbRsp
SArray
*
pArray
;
// Array of SUseDbRsp
}
SUseDbBatchRsp
;
}
SUseDbBatchRsp
;
...
@@ -926,6 +931,21 @@ typedef struct {
...
@@ -926,6 +931,21 @@ typedef struct {
int32_t
syncState
;
int32_t
syncState
;
}
SMnodeLoad
;
}
SMnodeLoad
;
typedef
struct
{
int32_t
dnodeId
;
int64_t
numOfProcessedQuery
;
int64_t
numOfProcessedCQuery
;
int64_t
numOfProcessedFetch
;
int64_t
numOfProcessedDrop
;
int64_t
numOfProcessedHb
;
int64_t
cacheDataSize
;
int64_t
numOfQueryInQueue
;
int64_t
numOfFetchInQueue
;
int64_t
timeInQueryQueue
;
int64_t
timeInFetchQueue
;
}
SQnodeLoad
;
typedef
struct
{
typedef
struct
{
int32_t
sver
;
// software version
int32_t
sver
;
// software version
int64_t
dnodeVer
;
// dnode table version in sdb
int64_t
dnodeVer
;
// dnode table version in sdb
...
@@ -937,6 +957,7 @@ typedef struct {
...
@@ -937,6 +957,7 @@ typedef struct {
int32_t
numOfSupportVnodes
;
int32_t
numOfSupportVnodes
;
char
dnodeEp
[
TSDB_EP_LEN
];
char
dnodeEp
[
TSDB_EP_LEN
];
SMnodeLoad
mload
;
SMnodeLoad
mload
;
SQnodeLoad
qload
;
SClusterCfg
clusterCfg
;
SClusterCfg
clusterCfg
;
SArray
*
pVloads
;
// array of SVnodeLoad
SArray
*
pVloads
;
// array of SVnodeLoad
}
SStatusReq
;
}
SStatusReq
;
...
@@ -1012,6 +1033,7 @@ typedef struct {
...
@@ -1012,6 +1033,7 @@ typedef struct {
// for tsma
// for tsma
int8_t
isTsma
;
int8_t
isTsma
;
void
*
pTsma
;
}
SCreateVnodeReq
;
}
SCreateVnodeReq
;
...
@@ -1946,6 +1968,7 @@ typedef struct {
...
@@ -1946,6 +1968,7 @@ typedef struct {
int8_t
killConnection
;
int8_t
killConnection
;
int8_t
align
[
3
];
int8_t
align
[
3
];
SEpSet
epSet
;
SEpSet
epSet
;
SArray
*
pQnodeList
;
}
SQueryHbRspBasic
;
}
SQueryHbRspBasic
;
typedef
struct
{
typedef
struct
{
...
@@ -2025,7 +2048,10 @@ static FORCE_INLINE void tFreeClientKv(void* pKv) {
...
@@ -2025,7 +2048,10 @@ static FORCE_INLINE void tFreeClientKv(void* pKv) {
static
FORCE_INLINE
void
tFreeClientHbRsp
(
void
*
pRsp
)
{
static
FORCE_INLINE
void
tFreeClientHbRsp
(
void
*
pRsp
)
{
SClientHbRsp
*
rsp
=
(
SClientHbRsp
*
)
pRsp
;
SClientHbRsp
*
rsp
=
(
SClientHbRsp
*
)
pRsp
;
if
(
rsp
->
query
)
{
taosArrayDestroy
(
rsp
->
query
->
pQnodeList
);
taosMemoryFreeClear
(
rsp
->
query
);
taosMemoryFreeClear
(
rsp
->
query
);
}
if
(
rsp
->
info
)
taosArrayDestroyEx
(
rsp
->
info
,
tFreeClientKv
);
if
(
rsp
->
info
)
taosArrayDestroyEx
(
rsp
->
info
,
tFreeClientKv
);
}
}
...
...
include/common/tmsgdef.h
浏览文件 @
6874016b
...
@@ -252,6 +252,7 @@ enum {
...
@@ -252,6 +252,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MON_BM_INFO
,
"monitor-binfo"
,
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
)
TD_DEF_MSG_TYPE
(
TDMT_MON_VM_LOAD
,
"monitor-vload"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_MM_LOAD
,
"monitor-mload"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_MM_LOAD
,
"monitor-mload"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_QM_LOAD
,
"monitor-qload"
,
NULL
,
NULL
)
#if defined(TD_MSG_NUMBER_)
#if defined(TD_MSG_NUMBER_)
TDMT_MAX
TDMT_MAX
...
...
include/dnode/qnode/qnode.h
浏览文件 @
6874016b
...
@@ -25,20 +25,6 @@ extern "C" {
...
@@ -25,20 +25,6 @@ extern "C" {
/* ------------------------ TYPES EXPOSED ------------------------ */
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SQnode
SQnode
;
typedef
struct
SQnode
SQnode
;
typedef
struct
{
int64_t
numOfProcessedQuery
;
int64_t
numOfProcessedCQuery
;
int64_t
numOfProcessedFetch
;
int64_t
numOfProcessedDrop
;
int64_t
memSizeInCache
;
int64_t
dataSizeSend
;
int64_t
dataSizeRecv
;
int64_t
numOfQueryInQueue
;
int64_t
numOfFetchInQueue
;
int64_t
waitTimeInQueryQUeue
;
int64_t
waitTimeInFetchQUeue
;
}
SQnodeLoad
;
typedef
struct
{
typedef
struct
{
SMsgCb
msgCb
;
SMsgCb
msgCb
;
}
SQnodeOpt
;
}
SQnodeOpt
;
...
...
include/libs/executor/dataSinkMgt.h
浏览文件 @
6874016b
...
@@ -32,6 +32,10 @@ extern "C" {
...
@@ -32,6 +32,10 @@ extern "C" {
struct
SDataSink
;
struct
SDataSink
;
struct
SSDataBlock
;
struct
SSDataBlock
;
typedef
struct
SDataSinkStat
{
uint64_t
cachedSize
;
}
SDataSinkStat
;
typedef
struct
SDataSinkMgtCfg
{
typedef
struct
SDataSinkMgtCfg
{
uint32_t
maxDataBlockNum
;
// todo: this should be numOfRows?
uint32_t
maxDataBlockNum
;
// todo: this should be numOfRows?
uint32_t
maxDataBlockNumPerQuery
;
uint32_t
maxDataBlockNumPerQuery
;
...
@@ -62,6 +66,8 @@ typedef struct SOutputData {
...
@@ -62,6 +66,8 @@ typedef struct SOutputData {
*/
*/
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
);
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
);
int32_t
dsDataSinkGetCacheSize
(
SDataSinkStat
*
pStat
);
/**
/**
* Put the result set returned by the executor into datasinker.
* Put the result set returned by the executor into datasinker.
* @param handle
* @param handle
...
@@ -88,6 +94,8 @@ void dsGetDataLength(DataSinkHandle handle, int32_t* pLen, bool* pQueryEnd);
...
@@ -88,6 +94,8 @@ void dsGetDataLength(DataSinkHandle handle, int32_t* pLen, bool* pQueryEnd);
*/
*/
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOutputData
*
pOutput
);
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOutputData
*
pOutput
);
int32_t
dsGetCacheSize
(
DataSinkHandle
handle
,
uint64_t
*
pSize
);
/**
/**
* After dsGetStatus returns DS_NEED_SCHEDULE, the caller need to put this into the work queue.
* After dsGetStatus returns DS_NEED_SCHEDULE, the caller need to put this into the work queue.
* @param ahandle
* @param ahandle
...
...
include/libs/index/index.h
浏览文件 @
6874016b
...
@@ -194,6 +194,7 @@ void indexInit();
...
@@ -194,6 +194,7 @@ void indexInit();
/* index filter */
/* index filter */
typedef
struct
SIndexMetaArg
{
typedef
struct
SIndexMetaArg
{
void
*
metaHandle
;
void
*
metaHandle
;
void
*
metaEx
;
uint64_t
suid
;
uint64_t
suid
;
}
SIndexMetaArg
;
}
SIndexMetaArg
;
...
...
include/libs/monitor/monitor.h
浏览文件 @
6874016b
...
@@ -171,6 +171,7 @@ void tFreeSMonVmInfo(SMonVmInfo *pInfo);
...
@@ -171,6 +171,7 @@ void tFreeSMonVmInfo(SMonVmInfo *pInfo);
typedef
struct
{
typedef
struct
{
SMonSysInfo
sys
;
SMonSysInfo
sys
;
SMonLogs
log
;
SMonLogs
log
;
SQnodeLoad
load
;
}
SMonQmInfo
;
}
SMonQmInfo
;
int32_t
tSerializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
);
int32_t
tSerializeSMonQmInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonQmInfo
*
pInfo
);
...
@@ -210,6 +211,10 @@ typedef struct {
...
@@ -210,6 +211,10 @@ typedef struct {
int32_t
tSerializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
);
int32_t
tSerializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
);
int32_t
tDeserializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
);
int32_t
tDeserializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
);
int32_t
tSerializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
);
int32_t
tDeserializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
);
typedef
struct
{
typedef
struct
{
const
char
*
server
;
const
char
*
server
;
uint16_t
port
;
uint16_t
port
;
...
...
include/libs/qworker/qworker.h
浏览文件 @
6874016b
...
@@ -22,7 +22,7 @@ extern "C" {
...
@@ -22,7 +22,7 @@ extern "C" {
#include "tmsgcb.h"
#include "tmsgcb.h"
#include "trpc.h"
#include "trpc.h"
#include "executor.h"
enum
{
enum
{
NODE_TYPE_VNODE
=
1
,
NODE_TYPE_VNODE
=
1
,
...
@@ -40,13 +40,19 @@ typedef struct SQWorkerCfg {
...
@@ -40,13 +40,19 @@ typedef struct SQWorkerCfg {
}
SQWorkerCfg
;
}
SQWorkerCfg
;
typedef
struct
{
typedef
struct
{
uint64_t
numOfStartTask
;
uint64_t
cacheDataSize
;
uint64_t
numOfStopTask
;
uint64_t
numOfRecvedFetch
;
uint64_t
queryProcessed
;
uint64_t
numOfSentHb
;
uint64_t
cqueryProcessed
;
uint64_t
numOfSentFetch
;
uint64_t
fetchProcessed
;
uint64_t
numOfTaskInQueue
;
uint64_t
dropProcessed
;
uint64_t
hbProcessed
;
uint64_t
numOfQueryInQueue
;
uint64_t
numOfFetchInQueue
;
uint64_t
numOfFetchInQueue
;
uint64_t
timeInQueryQueue
;
uint64_t
timeInFetchQueue
;
uint64_t
numOfErrors
;
uint64_t
numOfErrors
;
}
SQWorkerStat
;
}
SQWorkerStat
;
...
@@ -68,7 +74,7 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_
...
@@ -68,7 +74,7 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_
void
qWorkerDestroy
(
void
**
qWorkerMgmt
);
void
qWorkerDestroy
(
void
**
qWorkerMgmt
);
int
64_t
qWorkerGetWaitTimeInQueue
(
void
*
qWorkerMgmt
,
EQueueType
type
);
int
32_t
qWorkerGetStat
(
SReadHandle
*
handle
,
void
*
qWorkerMgmt
,
SQWorkerStat
*
pStat
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/taoserror.h
浏览文件 @
6874016b
...
@@ -182,8 +182,9 @@ int32_t* taosGetErrno();
...
@@ -182,8 +182,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_BNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0356)
#define TSDB_CODE_MND_BNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0356)
#define TSDB_CODE_MND_BNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0357)
#define TSDB_CODE_MND_BNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0357)
#define TSDB_CODE_MND_TOO_FEW_MNODES TAOS_DEF_ERROR_CODE(0, 0x0358)
#define TSDB_CODE_MND_TOO_FEW_MNODES TAOS_DEF_ERROR_CODE(0, 0x0358)
#define TSDB_CODE_MND_MNODE_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x0359)
#define TSDB_CODE_MND_TOO_MANY_MNODES TAOS_DEF_ERROR_CODE(0, 0x0359)
#define TSDB_CODE_MND_CANT_DROP_MASTER TAOS_DEF_ERROR_CODE(0, 0x035A)
#define TSDB_CODE_MND_MNODE_DEPLOYED TAOS_DEF_ERROR_CODE(0, 0x035A)
#define TSDB_CODE_MND_CANT_DROP_MASTER TAOS_DEF_ERROR_CODE(0, 0x035B)
// mnode-acct
// mnode-acct
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
#define TSDB_CODE_MND_ACCT_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360)
...
...
include/util/tdef.h
浏览文件 @
6874016b
...
@@ -253,8 +253,7 @@ typedef enum ELogicConditionType {
...
@@ -253,8 +253,7 @@ typedef enum ELogicConditionType {
#define TSDB_TRANS_STAGE_LEN 12
#define TSDB_TRANS_STAGE_LEN 12
#define TSDB_TRANS_TYPE_LEN 16
#define TSDB_TRANS_TYPE_LEN 16
#define TSDB_TRANS_ERROR_LEN 64
#define TSDB_TRANS_ERROR_LEN 512
#define TSDB_TRANS_DESC_LEN 128
#define TSDB_STEP_NAME_LEN 32
#define TSDB_STEP_NAME_LEN 32
#define TSDB_STEP_DESC_LEN 128
#define TSDB_STEP_DESC_LEN 128
...
@@ -343,7 +342,7 @@ typedef enum ELogicConditionType {
...
@@ -343,7 +342,7 @@ typedef enum ELogicConditionType {
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
#define TSDB_DEFAULT_DB_SCHEMALESS TSDB_DB_SCHEMALESS_OFF
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MIN_ROLLUP_FILE_FACTOR 0
#define TSDB_MAX_ROLLUP_FILE_FACTOR 1
#define TSDB_MAX_ROLLUP_FILE_FACTOR 1
0
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
#define TSDB_DEFAULT_ROLLUP_FILE_FACTOR 0.1
#define TSDB_MIN_TABLE_TTL 0
#define TSDB_MIN_TABLE_TTL 0
#define TSDB_DEFAULT_TABLE_TTL 0
#define TSDB_DEFAULT_TABLE_TTL 0
...
...
include/util/tencode.h
浏览文件 @
6874016b
...
@@ -378,14 +378,16 @@ static FORCE_INLINE int32_t tDecodeDouble(SDecoder* pCoder, double* val) {
...
@@ -378,14 +378,16 @@ static FORCE_INLINE int32_t tDecodeDouble(SDecoder* pCoder, double* val) {
}
}
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
uint8_t
**
val
,
uint32_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeBinary
(
SDecoder
*
pCoder
,
uint8_t
**
val
,
uint32_t
*
len
)
{
if
(
tDecodeU32v
(
pCoder
,
len
)
<
0
)
return
-
1
;
uint32_t
length
=
0
;
if
(
tDecodeU32v
(
pCoder
,
&
length
)
<
0
)
return
-
1
;
if
(
len
)
*
len
=
length
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
*
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
length
))
return
-
1
;
if
(
val
)
{
if
(
val
)
{
*
val
=
(
uint8_t
*
)
TD_CODER_CURRENT
(
pCoder
);
*
val
=
(
uint8_t
*
)
TD_CODER_CURRENT
(
pCoder
);
}
}
TD_CODER_MOVE_POS
(
pCoder
,
*
len
);
TD_CODER_MOVE_POS
(
pCoder
,
length
);
return
0
;
return
0
;
}
}
...
@@ -410,14 +412,16 @@ static int32_t tDecodeCStrTo(SDecoder* pCoder, char* val) {
...
@@ -410,14 +412,16 @@ static int32_t tDecodeCStrTo(SDecoder* pCoder, char* val) {
}
}
static
FORCE_INLINE
int32_t
tDecodeBinaryAlloc
(
SDecoder
*
pCoder
,
void
**
val
,
uint64_t
*
len
)
{
static
FORCE_INLINE
int32_t
tDecodeBinaryAlloc
(
SDecoder
*
pCoder
,
void
**
val
,
uint64_t
*
len
)
{
if
(
tDecodeU64v
(
pCoder
,
len
)
<
0
)
return
-
1
;
uint64_t
length
=
0
;
if
(
tDecodeU64v
(
pCoder
,
&
length
)
<
0
)
return
-
1
;
if
(
len
)
*
len
=
length
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
*
len
))
return
-
1
;
if
(
TD_CODER_CHECK_CAPACITY_FAILED
(
pCoder
,
length
))
return
-
1
;
*
val
=
taosMemoryMalloc
(
*
len
);
*
val
=
taosMemoryMalloc
(
length
);
if
(
*
val
==
NULL
)
return
-
1
;
if
(
*
val
==
NULL
)
return
-
1
;
memcpy
(
*
val
,
TD_CODER_CURRENT
(
pCoder
),
*
len
);
memcpy
(
*
val
,
TD_CODER_CURRENT
(
pCoder
),
length
);
TD_CODER_MOVE_POS
(
pCoder
,
*
len
);
TD_CODER_MOVE_POS
(
pCoder
,
length
);
return
0
;
return
0
;
}
}
...
...
source/client/inc/clientInt.h
浏览文件 @
6874016b
...
@@ -119,6 +119,8 @@ typedef struct SHeartBeatInfo {
...
@@ -119,6 +119,8 @@ typedef struct SHeartBeatInfo {
struct
SAppInstInfo
{
struct
SAppInstInfo
{
int64_t
numOfConns
;
int64_t
numOfConns
;
SCorEpSet
mgmtEp
;
SCorEpSet
mgmtEp
;
TdThreadMutex
qnodeMutex
;
SArray
*
pQnodeList
;
SInstanceSummary
summary
;
SInstanceSummary
summary
;
SList
*
pConnList
;
// STscObj linked list
SList
*
pConnList
;
// STscObj linked list
uint64_t
clusterId
;
uint64_t
clusterId
;
...
@@ -290,7 +292,7 @@ SRequestObj* launchQuery(STscObj* pTscObj, const char* sql, int sqlLen);
...
@@ -290,7 +292,7 @@ SRequestObj* launchQuery(STscObj* pTscObj, const char* sql, int sqlLen);
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
,
SStmtCallback
*
pStmtCb
);
int32_t
parseSql
(
SRequestObj
*
pRequest
,
bool
topicQuery
,
SQuery
**
pQuery
,
SStmtCallback
*
pStmtCb
);
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SQueryPlan
**
pPlan
,
SArray
*
pNodeList
);
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SQueryPlan
**
pPlan
,
SArray
*
*
pNodeList
);
int32_t
buildRequest
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
SRequestObj
**
pRequest
);
int32_t
buildRequest
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
SRequestObj
**
pRequest
);
...
@@ -317,6 +319,7 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
...
@@ -317,6 +319,7 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
int32_t
getQueryPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SArray
**
pNodeList
);
int32_t
getQueryPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SArray
**
pNodeList
);
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryPlan
*
pDag
,
SArray
*
pNodeList
,
void
**
res
);
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryPlan
*
pDag
,
SArray
*
pNodeList
,
void
**
res
);
int32_t
refreshMeta
(
STscObj
*
pTscObj
,
SRequestObj
*
pRequest
);
int32_t
refreshMeta
(
STscObj
*
pTscObj
,
SRequestObj
*
pRequest
);
int32_t
updateQnodeList
(
SAppInstInfo
*
pInfo
,
SArray
*
pNodeList
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/client/src/clientHb.c
浏览文件 @
6874016b
...
@@ -160,6 +160,10 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
...
@@ -160,6 +160,10 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) {
taos_close
(
pTscObj
);
taos_close
(
pTscObj
);
}
}
if
(
pRsp
->
query
->
pQnodeList
)
{
updateQnodeList
(
pTscObj
->
pAppInfo
,
pRsp
->
query
->
pQnodeList
);
}
releaseTscObj
(
pRsp
->
connKey
.
tscRid
);
releaseTscObj
(
pRsp
->
connKey
.
tscRid
);
}
}
}
}
...
...
source/client/src/clientImpl.c
浏览文件 @
6874016b
...
@@ -118,6 +118,7 @@ TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass,
...
@@ -118,6 +118,7 @@ TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass,
if
(
pInst
==
NULL
)
{
if
(
pInst
==
NULL
)
{
p
=
taosMemoryCalloc
(
1
,
sizeof
(
struct
SAppInstInfo
));
p
=
taosMemoryCalloc
(
1
,
sizeof
(
struct
SAppInstInfo
));
p
->
mgmtEp
=
epSet
;
p
->
mgmtEp
=
epSet
;
taosThreadMutexInit
(
&
p
->
qnodeMutex
,
NULL
);
p
->
pTransporter
=
openTransporter
(
user
,
secretEncrypt
,
tsNumOfCores
);
p
->
pTransporter
=
openTransporter
(
user
,
secretEncrypt
,
tsNumOfCores
);
p
->
pAppHbMgr
=
appHbMgrInit
(
p
,
key
);
p
->
pAppHbMgr
=
appHbMgrInit
(
p
,
key
);
taosHashPut
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
),
&
p
,
POINTER_BYTES
);
taosHashPut
(
appInfo
.
pInstMap
,
key
,
strlen
(
key
),
&
p
,
POINTER_BYTES
);
...
@@ -228,7 +229,61 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
...
@@ -228,7 +229,61 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SQueryPlan
**
pPlan
,
SArray
*
pNodeList
)
{
int
compareQueryNodeLoad
(
const
void
*
elem1
,
const
void
*
elem2
)
{
SQueryNodeLoad
*
node1
=
(
SQueryNodeLoad
*
)
elem1
;
SQueryNodeLoad
*
node2
=
(
SQueryNodeLoad
*
)
elem2
;
if
(
node1
->
load
<
node2
->
load
)
{
return
-
1
;
}
return
node1
->
load
>
node2
->
load
;
}
int32_t
updateQnodeList
(
SAppInstInfo
*
pInfo
,
SArray
*
pNodeList
)
{
taosThreadMutexLock
(
&
pInfo
->
qnodeMutex
);
if
(
pInfo
->
pQnodeList
)
{
taosArrayDestroy
(
pInfo
->
pQnodeList
);
pInfo
->
pQnodeList
=
NULL
;
}
if
(
pNodeList
)
{
pInfo
->
pQnodeList
=
taosArrayDup
(
pNodeList
);
taosArraySort
(
pInfo
->
pQnodeList
,
compareQueryNodeLoad
);
}
taosThreadMutexUnlock
(
&
pInfo
->
qnodeMutex
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
getQnodeList
(
SRequestObj
*
pRequest
,
SArray
**
pNodeList
)
{
SAppInstInfo
*
pInfo
=
pRequest
->
pTscObj
->
pAppInfo
;
int32_t
code
=
0
;
taosThreadMutexLock
(
&
pInfo
->
qnodeMutex
);
if
(
pInfo
->
pQnodeList
)
{
*
pNodeList
=
taosArrayDup
(
pInfo
->
pQnodeList
);
}
taosThreadMutexUnlock
(
&
pInfo
->
qnodeMutex
);
if
(
NULL
==
*
pNodeList
)
{
SEpSet
mgmtEpSet
=
getEpSet_s
(
&
pRequest
->
pTscObj
->
pAppInfo
->
mgmtEp
);
SCatalog
*
pCatalog
=
NULL
;
code
=
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pNodeList
=
taosArrayInit
(
5
,
sizeof
(
SQueryNodeLoad
));
code
=
catalogGetQnodeList
(
pCatalog
,
pRequest
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
mgmtEpSet
,
*
pNodeList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
*
pNodeList
)
{
code
=
updateQnodeList
(
pInfo
,
*
pNodeList
);
}
}
return
code
;
}
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SQueryPlan
**
pPlan
,
SArray
**
pNodeList
)
{
pRequest
->
type
=
pQuery
->
msgType
;
pRequest
->
type
=
pQuery
->
msgType
;
SPlanContext
cxt
=
{.
queryId
=
pRequest
->
requestId
,
SPlanContext
cxt
=
{.
queryId
=
pRequest
->
requestId
,
.
acctId
=
pRequest
->
pTscObj
->
acctId
,
.
acctId
=
pRequest
->
pTscObj
->
acctId
,
...
@@ -237,14 +292,10 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra
...
@@ -237,14 +292,10 @@ int32_t getPlan(SRequestObj* pRequest, SQuery* pQuery, SQueryPlan** pPlan, SArra
.
showRewrite
=
pQuery
->
showRewrite
,
.
showRewrite
=
pQuery
->
showRewrite
,
.
pMsg
=
pRequest
->
msgBuf
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
};
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
};
SEpSet
mgmtEpSet
=
getEpSet_s
(
&
pRequest
->
pTscObj
->
pAppInfo
->
mgmtEp
);
SCatalog
*
pCatalog
=
NULL
;
int32_t
code
=
getQnodeList
(
pRequest
,
pNodeList
);
int32_t
code
=
catalogGetHandle
(
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
,
&
pCatalog
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
catalogGetQnodeList
(
pCatalog
,
pRequest
->
pTscObj
->
pAppInfo
->
pTransporter
,
&
mgmtEpSet
,
pNodeList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
qCreateQueryPlan
(
&
cxt
,
pPlan
,
pNodeList
);
code
=
qCreateQueryPlan
(
&
cxt
,
pPlan
,
*
pNodeList
);
}
}
return
code
;
return
code
;
}
}
...
@@ -369,8 +420,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
...
@@ -369,8 +420,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
}
}
int32_t
getQueryPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SArray
**
pNodeList
)
{
int32_t
getQueryPlan
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
SArray
**
pNodeList
)
{
*
pNodeList
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
));
return
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
pNodeList
);
return
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
*
pNodeList
);
}
}
int32_t
validateSversion
(
SRequestObj
*
pRequest
,
void
*
res
)
{
int32_t
validateSversion
(
SRequestObj
*
pRequest
,
void
*
res
)
{
...
@@ -456,8 +506,8 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
...
@@ -456,8 +506,8 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
code
=
execDdlQuery
(
pRequest
,
pQuery
);
code
=
execDdlQuery
(
pRequest
,
pQuery
);
break
;
break
;
case
QUERY_EXEC_MODE_SCHEDULE
:
{
case
QUERY_EXEC_MODE_SCHEDULE
:
{
SArray
*
pNodeList
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
))
;
SArray
*
pNodeList
=
NULL
;
code
=
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
pNodeList
);
code
=
getPlan
(
pRequest
,
pQuery
,
&
pRequest
->
body
.
pDag
,
&
pNodeList
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
scheduleQuery
(
pRequest
,
pRequest
->
body
.
pDag
,
pNodeList
,
&
pRes
);
code
=
scheduleQuery
(
pRequest
,
pRequest
->
body
.
pDag
,
pNodeList
,
&
pRes
);
if
(
NULL
!=
pRes
)
{
if
(
NULL
!=
pRes
)
{
...
...
source/common/src/systable.c
浏览文件 @
6874016b
...
@@ -215,7 +215,6 @@ static const SSysDbTableSchema transSchema[] = {
...
@@ -215,7 +215,6 @@ static const SSysDbTableSchema transSchema[] = {
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"stage"
,
.
bytes
=
TSDB_TRANS_STAGE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"stage"
,
.
bytes
=
TSDB_TRANS_STAGE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"db"
,
.
bytes
=
SYSTABLE_SCH_DB_NAME_LEN
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"type"
,
.
bytes
=
TSDB_TRANS_TYPE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"failed_times"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"failed_times"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"last_exec_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"last_exec_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"last_error"
,
.
bytes
=
(
TSDB_TRANS_ERROR_LEN
-
1
)
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"last_error"
,
.
bytes
=
(
TSDB_TRANS_ERROR_LEN
-
1
)
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
...
...
source/common/src/tmsg.c
浏览文件 @
6874016b
...
@@ -147,12 +147,25 @@ int32_t tEncodeSQueryNodeAddr(SEncoder *pEncoder, SQueryNodeAddr *pAddr) {
...
@@ -147,12 +147,25 @@ int32_t tEncodeSQueryNodeAddr(SEncoder *pEncoder, SQueryNodeAddr *pAddr) {
return
0
;
return
0
;
}
}
int32_t
tEncodeSQueryNodeLoad
(
SEncoder
*
pEncoder
,
SQueryNodeLoad
*
pLoad
)
{
if
(
tEncodeSQueryNodeAddr
(
pEncoder
,
&
pLoad
->
addr
)
<
0
)
return
-
1
;
if
(
tEncodeU64
(
pEncoder
,
pLoad
->
load
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
tDecodeSQueryNodeAddr
(
SDecoder
*
pDecoder
,
SQueryNodeAddr
*
pAddr
)
{
int32_t
tDecodeSQueryNodeAddr
(
SDecoder
*
pDecoder
,
SQueryNodeAddr
*
pAddr
)
{
if
(
tDecodeI32
(
pDecoder
,
&
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pAddr
->
nodeId
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pAddr
->
epSet
)
<
0
)
return
-
1
;
return
0
;
return
0
;
}
}
int32_t
tDecodeSQueryNodeLoad
(
SDecoder
*
pDecoder
,
SQueryNodeLoad
*
pLoad
)
{
if
(
tDecodeSQueryNodeAddr
(
pDecoder
,
&
pLoad
->
addr
)
<
0
)
return
-
1
;
if
(
tDecodeU64
(
pDecoder
,
&
pLoad
->
load
)
<
0
)
return
-
1
;
return
0
;
}
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
)
{
int32_t
taosEncodeSEpSet
(
void
**
buf
,
const
SEpSet
*
pEp
)
{
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pEp
->
inUse
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pEp
->
inUse
);
...
@@ -304,6 +317,12 @@ static int32_t tSerializeSClientHbRsp(SEncoder *pEncoder, const SClientHbRsp *pR
...
@@ -304,6 +317,12 @@ static int32_t tSerializeSClientHbRsp(SEncoder *pEncoder, const SClientHbRsp *pR
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
query
->
onlineDnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
pRsp
->
query
->
onlineDnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
query
->
killConnection
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pEncoder
,
pRsp
->
query
->
killConnection
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pRsp
->
query
->
epSet
)
<
0
)
return
-
1
;
if
(
tEncodeSEpSet
(
pEncoder
,
&
pRsp
->
query
->
epSet
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
query
->
pQnodeList
);
if
(
tEncodeI32
(
pEncoder
,
num
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SQueryNodeLoad
*
pLoad
=
taosArrayGet
(
pRsp
->
query
->
pQnodeList
,
i
);
if
(
tEncodeSQueryNodeLoad
(
pEncoder
,
pLoad
)
<
0
)
return
-
1
;
}
}
else
{
}
else
{
if
(
tEncodeI32
(
pEncoder
,
queryNum
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pEncoder
,
queryNum
)
<
0
)
return
-
1
;
}
}
...
@@ -333,6 +352,15 @@ static int32_t tDeserializeSClientHbRsp(SDecoder *pDecoder, SClientHbRsp *pRsp)
...
@@ -333,6 +352,15 @@ static int32_t tDeserializeSClientHbRsp(SDecoder *pDecoder, SClientHbRsp *pRsp)
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
query
->
onlineDnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pDecoder
,
&
pRsp
->
query
->
onlineDnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pRsp
->
query
->
killConnection
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pDecoder
,
&
pRsp
->
query
->
killConnection
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pRsp
->
query
->
epSet
)
<
0
)
return
-
1
;
if
(
tDecodeSEpSet
(
pDecoder
,
&
pRsp
->
query
->
epSet
)
<
0
)
return
-
1
;
int32_t
pQnodeNum
=
0
;
if
(
tDecodeI32
(
pDecoder
,
&
pQnodeNum
)
<
0
)
return
-
1
;
if
(
pQnodeNum
>
0
)
{
pRsp
->
query
->
pQnodeList
=
taosArrayInit
(
pQnodeNum
,
sizeof
(
SQueryNodeLoad
));
if
(
NULL
==
pRsp
->
query
->
pQnodeList
)
return
-
1
;
SQueryNodeLoad
load
=
{
0
};
if
(
tDecodeSQueryNodeLoad
(
pDecoder
,
&
load
)
<
0
)
return
-
1
;
taosArrayPush
(
pRsp
->
query
->
pQnodeList
,
&
load
);
}
}
}
int32_t
kvNum
=
0
;
int32_t
kvNum
=
0
;
...
@@ -898,6 +926,18 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -898,6 +926,18 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
// mnode loads
// mnode loads
if
(
tEncodeI32
(
&
encoder
,
pReq
->
mload
.
syncState
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
mload
.
syncState
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
qload
.
dnodeId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
numOfProcessedQuery
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
numOfProcessedCQuery
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
numOfProcessedFetch
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
numOfProcessedDrop
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
numOfProcessedHb
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
cacheDataSize
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
numOfQueryInQueue
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
numOfFetchInQueue
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
timeInQueryQueue
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
qload
.
timeInFetchQueue
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -955,6 +995,18 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -955,6 +995,18 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
mload
.
syncState
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
mload
.
syncState
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
qload
.
dnodeId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
numOfProcessedQuery
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
numOfProcessedCQuery
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
numOfProcessedFetch
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
numOfProcessedDrop
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
numOfProcessedHb
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
cacheDataSize
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
numOfQueryInQueue
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
numOfFetchInQueue
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
timeInQueryQueue
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
qload
.
timeInFetchQueue
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
return
0
;
...
@@ -1921,11 +1973,11 @@ int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp)
...
@@ -1921,11 +1973,11 @@ int32_t tSerializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp)
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
addrs
List
);
int32_t
num
=
taosArrayGetSize
(
pRsp
->
qnode
List
);
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SQueryNode
Addr
*
addr
=
taosArrayGet
(
pRsp
->
addrs
List
,
i
);
SQueryNode
Load
*
pLoad
=
taosArrayGet
(
pRsp
->
qnode
List
,
i
);
if
(
tEncodeSQueryNode
Addr
(
&
encoder
,
addr
)
<
0
)
return
-
1
;
if
(
tEncodeSQueryNode
Load
(
&
encoder
,
pLoad
)
<
0
)
return
-
1
;
}
}
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
...
@@ -1941,15 +1993,15 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
...
@@ -1941,15 +1993,15 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
int32_t
num
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
if
(
NULL
==
pRsp
->
addrs
List
)
{
if
(
NULL
==
pRsp
->
qnode
List
)
{
pRsp
->
addrsList
=
taosArrayInit
(
num
,
sizeof
(
SQueryNodeAddr
));
pRsp
->
qnodeList
=
taosArrayInit
(
num
,
sizeof
(
SQueryNodeLoad
));
if
(
NULL
==
pRsp
->
addrs
List
)
return
-
1
;
if
(
NULL
==
pRsp
->
qnode
List
)
return
-
1
;
}
}
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SQueryNode
Addr
addr
=
{
0
};
SQueryNode
Load
load
=
{
0
};
if
(
tDecodeSQueryNode
Addr
(
&
decoder
,
&
addr
)
<
0
)
return
-
1
;
if
(
tDecodeSQueryNode
Load
(
&
decoder
,
&
load
)
<
0
)
return
-
1
;
taosArrayPush
(
pRsp
->
addrsList
,
&
addr
);
taosArrayPush
(
pRsp
->
qnodeList
,
&
load
);
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
...
@@ -1957,7 +2009,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
...
@@ -1957,7 +2009,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
return
0
;
return
0
;
}
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
addrs
List
);
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
qnode
List
);
}
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
...
@@ -2921,6 +2973,11 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
...
@@ -2921,6 +2973,11 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
}
}
if
(
tEncodeI8
(
&
encoder
,
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
pReq
->
isTsma
)
{
uint32_t
tsmaLen
=
(
uint32_t
)(
htonl
(((
SMsgHead
*
)
pReq
->
pTsma
)
->
contLen
));
if
(
tEncodeBinary
(
&
encoder
,
(
const
uint8_t
*
)
pReq
->
pTsma
,
tsmaLen
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -2984,6 +3041,9 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
...
@@ -2984,6 +3041,9 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
}
}
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
isTsma
)
<
0
)
return
-
1
;
if
(
pReq
->
isTsma
)
{
if
(
tDecodeBinaryAlloc
(
&
decoder
,
&
pReq
->
pTsma
,
NULL
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
@@ -2993,6 +3053,9 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
...
@@ -2993,6 +3053,9 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
int32_t
tFreeSCreateVnodeReq
(
SCreateVnodeReq
*
pReq
)
{
int32_t
tFreeSCreateVnodeReq
(
SCreateVnodeReq
*
pReq
)
{
taosArrayDestroy
(
pReq
->
pRetensions
);
taosArrayDestroy
(
pReq
->
pRetensions
);
pReq
->
pRetensions
=
NULL
;
pReq
->
pRetensions
=
NULL
;
if
(
pReq
->
isTsma
)
{
taosMemoryFreeClear
(
pReq
->
pTsma
);
}
return
0
;
return
0
;
}
}
...
...
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
浏览文件 @
6874016b
...
@@ -35,6 +35,7 @@ typedef struct SDnodeMgmt {
...
@@ -35,6 +35,7 @@ typedef struct SDnodeMgmt {
SendMonitorReportFp
sendMonitorReportFp
;
SendMonitorReportFp
sendMonitorReportFp
;
GetVnodeLoadsFp
getVnodeLoadsFp
;
GetVnodeLoadsFp
getVnodeLoadsFp
;
GetMnodeLoadsFp
getMnodeLoadsFp
;
GetMnodeLoadsFp
getMnodeLoadsFp
;
GetQnodeLoadsFp
getQnodeLoadsFp
;
}
SDnodeMgmt
;
}
SDnodeMgmt
;
// dmHandle.c
// dmHandle.c
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
6874016b
...
@@ -79,6 +79,8 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
...
@@ -79,6 +79,8 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
(
*
pMgmt
->
getMnodeLoadsFp
)(
&
minfo
);
(
*
pMgmt
->
getMnodeLoadsFp
)(
&
minfo
);
req
.
mload
=
minfo
.
load
;
req
.
mload
=
minfo
.
load
;
(
*
pMgmt
->
getQnodeLoadsFp
)(
&
req
.
qload
);
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
tSerializeSStatusReq
(
pHead
,
contLen
,
&
req
);
tSerializeSStatusReq
(
pHead
,
contLen
,
&
req
);
...
...
source/dnode/mgmt/mgmt_dnode/src/dmInt.c
浏览文件 @
6874016b
...
@@ -48,6 +48,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
...
@@ -48,6 +48,7 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
pMgmt
->
sendMonitorReportFp
=
pInput
->
sendMonitorReportFp
;
pMgmt
->
sendMonitorReportFp
=
pInput
->
sendMonitorReportFp
;
pMgmt
->
getVnodeLoadsFp
=
pInput
->
getVnodeLoadsFp
;
pMgmt
->
getVnodeLoadsFp
=
pInput
->
getVnodeLoadsFp
;
pMgmt
->
getMnodeLoadsFp
=
pInput
->
getMnodeLoadsFp
;
pMgmt
->
getMnodeLoadsFp
=
pInput
->
getMnodeLoadsFp
;
pMgmt
->
getQnodeLoadsFp
=
pInput
->
getQnodeLoadsFp
;
if
(
dmStartWorker
(
pMgmt
)
!=
0
)
{
if
(
dmStartWorker
(
pMgmt
)
!=
0
)
{
return
-
1
;
return
-
1
;
...
...
source/dnode/mgmt/mgmt_qnode/src/qmHandle.c
浏览文件 @
6874016b
...
@@ -20,6 +20,14 @@ void qmGetMonitorInfo(SQnodeMgmt *pMgmt, SMonQmInfo *qmInfo) {
...
@@ -20,6 +20,14 @@ void qmGetMonitorInfo(SQnodeMgmt *pMgmt, SMonQmInfo *qmInfo) {
SQnodeLoad
qload
=
{
0
};
SQnodeLoad
qload
=
{
0
};
qndGetLoad
(
pMgmt
->
pQnode
,
&
qload
);
qndGetLoad
(
pMgmt
->
pQnode
,
&
qload
);
qload
.
dnodeId
=
pMgmt
->
pData
->
dnodeId
;
}
void
qmGetQnodeLoads
(
SQnodeMgmt
*
pMgmt
,
SQnodeLoad
*
pInfo
)
{
qndGetLoad
(
pMgmt
->
pQnode
,
pInfo
);
pInfo
->
dnodeId
=
pMgmt
->
pData
->
dnodeId
;
}
}
int32_t
qmProcessGetMonitorInfoReq
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
qmProcessGetMonitorInfoReq
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
6874016b
...
@@ -140,6 +140,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
...
@@ -140,6 +140,7 @@ static void vmGenerateVnodeCfg(SCreateVnodeReq *pCreate, SVnodeCfg *pCfg) {
pCfg
->
szCache
=
pCreate
->
pages
;
pCfg
->
szCache
=
pCreate
->
pages
;
pCfg
->
szBuf
=
(
uint64_t
)
pCreate
->
buffer
*
1024
*
1024
;
pCfg
->
szBuf
=
(
uint64_t
)
pCreate
->
buffer
*
1024
*
1024
;
pCfg
->
isWeak
=
true
;
pCfg
->
isWeak
=
true
;
pCfg
->
isTsma
=
pCreate
->
isTsma
;
pCfg
->
tsdbCfg
.
compression
=
pCreate
->
compression
;
pCfg
->
tsdbCfg
.
compression
=
pCreate
->
compression
;
pCfg
->
tsdbCfg
.
precision
=
pCreate
->
precision
;
pCfg
->
tsdbCfg
.
precision
=
pCreate
->
precision
;
pCfg
->
tsdbCfg
.
days
=
pCreate
->
daysPerFile
;
pCfg
->
tsdbCfg
.
days
=
pCreate
->
daysPerFile
;
...
@@ -209,7 +210,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -209,7 +210,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SVnode
*
pImpl
=
vnodeOpen
(
path
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
SVnode
*
pImpl
=
vnodeOpen
(
path
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
if
(
pImpl
==
NULL
)
{
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to
create
vnode since %s"
,
createReq
.
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to
open
vnode since %s"
,
createReq
.
vgId
,
terrstr
());
code
=
terrno
;
code
=
terrno
;
goto
_OVER
;
goto
_OVER
;
}
}
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
6874016b
...
@@ -104,7 +104,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
...
@@ -104,7 +104,7 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
dTrace
(
"msg:%p, get from vnode-write queue"
,
pMsg
);
dTrace
(
"msg:%p, get from vnode-write queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
dTrace
(
"msg:%p, failed to p
rocess
since %s"
,
pMsg
,
terrstr
());
dTrace
(
"msg:%p, failed to p
ush to array
since %s"
,
pMsg
,
terrstr
());
vmSendRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
vmSendRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
}
}
}
}
...
...
source/dnode/mgmt/node_mgmt/inc/dmMgmt.h
浏览文件 @
6874016b
...
@@ -168,6 +168,7 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg);
...
@@ -168,6 +168,7 @@ int32_t dmProcessNodeMsg(SMgmtWrapper *pWrapper, SRpcMsg *pMsg);
void
dmSendMonitorReport
();
void
dmSendMonitorReport
();
void
dmGetVnodeLoads
(
SMonVloadInfo
*
pInfo
);
void
dmGetVnodeLoads
(
SMonVloadInfo
*
pInfo
);
void
dmGetMnodeLoads
(
SMonMloadInfo
*
pInfo
);
void
dmGetMnodeLoads
(
SMonMloadInfo
*
pInfo
);
void
dmGetQnodeLoads
(
SQnodeLoad
*
pInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/node_mgmt/inc/dmNodes.h
浏览文件 @
6874016b
...
@@ -37,6 +37,7 @@ void bmGetMonitorInfo(void *pMgmt, SMonBmInfo *pInfo);
...
@@ -37,6 +37,7 @@ void bmGetMonitorInfo(void *pMgmt, SMonBmInfo *pInfo);
void
vmGetVnodeLoads
(
void
*
pMgmt
,
SMonVloadInfo
*
pInfo
);
void
vmGetVnodeLoads
(
void
*
pMgmt
,
SMonVloadInfo
*
pInfo
);
void
mmGetMnodeLoads
(
void
*
pMgmt
,
SMonMloadInfo
*
pInfo
);
void
mmGetMnodeLoads
(
void
*
pMgmt
,
SMonMloadInfo
*
pInfo
);
void
qmGetQnodeLoads
(
void
*
pMgmt
,
SQnodeLoad
*
pInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/node_mgmt/src/dmEnv.c
浏览文件 @
6874016b
...
@@ -178,6 +178,7 @@ SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper) {
...
@@ -178,6 +178,7 @@ SMgmtInputOpt dmBuildMgmtInputOpt(SMgmtWrapper *pWrapper) {
.
sendMonitorReportFp
=
dmSendMonitorReport
,
.
sendMonitorReportFp
=
dmSendMonitorReport
,
.
getVnodeLoadsFp
=
dmGetVnodeLoads
,
.
getVnodeLoadsFp
=
dmGetVnodeLoads
,
.
getMnodeLoadsFp
=
dmGetMnodeLoads
,
.
getMnodeLoadsFp
=
dmGetMnodeLoads
,
.
getQnodeLoadsFp
=
dmGetQnodeLoads
,
};
};
opt
.
msgCb
=
dmGetMsgcb
(
pWrapper
->
pDnode
);
opt
.
msgCb
=
dmGetMsgcb
(
pWrapper
->
pDnode
);
...
...
source/dnode/mgmt/node_mgmt/src/dmMonitor.c
浏览文件 @
6874016b
...
@@ -170,3 +170,17 @@ void dmGetMnodeLoads(SMonMloadInfo *pInfo) {
...
@@ -170,3 +170,17 @@ void dmGetMnodeLoads(SMonMloadInfo *pInfo) {
dmReleaseWrapper
(
pWrapper
);
dmReleaseWrapper
(
pWrapper
);
}
}
}
}
void
dmGetQnodeLoads
(
SQnodeLoad
*
pInfo
)
{
SDnode
*
pDnode
=
dmInstance
();
SMgmtWrapper
*
pWrapper
=
&
pDnode
->
wrappers
[
QNODE
];
if
(
dmMarkWrapper
(
pWrapper
)
==
0
)
{
if
(
tsMultiProcess
)
{
dmSendLocalRecv
(
pDnode
,
TDMT_MON_QM_LOAD
,
tDeserializeSQnodeLoad
,
pInfo
);
}
else
if
(
pWrapper
->
pMgmt
!=
NULL
)
{
qmGetQnodeLoads
(
pWrapper
->
pMgmt
,
pInfo
);
}
dmReleaseWrapper
(
pWrapper
);
}
}
source/dnode/mgmt/node_util/inc/dmUtil.h
浏览文件 @
6874016b
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "dnode.h"
#include "dnode.h"
#include "mnode.h"
#include "mnode.h"
#include "qnode.h"
#include "monitor.h"
#include "monitor.h"
#include "sync.h"
#include "sync.h"
#include "wal.h"
#include "wal.h"
...
@@ -92,6 +93,7 @@ typedef int32_t (*ProcessDropNodeFp)(EDndNodeType ntype, SRpcMsg *pMsg);
...
@@ -92,6 +93,7 @@ typedef int32_t (*ProcessDropNodeFp)(EDndNodeType ntype, SRpcMsg *pMsg);
typedef
void
(
*
SendMonitorReportFp
)();
typedef
void
(
*
SendMonitorReportFp
)();
typedef
void
(
*
GetVnodeLoadsFp
)(
SMonVloadInfo
*
pInfo
);
typedef
void
(
*
GetVnodeLoadsFp
)(
SMonVloadInfo
*
pInfo
);
typedef
void
(
*
GetMnodeLoadsFp
)(
SMonMloadInfo
*
pInfo
);
typedef
void
(
*
GetMnodeLoadsFp
)(
SMonMloadInfo
*
pInfo
);
typedef
void
(
*
GetQnodeLoadsFp
)(
SQnodeLoad
*
pInfo
);
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
...
@@ -118,6 +120,7 @@ typedef struct {
...
@@ -118,6 +120,7 @@ typedef struct {
SendMonitorReportFp
sendMonitorReportFp
;
SendMonitorReportFp
sendMonitorReportFp
;
GetVnodeLoadsFp
getVnodeLoadsFp
;
GetVnodeLoadsFp
getVnodeLoadsFp
;
GetMnodeLoadsFp
getMnodeLoadsFp
;
GetMnodeLoadsFp
getMnodeLoadsFp
;
GetQnodeLoadsFp
getQnodeLoadsFp
;
}
SMgmtInputOpt
;
}
SMgmtInputOpt
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
6874016b
...
@@ -54,9 +54,11 @@ typedef enum {
...
@@ -54,9 +54,11 @@ typedef enum {
}
EAuthOp
;
}
EAuthOp
;
typedef
enum
{
typedef
enum
{
TRN_STEP_LOG
=
1
,
TRN_CONFLICT_NOTHING
=
0
,
TRN_STEP_ACTION
=
2
,
TRN_CONFLICT_GLOBAL
=
1
,
}
ETrnStep
;
TRN_CONFLICT_DB
=
2
,
TRN_CONFLICT_DB_INSIDE
=
3
,
}
ETrnConflct
;
typedef
enum
{
typedef
enum
{
TRN_STAGE_PREPARE
=
0
,
TRN_STAGE_PREPARE
=
0
,
...
@@ -68,69 +70,15 @@ typedef enum {
...
@@ -68,69 +70,15 @@ typedef enum {
TRN_STAGE_FINISHED
=
6
TRN_STAGE_FINISHED
=
6
}
ETrnStage
;
}
ETrnStage
;
typedef
enum
{
TRN_TYPE_BASIC_SCOPE
=
1000
,
TRN_TYPE_CREATE_ACCT
=
1001
,
TRN_TYPE_CREATE_CLUSTER
=
1002
,
TRN_TYPE_CREATE_USER
=
1003
,
TRN_TYPE_ALTER_USER
=
1004
,
TRN_TYPE_DROP_USER
=
1005
,
TRN_TYPE_CREATE_FUNC
=
1006
,
TRN_TYPE_DROP_FUNC
=
1007
,
TRN_TYPE_CREATE_SNODE
=
1010
,
TRN_TYPE_DROP_SNODE
=
1011
,
TRN_TYPE_CREATE_QNODE
=
1012
,
TRN_TYPE_DROP_QNODE
=
10013
,
TRN_TYPE_CREATE_BNODE
=
1014
,
TRN_TYPE_DROP_BNODE
=
1015
,
TRN_TYPE_CREATE_MNODE
=
1016
,
TRN_TYPE_DROP_MNODE
=
1017
,
TRN_TYPE_CREATE_TOPIC
=
1020
,
TRN_TYPE_DROP_TOPIC
=
1021
,
TRN_TYPE_SUBSCRIBE
=
1022
,
TRN_TYPE_REBALANCE
=
1023
,
TRN_TYPE_COMMIT_OFFSET
=
1024
,
TRN_TYPE_CREATE_STREAM
=
1025
,
TRN_TYPE_DROP_STREAM
=
1026
,
TRN_TYPE_ALTER_STREAM
=
1027
,
TRN_TYPE_CONSUMER_LOST
=
1028
,
TRN_TYPE_CONSUMER_RECOVER
=
1029
,
TRN_TYPE_DROP_CGROUP
=
1030
,
TRN_TYPE_BASIC_SCOPE_END
,
TRN_TYPE_GLOBAL_SCOPE
=
2000
,
TRN_TYPE_CREATE_DNODE
=
2001
,
TRN_TYPE_DROP_DNODE
=
2002
,
TRN_TYPE_GLOBAL_SCOPE_END
,
TRN_TYPE_DB_SCOPE
=
3000
,
TRN_TYPE_CREATE_DB
=
3001
,
TRN_TYPE_ALTER_DB
=
3002
,
TRN_TYPE_DROP_DB
=
3003
,
TRN_TYPE_SPLIT_VGROUP
=
3004
,
TRN_TYPE_MERGE_VGROUP
=
3015
,
TRN_TYPE_DB_SCOPE_END
,
TRN_TYPE_STB_SCOPE
=
4000
,
TRN_TYPE_CREATE_STB
=
4001
,
TRN_TYPE_ALTER_STB
=
4002
,
TRN_TYPE_DROP_STB
=
4003
,
TRN_TYPE_CREATE_SMA
=
4004
,
TRN_TYPE_DROP_SMA
=
4005
,
TRN_TYPE_STB_SCOPE_END
,
}
ETrnType
;
typedef
enum
{
typedef
enum
{
TRN_POLICY_ROLLBACK
=
0
,
TRN_POLICY_ROLLBACK
=
0
,
TRN_POLICY_RETRY
=
1
,
TRN_POLICY_RETRY
=
1
,
}
ETrnPolicy
;
}
ETrnPolicy
;
typedef
enum
{
typedef
enum
{
TRN_EXEC_P
ARA
LLEL
=
0
,
TRN_EXEC_P
RAR
LLEL
=
0
,
TRN_EXEC_
NO_PARALLE
L
=
1
,
TRN_EXEC_
SERIA
L
=
1
,
}
ETrnExec
Type
;
}
ETrnExec
;
typedef
enum
{
typedef
enum
{
DND_REASON_ONLINE
=
0
,
DND_REASON_ONLINE
=
0
,
...
@@ -159,8 +107,8 @@ typedef struct {
...
@@ -159,8 +107,8 @@ typedef struct {
int32_t
id
;
int32_t
id
;
ETrnStage
stage
;
ETrnStage
stage
;
ETrnPolicy
policy
;
ETrnPolicy
policy
;
ETrn
Type
type
;
ETrn
Conflct
conflict
;
ETrnExec
Type
parallel
;
ETrnExec
exec
;
int32_t
code
;
int32_t
code
;
int32_t
failedTimes
;
int32_t
failedTimes
;
SRpcHandleInfo
rpcInfo
;
SRpcHandleInfo
rpcInfo
;
...
@@ -172,10 +120,11 @@ typedef struct {
...
@@ -172,10 +120,11 @@ typedef struct {
SArray
*
commitActions
;
SArray
*
commitActions
;
int64_t
createdTime
;
int64_t
createdTime
;
int64_t
lastExecTime
;
int64_t
lastExecTime
;
int64_t
dbUid
;
int32_t
lastErrorAction
;
int32_t
lastErrorNo
;
tmsg_t
lastErrorMsgType
;
SEpSet
lastErrorEpset
;
char
dbname
[
TSDB_DB_FNAME_LEN
];
char
dbname
[
TSDB_DB_FNAME_LEN
];
char
lastError
[
TSDB_TRANS_ERROR_LEN
];
char
desc
[
TSDB_TRANS_DESC_LEN
];
int32_t
startFunc
;
int32_t
startFunc
;
int32_t
stopFunc
;
int32_t
stopFunc
;
int32_t
paramLen
;
int32_t
paramLen
;
...
@@ -219,6 +168,7 @@ typedef struct {
...
@@ -219,6 +168,7 @@ typedef struct {
int64_t
createdTime
;
int64_t
createdTime
;
int64_t
updateTime
;
int64_t
updateTime
;
SDnodeObj
*
pDnode
;
SDnodeObj
*
pDnode
;
SQnodeLoad
load
;
}
SQnodeObj
;
}
SQnodeObj
;
typedef
struct
{
typedef
struct
{
...
@@ -343,6 +293,7 @@ typedef struct {
...
@@ -343,6 +293,7 @@ typedef struct {
int8_t
isTsma
;
int8_t
isTsma
;
int8_t
replica
;
int8_t
replica
;
SVnodeGid
vnodeGid
[
TSDB_MAX_REPLICA
];
SVnodeGid
vnodeGid
[
TSDB_MAX_REPLICA
];
void
*
pTsma
;
}
SVgObj
;
}
SVgObj
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndQnode.h
浏览文件 @
6874016b
...
@@ -22,9 +22,15 @@
...
@@ -22,9 +22,15 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#define QNODE_LOAD_VALUE(pQnode) (pQnode ? (pQnode->load.numOfQueryInQueue + pQnode->load.numOfFetchInQueue) : 0)
int32_t
mndInitQnode
(
SMnode
*
pMnode
);
int32_t
mndInitQnode
(
SMnode
*
pMnode
);
void
mndCleanupQnode
(
SMnode
*
pMnode
);
void
mndCleanupQnode
(
SMnode
*
pMnode
);
SQnodeObj
*
mndAcquireQnode
(
SMnode
*
pMnode
,
int32_t
qnodeId
);
void
mndReleaseQnode
(
SMnode
*
pMnode
,
SQnodeObj
*
pObj
);
int32_t
mndCreateQnodeList
(
SMnode
*
pMnode
,
SArray
**
pList
,
int32_t
limit
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
6874016b
...
@@ -34,7 +34,7 @@ typedef struct {
...
@@ -34,7 +34,7 @@ typedef struct {
int32_t
errCode
;
int32_t
errCode
;
int32_t
acceptableCode
;
int32_t
acceptableCode
;
int8_t
stage
;
int8_t
stage
;
int8_t
isRaw
;
int8_t
actionType
;
// 0-msg, 1-raw
int8_t
rawWritten
;
int8_t
rawWritten
;
int8_t
msgSent
;
int8_t
msgSent
;
int8_t
msgReceived
;
int8_t
msgReceived
;
...
@@ -52,7 +52,7 @@ void mndCleanupTrans(SMnode *pMnode);
...
@@ -52,7 +52,7 @@ void mndCleanupTrans(SMnode *pMnode);
STrans
*
mndAcquireTrans
(
SMnode
*
pMnode
,
int32_t
transId
);
STrans
*
mndAcquireTrans
(
SMnode
*
pMnode
,
int32_t
transId
);
void
mndReleaseTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
void
mndReleaseTrans
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
STrans
*
mndTransCreate
(
SMnode
*
pMnode
,
ETrnPolicy
policy
,
ETrn
Type
type
,
const
SRpcMsg
*
pReq
);
STrans
*
mndTransCreate
(
SMnode
*
pMnode
,
ETrnPolicy
policy
,
ETrn
Conflct
conflict
,
const
SRpcMsg
*
pReq
);
void
mndTransDrop
(
STrans
*
pTrans
);
void
mndTransDrop
(
STrans
*
pTrans
);
int32_t
mndTransAppendRedolog
(
STrans
*
pTrans
,
SSdbRaw
*
pRaw
);
int32_t
mndTransAppendRedolog
(
STrans
*
pTrans
,
SSdbRaw
*
pRaw
);
int32_t
mndTransAppendUndolog
(
STrans
*
pTrans
,
SSdbRaw
*
pRaw
);
int32_t
mndTransAppendUndolog
(
STrans
*
pTrans
,
SSdbRaw
*
pRaw
);
...
@@ -62,7 +62,7 @@ int32_t mndTransAppendUndoAction(STrans *pTrans, STransAction *pAction);
...
@@ -62,7 +62,7 @@ int32_t mndTransAppendUndoAction(STrans *pTrans, STransAction *pAction);
void
mndTransSetRpcRsp
(
STrans
*
pTrans
,
void
*
pCont
,
int32_t
contLen
);
void
mndTransSetRpcRsp
(
STrans
*
pTrans
,
void
*
pCont
,
int32_t
contLen
);
void
mndTransSetCb
(
STrans
*
pTrans
,
ETrnFunc
startFunc
,
ETrnFunc
stopFunc
,
void
*
param
,
int32_t
paramLen
);
void
mndTransSetCb
(
STrans
*
pTrans
,
ETrnFunc
startFunc
,
ETrnFunc
stopFunc
,
void
*
param
,
int32_t
paramLen
);
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
);
void
mndTransSetDbInfo
(
STrans
*
pTrans
,
SDbObj
*
pDb
);
void
mndTransSet
NoParalle
l
(
STrans
*
pTrans
);
void
mndTransSet
Seria
l
(
STrans
*
pTrans
);
int32_t
mndTransPrepare
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
int32_t
mndTransPrepare
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
void
mndTransProcessRsp
(
SRpcMsg
*
pRsp
);
void
mndTransProcessRsp
(
SRpcMsg
*
pRsp
);
...
...
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
6874016b
...
@@ -80,7 +80,7 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
...
@@ -80,7 +80,7 @@ static int32_t mndCreateDefaultAcct(SMnode *pMnode) {
mDebug
(
"acct:%s, will be created when deploying, raw:%p"
,
acctObj
.
acct
,
pRaw
);
mDebug
(
"acct:%s, will be created when deploying, raw:%p"
,
acctObj
.
acct
,
pRaw
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_CREATE_ACCT
,
NULL
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_NOTHING
,
NULL
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"acct:%s, failed to create since %s"
,
acctObj
.
acct
,
terrstr
());
mError
(
"acct:%s, failed to create since %s"
,
acctObj
.
acct
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
6874016b
...
@@ -246,7 +246,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
...
@@ -246,7 +246,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
bnodeObj
.
createdTime
=
taosGetTimestampMs
();
bnodeObj
.
createdTime
=
taosGetTimestampMs
();
bnodeObj
.
updateTime
=
bnodeObj
.
createdTime
;
bnodeObj
.
updateTime
=
bnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_BNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create bnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
mDebug
(
"trans:%d, used to create bnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
...
@@ -363,7 +363,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
...
@@ -363,7 +363,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
static
int32_t
mndDropBnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SBnodeObj
*
pObj
)
{
static
int32_t
mndDropBnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SBnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_DROP_BNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop bnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
mDebug
(
"trans:%d, used to drop bnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
6874016b
...
@@ -179,10 +179,8 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
...
@@ -179,10 +179,8 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
mDebug
(
"cluster:%"
PRId64
", will be created when deploying, raw:%p"
,
clusterObj
.
id
,
pRaw
);
mDebug
(
"cluster:%"
PRId64
", will be created when deploying, raw:%p"
,
clusterObj
.
id
,
pRaw
);
#if 0
return sdbWrite(pMnode->pSdb, pRaw);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
NULL
);
#else
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_CLUSTER
,
NULL
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"cluster:%"
PRId64
", failed to create since %s"
,
clusterObj
.
id
,
terrstr
());
mError
(
"cluster:%"
PRId64
", failed to create since %s"
,
clusterObj
.
id
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -204,7 +202,6 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
...
@@ -204,7 +202,6 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
0
;
return
0
;
#endif
}
}
static
int32_t
mndRetrieveClusters
(
SRpcMsg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
static
int32_t
mndRetrieveClusters
(
SRpcMsg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
6874016b
...
@@ -97,7 +97,7 @@ static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) {
...
@@ -97,7 +97,7 @@ static int32_t mndProcessConsumerLostMsg(SRpcMsg *pMsg) {
mndReleaseConsumer
(
pMnode
,
pConsumer
);
mndReleaseConsumer
(
pMnode
,
pConsumer
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_CONSUMER_LOST
,
pMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_NOTHING
,
pMsg
);
if
(
pTrans
==
NULL
)
goto
FAIL
;
if
(
pTrans
==
NULL
)
goto
FAIL
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
FAIL
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
FAIL
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
FAIL
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
FAIL
;
...
@@ -121,7 +121,7 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) {
...
@@ -121,7 +121,7 @@ static int32_t mndProcessConsumerRecoverMsg(SRpcMsg *pMsg) {
mndReleaseConsumer
(
pMnode
,
pConsumer
);
mndReleaseConsumer
(
pMnode
,
pConsumer
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_CONSUMER_RECOVER
,
pMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_NOTHING
,
pMsg
);
if
(
pTrans
==
NULL
)
goto
FAIL
;
if
(
pTrans
==
NULL
)
goto
FAIL
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
FAIL
;
if
(
mndSetConsumerCommitLogs
(
pMnode
,
pTrans
,
pConsumerNew
)
!=
0
)
goto
FAIL
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
FAIL
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
FAIL
;
...
@@ -403,7 +403,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
...
@@ -403,7 +403,7 @@ static int32_t mndProcessSubscribeReq(SRpcMsg *pMsg) {
int32_t
newTopicNum
=
taosArrayGetSize
(
newSub
);
int32_t
newTopicNum
=
taosArrayGetSize
(
newSub
);
// check topic existance
// check topic existance
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_SUBSCRIBE
,
pMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_NOTHING
,
pMsg
);
if
(
pTrans
==
NULL
)
goto
SUBSCRIBE_OVER
;
if
(
pTrans
==
NULL
)
goto
SUBSCRIBE_OVER
;
for
(
int32_t
i
=
0
;
i
<
newTopicNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
newTopicNum
;
i
++
)
{
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
6874016b
...
@@ -545,7 +545,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
...
@@ -545,7 +545,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
}
}
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE
_DB
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT
_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
mDebug
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
...
@@ -775,7 +775,7 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
...
@@ -775,7 +775,7 @@ static int32_t mndSetAlterDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
static
int32_t
mndAlterDb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pOld
,
SDbObj
*
pNew
)
{
static
int32_t
mndAlterDb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pOld
,
SDbObj
*
pNew
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_ALTER
_DB
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT
_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to alter db:%s"
,
pTrans
->
id
,
pOld
->
name
);
mDebug
(
"trans:%d, used to alter db:%s"
,
pTrans
->
id
,
pOld
->
name
);
...
@@ -1036,7 +1036,7 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
...
@@ -1036,7 +1036,7 @@ static int32_t mndBuildDropDbRsp(SDbObj *pDb, int32_t *pRspLen, void **ppRsp, bo
static
int32_t
mndDropDb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pDb
)
{
static
int32_t
mndDropDb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pDb
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_DROP
_DB
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT
_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop db:%s"
,
pTrans
->
id
,
pDb
->
name
);
mDebug
(
"trans:%d, used to drop db:%s"
,
pTrans
->
id
,
pDb
->
name
);
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
6874016b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndAuth.h"
#include "mndAuth.h"
#include "mndMnode.h"
#include "mndMnode.h"
#include "mndQnode.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndUser.h"
...
@@ -100,10 +101,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
...
@@ -100,10 +101,7 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
mDebug
(
"dnode:%d, will be created when deploying, raw:%p"
,
dnodeObj
.
id
,
pRaw
);
mDebug
(
"dnode:%d, will be created when deploying, raw:%p"
,
dnodeObj
.
id
,
pRaw
);
#if 0
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_GLOBAL
,
NULL
);
return sdbWrite(pMnode->pSdb, pRaw);
#else
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_DNODE
,
NULL
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"dnode:%s, failed to create since %s"
,
dnodeObj
.
ep
,
terrstr
());
mError
(
"dnode:%s, failed to create since %s"
,
dnodeObj
.
ep
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -125,7 +123,6 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
...
@@ -125,7 +123,6 @@ static int32_t mndCreateDefaultDnode(SMnode *pMnode) {
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
0
;
return
0
;
#endif
}
}
static
SSdbRaw
*
mndDnodeActionEncode
(
SDnodeObj
*
pDnode
)
{
static
SSdbRaw
*
mndDnodeActionEncode
(
SDnodeObj
*
pDnode
)
{
...
@@ -388,6 +385,12 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
...
@@ -388,6 +385,12 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
mndReleaseMnode
(
pMnode
,
pObj
);
mndReleaseMnode
(
pMnode
,
pObj
);
}
}
SQnodeObj
*
pQnode
=
mndAcquireQnode
(
pMnode
,
statusReq
.
qload
.
dnodeId
);
if
(
pQnode
!=
NULL
)
{
pQnode
->
load
=
statusReq
.
qload
;
mndReleaseQnode
(
pMnode
,
pQnode
);
}
int64_t
dnodeVer
=
sdbGetTableVer
(
pMnode
->
pSdb
,
SDB_DNODE
)
+
sdbGetTableVer
(
pMnode
->
pSdb
,
SDB_MNODE
);
int64_t
dnodeVer
=
sdbGetTableVer
(
pMnode
->
pSdb
,
SDB_DNODE
)
+
sdbGetTableVer
(
pMnode
->
pSdb
,
SDB_MNODE
);
int64_t
curMs
=
taosGetTimestampMs
();
int64_t
curMs
=
taosGetTimestampMs
();
bool
online
=
mndIsDnodeOnline
(
pMnode
,
pDnode
,
curMs
);
bool
online
=
mndIsDnodeOnline
(
pMnode
,
pDnode
,
curMs
);
...
@@ -481,7 +484,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
...
@@ -481,7 +484,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SRpcMsg *pReq, SCreateDnodeReq *pC
memcpy
(
dnodeObj
.
fqdn
,
pCreate
->
fqdn
,
TSDB_FQDN_LEN
);
memcpy
(
dnodeObj
.
fqdn
,
pCreate
->
fqdn
,
TSDB_FQDN_LEN
);
snprintf
(
dnodeObj
.
ep
,
TSDB_EP_LEN
,
"%s:%u"
,
dnodeObj
.
fqdn
,
dnodeObj
.
port
);
snprintf
(
dnodeObj
.
ep
,
TSDB_EP_LEN
,
"%s:%u"
,
dnodeObj
.
fqdn
,
dnodeObj
.
port
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_DNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_GLOBAL
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"dnode:%s, failed to create since %s"
,
dnodeObj
.
ep
,
terrstr
());
mError
(
"dnode:%s, failed to create since %s"
,
dnodeObj
.
ep
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -557,7 +560,7 @@ CREATE_DNODE_OVER:
...
@@ -557,7 +560,7 @@ CREATE_DNODE_OVER:
}
}
static
int32_t
mndDropDnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDnodeObj
*
pDnode
)
{
static
int32_t
mndDropDnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDnodeObj
*
pDnode
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_DROP_DNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_GLOBAL
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"dnode:%d, failed to drop since %s"
,
pDnode
->
id
,
terrstr
());
mError
(
"dnode:%d, failed to drop since %s"
,
pDnode
->
id
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
6874016b
...
@@ -215,7 +215,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
...
@@ -215,7 +215,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SRpcMsg *pReq, SCreateFuncReq *pCre
}
}
memcpy
(
func
.
pCode
,
pCreate
->
pCode
,
func
.
codeSize
);
memcpy
(
func
.
pCode
,
pCreate
->
pCode
,
func
.
codeSize
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_FUNC
,
pReq
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create func:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mDebug
(
"trans:%d, used to create func:%s"
,
pTrans
->
id
,
pCreate
->
name
);
...
@@ -245,7 +245,7 @@ _OVER:
...
@@ -245,7 +245,7 @@ _OVER:
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SFuncObj
*
pFunc
)
{
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SFuncObj
*
pFunc
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_DROP_FUNC
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pFunc
->
name
);
mDebug
(
"trans:%d, used to drop user:%s"
,
pTrans
->
id
,
pFunc
->
name
);
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
6874016b
...
@@ -18,9 +18,9 @@
...
@@ -18,9 +18,9 @@
#include "mndAuth.h"
#include "mndAuth.h"
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndSync.h"
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndUser.h"
#include "mndSync.h"
#define MNODE_VER_NUMBER 1
#define MNODE_VER_NUMBER 1
#define MNODE_RESERVE_SIZE 64
#define MNODE_RESERVE_SIZE 64
...
@@ -92,10 +92,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
...
@@ -92,10 +92,7 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
mDebug
(
"mnode:%d, will be created when deploying, raw:%p"
,
mnodeObj
.
id
,
pRaw
);
mDebug
(
"mnode:%d, will be created when deploying, raw:%p"
,
mnodeObj
.
id
,
pRaw
);
#if 0
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_GLOBAL
,
NULL
);
return sdbWrite(pMnode->pSdb, pRaw);
#else
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_DNODE
,
NULL
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"mnode:%d, failed to create since %s"
,
mnodeObj
.
id
,
terrstr
());
mError
(
"mnode:%d, failed to create since %s"
,
mnodeObj
.
id
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -117,7 +114,6 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
...
@@ -117,7 +114,6 @@ static int32_t mndCreateDefaultMnode(SMnode *pMnode) {
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
0
;
return
0
;
#endif
}
}
static
SSdbRaw
*
mndMnodeActionEncode
(
SMnodeObj
*
pObj
)
{
static
SSdbRaw
*
mndMnodeActionEncode
(
SMnodeObj
*
pObj
)
{
...
@@ -363,11 +359,11 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
...
@@ -363,11 +359,11 @@ static int32_t mndCreateMnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
mnodeObj
.
createdTime
=
taosGetTimestampMs
();
mnodeObj
.
createdTime
=
taosGetTimestampMs
();
mnodeObj
.
updateTime
=
mnodeObj
.
createdTime
;
mnodeObj
.
updateTime
=
mnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_CREATE_MNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_GLOBAL
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create mnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
mDebug
(
"trans:%d, used to create mnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
mndTransSet
NoParalle
l
(
pTrans
);
mndTransSet
Seria
l
(
pTrans
);
if
(
mndSetCreateMnodeRedoLogs
(
pMnode
,
pTrans
,
&
mnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateMnodeRedoLogs
(
pMnode
,
pTrans
,
&
mnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateMnodeCommitLogs
(
pMnode
,
pTrans
,
&
mnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateMnodeCommitLogs
(
pMnode
,
pTrans
,
&
mnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateMnodeRedoActions
(
pMnode
,
pTrans
,
pDnode
,
&
mnodeObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateMnodeRedoActions
(
pMnode
,
pTrans
,
pDnode
,
&
mnodeObj
)
!=
0
)
goto
_OVER
;
...
@@ -396,6 +392,11 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
...
@@ -396,6 +392,11 @@ static int32_t mndProcessCreateMnodeReq(SRpcMsg *pReq) {
mDebug
(
"mnode:%d, start to create"
,
createReq
.
dnodeId
);
mDebug
(
"mnode:%d, start to create"
,
createReq
.
dnodeId
);
if
(
sdbGetSize
(
pMnode
->
pSdb
,
SDB_MNODE
)
>=
3
)
{
terrno
=
TSDB_CODE_MND_TOO_MANY_MNODES
;
goto
_OVER
;
}
pObj
=
mndAcquireMnode
(
pMnode
,
createReq
.
dnodeId
);
pObj
=
mndAcquireMnode
(
pMnode
,
createReq
.
dnodeId
);
if
(
pObj
!=
NULL
)
{
if
(
pObj
!=
NULL
)
{
terrno
=
TSDB_CODE_MND_MNODE_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_MNODE_ALREADY_EXIST
;
...
@@ -535,11 +536,11 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
...
@@ -535,11 +536,11 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
static
int32_t
mndDropMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SMnodeObj
*
pObj
)
{
static
int32_t
mndDropMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SMnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_DROP_MNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_GLOBAL
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop mnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
mDebug
(
"trans:%d, used to drop mnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
mndTransSet
NoParalle
l
(
pTrans
);
mndTransSet
Seria
l
(
pTrans
);
if
(
mndSetDropMnodeRedoLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropMnodeRedoLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropMnodeCommitLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropMnodeCommitLogs
(
pMnode
,
pTrans
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropMnodeRedoActions
(
pMnode
,
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetDropMnodeRedoActions
(
pMnode
,
pTrans
,
pObj
->
pDnode
,
pObj
)
!=
0
)
goto
_OVER
;
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
6874016b
...
@@ -179,7 +179,7 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) {
...
@@ -179,7 +179,7 @@ static int32_t mndProcessCommitOffsetReq(SRpcMsg *pMsg) {
tDecodeSMqCMCommitOffsetReq
(
&
decoder
,
&
commitOffsetReq
);
tDecodeSMqCMCommitOffsetReq
(
&
decoder
,
&
commitOffsetReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_COMMIT_OFFSET
,
pMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pMsg
);
for
(
int32_t
i
=
0
;
i
<
commitOffsetReq
.
num
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
commitOffsetReq
.
num
;
i
++
)
{
SMqOffset
*
pOffset
=
&
commitOffsetReq
.
offsets
[
i
];
SMqOffset
*
pOffset
=
&
commitOffsetReq
.
offsets
[
i
];
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
6874016b
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "mndDb.h"
#include "mndDb.h"
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndMnode.h"
#include "mndMnode.h"
#include "mndQnode.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndStb.h"
#include "mndStb.h"
#include "mndUser.h"
#include "mndUser.h"
...
@@ -382,6 +383,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
...
@@ -382,6 +383,9 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
rspBasic
->
totalDnodes
=
mndGetDnodeSize
(
pMnode
);
rspBasic
->
totalDnodes
=
mndGetDnodeSize
(
pMnode
);
rspBasic
->
onlineDnodes
=
1
;
// TODO
rspBasic
->
onlineDnodes
=
1
;
// TODO
mndGetMnodeEpSet
(
pMnode
,
&
rspBasic
->
epSet
);
mndGetMnodeEpSet
(
pMnode
,
&
rspBasic
->
epSet
);
mndCreateQnodeList
(
pMnode
,
&
rspBasic
->
pQnodeList
,
-
1
);
mndReleaseConn
(
pMnode
,
pConn
);
mndReleaseConn
(
pMnode
,
pConn
);
hbRsp
.
query
=
rspBasic
;
hbRsp
.
query
=
rspBasic
;
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
6874016b
...
@@ -60,7 +60,7 @@ int32_t mndInitQnode(SMnode *pMnode) {
...
@@ -60,7 +60,7 @@ int32_t mndInitQnode(SMnode *pMnode) {
void
mndCleanupQnode
(
SMnode
*
pMnode
)
{}
void
mndCleanupQnode
(
SMnode
*
pMnode
)
{}
static
SQnodeObj
*
mndAcquireQnode
(
SMnode
*
pMnode
,
int32_t
qnodeId
)
{
SQnodeObj
*
mndAcquireQnode
(
SMnode
*
pMnode
,
int32_t
qnodeId
)
{
SQnodeObj
*
pObj
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_QNODE
,
&
qnodeId
);
SQnodeObj
*
pObj
=
sdbAcquire
(
pMnode
->
pSdb
,
SDB_QNODE
,
&
qnodeId
);
if
(
pObj
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
if
(
pObj
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_QNODE_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_QNODE_NOT_EXIST
;
...
@@ -68,7 +68,7 @@ static SQnodeObj *mndAcquireQnode(SMnode *pMnode, int32_t qnodeId) {
...
@@ -68,7 +68,7 @@ static SQnodeObj *mndAcquireQnode(SMnode *pMnode, int32_t qnodeId) {
return
pObj
;
return
pObj
;
}
}
static
void
mndReleaseQnode
(
SMnode
*
pMnode
,
SQnodeObj
*
pObj
)
{
void
mndReleaseQnode
(
SMnode
*
pMnode
,
SQnodeObj
*
pObj
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbRelease
(
pSdb
,
pObj
);
sdbRelease
(
pSdb
,
pObj
);
}
}
...
@@ -248,7 +248,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
...
@@ -248,7 +248,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
qnodeObj
.
createdTime
=
taosGetTimestampMs
();
qnodeObj
.
createdTime
=
taosGetTimestampMs
();
qnodeObj
.
updateTime
=
qnodeObj
.
createdTime
;
qnodeObj
.
updateTime
=
qnodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_QNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create qnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
mDebug
(
"trans:%d, used to create qnode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
...
@@ -365,7 +365,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
...
@@ -365,7 +365,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
static
int32_t
mndDropQnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SQnodeObj
*
pObj
)
{
static
int32_t
mndDropQnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SQnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_DROP_QNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop qnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
mDebug
(
"trans:%d, used to drop qnode:%d"
,
pTrans
->
id
,
pObj
->
id
);
...
@@ -429,49 +429,62 @@ _OVER:
...
@@ -429,49 +429,62 @@ _OVER:
return
code
;
return
code
;
}
}
static
int32_t
mndProcessQnodeListReq
(
SRpcMsg
*
pReq
)
{
int32_t
mndCreateQnodeList
(
SMnode
*
pMnode
,
SArray
**
pList
,
int32_t
limit
)
{
int32_t
code
=
-
1
;
int32_t
numOfRows
=
0
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
SQnodeObj
*
pObj
=
NULL
;
SQnodeObj
*
pObj
=
NULL
;
SQnodeListReq
qlistReq
=
{
0
};
int32_t
numOfRows
=
0
;
SQnodeListRsp
qlistRsp
=
{
0
};
if
(
tDeserializeSQnodeListReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
qlistReq
)
!=
0
)
{
mError
(
"failed to parse qnode list req"
);
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
qlistRsp
.
addrsList
=
taosArrayInit
(
5
,
sizeof
(
SQueryNodeAddr
));
SArray
*
qnodeList
=
taosArrayInit
(
5
,
sizeof
(
SQueryNodeLoad
));
if
(
NULL
==
q
listRsp
.
addrs
List
)
{
if
(
NULL
==
q
node
List
)
{
mError
(
"failed to alloc epSet while process qnode list req"
);
mError
(
"failed to alloc epSet while process qnode list req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
return
terrno
;
}
}
void
*
pIter
=
NULL
;
while
(
1
)
{
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_QNODE
,
pIter
,
(
void
**
)
&
pObj
);
pIter
=
sdbFetch
(
pSdb
,
SDB_QNODE
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
SQueryNodeAddr
nodeAddr
=
{
0
};
SQueryNodeLoad
nodeLoad
=
{
0
};
nodeAddr
.
nodeId
=
QNODE_HANDLE
;
nodeLoad
.
addr
.
nodeId
=
QNODE_HANDLE
;
nodeAddr
.
epSet
.
numOfEps
=
1
;
nodeLoad
.
addr
.
epSet
.
numOfEps
=
1
;
tstrncpy
(
nodeAddr
.
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
tstrncpy
(
nodeLoad
.
addr
.
epSet
.
eps
[
0
].
fqdn
,
pObj
->
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
nodeAddr
.
epSet
.
eps
[
0
].
port
=
pObj
->
pDnode
->
port
;
nodeLoad
.
addr
.
epSet
.
eps
[
0
].
port
=
pObj
->
pDnode
->
port
;
nodeLoad
.
load
=
QNODE_LOAD_VALUE
(
pObj
);
(
void
)
taosArrayPush
(
q
listRsp
.
addrsList
,
&
nodeAddr
);
(
void
)
taosArrayPush
(
q
nodeList
,
&
nodeLoad
);
numOfRows
++
;
numOfRows
++
;
sdbRelease
(
pSdb
,
pObj
);
sdbRelease
(
pSdb
,
pObj
);
if
(
qlistReq
.
rowNum
>
0
&&
numOfRows
>=
qlistReq
.
rowNum
)
{
if
(
limit
>
0
&&
numOfRows
>=
limit
)
{
break
;
break
;
}
}
}
}
*
pList
=
qnodeList
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
mndProcessQnodeListReq
(
SRpcMsg
*
pReq
)
{
int32_t
code
=
-
1
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SQnodeListReq
qlistReq
=
{
0
};
SQnodeListRsp
qlistRsp
=
{
0
};
if
(
tDeserializeSQnodeListReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
qlistReq
)
!=
0
)
{
mError
(
"failed to parse qnode list req"
);
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
}
if
(
mndCreateQnodeList
(
pMnode
,
&
qlistRsp
.
qnodeList
,
qlistReq
.
rowNum
)
!=
0
)
{
goto
_OVER
;
}
int32_t
rspLen
=
tSerializeSQnodeListRsp
(
NULL
,
0
,
&
qlistRsp
);
int32_t
rspLen
=
tSerializeSQnodeListRsp
(
NULL
,
0
,
&
qlistRsp
);
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
...
...
source/dnode/mnode/impl/src/mndSma.c
浏览文件 @
6874016b
...
@@ -409,7 +409,8 @@ static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
...
@@ -409,7 +409,8 @@ static int32_t mndSetCreateSmaRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
return
0
;
}
}
static
int32_t
mndSetCreateSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
)
{
static
int32_t
mndSetCreateSmaVgroupRedoActions
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
SSmaObj
*
pSma
)
{
SVnodeGid
*
pVgid
=
pVgroup
->
vnodeGid
+
0
;
SVnodeGid
*
pVgid
=
pVgroup
->
vnodeGid
+
0
;
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
if
(
pDnode
==
NULL
)
return
-
1
;
if
(
pDnode
==
NULL
)
return
-
1
;
...
@@ -419,9 +420,14 @@ static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans,
...
@@ -419,9 +420,14 @@ static int32_t mndSetCreateSmaVgroupRedoActions(SMnode *pMnode, STrans *pTrans,
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
// todo add sma info here
// todo add sma info here
int32_t
smaContLen
=
0
;
void
*
pSmaReq
=
mndBuildVCreateSmaReq
(
pMnode
,
pVgroup
,
pSma
,
&
smaContLen
);
if
(
pSmaReq
==
NULL
)
return
-
1
;
pVgroup
->
pTsma
=
pSmaReq
;
int32_t
contLen
=
0
;
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildCreateVnodeReq
(
pMnode
,
pDnode
,
pDb
,
pVgroup
,
&
contLen
);
void
*
pReq
=
mndBuildCreateVnodeReq
(
pMnode
,
pDnode
,
pDb
,
pVgroup
,
&
contLen
);
taosMemoryFreeClear
(
pSmaReq
);
if
(
pReq
==
NULL
)
return
-
1
;
if
(
pReq
==
NULL
)
return
-
1
;
action
.
pCont
=
pReq
;
action
.
pCont
=
pReq
;
...
@@ -502,19 +508,19 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
...
@@ -502,19 +508,19 @@ static int32_t mndCreateSma(SMnode *pMnode, SRpcMsg *pReq, SMCreateSmaReq *pCrea
streamObj
.
fixedSinkVgId
=
smaObj
.
dstVgId
;
streamObj
.
fixedSinkVgId
=
smaObj
.
dstVgId
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_CREATE_SMA
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create sma:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mDebug
(
"trans:%d, used to create sma:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
mndTransSetDbInfo
(
pTrans
,
pDb
);
mndTransSet
NoParalle
l
(
pTrans
);
mndTransSet
Seria
l
(
pTrans
);
if
(
mndSetCreateSmaRedoLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaRedoLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaCommitLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaCommitLogs
(
pMnode
,
pTrans
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupCommitLogs
(
pMnode
,
pTrans
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
streamObj
.
fixedSinkVg
)
!=
0
)
goto
_OVER
;
if
(
mndSetCreateSmaVgroupRedoActions
(
pMnode
,
pTrans
,
pDb
,
&
streamObj
.
fixedSinkVg
,
&
smaObj
)
!=
0
)
goto
_OVER
;
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
STREAM_TRIGGER_AT_ONCE
,
0
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndAddStreamToTrans
(
pMnode
,
&
streamObj
,
pCreate
->
ast
,
STREAM_TRIGGER_AT_ONCE
,
0
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
if
(
mndTransPrepare
(
pMnode
,
pTrans
)
!=
0
)
goto
_OVER
;
...
@@ -747,7 +753,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
...
@@ -747,7 +753,7 @@ static int32_t mndDropSma(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SSmaObj *p
pVgroup
=
mndAcquireVgroup
(
pMnode
,
pSma
->
dstVgId
);
pVgroup
=
mndAcquireVgroup
(
pMnode
,
pSma
->
dstVgId
);
if
(
pVgroup
==
NULL
)
goto
_OVER
;
if
(
pVgroup
==
NULL
)
goto
_OVER
;
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_DROP_SMA
,
pReq
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop sma:%s"
,
pTrans
->
id
,
pSma
->
name
);
mDebug
(
"trans:%d, used to drop sma:%s"
,
pTrans
->
id
,
pSma
->
name
);
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
6874016b
...
@@ -253,7 +253,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
...
@@ -253,7 +253,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SRpcMsg *pReq, SDnodeObj *pDnode,
snodeObj
.
createdTime
=
taosGetTimestampMs
();
snodeObj
.
createdTime
=
taosGetTimestampMs
();
snodeObj
.
updateTime
=
snodeObj
.
createdTime
;
snodeObj
.
updateTime
=
snodeObj
.
createdTime
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_SNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create snode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
mDebug
(
"trans:%d, used to create snode:%d"
,
pTrans
->
id
,
pCreate
->
dnodeId
);
...
@@ -372,7 +372,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
...
@@ -372,7 +372,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
static
int32_t
mndDropSnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SSnodeObj
*
pObj
)
{
static
int32_t
mndDropSnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SSnodeObj
*
pObj
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_DROP_SNODE
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop snode:%d"
,
pTrans
->
id
,
pObj
->
id
);
mDebug
(
"trans:%d, used to drop snode:%d"
,
pTrans
->
id
,
pObj
->
id
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
6874016b
...
@@ -735,7 +735,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
...
@@ -735,7 +735,7 @@ static int32_t mndCreateStb(SMnode *pMnode, SRpcMsg *pReq, SMCreateStbReq *pCrea
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_STB
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_DB_INSIDE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
mDebug
(
"trans:%d, used to create stb:%s"
,
pTrans
->
id
,
pCreate
->
name
);
...
@@ -1257,7 +1257,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p
...
@@ -1257,7 +1257,7 @@ static int32_t mndAlterStb(SMnode *pMnode, SRpcMsg *pReq, const SMAlterStbReq *p
if
(
code
!=
0
)
goto
_OVER
;
if
(
code
!=
0
)
goto
_OVER
;
code
=
-
1
;
code
=
-
1
;
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
TYPE_ALTER_STB
,
pReq
);
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_
CONFLICT_DB_INSIDE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pAlter
->
name
);
mDebug
(
"trans:%d, used to alter stb:%s"
,
pTrans
->
id
,
pAlter
->
name
);
...
@@ -1403,7 +1403,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
...
@@ -1403,7 +1403,7 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
static
int32_t
mndDropStb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
static
int32_t
mndDropStb
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SDbObj
*
pDb
,
SStbObj
*
pStb
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_DROP_STB
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_DB_INSIDE
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
mDebug
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
mDebug
(
"trans:%d, used to drop stb:%s"
,
pTrans
->
id
,
pStb
->
name
);
...
...
source/dnode/mnode/impl/src/mndStream.c
浏览文件 @
6874016b
...
@@ -402,7 +402,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SRpcMsg *pReq, SCMCreateStreamReq
...
@@ -402,7 +402,7 @@ static int32_t mndCreateStream(SMnode *pMnode, SRpcMsg *pReq, SCMCreateStreamReq
tstrncpy
(
streamObj
.
targetDb
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
tstrncpy
(
streamObj
.
targetDb
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
}
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_STREAM
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"stream:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"stream:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
6874016b
...
@@ -394,8 +394,8 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -394,8 +394,8 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
mInfo
(
"rebalance calculation completed, rebalanced vg:"
);
mInfo
(
"rebalance calculation completed, rebalanced vg:"
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pOutput
->
rebVgs
);
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pOutput
->
rebVgs
);
i
++
)
{
SMqRebOutputVg
*
pOutputRebVg
=
taosArrayGet
(
pOutput
->
rebVgs
,
i
);
SMqRebOutputVg
*
pOutputRebVg
=
taosArrayGet
(
pOutput
->
rebVgs
,
i
);
mInfo
(
"vg
: %d moved from consumer %ld to consumer %ld"
,
pOutputRebVg
->
pVgEp
->
vgId
,
pOutputRebVg
->
oldConsumer
Id
,
mInfo
(
"vg
Id:%d moved from consumer %"
PRId64
" to consumer %"
PRId64
,
pOutputRebVg
->
pVgEp
->
vg
Id
,
pOutputRebVg
->
newConsumerId
);
pOutputRebVg
->
oldConsumerId
,
pOutputRebVg
->
newConsumerId
);
}
}
// 9. clear
// 9. clear
...
@@ -405,10 +405,9 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -405,10 +405,9 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
}
}
static
int32_t
mndPersistRebResult
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
const
SMqRebOutputObj
*
pOutput
)
{
static
int32_t
mndPersistRebResult
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
const
SMqRebOutputObj
*
pOutput
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_REBALANCE
,
pMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_CONFLICT_NOTHING
,
pMsg
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
return
-
1
;
return
-
1
;
}
// make txn:
// make txn:
// 1. redo action: action to all vg
// 1. redo action: action to all vg
const
SArray
*
rebVgs
=
pOutput
->
rebVgs
;
const
SArray
*
rebVgs
=
pOutput
->
rebVgs
;
...
@@ -625,7 +624,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
...
@@ -625,7 +624,7 @@ static int32_t mndProcessDropCgroupReq(SRpcMsg *pReq) {
return
-
1
;
return
-
1
;
}
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_DROP_CGROUP
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"cgroup: %s on topic:%s, failed to drop since %s"
,
dropReq
.
cgroup
,
dropReq
.
topic
,
terrstr
());
mError
(
"cgroup: %s on topic:%s, failed to drop since %s"
,
dropReq
.
cgroup
,
dropReq
.
topic
,
terrstr
());
mndReleaseSubscribe
(
pMnode
,
pSub
);
mndReleaseSubscribe
(
pMnode
,
pSub
);
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
6874016b
...
@@ -383,7 +383,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
...
@@ -383,7 +383,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SRpcMsg *pReq, SCMCreateTopicReq *
/*topicObj.withSchema = 1;*/
/*topicObj.withSchema = 1;*/
}
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_TOPIC
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
taosMemoryFreeClear
(
topicObj
.
ast
);
taosMemoryFreeClear
(
topicObj
.
ast
);
...
@@ -551,7 +551,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
...
@@ -551,7 +551,7 @@ static int32_t mndProcessDropTopicReq(SRpcMsg *pReq) {
}
}
#endif
#endif
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_DROP_TOPIC
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"topic:%s, failed to drop since %s"
,
pTopic
->
name
,
terrstr
());
mError
(
"topic:%s, failed to drop since %s"
,
pTopic
->
name
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
6874016b
...
@@ -79,10 +79,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
...
@@ -79,10 +79,7 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
mDebug
(
"user:%s, will be created when deploying, raw:%p"
,
userObj
.
user
,
pRaw
);
mDebug
(
"user:%s, will be created when deploying, raw:%p"
,
userObj
.
user
,
pRaw
);
#if 0
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_NOTHING
,
NULL
);
return sdbWrite(pMnode->pSdb, pRaw);
#else
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_TYPE_CREATE_USER
,
NULL
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to create since %s"
,
userObj
.
user
,
terrstr
());
mError
(
"user:%s, failed to create since %s"
,
userObj
.
user
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -104,7 +101,6 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
...
@@ -104,7 +101,6 @@ static int32_t mndCreateDefaultUser(SMnode *pMnode, char *acct, char *user, char
mndTransDrop
(
pTrans
);
mndTransDrop
(
pTrans
);
return
0
;
return
0
;
#endif
}
}
static
int32_t
mndCreateDefaultUsers
(
SMnode
*
pMnode
)
{
static
int32_t
mndCreateDefaultUsers
(
SMnode
*
pMnode
)
{
...
@@ -291,7 +287,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
...
@@ -291,7 +287,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
updateTime
=
userObj
.
createdTime
;
userObj
.
superUser
=
pCreate
->
superUser
;
userObj
.
superUser
=
pCreate
->
superUser
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_USER
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to create since %s"
,
pCreate
->
user
,
terrstr
());
mError
(
"user:%s, failed to create since %s"
,
pCreate
->
user
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -371,7 +367,7 @@ _OVER:
...
@@ -371,7 +367,7 @@ _OVER:
}
}
static
int32_t
mndAlterUser
(
SMnode
*
pMnode
,
SUserObj
*
pOld
,
SUserObj
*
pNew
,
SRpcMsg
*
pReq
)
{
static
int32_t
mndAlterUser
(
SMnode
*
pMnode
,
SUserObj
*
pOld
,
SUserObj
*
pNew
,
SRpcMsg
*
pReq
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_ALTER_USER
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to alter since %s"
,
pOld
->
user
,
terrstr
());
mError
(
"user:%s, failed to alter since %s"
,
pOld
->
user
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -578,7 +574,7 @@ _OVER:
...
@@ -578,7 +574,7 @@ _OVER:
}
}
static
int32_t
mndDropUser
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SUserObj
*
pUser
)
{
static
int32_t
mndDropUser
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SUserObj
*
pUser
)
{
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_DROP_USER
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
CONFLICT_NOTHING
,
pReq
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
mError
(
"user:%s, failed to drop since %s"
,
pUser
->
user
,
terrstr
());
mError
(
"user:%s, failed to drop since %s"
,
pUser
->
user
,
terrstr
());
return
-
1
;
return
-
1
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
6874016b
...
@@ -218,6 +218,8 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
...
@@ -218,6 +218,8 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
createReq
.
hashMethod
=
pDb
->
cfg
.
hashMethod
;
createReq
.
hashMethod
=
pDb
->
cfg
.
hashMethod
;
createReq
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
createReq
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
createReq
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
createReq
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
createReq
.
isTsma
=
pVgroup
->
isTsma
;
createReq
.
pTsma
=
pVgroup
->
pTsma
;
for
(
int32_t
v
=
0
;
v
<
pVgroup
->
replica
;
++
v
)
{
for
(
int32_t
v
=
0
;
v
<
pVgroup
->
replica
;
++
v
)
{
SReplica
*
pReplica
=
&
createReq
.
replicas
[
v
];
SReplica
*
pReplica
=
&
createReq
.
replicas
[
v
];
...
...
source/dnode/mnode/impl/test/trans/trans2.cpp
浏览文件 @
6874016b
...
@@ -11,6 +11,8 @@
...
@@ -11,6 +11,8 @@
#include <gtest/gtest.h>
#include <gtest/gtest.h>
#if 0
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndUser.h"
#include "tcache.h"
#include "tcache.h"
...
@@ -103,7 +105,7 @@ class MndTestTrans2 : public ::testing::Test {
...
@@ -103,7 +105,7 @@ class MndTestTrans2 : public ::testing::Test {
void SetUp() override {}
void SetUp() override {}
void TearDown() override {}
void TearDown() override {}
int32_t
CreateUserLog
(
const
char
*
acct
,
const
char
*
user
,
ETrn
Type
type
,
SDbObj
*
pDb
)
{
int32_t CreateUserLog(const char *acct, const char *user, ETrn
Conflct conflict
, SDbObj *pDb) {
SUserObj userObj = {0};
SUserObj userObj = {0};
taosEncryptPass_c((uint8_t *)"taosdata", strlen("taosdata"), userObj.pass);
taosEncryptPass_c((uint8_t *)"taosdata", strlen("taosdata"), userObj.pass);
tstrncpy(userObj.user, user, TSDB_USER_LEN);
tstrncpy(userObj.user, user, TSDB_USER_LEN);
...
@@ -113,7 +115,7 @@ class MndTestTrans2 : public ::testing::Test {
...
@@ -113,7 +115,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj.superUser = 1;
userObj.superUser = 1;
SRpcMsg rpcMsg = {0};
SRpcMsg rpcMsg = {0};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
type
,
&
rpcMsg
);
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK,
conflict
, &rpcMsg);
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
mndTransAppendRedolog(pTrans, pRedoRaw);
mndTransAppendRedolog(pTrans, pRedoRaw);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
...
@@ -135,7 +137,7 @@ class MndTestTrans2 : public ::testing::Test {
...
@@ -135,7 +137,7 @@ class MndTestTrans2 : public ::testing::Test {
return code;
return code;
}
}
int32_t
CreateUserAction
(
const
char
*
acct
,
const
char
*
user
,
bool
hasUndoAction
,
ETrnPolicy
policy
,
ETrn
Type
type
,
int32_t CreateUserAction(const char *acct, const char *user, bool hasUndoAction, ETrnPolicy policy, ETrn
Conflct conflict
,
SDbObj *pDb) {
SDbObj *pDb) {
SUserObj userObj = {0};
SUserObj userObj = {0};
taosEncryptPass_c((uint8_t *)"taosdata", strlen("taosdata"), userObj.pass);
taosEncryptPass_c((uint8_t *)"taosdata", strlen("taosdata"), userObj.pass);
...
@@ -146,7 +148,7 @@ class MndTestTrans2 : public ::testing::Test {
...
@@ -146,7 +148,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj.superUser = 1;
userObj.superUser = 1;
SRpcMsg rpcMsg = {0};
SRpcMsg rpcMsg = {0};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
policy
,
type
,
&
rpcMsg
);
STrans *pTrans = mndTransCreate(pMnode, policy,
conflict
, &rpcMsg);
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
mndTransAppendRedolog(pTrans, pRedoRaw);
mndTransAppendRedolog(pTrans, pRedoRaw);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
...
@@ -218,7 +220,7 @@ class MndTestTrans2 : public ::testing::Test {
...
@@ -218,7 +220,7 @@ class MndTestTrans2 : public ::testing::Test {
userObj.superUser = 1;
userObj.superUser = 1;
SRpcMsg rpcMsg = {0};
SRpcMsg rpcMsg = {0};
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_
TYPE_CREATE_USER
,
&
rpcMsg
);
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_
CONFLICT_NOTHING
, &rpcMsg);
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
SSdbRaw *pRedoRaw = mndUserActionEncode(&userObj);
mndTransAppendRedolog(pTrans, pRedoRaw);
mndTransAppendRedolog(pTrans, pRedoRaw);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
sdbSetRawStatus(pRedoRaw, SDB_STATUS_READY);
...
@@ -528,3 +530,5 @@ TEST_F(MndTestTrans2, 04_Conflict) {
...
@@ -528,3 +530,5 @@ TEST_F(MndTestTrans2, 04_Conflict) {
mndReleaseUser(pMnode, pUser);
mndReleaseUser(pMnode, pUser);
}
}
}
}
#endif
\ No newline at end of file
source/dnode/mnode/impl/test/user/CMakeLists.txt
浏览文件 @
6874016b
...
@@ -5,7 +5,9 @@ target_link_libraries(
...
@@ -5,7 +5,9 @@ target_link_libraries(
PUBLIC sut
PUBLIC sut
)
)
add_test
(
if
(
NOT TD_WINDOWS
)
add_test
(
NAME userTest
NAME userTest
COMMAND userTest
COMMAND userTest
)
)
endif
(
NOT TD_WINDOWS
)
source/dnode/qnode/src/qnode.c
浏览文件 @
6874016b
...
@@ -41,12 +41,24 @@ void qndClose(SQnode *pQnode) {
...
@@ -41,12 +41,24 @@ void qndClose(SQnode *pQnode) {
}
}
int32_t
qndGetLoad
(
SQnode
*
pQnode
,
SQnodeLoad
*
pLoad
)
{
int32_t
qndGetLoad
(
SQnode
*
pQnode
,
SQnodeLoad
*
pLoad
)
{
SMsgCb
*
pCb
=
&
pQnode
->
msgCb
;
SReadHandle
handle
=
{.
pMsgCb
=
&
pQnode
->
msgCb
};
SQWorkerStat
stat
=
{
0
};
int32_t
code
=
qWorkerGetStat
(
&
handle
,
pQnode
->
pQuery
,
&
stat
);
if
(
code
)
{
return
code
;
}
pLoad
->
numOfQueryInQueue
=
pCb
->
qsizeFp
(
pCb
->
mgmt
,
pQnode
->
qndId
,
QUERY_QUEUE
);
pLoad
->
numOfQueryInQueue
=
stat
.
numOfQueryInQueue
;
pLoad
->
numOfFetchInQueue
=
pCb
->
qsizeFp
(
pCb
->
mgmt
,
pQnode
->
qndId
,
FETCH_QUEUE
);
pLoad
->
numOfFetchInQueue
=
stat
.
numOfFetchInQueue
;
pLoad
->
waitTimeInQueryQUeue
=
qWorkerGetWaitTimeInQueue
(
pQnode
->
pQuery
,
QUERY_QUEUE
);
pLoad
->
timeInQueryQueue
=
stat
.
timeInQueryQueue
;
pLoad
->
waitTimeInFetchQUeue
=
qWorkerGetWaitTimeInQueue
(
pQnode
->
pQuery
,
FETCH_QUEUE
);
pLoad
->
timeInFetchQueue
=
stat
.
timeInFetchQueue
;
pLoad
->
cacheDataSize
=
stat
.
cacheDataSize
;
pLoad
->
numOfProcessedQuery
=
stat
.
queryProcessed
;
pLoad
->
numOfProcessedCQuery
=
stat
.
cqueryProcessed
;
pLoad
->
numOfProcessedFetch
=
stat
.
fetchProcessed
;
pLoad
->
numOfProcessedDrop
=
stat
.
dropProcessed
;
pLoad
->
numOfProcessedHb
=
stat
.
hbProcessed
;
return
0
;
return
0
;
}
}
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
6874016b
...
@@ -80,6 +80,18 @@ int32_t metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid);
...
@@ -80,6 +80,18 @@ int32_t metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid);
int32_t
metaReadNext
(
SMetaReader
*
pReader
);
int32_t
metaReadNext
(
SMetaReader
*
pReader
);
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
cid
);
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
cid
);
typedef
struct
SMetaFltParam
{
tb_uid_t
suid
;
int16_t
cid
;
int16_t
type
;
char
*
val
;
bool
reverse
;
int
(
*
filterFunc
)(
void
*
a
,
void
*
b
,
int16_t
type
);
}
SMetaFltParam
;
int32_t
metaFilteTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
results
);
#if 1 // refact APIs below (TODO)
#if 1 // refact APIs below (TODO)
typedef
SVCreateTbReq
STbCfg
;
typedef
SVCreateTbReq
STbCfg
;
typedef
SVCreateTSmaReq
SSmaCfg
;
typedef
SVCreateTSmaReq
SSmaCfg
;
...
@@ -159,12 +171,13 @@ struct SVnodeCfg {
...
@@ -159,12 +171,13 @@ struct SVnodeCfg {
uint64_t
szBuf
;
uint64_t
szBuf
;
bool
isHeap
;
bool
isHeap
;
bool
isWeak
;
bool
isWeak
;
int8_t
isTsma
;
int8_t
hashMethod
;
STsdbCfg
tsdbCfg
;
STsdbCfg
tsdbCfg
;
SWalCfg
walCfg
;
SWalCfg
walCfg
;
SSyncCfg
syncCfg
;
SSyncCfg
syncCfg
;
uint32_t
hashBegin
;
uint32_t
hashBegin
;
uint32_t
hashEnd
;
uint32_t
hashEnd
;
int8_t
hashMethod
;
};
};
typedef
struct
{
typedef
struct
{
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
6874016b
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
#ifndef _TD_VNODE_META_H_
#ifndef _TD_VNODE_META_H_
#define _TD_VNODE_META_H_
#define _TD_VNODE_META_H_
#include "vnodeInt.h"
#include "index.h"
#include "index.h"
#include "vnodeInt.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -45,8 +45,6 @@ int32_t metaULock(SMeta* pMeta);
...
@@ -45,8 +45,6 @@ int32_t metaULock(SMeta* pMeta);
int
metaEncodeEntry
(
SEncoder
*
pCoder
,
const
SMetaEntry
*
pME
);
int
metaEncodeEntry
(
SEncoder
*
pCoder
,
const
SMetaEntry
*
pME
);
int
metaDecodeEntry
(
SDecoder
*
pCoder
,
SMetaEntry
*
pME
);
int
metaDecodeEntry
(
SDecoder
*
pCoder
,
SMetaEntry
*
pME
);
// metaTable ==================
// metaQuery ==================
// metaQuery ==================
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
);
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
);
...
@@ -118,6 +116,10 @@ typedef struct {
...
@@ -118,6 +116,10 @@ typedef struct {
int64_t
smaUid
;
int64_t
smaUid
;
}
SSmaIdxKey
;
}
SSmaIdxKey
;
// metaTable ==================
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int8_t
type
,
tb_uid_t
uid
,
STagIdxKey
**
ppTagIdxKey
,
int32_t
*
nTagIdxKey
);
#ifndef META_REFACT
#ifndef META_REFACT
// SMetaDB
// SMetaDB
int
metaOpenDB
(
SMeta
*
pMeta
);
int
metaOpenDB
(
SMeta
*
pMeta
);
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
6874016b
...
@@ -31,7 +31,7 @@ void metaReaderClear(SMetaReader *pReader) {
...
@@ -31,7 +31,7 @@ void metaReaderClear(SMetaReader *pReader) {
}
}
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
)
{
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
SMeta
*
pMeta
=
pReader
->
pMeta
;
STbDbKey
tbDbKey
=
{.
version
=
version
,
.
uid
=
uid
};
STbDbKey
tbDbKey
=
{.
version
=
version
,
.
uid
=
uid
};
// query table.db
// query table.db
...
@@ -54,7 +54,7 @@ _err:
...
@@ -54,7 +54,7 @@ _err:
}
}
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
)
{
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
SMeta
*
pMeta
=
pReader
->
pMeta
;
int64_t
version
;
int64_t
version
;
// query uid.idx
// query uid.idx
...
@@ -68,7 +68,7 @@ int metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid) {
...
@@ -68,7 +68,7 @@ int metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid) {
}
}
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
)
{
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
SMeta
*
pMeta
=
pReader
->
pMeta
;
tb_uid_t
uid
;
tb_uid_t
uid
;
// query name.idx
// query name.idx
...
@@ -82,7 +82,7 @@ int metaGetTableEntryByName(SMetaReader *pReader, const char *name) {
...
@@ -82,7 +82,7 @@ int metaGetTableEntryByName(SMetaReader *pReader, const char *name) {
}
}
tb_uid_t
metaGetTableEntryUidByName
(
SMeta
*
pMeta
,
const
char
*
name
)
{
tb_uid_t
metaGetTableEntryUidByName
(
SMeta
*
pMeta
,
const
char
*
name
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int
nData
=
0
;
tb_uid_t
uid
=
0
;
tb_uid_t
uid
=
0
;
...
@@ -134,7 +134,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
...
@@ -134,7 +134,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
int
metaTbCursorNext
(
SMTbCursor
*
pTbCur
)
{
int
metaTbCursorNext
(
SMTbCursor
*
pTbCur
)
{
int
ret
;
int
ret
;
void
*
pBuf
;
void
*
pBuf
;
STbCfg
tbCfg
;
STbCfg
tbCfg
;
for
(;;)
{
for
(;;)
{
...
@@ -155,7 +155,7 @@ int metaTbCursorNext(SMTbCursor *pTbCur) {
...
@@ -155,7 +155,7 @@ int metaTbCursorNext(SMTbCursor *pTbCur) {
}
}
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
)
{
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int
nData
=
0
;
int64_t
version
;
int64_t
version
;
SSchemaWrapper
schema
=
{
0
};
SSchemaWrapper
schema
=
{
0
};
...
@@ -205,11 +205,11 @@ _err:
...
@@ -205,11 +205,11 @@ _err:
}
}
struct
SMCtbCursor
{
struct
SMCtbCursor
{
SMeta
*
pMeta
;
SMeta
*
pMeta
;
TBC
*
pCur
;
TBC
*
pCur
;
tb_uid_t
suid
;
tb_uid_t
suid
;
void
*
pKey
;
void
*
pKey
;
void
*
pVal
;
void
*
pVal
;
int
kLen
;
int
kLen
;
int
vLen
;
int
vLen
;
};
};
...
@@ -281,10 +281,10 @@ tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur) {
...
@@ -281,10 +281,10 @@ tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur) {
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
)
{
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
)
{
tb_uid_t
quid
;
tb_uid_t
quid
;
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
STSchema
*
pTSchema
=
NULL
;
STSchema
*
pTSchema
=
NULL
;
SSchemaWrapper
*
pSW
=
NULL
;
SSchemaWrapper
*
pSW
=
NULL
;
STSchemaBuilder
sb
=
{
0
};
STSchemaBuilder
sb
=
{
0
};
SSchema
*
pSchema
;
SSchema
*
pSchema
;
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaGetTableEntryByUid
(
&
mr
,
uid
);
metaGetTableEntryByUid
(
&
mr
,
uid
);
...
@@ -321,11 +321,11 @@ int metaGetTbNum(SMeta *pMeta) {
...
@@ -321,11 +321,11 @@ int metaGetTbNum(SMeta *pMeta) {
}
}
typedef
struct
{
typedef
struct
{
SMeta
*
pMeta
;
SMeta
*
pMeta
;
TBC
*
pCur
;
TBC
*
pCur
;
tb_uid_t
uid
;
tb_uid_t
uid
;
void
*
pKey
;
void
*
pKey
;
void
*
pVal
;
void
*
pVal
;
int
kLen
;
int
kLen
;
int
vLen
;
int
vLen
;
}
SMSmaCursor
;
}
SMSmaCursor
;
...
@@ -397,7 +397,7 @@ tb_uid_t metaSmaCursorNext(SMSmaCursor *pSmaCur) {
...
@@ -397,7 +397,7 @@ tb_uid_t metaSmaCursorNext(SMSmaCursor *pSmaCur) {
STSmaWrapper
*
metaGetSmaInfoByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
bool
deepCopy
)
{
STSmaWrapper
*
metaGetSmaInfoByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
bool
deepCopy
)
{
STSmaWrapper
*
pSW
=
NULL
;
STSmaWrapper
*
pSW
=
NULL
;
SArray
*
pSmaIds
=
NULL
;
SArray
*
pSmaIds
=
NULL
;
if
(
!
(
pSmaIds
=
metaGetSmaIdsByTable
(
pMeta
,
uid
)))
{
if
(
!
(
pSmaIds
=
metaGetSmaIdsByTable
(
pMeta
,
uid
)))
{
return
NULL
;
return
NULL
;
...
@@ -421,7 +421,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
...
@@ -421,7 +421,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaReaderInit
(
&
mr
,
pMeta
,
0
);
int64_t
smaId
;
int64_t
smaId
;
int
smaIdx
=
0
;
int
smaIdx
=
0
;
STSma
*
pTSma
=
NULL
;
STSma
*
pTSma
=
NULL
;
for
(
int
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
for
(
int
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
smaId
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pSmaIds
,
i
);
smaId
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pSmaIds
,
i
);
if
(
metaGetTableEntryByUid
(
&
mr
,
smaId
)
<
0
)
{
if
(
metaGetTableEntryByUid
(
&
mr
,
smaId
)
<
0
)
{
...
@@ -469,7 +469,7 @@ _err:
...
@@ -469,7 +469,7 @@ _err:
}
}
STSma
*
metaGetSmaInfoByIndex
(
SMeta
*
pMeta
,
int64_t
indexUid
)
{
STSma
*
metaGetSmaInfoByIndex
(
SMeta
*
pMeta
,
int64_t
indexUid
)
{
STSma
*
pTSma
=
NULL
;
STSma
*
pTSma
=
NULL
;
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaReaderInit
(
&
mr
,
pMeta
,
0
);
if
(
metaGetTableEntryByUid
(
&
mr
,
indexUid
)
<
0
)
{
if
(
metaGetTableEntryByUid
(
&
mr
,
indexUid
)
<
0
)
{
...
@@ -491,7 +491,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
...
@@ -491,7 +491,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
}
}
SArray
*
metaGetSmaIdsByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
SArray
*
metaGetSmaIdsByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
SArray
*
pUids
=
NULL
;
SArray
*
pUids
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
SMSmaCursor
*
pCur
=
metaOpenSmaCursor
(
pMeta
,
uid
);
SMSmaCursor
*
pCur
=
metaOpenSmaCursor
(
pMeta
,
uid
);
...
@@ -529,7 +529,7 @@ SArray *metaGetSmaIdsByTable(SMeta *pMeta, tb_uid_t uid) {
...
@@ -529,7 +529,7 @@ SArray *metaGetSmaIdsByTable(SMeta *pMeta, tb_uid_t uid) {
}
}
SArray
*
metaGetSmaTbUids
(
SMeta
*
pMeta
)
{
SArray
*
metaGetSmaTbUids
(
SMeta
*
pMeta
)
{
SArray
*
pUids
=
NULL
;
SArray
*
pUids
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
tb_uid_t
lastUid
=
0
;
tb_uid_t
lastUid
=
0
;
...
@@ -577,3 +577,78 @@ const void *metaGetTableTagVal(SMetaEntry *pEntry, int16_t cid) {
...
@@ -577,3 +577,78 @@ const void *metaGetTableTagVal(SMetaEntry *pEntry, int16_t cid) {
ASSERT
(
pEntry
->
type
==
TSDB_CHILD_TABLE
);
ASSERT
(
pEntry
->
type
==
TSDB_CHILD_TABLE
);
return
tdGetKVRowValOfCol
((
const
SKVRow
)
pEntry
->
ctbEntry
.
pTags
,
cid
);
return
tdGetKVRowValOfCol
((
const
SKVRow
)
pEntry
->
ctbEntry
.
pTags
,
cid
);
}
}
typedef
struct
{
SMeta
*
pMeta
;
TBC
*
pCur
;
tb_uid_t
suid
;
int16_t
cid
;
int16_t
type
;
void
*
pKey
;
void
*
pVal
;
int32_t
kLen
;
int32_t
vLen
;
}
SIdxCursor
;
int32_t
metaFilteTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
SIdxCursor
*
pCursor
=
NULL
;
char
*
tagData
=
param
->
val
;
int32_t
ret
=
0
,
valid
=
0
;
pCursor
=
(
SIdxCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SIdxCursor
));
pCursor
->
pMeta
=
pMeta
;
pCursor
->
suid
=
param
->
suid
;
pCursor
->
cid
=
param
->
cid
;
pCursor
->
type
=
param
->
type
;
metaRLock
(
pMeta
);
ret
=
tdbTbcOpen
(
pMeta
->
pTagIdx
,
&
pCursor
->
pCur
,
NULL
);
if
(
ret
<
0
)
{
goto
END
;
}
STagIdxKey
*
pKey
=
NULL
;
int32_t
nKey
=
0
;
ret
=
metaCreateTagIdxKey
(
pCursor
->
suid
,
pCursor
->
cid
,
param
->
val
,
pCursor
->
type
,
param
->
reverse
?
INT64_MAX
:
INT64_MIN
,
&
pKey
,
&
nKey
);
if
(
ret
!=
0
)
{
goto
END
;
}
int
cmp
=
0
;
if
(
tdbTbcMoveTo
(
pCursor
->
pCur
,
pKey
,
nKey
,
&
cmp
)
<
0
)
{
goto
END
;
}
void
*
entryKey
=
NULL
,
*
entryVal
=
NULL
;
int32_t
nEntryKey
,
nEntryVal
;
while
(
1
)
{
valid
=
tdbTbcGet
(
pCursor
->
pCur
,
(
const
void
**
)
&
entryKey
,
&
nEntryKey
,
(
const
void
**
)
&
entryVal
,
&
nEntryVal
);
if
(
valid
<
0
)
{
break
;
}
STagIdxKey
*
p
=
entryKey
;
if
(
p
!=
NULL
)
{
int32_t
cmp
=
(
*
param
->
filterFunc
)(
p
->
data
,
pKey
->
data
,
pKey
->
type
);
if
(
cmp
==
0
)
{
// match
tb_uid_t
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
tDataTypes
[
pCursor
->
type
].
bytes
);
taosArrayPush
(
pUids
,
&
tuid
);
}
else
if
(
cmp
==
1
)
{
// not match but should continue to iter
}
else
{
// not match and no more result
break
;
}
}
valid
=
param
->
reverse
?
tdbTbcMoveToPrev
(
pCursor
->
pCur
)
:
tdbTbcMoveToNext
(
pCursor
->
pCur
);
if
(
valid
<
0
)
{
break
;
}
}
END:
if
(
pCursor
->
pMeta
)
metaULock
(
pCursor
->
pMeta
);
if
(
pCursor
->
pCur
)
tdbTbcClose
(
pCursor
->
pCur
);
taosMemoryFree
(
pCursor
);
return
ret
;
}
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
6874016b
...
@@ -721,7 +721,7 @@ static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -721,7 +721,7 @@ static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) {
return
tdbTbInsert
(
pMeta
->
pCtbIdx
,
&
ctbIdxKey
,
sizeof
(
ctbIdxKey
),
NULL
,
0
,
&
pMeta
->
txn
);
return
tdbTbInsert
(
pMeta
->
pCtbIdx
,
&
ctbIdxKey
,
sizeof
(
ctbIdxKey
),
NULL
,
0
,
&
pMeta
->
txn
);
}
}
static
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int8_t
type
,
tb_uid_t
uid
,
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int8_t
type
,
tb_uid_t
uid
,
STagIdxKey
**
ppTagIdxKey
,
int32_t
*
nTagIdxKey
)
{
STagIdxKey
**
ppTagIdxKey
,
int32_t
*
nTagIdxKey
)
{
int32_t
nTagData
=
0
;
int32_t
nTagData
=
0
;
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
6874016b
...
@@ -414,7 +414,7 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
...
@@ -414,7 +414,7 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
}
}
taosMemoryFreeClear
(
pReq
);
taosMemoryFreeClear
(
pReq
);
}
else
{
}
else
{
sma
Warn
(
"vgId:%d no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
sma
Debug
(
"vgId:%d no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
}
}
taosArrayDestroy
(
pResult
);
taosArrayDestroy
(
pResult
);
...
...
source/dnode/vnode/src/vnd/vnodeCfg.c
浏览文件 @
6874016b
...
@@ -56,6 +56,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
...
@@ -56,6 +56,7 @@ int vnodeEncodeConfig(const void *pObj, SJson *pJson) {
if
(
tjsonAddIntegerToObject
(
pJson
,
"szBuf"
,
pCfg
->
szBuf
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"szBuf"
,
pCfg
->
szBuf
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isHeap"
,
pCfg
->
isHeap
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isHeap"
,
pCfg
->
isHeap
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isWeak"
,
pCfg
->
isWeak
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isWeak"
,
pCfg
->
isWeak
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"isTsma"
,
pCfg
->
isTsma
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"precision"
,
pCfg
->
tsdbCfg
.
precision
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"precision"
,
pCfg
->
tsdbCfg
.
precision
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"update"
,
pCfg
->
tsdbCfg
.
update
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"update"
,
pCfg
->
tsdbCfg
.
update
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"compression"
,
pCfg
->
tsdbCfg
.
compression
)
<
0
)
return
-
1
;
if
(
tjsonAddIntegerToObject
(
pJson
,
"compression"
,
pCfg
->
tsdbCfg
.
compression
)
<
0
)
return
-
1
;
...
@@ -130,6 +131,8 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
...
@@ -130,6 +131,8 @@ int vnodeDecodeConfig(const SJson *pJson, void *pObj) {
if
(
code
<
0
)
return
-
1
;
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"isWeak"
,
pCfg
->
isWeak
,
code
);
tjsonGetNumberValue
(
pJson
,
"isWeak"
,
pCfg
->
isWeak
,
code
);
if
(
code
<
0
)
return
-
1
;
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"isTsma"
,
pCfg
->
isTsma
,
code
);
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"precision"
,
pCfg
->
tsdbCfg
.
precision
,
code
);
tjsonGetNumberValue
(
pJson
,
"precision"
,
pCfg
->
tsdbCfg
.
precision
,
code
);
if
(
code
<
0
)
return
-
1
;
if
(
code
<
0
)
return
-
1
;
tjsonGetNumberValue
(
pJson
,
"update"
,
pCfg
->
tsdbCfg
.
update
,
code
);
tjsonGetNumberValue
(
pJson
,
"update"
,
pCfg
->
tsdbCfg
.
update
,
code
);
...
...
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
6874016b
...
@@ -97,7 +97,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
...
@@ -97,7 +97,7 @@ SVnode *vnodeOpen(const char *path, STfs *pTfs, SMsgCb msgCb) {
}
}
// open tsdb
// open tsdb
if
(
!
vnodeIsRollup
(
pVnode
)
&&
tsdbOpen
(
pVnode
,
&
VND_TSDB
(
pVnode
),
VNODE_TSDB_DIR
,
TSDB_TYPE_TSDB
)
<
0
)
{
if
(
!
vnodeIsRollup
(
pVnode
)
&&
tsdbOpen
(
pVnode
,
&
VND_TSDB
(
pVnode
),
VNODE_TSDB_DIR
,
NULL
)
<
0
)
{
vError
(
"vgId:%d failed to open vnode tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
vError
(
"vgId:%d failed to open vnode tsdb since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
6874016b
...
@@ -342,16 +342,16 @@ typedef struct SCtgOperation {
...
@@ -342,16 +342,16 @@ typedef struct SCtgOperation {
ctgOpFunc
func
;
ctgOpFunc
func
;
}
SCtgOperation
;
}
SCtgOperation
;
#define CTG_QUEUE_
ADD
() atomic_add_fetch_64(&gCtgMgmt.queue.qRemainNum, 1)
#define CTG_QUEUE_
INC
() atomic_add_fetch_64(&gCtgMgmt.queue.qRemainNum, 1)
#define CTG_QUEUE_
SUB
() atomic_sub_fetch_64(&gCtgMgmt.queue.qRemainNum, 1)
#define CTG_QUEUE_
DEC
() atomic_sub_fetch_64(&gCtgMgmt.queue.qRemainNum, 1)
#define CTG_STAT_
ADD
(_item, _n) atomic_add_fetch_64(&(_item), _n)
#define CTG_STAT_
INC
(_item, _n) atomic_add_fetch_64(&(_item), _n)
#define CTG_STAT_
SUB
(_item, _n) atomic_sub_fetch_64(&(_item), _n)
#define CTG_STAT_
DEC
(_item, _n) atomic_sub_fetch_64(&(_item), _n)
#define CTG_STAT_GET(_item) atomic_load_64(&(_item))
#define CTG_STAT_GET(_item) atomic_load_64(&(_item))
#define CTG_R
UNTIME_STAT_ADD(item, n) (CTG_STAT_ADD
(gCtgMgmt.stat.runtime.item, n))
#define CTG_R
T_STAT_INC(item, n) (CTG_STAT_INC
(gCtgMgmt.stat.runtime.item, n))
#define CTG_CACHE_STAT_
ADD(item, n) (CTG_STAT_ADD
(gCtgMgmt.stat.cache.item, n))
#define CTG_CACHE_STAT_
INC(item, n) (CTG_STAT_INC
(gCtgMgmt.stat.cache.item, n))
#define CTG_CACHE_STAT_
SUB(item, n) (CTG_STAT_SUB
(gCtgMgmt.stat.cache.item, n))
#define CTG_CACHE_STAT_
DEC(item, n) (CTG_STAT_DEC
(gCtgMgmt.stat.cache.item, n))
#define CTG_IS_META_NULL(type) ((type) == META_TYPE_NULL_TABLE)
#define CTG_IS_META_NULL(type) ((type) == META_TYPE_NULL_TABLE)
#define CTG_IS_META_CTABLE(type) ((type) == META_TYPE_CTABLE)
#define CTG_IS_META_CTABLE(type) ((type) == META_TYPE_CTABLE)
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
6874016b
...
@@ -558,7 +558,7 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
...
@@ -558,7 +558,7 @@ int32_t catalogGetHandle(uint64_t clusterId, SCatalog** catalogHandle) {
*
catalogHandle
=
clusterCtg
;
*
catalogHandle
=
clusterCtg
;
CTG_CACHE_STAT_
ADD
(
clusterNum
,
1
);
CTG_CACHE_STAT_
INC
(
clusterNum
,
1
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -579,7 +579,7 @@ void catalogFreeHandle(SCatalog* pCtg) {
...
@@ -579,7 +579,7 @@ void catalogFreeHandle(SCatalog* pCtg) {
return
;
return
;
}
}
CTG_CACHE_STAT_
SUB
(
clusterNum
,
1
);
CTG_CACHE_STAT_
DEC
(
clusterNum
,
1
);
uint64_t
clusterId
=
pCtg
->
clusterId
;
uint64_t
clusterId
=
pCtg
->
clusterId
;
...
@@ -990,7 +990,7 @@ int32_t catalogGetAllMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps,
...
@@ -990,7 +990,7 @@ int32_t catalogGetAllMeta(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps,
}
}
if
(
pReq
->
qNodeRequired
)
{
if
(
pReq
->
qNodeRequired
)
{
pRsp
->
pQnodeList
=
taosArrayInit
(
10
,
sizeof
(
SQueryNode
Addr
));
pRsp
->
pQnodeList
=
taosArrayInit
(
10
,
sizeof
(
SQueryNode
Load
));
CTG_ERR_JRET
(
ctgGetQnodeListFromMnode
(
CTG_PARAMS_LIST
(),
pRsp
->
pQnodeList
,
NULL
));
CTG_ERR_JRET
(
ctgGetQnodeListFromMnode
(
CTG_PARAMS_LIST
(),
pRsp
->
pQnodeList
,
NULL
));
}
}
...
...
source/libs/catalog/src/ctgCache.c
浏览文件 @
6874016b
...
@@ -178,7 +178,7 @@ int32_t ctgAcquireVgInfoFromCache(SCatalog* pCtg, const char *dbFName, SCtgDBCac
...
@@ -178,7 +178,7 @@ int32_t ctgAcquireVgInfoFromCache(SCatalog* pCtg, const char *dbFName, SCtgDBCac
*
pCache
=
dbCache
;
*
pCache
=
dbCache
;
CTG_CACHE_STAT_
ADD
(
vgHitNum
,
1
);
CTG_CACHE_STAT_
INC
(
vgHitNum
,
1
);
ctgDebug
(
"Got db vgInfo from cache, dbFName:%s"
,
dbFName
);
ctgDebug
(
"Got db vgInfo from cache, dbFName:%s"
,
dbFName
);
...
@@ -192,7 +192,7 @@ _return:
...
@@ -192,7 +192,7 @@ _return:
*
pCache
=
NULL
;
*
pCache
=
NULL
;
CTG_CACHE_STAT_
ADD
(
vgMissNum
,
1
);
CTG_CACHE_STAT_
INC
(
vgMissNum
,
1
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -279,7 +279,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
...
@@ -279,7 +279,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgDebug
(
"Got meta from cache, type:%d, dbFName:%s, tbName:%s"
,
tbMeta
->
tableType
,
dbFName
,
ctx
->
pName
->
tname
);
ctgDebug
(
"Got meta from cache, type:%d, dbFName:%s, tbName:%s"
,
tbMeta
->
tableType
,
dbFName
,
ctx
->
pName
->
tname
);
CTG_CACHE_STAT_
ADD
(
tblHitNum
,
1
);
CTG_CACHE_STAT_
INC
(
tblHitNum
,
1
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -312,7 +312,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
...
@@ -312,7 +312,7 @@ int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta**
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
CTG_CACHE_STAT_
ADD
(
tblHitNum
,
1
);
CTG_CACHE_STAT_
INC
(
tblHitNum
,
1
);
ctgDebug
(
"Got tbmeta from cache, dbFName:%s, tbName:%s"
,
dbFName
,
ctx
->
pName
->
tname
);
ctgDebug
(
"Got tbmeta from cache, dbFName:%s, tbName:%s"
,
dbFName
,
ctx
->
pName
->
tname
);
...
@@ -323,7 +323,7 @@ _return:
...
@@ -323,7 +323,7 @@ _return:
ctgReleaseDBCache
(
pCtg
,
dbCache
);
ctgReleaseDBCache
(
pCtg
,
dbCache
);
taosMemoryFreeClear
(
*
pTableMeta
);
taosMemoryFreeClear
(
*
pTableMeta
);
CTG_CACHE_STAT_
ADD
(
tblMissNum
,
1
);
CTG_CACHE_STAT_
INC
(
tblMissNum
,
1
);
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
...
@@ -462,7 +462,7 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFNam
...
@@ -462,7 +462,7 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFNam
*
inCache
=
true
;
*
inCache
=
true
;
ctgDebug
(
"Got user from cache, user:%s"
,
user
);
ctgDebug
(
"Got user from cache, user:%s"
,
user
);
CTG_CACHE_STAT_
ADD
(
userHitNum
,
1
);
CTG_CACHE_STAT_
INC
(
userHitNum
,
1
);
if
(
pUser
->
superUser
)
{
if
(
pUser
->
superUser
)
{
*
pass
=
true
;
*
pass
=
true
;
...
@@ -491,7 +491,7 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFNam
...
@@ -491,7 +491,7 @@ int32_t ctgChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFNam
_return:
_return:
*
inCache
=
false
;
*
inCache
=
false
;
CTG_CACHE_STAT_
ADD
(
userMissNum
,
1
);
CTG_CACHE_STAT_
INC
(
userMissNum
,
1
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -521,7 +521,7 @@ void ctgDequeue(SCtgCacheOperation **op) {
...
@@ -521,7 +521,7 @@ void ctgDequeue(SCtgCacheOperation **op) {
SCtgQNode
*
node
=
gCtgMgmt
.
queue
.
head
->
next
;
SCtgQNode
*
node
=
gCtgMgmt
.
queue
.
head
->
next
;
gCtgMgmt
.
queue
.
head
=
gCtgMgmt
.
queue
.
head
->
next
;
gCtgMgmt
.
queue
.
head
=
gCtgMgmt
.
queue
.
head
->
next
;
CTG_QUEUE_
SUB
();
CTG_QUEUE_
DEC
();
taosMemoryFreeClear
(
orig
);
taosMemoryFreeClear
(
orig
);
...
@@ -545,8 +545,8 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
...
@@ -545,8 +545,8 @@ int32_t ctgEnqueue(SCatalog* pCtg, SCtgCacheOperation *operation) {
gCtgMgmt
.
queue
.
tail
=
node
;
gCtgMgmt
.
queue
.
tail
=
node
;
CTG_UNLOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
gCtgMgmt
.
queue
.
qlock
);
CTG_QUEUE_
ADD
();
CTG_QUEUE_
INC
();
CTG_R
UNTIME_STAT_ADD
(
qNum
,
1
);
CTG_R
T_STAT_INC
(
qNum
,
1
);
tsem_post
(
&
gCtgMgmt
.
queue
.
reqSem
);
tsem_post
(
&
gCtgMgmt
.
queue
.
reqSem
);
...
@@ -988,7 +988,7 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
...
@@ -988,7 +988,7 @@ int32_t ctgAddNewDBCache(SCatalog *pCtg, const char *dbFName, uint64_t dbId) {
CTG_ERR_JRET
(
TSDB_CODE_CTG_MEM_ERROR
);
CTG_ERR_JRET
(
TSDB_CODE_CTG_MEM_ERROR
);
}
}
CTG_CACHE_STAT_
ADD
(
dbNum
,
1
);
CTG_CACHE_STAT_
INC
(
dbNum
,
1
);
SDbVgVersion
vgVersion
=
{.
dbId
=
newDBCache
.
dbId
,
.
vgVersion
=
-
1
};
SDbVgVersion
vgVersion
=
{.
dbId
=
newDBCache
.
dbId
,
.
vgVersion
=
-
1
};
strncpy
(
vgVersion
.
dbFName
,
dbFName
,
sizeof
(
vgVersion
.
dbFName
));
strncpy
(
vgVersion
.
dbFName
,
dbFName
,
sizeof
(
vgVersion
.
dbFName
));
...
@@ -1048,7 +1048,7 @@ int32_t ctgRemoveDBFromCache(SCatalog* pCtg, SCtgDBCache *dbCache, const char* d
...
@@ -1048,7 +1048,7 @@ int32_t ctgRemoveDBFromCache(SCatalog* pCtg, SCtgDBCache *dbCache, const char* d
CTG_ERR_RET
(
TSDB_CODE_CTG_DB_DROPPED
);
CTG_ERR_RET
(
TSDB_CODE_CTG_DB_DROPPED
);
}
}
CTG_CACHE_STAT_
SUB
(
dbNum
,
1
);
CTG_CACHE_STAT_
DEC
(
dbNum
,
1
);
ctgInfo
(
"db removed from cache, dbFName:%s, dbId:%"
PRIx64
,
dbFName
,
dbId
);
ctgInfo
(
"db removed from cache, dbFName:%s, dbId:%"
PRIx64
,
dbFName
,
dbId
);
...
@@ -1187,7 +1187,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
...
@@ -1187,7 +1187,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
if
(
taosHashRemove
(
tbCache
->
stbCache
,
&
orig
->
suid
,
sizeof
(
orig
->
suid
)))
{
if
(
taosHashRemove
(
tbCache
->
stbCache
,
&
orig
->
suid
,
sizeof
(
orig
->
suid
)))
{
ctgError
(
"stb not exist in stbCache, dbFName:%s, stb:%s, suid:%"
PRIx64
,
dbFName
,
tbName
,
orig
->
suid
);
ctgError
(
"stb not exist in stbCache, dbFName:%s, stb:%s, suid:%"
PRIx64
,
dbFName
,
tbName
,
orig
->
suid
);
}
else
{
}
else
{
CTG_CACHE_STAT_
SUB
(
stblNum
,
1
);
CTG_CACHE_STAT_
DEC
(
stblNum
,
1
);
}
}
CTG_UNLOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
...
@@ -1214,7 +1214,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
...
@@ -1214,7 +1214,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
}
}
if
(
NULL
==
orig
)
{
if
(
NULL
==
orig
)
{
CTG_CACHE_STAT_
ADD
(
tblNum
,
1
);
CTG_CACHE_STAT_
INC
(
tblNum
,
1
);
}
}
ctgDebug
(
"tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d"
,
dbFName
,
tbName
,
meta
->
tableType
);
ctgDebug
(
"tbmeta updated to cache, dbFName:%s, tbName:%s, tbType:%d"
,
dbFName
,
tbName
,
meta
->
tableType
);
...
@@ -1233,7 +1233,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
...
@@ -1233,7 +1233,7 @@ int32_t ctgWriteTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, char *dbFNam
CTG_ERR_RET
(
TSDB_CODE_CTG_MEM_ERROR
);
CTG_ERR_RET
(
TSDB_CODE_CTG_MEM_ERROR
);
}
}
CTG_CACHE_STAT_
ADD
(
stblNum
,
1
);
CTG_CACHE_STAT_
INC
(
stblNum
,
1
);
CTG_UNLOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
tbCache
->
stbLock
);
...
@@ -1371,14 +1371,14 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) {
...
@@ -1371,14 +1371,14 @@ int32_t ctgOpDropStbMeta(SCtgCacheOperation *operation) {
if
(
taosHashRemove
(
dbCache
->
tbCache
.
stbCache
,
&
msg
->
suid
,
sizeof
(
msg
->
suid
)))
{
if
(
taosHashRemove
(
dbCache
->
tbCache
.
stbCache
,
&
msg
->
suid
,
sizeof
(
msg
->
suid
)))
{
ctgDebug
(
"stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:%"
PRIx64
,
msg
->
dbFName
,
msg
->
stbName
,
msg
->
suid
);
ctgDebug
(
"stb not exist in stbCache, may be removed, dbFName:%s, stb:%s, suid:%"
PRIx64
,
msg
->
dbFName
,
msg
->
stbName
,
msg
->
suid
);
}
else
{
}
else
{
CTG_CACHE_STAT_
SUB
(
stblNum
,
1
);
CTG_CACHE_STAT_
DEC
(
stblNum
,
1
);
}
}
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
CTG_LOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
if
(
taosHashRemove
(
dbCache
->
tbCache
.
metaCache
,
msg
->
stbName
,
strlen
(
msg
->
stbName
)))
{
if
(
taosHashRemove
(
dbCache
->
tbCache
.
metaCache
,
msg
->
stbName
,
strlen
(
msg
->
stbName
)))
{
ctgError
(
"stb not exist in cache, dbFName:%s, stb:%s, suid:%"
PRIx64
,
msg
->
dbFName
,
msg
->
stbName
,
msg
->
suid
);
ctgError
(
"stb not exist in cache, dbFName:%s, stb:%s, suid:%"
PRIx64
,
msg
->
dbFName
,
msg
->
stbName
,
msg
->
suid
);
}
else
{
}
else
{
CTG_CACHE_STAT_
SUB
(
tblNum
,
1
);
CTG_CACHE_STAT_
DEC
(
tblNum
,
1
);
}
}
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
...
@@ -1419,7 +1419,7 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) {
...
@@ -1419,7 +1419,7 @@ int32_t ctgOpDropTbMeta(SCtgCacheOperation *operation) {
ctgError
(
"stb not exist in cache, dbFName:%s, tbName:%s"
,
msg
->
dbFName
,
msg
->
tbName
);
ctgError
(
"stb not exist in cache, dbFName:%s, tbName:%s"
,
msg
->
dbFName
,
msg
->
tbName
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
CTG_ERR_RET
(
TSDB_CODE_CTG_INTERNAL_ERROR
);
}
else
{
}
else
{
CTG_CACHE_STAT_
SUB
(
tblNum
,
1
);
CTG_CACHE_STAT_
DEC
(
tblNum
,
1
);
}
}
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
CTG_UNLOCK
(
CTG_READ
,
&
dbCache
->
tbCache
.
metaLock
);
...
@@ -1578,7 +1578,7 @@ void* ctgUpdateThreadFunc(void* param) {
...
@@ -1578,7 +1578,7 @@ void* ctgUpdateThreadFunc(void* param) {
tsem_post
(
&
gCtgMgmt
.
queue
.
rspSem
);
tsem_post
(
&
gCtgMgmt
.
queue
.
rspSem
);
}
}
CTG_R
UNTIME_STAT_ADD
(
qDoneNum
,
1
);
CTG_R
T_STAT_INC
(
qDoneNum
,
1
);
ctgdShowClusterCache
(
pCtg
);
ctgdShowClusterCache
(
pCtg
);
}
}
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
6874016b
...
@@ -275,7 +275,7 @@ int32_t ctgGetQnodeListFromMnode(CTG_PARAMS, SArray *out, SCtgTask* pTask) {
...
@@ -275,7 +275,7 @@ int32_t ctgGetQnodeListFromMnode(CTG_PARAMS, SArray *out, SCtgTask* pTask) {
}
}
if
(
pTask
)
{
if
(
pTask
)
{
void
*
pOut
=
taosArrayInit
(
4
,
sizeof
(
struct
SQueryNodeAddr
));
void
*
pOut
=
taosArrayInit
(
4
,
sizeof
(
SQueryNodeLoad
));
if
(
NULL
==
pOut
)
{
if
(
NULL
==
pOut
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
6874016b
...
@@ -85,7 +85,7 @@ void ctgFreeTbMetaCache(SCtgTbMetaCache *cache) {
...
@@ -85,7 +85,7 @@ void ctgFreeTbMetaCache(SCtgTbMetaCache *cache) {
int32_t
stblNum
=
taosHashGetSize
(
cache
->
stbCache
);
int32_t
stblNum
=
taosHashGetSize
(
cache
->
stbCache
);
taosHashCleanup
(
cache
->
stbCache
);
taosHashCleanup
(
cache
->
stbCache
);
cache
->
stbCache
=
NULL
;
cache
->
stbCache
=
NULL
;
CTG_CACHE_STAT_
SUB
(
stblNum
,
stblNum
);
CTG_CACHE_STAT_
DEC
(
stblNum
,
stblNum
);
}
}
CTG_UNLOCK
(
CTG_WRITE
,
&
cache
->
stbLock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
cache
->
stbLock
);
...
@@ -94,7 +94,7 @@ void ctgFreeTbMetaCache(SCtgTbMetaCache *cache) {
...
@@ -94,7 +94,7 @@ void ctgFreeTbMetaCache(SCtgTbMetaCache *cache) {
int32_t
tblNum
=
taosHashGetSize
(
cache
->
metaCache
);
int32_t
tblNum
=
taosHashGetSize
(
cache
->
metaCache
);
taosHashCleanup
(
cache
->
metaCache
);
taosHashCleanup
(
cache
->
metaCache
);
cache
->
metaCache
=
NULL
;
cache
->
metaCache
=
NULL
;
CTG_CACHE_STAT_
SUB
(
tblNum
,
tblNum
);
CTG_CACHE_STAT_
DEC
(
tblNum
,
tblNum
);
}
}
CTG_UNLOCK
(
CTG_WRITE
,
&
cache
->
metaLock
);
CTG_UNLOCK
(
CTG_WRITE
,
&
cache
->
metaLock
);
}
}
...
@@ -145,7 +145,7 @@ void ctgFreeHandle(SCatalog* pCtg) {
...
@@ -145,7 +145,7 @@ void ctgFreeHandle(SCatalog* pCtg) {
taosHashCleanup
(
pCtg
->
dbCache
);
taosHashCleanup
(
pCtg
->
dbCache
);
CTG_CACHE_STAT_
SUB
(
dbNum
,
dbNum
);
CTG_CACHE_STAT_
DEC
(
dbNum
,
dbNum
);
}
}
if
(
pCtg
->
userCache
)
{
if
(
pCtg
->
userCache
)
{
...
@@ -162,7 +162,7 @@ void ctgFreeHandle(SCatalog* pCtg) {
...
@@ -162,7 +162,7 @@ void ctgFreeHandle(SCatalog* pCtg) {
taosHashCleanup
(
pCtg
->
userCache
);
taosHashCleanup
(
pCtg
->
userCache
);
CTG_CACHE_STAT_
SUB
(
userNum
,
userNum
);
CTG_CACHE_STAT_
DEC
(
userNum
,
userNum
);
}
}
taosMemoryFree
(
pCtg
);
taosMemoryFree
(
pCtg
);
...
...
source/libs/executor/inc/dataSinkInt.h
浏览文件 @
6874016b
...
@@ -37,6 +37,7 @@ typedef void (*FEndPut)(struct SDataSinkHandle* pHandle, uint64_t useconds);
...
@@ -37,6 +37,7 @@ typedef void (*FEndPut)(struct SDataSinkHandle* pHandle, uint64_t useconds);
typedef
void
(
*
FGetDataLength
)(
struct
SDataSinkHandle
*
pHandle
,
int32_t
*
pLen
,
bool
*
pQueryEnd
);
typedef
void
(
*
FGetDataLength
)(
struct
SDataSinkHandle
*
pHandle
,
int32_t
*
pLen
,
bool
*
pQueryEnd
);
typedef
int32_t
(
*
FGetDataBlock
)(
struct
SDataSinkHandle
*
pHandle
,
SOutputData
*
pOutput
);
typedef
int32_t
(
*
FGetDataBlock
)(
struct
SDataSinkHandle
*
pHandle
,
SOutputData
*
pOutput
);
typedef
int32_t
(
*
FDestroyDataSinker
)(
struct
SDataSinkHandle
*
pHandle
);
typedef
int32_t
(
*
FDestroyDataSinker
)(
struct
SDataSinkHandle
*
pHandle
);
typedef
int32_t
(
*
FGetCacheSize
)(
struct
SDataSinkHandle
*
pHandle
,
uint64_t
*
size
);
typedef
struct
SDataSinkHandle
{
typedef
struct
SDataSinkHandle
{
FPutDataBlock
fPut
;
FPutDataBlock
fPut
;
...
@@ -44,6 +45,7 @@ typedef struct SDataSinkHandle {
...
@@ -44,6 +45,7 @@ typedef struct SDataSinkHandle {
FGetDataLength
fGetLen
;
FGetDataLength
fGetLen
;
FGetDataBlock
fGetData
;
FGetDataBlock
fGetData
;
FDestroyDataSinker
fDestroy
;
FDestroyDataSinker
fDestroy
;
FGetCacheSize
fGetCacheSize
;
}
SDataSinkHandle
;
}
SDataSinkHandle
;
int32_t
createDataDispatcher
(
SDataSinkManager
*
pManager
,
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
);
int32_t
createDataDispatcher
(
SDataSinkManager
*
pManager
,
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
);
...
...
source/libs/executor/src/dataDispatcher.c
浏览文件 @
6874016b
...
@@ -22,6 +22,8 @@
...
@@ -22,6 +22,8 @@
#include "tglobal.h"
#include "tglobal.h"
#include "tqueue.h"
#include "tqueue.h"
extern
SDataSinkStat
gDataSinkStat
;
typedef
struct
SDataDispatchBuf
{
typedef
struct
SDataDispatchBuf
{
int32_t
useSize
;
int32_t
useSize
;
int32_t
allocSize
;
int32_t
allocSize
;
...
@@ -45,6 +47,7 @@ typedef struct SDataDispatchHandle {
...
@@ -45,6 +47,7 @@ typedef struct SDataDispatchHandle {
int32_t
status
;
int32_t
status
;
bool
queryEnd
;
bool
queryEnd
;
uint64_t
useconds
;
uint64_t
useconds
;
uint64_t
cachedSize
;
TdThreadMutex
mutex
;
TdThreadMutex
mutex
;
}
SDataDispatchHandle
;
}
SDataDispatchHandle
;
...
@@ -71,7 +74,7 @@ static bool needCompress(const SSDataBlock* pData, int32_t numOfCols) {
...
@@ -71,7 +74,7 @@ static bool needCompress(const SSDataBlock* pData, int32_t numOfCols) {
// +----------------+--------------+----------+--------------------------------------+-------------+-----------+-------------+-----------+
// +----------------+--------------+----------+--------------------------------------+-------------+-----------+-------------+-----------+
// The length of bitmap is decided by number of rows of this data block, and the length of each column data is
// The length of bitmap is decided by number of rows of this data block, and the length of each column data is
// recorded in the first segment, next to the struct header
// recorded in the first segment, next to the struct header
static
void
toDataCacheEntry
(
const
SDataDispatchHandle
*
pHandle
,
const
SInputData
*
pInput
,
SDataDispatchBuf
*
pBuf
)
{
static
void
toDataCacheEntry
(
SDataDispatchHandle
*
pHandle
,
const
SInputData
*
pInput
,
SDataDispatchBuf
*
pBuf
)
{
int32_t
numOfCols
=
LIST_LENGTH
(
pHandle
->
pSchema
->
pSlots
);
int32_t
numOfCols
=
LIST_LENGTH
(
pHandle
->
pSchema
->
pSlots
);
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
...
@@ -84,6 +87,9 @@ static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputDat
...
@@ -84,6 +87,9 @@ static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputDat
blockCompressEncode
(
pInput
->
pData
,
pEntry
->
data
,
&
pEntry
->
dataLen
,
numOfCols
,
pEntry
->
compressed
);
blockCompressEncode
(
pInput
->
pData
,
pEntry
->
data
,
&
pEntry
->
dataLen
,
numOfCols
,
pEntry
->
compressed
);
pBuf
->
useSize
+=
pEntry
->
dataLen
;
pBuf
->
useSize
+=
pEntry
->
dataLen
;
atomic_add_fetch_64
(
&
pHandle
->
cachedSize
,
pEntry
->
dataLen
);
atomic_add_fetch_64
(
&
gDataSinkStat
.
cachedSize
,
pEntry
->
dataLen
);
}
}
static
bool
allocBuf
(
SDataDispatchHandle
*
pDispatcher
,
const
SInputData
*
pInput
,
SDataDispatchBuf
*
pBuf
)
{
static
bool
allocBuf
(
SDataDispatchHandle
*
pDispatcher
,
const
SInputData
*
pInput
,
SDataDispatchBuf
*
pBuf
)
{
...
@@ -156,6 +162,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int32_t* pLen, bool* pQueryE
...
@@ -156,6 +162,7 @@ static void getDataLength(SDataSinkHandle* pHandle, int32_t* pLen, bool* pQueryE
taosFreeQitem
(
pBuf
);
taosFreeQitem
(
pBuf
);
*
pLen
=
((
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
))
->
dataLen
;
*
pLen
=
((
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
))
->
dataLen
;
*
pQueryEnd
=
pDispatcher
->
queryEnd
;
*
pQueryEnd
=
pDispatcher
->
queryEnd
;
qDebug
(
"got data len %d, row num %d in sink"
,
*
pLen
,
((
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
))
->
numOfRows
);
}
}
static
int32_t
getDataBlock
(
SDataSinkHandle
*
pHandle
,
SOutputData
*
pOutput
)
{
static
int32_t
getDataBlock
(
SDataSinkHandle
*
pHandle
,
SOutputData
*
pOutput
)
{
...
@@ -173,6 +180,10 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
...
@@ -173,6 +180,10 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
pOutput
->
numOfRows
=
pEntry
->
numOfRows
;
pOutput
->
numOfRows
=
pEntry
->
numOfRows
;
pOutput
->
numOfCols
=
pEntry
->
numOfCols
;
pOutput
->
numOfCols
=
pEntry
->
numOfCols
;
pOutput
->
compressed
=
pEntry
->
compressed
;
pOutput
->
compressed
=
pEntry
->
compressed
;
atomic_sub_fetch_64
(
&
pDispatcher
->
cachedSize
,
pEntry
->
dataLen
);
atomic_sub_fetch_64
(
&
gDataSinkStat
.
cachedSize
,
pEntry
->
dataLen
);
taosMemoryFreeClear
(
pDispatcher
->
nextOutput
.
pData
);
// todo persistent
taosMemoryFreeClear
(
pDispatcher
->
nextOutput
.
pData
);
// todo persistent
pOutput
->
bufStatus
=
updateStatus
(
pDispatcher
);
pOutput
->
bufStatus
=
updateStatus
(
pDispatcher
);
taosThreadMutexLock
(
&
pDispatcher
->
mutex
);
taosThreadMutexLock
(
&
pDispatcher
->
mutex
);
...
@@ -180,11 +191,14 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
...
@@ -180,11 +191,14 @@ static int32_t getDataBlock(SDataSinkHandle* pHandle, SOutputData* pOutput) {
pOutput
->
useconds
=
pDispatcher
->
useconds
;
pOutput
->
useconds
=
pDispatcher
->
useconds
;
pOutput
->
precision
=
pDispatcher
->
pSchema
->
precision
;
pOutput
->
precision
=
pDispatcher
->
pSchema
->
precision
;
taosThreadMutexUnlock
(
&
pDispatcher
->
mutex
);
taosThreadMutexUnlock
(
&
pDispatcher
->
mutex
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
destroyDataSinker
(
SDataSinkHandle
*
pHandle
)
{
static
int32_t
destroyDataSinker
(
SDataSinkHandle
*
pHandle
)
{
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
atomic_sub_fetch_64
(
&
gDataSinkStat
.
cachedSize
,
pDispatcher
->
cachedSize
);
taosMemoryFreeClear
(
pDispatcher
->
nextOutput
.
pData
);
taosMemoryFreeClear
(
pDispatcher
->
nextOutput
.
pData
);
while
(
!
taosQueueEmpty
(
pDispatcher
->
pDataBlocks
))
{
while
(
!
taosQueueEmpty
(
pDispatcher
->
pDataBlocks
))
{
SDataDispatchBuf
*
pBuf
=
NULL
;
SDataDispatchBuf
*
pBuf
=
NULL
;
...
@@ -197,6 +211,13 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
...
@@ -197,6 +211,13 @@ static int32_t destroyDataSinker(SDataSinkHandle* pHandle) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
getCacheSize
(
struct
SDataSinkHandle
*
pHandle
,
uint64_t
*
size
)
{
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
*
size
=
atomic_load_64
(
&
pDispatcher
->
cachedSize
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
createDataDispatcher
(
SDataSinkManager
*
pManager
,
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
)
{
int32_t
createDataDispatcher
(
SDataSinkManager
*
pManager
,
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
)
{
SDataDispatchHandle
*
dispatcher
=
taosMemoryCalloc
(
1
,
sizeof
(
SDataDispatchHandle
));
SDataDispatchHandle
*
dispatcher
=
taosMemoryCalloc
(
1
,
sizeof
(
SDataDispatchHandle
));
if
(
NULL
==
dispatcher
)
{
if
(
NULL
==
dispatcher
)
{
...
@@ -208,6 +229,7 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD
...
@@ -208,6 +229,7 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSinkNode* pD
dispatcher
->
sink
.
fGetLen
=
getDataLength
;
dispatcher
->
sink
.
fGetLen
=
getDataLength
;
dispatcher
->
sink
.
fGetData
=
getDataBlock
;
dispatcher
->
sink
.
fGetData
=
getDataBlock
;
dispatcher
->
sink
.
fDestroy
=
destroyDataSinker
;
dispatcher
->
sink
.
fDestroy
=
destroyDataSinker
;
dispatcher
->
sink
.
fGetCacheSize
=
getCacheSize
;
dispatcher
->
pManager
=
pManager
;
dispatcher
->
pManager
=
pManager
;
dispatcher
->
pSchema
=
pDataSink
->
pInputDataBlockDesc
;
dispatcher
->
pSchema
=
pDataSink
->
pInputDataBlockDesc
;
dispatcher
->
status
=
DS_BUF_EMPTY
;
dispatcher
->
status
=
DS_BUF_EMPTY
;
...
...
source/libs/executor/src/dataSinkMgt.c
浏览文件 @
6874016b
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "planner.h"
#include "planner.h"
static
SDataSinkManager
gDataSinkManager
=
{
0
};
static
SDataSinkManager
gDataSinkManager
=
{
0
};
SDataSinkStat
gDataSinkStat
=
{
0
};
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
)
{
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
)
{
gDataSinkManager
.
cfg
=
*
cfg
;
gDataSinkManager
.
cfg
=
*
cfg
;
...
@@ -26,6 +27,13 @@ int32_t dsDataSinkMgtInit(SDataSinkMgtCfg *cfg) {
...
@@ -26,6 +27,13 @@ int32_t dsDataSinkMgtInit(SDataSinkMgtCfg *cfg) {
return
0
;
// to avoid compiler eror
return
0
;
// to avoid compiler eror
}
}
int32_t
dsDataSinkGetCacheSize
(
SDataSinkStat
*
pStat
)
{
pStat
->
cachedSize
=
atomic_load_64
(
&
gDataSinkStat
.
cachedSize
);
return
0
;
}
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
)
{
int32_t
dsCreateDataSinker
(
const
SDataSinkNode
*
pDataSink
,
DataSinkHandle
*
pHandle
)
{
if
(
QUERY_NODE_PHYSICAL_PLAN_DISPATCH
==
nodeType
(
pDataSink
))
{
if
(
QUERY_NODE_PHYSICAL_PLAN_DISPATCH
==
nodeType
(
pDataSink
))
{
return
createDataDispatcher
(
&
gDataSinkManager
,
pDataSink
,
pHandle
);
return
createDataDispatcher
(
&
gDataSinkManager
,
pDataSink
,
pHandle
);
...
@@ -53,6 +61,12 @@ int32_t dsGetDataBlock(DataSinkHandle handle, SOutputData* pOutput) {
...
@@ -53,6 +61,12 @@ int32_t dsGetDataBlock(DataSinkHandle handle, SOutputData* pOutput) {
return
pHandleImpl
->
fGetData
(
pHandleImpl
,
pOutput
);
return
pHandleImpl
->
fGetData
(
pHandleImpl
,
pOutput
);
}
}
int32_t
dsGetCacheSize
(
DataSinkHandle
handle
,
uint64_t
*
pSize
)
{
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
return
pHandleImpl
->
fGetCacheSize
(
pHandleImpl
,
pSize
);
}
void
dsScheduleProcess
(
void
*
ahandle
,
void
*
pItem
)
{
void
dsScheduleProcess
(
void
*
ahandle
,
void
*
pItem
)
{
// todo
// todo
}
}
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
6874016b
...
@@ -4529,6 +4529,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4529,6 +4529,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
qDebug
(
"%s pDataReader is not NULL"
,
GET_TASKID
(
pTaskInfo
));
qDebug
(
"%s pDataReader is not NULL"
,
GET_TASKID
(
pTaskInfo
));
}
}
SArray
*
tableIdList
=
extractTableIdList
(
pTableListInfo
);
SArray
*
tableIdList
=
extractTableIdList
(
pTableListInfo
);
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pDataReader
,
pHandle
,
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pDataReader
,
pHandle
,
tableIdList
,
pTableScanNode
,
pTaskInfo
,
&
twSup
);
tableIdList
,
pTableScanNode
,
pTaskInfo
,
&
twSup
);
...
@@ -4942,7 +4943,7 @@ int32_t getTableList(void* metaHandle, int32_t tableType, uint64_t tableUid, STa
...
@@ -4942,7 +4943,7 @@ int32_t getTableList(void* metaHandle, int32_t tableType, uint64_t tableUid, STa
if
(
tableType
==
TSDB_SUPER_TABLE
)
{
if
(
tableType
==
TSDB_SUPER_TABLE
)
{
if
(
pTagCond
)
{
if
(
pTagCond
)
{
SIndexMetaArg
metaArg
=
{.
metaHandle
=
tsdbGetIdx
(
metaHandle
),
.
suid
=
tableUid
};
SIndexMetaArg
metaArg
=
{.
meta
Ex
=
metaHandle
,
.
meta
Handle
=
tsdbGetIdx
(
metaHandle
),
.
suid
=
tableUid
};
SArray
*
res
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
SArray
*
res
=
taosArrayInit
(
8
,
sizeof
(
uint64_t
));
code
=
doFilterTag
(
pTagCond
,
&
metaArg
,
res
);
code
=
doFilterTag
(
pTagCond
,
&
metaArg
,
res
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
6874016b
...
@@ -303,7 +303,9 @@ void addTagPseudoColumnData(SReadHandle *pHandle, SExprInfo* pPseudoExpr, int32_
...
@@ -303,7 +303,9 @@ void addTagPseudoColumnData(SReadHandle *pHandle, SExprInfo* pPseudoExpr, int32_
int32_t
dstSlotId
=
pExpr
->
base
.
resSchema
.
slotId
;
int32_t
dstSlotId
=
pExpr
->
base
.
resSchema
.
slotId
;
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
dstSlotId
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
dstSlotId
);
colInfoDataEnsureCapacity
(
pColInfoData
,
0
,
pBlock
->
info
.
rows
);
colInfoDataEnsureCapacity
(
pColInfoData
,
0
,
pBlock
->
info
.
rows
);
colInfoDataCleanup
(
pColInfoData
,
pBlock
->
info
.
rows
);
int32_t
functionId
=
pExpr
->
pExpr
->
_function
.
functionId
;
int32_t
functionId
=
pExpr
->
pExpr
->
_function
.
functionId
;
...
...
source/libs/function/src/builtins.c
浏览文件 @
6874016b
...
@@ -183,7 +183,7 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -183,7 +183,7 @@ static int32_t translatePercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
bool
valid
Aperv
entileAlgo
(
const
SValueNode
*
pVal
)
{
static
bool
valid
ateAperc
entileAlgo
(
const
SValueNode
*
pVal
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
return
false
;
return
false
;
}
}
...
@@ -231,7 +231,7 @@ static int32_t translateApercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -231,7 +231,7 @@ static int32_t translateApercentile(SFunctionNode* pFunc, char* pErrBuf, int32_t
}
}
SNode
*
pParamNode2
=
nodesListGetNode
(
pFunc
->
pParameterList
,
2
);
SNode
*
pParamNode2
=
nodesListGetNode
(
pFunc
->
pParameterList
,
2
);
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode2
)
||
!
valid
Aperv
entileAlgo
((
SValueNode
*
)
pParamNode2
))
{
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode2
)
||
!
valid
ateAperc
entileAlgo
((
SValueNode
*
)
pParamNode2
))
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"Third parameter algorithm of apercentile must be 'default' or 't-digest'"
);
"Third parameter algorithm of apercentile must be 'default' or 't-digest'"
);
}
}
...
@@ -438,6 +438,18 @@ static int32_t translateHLL(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
...
@@ -438,6 +438,18 @@ static int32_t translateHLL(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
bool
validateStateOper
(
const
SValueNode
*
pVal
)
{
if
(
TSDB_DATA_TYPE_BINARY
!=
pVal
->
node
.
resType
.
type
)
{
return
false
;
}
return
(
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"GT"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"GE"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"LT"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"LE"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"EQ"
)
||
0
==
strcasecmp
(
varDataVal
(
pVal
->
datum
.
p
),
"NE"
));
}
static
int32_t
translateStateCount
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateStateCount
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
int32_t
numOfParams
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
int32_t
numOfParams
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
if
(
3
!=
numOfParams
)
{
if
(
3
!=
numOfParams
)
{
...
@@ -464,6 +476,12 @@ static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t
...
@@ -464,6 +476,12 @@ static int32_t translateStateCount(SFunctionNode* pFunc, char* pErrBuf, int32_t
SValueNode
*
pValue
=
(
SValueNode
*
)
pParamNode
;
SValueNode
*
pValue
=
(
SValueNode
*
)
pParamNode
;
if
(
i
==
1
&&
!
validateStateOper
(
pValue
))
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"Second parameter of STATECOUNT function"
"must be one of the following: 'GE', 'GT', 'LE', 'LT', 'EQ', 'NE'"
);
}
pValue
->
notReserved
=
true
;
pValue
->
notReserved
=
true
;
}
}
...
@@ -504,6 +522,16 @@ static int32_t translateStateDuration(SFunctionNode* pFunc, char* pErrBuf, int32
...
@@ -504,6 +522,16 @@ static int32_t translateStateDuration(SFunctionNode* pFunc, char* pErrBuf, int32
SValueNode
*
pValue
=
(
SValueNode
*
)
pParamNode
;
SValueNode
*
pValue
=
(
SValueNode
*
)
pParamNode
;
if
(
i
==
1
&&
!
validateStateOper
(
pValue
))
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"Second parameter of STATEDURATION function"
"must be one of the following: 'GE', 'GT', 'LE', 'LT', 'EQ', 'NE'"
);
}
else
if
(
i
==
3
&&
pValue
->
datum
.
i
==
0
)
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"STATEDURATION function time unit parameter should be greater than db precision"
);
}
pValue
->
notReserved
=
true
;
pValue
->
notReserved
=
true
;
}
}
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
6874016b
...
@@ -1754,6 +1754,11 @@ int32_t leastSQRFunction(SqlFunctionCtx* pCtx) {
...
@@ -1754,6 +1754,11 @@ int32_t leastSQRFunction(SqlFunctionCtx* pCtx) {
}
}
break
;
break
;
}
}
case
TSDB_DATA_TYPE_NULL
:
{
GET_RES_INFO
(
pCtx
)
->
isNullRes
=
1
;
numOfElem
=
1
;
break
;
}
default:
default:
break
;
break
;
...
@@ -1797,7 +1802,7 @@ int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
...
@@ -1797,7 +1802,7 @@ int32_t leastSQRFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
size_t
len
=
snprintf
(
varDataVal
(
buf
),
sizeof
(
buf
)
-
VARSTR_HEADER_SIZE
,
"{slop:%.6lf, intercept:%.6lf}"
,
param
[
0
][
2
],
param
[
1
][
2
]);
size_t
len
=
snprintf
(
varDataVal
(
buf
),
sizeof
(
buf
)
-
VARSTR_HEADER_SIZE
,
"{slop:%.6lf, intercept:%.6lf}"
,
param
[
0
][
2
],
param
[
1
][
2
]);
varDataSetLen
(
buf
,
len
);
varDataSetLen
(
buf
,
len
);
colDataAppend
(
pCol
,
currentRow
,
buf
,
false
);
colDataAppend
(
pCol
,
currentRow
,
buf
,
pResInfo
->
isNullRes
);
return
pResInfo
->
numOfRes
;
return
pResInfo
->
numOfRes
;
}
}
...
...
source/libs/index/CMakeLists.txt
浏览文件 @
6874016b
...
@@ -12,6 +12,7 @@ target_link_libraries(
...
@@ -12,6 +12,7 @@ target_link_libraries(
PUBLIC os
PUBLIC os
PUBLIC util
PUBLIC util
PUBLIC common
PUBLIC common
PUBLIC vnode
PUBLIC nodes
PUBLIC nodes
PUBLIC scalar
PUBLIC scalar
PUBLIC function
PUBLIC function
...
...
source/libs/index/inc/indexCache.h
浏览文件 @
6874016b
...
@@ -36,6 +36,7 @@ typedef struct MemTable {
...
@@ -36,6 +36,7 @@ typedef struct MemTable {
typedef
struct
IndexCache
{
typedef
struct
IndexCache
{
T_REF_DECLARE
()
T_REF_DECLARE
()
MemTable
*
mem
,
*
imm
;
MemTable
*
mem
,
*
imm
;
int32_t
merging
;
SIndex
*
index
;
SIndex
*
index
;
char
*
colName
;
char
*
colName
;
int64_t
version
;
int64_t
version
;
...
...
source/libs/index/inc/indexComm.h
浏览文件 @
6874016b
...
@@ -33,6 +33,7 @@ typedef enum { MATCH, CONTINUE, BREAK } TExeCond;
...
@@ -33,6 +33,7 @@ typedef enum { MATCH, CONTINUE, BREAK } TExeCond;
typedef
TExeCond
(
*
_cache_range_compare
)(
void
*
a
,
void
*
b
,
int8_t
type
);
typedef
TExeCond
(
*
_cache_range_compare
)(
void
*
a
,
void
*
b
,
int8_t
type
);
__compar_fn_t
indexGetCompar
(
int8_t
type
);
TExeCond
tCompare
(
__compar_fn_t
func
,
int8_t
cmpType
,
void
*
a
,
void
*
b
,
int8_t
dType
);
TExeCond
tCompare
(
__compar_fn_t
func
,
int8_t
cmpType
,
void
*
a
,
void
*
b
,
int8_t
dType
);
TExeCond
tDoCompare
(
__compar_fn_t
func
,
int8_t
cmpType
,
void
*
a
,
void
*
b
);
TExeCond
tDoCompare
(
__compar_fn_t
func
,
int8_t
cmpType
,
void
*
a
,
void
*
b
);
...
...
source/libs/index/src/index.c
浏览文件 @
6874016b
...
@@ -80,7 +80,7 @@ static TdThreadOnce isInit = PTHREAD_ONCE_INIT;
...
@@ -80,7 +80,7 @@ static TdThreadOnce isInit = PTHREAD_ONCE_INIT;
static
int
indexTermSearch
(
SIndex
*
sIdx
,
SIndexTermQuery
*
term
,
SArray
**
result
);
static
int
indexTermSearch
(
SIndex
*
sIdx
,
SIndexTermQuery
*
term
,
SArray
**
result
);
static
void
indexInterResultsDestroy
(
SArray
*
results
);
static
void
indexInterResultsDestroy
(
SArray
*
results
);
static
int
indexMergeFinalResults
(
SArray
*
in
terResults
,
EIndexOperatorType
oType
,
SArray
*
finalResul
t
);
static
int
indexMergeFinalResults
(
SArray
*
in
,
EIndexOperatorType
oType
,
SArray
*
ou
t
);
static
int
indexGenTFile
(
SIndex
*
index
,
IndexCache
*
cache
,
SArray
*
batch
);
static
int
indexGenTFile
(
SIndex
*
index
,
IndexCache
*
cache
,
SArray
*
batch
);
...
@@ -386,21 +386,21 @@ static void indexInterResultsDestroy(SArray* results) {
...
@@ -386,21 +386,21 @@ static void indexInterResultsDestroy(SArray* results) {
taosArrayDestroy
(
results
);
taosArrayDestroy
(
results
);
}
}
static
int
indexMergeFinalResults
(
SArray
*
in
terResults
,
EIndexOperatorType
oType
,
SArray
*
fResults
)
{
static
int
indexMergeFinalResults
(
SArray
*
in
,
EIndexOperatorType
oType
,
SArray
*
out
)
{
// refactor, merge interResults into fResults by oType
// refactor, merge interResults into fResults by oType
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
in
terResults
);
i
--
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
in
);
i
--
)
{
SArray
*
t
=
taosArrayGetP
(
in
terResults
,
i
);
SArray
*
t
=
taosArrayGetP
(
in
,
i
);
taosArraySort
(
t
,
uidCompare
);
taosArraySort
(
t
,
uidCompare
);
taosArrayRemoveDuplicate
(
t
,
uidCompare
,
NULL
);
taosArrayRemoveDuplicate
(
t
,
uidCompare
,
NULL
);
}
}
if
(
oType
==
MUST
)
{
if
(
oType
==
MUST
)
{
iIntersection
(
in
terResults
,
fResults
);
iIntersection
(
in
,
out
);
}
else
if
(
oType
==
SHOULD
)
{
}
else
if
(
oType
==
SHOULD
)
{
iUnion
(
in
terResults
,
fResults
);
iUnion
(
in
,
out
);
}
else
if
(
oType
==
NOT
)
{
}
else
if
(
oType
==
NOT
)
{
// just one column index, enhance later
// just one column index, enhance later
taosArrayAddAll
(
fResults
,
interResults
);
//
taosArrayAddAll(fResults, interResults);
// not use currently
// not use currently
}
}
return
0
;
return
0
;
...
@@ -463,6 +463,9 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
...
@@ -463,6 +463,9 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
int64_t
st
=
taosGetTimestampUs
();
int64_t
st
=
taosGetTimestampUs
();
IndexCache
*
pCache
=
(
IndexCache
*
)
cache
;
IndexCache
*
pCache
=
(
IndexCache
*
)
cache
;
while
(
sIdx
->
quit
&&
atomic_load_32
(
&
pCache
->
merging
)
==
1
)
{
}
TFileReader
*
pReader
=
tfileGetReaderByCol
(
sIdx
->
tindex
,
pCache
->
suid
,
pCache
->
colName
);
TFileReader
*
pReader
=
tfileGetReaderByCol
(
sIdx
->
tindex
,
pCache
->
suid
,
pCache
->
colName
);
if
(
pReader
==
NULL
)
{
if
(
pReader
==
NULL
)
{
indexWarn
(
"empty tfile reader found"
);
indexWarn
(
"empty tfile reader found"
);
...
@@ -475,9 +478,9 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
...
@@ -475,9 +478,9 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
tfileReaderUnRef
(
pReader
);
tfileReaderUnRef
(
pReader
);
if
(
sIdx
->
quit
)
{
if
(
sIdx
->
quit
)
{
indexPost
(
sIdx
);
indexPost
(
sIdx
);
// indexCacheBroadcast(pCache);
}
}
indexReleaseRef
(
sIdx
->
refId
);
indexReleaseRef
(
sIdx
->
refId
);
atomic_store_32
(
&
pCache
->
merging
,
0
);
return
0
;
return
0
;
}
}
...
@@ -539,6 +542,7 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
...
@@ -539,6 +542,7 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
if
(
sIdx
->
quit
)
{
if
(
sIdx
->
quit
)
{
indexPost
(
sIdx
);
indexPost
(
sIdx
);
}
}
atomic_store_32
(
&
pCache
->
merging
,
0
);
indexReleaseRef
(
sIdx
->
refId
);
indexReleaseRef
(
sIdx
->
refId
);
return
ret
;
return
ret
;
...
@@ -605,6 +609,7 @@ static int indexGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
...
@@ -605,6 +609,7 @@ static int indexGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
taosThreadMutexLock
(
&
tf
->
mtx
);
taosThreadMutexLock
(
&
tf
->
mtx
);
tfileCachePut
(
tf
->
cache
,
&
key
,
reader
);
tfileCachePut
(
tf
->
cache
,
&
key
,
reader
);
taosThreadMutexUnlock
(
&
tf
->
mtx
);
taosThreadMutexUnlock
(
&
tf
->
mtx
);
return
ret
;
return
ret
;
END:
END:
if
(
tw
!=
NULL
)
{
if
(
tw
!=
NULL
)
{
...
...
source/libs/index/src/indexCache.c
浏览文件 @
6874016b
...
@@ -494,16 +494,19 @@ static void indexCacheMakeRoomForWrite(IndexCache* cache) {
...
@@ -494,16 +494,19 @@ static void indexCacheMakeRoomForWrite(IndexCache* cache) {
// TODO: wake up by condition variable
// TODO: wake up by condition variable
indexCacheWait
(
cache
);
indexCacheWait
(
cache
);
}
else
{
}
else
{
bool
notifyQ
uit
=
cache
->
occupiedMem
>=
MEM_SIGNAL_QUIT
?
true
:
false
;
bool
q
uit
=
cache
->
occupiedMem
>=
MEM_SIGNAL_QUIT
?
true
:
false
;
indexCacheRef
(
cache
);
indexCacheRef
(
cache
);
cache
->
imm
=
cache
->
mem
;
cache
->
imm
=
cache
->
mem
;
cache
->
mem
=
indexInternalCacheCreate
(
cache
->
type
);
cache
->
mem
=
indexInternalCacheCreate
(
cache
->
type
);
cache
->
mem
->
pCache
=
cache
;
cache
->
mem
->
pCache
=
cache
;
cache
->
occupiedMem
=
0
;
cache
->
occupiedMem
=
0
;
if
(
quit
==
false
)
{
atomic_store_32
(
&
cache
->
merging
,
1
);
}
// sched to merge
// sched to merge
// unref cache in bgwork
// unref cache in bgwork
indexCacheSchedToMerge
(
cache
,
notifyQ
uit
);
indexCacheSchedToMerge
(
cache
,
q
uit
);
}
}
}
}
}
}
...
...
source/libs/index/src/indexComm.c
浏览文件 @
6874016b
...
@@ -75,7 +75,7 @@ char* indexInt2str(int64_t val, char* dst, int radix) {
...
@@ -75,7 +75,7 @@ char* indexInt2str(int64_t val, char* dst, int radix) {
;
;
return
dst
-
1
;
return
dst
-
1
;
}
}
static
__compar_fn_t
indexGetCompar
(
int8_t
type
)
{
__compar_fn_t
indexGetCompar
(
int8_t
type
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
return
(
__compar_fn_t
)
strcmp
;
return
(
__compar_fn_t
)
strcmp
;
}
}
...
@@ -182,6 +182,9 @@ TExeCond tDoCompare(__compar_fn_t func, int8_t comparType, void* a, void* b) {
...
@@ -182,6 +182,9 @@ TExeCond tDoCompare(__compar_fn_t func, int8_t comparType, void* a, void* b) {
case
QUERY_GREATER_EQUAL
:
{
case
QUERY_GREATER_EQUAL
:
{
if
(
ret
>=
0
)
return
MATCH
;
if
(
ret
>=
0
)
return
MATCH
;
}
}
case
QUERY_TERM
:
{
if
(
ret
==
0
)
return
MATCH
;
}
}
}
return
CONTINUE
;
return
CONTINUE
;
}
}
...
...
source/libs/index/src/indexFilter.c
浏览文件 @
6874016b
...
@@ -14,11 +14,13 @@
...
@@ -14,11 +14,13 @@
*/
*/
#include "index.h"
#include "index.h"
#include "indexComm.h"
#include "indexInt.h"
#include "indexInt.h"
#include "nodes.h"
#include "nodes.h"
#include "querynodes.h"
#include "querynodes.h"
#include "scalar.h"
#include "scalar.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "vnode.h"
// clang-format off
// clang-format off
#define SIF_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define SIF_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
...
@@ -259,10 +261,52 @@ static int32_t sifExecFunction(SFunctionNode *node, SIFCtx *ctx, SIFParam *outpu
...
@@ -259,10 +261,52 @@ static int32_t sifExecFunction(SFunctionNode *node, SIFCtx *ctx, SIFParam *outpu
indexError
(
"index-filter not support buildin function"
);
indexError
(
"index-filter not support buildin function"
);
return
TSDB_CODE_QRY_INVALID_INPUT
;
return
TSDB_CODE_QRY_INVALID_INPUT
;
}
}
typedef
int
(
*
Filter
)(
void
*
a
,
void
*
b
,
int16_t
dtype
);
int
sifGreaterThan
(
void
*
a
,
void
*
b
,
int16_t
dtype
)
{
__compar_fn_t
func
=
indexGetCompar
(
dtype
);
return
tDoCompare
(
func
,
QUERY_GREATER_THAN
,
a
,
b
);
}
int
sifGreaterEqual
(
void
*
a
,
void
*
b
,
int16_t
dtype
)
{
__compar_fn_t
func
=
indexGetCompar
(
dtype
);
return
tDoCompare
(
func
,
QUERY_GREATER_EQUAL
,
a
,
b
);
}
int
sifLessEqual
(
void
*
a
,
void
*
b
,
int16_t
dtype
)
{
__compar_fn_t
func
=
indexGetCompar
(
dtype
);
return
tDoCompare
(
func
,
QUERY_LESS_EQUAL
,
a
,
b
);
}
int
sifLessThan
(
void
*
a
,
void
*
b
,
int16_t
dtype
)
{
__compar_fn_t
func
=
indexGetCompar
(
dtype
);
return
(
int
)
tDoCompare
(
func
,
QUERY_LESS_THAN
,
a
,
b
);
}
int
sifEqual
(
void
*
a
,
void
*
b
,
int16_t
dtype
)
{
__compar_fn_t
func
=
indexGetCompar
(
dtype
);
return
(
int
)
tDoCompare
(
func
,
QUERY_TERM
,
a
,
b
);
}
static
Filter
sifGetFilterFunc
(
EIndexQueryType
type
,
bool
*
reverse
)
{
if
(
type
==
QUERY_LESS_EQUAL
||
type
==
QUERY_LESS_THAN
)
{
*
reverse
=
true
;
}
else
{
*
reverse
=
false
;
}
if
(
type
==
QUERY_LESS_EQUAL
)
return
sifLessEqual
;
else
if
(
type
==
QUERY_LESS_THAN
)
return
sifLessThan
;
else
if
(
type
==
QUERY_GREATER_EQUAL
)
return
sifGreaterEqual
;
else
if
(
type
==
QUERY_GREATER_THAN
)
return
sifGreaterThan
;
else
if
(
type
==
QUERY_TERM
)
{
return
sifEqual
;
}
return
NULL
;
}
static
int32_t
sifDoIndex
(
SIFParam
*
left
,
SIFParam
*
right
,
int8_t
operType
,
SIFParam
*
output
)
{
static
int32_t
sifDoIndex
(
SIFParam
*
left
,
SIFParam
*
right
,
int8_t
operType
,
SIFParam
*
output
)
{
#ifdef USE_INVERTED_INDEX
SIndexMetaArg
*
arg
=
&
output
->
arg
;
SIndexMetaArg
*
arg
=
&
output
->
arg
;
SIndexTerm
*
tm
=
indexTermCreate
(
arg
->
suid
,
DEFAULT
,
left
->
colValType
,
left
->
colName
,
strlen
(
left
->
colName
),
#ifdef USE_INVERTED_INDEX
SIndexTerm
*
tm
=
indexTermCreate
(
arg
->
suid
,
DEFAULT
,
left
->
colValType
,
left
->
colName
,
strlen
(
left
->
colName
),
right
->
condValue
,
strlen
(
right
->
condValue
));
right
->
condValue
,
strlen
(
right
->
condValue
));
if
(
tm
==
NULL
)
{
if
(
tm
==
NULL
)
{
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
...
@@ -278,8 +322,22 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
...
@@ -278,8 +322,22 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
indexMultiTermQueryDestroy
(
mtm
);
indexMultiTermQueryDestroy
(
mtm
);
return
ret
;
return
ret
;
#else
#else
return
0
;
EIndexQueryType
qtype
=
0
;
SIF_ERR_RET
(
sifGetFuncFromSql
(
operType
,
&
qtype
));
bool
reverse
;
Filter
filterFunc
=
sifGetFilterFunc
(
qtype
,
&
reverse
);
SMetaFltParam
param
=
{.
suid
=
arg
->
suid
,
.
cid
=
left
->
colId
,
.
type
=
left
->
colValType
,
.
val
=
right
->
condValue
,
.
reverse
=
reverse
,
.
filterFunc
=
filterFunc
};
int
ret
=
metaFilteTableIds
(
arg
->
metaEx
,
&
param
,
output
->
result
);
return
ret
;
#endif
#endif
return
0
;
}
}
static
int32_t
sifLessThanFunc
(
SIFParam
*
left
,
SIFParam
*
right
,
SIFParam
*
output
)
{
static
int32_t
sifLessThanFunc
(
SIFParam
*
left
,
SIFParam
*
right
,
SIFParam
*
output
)
{
...
...
source/libs/index/src/indexJson.c
浏览文件 @
6874016b
...
@@ -24,8 +24,8 @@ int tIndexJsonPut(SIndexJson *index, SIndexJsonMultiTerm *terms, uint64_t uid) {
...
@@ -24,8 +24,8 @@ int tIndexJsonPut(SIndexJson *index, SIndexJsonMultiTerm *terms, uint64_t uid) {
SIndexJsonTerm
*
p
=
taosArrayGetP
(
terms
,
i
);
SIndexJsonTerm
*
p
=
taosArrayGetP
(
terms
,
i
);
INDEX_TYPE_ADD_EXTERN_TYPE
(
p
->
colType
,
TSDB_DATA_TYPE_JSON
);
INDEX_TYPE_ADD_EXTERN_TYPE
(
p
->
colType
,
TSDB_DATA_TYPE_JSON
);
}
}
return
indexPut
(
index
,
terms
,
uid
);
// handle put
// handle put
return
indexPut
(
index
,
terms
,
uid
);
}
}
int
tIndexJsonSearch
(
SIndexJson
*
index
,
SIndexJsonMultiTermQuery
*
tq
,
SArray
*
result
)
{
int
tIndexJsonSearch
(
SIndexJson
*
index
,
SIndexJsonMultiTermQuery
*
tq
,
SArray
*
result
)
{
...
@@ -34,11 +34,11 @@ int tIndexJsonSearch(SIndexJson *index, SIndexJsonMultiTermQuery *tq, SArray *re
...
@@ -34,11 +34,11 @@ int tIndexJsonSearch(SIndexJson *index, SIndexJsonMultiTermQuery *tq, SArray *re
SIndexJsonTerm
*
p
=
taosArrayGetP
(
terms
,
i
);
SIndexJsonTerm
*
p
=
taosArrayGetP
(
terms
,
i
);
INDEX_TYPE_ADD_EXTERN_TYPE
(
p
->
colType
,
TSDB_DATA_TYPE_JSON
);
INDEX_TYPE_ADD_EXTERN_TYPE
(
p
->
colType
,
TSDB_DATA_TYPE_JSON
);
}
}
return
indexSearch
(
index
,
tq
,
result
);
// handle search
// handle search
return
indexSearch
(
index
,
tq
,
result
);
}
}
void
tIndexJsonClose
(
SIndexJson
*
index
)
{
void
tIndexJsonClose
(
SIndexJson
*
index
)
{
return
indexClose
(
index
);
// handle close
// handle close
return
indexClose
(
index
);
}
}
source/libs/monitor/src/monMsg.c
浏览文件 @
6874016b
...
@@ -557,3 +557,49 @@ int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInf
...
@@ -557,3 +557,49 @@ int32_t tDeserializeSMonMloadInfo(void *buf, int32_t bufLen, SMonMloadInfo *pInf
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
return
0
;
}
}
int32_t
tSerializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
numOfProcessedQuery
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
numOfProcessedCQuery
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
numOfProcessedFetch
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
numOfProcessedDrop
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
numOfProcessedHb
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
cacheDataSize
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
numOfQueryInQueue
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
numOfFetchInQueue
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
timeInQueryQueue
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
timeInFetchQueue
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSQnodeLoad
(
void
*
buf
,
int32_t
bufLen
,
SQnodeLoad
*
pInfo
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
numOfProcessedQuery
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
numOfProcessedCQuery
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
numOfProcessedFetch
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
numOfProcessedDrop
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
numOfProcessedHb
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
cacheDataSize
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
numOfQueryInQueue
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
numOfFetchInQueue
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
timeInQueryQueue
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pInfo
->
timeInFetchQueue
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
source/libs/parser/src/parTranslater.c
浏览文件 @
6874016b
...
@@ -3310,6 +3310,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
...
@@ -3310,6 +3310,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
if
(
'\0'
!=
pStmt
->
subSTbName
[
0
])
{
if
(
'\0'
!=
pStmt
->
subSTbName
[
0
])
{
pReq
->
subType
=
TOPIC_SUB_TYPE__TABLE
;
pReq
->
subType
=
TOPIC_SUB_TYPE__TABLE
;
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
subDbName
,
pStmt
->
subSTbName
,
&
name
);
toName
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
subDbName
,
pStmt
->
subSTbName
,
&
name
);
tNameGetFullDbName
(
&
name
,
pReq
->
subDbName
);
tNameExtractFullName
(
&
name
,
pReq
->
subStbName
);
tNameExtractFullName
(
&
name
,
pReq
->
subStbName
);
}
else
if
(
'\0'
!=
pStmt
->
subDbName
[
0
])
{
}
else
if
(
'\0'
!=
pStmt
->
subDbName
[
0
])
{
pReq
->
subType
=
TOPIC_SUB_TYPE__DB
;
pReq
->
subType
=
TOPIC_SUB_TYPE__DB
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
6874016b
...
@@ -468,6 +468,7 @@ static int32_t createTagScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubpla
...
@@ -468,6 +468,7 @@ static int32_t createTagScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubpla
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
SQueryNodeLoad
node
=
{.
addr
=
pSubplan
->
execNode
,
.
load
=
0
};
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
pSubplan
->
execNode
);
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
pSubplan
->
execNode
);
return
createScanPhysiNodeFinalize
(
pCxt
,
pSubplan
,
pScanLogicNode
,
(
SScanPhysiNode
*
)
pTagScan
,
pPhyNode
);
return
createScanPhysiNodeFinalize
(
pCxt
,
pSubplan
,
pScanLogicNode
,
(
SScanPhysiNode
*
)
pTagScan
,
pPhyNode
);
}
}
...
@@ -489,7 +490,8 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp
...
@@ -489,7 +490,8 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp
pSubplan
->
execNodeStat
.
tableNum
=
pScanLogicNode
->
pVgroupList
->
vgroups
[
0
].
numOfTable
;
pSubplan
->
execNodeStat
.
tableNum
=
pScanLogicNode
->
pVgroupList
->
vgroups
[
0
].
numOfTable
;
}
}
if
(
pCxt
->
pExecNodeList
)
{
if
(
pCxt
->
pExecNodeList
)
{
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
pSubplan
->
execNode
);
SQueryNodeLoad
node
=
{.
addr
=
pSubplan
->
execNode
,
.
load
=
0
};
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
node
);
}
}
tNameGetFullDbName
(
&
pScanLogicNode
->
tableName
,
pSubplan
->
dbFName
);
tNameGetFullDbName
(
&
pScanLogicNode
->
tableName
,
pSubplan
->
dbFName
);
pTableScan
->
dataRequired
=
pScanLogicNode
->
dataRequired
;
pTableScan
->
dataRequired
=
pScanLogicNode
->
dataRequired
;
...
@@ -524,10 +526,11 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
...
@@ -524,10 +526,11 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
pScan
->
accountId
=
pCxt
->
pPlanCxt
->
acctId
;
pScan
->
accountId
=
pCxt
->
pPlanCxt
->
acctId
;
if
(
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLES
))
{
if
(
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLES
))
{
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
SQueryNodeLoad
node
=
{
.
addr
=
pSubplan
->
execNode
,
.
load
=
0
};
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
pSubplan
->
execNode
);
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
pSubplan
->
execNode
);
}
else
{
}
else
{
SQueryNode
Addr
addr
=
{.
nodeId
=
MNODE_HANDLE
,
.
epSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
};
SQueryNode
Load
node
=
{
.
addr
=
{.
nodeId
=
MNODE_HANDLE
,
.
epSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
},
.
load
=
0
};
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
addr
);
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
node
);
}
}
pScan
->
mgmtEpSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
;
pScan
->
mgmtEpSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
;
tNameGetFullDbName
(
&
pScanLogicNode
->
tableName
,
pSubplan
->
dbFName
);
tNameGetFullDbName
(
&
pScanLogicNode
->
tableName
,
pSubplan
->
dbFName
);
...
@@ -1248,7 +1251,8 @@ static int32_t createPhysiSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogic
...
@@ -1248,7 +1251,8 @@ static int32_t createPhysiSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogic
SVnodeModifLogicNode
*
pModif
=
(
SVnodeModifLogicNode
*
)
pLogicSubplan
->
pNode
;
SVnodeModifLogicNode
*
pModif
=
(
SVnodeModifLogicNode
*
)
pLogicSubplan
->
pNode
;
pSubplan
->
msgType
=
pModif
->
msgType
;
pSubplan
->
msgType
=
pModif
->
msgType
;
pSubplan
->
execNode
.
epSet
=
pModif
->
pVgDataBlocks
->
vg
.
epSet
;
pSubplan
->
execNode
.
epSet
=
pModif
->
pVgDataBlocks
->
vg
.
epSet
;
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
pSubplan
->
execNode
);
SQueryNodeLoad
node
=
{.
addr
=
pSubplan
->
execNode
,
.
load
=
0
};
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
node
);
code
=
createDataInserter
(
pCxt
,
pModif
->
pVgDataBlocks
,
&
pSubplan
->
pDataSink
);
code
=
createDataInserter
(
pCxt
,
pModif
->
pVgDataBlocks
,
&
pSubplan
->
pDataSink
);
}
else
{
}
else
{
pSubplan
->
msgType
=
TDMT_VND_QUERY
;
pSubplan
->
msgType
=
TDMT_VND_QUERY
;
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
6874016b
...
@@ -373,7 +373,7 @@ int32_t queryProcessQnodeListRsp(void *output, char *msg, int32_t msgSize) {
...
@@ -373,7 +373,7 @@ int32_t queryProcessQnodeListRsp(void *output, char *msg, int32_t msgSize) {
return
code
;
return
code
;
}
}
out
.
addrs
List
=
(
SArray
*
)
output
;
out
.
qnode
List
=
(
SArray
*
)
output
;
if
(
tDeserializeSQnodeListRsp
(
msg
,
msgSize
,
&
out
)
!=
0
)
{
if
(
tDeserializeSQnodeListRsp
(
msg
,
msgSize
,
&
out
)
!=
0
)
{
qError
(
"invalid qnode list rsp msg, msgSize:%d"
,
msgSize
);
qError
(
"invalid qnode list rsp msg, msgSize:%d"
,
msgSize
);
code
=
TSDB_CODE_INVALID_MSG
;
code
=
TSDB_CODE_INVALID_MSG
;
...
...
source/libs/qworker/inc/qwInt.h
浏览文件 @
6874016b
...
@@ -145,13 +145,30 @@ typedef struct SQWSchStatus {
...
@@ -145,13 +145,30 @@ typedef struct SQWSchStatus {
SHashObj
*
tasksHash
;
// key:queryId+taskId, value: SQWTaskStatus
SHashObj
*
tasksHash
;
// key:queryId+taskId, value: SQWTaskStatus
}
SQWSchStatus
;
}
SQWSchStatus
;
typedef
struct
SQW
WaitTimeStat
{
typedef
struct
SQW
TimeInQ
{
uint64_t
num
;
uint64_t
num
;
uint64_t
total
;
uint64_t
total
;
}
SQWWaitTimeStat
;
}
SQWTimeInQ
;
typedef
struct
SQWMsgStat
{
SQWTimeInQ
waitTime
[
2
];
uint64_t
queryProcessed
;
uint64_t
cqueryProcessed
;
uint64_t
fetchProcessed
;
uint64_t
fetchRspProcessed
;
uint64_t
cancelProcessed
;
uint64_t
dropProcessed
;
uint64_t
hbProcessed
;
}
SQWMsgStat
;
typedef
struct
SQWRTStat
{
uint64_t
startTaskNum
;
uint64_t
stopTaskNum
;
}
SQWRTStat
;
typedef
struct
SQWStat
{
typedef
struct
SQWStat
{
SQWWaitTimeStat
msgWait
[
2
];
SQWMsgStat
msgStat
;
SQWRTStat
rtStat
;
}
SQWStat
;
}
SQWStat
;
// Qnode/Vnode level task management
// Qnode/Vnode level task management
...
@@ -182,10 +199,13 @@ typedef struct SQWorkerMgmt {
...
@@ -182,10 +199,13 @@ typedef struct SQWorkerMgmt {
#define QW_IDS() sId, qId, tId, rId
#define QW_IDS() sId, qId, tId, rId
#define QW_FPARAMS() mgmt, QW_IDS()
#define QW_FPARAMS() mgmt, QW_IDS()
#define QW_GET_EVENT_VALUE(ctx, event) atomic_load_8(&(ctx)->events[event])
#define QW_STAT_INC(_item, _n) atomic_add_fetch_64(&(_item), _n)
#define QW_STAT_DEC(_item, _n) atomic_sub_fetch_64(&(_item), _n)
#define QW_STAT_GET(_item) atomic_load_64(&(_item))
#define QW_IS_EVENT_RECEIVED(ctx, event) (atomic_load_8(&(ctx)->events[event]) == QW_EVENT_RECEIVED)
#define QW_GET_EVENT(ctx, event) atomic_load_8(&(ctx)->events[event])
#define QW_IS_EVENT_PROCESSED(ctx, event) (atomic_load_8(&(ctx)->events[event]) == QW_EVENT_PROCESSED)
#define QW_IS_EVENT_RECEIVED(ctx, event) (QW_GET_EVENT(ctx, event) == QW_EVENT_RECEIVED)
#define QW_IS_EVENT_PROCESSED(ctx, event) (QW_GET_EVENT(ctx, event) == QW_EVENT_PROCESSED)
#define QW_SET_EVENT_RECEIVED(ctx, event) atomic_store_8(&(ctx)->events[event], QW_EVENT_RECEIVED)
#define QW_SET_EVENT_RECEIVED(ctx, event) atomic_store_8(&(ctx)->events[event], QW_EVENT_RECEIVED)
#define QW_SET_EVENT_PROCESSED(ctx, event) atomic_store_8(&(ctx)->events[event], QW_EVENT_PROCESSED)
#define QW_SET_EVENT_PROCESSED(ctx, event) atomic_store_8(&(ctx)->events[event], QW_EVENT_PROCESSED)
...
@@ -332,8 +352,8 @@ int32_t qwDropTask(QW_FPARAMS_DEF);
...
@@ -332,8 +352,8 @@ int32_t qwDropTask(QW_FPARAMS_DEF);
void
qwSaveTbVersionInfo
(
qTaskInfo_t
pTaskInfo
,
SQWTaskCtx
*
ctx
);
void
qwSaveTbVersionInfo
(
qTaskInfo_t
pTaskInfo
,
SQWTaskCtx
*
ctx
);
int32_t
qwOpenRef
(
void
);
int32_t
qwOpenRef
(
void
);
void
qwSetHbParam
(
int64_t
refId
,
SQWHbParam
**
pParam
);
void
qwSetHbParam
(
int64_t
refId
,
SQWHbParam
**
pParam
);
int32_t
qwUpdate
Wait
TimeInQueue
(
SQWorker
*
mgmt
,
int64_t
ts
,
EQueueType
type
);
int32_t
qwUpdateTimeInQueue
(
SQWorker
*
mgmt
,
int64_t
ts
,
EQueueType
type
);
int64_t
qwGet
Wait
TimeInQueue
(
SQWorker
*
mgmt
,
EQueueType
type
);
int64_t
qwGetTimeInQueue
(
SQWorker
*
mgmt
,
EQueueType
type
);
void
qwDbgDumpMgmtInfo
(
SQWorker
*
mgmt
);
void
qwDbgDumpMgmtInfo
(
SQWorker
*
mgmt
);
int32_t
qwDbgValidateStatus
(
QW_FPARAMS_DEF
,
int8_t
oriStatus
,
int8_t
newStatus
,
bool
*
ignore
);
int32_t
qwDbgValidateStatus
(
QW_FPARAMS_DEF
,
int8_t
oriStatus
,
int8_t
newStatus
,
bool
*
ignore
);
...
...
source/libs/qworker/src/qwMsg.c
浏览文件 @
6874016b
...
@@ -257,7 +257,8 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int
...
@@ -257,7 +257,8 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int
SSubQueryMsg
*
msg
=
pMsg
->
pCont
;
SSubQueryMsg
*
msg
=
pMsg
->
pCont
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
qwUpdateWaitTimeInQueue
(
mgmt
,
ts
,
QUERY_QUEUE
);
qwUpdateTimeInQueue
(
mgmt
,
ts
,
QUERY_QUEUE
);
QW_STAT_INC
(
mgmt
->
stat
.
msgStat
.
queryProcessed
,
1
);
if
(
NULL
==
msg
||
pMsg
->
contLen
<=
sizeof
(
*
msg
))
{
if
(
NULL
==
msg
||
pMsg
->
contLen
<=
sizeof
(
*
msg
))
{
QW_ELOG
(
"invalid query msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
QW_ELOG
(
"invalid query msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
...
@@ -297,7 +298,8 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in
...
@@ -297,7 +298,8 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in
SQWTaskCtx
*
handles
=
NULL
;
SQWTaskCtx
*
handles
=
NULL
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
qwUpdateWaitTimeInQueue
(
mgmt
,
ts
,
QUERY_QUEUE
);
qwUpdateTimeInQueue
(
mgmt
,
ts
,
QUERY_QUEUE
);
QW_STAT_INC
(
mgmt
->
stat
.
msgStat
.
cqueryProcessed
,
1
);
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
QW_ELOG
(
"invalid cquery msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
QW_ELOG
(
"invalid cquery msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
...
@@ -328,7 +330,8 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int
...
@@ -328,7 +330,8 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int
SResFetchReq
*
msg
=
pMsg
->
pCont
;
SResFetchReq
*
msg
=
pMsg
->
pCont
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
qwUpdateWaitTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
qwUpdateTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
QW_STAT_INC
(
mgmt
->
stat
.
msgStat
.
fetchProcessed
,
1
);
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
QW_ELOG
(
"invalid fetch msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
QW_ELOG
(
"invalid fetch msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
...
@@ -357,7 +360,10 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int
...
@@ -357,7 +360,10 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int
int32_t
qWorkerProcessFetchRsp
(
void
*
node
,
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
,
int64_t
ts
)
{
int32_t
qWorkerProcessFetchRsp
(
void
*
node
,
void
*
qWorkerMgmt
,
SRpcMsg
*
pMsg
,
int64_t
ts
)
{
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
qwUpdateWaitTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
if
(
mgmt
)
{
qwUpdateTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
QW_STAT_INC
(
mgmt
->
stat
.
msgStat
.
fetchRspProcessed
,
1
);
}
qProcessFetchRsp
(
NULL
,
pMsg
,
NULL
);
qProcessFetchRsp
(
NULL
,
pMsg
,
NULL
);
pMsg
->
pCont
=
NULL
;
pMsg
->
pCont
=
NULL
;
...
@@ -373,7 +379,8 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in
...
@@ -373,7 +379,8 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in
int32_t
code
=
0
;
int32_t
code
=
0
;
STaskCancelReq
*
msg
=
pMsg
->
pCont
;
STaskCancelReq
*
msg
=
pMsg
->
pCont
;
qwUpdateWaitTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
qwUpdateTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
QW_STAT_INC
(
mgmt
->
stat
.
msgStat
.
cancelProcessed
,
1
);
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
qError
(
"invalid task cancel msg"
);
qError
(
"invalid task cancel msg"
);
...
@@ -411,7 +418,8 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6
...
@@ -411,7 +418,8 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6
STaskDropReq
*
msg
=
pMsg
->
pCont
;
STaskDropReq
*
msg
=
pMsg
->
pCont
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
qwUpdateWaitTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
qwUpdateTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
QW_STAT_INC
(
mgmt
->
stat
.
msgStat
.
dropProcessed
,
1
);
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
if
(
NULL
==
msg
||
pMsg
->
contLen
<
sizeof
(
*
msg
))
{
QW_ELOG
(
"invalid task drop msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
QW_ELOG
(
"invalid task drop msg, msg:%p, msgLen:%d"
,
msg
,
pMsg
->
contLen
);
...
@@ -452,7 +460,8 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_
...
@@ -452,7 +460,8 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_
SSchedulerHbReq
req
=
{
0
};
SSchedulerHbReq
req
=
{
0
};
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
qwUpdateWaitTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
qwUpdateTimeInQueue
(
mgmt
,
ts
,
FETCH_QUEUE
);
QW_STAT_INC
(
mgmt
->
stat
.
msgStat
.
hbProcessed
,
1
);
if
(
NULL
==
pMsg
->
pCont
)
{
if
(
NULL
==
pMsg
->
pCont
)
{
QW_ELOG
(
"invalid hb msg, msg:%p, msgLen:%d"
,
pMsg
->
pCont
,
pMsg
->
contLen
);
QW_ELOG
(
"invalid hb msg, msg:%p, msgLen:%d"
,
pMsg
->
pCont
,
pMsg
->
contLen
);
...
...
source/libs/qworker/src/qwUtil.c
浏览文件 @
6874016b
...
@@ -499,7 +499,7 @@ int32_t qwOpenRef(void) {
...
@@ -499,7 +499,7 @@ int32_t qwOpenRef(void) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
qwUpdate
Wait
TimeInQueue
(
SQWorker
*
mgmt
,
int64_t
ts
,
EQueueType
type
)
{
int32_t
qwUpdateTimeInQueue
(
SQWorker
*
mgmt
,
int64_t
ts
,
EQueueType
type
)
{
if
(
ts
<=
0
)
{
if
(
ts
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -507,12 +507,12 @@ int32_t qwUpdateWaitTimeInQueue(SQWorker *mgmt, int64_t ts, EQueueType type) {
...
@@ -507,12 +507,12 @@ int32_t qwUpdateWaitTimeInQueue(SQWorker *mgmt, int64_t ts, EQueueType type) {
int64_t
duration
=
taosGetTimestampUs
()
-
ts
;
int64_t
duration
=
taosGetTimestampUs
()
-
ts
;
switch
(
type
)
{
switch
(
type
)
{
case
QUERY_QUEUE
:
case
QUERY_QUEUE
:
++
mgmt
->
stat
.
msg
Wait
[
0
].
num
;
++
mgmt
->
stat
.
msg
Stat
.
waitTime
[
0
].
num
;
mgmt
->
stat
.
msg
Wait
[
0
].
total
+=
duration
;
mgmt
->
stat
.
msg
Stat
.
waitTime
[
0
].
total
+=
duration
;
break
;
break
;
case
FETCH_QUEUE
:
case
FETCH_QUEUE
:
++
mgmt
->
stat
.
msg
Wait
[
1
].
num
;
++
mgmt
->
stat
.
msg
Stat
.
waitTime
[
1
].
num
;
mgmt
->
stat
.
msg
Wait
[
1
].
total
+=
duration
;
mgmt
->
stat
.
msg
Stat
.
waitTime
[
1
].
total
+=
duration
;
break
;
break
;
default:
default:
qError
(
"unsupported queue type %d"
,
type
);
qError
(
"unsupported queue type %d"
,
type
);
...
@@ -522,19 +522,20 @@ int32_t qwUpdateWaitTimeInQueue(SQWorker *mgmt, int64_t ts, EQueueType type) {
...
@@ -522,19 +522,20 @@ int32_t qwUpdateWaitTimeInQueue(SQWorker *mgmt, int64_t ts, EQueueType type) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int64_t
qwGet
Wait
TimeInQueue
(
SQWorker
*
mgmt
,
EQueueType
type
)
{
int64_t
qwGetTimeInQueue
(
SQWorker
*
mgmt
,
EQueueType
type
)
{
SQW
WaitTimeStat
*
pStat
=
NULL
;
SQW
TimeInQ
*
pStat
=
NULL
;
switch
(
type
)
{
switch
(
type
)
{
case
QUERY_QUEUE
:
case
QUERY_QUEUE
:
pStat
=
&
mgmt
->
stat
.
msg
Wait
[
0
];
pStat
=
&
mgmt
->
stat
.
msg
Stat
.
waitTime
[
0
];
return
pStat
->
num
?
(
pStat
->
total
/
pStat
->
num
)
:
0
;
return
pStat
->
num
?
(
pStat
->
total
/
pStat
->
num
)
:
0
;
case
FETCH_QUEUE
:
case
FETCH_QUEUE
:
pStat
=
&
mgmt
->
stat
.
msg
Wait
[
1
];
pStat
=
&
mgmt
->
stat
.
msg
Stat
.
waitTime
[
1
];
return
pStat
->
num
?
(
pStat
->
total
/
pStat
->
num
)
:
0
;
return
pStat
->
num
?
(
pStat
->
total
/
pStat
->
num
)
:
0
;
default:
default:
qError
(
"unsupported queue type %d"
,
type
);
qError
(
"unsupported queue type %d"
,
type
);
return
-
1
;
}
}
return
-
1
;
}
}
...
...
source/libs/qworker/src/qworker.c
浏览文件 @
6874016b
#include "qworker.h"
#include "dataSinkMgt.h"
#include "dataSinkMgt.h"
#include "executor.h"
#include "executor.h"
#include "planner.h"
#include "planner.h"
...
@@ -8,6 +7,7 @@
...
@@ -8,6 +7,7 @@
#include "tcommon.h"
#include "tcommon.h"
#include "tmsg.h"
#include "tmsg.h"
#include "tname.h"
#include "tname.h"
#include "qworker.h"
SQWorkerMgmt
gQwMgmt
=
{
SQWorkerMgmt
gQwMgmt
=
{
.
lock
=
0
,
.
lock
=
0
,
...
@@ -954,8 +954,29 @@ void qWorkerDestroy(void **qWorkerMgmt) {
...
@@ -954,8 +954,29 @@ void qWorkerDestroy(void **qWorkerMgmt) {
}
}
}
}
int64_t
qWorkerGetWaitTimeInQueue
(
void
*
qWorkerMgmt
,
EQueueType
type
)
{
int32_t
qWorkerGetStat
(
SReadHandle
*
handle
,
void
*
qWorkerMgmt
,
SQWorkerStat
*
pStat
)
{
return
qwGetWaitTimeInQueue
((
SQWorker
*
)
qWorkerMgmt
,
type
);
if
(
NULL
==
handle
||
NULL
==
qWorkerMgmt
||
NULL
==
pStat
)
{
QW_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
SQWorker
*
mgmt
=
(
SQWorker
*
)
qWorkerMgmt
;
SDataSinkStat
sinkStat
=
{
0
};
dsDataSinkGetCacheSize
(
&
sinkStat
);
pStat
->
cacheDataSize
=
sinkStat
.
cachedSize
;
pStat
->
queryProcessed
=
QW_STAT_GET
(
mgmt
->
stat
.
msgStat
.
queryProcessed
);
pStat
->
cqueryProcessed
=
QW_STAT_GET
(
mgmt
->
stat
.
msgStat
.
cqueryProcessed
);
pStat
->
fetchProcessed
=
QW_STAT_GET
(
mgmt
->
stat
.
msgStat
.
fetchProcessed
);
pStat
->
dropProcessed
=
QW_STAT_GET
(
mgmt
->
stat
.
msgStat
.
dropProcessed
);
pStat
->
hbProcessed
=
QW_STAT_GET
(
mgmt
->
stat
.
msgStat
.
hbProcessed
);
pStat
->
numOfQueryInQueue
=
handle
->
pMsgCb
->
qsizeFp
(
handle
->
pMsgCb
->
mgmt
,
mgmt
->
nodeId
,
QUERY_QUEUE
);
pStat
->
numOfFetchInQueue
=
handle
->
pMsgCb
->
qsizeFp
(
handle
->
pMsgCb
->
mgmt
,
mgmt
->
nodeId
,
FETCH_QUEUE
);
pStat
->
timeInQueryQueue
=
qwGetTimeInQueue
((
SQWorker
*
)
qWorkerMgmt
,
QUERY_QUEUE
);
pStat
->
timeInFetchQueue
=
qwGetTimeInQueue
((
SQWorker
*
)
qWorkerMgmt
,
FETCH_QUEUE
);
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/libs/scalar/test/scalar/CMakeLists.txt
浏览文件 @
6874016b
...
@@ -17,7 +17,9 @@ TARGET_INCLUDE_DIRECTORIES(
...
@@ -17,7 +17,9 @@ TARGET_INCLUDE_DIRECTORIES(
PUBLIC
"
${
TD_SOURCE_DIR
}
/source/libs/parser/inc"
PUBLIC
"
${
TD_SOURCE_DIR
}
/source/libs/parser/inc"
PRIVATE
"
${
TD_SOURCE_DIR
}
/source/libs/scalar/inc"
PRIVATE
"
${
TD_SOURCE_DIR
}
/source/libs/scalar/inc"
)
)
add_test
(
if
(
NOT TD_WINDOWS
)
add_test
(
NAME scalarTest
NAME scalarTest
COMMAND scalarTest
COMMAND scalarTest
)
)
endif
(
NOT TD_WINDOWS
)
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
6874016b
...
@@ -300,7 +300,7 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask);
...
@@ -300,7 +300,7 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask);
int32_t
schSaveJobQueryRes
(
SSchJob
*
pJob
,
SQueryTableRsp
*
rsp
);
int32_t
schSaveJobQueryRes
(
SSchJob
*
pJob
,
SQueryTableRsp
*
rsp
);
int32_t
schProcessOnExplainDone
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
SRetrieveTableRsp
*
pRsp
);
int32_t
schProcessOnExplainDone
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
SRetrieveTableRsp
*
pRsp
);
void
schProcessOnDataFetched
(
SSchJob
*
job
);
void
schProcessOnDataFetched
(
SSchJob
*
job
);
int32_t
schGetTask
FromTaskList
(
SHashObj
*
pTaskList
,
uint64_t
taskId
,
SSchTask
**
pTask
);
int32_t
schGetTask
InJob
(
SSchJob
*
pJob
,
uint64_t
taskId
,
SSchTask
**
pTask
);
int32_t
schUpdateTaskExecNodeHandle
(
SSchTask
*
pTask
,
void
*
handle
,
int32_t
rspCode
);
int32_t
schUpdateTaskExecNodeHandle
(
SSchTask
*
pTask
,
void
*
handle
,
int32_t
rspCode
);
void
schFreeRpcCtxVal
(
const
void
*
arg
);
void
schFreeRpcCtxVal
(
const
void
*
arg
);
int32_t
schMakeBrokenLinkVal
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
SRpcBrokenlinkVal
*
brokenVal
,
bool
isHb
);
int32_t
schMakeBrokenLinkVal
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
SRpcBrokenlinkVal
*
brokenVal
,
bool
isHb
);
...
@@ -314,12 +314,11 @@ int32_t schCancelJob(SSchJob *pJob);
...
@@ -314,12 +314,11 @@ int32_t schCancelJob(SSchJob *pJob);
int32_t
schProcessOnJobDropped
(
SSchJob
*
pJob
,
int32_t
errCode
);
int32_t
schProcessOnJobDropped
(
SSchJob
*
pJob
,
int32_t
errCode
);
uint64_t
schGenTaskId
(
void
);
uint64_t
schGenTaskId
(
void
);
void
schCloseJobRef
(
void
);
void
schCloseJobRef
(
void
);
int32_t
schExecJob
(
void
*
pTrans
,
SArray
*
pNodeList
,
SQueryPlan
*
pDag
,
int64_t
*
pJob
,
const
char
*
sql
,
int32_t
schExecJob
(
void
*
pTrans
,
SArray
*
pNodeList
,
SQueryPlan
*
pDag
,
int64_t
*
pJob
,
const
char
*
sql
,
int64_t
startTs
,
SSchResInfo
*
pRes
);
int64_t
startTs
,
SSchResInfo
*
pRes
);
int32_t
schAsyncExecJob
(
void
*
pTrans
,
SArray
*
pNodeList
,
SQueryPlan
*
pDag
,
int64_t
*
pJob
,
const
char
*
sql
,
int64_t
startTs
,
SSchResInfo
*
pRes
);
int32_t
schAsyncExecJob
(
void
*
pTrans
,
SArray
*
pNodeList
,
SQueryPlan
*
pDag
,
int64_t
*
pJob
,
const
char
*
sql
,
int64_t
startTs
,
SSchResInfo
*
pRes
);
int32_t
schFetchRows
(
SSchJob
*
pJob
);
int32_t
schFetchRows
(
SSchJob
*
pJob
);
int32_t
schAsyncFetchRows
(
SSchJob
*
pJob
);
int32_t
schAsyncFetchRows
(
SSchJob
*
pJob
);
int32_t
schUpdateTaskHandle
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
int32_t
msgType
,
void
*
handle
,
int32_t
rspCode
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/libs/scheduler/src/schJob.c
浏览文件 @
6874016b
...
@@ -342,6 +342,36 @@ int32_t schRecordTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *ad
...
@@ -342,6 +342,36 @@ int32_t schRecordTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *ad
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
schDropTaskExecNode
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
void
*
handle
)
{
if
(
NULL
==
pTask
->
execNodes
)
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
num
=
taosArrayGetSize
(
pTask
->
execNodes
);
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SSchNodeInfo
*
pNode
=
taosArrayGet
(
pTask
->
execNodes
,
i
);
if
(
pNode
->
handle
==
handle
)
{
taosArrayRemove
(
pTask
->
execNodes
,
i
);
break
;
}
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
schUpdateTaskHandle
(
SSchJob
*
pJob
,
SSchTask
*
pTask
,
int32_t
msgType
,
void
*
handle
,
int32_t
rspCode
)
{
SCH_SET_TASK_HANDLE
(
pTask
,
handle
);
schUpdateTaskExecNodeHandle
(
pTask
,
handle
,
rspCode
);
if
(
msgType
==
TDMT_SCH_LINK_BROKEN
)
{
schDropTaskExecNode
(
pJob
,
pTask
,
handle
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
schRecordQueryDataSrc
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
int32_t
schRecordQueryDataSrc
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
if
(
!
SCH_IS_DATA_SRC_QRY_TASK
(
pTask
))
{
if
(
!
SCH_IS_DATA_SRC_QRY_TASK
(
pTask
))
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -469,6 +499,34 @@ _return:
...
@@ -469,6 +499,34 @@ _return:
SCH_RET
(
code
);
SCH_RET
(
code
);
}
}
int32_t
schSetAddrsFromNodeList
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
int32_t
addNum
=
0
;
int32_t
nodeNum
=
0
;
if
(
pJob
->
nodeList
)
{
nodeNum
=
taosArrayGetSize
(
pJob
->
nodeList
);
for
(
int32_t
i
=
0
;
i
<
nodeNum
&&
addNum
<
SCH_MAX_CANDIDATE_EP_NUM
;
++
i
)
{
SQueryNodeAddr
*
naddr
=
taosArrayGet
(
pJob
->
nodeList
,
i
);
if
(
NULL
==
taosArrayPush
(
pTask
->
candidateAddrs
,
naddr
))
{
SCH_TASK_ELOG
(
"taosArrayPush execNode to candidate addrs failed, addNum:%d, errno:%d"
,
addNum
,
errno
);
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
++
addNum
;
}
}
if
(
addNum
<=
0
)
{
SCH_TASK_ELOG
(
"no available execNode as candidates, nodeNum:%d"
,
nodeNum
);
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
schSetTaskCandidateAddrs
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
int32_t
schSetTaskCandidateAddrs
(
SSchJob
*
pJob
,
SSchTask
*
pTask
)
{
if
(
NULL
!=
pTask
->
candidateAddrs
)
{
if
(
NULL
!=
pTask
->
candidateAddrs
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -492,27 +550,7 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) {
...
@@ -492,27 +550,7 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
addNum
=
0
;
SCH_ERR_RET
(
schSetAddrsFromNodeList
(
pJob
,
pTask
));
int32_t
nodeNum
=
0
;
if
(
pJob
->
nodeList
)
{
nodeNum
=
taosArrayGetSize
(
pJob
->
nodeList
);
for
(
int32_t
i
=
0
;
i
<
nodeNum
&&
addNum
<
SCH_MAX_CANDIDATE_EP_NUM
;
++
i
)
{
SQueryNodeAddr
*
naddr
=
taosArrayGet
(
pJob
->
nodeList
,
i
);
if
(
NULL
==
taosArrayPush
(
pTask
->
candidateAddrs
,
naddr
))
{
SCH_TASK_ELOG
(
"taosArrayPush execNode to candidate addrs failed, addNum:%d, errno:%d"
,
addNum
,
errno
);
SCH_ERR_RET
(
TSDB_CODE_QRY_OUT_OF_MEMORY
);
}
++
addNum
;
}
}
if
(
addNum
<=
0
)
{
SCH_TASK_ELOG
(
"no available execNode as candidates, nodeNum:%d"
,
nodeNum
);
SCH_ERR_RET
(
TSDB_CODE_QRY_INVALID_INPUT
);
}
/*
/*
for (int32_t i = 0; i < job->dataSrcEps.numOfEps && addNum < SCH_MAX_CANDIDATE_EP_NUM; ++i) {
for (int32_t i = 0; i < job->dataSrcEps.numOfEps && addNum < SCH_MAX_CANDIDATE_EP_NUM; ++i) {
...
@@ -1001,19 +1039,19 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) {
...
@@ -1001,19 +1039,19 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) {
*/
*/
for
(
int32_t
i
=
0
;
i
<
parentNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
parentNum
;
++
i
)
{
SSchTask
*
par
=
*
(
SSchTask
**
)
taosArrayGet
(
pTask
->
parents
,
i
);
SSchTask
*
par
ent
=
*
(
SSchTask
**
)
taosArrayGet
(
pTask
->
parents
,
i
);
int32_t
readyNum
=
atomic_add_fetch_32
(
&
par
->
childReady
,
1
);
int32_t
readyNum
=
atomic_add_fetch_32
(
&
par
ent
->
childReady
,
1
);
SCH_LOCK
(
SCH_WRITE
,
&
par
->
lock
);
SCH_LOCK
(
SCH_WRITE
,
&
par
ent
->
lock
);
SDownstreamSourceNode
source
=
{.
type
=
QUERY_NODE_DOWNSTREAM_SOURCE
,
SDownstreamSourceNode
source
=
{.
type
=
QUERY_NODE_DOWNSTREAM_SOURCE
,
.
taskId
=
pTask
->
taskId
,
.
taskId
=
pTask
->
taskId
,
.
schedId
=
schMgmt
.
sId
,
.
schedId
=
schMgmt
.
sId
,
.
addr
=
pTask
->
succeedAddr
};
.
addr
=
pTask
->
succeedAddr
};
qSetSubplanExecutionNode
(
par
->
plan
,
pTask
->
plan
->
id
.
groupId
,
&
source
);
qSetSubplanExecutionNode
(
par
ent
->
plan
,
pTask
->
plan
->
id
.
groupId
,
&
source
);
SCH_UNLOCK
(
SCH_WRITE
,
&
par
->
lock
);
SCH_UNLOCK
(
SCH_WRITE
,
&
par
ent
->
lock
);
if
(
SCH_TASK_READY_FOR_LAUNCH
(
readyNum
,
par
))
{
if
(
SCH_TASK_READY_FOR_LAUNCH
(
readyNum
,
par
ent
))
{
SCH_ERR_RET
(
schLaunchTask
(
pJob
,
par
));
SCH_ERR_RET
(
schLaunchTask
(
pJob
,
par
ent
));
}
}
}
}
...
@@ -1087,7 +1125,7 @@ int32_t schSaveJobQueryRes(SSchJob *pJob, SQueryTableRsp *rsp) {
...
@@ -1087,7 +1125,7 @@ int32_t schSaveJobQueryRes(SSchJob *pJob, SQueryTableRsp *rsp) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
schGetTaskFrom
Task
List
(
SHashObj
*
pTaskList
,
uint64_t
taskId
,
SSchTask
**
pTask
)
{
int32_t
schGetTaskFromList
(
SHashObj
*
pTaskList
,
uint64_t
taskId
,
SSchTask
**
pTask
)
{
int32_t
s
=
taosHashGetSize
(
pTaskList
);
int32_t
s
=
taosHashGetSize
(
pTaskList
);
if
(
s
<=
0
)
{
if
(
s
<=
0
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -1103,6 +1141,21 @@ int32_t schGetTaskFromTaskList(SHashObj *pTaskList, uint64_t taskId, SSchTask **
...
@@ -1103,6 +1141,21 @@ int32_t schGetTaskFromTaskList(SHashObj *pTaskList, uint64_t taskId, SSchTask **
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
schGetTaskInJob
(
SSchJob
*
pJob
,
uint64_t
taskId
,
SSchTask
**
pTask
)
{
schGetTaskFromList
(
pJob
->
execTasks
,
taskId
,
pTask
);
if
(
NULL
==
*
pTask
)
{
schGetTaskFromList
(
pJob
->
succTasks
,
taskId
,
pTask
);
if
(
NULL
==
*
pTask
)
{
SCH_JOB_ELOG
(
"task not found in execList & succList, taskId:%"
PRIx64
,
taskId
);
SCH_ERR_RET
(
TSDB_CODE_SCH_INTERNAL_ERROR
);
}
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
schUpdateTaskExecNodeHandle
(
SSchTask
*
pTask
,
void
*
handle
,
int32_t
rspCode
)
{
int32_t
schUpdateTaskExecNodeHandle
(
SSchTask
*
pTask
,
void
*
handle
,
int32_t
rspCode
)
{
if
(
rspCode
||
NULL
==
pTask
->
execNodes
||
taosArrayGetSize
(
pTask
->
execNodes
)
>
1
||
if
(
rspCode
||
NULL
==
pTask
->
execNodes
||
taosArrayGetSize
(
pTask
->
execNodes
)
>
1
||
taosArrayGetSize
(
pTask
->
execNodes
)
<=
0
)
{
taosArrayGetSize
(
pTask
->
execNodes
)
<=
0
)
{
...
...
source/libs/scheduler/src/schRemote.c
浏览文件 @
6874016b
...
@@ -358,27 +358,11 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in
...
@@ -358,27 +358,11 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in
SCH_ERR_JRET
(
TSDB_CODE_QRY_JOB_FREED
);
SCH_ERR_JRET
(
TSDB_CODE_QRY_JOB_FREED
);
}
}
schGetTaskFromTaskList
(
pJob
->
execTasks
,
pParam
->
taskId
,
&
pTask
);
SCH_ERR_JRET
(
schGetTaskInJob
(
pJob
,
pParam
->
taskId
,
&
pTask
));
if
(
NULL
==
pTask
)
{
if
(
TDMT_VND_EXPLAIN_RSP
==
msgType
)
{
schGetTaskFromTaskList
(
pJob
->
succTasks
,
pParam
->
taskId
,
&
pTask
);
}
else
{
SCH_JOB_ELOG
(
"task not found in execTask list, refId:%"
PRIx64
", taskId:%"
PRIx64
,
pParam
->
refId
,
pParam
->
taskId
);
SCH_ERR_JRET
(
TSDB_CODE_SCH_INTERNAL_ERROR
);
}
}
if
(
NULL
==
pTask
)
{
SCH_JOB_ELOG
(
"task not found in execList & succList, refId:%"
PRIx64
", taskId:%"
PRIx64
,
pParam
->
refId
,
pParam
->
taskId
);
SCH_ERR_JRET
(
TSDB_CODE_SCH_INTERNAL_ERROR
);
}
SCH_TASK_DLOG
(
"rsp msg received, type:%s, handle:%p, code:%s"
,
TMSG_INFO
(
msgType
),
pMsg
->
handle
,
tstrerror
(
rspCode
));
SCH_TASK_DLOG
(
"rsp msg received, type:%s, handle:%p, code:%s"
,
TMSG_INFO
(
msgType
),
pMsg
->
handle
,
tstrerror
(
rspCode
));
SCH_SET_TASK_HANDLE
(
pTask
,
pMsg
->
handle
);
SCH_ERR_JRET
(
schUpdateTaskHandle
(
pJob
,
pTask
,
msgType
,
pMsg
->
handle
,
rspCode
));
schUpdateTaskExecNodeHandle
(
pTask
,
pMsg
->
handle
,
rspCode
);
SCH_ERR_JRET
(
schHandleResponseMsg
(
pJob
,
pTask
,
msgType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
));
SCH_ERR_JRET
(
schHandleResponseMsg
(
pJob
,
pTask
,
msgType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
));
...
...
source/libs/scheduler/src/scheduler.c
浏览文件 @
6874016b
...
@@ -141,7 +141,7 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) {
...
@@ -141,7 +141,7 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) {
if
(
pJob
->
status
<
JOB_TASK_STATUS_NOT_START
||
pJob
->
levelNum
<=
0
||
NULL
==
pJob
->
levels
)
{
if
(
pJob
->
status
<
JOB_TASK_STATUS_NOT_START
||
pJob
->
levelNum
<=
0
||
NULL
==
pJob
->
levels
)
{
qDebug
(
"job not initialized or not executable job, refId:%"
PRIx64
,
job
);
qDebug
(
"job not initialized or not executable job, refId:%"
PRIx64
,
job
);
SCH_ERR_RET
(
TSDB_CODE_SCH_STATUS_ERROR
);
SCH_ERR_
J
RET
(
TSDB_CODE_SCH_STATUS_ERROR
);
}
}
for
(
int32_t
i
=
pJob
->
levelNum
-
1
;
i
>=
0
;
--
i
)
{
for
(
int32_t
i
=
pJob
->
levelNum
-
1
;
i
>=
0
;
--
i
)
{
...
@@ -155,7 +155,11 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) {
...
@@ -155,7 +155,11 @@ int32_t schedulerGetTasksStatus(int64_t job, SArray *pSub) {
}
}
}
}
return
TSDB_CODE_SUCCESS
;
_return:
schReleaseJob
(
job
);
SCH_RET
(
code
);
}
}
int32_t
scheduleCancelJob
(
int64_t
job
)
{
int32_t
scheduleCancelJob
(
int64_t
job
)
{
...
...
source/libs/tdb/src/db/tdbTable.c
浏览文件 @
6874016b
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include "tdbInt.h"
#include "tdbInt.h"
struct
STTB
{
struct
STTB
{
TDB
*
pEnv
;
TDB
*
pEnv
;
SBTree
*
pBt
;
SBTree
*
pBt
;
};
};
...
@@ -25,11 +25,11 @@ struct STBC {
...
@@ -25,11 +25,11 @@ struct STBC {
};
};
int
tdbTbOpen
(
const
char
*
tbname
,
int
keyLen
,
int
valLen
,
tdb_cmpr_fn_t
keyCmprFn
,
TDB
*
pEnv
,
TTB
**
ppTb
)
{
int
tdbTbOpen
(
const
char
*
tbname
,
int
keyLen
,
int
valLen
,
tdb_cmpr_fn_t
keyCmprFn
,
TDB
*
pEnv
,
TTB
**
ppTb
)
{
TTB
*
pTb
;
TTB
*
pTb
;
SPager
*
pPager
;
SPager
*
pPager
;
int
ret
;
int
ret
;
char
fFullName
[
TDB_FILENAME_LEN
];
char
fFullName
[
TDB_FILENAME_LEN
];
SPage
*
pPage
;
SPage
*
pPage
;
SPgno
pgno
;
SPgno
pgno
;
*
ppTb
=
NULL
;
*
ppTb
=
NULL
;
...
...
source/util/src/terror.c
浏览文件 @
6874016b
...
@@ -187,6 +187,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SNODE_NOT_EXIST, "Snode not there")
...
@@ -187,6 +187,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_SNODE_NOT_EXIST, "Snode not there")
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_ALREADY_EXIST
,
"Bnode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_ALREADY_EXIST
,
"Bnode already exists"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_NOT_EXIST
,
"Bnode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_BNODE_NOT_EXIST
,
"Bnode not there"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_FEW_MNODES
,
"Too few mnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_FEW_MNODES
,
"Too few mnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_TOO_MANY_MNODES
,
"Too many mnodes"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MNODE_DEPLOYED
,
"Mnode deployed in this dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_MNODE_DEPLOYED
,
"Mnode deployed in this dnode"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_CANT_DROP_MASTER
,
"Can't drop mnode which is master"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_MND_CANT_DROP_MASTER
,
"Can't drop mnode which is master"
)
...
...
tests/pytest/util/common.py
浏览文件 @
6874016b
...
@@ -95,8 +95,12 @@ class TDCom:
...
@@ -95,8 +95,12 @@ class TDCom:
stb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
stb_list
=
map
(
lambda
x
:
x
[
0
],
res_row_list
)
for
stb
in
stb_list
:
for
stb
in
stb_list
:
if
type
==
"taosc"
:
if
type
==
"taosc"
:
tdSql
.
execute
(
f
'drop table if exists `
{
stb
}
`'
)
if
not
stb
[
0
].
isdigit
():
tdSql
.
execute
(
f
'drop table if exists
{
stb
}
'
)
tdSql
.
execute
(
f
'drop table if exists
{
stb
}
'
)
elif
type
==
"restful"
:
elif
type
==
"restful"
:
self
.
restApiPost
(
f
"drop table if exists `
{
stb
}
`"
)
if
not
stb
[
0
].
isdigit
():
self
.
restApiPost
(
f
"drop table if exists
{
stb
}
"
)
self
.
restApiPost
(
f
"drop table if exists
{
stb
}
"
)
def
dateToTs
(
self
,
datetime_input
):
def
dateToTs
(
self
,
datetime_input
):
...
...
tests/script/jenkins/basic.txt
浏览文件 @
6874016b
...
@@ -57,7 +57,6 @@
...
@@ -57,7 +57,6 @@
# ---- mnode
# ---- mnode
./test.sh -f tsim/mnode/basic1.sim
./test.sh -f tsim/mnode/basic1.sim
./test.sh -f tsim/mnode/basic2.sim
./test.sh -f tsim/mnode/basic2.sim
./test.sh -f tsim/mnode/basic3.sim
# ---- show
# ---- show
./test.sh -f tsim/show/basic.sim
./test.sh -f tsim/show/basic.sim
...
@@ -108,6 +107,7 @@
...
@@ -108,6 +107,7 @@
./test.sh -f tsim/stable/alter_insert1.sim
./test.sh -f tsim/stable/alter_insert1.sim
./test.sh -f tsim/stable/alter_insert2.sim
./test.sh -f tsim/stable/alter_insert2.sim
./test.sh -f tsim/stable/alter_import.sim
./test.sh -f tsim/stable/alter_import.sim
./test.sh -f tsim/stable/tag_filter.sim
# --- for multi process mode
# --- for multi process mode
./test.sh -f tsim/user/basic1.sim -m
./test.sh -f tsim/user/basic1.sim -m
...
...
tests/script/tsim/mnode/basic3.sim
浏览文件 @
6874016b
...
@@ -2,14 +2,17 @@ system sh/stop_dnodes.sh
...
@@ -2,14 +2,17 @@ system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode1 -i 1
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode2 -i 2
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode3 -i 3
system sh/deploy.sh -n dnode4 -i 4
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode1 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode2 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode3 -s start
system sh/exec.sh -n dnode4 -s start
sql connect
sql connect
print =============== step1: create dnodes
print =============== step1: create dnodes
sql create dnode $hostname port 7200
sql create dnode $hostname port 7200
sql create dnode $hostname port 7300
sql create dnode $hostname port 7300
sql create dnode $hostname port 7400
$x = 0
$x = 0
step1:
step1:
...
@@ -32,6 +35,7 @@ endi
...
@@ -32,6 +35,7 @@ endi
print =============== step2: create mnode 2
print =============== step2: create mnode 2
sql create mnode on dnode 2
sql create mnode on dnode 2
sql create mnode on dnode 3
sql create mnode on dnode 3
sql_error create mnode on dnode 4
$x = 0
$x = 0
step2:
step2:
...
@@ -135,3 +139,4 @@ endi
...
@@ -135,3 +139,4 @@ endi
system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode1 -s stop
system sh/exec.sh -n dnode2 -s stop
system sh/exec.sh -n dnode2 -s stop
system sh/exec.sh -n dnode3 -s stop
system sh/exec.sh -n dnode3 -s stop
system sh/exec.sh -n dnode4 -s stop
\ No newline at end of file
tests/script/tsim/stable/tag_filter.sim
0 → 100644
浏览文件 @
6874016b
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print ========== prepare stb and ctb
sql create database db vgroups 1
sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 binary(16)) comment "abd"
sql create table db.ctb1 using db.stb tags(1, "102")
sql insert into db.ctb1 values(now, 1, "2")
sql create table db.ctb2 using db.stb tags(2, "102")
sql insert into db.ctb2 values(now, 2, "2")
sql create table db.ctb3 using db.stb tags(3, "102")
sql insert into db.ctb3 values(now, 3, "2")
sql create table db.ctb4 using db.stb tags(4, "102")
sql insert into db.ctb4 values(now, 4, "2")
sql create table db.ctb5 using db.stb tags(5, "102")
sql insert into db.ctb5 values(now, 5, "2")
sql create table db.ctb6 using db.stb tags(6, "102")
sql insert into db.ctb6 values(now, 6, "2")
sql select * from db.stb where t1 = 1
if $rows != 1 then
return -1
endi
sql select * from db.stb where t1 < 1
if $rows != 0 then
return -=1
endi
sql select * from db.stb where t1 < 2
if $rows != 1 then
return -1
endi
sql select * from db.stb where t1 <= 2
if $rows != 2 then
return -1
endi
sql select * from db.stb where t1 >= 1
if $rows != 6 then
return -1
endi
sql select * from db.stb where t1 > 1
if $rows != 5 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
tests/script/tsim/trans/create_db.sim
浏览文件 @
6874016b
...
@@ -76,14 +76,6 @@ if $data[0][3] != d1 then
...
@@ -76,14 +76,6 @@ if $data[0][3] != d1 then
return -1
return -1
endi
endi
if $data[0][4] != create-db then
return -1
endi
if $data[0][7] != @Unable to establish connection@ then
return -1
endi
sql_error create database d1 vgroups 2;
sql_error create database d1 vgroups 2;
print =============== start dnode2
print =============== start dnode2
...
@@ -125,15 +117,7 @@ endi
...
@@ -125,15 +117,7 @@ endi
if $data[0][3] != d2 then
if $data[0][3] != d2 then
return -1
return -1
endi
endi
return
if $data[0][4] != create-db then
return -1
endi
if $data[0][7] != @Unable to establish connection@ then
return -1
endi
sql_error create database d2 vgroups 2;
sql_error create database d2 vgroups 2;
print =============== kill transaction
print =============== kill transaction
...
...
tests/system-test/1-insert/influxdb_line_taosc_insert.py
0 → 100644
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
0 → 100644
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
tests/system-test/2-query/function_stateduration.py
0 → 100644
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
tests/system-test/2-query/statecount.py
0 → 100644
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
tests/test/c/sdbDump.c
浏览文件 @
6874016b
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录