Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4b9ea626
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4b9ea626
编写于
6月 03, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into feature/3_liaohj
上级
3ff81a90
68b9608f
变更
123
展开全部
隐藏空白更改
内联
并排
Showing
123 changed file
with
3097 addition
and
2105 deletion
+3097
-2105
docs-cn/14-reference/02-rest-api/02-rest-api.mdx
docs-cn/14-reference/02-rest-api/02-rest-api.mdx
+1
-1
include/common/tdataformat.h
include/common/tdataformat.h
+16
-24
include/common/tmsg.h
include/common/tmsg.h
+6
-5
include/common/tmsgcb.h
include/common/tmsgcb.h
+2
-2
include/common/tmsgdef.h
include/common/tmsgdef.h
+84
-88
include/common/ttypes.h
include/common/ttypes.h
+46
-41
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+1
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+23
-14
include/libs/parser/parser.h
include/libs/parser/parser.h
+1
-0
include/libs/planner/planner.h
include/libs/planner/planner.h
+1
-1
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+1
-0
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+1
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-1
source/client/src/clientSml.c
source/client/src/clientSml.c
+37
-1
source/client/test/smlTest.cpp
source/client/test/smlTest.cpp
+45
-1
source/common/src/systable.c
source/common/src/systable.c
+2
-0
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+268
-435
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/common/src/tmsgcb.c
source/common/src/tmsgcb.c
+8
-28
source/dnode/mgmt/exe/dmMain.c
source/dnode/mgmt/exe/dmMain.c
+1
-1
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
+1
-4
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+2
-2
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
+1
-4
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
+27
-29
source/dnode/mgmt/mgmt_qnode/inc/qmInt.h
source/dnode/mgmt/mgmt_qnode/inc/qmInt.h
+1
-2
source/dnode/mgmt/mgmt_qnode/src/qmInt.c
source/dnode/mgmt/mgmt_qnode/src/qmInt.c
+1
-2
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
+14
-12
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
+26
-31
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
+7
-5
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+89
-63
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+6
-15
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+97
-158
source/dnode/mgmt/node_mgmt/src/dmEnv.c
source/dnode/mgmt/node_mgmt/src/dmEnv.c
+5
-5
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+3
-3
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+1
-0
source/dnode/mgmt/node_util/src/dmEps.c
source/dnode/mgmt/node_util/src/dmEps.c
+4
-2
source/dnode/mgmt/node_util/src/dmFile.c
source/dnode/mgmt/node_util/src/dmFile.c
+1
-1
source/dnode/mgmt/test/mnode/dmnode.cpp
source/dnode/mgmt/test/mnode/dmnode.cpp
+4
-4
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/inc/mndTopic.h
source/dnode/mnode/impl/inc/mndTopic.h
+2
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+11
-1
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+8
-8
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+1
-1
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+50
-0
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+1
-1
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-2
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+3
-0
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+6
-6
source/dnode/vnode/src/inc/sma.h
source/dnode/vnode/src/inc/sma.h
+2
-0
source/dnode/vnode/src/inc/vnd.h
source/dnode/vnode/src/inc/vnd.h
+1
-1
source/dnode/vnode/src/meta/metaOpen.c
source/dnode/vnode/src/meta/metaOpen.c
+12
-12
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+22
-14
source/dnode/vnode/src/meta/metaSma.c
source/dnode/vnode/src/meta/metaSma.c
+2
-2
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+41
-37
source/dnode/vnode/src/sma/sma.c
source/dnode/vnode/src/sma/sma.c
+12
-4
source/dnode/vnode/src/sma/smaEnv.c
source/dnode/vnode/src/sma/smaEnv.c
+6
-6
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+15
-15
source/dnode/vnode/src/sma/smaTimeRange.c
source/dnode/vnode/src/sma/smaTimeRange.c
+43
-43
source/dnode/vnode/src/sma/smaTimeRange2.c
source/dnode/vnode/src/sma/smaTimeRange2.c
+1084
-0
source/dnode/vnode/src/tq/tqPush.c
source/dnode/vnode/src/tq/tqPush.c
+26
-28
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+37
-25
source/dnode/vnode/src/tsdb/tsdbCommit2.c
source/dnode/vnode/src/tsdb/tsdbCommit2.c
+0
-28
source/dnode/vnode/src/tsdb/tsdbFS.c
source/dnode/vnode/src/tsdb/tsdbFS.c
+36
-36
source/dnode/vnode/src/tsdb/tsdbFile.c
source/dnode/vnode/src/tsdb/tsdbFile.c
+4
-4
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
+96
-276
source/dnode/vnode/src/tsdb/tsdbOpen.c
source/dnode/vnode/src/tsdb/tsdbOpen.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+4
-4
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
+27
-27
source/dnode/vnode/src/tsdb/tsdbWrite.c
source/dnode/vnode/src/tsdb/tsdbWrite.c
+6
-6
source/dnode/vnode/src/vnd/vnodeBufPool.c
source/dnode/vnode/src/vnd/vnodeBufPool.c
+3
-3
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+9
-9
source/dnode/vnode/src/vnd/vnodeOpen.c
source/dnode/vnode/src/vnd/vnodeOpen.c
+14
-14
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+10
-9
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+8
-6
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+7
-7
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+22
-21
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+3
-1
source/libs/index/src/indexFilter.c
source/libs/index/src/indexFilter.c
+50
-29
source/libs/nodes/src/nodesCloneFuncs.c
source/libs/nodes/src/nodesCloneFuncs.c
+2
-1
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+8
-0
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+4
-0
source/libs/parser/inc/parInt.h
source/libs/parser/inc/parInt.h
+1
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+19
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+16
-1
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+1
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+14
-3
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+87
-32
source/libs/planner/test/planOtherTest.cpp
source/libs/planner/test/planOtherTest.cpp
+6
-0
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+16
-17
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+7
-7
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+4
-4
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+0
-1
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-1
source/util/src/terror.c
source/util/src/terror.c
+2
-1
source/util/src/tworker.c
source/util/src/tworker.c
+2
-2
tests/script/tsim/bnode/basic1.sim
tests/script/tsim/bnode/basic1.sim
+2
-2
tests/script/tsim/db/alter_option.sim
tests/script/tsim/db/alter_option.sim
+15
-15
tests/script/tsim/db/alter_replica_13.sim
tests/script/tsim/db/alter_replica_13.sim
+28
-12
tests/script/tsim/dnode/basic1.sim
tests/script/tsim/dnode/basic1.sim
+2
-2
tests/script/tsim/mnode/basic1.sim
tests/script/tsim/mnode/basic1.sim
+6
-6
tests/script/tsim/mnode/basic2.sim
tests/script/tsim/mnode/basic2.sim
+3
-3
tests/script/tsim/mnode/basic3.sim
tests/script/tsim/mnode/basic3.sim
+4
-4
tests/script/tsim/mnode/basic4.sim
tests/script/tsim/mnode/basic4.sim
+22
-22
tests/script/tsim/qnode/basic1.sim
tests/script/tsim/qnode/basic1.sim
+2
-2
tests/script/tsim/query/explain.sim
tests/script/tsim/query/explain.sim
+1
-1
tests/script/tsim/query/scalarNull.sim
tests/script/tsim/query/scalarNull.sim
+1
-1
tests/script/tsim/query/udf.sim
tests/script/tsim/query/udf.sim
+1
-1
tests/script/tsim/snode/basic1.sim
tests/script/tsim/snode/basic1.sim
+2
-2
tests/script/tsim/sync/3Replica1VgElect.sim
tests/script/tsim/sync/3Replica1VgElect.sim
+27
-27
tests/script/tsim/sync/3Replica5VgElect.sim
tests/script/tsim/sync/3Replica5VgElect.sim
+135
-135
tests/script/tsim/sync/oneReplica1VgElect.sim
tests/script/tsim/sync/oneReplica1VgElect.sim
+12
-12
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
+12
-12
tests/script/tsim/sync/oneReplica5VgElect.sim
tests/script/tsim/sync/oneReplica5VgElect.sim
+30
-30
tests/script/tsim/sync/threeReplica1VgElect.sim
tests/script/tsim/sync/threeReplica1VgElect.sim
+21
-21
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
+39
-39
tests/script/tsim/trans/create_db.sim
tests/script/tsim/trans/create_db.sim
+1
-1
tests/system-test/0-others/taosdMonitor.py
tests/system-test/0-others/taosdMonitor.py
+1
-1
tests/system-test/1-insert/influxdb_line_taosc_insert.py
tests/system-test/1-insert/influxdb_line_taosc_insert.py
+2
-2
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
+5
-5
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
...system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
+3
-3
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+1
-0
tests/test/c/sdbDump.c
tests/test/c/sdbDump.c
+1
-0
未找到文件。
docs-cn/14-reference/02-rest-api/02-rest-api.mdx
浏览文件 @
4b9ea626
...
@@ -16,7 +16,7 @@ RESTful 接口不依赖于任何 TDengine 的库,因此客户端不需要安
...
@@ -16,7 +16,7 @@ RESTful 接口不依赖于任何 TDengine 的库,因此客户端不需要安
在已经安装 TDengine 服务器端的情况下,可以按照如下方式进行验证。
在已经安装 TDengine 服务器端的情况下,可以按照如下方式进行验证。
下面以 Ubuntu 环境中使用 curl 工具(确认已经安装)来验证 RESTful 接口的正常。
下面以 Ubuntu 环境中使用 curl 工具(确认已经安装)来验证 RESTful 接口的正常
,验证前请确认 taosAdapter 服务已开启,在 Linux 系统上此服务默认由 systemd 管理,使用命令 `systemctl start taosadapter` 启动
。
下面示例是列出所有的数据库,请把 h1.taosdata.com 和 6041(缺省值)替换为实际运行的 TDengine 服务 FQDN 和端口号:
下面示例是列出所有的数据库,请把 h1.taosdata.com 和 6041(缺省值)替换为实际运行的 TDengine 服务 FQDN 和端口号:
...
...
include/common/tdataformat.h
浏览文件 @
4b9ea626
...
@@ -46,6 +46,7 @@ void tTSchemaDestroy(STSchema *pTSchema);
...
@@ -46,6 +46,7 @@ void tTSchemaDestroy(STSchema *pTSchema);
#define COL_VAL_NULL(CID) ((SColVal){.cid = (CID), .isNull = 1})
#define COL_VAL_NULL(CID) ((SColVal){.cid = (CID), .isNull = 1})
#define COL_VAL_VALUE(CID, V) ((SColVal){.cid = (CID), .value = (V)})
#define COL_VAL_VALUE(CID, V) ((SColVal){.cid = (CID), .value = (V)})
int32_t
tTSRowNew
(
STSRowBuilder
*
pBuilder
,
SArray
*
pArray
,
STSchema
*
pTSchema
,
STSRow2
**
ppRow
);
int32_t
tTSRowClone
(
const
STSRow2
*
pRow
,
STSRow2
**
ppRow
);
int32_t
tTSRowClone
(
const
STSRow2
*
pRow
,
STSRow2
**
ppRow
);
void
tTSRowFree
(
STSRow2
*
pRow
);
void
tTSRowFree
(
STSRow2
*
pRow
);
void
tTSRowGet
(
STSRow2
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
);
void
tTSRowGet
(
STSRow2
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
);
...
@@ -54,24 +55,24 @@ int32_t tPutTSRow(uint8_t *p, STSRow2 *pRow);
...
@@ -54,24 +55,24 @@ int32_t tPutTSRow(uint8_t *p, STSRow2 *pRow);
int32_t
tGetTSRow
(
uint8_t
*
p
,
STSRow2
*
pRow
);
int32_t
tGetTSRow
(
uint8_t
*
p
,
STSRow2
*
pRow
);
// STSRowBuilder
// STSRowBuilder
#
if 0
#
define tsRowBuilderInit() ((STSRowBuilder){0})
int32_t tTSRowBuilderInit(STSRowBuilder *pBuilder, int32_t sver, int32_t nCols, SSchema *pSchema);
#define tsRowBuilderClear(B) \
void tTSRowBuilderClear(STSRowBuilder *pBuilder);
do { \
void tTSRowBuilderReset(STSRowBuilder *pBuilder);
if ((B)->pBuf) { \
int32_t tTSRowBuilderPut(STSRowBuilder *pBuilder, int32_t cid, uint8_t *pData, uint32_t nData);
taosMemoryFree((B)->pBuf); \
int32_t tTSRowBuilderGetRow(STSRowBuilder *pBuilder, const STSRow2 **ppRow);
} \
#endif
} while (0)
// STag
// STag
int32_t
tTagNew
(
SArray
*
pArray
,
int32_t
version
,
int8_t
isJson
,
STag
**
ppTag
);
int32_t
tTagNew
(
SArray
*
pArray
,
int32_t
version
,
int8_t
isJson
,
STag
**
ppTag
);
void
tTagFree
(
STag
*
pTag
);
void
tTagFree
(
STag
*
pTag
);
bool
tTagGet
(
const
STag
*
pTag
,
STagVal
*
pTagVal
);
bool
tTagGet
(
const
STag
*
pTag
,
STagVal
*
pTagVal
);
char
*
tTagValToData
(
const
STagVal
*
pTagVal
,
bool
isJson
);
char
*
tTagValToData
(
const
STagVal
*
pTagVal
,
bool
isJson
);
int32_t
tEncodeTag
(
SEncoder
*
pEncoder
,
const
STag
*
pTag
);
int32_t
tEncodeTag
(
SEncoder
*
pEncoder
,
const
STag
*
pTag
);
int32_t
tDecodeTag
(
SDecoder
*
pDecoder
,
STag
**
ppTag
);
int32_t
tDecodeTag
(
SDecoder
*
pDecoder
,
STag
**
ppTag
);
int32_t
tTagToValArray
(
const
STag
*
pTag
,
SArray
**
ppArray
);
int32_t
tTagToValArray
(
const
STag
*
pTag
,
SArray
**
ppArray
);
void
debugPrintSTag
(
STag
*
pTag
,
const
char
*
tag
,
int32_t
ln
);
// TODO: remove
void
debugPrintSTag
(
STag
*
pTag
,
const
char
*
tag
,
int32_t
ln
);
// TODO: remove
void
debugCheckTags
(
STag
*
pTag
);
// TODO: remove
void
debugCheckTags
(
STag
*
pTag
);
// TODO: remove
// STRUCT =================
// STRUCT =================
struct
STColumn
{
struct
STColumn
{
...
@@ -106,17 +107,9 @@ struct STSRow2 {
...
@@ -106,17 +107,9 @@ struct STSRow2 {
};
};
struct
STSRowBuilder
{
struct
STSRowBuilder
{
STSchema
*
pTSchema
;
STSRow2
tsRow
;
int32_t
szBitMap1
;
int32_t
szBuf
;
int32_t
szBitMap2
;
uint8_t
*
pBuf
;
int32_t
szKVBuf
;
uint8_t
*
pKVBuf
;
int32_t
szTPBuf
;
uint8_t
*
pTPBuf
;
int32_t
iCol
;
int32_t
vlenKV
;
int32_t
vlenTP
;
STSRow2
row
;
};
};
struct
SValue
{
struct
SValue
{
...
@@ -154,7 +147,7 @@ struct STagVal {
...
@@ -154,7 +147,7 @@ struct STagVal {
};
};
int8_t
type
;
int8_t
type
;
union
{
union
{
int64_t
i64
;
int64_t
i64
;
struct
{
struct
{
uint32_t
nData
;
uint32_t
nData
;
uint8_t
*
pData
;
uint8_t
*
pData
;
...
@@ -162,7 +155,7 @@ struct STagVal {
...
@@ -162,7 +155,7 @@ struct STagVal {
};
};
};
};
#define TD_TAG_JSON ((int8_t)0x40)
// distinguish JSON string and JSON value with the highest bit
#define TD_TAG_JSON ((int8_t)0x40) // distinguish JSON string and JSON value with the highest bit
#define TD_TAG_LARGE ((int8_t)0x20)
#define TD_TAG_LARGE ((int8_t)0x20)
struct
STag
{
struct
STag
{
int8_t
flags
;
int8_t
flags
;
...
@@ -422,4 +415,3 @@ int32_t tdMergeDataCols(SDataCols *target, SDataCols *source, int32_t rowsToM
...
@@ -422,4 +415,3 @@ int32_t tdMergeDataCols(SDataCols *target, SDataCols *source, int32_t rowsToM
#endif
#endif
#endif
/*_TD_COMMON_DATA_FORMAT_H_*/
#endif
/*_TD_COMMON_DATA_FORMAT_H_*/
include/common/tmsg.h
浏览文件 @
4b9ea626
...
@@ -772,6 +772,7 @@ typedef struct {
...
@@ -772,6 +772,7 @@ typedef struct {
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int32_t
numOfRetensions
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
SArray
*
pRetensions
;
int8_t
schemaless
;
}
SDbCfgRsp
;
}
SDbCfgRsp
;
int32_t
tSerializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SDbCfgRsp
*
pRsp
);
int32_t
tSerializeSDbCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
const
SDbCfgRsp
*
pRsp
);
...
@@ -2346,19 +2347,19 @@ typedef struct {
...
@@ -2346,19 +2347,19 @@ typedef struct {
STSma
*
tSma
;
STSma
*
tSma
;
}
STSmaWrapper
;
}
STSmaWrapper
;
static
FORCE_INLINE
void
t
d
DestroyTSma
(
STSma
*
pSma
)
{
static
FORCE_INLINE
void
tDestroyTSma
(
STSma
*
pSma
)
{
if
(
pSma
)
{
if
(
pSma
)
{
taosMemoryFreeClear
(
pSma
->
expr
);
taosMemoryFreeClear
(
pSma
->
expr
);
taosMemoryFreeClear
(
pSma
->
tagsFilter
);
taosMemoryFreeClear
(
pSma
->
tagsFilter
);
}
}
}
}
static
FORCE_INLINE
void
t
d
DestroyTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
static
FORCE_INLINE
void
tDestroyTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
if
(
pSW
)
{
if
(
pSW
)
{
if
(
pSW
->
tSma
)
{
if
(
pSW
->
tSma
)
{
if
(
deepCopy
)
{
if
(
deepCopy
)
{
for
(
uint32_t
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
for
(
uint32_t
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
t
d
DestroyTSma
(
pSW
->
tSma
+
i
);
tDestroyTSma
(
pSW
->
tSma
+
i
);
}
}
}
}
taosMemoryFreeClear
(
pSW
->
tSma
);
taosMemoryFreeClear
(
pSW
->
tSma
);
...
@@ -2366,8 +2367,8 @@ static FORCE_INLINE void tdDestroyTSmaWrapper(STSmaWrapper* pSW, bool deepCopy)
...
@@ -2366,8 +2367,8 @@ static FORCE_INLINE void tdDestroyTSmaWrapper(STSmaWrapper* pSW, bool deepCopy)
}
}
}
}
static
FORCE_INLINE
void
*
t
d
FreeTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
static
FORCE_INLINE
void
*
tFreeTSmaWrapper
(
STSmaWrapper
*
pSW
,
bool
deepCopy
)
{
t
d
DestroyTSmaWrapper
(
pSW
,
deepCopy
);
tDestroyTSmaWrapper
(
pSW
,
deepCopy
);
taosMemoryFreeClear
(
pSW
);
taosMemoryFreeClear
(
pSW
);
return
NULL
;
return
NULL
;
}
}
...
...
include/common/tmsgcb.h
浏览文件 @
4b9ea626
...
@@ -38,7 +38,7 @@ typedef enum {
...
@@ -38,7 +38,7 @@ typedef enum {
QUEUE_MAX
,
QUEUE_MAX
,
}
EQueueType
;
}
EQueueType
;
typedef
int32_t
(
*
PutToQueueFp
)(
void
*
pMgmt
,
SRpcMsg
*
pMsg
);
typedef
int32_t
(
*
PutToQueueFp
)(
void
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
);
typedef
int32_t
(
*
GetQueueSizeFp
)(
void
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
);
typedef
int32_t
(
*
GetQueueSizeFp
)(
void
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
);
typedef
int32_t
(
*
SendReqFp
)(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
typedef
int32_t
(
*
SendReqFp
)(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
typedef
void
(
*
SendRspFp
)(
SRpcMsg
*
pMsg
);
typedef
void
(
*
SendRspFp
)(
SRpcMsg
*
pMsg
);
...
@@ -50,7 +50,7 @@ typedef void (*ReportStartup)(const char* name, const char* desc);
...
@@ -50,7 +50,7 @@ typedef void (*ReportStartup)(const char* name, const char* desc);
typedef
struct
{
typedef
struct
{
void
*
mgmt
;
void
*
mgmt
;
void
*
clientRpc
;
void
*
clientRpc
;
PutToQueueFp
queueFps
[
QUEUE_MAX
]
;
PutToQueueFp
putToQueueFp
;
GetQueueSizeFp
qsizeFp
;
GetQueueSizeFp
qsizeFp
;
SendReqFp
sendReqFp
;
SendReqFp
sendReqFp
;
SendRspFp
sendRspFp
;
SendRspFp
sendRspFp
;
...
...
include/common/tmsgdef.h
浏览文件 @
4b9ea626
...
@@ -70,106 +70,102 @@ enum {
...
@@ -70,106 +70,102 @@ enum {
// Requests handled by DNODE
// Requests handled by DNODE
TD_NEW_MSG_SEG
(
TDMT_DND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_DND_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_MNODE
,
"dnode-create-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_MNODE
,
"dnode-create-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_MNODE
,
"dnode-alter-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_MNODE
,
"dnode-drop-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_MNODE
,
"dnode-drop-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_QNODE
,
"dnode-create-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_QNODE
,
"dnode-create-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_QNODE
,
"dnode-alter-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_QNODE
,
"dnode-drop-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_QNODE
,
"dnode-drop-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_SNODE
,
"dnode-create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_SNODE
,
"dnode-create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_SNODE
,
"dnode-alter-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_SNODE
,
"dnode-drop-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_SNODE
,
"dnode-drop-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_BNODE
,
"dnode-create-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_BNODE
,
"dnode-create-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_BNODE
,
"dnode-alter-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_BNODE
,
"dnode-drop-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_BNODE
,
"dnode-drop-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_VNODE
,
"
dnode-
create-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CREATE_VNODE
,
"create-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_VNODE
,
"d
node-d
rop-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_VNODE
,
"drop-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
CONFIG_DNODE
,
"dnode-config-dnode
"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
SERVER_STATUS
,
"server-status
"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
SERVER_STATUS
,
"dnode-server-status
"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
NET_TEST
,
"net-test
"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
NET_TEST
,
"dnode-net-test
"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
CONFIG_DNODE
,
"config-dnode
"
,
NULL
,
NULL
)
// Requests handled by MNODE
// Requests handled by MNODE
TD_NEW_MSG_SEG
(
TDMT_MND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_MND_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CONNECT
,
"
mnode-
connect"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CONNECT
,
"connect"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_ACCT
,
"
mnode-
create-acct"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_ACCT
,
"create-acct"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_ACCT
,
"
mnode-
alter-acct"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_ACCT
,
"alter-acct"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_ACCT
,
"
mnode-
drop-acct"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_ACCT
,
"drop-acct"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_USER
,
"
mnode-
create-user"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_USER
,
"create-user"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_USER
,
"
mnode-
alter-user"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_USER
,
"alter-user"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_USER
,
"
mnode-
drop-user"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_USER
,
"drop-user"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_USER_AUTH
,
"
mnode-
get-user-auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_USER_AUTH
,
"get-user-auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_DNODE
,
"
mnode-
create-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_DNODE
,
"create-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CONFIG_DNODE
,
"
mnode-
config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CONFIG_DNODE
,
"config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_DNODE
,
"
mnode-
alter-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_DNODE
,
"alter-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_DNODE
,
"
mnode-
drop-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_DNODE
,
"drop-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_MNODE
,
"
mnode-
create-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_MNODE
,
"create-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_MNODE
,
"
mnode-
alter-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_MNODE
,
"alter-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_MNODE
,
"
mnode-
drop-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_MNODE
,
"drop-mnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_QNODE
,
"
mnode-
create-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_QNODE
,
"create-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_QNODE
,
"
mnode-
alter-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_QNODE
,
"alter-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_QNODE
,
"
mnode-
drop-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_QNODE
,
"drop-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_SNODE
,
"
mnode-
create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_SNODE
,
"create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_SNODE
,
"
mnode-
alter-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_SNODE
,
"alter-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_SNODE
,
"
mnode-
drop-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_SNODE
,
"drop-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_BNODE
,
"
mnode-
create-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_BNODE
,
"create-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_BNODE
,
"
mnode-
alter-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_BNODE
,
"alter-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_BNODE
,
"
mnode-
drop-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_BNODE
,
"drop-bnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_DB
,
"
mnode-
create-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_DB
,
"create-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_DB
,
"
mnode-
drop-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_DB
,
"drop-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_USE_DB
,
"
mnode-
use-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_USE_DB
,
"use-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_DB
,
"
mnode-
alter-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_DB
,
"alter-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYNC_DB
,
"
mnode-
sync-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYNC_DB
,
"sync-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_COMPACT_DB
,
"
mnode-
compact-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_COMPACT_DB
,
"compact-db"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_FUNC
,
"
mnode-
create-func"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_FUNC
,
"create-func"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_RETRIEVE_FUNC
,
"
mnode-
retrieve-func"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_RETRIEVE_FUNC
,
"retrieve-func"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_FUNC
,
"
mnode-
drop-func"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_FUNC
,
"drop-func"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STB
,
"
mnode-
create-stb"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STB
,
"create-stb"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_STB
,
"
mnode-
alter-stb"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_STB
,
"alter-stb"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_STB
,
"
mnode-
drop-stb"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_STB
,
"drop-stb"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_SMA
,
"
mnode-
create-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_SMA
,
"create-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_SMA
,
"
mnode-
drop-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_SMA
,
"drop-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TABLE_META
,
"
mnode-
table-meta"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TABLE_META
,
"table-meta"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_VGROUP_LIST
,
"
mnode-
vgroup-list"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_VGROUP_LIST
,
"vgroup-list"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_QNODE_LIST
,
"
mnode-
qnode-list"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_QNODE_LIST
,
"qnode-list"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_QUERY
,
"
mnode-
kill-query"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_QUERY
,
"kill-query"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_CONN
,
"
mnode-
kill-conn"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_CONN
,
"kill-conn"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_HEARTBEAT
,
"
mnode-
heartbeat"
,
SClientHbBatchReq
,
SClientHbBatchRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_HEARTBEAT
,
"heartbeat"
,
SClientHbBatchReq
,
SClientHbBatchRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW
,
"
mnode-
show"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW
,
"show"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYSTABLE_RETRIEVE
,
"
mnode-
systable-retrieve"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYSTABLE_RETRIEVE
,
"systable-retrieve"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_STATUS
,
"
mnode-
status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_STATUS
,
"status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS_TIMER
,
"
mnode-
trans-tmr"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TRANS_TIMER
,
"trans-tmr"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_TRANS
,
"
mnode-
kill-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_KILL_TRANS
,
"kill-trans"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TELEM_TIMER
,
"
mnode-
telem-tmr"
,
SMTimerReq
,
SMTimerReq
)
TD_DEF_MSG_TYPE
(
TDMT_MND_TELEM_TIMER
,
"telem-tmr"
,
SMTimerReq
,
SMTimerReq
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"
mnode-
grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"
mnode-
auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"
mnode-
create-topic"
,
SMCreateTopicReq
,
SMCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_TOPIC
,
"create-topic"
,
SMCreateTopicReq
,
SMCreateTopicRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_TOPIC
,
"
mnode-
alter-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_TOPIC
,
"alter-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_TOPIC
,
"
mnode-
drop-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_TOPIC
,
"drop-topic"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"
mnode-
subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SUBSCRIBE
,
"subscribe"
,
SCMSubscribeReq
,
SCMSubscribeRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_ASK_EP
,
"m
node-m
q-ask-ep"
,
SMqAskEpReq
,
SMqAskEpRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_ASK_EP
,
"mq-ask-ep"
,
SMqAskEpReq
,
SMqAskEpRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_TIMER
,
"m
node-m
q-tmr"
,
SMTimerReq
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_TIMER
,
"mq-tmr"
,
SMTimerReq
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_CONSUMER_LOST
,
"m
node-m
q-consumer-lost"
,
SMqConsumerLostMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_CONSUMER_LOST
,
"mq-consumer-lost"
,
SMqConsumerLostMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_CONSUMER_RECOVER
,
"m
node-m
q-consumer-recover"
,
SMqConsumerRecoverMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_CONSUMER_RECOVER
,
"mq-consumer-recover"
,
SMqConsumerRecoverMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DO_REBALANCE
,
"m
node-m
q-do-rebalance"
,
SMqDoRebalanceMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DO_REBALANCE
,
"mq-do-rebalance"
,
SMqDoRebalanceMsg
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DROP_CGROUP
,
"m
node-m
q-drop-cgroup"
,
SMqDropCGroupReq
,
SMqDropCGroupRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_DROP_CGROUP
,
"mq-drop-cgroup"
,
SMqDropCGroupReq
,
SMqDropCGroupRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_COMMIT_OFFSET
,
"m
node-m
q-commit-offset"
,
SMqCMCommitOffsetReq
,
SMqCMCommitOffsetRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_MQ_COMMIT_OFFSET
,
"mq-commit-offset"
,
SMqCMCommitOffsetReq
,
SMqCMCommitOffsetRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STREAM
,
"
mnode-
create-stream"
,
SCMCreateStreamReq
,
SCMCreateStreamRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_STREAM
,
"create-stream"
,
SCMCreateStreamReq
,
SCMCreateStreamRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_STREAM
,
"
mnode-
alter-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_STREAM
,
"alter-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_STREAM
,
"
mnode-
drop-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_STREAM
,
"drop-stream"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_INDEX
,
"
mnode-
create-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_INDEX
,
"create-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_INDEX
,
"
mnode-
drop-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_INDEX
,
"drop-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_DB_CFG
,
"
mnode-
get-db-cfg"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_DB_CFG
,
"get-db-cfg"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_INDEX
,
"
mnode-
get-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GET_INDEX
,
"get-index"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_APPLY_MSG
,
"
mnode-
apply-msg"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_APPLY_MSG
,
"apply-msg"
,
NULL
,
NULL
)
// Requests handled by VNODE
// Requests handled by VNODE
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_VND_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBMIT
,
"
vnode-
submit"
,
SSubmitReq
,
SSubmitRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SUBMIT
,
"submit"
,
SSubmitReq
,
SSubmitRsp
)
TD_DEF_MSG_TYPE
(
TDMT_VND_QUERY
,
"
vnode-
query"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_QUERY
,
"query"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_FETCH
,
"
vnode-
fetch"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_FETCH
,
"fetch"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CREATE_TABLE
,
"
vnode-
create-table"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CREATE_TABLE
,
"create-table"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_ALTER_TABLE
,
"
vnode-
alter-table"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_ALTER_TABLE
,
"alter-table"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_TABLE
,
"
vnode-
drop-table"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_TABLE
,
"drop-table"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_UPDATE_TAG_VAL
,
"
vnode-
update-tag-val"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_UPDATE_TAG_VAL
,
"update-tag-val"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TABLE_META
,
"vnode-table-meta"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TABLE_META
,
"vnode-table-meta"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TABLES_META
,
"vnode-tables-meta"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_TABLES_META
,
"vnode-tables-meta"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CREATE_STB
,
"vnode-create-stb"
,
SVCreateStbReq
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CREATE_STB
,
"vnode-create-stb"
,
SVCreateStbReq
,
NULL
)
...
...
include/common/ttypes.h
浏览文件 @
4b9ea626
...
@@ -30,7 +30,7 @@ typedef uint64_t TDRowVerT;
...
@@ -30,7 +30,7 @@ typedef uint64_t TDRowVerT;
typedef
int16_t
col_id_t
;
typedef
int16_t
col_id_t
;
typedef
int8_t
col_type_t
;
typedef
int8_t
col_type_t
;
typedef
int32_t
col_bytes_t
;
typedef
int32_t
col_bytes_t
;
typedef
int32_t
schema_ver_t
;
typedef
int32_t
schema_ver_t
;
typedef
int32_t
func_id_t
;
typedef
int32_t
func_id_t
;
#pragma pack(push, 1)
#pragma pack(push, 1)
...
@@ -49,8 +49,9 @@ typedef struct {
...
@@ -49,8 +49,9 @@ typedef struct {
#define varDataCopy(dst, v) memcpy((dst), (void *)(v), varDataTLen(v))
#define varDataCopy(dst, v) memcpy((dst), (void *)(v), varDataTLen(v))
#define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE))
#define varDataLenByData(v) (*(VarDataLenT *)(((char *)(v)) - VARSTR_HEADER_SIZE))
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len))
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT)(_len))
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON))
#define IS_VAR_DATA_TYPE(t) \
#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR))
(((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR) || ((t) == TSDB_DATA_TYPE_JSON))
#define IS_STR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_VARCHAR) || ((t) == TSDB_DATA_TYPE_NCHAR))
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
#define varDataNetLen(v) (htons(((VarDataLenT *)(v))[0]))
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
#define varDataNetTLen(v) (sizeof(VarDataLenT) + varDataNetLen(v))
...
@@ -142,52 +143,56 @@ typedef struct {
...
@@ -142,52 +143,56 @@ typedef struct {
} \
} \
} while (0)
} while (0)
#define NUM_TO_STRING(_inputType, _input, _outputBytes, _output) \
#define NUM_TO_STRING(_inputType, _input, _outputBytes, _output)
\
do { \
do {
\
switch (_inputType) { \
switch (_inputType) {
\
case TSDB_DATA_TYPE_TINYINT: \
case TSDB_DATA_TYPE_TINYINT:
\
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int8_t *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int8_t *)(_input));
\
break; \
break;
\
case TSDB_DATA_TYPE_UTINYINT: \
case TSDB_DATA_TYPE_UTINYINT:
\
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint8_t *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint8_t *)(_input));
\
break; \
break;
\
case TSDB_DATA_TYPE_SMALLINT: \
case TSDB_DATA_TYPE_SMALLINT:
\
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int16_t *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int16_t *)(_input));
\
break; \
break;
\
case TSDB_DATA_TYPE_USMALLINT: \
case TSDB_DATA_TYPE_USMALLINT:
\
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint16_t *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(uint16_t *)(_input));
\
break; \
break;
\
case TSDB_DATA_TYPE_TIMESTAMP: \
case TSDB_DATA_TYPE_TIMESTAMP:
\
case TSDB_DATA_TYPE_BIGINT: \
case TSDB_DATA_TYPE_BIGINT:
\
snprintf(_output, (int32_t)(_outputBytes), "%" PRId64, *(int64_t *)(_input));
\
snprintf(_output, (int32_t)(_outputBytes), "%" PRId64, *(int64_t *)(_input)); \
break; \
break;
\
case TSDB_DATA_TYPE_UBIGINT: \
case TSDB_DATA_TYPE_UBIGINT:
\
snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input));
\
snprintf(_output, (int32_t)(_outputBytes), "%" PRIu64, *(uint64_t *)(_input)); \
break; \
break;
\
case TSDB_DATA_TYPE_FLOAT: \
case TSDB_DATA_TYPE_FLOAT:
\
snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%f", *(float *)(_input));
\
break; \
break;
\
case TSDB_DATA_TYPE_DOUBLE: \
case TSDB_DATA_TYPE_DOUBLE:
\
snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%f", *(double *)(_input));
\
break; \
break;
\
case TSDB_DATA_TYPE_UINT: \
case TSDB_DATA_TYPE_UINT:
\
snprintf(_output, (int32_t)(_outputBytes), "%u", *(uint32_t *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%u", *(uint32_t *)(_input));
\
break; \
break;
\
default: \
default:
\
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int32_t *)(_input)); \
snprintf(_output, (int32_t)(_outputBytes), "%d", *(int32_t *)(_input));
\
break; \
break;
\
} \
}
\
} while (0)
} while (0)
//TODO: use varchar(0) to represent NULL type
//TODO: use varchar(0) to represent NULL type
#define IS_VAR_NULL_TYPE(_t, _b) ((_t) == TSDB_DATA_TYPE_VARCHAR && (_b) == 0)
#define IS_NULL_TYPE(_t) ((_t) == TSDB_DATA_TYPE_NULL)
#define IS_NULL_TYPE(_t) ((_t) == TSDB_DATA_TYPE_NULL)
#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
#define IS_SIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_TINYINT && (_t) <= TSDB_DATA_TYPE_BIGINT)
#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
#define IS_UNSIGNED_NUMERIC_TYPE(_t) ((_t) >= TSDB_DATA_TYPE_UTINYINT && (_t) <= TSDB_DATA_TYPE_UBIGINT)
#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE)
#define IS_FLOAT_TYPE(_t) ((_t) == TSDB_DATA_TYPE_FLOAT || (_t) == TSDB_DATA_TYPE_DOUBLE)
#define IS_INTEGER_TYPE(_t) ((IS_SIGNED_NUMERIC_TYPE(_t)) || (IS_UNSIGNED_NUMERIC_TYPE(_t)))
#define IS_INTEGER_TYPE(_t) ((IS_SIGNED_NUMERIC_TYPE(_t)) || (IS_UNSIGNED_NUMERIC_TYPE(_t)))
#define IS_NUMERIC_TYPE(_t) ((IS_SIGNED_NUMERIC_TYPE(_t)) || (IS_UNSIGNED_NUMERIC_TYPE(_t)) || (IS_FLOAT_TYPE(_t)))
#define IS_NUMERIC_TYPE(_t) ((IS_SIGNED_NUMERIC_TYPE(_t)) || (IS_UNSIGNED_NUMERIC_TYPE(_t)) || (IS_FLOAT_TYPE(_t)))
#define IS_MATHABLE_TYPE(_t) (IS_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP))
#define IS_MATHABLE_TYPE(_t) \
(IS_NUMERIC_TYPE(_t) || (_t) == (TSDB_DATA_TYPE_BOOL) || (_t) == (TSDB_DATA_TYPE_TIMESTAMP))
#define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX)
#define IS_VALID_TINYINT(_t) ((_t) >= INT8_MIN && (_t) <= INT8_MAX)
#define IS_VALID_SMALLINT(_t) ((_t) >= INT16_MIN && (_t) <= INT16_MAX)
#define IS_VALID_SMALLINT(_t) ((_t) >= INT16_MIN && (_t) <= INT16_MAX)
...
@@ -244,7 +249,7 @@ typedef struct tDataTypeDescriptor {
...
@@ -244,7 +249,7 @@ typedef struct tDataTypeDescriptor {
int16_t
type
;
int16_t
type
;
int16_t
nameLen
;
int16_t
nameLen
;
int32_t
bytes
;
int32_t
bytes
;
char
*
name
;
char
*
name
;
int64_t
minValue
;
int64_t
minValue
;
int64_t
maxValue
;
int64_t
maxValue
;
int32_t
(
*
compFunc
)(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
int32_t
(
*
compFunc
)(
const
char
*
const
input
,
int32_t
inputSize
,
const
int32_t
nelements
,
char
*
const
output
,
...
@@ -277,4 +282,4 @@ void *getDataMax(int32_t type);
...
@@ -277,4 +282,4 @@ void *getDataMax(int32_t type);
}
}
#endif
#endif
#endif
/*_TD_COMMON_TTYPE_H_*/
#endif
/*_TD_COMMON_TTYPE_H_*/
include/libs/nodes/nodes.h
浏览文件 @
4b9ea626
...
@@ -212,6 +212,7 @@ typedef enum ENodeType {
...
@@ -212,6 +212,7 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_FINAL_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL
,
QUERY_NODE_PHYSICAL_PLAN_FILL
,
QUERY_NODE_PHYSICAL_PLAN_FILL
,
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
,
QUERY_NODE_PHYSICAL_PLAN_SESSION_WINDOW
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION_WINDOW
,
QUERY_NODE_PHYSICAL_PLAN_STREAM_SESSION_WINDOW
,
...
...
include/libs/nodes/plannodes.h
浏览文件 @
4b9ea626
...
@@ -106,21 +106,28 @@ typedef struct SMergeLogicNode {
...
@@ -106,21 +106,28 @@ typedef struct SMergeLogicNode {
typedef
enum
EWindowType
{
WINDOW_TYPE_INTERVAL
=
1
,
WINDOW_TYPE_SESSION
,
WINDOW_TYPE_STATE
}
EWindowType
;
typedef
enum
EWindowType
{
WINDOW_TYPE_INTERVAL
=
1
,
WINDOW_TYPE_SESSION
,
WINDOW_TYPE_STATE
}
EWindowType
;
typedef
enum
EStreamIntervalAlgorithm
{
STREAM_INTERVAL_ALGO_FINAL
=
1
,
STREAM_INTERVAL_ALGO_SEMI
,
STREAM_INTERVAL_ALGO_SINGLE
}
EStreamIntervalAlgorithm
;
typedef
struct
SWindowLogicNode
{
typedef
struct
SWindowLogicNode
{
SLogicNode
node
;
SLogicNode
node
;
EWindowType
winType
;
EWindowType
winType
;
SNodeList
*
pFuncs
;
SNodeList
*
pFuncs
;
int64_t
interval
;
int64_t
interval
;
int64_t
offset
;
int64_t
offset
;
int64_t
sliding
;
int64_t
sliding
;
int8_t
intervalUnit
;
int8_t
intervalUnit
;
int8_t
slidingUnit
;
int8_t
slidingUnit
;
int64_t
sessionGap
;
int64_t
sessionGap
;
SNode
*
pTspk
;
SNode
*
pTspk
;
SNode
*
pStateExpr
;
SNode
*
pStateExpr
;
int8_t
triggerType
;
int8_t
triggerType
;
int64_t
watermark
;
int64_t
watermark
;
double
filesFactor
;
double
filesFactor
;
EStreamIntervalAlgorithm
stmInterAlgo
;
}
SWindowLogicNode
;
}
SWindowLogicNode
;
typedef
struct
SFillLogicNode
{
typedef
struct
SFillLogicNode
{
...
@@ -301,6 +308,8 @@ typedef struct SIntervalPhysiNode {
...
@@ -301,6 +308,8 @@ typedef struct SIntervalPhysiNode {
}
SIntervalPhysiNode
;
}
SIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamFinalIntervalPhysiNode
;
typedef
SIntervalPhysiNode
SStreamSemiIntervalPhysiNode
;
typedef
struct
SFillPhysiNode
{
typedef
struct
SFillPhysiNode
{
SPhysiNode
node
;
SPhysiNode
node
;
...
...
include/libs/parser/parser.h
浏览文件 @
4b9ea626
...
@@ -49,6 +49,7 @@ typedef struct SParseContext {
...
@@ -49,6 +49,7 @@ typedef struct SParseContext {
const
char
*
pUser
;
const
char
*
pUser
;
bool
isSuperUser
;
bool
isSuperUser
;
bool
async
;
bool
async
;
int8_t
schemalessType
;
}
SParseContext
;
}
SParseContext
;
int32_t
qParseSql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
int32_t
qParseSql
(
SParseContext
*
pCxt
,
SQuery
**
pQuery
);
...
...
include/libs/planner/planner.h
浏览文件 @
4b9ea626
...
@@ -36,7 +36,7 @@ typedef struct SPlanContext {
...
@@ -36,7 +36,7 @@ typedef struct SPlanContext {
int64_t
watermark
;
int64_t
watermark
;
char
*
pMsg
;
char
*
pMsg
;
int32_t
msgLen
;
int32_t
msgLen
;
double
filesFactor
;
double
filesFactor
;
}
SPlanContext
;
}
SPlanContext
;
// Create the physical plan for the query, according to the AST.
// Create the physical plan for the query, according to the AST.
...
...
include/util/taoserror.h
浏览文件 @
4b9ea626
...
@@ -675,6 +675,7 @@ int32_t* taosGetErrno();
...
@@ -675,6 +675,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SML_INVALID_PROTOCOL_TYPE TAOS_DEF_ERROR_CODE(0, 0x3000)
#define TSDB_CODE_SML_INVALID_PROTOCOL_TYPE TAOS_DEF_ERROR_CODE(0, 0x3000)
#define TSDB_CODE_SML_INVALID_PRECISION_TYPE TAOS_DEF_ERROR_CODE(0, 0x3001)
#define TSDB_CODE_SML_INVALID_PRECISION_TYPE TAOS_DEF_ERROR_CODE(0, 0x3001)
#define TSDB_CODE_SML_INVALID_DATA TAOS_DEF_ERROR_CODE(0, 0x3002)
#define TSDB_CODE_SML_INVALID_DATA TAOS_DEF_ERROR_CODE(0, 0x3002)
#define TSDB_CODE_SML_INVALID_DB_CONF TAOS_DEF_ERROR_CODE(0, 0x3003)
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/client/inc/clientInt.h
浏览文件 @
4b9ea626
...
@@ -153,6 +153,7 @@ typedef struct STscObj {
...
@@ -153,6 +153,7 @@ typedef struct STscObj {
int32_t
numOfReqs
;
// number of sqlObj bound to this connection
int32_t
numOfReqs
;
// number of sqlObj bound to this connection
SAppInstInfo
*
pAppInfo
;
SAppInstInfo
*
pAppInfo
;
SHashObj
*
pRequests
;
SHashObj
*
pRequests
;
int8_t
schemalessType
;
}
STscObj
;
}
STscObj
;
typedef
struct
SResultColumn
{
typedef
struct
SResultColumn
{
...
...
source/client/src/clientEnv.c
浏览文件 @
4b9ea626
...
@@ -162,6 +162,7 @@ void *createTscObj(const char *user, const char *auth, const char *db, int32_t c
...
@@ -162,6 +162,7 @@ void *createTscObj(const char *user, const char *auth, const char *db, int32_t c
taosThreadMutexInit
(
&
pObj
->
mutex
,
NULL
);
taosThreadMutexInit
(
&
pObj
->
mutex
,
NULL
);
pObj
->
id
=
taosAddRef
(
clientConnRefPool
,
pObj
);
pObj
->
id
=
taosAddRef
(
clientConnRefPool
,
pObj
);
pObj
->
schemalessType
=
0
;
tscDebug
(
"connObj created, 0x%"
PRIx64
,
pObj
->
id
);
tscDebug
(
"connObj created, 0x%"
PRIx64
,
pObj
->
id
);
return
pObj
;
return
pObj
;
...
...
source/client/src/clientImpl.c
浏览文件 @
4b9ea626
...
@@ -176,6 +176,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
...
@@ -176,6 +176,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pStmtCb
=
pStmtCb
,
.
pStmtCb
=
pStmtCb
,
.
pUser
=
pTscObj
->
user
,
.
pUser
=
pTscObj
->
user
,
.
schemalessType
=
pTscObj
->
schemalessType
,
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
))};
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
))};
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
...
@@ -1003,7 +1004,7 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
...
@@ -1003,7 +1004,7 @@ void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
int32_t
bytes
=
pResultInfo
->
fields
[
i
].
bytes
;
int32_t
bytes
=
pResultInfo
->
fields
[
i
].
bytes
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
pCol
->
offset
[
pResultInfo
->
current
]
!=
-
1
)
{
if
(
!
IS_VAR_NULL_TYPE
(
type
,
bytes
)
&&
pCol
->
offset
[
pResultInfo
->
current
]
!=
-
1
)
{
char
*
pStart
=
pResultInfo
->
pCol
[
i
].
offset
[
pResultInfo
->
current
]
+
pResultInfo
->
pCol
[
i
].
pData
;
char
*
pStart
=
pResultInfo
->
pCol
[
i
].
offset
[
pResultInfo
->
current
]
+
pResultInfo
->
pCol
[
i
].
pData
;
pResultInfo
->
length
[
i
]
=
varDataLen
(
pStart
);
pResultInfo
->
length
[
i
]
=
varDataLen
(
pStart
);
...
...
source/client/src/clientSml.c
浏览文件 @
4b9ea626
...
@@ -1124,7 +1124,7 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable
...
@@ -1124,7 +1124,7 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable
}
}
static
int32_t
smlParseCols
(
const
char
*
data
,
int32_t
len
,
SArray
*
cols
,
char
*
childTableName
,
bool
isTag
,
SHashObj
*
dumplicateKey
,
SSmlMsgBuf
*
msg
){
static
int32_t
smlParseCols
(
const
char
*
data
,
int32_t
len
,
SArray
*
cols
,
char
*
childTableName
,
bool
isTag
,
SHashObj
*
dumplicateKey
,
SSmlMsgBuf
*
msg
){
if
(
isTag
&&
len
==
0
){
if
(
len
==
0
){
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -2318,6 +2318,28 @@ cleanup:
...
@@ -2318,6 +2318,28 @@ cleanup:
return
code
;
return
code
;
}
}
static
int32_t
isSchemalessDb
(
SSmlHandle
*
info
){
SName
name
;
tNameSetDbName
(
&
name
,
info
->
taos
->
acctId
,
info
->
taos
->
db
,
strlen
(
info
->
taos
->
db
));
char
dbFname
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbFname
);
SDbCfgInfo
pInfo
=
{
0
};
SEpSet
ep
=
getEpSet_s
(
&
info
->
taos
->
pAppInfo
->
mgmtEp
);
int32_t
code
=
catalogGetDBCfg
(
info
->
pCatalog
,
info
->
taos
->
pAppInfo
->
pTransporter
,
&
ep
,
dbFname
,
&
pInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
info
->
pRequest
->
code
=
code
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"catalogGetDBCfg error, code:"
,
tstrerror
(
code
));
return
code
;
}
if
(
!
pInfo
.
schemaless
){
info
->
pRequest
->
code
=
TSDB_CODE_SML_INVALID_DB_CONF
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"can not insert into schemaless db:"
,
dbFname
);
return
TSDB_CODE_SML_INVALID_DB_CONF
;
}
return
TSDB_CODE_SUCCESS
;
}
/**
/**
* taos_schemaless_insert() parse and insert data points into database according to
* taos_schemaless_insert() parse and insert data points into database according to
* different protocol.
* different protocol.
...
@@ -2351,6 +2373,19 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
...
@@ -2351,6 +2373,19 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
return
(
TAOS_RES
*
)
request
;
return
(
TAOS_RES
*
)
request
;
}
}
info
->
taos
->
schemalessType
=
1
;
if
(
request
->
pDb
==
NULL
){
request
->
code
=
TSDB_CODE_PAR_DB_NOT_SPECIFIED
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"Database not specified"
,
NULL
);
goto
end
;
}
if
(
isSchemalessDb
(
info
)
!=
TSDB_CODE_SUCCESS
){
request
->
code
=
TSDB_CODE_SML_INVALID_DB_CONF
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"Cannot write data to a non schemaless database"
,
NULL
);
goto
end
;
}
if
(
!
lines
)
{
if
(
!
lines
)
{
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
request
->
code
=
TSDB_CODE_SML_INVALID_DATA
;
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"lines is null"
,
NULL
);
smlBuildInvalidDataMsg
(
&
info
->
msgBuf
,
"lines is null"
,
NULL
);
...
@@ -2372,6 +2407,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
...
@@ -2372,6 +2407,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
info
->
pRequest
->
code
=
smlProcess
(
info
,
lines
,
numLines
);
info
->
pRequest
->
code
=
smlProcess
(
info
,
lines
,
numLines
);
end:
end:
uDebug
(
"result:%s"
,
info
->
msgBuf
.
buf
);
smlDestroyInfo
(
info
);
smlDestroyInfo
(
info
);
return
(
TAOS_RES
*
)
request
;
return
(
TAOS_RES
*
)
request
;
}
}
...
...
source/client/test/smlTest.cpp
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/common/src/systable.c
浏览文件 @
4b9ea626
...
@@ -91,6 +91,8 @@ static const SSysDbTableSchema userDBSchema[] = {
...
@@ -91,6 +91,8 @@ static const SSysDbTableSchema userDBSchema[] = {
{.
name
=
"precision"
,
.
bytes
=
2
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"precision"
,
.
bytes
=
2
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"single_stable"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"single_stable"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"status"
,
.
bytes
=
10
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"schemaless"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
// {.name = "update", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, // disable update
};
};
...
...
source/common/src/tdataformat.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/common/src/tmsg.c
浏览文件 @
4b9ea626
...
@@ -2278,6 +2278,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
...
@@ -2278,6 +2278,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
freqUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
freqUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
keepUnit
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRetension
->
keepUnit
)
<
0
)
return
-
1
;
}
}
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
schemaless
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -2326,6 +2327,7 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
...
@@ -2326,6 +2327,7 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
return
-
1
;
return
-
1
;
}
}
}
}
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
schemaless
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
tDecoderClear
(
&
decoder
);
...
...
source/common/src/tmsgcb.c
浏览文件 @
4b9ea626
...
@@ -22,41 +22,21 @@ static SMsgCb defaultMsgCb;
...
@@ -22,41 +22,21 @@ static SMsgCb defaultMsgCb;
void
tmsgSetDefault
(
const
SMsgCb
*
msgcb
)
{
defaultMsgCb
=
*
msgcb
;
}
void
tmsgSetDefault
(
const
SMsgCb
*
msgcb
)
{
defaultMsgCb
=
*
msgcb
;
}
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
msgcb
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
)
{
int32_t
tmsgPutToQueue
(
const
SMsgCb
*
msgcb
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
)
{
PutToQueueFp
fp
=
msgcb
->
queueFps
[
qtype
];
return
(
*
msgcb
->
putToQueueFp
)(
msgcb
->
mgmt
,
qtype
,
pMsg
);
return
(
*
fp
)(
msgcb
->
mgmt
,
pMsg
);
}
}
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
msgcb
,
int32_t
vgId
,
EQueueType
qtype
)
{
int32_t
tmsgGetQueueSize
(
const
SMsgCb
*
msgcb
,
int32_t
vgId
,
EQueueType
qtype
)
{
GetQueueSizeFp
fp
=
msgcb
->
qsizeFp
;
return
(
*
msgcb
->
qsizeFp
)(
msgcb
->
mgmt
,
vgId
,
qtype
);
return
(
*
fp
)(
msgcb
->
mgmt
,
vgId
,
qtype
);
}
}
int32_t
tmsgSendReq
(
const
SEpSet
*
epSet
,
SRpcMsg
*
pMsg
)
{
int32_t
tmsgSendReq
(
const
SEpSet
*
epSet
,
SRpcMsg
*
pMsg
)
{
return
(
*
defaultMsgCb
.
sendReqFp
)(
epSet
,
pMsg
);
}
SendReqFp
fp
=
defaultMsgCb
.
sendReqFp
;
return
(
*
fp
)(
epSet
,
pMsg
);
}
void
tmsgSendRsp
(
SRpcMsg
*
pMsg
)
{
void
tmsgSendRsp
(
SRpcMsg
*
pMsg
)
{
return
(
*
defaultMsgCb
.
sendRspFp
)(
pMsg
);
}
SendRspFp
fp
=
defaultMsgCb
.
sendRspFp
;
return
(
*
fp
)(
pMsg
);
}
void
tmsgSendRedirectRsp
(
SRpcMsg
*
pMsg
,
const
SEpSet
*
pNewEpSet
)
{
void
tmsgSendRedirectRsp
(
SRpcMsg
*
pMsg
,
const
SEpSet
*
pNewEpSet
)
{
(
*
defaultMsgCb
.
sendRedirectRspFp
)(
pMsg
,
pNewEpSet
);
}
SendRedirectRspFp
fp
=
defaultMsgCb
.
sendRedirectRspFp
;
(
*
fp
)(
pMsg
,
pNewEpSet
);
}
void
tmsgRegisterBrokenLinkArg
(
SRpcMsg
*
pMsg
)
{
void
tmsgRegisterBrokenLinkArg
(
SRpcMsg
*
pMsg
)
{
(
*
defaultMsgCb
.
registerBrokenLinkArgFp
)(
pMsg
);
}
RegisterBrokenLinkArgFp
fp
=
defaultMsgCb
.
registerBrokenLinkArgFp
;
(
*
fp
)(
pMsg
);
}
void
tmsgReleaseHandle
(
SRpcHandleInfo
*
pHandle
,
int8_t
type
)
{
void
tmsgReleaseHandle
(
SRpcHandleInfo
*
pHandle
,
int8_t
type
)
{
(
*
defaultMsgCb
.
releaseHandleFp
)(
pHandle
,
type
);
}
ReleaseHandleFp
fp
=
defaultMsgCb
.
releaseHandleFp
;
(
*
fp
)(
pHandle
,
type
);
}
void
tmsgReportStartup
(
const
char
*
name
,
const
char
*
desc
)
{
void
tmsgReportStartup
(
const
char
*
name
,
const
char
*
desc
)
{
(
*
defaultMsgCb
.
reportStartupFp
)(
name
,
desc
);
}
ReportStartup
fp
=
defaultMsgCb
.
reportStartupFp
;
\ No newline at end of file
(
*
fp
)(
name
,
desc
);
}
\ No newline at end of file
source/dnode/mgmt/exe/dmMain.c
浏览文件 @
4b9ea626
...
@@ -216,7 +216,7 @@ int main(int argc, char const *argv[]) {
...
@@ -216,7 +216,7 @@ int main(int argc, char const *argv[]) {
return
-
1
;
return
-
1
;
}
}
dInfo
(
"start to
ru
n dnode"
);
dInfo
(
"start to
ope
n dnode"
);
dmSetSignalHandle
();
dmSetSignalHandle
();
int32_t
code
=
dmRun
();
int32_t
code
=
dmRun
();
dInfo
(
"shutting down the service"
);
dInfo
(
"shutting down the service"
);
...
...
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
浏览文件 @
4b9ea626
...
@@ -65,10 +65,7 @@ int32_t mmPutNodeMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg);
...
@@ -65,10 +65,7 @@ int32_t mmPutNodeMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t
mmPutNodeMsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutNodeMsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutNodeMsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutNodeMsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutNodeMsgToMonitorQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutNodeMsgToMonitorQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutRpcMsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutRpcMsgToQueue
(
SMnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
);
int32_t
mmPutRpcMsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutRpcMsgToWriteQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
mmPutRpcMsgToSyncQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
4b9ea626
...
@@ -134,7 +134,7 @@ SArray *mmGetMsgHandles() {
...
@@ -134,7 +134,7 @@ SArray *mmGetMsgHandles() {
// Requests handled by DNODE
// Requests handled by DNODE
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_MNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_MNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_
D
ND_ALTER_MNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_
M
ND_ALTER_MNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_MNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_MNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_QNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_QNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_QNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_QNODE_RSP
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
@@ -190,7 +190,7 @@ SArray *mmGetMsgHandles() {
...
@@ -190,7 +190,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_KILL_TRANS
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_KILL_TRANS
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_AUTH
,
mmPutNodeMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_AUTH
,
mmPutNodeMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_
D
ND_ALTER_MNODE
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_
M
ND_ALTER_MNODE
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_TOPIC
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_TOPIC
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_ALTER_TOPIC
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_ALTER_TOPIC
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_TOPIC
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_TOPIC
,
mmPutNodeMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
浏览文件 @
4b9ea626
...
@@ -105,10 +105,7 @@ static int32_t mmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
...
@@ -105,10 +105,7 @@ static int32_t mmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
.
queueFps
[
QUERY_QUEUE
]
=
(
PutToQueueFp
)
mmPutRpcMsgToQueryQueue
;
pMgmt
->
msgCb
.
putToQueueFp
=
(
PutToQueueFp
)
mmPutRpcMsgToQueue
;
pMgmt
->
msgCb
.
queueFps
[
READ_QUEUE
]
=
(
PutToQueueFp
)
mmPutRpcMsgToReadQueue
;
pMgmt
->
msgCb
.
queueFps
[
WRITE_QUEUE
]
=
(
PutToQueueFp
)
mmPutRpcMsgToWriteQueue
;
pMgmt
->
msgCb
.
queueFps
[
SYNC_QUEUE
]
=
(
PutToQueueFp
)
mmPutRpcMsgToSyncQueue
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
taosThreadRwlockInit
(
&
pMgmt
->
lock
,
NULL
);
taosThreadRwlockInit
(
&
pMgmt
->
lock
,
NULL
);
...
...
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
浏览文件 @
4b9ea626
...
@@ -96,40 +96,38 @@ int32_t mmPutNodeMsgToMonitorQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -96,40 +96,38 @@ int32_t mmPutNodeMsgToMonitorQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
mmPutNodeMsgToWorker
(
&
pMgmt
->
monitorWorker
,
pMsg
);
return
mmPutNodeMsgToWorker
(
&
pMgmt
->
monitorWorker
,
pMsg
);
}
}
static
inline
int32_t
mmPutRpcMsgToWorker
(
SSingleWorker
*
pWorker
,
SRpcMsg
*
pRpc
)
{
int32_t
mmPutRpcMsgToQueue
(
SMnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
)
{
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
if
(
pMsg
==
NULL
)
return
-
1
;
if
(
pMsg
==
NULL
)
return
-
1
;
dTrace
(
"msg:%p, create and put into worker:%s, type:%s"
,
pMsg
,
pWorker
->
name
,
TMSG_INFO
(
pRpc
->
msgType
));
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
int32_t
mmPutRpcMsgToQueryQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
switch
(
qtype
)
{
return
mmPutRpcMsgToWorker
(
&
pMgmt
->
queryWorker
,
pMsg
);
case
WRITE_QUEUE
:
}
dTrace
(
"msg:%p, is created and will put into vnode-write queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
writeWorker
.
queue
,
pMsg
);
int32_t
mmPutRpcMsgToWriteQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
0
;
return
mmPutRpcMsgToWorker
(
&
pMgmt
->
writeWorker
,
pMsg
);
case
QUERY_QUEUE
:
}
dTrace
(
"msg:%p, is created and will put into vnode-query queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
queryWorker
.
queue
,
pMsg
);
int32_t
mmPutRpcMsgToReadQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
0
;
return
mmPutRpcMsgToWorker
(
&
pMgmt
->
readWorker
,
pMsg
);
}
case
READ_QUEUE
:
dTrace
(
"msg:%p, is created and will put into vnode-read queue"
,
pMsg
);
int32_t
mmPutRpcMsgToSyncQueue
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
taosWriteQitem
(
pMgmt
->
readWorker
.
queue
,
pMsg
);
int32_t
code
=
-
1
;
return
0
;
if
(
mmAcquire
(
pMgmt
)
==
0
)
{
case
SYNC_QUEUE
:
code
=
mmPutRpcMsgToWorker
(
&
pMgmt
->
syncWorker
,
pMsg
);
if
(
mmAcquire
(
pMgmt
)
==
0
)
{
mmRelease
(
pMgmt
);
dTrace
(
"msg:%p, is created and will put into vnode-sync queue"
,
pMsg
);
}
taosWriteQitem
(
pMgmt
->
syncWorker
.
queue
,
pMsg
);
mmRelease
(
pMgmt
);
if
(
code
!=
0
)
{
return
0
;
rpcFreeCont
(
pMsg
->
pCont
);
}
else
{
pMsg
->
pCont
=
NULL
;
return
-
1
;
}
default:
terrno
=
TSDB_CODE_INVALID_PARA
;
return
-
1
;
}
}
return
code
;
}
}
int32_t
mmStartWorker
(
SMnodeMgmt
*
pMgmt
)
{
int32_t
mmStartWorker
(
SMnodeMgmt
*
pMgmt
)
{
...
...
source/dnode/mgmt/mgmt_qnode/inc/qmInt.h
浏览文件 @
4b9ea626
...
@@ -42,8 +42,7 @@ int32_t qmProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg);
...
@@ -42,8 +42,7 @@ int32_t qmProcessDropReq(const SMgmtInputOpt *pInput, SRpcMsg *pMsg);
int32_t
qmProcessGetMonitorInfoReq
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
qmProcessGetMonitorInfoReq
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
// qmWorker.c
// qmWorker.c
int32_t
qmPutRpcMsgToQueryQueue
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
qmPutRpcMsgToQueue
(
SQnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pMsg
);
int32_t
qmPutRpcMsgToFetchQueue
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
qmGetQueueSize
(
SQnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
);
int32_t
qmGetQueueSize
(
SQnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
);
int32_t
qmStartWorker
(
SQnodeMgmt
*
pMgmt
);
int32_t
qmStartWorker
(
SQnodeMgmt
*
pMgmt
);
...
...
source/dnode/mgmt/mgmt_qnode/src/qmInt.c
浏览文件 @
4b9ea626
...
@@ -43,8 +43,7 @@ static int32_t qmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
...
@@ -43,8 +43,7 @@ static int32_t qmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
.
queueFps
[
QUERY_QUEUE
]
=
(
PutToQueueFp
)
qmPutRpcMsgToQueryQueue
;
pMgmt
->
msgCb
.
putToQueueFp
=
(
PutToQueueFp
)
qmPutRpcMsgToQueue
;
pMgmt
->
msgCb
.
queueFps
[
FETCH_QUEUE
]
=
(
PutToQueueFp
)
qmPutRpcMsgToFetchQueue
;
pMgmt
->
msgCb
.
qsizeFp
=
(
GetQueueSizeFp
)
qmGetQueueSize
;
pMgmt
->
msgCb
.
qsizeFp
=
(
GetQueueSizeFp
)
qmGetQueueSize
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
...
...
source/dnode/mgmt/mgmt_qnode/src/qmWorker.c
浏览文件 @
4b9ea626
...
@@ -68,22 +68,24 @@ int32_t qmPutNodeMsgToMonitorQueue(SQnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -68,22 +68,24 @@ int32_t qmPutNodeMsgToMonitorQueue(SQnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
qmPutNodeMsgToWorker
(
&
pMgmt
->
monitorWorker
,
pMsg
);
return
qmPutNodeMsgToWorker
(
&
pMgmt
->
monitorWorker
,
pMsg
);
}
}
static
int32_t
qmPutRpcMsgToWorker
(
SQnodeMgmt
*
pMgmt
,
SSingleWorker
*
pWorker
,
SRpcMsg
*
pRpc
)
{
int32_t
qmPutRpcMsgToQueue
(
SQnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
)
{
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
if
(
pMsg
==
NULL
)
return
-
1
;
if
(
pMsg
==
NULL
)
return
-
1
;
dTrace
(
"msg:%p, create and put into worker:%s, type:%s"
,
pMsg
,
pWorker
->
name
,
TMSG_INFO
(
pRpc
->
msgType
));
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
}
int32_t
qmPutRpcMsgToQueryQueue
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
return
qmPutRpcMsgToWorker
(
pMgmt
,
&
pMgmt
->
queryWorker
,
pRpc
);
}
int32_t
qmPutRpcMsgToFetchQueue
(
SQnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
switch
(
qtype
)
{
return
qmPutRpcMsgToWorker
(
pMgmt
,
&
pMgmt
->
fetchWorker
,
pRpc
);
case
QUERY_QUEUE
:
dTrace
(
"msg:%p, is created and will put into qnode-query queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
queryWorker
.
queue
,
pMsg
);
return
0
;
case
READ_QUEUE
:
dTrace
(
"msg:%p, is created and will put into qnode-fetch queue"
,
pMsg
);
taosWriteQitem
(
pMgmt
->
fetchWorker
.
queue
,
pMsg
);
return
0
;
default:
terrno
=
TSDB_CODE_INVALID_PARA
;
return
-
1
;
}
}
}
int32_t
qmGetQueueSize
(
SQnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
)
{
int32_t
qmGetQueueSize
(
SQnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
)
{
...
...
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
浏览文件 @
4b9ea626
...
@@ -44,26 +44,26 @@ typedef struct SVnodeMgmt {
...
@@ -44,26 +44,26 @@ typedef struct SVnodeMgmt {
}
SVnodeMgmt
;
}
SVnodeMgmt
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
int32_t
vgVersion
;
int32_t
vgVersion
;
int8_t
dropped
;
int8_t
dropped
;
char
path
[
PATH_MAX
+
20
];
char
path
[
PATH_MAX
+
20
];
}
SWrapperCfg
;
}
SWrapperCfg
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
int32_t
refCount
;
int32_t
refCount
;
int32_t
vgVersion
;
int32_t
vgVersion
;
int8_t
dropped
;
int8_t
dropped
;
int8_t
accessState
;
int8_t
accessState
;
char
*
path
;
char
*
path
;
SVnode
*
pImpl
;
SVnode
*
pImpl
;
STaosQueue
*
pWriteQ
;
STaosQueue
*
pWriteQ
;
STaosQueue
*
pSyncQ
;
STaosQueue
*
pSyncQ
;
STaosQueue
*
pApplyQ
;
STaosQueue
*
pApplyQ
;
STaosQueue
*
pQueryQ
;
STaosQueue
*
pQueryQ
;
STaosQueue
*
pFetchQ
;
STaosQueue
*
pFetchQ
;
STaosQueue
*
pMergeQ
;
STaosQueue
*
pMergeQ
;
}
SVnodeObj
;
}
SVnodeObj
;
typedef
struct
{
typedef
struct
{
...
@@ -100,21 +100,16 @@ void vmStopWorker(SVnodeMgmt *pMgmt);
...
@@ -100,21 +100,16 @@ void vmStopWorker(SVnodeMgmt *pMgmt);
int32_t
vmAllocQueue
(
SVnodeMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
int32_t
vmAllocQueue
(
SVnodeMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
void
vmFreeQueue
(
SVnodeMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
void
vmFreeQueue
(
SVnodeMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
int32_t
vmPutRpcMsgToWriteQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutRpcMsgToSyncQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutRpcMsgToApplyQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutRpcMsgToQueryQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutRpcMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutRpcMsgToMergeQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmGetQueueSize
(
SVnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
);
int32_t
vmGetQueueSize
(
SVnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
);
int32_t
vmPutRpcMsgToQueue
(
SVnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
);
int32_t
vmPutNodeMsgToWriteQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutNodeMsgToSyncQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToWriteQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutNodeMsgToQueryQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToSyncQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutNodeMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToQueryQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutNodeMsgToMergeQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutNodeMsgToMgmtQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToMergeQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutNodeMsgToMonitorQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToMgmtQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
vmPutMsgToMonitorQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
浏览文件 @
4b9ea626
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "vmInt.h"
#include "vmInt.h"
#define MAX_CONTENT_LEN 1024 * 1024
SVnodeObj
**
vmGetVnodeListFromHash
(
SVnodeMgmt
*
pMgmt
,
int32_t
*
numOfVnodes
)
{
SVnodeObj
**
vmGetVnodeListFromHash
(
SVnodeMgmt
*
pMgmt
,
int32_t
*
numOfVnodes
)
{
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
...
@@ -29,7 +31,7 @@ SVnodeObj **vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes) {
...
@@ -29,7 +31,7 @@ SVnodeObj **vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes) {
SVnodeObj
*
pVnode
=
*
ppVnode
;
SVnodeObj
*
pVnode
=
*
ppVnode
;
if
(
pVnode
&&
num
<
size
)
{
if
(
pVnode
&&
num
<
size
)
{
int32_t
refCount
=
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
int32_t
refCount
=
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
dTrace
(
"vgId:%d, acquire vnode, refCount:%d"
,
pVnode
->
vgId
,
refCount
);
//
dTrace("vgId:%d, acquire vnode, refCount:%d", pVnode->vgId, refCount);
pVnodes
[
num
]
=
(
*
ppVnode
);
pVnodes
[
num
]
=
(
*
ppVnode
);
num
++
;
num
++
;
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
pIter
);
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
pIter
);
...
@@ -47,7 +49,7 @@ SVnodeObj **vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes) {
...
@@ -47,7 +49,7 @@ SVnodeObj **vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes) {
int32_t
vmGetVnodeListFromFile
(
SVnodeMgmt
*
pMgmt
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
)
{
int32_t
vmGetVnodeListFromFile
(
SVnodeMgmt
*
pMgmt
,
SWrapperCfg
**
ppCfgs
,
int32_t
*
numOfVnodes
)
{
int32_t
code
=
TSDB_CODE_INVALID_JSON_FORMAT
;
int32_t
code
=
TSDB_CODE_INVALID_JSON_FORMAT
;
int32_t
len
=
0
;
int32_t
len
=
0
;
int32_t
maxLen
=
1024
*
1024
;
int32_t
maxLen
=
MAX_CONTENT_LEN
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
cJSON
*
root
=
NULL
;
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
...
@@ -128,7 +130,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
...
@@ -128,7 +130,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
*
numOfVnodes
=
vnodesNum
;
*
numOfVnodes
=
vnodesNum
;
code
=
0
;
code
=
0
;
dDebug
(
"succcessed to read file %s
"
,
file
);
dDebug
(
"succcessed to read file %s
, numOfVnodes:%d"
,
file
,
vnodesNum
);
_OVER:
_OVER:
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
...
@@ -156,7 +158,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
...
@@ -156,7 +158,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
SVnodeObj
**
pVnodes
=
vmGetVnodeListFromHash
(
pMgmt
,
&
numOfVnodes
);
SVnodeObj
**
pVnodes
=
vmGetVnodeListFromHash
(
pMgmt
,
&
numOfVnodes
);
int32_t
len
=
0
;
int32_t
len
=
0
;
int32_t
maxLen
=
1024
*
1024
;
int32_t
maxLen
=
MAX_CONTENT_LEN
;
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
char
*
content
=
taosMemoryCalloc
(
1
,
maxLen
+
1
);
if
(
content
==
NULL
)
{
if
(
content
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -195,6 +197,6 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
...
@@ -195,6 +197,6 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
taosMemoryFree
(
pVnodes
);
taosMemoryFree
(
pVnodes
);
}
}
dDebug
(
"successed to write %s
"
,
realfile
);
dDebug
(
"successed to write %s
, numOfVnodes:%d"
,
realfile
,
numOfVnodes
);
return
taosRenameFile
(
file
,
realfile
);
return
taosRenameFile
(
file
,
realfile
);
}
}
\ No newline at end of file
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
4b9ea626
...
@@ -180,6 +180,24 @@ static void vmGenerateWrapperCfg(SVnodeMgmt *pMgmt, SCreateVnodeReq *pCreate, SW
...
@@ -180,6 +180,24 @@ static void vmGenerateWrapperCfg(SVnodeMgmt *pMgmt, SCreateVnodeReq *pCreate, SW
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s%svnode%d"
,
pMgmt
->
path
,
TD_DIRSEP
,
pCreate
->
vgId
);
snprintf
(
pCfg
->
path
,
sizeof
(
pCfg
->
path
),
"%s%svnode%d"
,
pMgmt
->
path
,
TD_DIRSEP
,
pCreate
->
vgId
);
}
}
static
int32_t
vmTsmaAdjustDays
(
SVnodeCfg
*
pCfg
,
SCreateVnodeReq
*
pReq
)
{
if
(
pReq
->
isTsma
)
{
SMsgHead
*
smaMsg
=
pReq
->
pTsma
;
uint32_t
contLen
=
(
uint32_t
)(
htonl
(
smaMsg
->
contLen
)
-
sizeof
(
SMsgHead
));
return
smaGetTSmaDays
(
pCfg
,
POINTER_SHIFT
(
smaMsg
,
sizeof
(
SMsgHead
)),
contLen
,
&
pCfg
->
tsdbCfg
.
days
);
}
return
0
;
}
static
int32_t
vmTsmaProcessCreate
(
SVnode
*
pVnode
,
SCreateVnodeReq
*
pReq
)
{
if
(
pReq
->
isTsma
)
{
SMsgHead
*
smaMsg
=
pReq
->
pTsma
;
uint32_t
contLen
=
(
uint32_t
)(
htonl
(
smaMsg
->
contLen
)
-
sizeof
(
SMsgHead
));
return
vnodeProcessCreateTSma
(
pVnode
,
POINTER_SHIFT
(
smaMsg
,
sizeof
(
SMsgHead
)),
contLen
);
}
return
0
;
}
int32_t
vmProcessCreateVnodeReq
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmProcessCreateVnodeReq
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SCreateVnodeReq
createReq
=
{
0
};
SCreateVnodeReq
createReq
=
{
0
};
SVnodeCfg
vnodeCfg
=
{
0
};
SVnodeCfg
vnodeCfg
=
{
0
};
...
@@ -192,9 +210,16 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -192,9 +210,16 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
-
1
;
return
-
1
;
}
}
dDebug
(
"vgId:%d,
create vnode req is received
, tsma:%d standby:%d"
,
createReq
.
vgId
,
createReq
.
isTsma
,
dDebug
(
"vgId:%d,
start to create vnode
, tsma:%d standby:%d"
,
createReq
.
vgId
,
createReq
.
isTsma
,
createReq
.
standby
);
createReq
.
standby
);
vmGenerateVnodeCfg
(
&
createReq
,
&
vnodeCfg
);
vmGenerateVnodeCfg
(
&
createReq
,
&
vnodeCfg
);
if
(
vmTsmaAdjustDays
(
&
vnodeCfg
,
&
createReq
)
<
0
)
{
dError
(
"vgId:%d, failed to adjust tsma days since %s"
,
createReq
.
vgId
,
terrstr
());
code
=
terrno
;
goto
_OVER
;
}
vmGenerateWrapperCfg
(
pMgmt
,
&
createReq
,
&
wrapperCfg
);
vmGenerateWrapperCfg
(
pMgmt
,
&
createReq
,
&
wrapperCfg
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
createReq
.
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
createReq
.
vgId
);
...
@@ -203,14 +228,16 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -203,14 +228,16 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
tFreeSCreateVnodeReq
(
&
createReq
);
tFreeSCreateVnodeReq
(
&
createReq
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
terrno
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_ALREADY_DEPLOYED
;
return
-
1
;
code
=
terrno
;
goto
_OVER
;
}
}
snprintf
(
path
,
TSDB_FILENAME_LEN
,
"vnode%svnode%d"
,
TD_DIRSEP
,
vnodeCfg
.
vgId
);
snprintf
(
path
,
TSDB_FILENAME_LEN
,
"vnode%svnode%d"
,
TD_DIRSEP
,
vnodeCfg
.
vgId
);
if
(
vnodeCreate
(
path
,
&
vnodeCfg
,
pMgmt
->
pTfs
)
<
0
)
{
if
(
vnodeCreate
(
path
,
&
vnodeCfg
,
pMgmt
->
pTfs
)
<
0
)
{
tFreeSCreateVnodeReq
(
&
createReq
);
tFreeSCreateVnodeReq
(
&
createReq
);
dError
(
"vgId:%d, failed to create vnode since %s"
,
createReq
.
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to create vnode since %s"
,
createReq
.
vgId
,
terrstr
());
return
-
1
;
code
=
terrno
;
goto
_OVER
;
}
}
SVnode
*
pImpl
=
vnodeOpen
(
path
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
SVnode
*
pImpl
=
vnodeOpen
(
path
,
pMgmt
->
pTfs
,
pMgmt
->
msgCb
);
...
@@ -227,14 +254,11 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -227,14 +254,11 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
goto
_OVER
;
goto
_OVER
;
}
}
if
(
createReq
.
isTsma
)
{
code
=
vmTsmaProcessCreate
(
pImpl
,
&
createReq
);
SMsgHead
*
smaMsg
=
createReq
.
pTsma
;
if
(
code
!=
0
)
{
uint32_t
contLen
=
(
uint32_t
)(
htonl
(
smaMsg
->
contLen
)
-
sizeof
(
SMsgHead
));
dError
(
"vgId:%d, failed to create tsma since %s"
,
createReq
.
vgId
,
terrstr
());
if
(
vnodeProcessCreateTSma
(
pImpl
,
POINTER_SHIFT
(
smaMsg
,
sizeof
(
SMsgHead
)),
contLen
)
<
0
)
{
code
=
terrno
;
dError
(
"vgId:%d, failed to create tsma since %s"
,
createReq
.
vgId
,
terrstr
());
goto
_OVER
;
code
=
terrno
;
goto
_OVER
;
};
}
}
code
=
vnodeStart
(
pImpl
);
code
=
vnodeStart
(
pImpl
);
...
@@ -253,6 +277,8 @@ _OVER:
...
@@ -253,6 +277,8 @@ _OVER:
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
vnodeClose
(
pImpl
);
vnodeClose
(
pImpl
);
vnodeDestroy
(
path
,
pMgmt
->
pTfs
);
vnodeDestroy
(
path
,
pMgmt
->
pTfs
);
}
else
{
dInfo
(
"vgId:%d, vnode is created"
,
createReq
.
vgId
);
}
}
tFreeSCreateVnodeReq
(
&
createReq
);
tFreeSCreateVnodeReq
(
&
createReq
);
...
@@ -268,7 +294,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -268,7 +294,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
}
int32_t
vgId
=
dropReq
.
vgId
;
int32_t
vgId
=
dropReq
.
vgId
;
dDebug
(
"vgId:%d,
drop vnode req is received
"
,
vgId
);
dDebug
(
"vgId:%d,
start to drop vnode
"
,
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
...
@@ -295,59 +321,59 @@ SArray *vmGetMsgHandles() {
...
@@ -295,59 +321,59 @@ SArray *vmGetMsgHandles() {
SArray
*
pArray
=
taosArrayInit
(
32
,
sizeof
(
SMgmtHandle
));
SArray
*
pArray
=
taosArrayInit
(
32
,
sizeof
(
SMgmtHandle
));
if
(
pArray
==
NULL
)
goto
_OVER
;
if
(
pArray
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MON_VM_INFO
,
vmPut
Node
MsgToMonitorQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MON_VM_INFO
,
vmPutMsgToMonitorQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MON_VM_LOAD
,
vmPut
Node
MsgToMonitorQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MON_VM_LOAD
,
vmPutMsgToMonitorQueue
,
0
)
==
NULL
)
goto
_OVER
;
// Requests handled by VNODE
// Requests handled by VNODE
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SUBMIT
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SUBMIT
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY
,
vmPut
Node
MsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY
,
vmPutMsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_CONTINUE
,
vmPut
Node
MsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_CONTINUE
,
vmPutMsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_FETCH
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_FETCH
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_TABLE
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_TABLE
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_UPDATE_TAG_VAL
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_UPDATE_TAG_VAL
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TABLE_META
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TABLE_META
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TABLES_META
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TABLES_META
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_CONSUME
,
vmPut
Node
MsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_CONSUME
,
vmPutMsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_QUERY
,
vmPut
Node
MsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_QUERY
,
vmPutMsgToQueryQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_CONNECT
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_CONNECT
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_DISCONNECT
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_DISCONNECT
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
// if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_SET_CUR, vmPut
Node
MsgToWriteQueue, 0)== NULL) goto _OVER;
// if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_SET_CUR, vmPutMsgToWriteQueue, 0)== NULL) goto _OVER;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CANCEL_TASK
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CANCEL_TASK
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_TASK
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_TASK
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CREATE_STB
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CREATE_STB
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_STB
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_STB
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_STB
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_STB
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CREATE_TABLE
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CREATE_TABLE
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_TABLE
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_TABLE
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CREATE_SMA
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CREATE_SMA
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CANCEL_SMA
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CANCEL_SMA
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_SMA
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_DROP_SMA
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SUBMIT_RSMA
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SUBMIT_RSMA
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_VG_CHANGE
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_VG_CHANGE
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_VG_DELETE
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_MQ_VG_DELETE
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CONSUME
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_CONSUME
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_DEPLOY
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_DEPLOY
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_HEARTBEAT
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_QUERY_HEARTBEAT
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TRIGGER
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_STREAM_TRIGGER
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_RUN
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_RUN
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_DISPATCH
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_DISPATCH
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_RECOVER
,
vmPut
Node
MsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_TASK_RECOVER
,
vmPutMsgToFetchQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_REPLICA
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_REPLICA
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_CONFIG
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_ALTER_CONFIG
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_COMPACT
,
vmPut
Node
MsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_COMPACT
,
vmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_VNODE
,
vmPut
Node
MsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CREATE_VNODE
,
vmPutMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_VNODE
,
vmPut
Node
MsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_VNODE
,
vmPutMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_TIMEOUT
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_TIMEOUT
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_PING
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_PING
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_PING_REPLY
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_PING_REPLY
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_CLIENT_REQUEST
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_CLIENT_REQUEST
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_CLIENT_REQUEST_REPLY
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_CLIENT_REQUEST_REPLY
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_REQUEST_VOTE
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_REQUEST_VOTE
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_REQUEST_VOTE_REPLY
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_REQUEST_VOTE_REPLY
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_APPEND_ENTRIES
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_APPEND_ENTRIES
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_APPEND_ENTRIES_REPLY
,
vmPut
Node
MsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_VND_SYNC_APPEND_ENTRIES_REPLY
,
vmPutMsgToSyncQueue
,
0
)
==
NULL
)
goto
_OVER
;
code
=
0
;
code
=
0
;
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
4b9ea626
...
@@ -18,21 +18,17 @@
...
@@ -18,21 +18,17 @@
SVnodeObj
*
vmAcquireVnode
(
SVnodeMgmt
*
pMgmt
,
int32_t
vgId
)
{
SVnodeObj
*
vmAcquireVnode
(
SVnodeMgmt
*
pMgmt
,
int32_t
vgId
)
{
SVnodeObj
*
pVnode
=
NULL
;
SVnodeObj
*
pVnode
=
NULL
;
int32_t
refCount
=
0
;
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
taosHashGetDup
(
pMgmt
->
hash
,
&
vgId
,
sizeof
(
int32_t
),
(
void
*
)
&
pVnode
);
taosHashGetDup
(
pMgmt
->
hash
,
&
vgId
,
sizeof
(
int32_t
),
(
void
*
)
&
pVnode
);
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
terrno
=
TSDB_CODE_VND_INVALID_VGROUP_ID
;
}
else
{
}
else
{
refCount
=
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
int32_t
refCount
=
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
// dTrace("vgId:%d, acquire vnode, ref:%d", pVnode->vgId, refCount);
}
}
taosThreadRwlockUnlock
(
&
pMgmt
->
lock
);
taosThreadRwlockUnlock
(
&
pMgmt
->
lock
);
if
(
pVnode
!=
NULL
)
{
dTrace
(
"vgId:%d, acquire vnode, refCount:%d"
,
pVnode
->
vgId
,
refCount
);
}
return
pVnode
;
return
pVnode
;
}
}
...
@@ -41,8 +37,8 @@ void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
...
@@ -41,8 +37,8 @@ void vmReleaseVnode(SVnodeMgmt *pMgmt, SVnodeObj *pVnode) {
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pVnode
->
refCount
,
1
);
// dTrace("vgId:%d, release vnode, ref:%d", pVnode->vgId, refCount);
taosThreadRwlockUnlock
(
&
pMgmt
->
lock
);
taosThreadRwlockUnlock
(
&
pMgmt
->
lock
);
dTrace
(
"vgId:%d, release vnode, refCount:%d"
,
pVnode
->
vgId
,
refCount
);
}
}
int32_t
vmOpenVnode
(
SVnodeMgmt
*
pMgmt
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
)
{
int32_t
vmOpenVnode
(
SVnodeMgmt
*
pMgmt
,
SWrapperCfg
*
pCfg
,
SVnode
*
pImpl
)
{
...
@@ -138,7 +134,7 @@ static void *vmOpenVnodeInThread(void *param) {
...
@@ -138,7 +134,7 @@ static void *vmOpenVnodeInThread(void *param) {
}
}
}
}
dDebug
(
"thread:%d,
total v
nodes:%d, opened:%d failed:%d"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
,
pThread
->
opened
,
dDebug
(
"thread:%d,
numOfV
nodes:%d, opened:%d failed:%d"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
,
pThread
->
opened
,
pThread
->
failed
);
pThread
->
failed
);
return
NULL
;
return
NULL
;
}
}
...
@@ -160,7 +156,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
...
@@ -160,7 +156,7 @@ static int32_t vmOpenVnodes(SVnodeMgmt *pMgmt) {
pMgmt
->
state
.
totalVnodes
=
numOfVnodes
;
pMgmt
->
state
.
totalVnodes
=
numOfVnodes
;
int32_t
threadNum
=
1
;
// tsNumOfCores;
int32_t
threadNum
=
1
;
int32_t
vnodesPerThread
=
numOfVnodes
/
threadNum
+
1
;
int32_t
vnodesPerThread
=
numOfVnodes
/
threadNum
+
1
;
SVnodeThread
*
threads
=
taosMemoryCalloc
(
threadNum
,
sizeof
(
SVnodeThread
));
SVnodeThread
*
threads
=
taosMemoryCalloc
(
threadNum
,
sizeof
(
SVnodeThread
));
...
@@ -253,12 +249,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
...
@@ -253,12 +249,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
path
=
pInput
->
path
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
name
=
pInput
->
name
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
=
pInput
->
msgCb
;
pMgmt
->
msgCb
.
queueFps
[
WRITE_QUEUE
]
=
(
PutToQueueFp
)
vmPutRpcMsgToWriteQueue
;
pMgmt
->
msgCb
.
putToQueueFp
=
(
PutToQueueFp
)
vmPutRpcMsgToQueue
;
pMgmt
->
msgCb
.
queueFps
[
SYNC_QUEUE
]
=
(
PutToQueueFp
)
vmPutRpcMsgToSyncQueue
;
pMgmt
->
msgCb
.
queueFps
[
APPLY_QUEUE
]
=
(
PutToQueueFp
)
vmPutRpcMsgToApplyQueue
;
pMgmt
->
msgCb
.
queueFps
[
QUERY_QUEUE
]
=
(
PutToQueueFp
)
vmPutRpcMsgToQueryQueue
;
pMgmt
->
msgCb
.
queueFps
[
FETCH_QUEUE
]
=
(
PutToQueueFp
)
vmPutRpcMsgToFetchQueue
;
pMgmt
->
msgCb
.
queueFps
[
MERGE_QUEUE
]
=
(
PutToQueueFp
)
vmPutRpcMsgToMergeQueue
;
pMgmt
->
msgCb
.
qsizeFp
=
(
GetQueueSizeFp
)
vmGetQueueSize
;
pMgmt
->
msgCb
.
qsizeFp
=
(
GetQueueSizeFp
)
vmGetQueueSize
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
taosThreadRwlockInit
(
&
pMgmt
->
lock
,
NULL
);
taosThreadRwlockInit
(
&
pMgmt
->
lock
,
NULL
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
4b9ea626
...
@@ -29,11 +29,11 @@ static inline void vmSendRsp(SRpcMsg *pMsg, int32_t code) {
...
@@ -29,11 +29,11 @@ static inline void vmSendRsp(SRpcMsg *pMsg, int32_t code) {
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
}
static
void
vmProcessQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
static
void
vmProcess
Mgmt
Queue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SVnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
SVnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
dTrace
(
"msg:%p, get from vnode queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
dTrace
(
"msg:%p, get from vnode-mgmt queue"
,
pMsg
);
switch
(
pMsg
->
msgType
)
{
switch
(
pMsg
->
msgType
)
{
case
TDMT_MON_VM_INFO
:
case
TDMT_MON_VM_INFO
:
code
=
vmProcessGetMonitorInfoReq
(
pMgmt
,
pMsg
);
code
=
vmProcessGetMonitorInfoReq
(
pMgmt
,
pMsg
);
...
@@ -49,11 +49,14 @@ static void vmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
...
@@ -49,11 +49,14 @@ static void vmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
break
;
break
;
default:
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
dError
(
"msg:%p, not processed in vnode queue"
,
pMsg
);
dError
(
"msg:%p, not processed in vnode
-mgmt
queue"
,
pMsg
);
}
}
if
(
IsReq
(
pMsg
))
{
if
(
IsReq
(
pMsg
))
{
if
(
code
!=
0
&&
terrno
!=
0
)
code
=
terrno
;
if
(
code
!=
0
&&
terrno
!=
0
)
{
dError
(
"msg:%p failed to process since %s"
,
pMsg
,
terrstr
());
code
=
terrno
;
}
vmSendRsp
(
pMsg
,
code
);
vmSendRsp
(
pMsg
,
code
);
}
}
...
@@ -65,13 +68,15 @@ static void vmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
...
@@ -65,13 +68,15 @@ static void vmProcessQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
static
void
vmProcessQueryQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
static
void
vmProcessQueryQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
dTrace
(
"
msg:%p, get from vnode-query queue"
,
pMsg
);
dTrace
(
"
vgId:%d, msg:%p get from vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
int32_t
code
=
vnodeProcessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
int32_t
code
=
vnodeProcessQueryMsg
(
pVnode
->
pImpl
,
pMsg
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
if
(
terrno
!=
0
)
code
=
terrno
;
if
(
terrno
!=
0
)
code
=
terrno
;
dError
(
"vgId:%d, msg:%p failed to query since %s"
,
pVnode
->
vgId
,
pMsg
,
terrstr
());
vmSendRsp
(
pMsg
,
code
);
vmSendRsp
(
pMsg
,
code
);
}
}
dTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
dTrace
(
"vgId:%d, msg:%p is freed, code:0x%x"
,
pVnode
->
vgId
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
...
@@ -79,63 +84,66 @@ static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
...
@@ -79,63 +84,66 @@ static void vmProcessQueryQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
static
void
vmProcessFetchQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
static
void
vmProcessFetchQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
dTrace
(
"
msg:%p, get from vnode-fetch queue"
,
pMsg
);
dTrace
(
"
vgId:%d, msg:%p get from vnode-fetch queue"
,
pVnode
->
vgId
,
pMsg
);
int32_t
code
=
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
int32_t
code
=
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
if
(
terrno
!=
0
)
code
=
terrno
;
if
(
terrno
!=
0
)
code
=
terrno
;
dError
(
"vgId:%d, msg:%p failed to fetch since %s"
,
pVnode
->
vgId
,
pMsg
,
terrstr
());
vmSendRsp
(
pMsg
,
code
);
vmSendRsp
(
pMsg
,
code
);
}
}
dTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
dTrace
(
"vgId:%d, msg:%p is freed, code:0x%x"
,
pVnode
->
vgId
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
static
void
vmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcessWriteQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
int32_t
code
=
0
;
SRpcMsg
*
pMsg
=
NULL
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
*
));
int64_t
sync
=
vnodeGetSyncHandle
(
pVnode
->
pImpl
);
if
(
pArray
==
NULL
)
{
SArray
*
pArray
=
taosArrayInit
(
numOfMsgs
,
sizeof
(
SRpcMsg
**
));
dError
(
"failed to process %d msgs in write-queue since %s"
,
numOfMsgs
,
terrstr
());
return
;
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
m
=
0
;
m
<
numOfMsgs
;
m
++
)
{
SRpcMsg
*
pMsg
=
NULL
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
dTrace
(
"vgId:%d, msg:%p get from vnode-write queue"
,
pVnode
->
vgId
,
pMsg
);
dTrace
(
"msg:%p, get from vnode-write queue"
,
pMsg
);
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
if
(
taosArrayPush
(
pArray
,
&
pMsg
)
==
NULL
)
{
d
Trace
(
"msg:%p, failed to push to array since %s"
,
pMsg
,
terrstr
()
);
d
Error
(
"vgId:%d, failed to push msg:%p to vnode-write array"
,
pVnode
->
vgId
,
pMsg
);
vmSendRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
vmSendRsp
(
pMsg
,
TSDB_CODE_OUT_OF_MEMORY
);
}
}
}
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pArray
);
i
++
)
{
for
(
int
32_t
m
=
0
;
m
<
taosArrayGetSize
(
pArray
);
m
++
)
{
SRpcMsg
*
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
m
);
SRpcMsg
rsp
=
{.
info
=
pMsg
->
info
}
;
code
=
vnodePreprocessReq
(
pVnode
->
pImpl
,
pMsg
)
;
vnodePreprocessReq
(
pVnode
->
pImpl
,
pMsg
);
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
continue
;
if
(
code
!=
0
)
{
dError
(
"vgId:%d, msg:%p failed to write since %s"
,
pVnode
->
vgId
,
pMsg
,
tstrerror
(
code
));
vmSendRsp
(
pMsg
,
code
);
continue
;
}
int32_t
ret
=
syncPropose
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
),
pMsg
,
false
);
code
=
syncPropose
(
sync
,
pMsg
,
false
);
if
(
ret
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
if
(
code
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
dTrace
(
"msg:%p, is redirect since not leader, vgId:%d "
,
pMsg
,
pVnode
->
vgId
);
continue
;
rsp
.
code
=
TSDB_CODE_RPC_REDIRECT
;
}
else
if
(
code
==
TAOS_SYNC_PROPOSE_NOT_LEADER
)
{
SEpSet
newEpSet
;
dTrace
(
"vgId:%d, msg:%p is redirect since not leader"
,
pVnode
->
vgId
,
pMsg
);
syncGetEpSet
(
vnodeGetSyncHandle
(
pVnode
->
pImpl
),
&
newEpSet
);
SEpSet
newEpSet
=
{
0
};
syncGetEpSet
(
sync
,
&
newEpSet
);
newEpSet
.
inUse
=
(
newEpSet
.
inUse
+
1
)
%
newEpSet
.
numOfEps
;
newEpSet
.
inUse
=
(
newEpSet
.
inUse
+
1
)
%
newEpSet
.
numOfEps
;
SRpcMsg
rsp
=
{.
code
=
TSDB_CODE_RPC_REDIRECT
,
.
info
=
pMsg
->
info
};
tmsgSendRedirectRsp
(
&
rsp
,
&
newEpSet
);
tmsgSendRedirectRsp
(
&
rsp
,
&
newEpSet
);
}
else
if
(
ret
==
TAOS_SYNC_PROPOSE_OTHER_ERROR
)
{
rsp
.
code
=
TSDB_CODE_SYN_INTERNAL_ERROR
;
tmsgSendRsp
(
&
rsp
);
}
else
if
(
ret
==
TAOS_SYNC_PROPOSE_SUCCESS
)
{
// send response in applyQ
}
else
{
}
else
{
assert
(
0
);
dError
(
"vgId:%d, msg:%p failed to write since %s"
,
pVnode
->
vgId
,
pMsg
,
tstrerror
(
code
));
vmSendRsp
(
pMsg
,
code
);
}
}
}
}
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
i
++
)
{
SRpcMsg
*
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pArray
,
i
);
dTrace
(
"
msg:%p, is freed"
,
pMsg
);
dTrace
(
"
vgId:%d, msg:%p is freed"
,
pVnode
->
vgId
,
pMsg
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
...
@@ -145,10 +153,11 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
...
@@ -145,10 +153,11 @@ static void vmProcessWriteQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
static
void
vmProcessApplyQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcessApplyQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SRpcMsg
*
pMsg
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"vgId:%d, msg:%p get from vnode-apply queue"
,
pVnode
->
vgId
,
pMsg
);
// init response rpc msg
// init response rpc msg
SRpcMsg
rsp
=
{
0
};
SRpcMsg
rsp
=
{
0
};
...
@@ -163,7 +172,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
...
@@ -163,7 +172,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
// apply data into tsdb
// apply data into tsdb
if
(
vnodeProcessWriteReq
(
pVnode
->
pImpl
,
&
originalRpcMsg
,
pSyncApplyMsg
->
fsmMeta
.
index
,
&
rsp
)
<
0
)
{
if
(
vnodeProcessWriteReq
(
pVnode
->
pImpl
,
&
originalRpcMsg
,
pSyncApplyMsg
->
fsmMeta
.
index
,
&
rsp
)
<
0
)
{
rsp
.
code
=
terrno
;
rsp
.
code
=
terrno
;
d
Trace
(
"msg:%p, process write error since %s"
,
pMsg
,
terrstr
());
d
Error
(
"vgId:%d, msg:%p failed to apply since %s"
,
pVnode
->
vgId
,
pMsg
,
terrstr
());
}
}
syncApplyMsgDestroy
(
pSyncApplyMsg
);
syncApplyMsgDestroy
(
pSyncApplyMsg
);
...
@@ -175,6 +184,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
...
@@ -175,6 +184,7 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
tmsgSendRsp
(
&
rsp
);
tmsgSendRsp
(
&
rsp
);
}
}
dTrace
(
"vgId:%d, msg:%p is freed, code:0x%x"
,
pVnode
->
vgId
,
pMsg
,
rsp
.
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
...
@@ -182,23 +192,22 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
...
@@ -182,23 +192,22 @@ static void vmProcessApplyQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO
static
void
vmProcessSyncQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcessSyncQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SRpcMsg
*
pMsg
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"vgId:%d, msg:%p get from vnode-sync queue"
,
pVnode
->
vgId
,
pMsg
);
int32_t
code
=
vnodeProcessSyncReq
(
pVnode
->
pImpl
,
pMsg
,
NULL
);
int32_t
code
=
vnodeProcessSyncReq
(
pVnode
->
pImpl
,
pMsg
,
NULL
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
dError
(
"vgId:%d, msg:%p failed to sync since %s"
,
pVnode
->
vgId
,
pMsg
,
terrstr
());
if
(
pMsg
->
info
.
handle
!=
NULL
)
{
if
(
pMsg
->
info
.
handle
!=
NULL
)
{
SRpcMsg
rsp
=
{
if
(
terrno
!=
0
)
code
=
terrno
;
.
code
=
(
terrno
<
0
)
?
terrno
:
code
,
vmSendRsp
(
pMsg
,
code
);
.
info
=
pMsg
->
info
,
};
dTrace
(
"msg:%p, failed to process sync queue since %s"
,
pMsg
,
terrstr
());
tmsgSendRsp
(
&
rsp
);
}
}
}
}
dTrace
(
"vgId:%d, msg:%p is freed, code:0x%x"
,
pVnode
->
vgId
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
...
@@ -206,24 +215,26 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf
...
@@ -206,24 +215,26 @@ static void vmProcessSyncQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numOf
static
void
vmProcessMergeQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
static
void
vmProcessMergeQueue
(
SQueueInfo
*
pInfo
,
STaosQall
*
qall
,
int32_t
numOfMsgs
)
{
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SVnodeObj
*
pVnode
=
pInfo
->
ahandle
;
SRpcMsg
*
pMsg
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfMsgs
;
++
i
)
{
SRpcMsg
*
pMsg
=
NULL
;
if
(
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
)
==
0
)
continue
;
taosGetQitem
(
qall
,
(
void
**
)
&
pMsg
);
dTrace
(
"vgId:%d, msg:%p get from vnode-merge queue"
,
pVnode
->
vgId
,
pMsg
);
dTrace
(
"msg:%p, get from vnode-merge queue"
,
pMsg
);
int32_t
code
=
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
int32_t
code
=
vnodeProcessFetchMsg
(
pVnode
->
pImpl
,
pMsg
,
pInfo
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
dError
(
"vgId:%d, msg:%p failed to merge since %s"
,
pVnode
->
vgId
,
pMsg
,
terrstr
());
if
(
terrno
!=
0
)
code
=
terrno
;
if
(
terrno
!=
0
)
code
=
terrno
;
vmSendRsp
(
pMsg
,
code
);
vmSendRsp
(
pMsg
,
code
);
}
}
dTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
dTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosFreeQitem
(
pMsg
);
}
}
}
}
static
int32_t
vmPut
Node
MsgToQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
,
EQueueType
qtype
)
{
static
int32_t
vmPutMsgToQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
,
EQueueType
qtype
)
{
SMsgHead
*
pHead
=
pMsg
->
pCont
;
SMsgHead
*
pHead
=
pMsg
->
pCont
;
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -232,31 +243,36 @@ static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType
...
@@ -232,31 +243,36 @@ static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
dError
(
"vgId:%d, failed to put msg:%p into vnode-queue since %s"
,
pHead
->
vgId
,
pMsg
,
terrstr
());
dError
(
"vgId:%d, failed to put msg:%p into vnode queue since %s, type:%s"
,
pHead
->
vgId
,
pMsg
,
terrstr
(),
TMSG_INFO
(
pMsg
->
msgType
));
return
terrno
!=
0
?
terrno
:
-
1
;
return
terrno
!=
0
?
terrno
:
-
1
;
}
}
switch
(
qtype
)
{
switch
(
qtype
)
{
case
QUERY_QUEUE
:
case
QUERY_QUEUE
:
dTrace
(
"
msg:%p, put into vnode-query worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
)
);
dTrace
(
"
vgId:%d, msg:%p put into vnode-query queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
break
;
break
;
case
FETCH_QUEUE
:
case
FETCH_QUEUE
:
dTrace
(
"
msg:%p, put into vnode-fetch worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
)
);
dTrace
(
"
vgId:%d, msg:%p put into vnode-fetch queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pFetchQ
,
pMsg
);
taosWriteQitem
(
pVnode
->
pFetchQ
,
pMsg
);
break
;
break
;
case
WRITE_QUEUE
:
case
WRITE_QUEUE
:
dTrace
(
"
msg:%p, put into vnode-write worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
)
);
dTrace
(
"
vgId:%d, msg:%p put into vnode-write queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pWriteQ
,
pMsg
);
taosWriteQitem
(
pVnode
->
pWriteQ
,
pMsg
);
break
;
break
;
case
SYNC_QUEUE
:
case
SYNC_QUEUE
:
dTrace
(
"
msg:%p, put into vnode-sync worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
)
);
dTrace
(
"
vgId:%d, msg:%p put into vnode-sync queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pSyncQ
,
pMsg
);
taosWriteQitem
(
pVnode
->
pSyncQ
,
pMsg
);
break
;
break
;
case
MERGE_QUEUE
:
case
MERGE_QUEUE
:
dTrace
(
"
msg:%p, put into vnode-merge worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
)
);
dTrace
(
"
vgId:%d, msg:%p put into vnode-merge queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pMergeQ
,
pMsg
);
taosWriteQitem
(
pVnode
->
pMergeQ
,
pMsg
);
break
;
break
;
case
APPLY_QUEUE
:
dTrace
(
"vgId:%d, msg:%p put into vnode-apply queue"
,
pVnode
->
vgId
,
pMsg
);
taosWriteQitem
(
pVnode
->
pApplyQ
,
pMsg
);
break
;
default:
default:
code
=
-
1
;
code
=
-
1
;
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
...
@@ -267,110 +283,39 @@ static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType
...
@@ -267,110 +283,39 @@ static int32_t vmPutNodeMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType
return
code
;
return
code
;
}
}
int32_t
vmPutNodeMsgToSyncQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToSyncQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
SYNC_QUEUE
);
}
return
vmPutNodeMsgToQueue
(
pMgmt
,
pMsg
,
SYNC_QUEUE
);
}
int32_t
vmPutNodeMsgToWriteQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToWriteQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
WRITE_QUEUE
);
}
return
vmPutNodeMsgToQueue
(
pMgmt
,
pMsg
,
WRITE_QUEUE
);
}
int32_t
vmPutNodeMsgToQueryQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToQueryQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
QUERY_QUEUE
);
}
return
vmPutNodeMsgToQueue
(
pMgmt
,
pMsg
,
QUERY_QUEUE
);
}
int32_t
vmPutNodeMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
FETCH_QUEUE
);
}
return
vmPutNodeMsgToQueue
(
pMgmt
,
pMsg
,
FETCH_QUEUE
);
}
int32_t
vmPutNodeMsgToMergeQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToMergeQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
MERGE_QUEUE
);
}
return
vmPutNodeMsgToQueue
(
pMgmt
,
pMsg
,
MERGE_QUEUE
);
}
int32_t
vmPutNodeMsgToMgmtQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToMgmtQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SSingleWorker
*
pWorker
=
&
pMgmt
->
mgmtWorker
;
dTrace
(
"msg:%p, put into vnode-mgmt queue"
,
pMsg
);
dTrace
(
"msg:%p, put into vnode-mgmt worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
taosWriteQitem
(
pMgmt
->
mgmtWorker
.
queue
,
pMsg
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
return
0
;
}
}
int32_t
vmPutNodeMsgToMonitorQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
vmPutMsgToMonitorQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
SSingleWorker
*
pWorker
=
&
pMgmt
->
monitorWorker
;
dTrace
(
"msg:%p, put into vnode-monitor queue"
,
pMsg
);
dTrace
(
"msg:%p, put into vnode-monitor worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
taosWriteQitem
(
pMgmt
->
monitorWorker
.
queue
,
pMsg
);
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
return
0
;
return
0
;
}
}
static
int32_t
vmPutRpcMsgToQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
,
EQueueType
qtype
)
{
int32_t
vmPutRpcMsgToQueue
(
SVnodeMgmt
*
pMgmt
,
EQueueType
qtype
,
SRpcMsg
*
pRpc
)
{
SMsgHead
*
pHead
=
pRpc
->
pCont
;
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
pHead
->
vgId
);
if
(
pVnode
==
NULL
)
return
-
1
;
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
SRpcMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
),
RPC_QITEM
);
int32_t
code
=
0
;
if
(
pMsg
==
NULL
)
return
-
1
;
if
(
pMsg
==
NULL
)
{
rpcFreeCont
(
pRpc
->
pCont
);
pRpc
->
pCont
=
NULL
;
code
=
-
1
;
}
else
{
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
switch
(
qtype
)
{
case
WRITE_QUEUE
:
dTrace
(
"msg:%p, create and put into vnode-write worker, type:%s"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
));
taosWriteQitem
(
pVnode
->
pWriteQ
,
pMsg
);
break
;
case
QUERY_QUEUE
:
dTrace
(
"msg:%p, create and put into vnode-query queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
));
taosWriteQitem
(
pVnode
->
pQueryQ
,
pMsg
);
break
;
case
FETCH_QUEUE
:
dTrace
(
"msg:%p, create and put into vnode-fetch queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
));
taosWriteQitem
(
pVnode
->
pFetchQ
,
pMsg
);
break
;
case
APPLY_QUEUE
:
dTrace
(
"msg:%p, create and put into vnode-apply queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
));
taosWriteQitem
(
pVnode
->
pApplyQ
,
pMsg
);
break
;
case
MERGE_QUEUE
:
dTrace
(
"msg:%p, create and put into vnode-merge queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
));
taosWriteQitem
(
pVnode
->
pMergeQ
,
pMsg
);
break
;
case
SYNC_QUEUE
:
dTrace
(
"msg:%p, create and put into vnode-sync queue, type:%s"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
));
taosWriteQitem
(
pVnode
->
pSyncQ
,
pMsg
);
break
;
default:
code
=
-
1
;
terrno
=
TSDB_CODE_INVALID_PARA
;
break
;
}
}
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
code
;
}
int32_t
vmPutRpcMsgToWriteQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
return
vmPutRpcMsgToQueue
(
pMgmt
,
pRpc
,
WRITE_QUEUE
);
}
int32_t
vmPutRpcMsgToSyncQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
return
vmPutRpcMsgToQueue
(
pMgmt
,
pRpc
,
SYNC_QUEUE
);
}
int32_t
vmPutRpcMsgToApplyQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
return
vmPutRpcMsgToQueue
(
pMgmt
,
pRpc
,
APPLY_QUEUE
);
}
int32_t
vmPutRpcMsgToQueryQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
SMsgHead
*
pHead
=
pRpc
->
pCont
;
return
vmPutRpcMsgToQueue
(
pMgmt
,
pRpc
,
QUERY_QUEUE
);
dTrace
(
"vgId:%d, msg:%p is created, type:%s"
,
pHead
->
vgId
,
pMsg
,
TMSG_INFO
(
pMsg
->
msgType
));
}
int32_t
vmPutRpcMsgToFetchQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
return
vmPutRpcMsgToQueue
(
pMgmt
,
pRpc
,
FETCH_QUEUE
);
}
int32_t
vmPutRpcMsgToMergeQueue
(
SVnodeMgmt
*
pMgmt
,
SRpcMsg
*
pRpc
)
{
pHead
->
contLen
=
htonl
(
pHead
->
contLen
);
return
vmPutRpcMsgToQueue
(
pMgmt
,
pRpc
,
MERGE_QUEUE
);
pHead
->
vgId
=
htonl
(
pHead
->
vgId
);
memcpy
(
pMsg
,
pRpc
,
sizeof
(
SRpcMsg
));
return
vmPutMsgToQueue
(
pMgmt
,
pMsg
,
qtype
);
}
}
int32_t
vmGetQueueSize
(
SVnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
)
{
int32_t
vmGetQueueSize
(
SVnodeMgmt
*
pMgmt
,
int32_t
vgId
,
EQueueType
qtype
)
{
...
@@ -466,29 +411,23 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
...
@@ -466,29 +411,23 @@ int32_t vmStartWorker(SVnodeMgmt *pMgmt) {
pMPool
->
max
=
tsNumOfVnodeMergeThreads
;
pMPool
->
max
=
tsNumOfVnodeMergeThreads
;
if
(
tWWorkerInit
(
pMPool
)
!=
0
)
return
-
1
;
if
(
tWWorkerInit
(
pMPool
)
!=
0
)
return
-
1
;
SSingleWorkerCfg
c
fg
=
{
SSingleWorkerCfg
mgmtC
fg
=
{
.
min
=
1
,
.
min
=
1
,
.
max
=
1
,
.
max
=
1
,
.
name
=
"vnode-mgmt"
,
.
name
=
"vnode-mgmt"
,
.
fp
=
(
FItem
)
vmProcessQueue
,
.
fp
=
(
FItem
)
vmProcess
Mgmt
Queue
,
.
param
=
pMgmt
,
.
param
=
pMgmt
,
};
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
mgmtWorker
,
&
cfg
)
!=
0
)
{
if
(
tSingleWorkerInit
(
&
pMgmt
->
mgmtWorker
,
&
mgmtCfg
)
!=
0
)
return
-
1
;
dError
(
"failed to start vnode-mgmt worker since %s"
,
terrstr
());
return
-
1
;
}
SSingleWorkerCfg
mCfg
=
{
SSingleWorkerCfg
m
onitor
Cfg
=
{
.
min
=
1
,
.
min
=
1
,
.
max
=
1
,
.
max
=
1
,
.
name
=
"vnode-monitor"
,
.
name
=
"vnode-monitor"
,
.
fp
=
(
FItem
)
vmProcessQueue
,
.
fp
=
(
FItem
)
vmProcess
Mgmt
Queue
,
.
param
=
pMgmt
,
.
param
=
pMgmt
,
};
};
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
mCfg
)
!=
0
)
{
if
(
tSingleWorkerInit
(
&
pMgmt
->
monitorWorker
,
&
monitorCfg
)
!=
0
)
return
-
1
;
dError
(
"failed to start vnode-monitor worker since %s"
,
terrstr
());
return
-
1
;
}
dDebug
(
"vnode workers are initialized"
);
dDebug
(
"vnode workers are initialized"
);
return
0
;
return
0
;
...
...
source/dnode/mgmt/node_mgmt/src/dmEnv.c
浏览文件 @
4b9ea626
...
@@ -50,26 +50,26 @@ static int32_t dmInitMonitor() {
...
@@ -50,26 +50,26 @@ static int32_t dmInitMonitor() {
}
}
int32_t
dmInit
(
int8_t
rtype
)
{
int32_t
dmInit
(
int8_t
rtype
)
{
dInfo
(
"start to init env"
);
dInfo
(
"start to init
dnode
env"
);
if
(
dmCheckRepeatInit
(
dmInstance
())
!=
0
)
return
-
1
;
if
(
dmCheckRepeatInit
(
dmInstance
())
!=
0
)
return
-
1
;
if
(
dmInitSystem
()
!=
0
)
return
-
1
;
if
(
dmInitSystem
()
!=
0
)
return
-
1
;
if
(
dmInitMonitor
()
!=
0
)
return
-
1
;
if
(
dmInitMonitor
()
!=
0
)
return
-
1
;
if
(
dmInitDnode
(
dmInstance
(),
rtype
)
!=
0
)
return
-
1
;
if
(
dmInitDnode
(
dmInstance
(),
rtype
)
!=
0
)
return
-
1
;
dInfo
(
"env is initialized"
);
dInfo
(
"
dnode
env is initialized"
);
return
0
;
return
0
;
}
}
static
int32_t
dmCheckRepeatCleanup
(
SDnode
*
pDnode
)
{
static
int32_t
dmCheckRepeatCleanup
(
SDnode
*
pDnode
)
{
if
(
atomic_val_compare_exchange_8
(
&
pDnode
->
once
,
DND_ENV_READY
,
DND_ENV_CLEANUP
)
!=
DND_ENV_READY
)
{
if
(
atomic_val_compare_exchange_8
(
&
pDnode
->
once
,
DND_ENV_READY
,
DND_ENV_CLEANUP
)
!=
DND_ENV_READY
)
{
dError
(
"env is already cleaned up"
);
dError
(
"
dnode
env is already cleaned up"
);
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
}
}
void
dmCleanup
()
{
void
dmCleanup
()
{
dDebug
(
"start to cleanup env"
);
dDebug
(
"start to cleanup
dnode
env"
);
SDnode
*
pDnode
=
dmInstance
();
SDnode
*
pDnode
=
dmInstance
();
if
(
dmCheckRepeatCleanup
(
pDnode
)
!=
0
)
return
;
if
(
dmCheckRepeatCleanup
(
pDnode
)
!=
0
)
return
;
dmCleanupDnode
(
pDnode
);
dmCleanupDnode
(
pDnode
);
...
@@ -79,7 +79,7 @@ void dmCleanup() {
...
@@ -79,7 +79,7 @@ void dmCleanup() {
udfcClose
();
udfcClose
();
udfStopUdfd
();
udfStopUdfd
();
taosStopCacheRefreshWorker
();
taosStopCacheRefreshWorker
();
dInfo
(
"env is cleaned up"
);
dInfo
(
"
dnode
env is cleaned up"
);
taosCloseLog
();
taosCloseLog
();
taosCleanupCfg
();
taosCleanupCfg
();
...
...
source/dnode/mgmt/node_mgmt/src/dmMgmt.c
浏览文件 @
4b9ea626
...
@@ -229,7 +229,7 @@ SMgmtWrapper *dmAcquireWrapper(SDnode *pDnode, EDndNodeType ntype) {
...
@@ -229,7 +229,7 @@ SMgmtWrapper *dmAcquireWrapper(SDnode *pDnode, EDndNodeType ntype) {
taosThreadRwlockRdlock
(
&
pWrapper
->
lock
);
taosThreadRwlockRdlock
(
&
pWrapper
->
lock
);
if
(
pWrapper
->
deployed
)
{
if
(
pWrapper
->
deployed
)
{
int32_t
refCount
=
atomic_add_fetch_32
(
&
pWrapper
->
refCount
,
1
);
int32_t
refCount
=
atomic_add_fetch_32
(
&
pWrapper
->
refCount
,
1
);
dTrace
(
"node:%s, is acquired, ref:%d"
,
pWrapper
->
name
,
refCount
);
//
dTrace("node:%s, is acquired, ref:%d", pWrapper->name, refCount);
}
else
{
}
else
{
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
pRetWrapper
=
NULL
;
pRetWrapper
=
NULL
;
...
@@ -245,7 +245,7 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper) {
...
@@ -245,7 +245,7 @@ int32_t dmMarkWrapper(SMgmtWrapper *pWrapper) {
taosThreadRwlockRdlock
(
&
pWrapper
->
lock
);
taosThreadRwlockRdlock
(
&
pWrapper
->
lock
);
if
(
pWrapper
->
deployed
||
(
InParentProc
(
pWrapper
)
&&
pWrapper
->
required
))
{
if
(
pWrapper
->
deployed
||
(
InParentProc
(
pWrapper
)
&&
pWrapper
->
required
))
{
int32_t
refCount
=
atomic_add_fetch_32
(
&
pWrapper
->
refCount
,
1
);
int32_t
refCount
=
atomic_add_fetch_32
(
&
pWrapper
->
refCount
,
1
);
dTrace
(
"node:%s, is marked, ref:%d"
,
pWrapper
->
name
,
refCount
);
//
dTrace("node:%s, is marked, ref:%d", pWrapper->name, refCount);
}
else
{
}
else
{
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
terrno
=
TSDB_CODE_NODE_NOT_DEPLOYED
;
code
=
-
1
;
code
=
-
1
;
...
@@ -261,7 +261,7 @@ void dmReleaseWrapper(SMgmtWrapper *pWrapper) {
...
@@ -261,7 +261,7 @@ void dmReleaseWrapper(SMgmtWrapper *pWrapper) {
taosThreadRwlockRdlock
(
&
pWrapper
->
lock
);
taosThreadRwlockRdlock
(
&
pWrapper
->
lock
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pWrapper
->
refCount
,
1
);
int32_t
refCount
=
atomic_sub_fetch_32
(
&
pWrapper
->
refCount
,
1
);
taosThreadRwlockUnlock
(
&
pWrapper
->
lock
);
taosThreadRwlockUnlock
(
&
pWrapper
->
lock
);
dTrace
(
"node:%s, is released, ref:%d"
,
pWrapper
->
name
,
refCount
);
//
dTrace("node:%s, is released, ref:%d", pWrapper->name, refCount);
}
}
static
void
dmGetServerStartupStatus
(
SDnode
*
pDnode
,
SServerStatusRsp
*
pStatus
)
{
static
void
dmGetServerStartupStatus
(
SDnode
*
pDnode
,
SServerStatusRsp
*
pStatus
)
{
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
4b9ea626
...
@@ -117,6 +117,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
...
@@ -117,6 +117,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
if
(
pMsg
==
NULL
)
{
if
(
pMsg
==
NULL
)
{
goto
_OVER
;
goto
_OVER
;
}
}
dTrace
(
"msg:%p, is created, type:%s"
,
pMsg
,
TMSG_INFO
(
pRpc
->
msgType
));
if
(
dmBuildNodeMsg
(
pMsg
,
pRpc
)
!=
0
)
{
if
(
dmBuildNodeMsg
(
pMsg
,
pRpc
)
!=
0
)
{
goto
_OVER
;
goto
_OVER
;
...
...
source/dnode/mgmt/node_util/src/dmEps.c
浏览文件 @
4b9ea626
...
@@ -148,7 +148,6 @@ int32_t dmReadEps(SDnodeData *pData) {
...
@@ -148,7 +148,6 @@ int32_t dmReadEps(SDnodeData *pData) {
code
=
0
;
code
=
0
;
dDebug
(
"succcessed to read file %s"
,
file
);
dDebug
(
"succcessed to read file %s"
,
file
);
dmPrintEps
(
pData
);
_OVER:
_OVER:
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
...
@@ -162,6 +161,7 @@ _OVER:
...
@@ -162,6 +161,7 @@ _OVER:
taosArrayPush
(
pData
->
dnodeEps
,
&
dnodeEp
);
taosArrayPush
(
pData
->
dnodeEps
,
&
dnodeEp
);
}
}
dDebug
(
"reset dnode list on startup"
);
dmResetEps
(
pData
,
pData
->
dnodeEps
);
dmResetEps
(
pData
,
pData
->
dnodeEps
);
if
(
dmIsEpChanged
(
pData
,
pData
->
dnodeId
,
tsLocalEp
))
{
if
(
dmIsEpChanged
(
pData
,
pData
->
dnodeId
,
tsLocalEp
))
{
...
@@ -236,11 +236,13 @@ void dmUpdateEps(SDnodeData *pData, SArray *eps) {
...
@@ -236,11 +236,13 @@ void dmUpdateEps(SDnodeData *pData, SArray *eps) {
int32_t
numOfEpsOld
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
int32_t
numOfEpsOld
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
if
(
numOfEps
!=
numOfEpsOld
)
{
if
(
numOfEps
!=
numOfEpsOld
)
{
dDebug
(
"new dnode list get from mnode"
);
dmResetEps
(
pData
,
eps
);
dmResetEps
(
pData
,
eps
);
dmWriteEps
(
pData
);
dmWriteEps
(
pData
);
}
else
{
}
else
{
int32_t
size
=
numOfEps
*
sizeof
(
SDnodeEp
);
int32_t
size
=
numOfEps
*
sizeof
(
SDnodeEp
);
if
(
memcmp
(
pData
->
dnodeEps
->
pData
,
eps
->
pData
,
size
)
!=
0
)
{
if
(
memcmp
(
pData
->
dnodeEps
->
pData
,
eps
->
pData
,
size
)
!=
0
)
{
dDebug
(
"new dnode list get from mnode"
);
dmResetEps
(
pData
,
eps
);
dmResetEps
(
pData
,
eps
);
dmWriteEps
(
pData
);
dmWriteEps
(
pData
);
}
}
...
@@ -282,7 +284,7 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
...
@@ -282,7 +284,7 @@ static void dmResetEps(SDnodeData *pData, SArray *dnodeEps) {
static
void
dmPrintEps
(
SDnodeData
*
pData
)
{
static
void
dmPrintEps
(
SDnodeData
*
pData
)
{
int32_t
numOfEps
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
int32_t
numOfEps
=
(
int32_t
)
taosArrayGetSize
(
pData
->
dnodeEps
);
dDebug
(
"print dnode
ep
list, num:%d"
,
numOfEps
);
dDebug
(
"print dnode list, num:%d"
,
numOfEps
);
for
(
int32_t
i
=
0
;
i
<
numOfEps
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
numOfEps
;
i
++
)
{
SDnodeEp
*
pEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
SDnodeEp
*
pEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is_mnode:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is_mnode:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
...
...
source/dnode/mgmt/node_util/src/dmFile.c
浏览文件 @
4b9ea626
...
@@ -135,7 +135,7 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
...
@@ -135,7 +135,7 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
return
NULL
;
return
NULL
;
}
}
dDebug
(
"
file:%s is locked
"
,
filepath
);
dDebug
(
"
lock file:%s to prevent repeated starts
"
,
filepath
);
return
pFile
;
return
pFile
;
}
}
...
...
source/dnode/mgmt/test/mnode/dmnode.cpp
浏览文件 @
4b9ea626
...
@@ -94,7 +94,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
...
@@ -94,7 +94,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
D
ND_ALTER_MNODE
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
M
ND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
}
...
@@ -111,7 +111,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
...
@@ -111,7 +111,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
D
ND_ALTER_MNODE
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
M
ND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_INVALID_OPTION
);
}
}
...
@@ -128,7 +128,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
...
@@ -128,7 +128,7 @@ TEST_F(DndTestMnode, 02_Alter_Mnode) {
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
D
ND_ALTER_MNODE
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
M
ND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
}
...
@@ -186,7 +186,7 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
...
@@ -186,7 +186,7 @@ TEST_F(DndTestMnode, 03_Drop_Mnode) {
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
tSerializeSDCreateMnodeReq
(
pReq
,
contLen
,
&
alterReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
D
ND_ALTER_MNODE
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
M
ND_ALTER_MNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_NOT_DEPLOYED
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_NODE_NOT_DEPLOYED
);
}
}
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
4b9ea626
...
@@ -255,6 +255,7 @@ typedef struct {
...
@@ -255,6 +255,7 @@ typedef struct {
int8_t
hashMethod
;
// default is 1
int8_t
hashMethod
;
// default is 1
int32_t
numOfRetensions
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
SArray
*
pRetensions
;
int8_t
schemaless
;
}
SDbCfg
;
}
SDbCfg
;
typedef
struct
{
typedef
struct
{
...
...
source/dnode/mnode/impl/inc/mndTopic.h
浏览文件 @
4b9ea626
...
@@ -37,6 +37,8 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
...
@@ -37,6 +37,8 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
int32_t
mndSetTopicCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
int32_t
mndSetTopicCommitLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqTopicObj
*
pTopic
);
bool
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
const
SArray
*
colIds
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
4b9ea626
...
@@ -115,6 +115,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
...
@@ -115,6 +115,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
freqUnit
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
freqUnit
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
keepUnit
,
_OVER
)
SDB_SET_INT8
(
pRaw
,
dataPos
,
pRetension
->
keepUnit
,
_OVER
)
}
}
SDB_SET_INT8
(
pRaw
,
dataPos
,
pDb
->
cfg
.
schemaless
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
SDB_SET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
SDB_SET_DATALEN
(
pRaw
,
dataPos
,
_OVER
)
...
@@ -192,6 +193,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
...
@@ -192,6 +193,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
}
}
}
}
}
}
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
schemaless
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
SDB_GET_RESERVE
(
pRaw
,
dataPos
,
DB_RESERVE_SIZE
,
_OVER
)
taosInitRWLatch
(
&
pDb
->
lock
);
taosInitRWLatch
(
&
pDb
->
lock
);
...
@@ -380,6 +382,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
...
@@ -380,6 +382,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
if
(
pCfg
->
replications
<
TSDB_MIN_DB_REPLICA
||
pCfg
->
replications
>
TSDB_MAX_DB_REPLICA
)
return
-
1
;
if
(
pCfg
->
replications
<
TSDB_MIN_DB_REPLICA
||
pCfg
->
replications
>
TSDB_MAX_DB_REPLICA
)
return
-
1
;
if
(
pCfg
->
replications
!=
1
&&
pCfg
->
replications
!=
3
)
return
-
1
;
if
(
pCfg
->
replications
!=
1
&&
pCfg
->
replications
!=
3
)
return
-
1
;
if
(
pCfg
->
strict
<
TSDB_DB_STRICT_OFF
||
pCfg
->
strict
>
TSDB_DB_STRICT_ON
)
return
-
1
;
if
(
pCfg
->
strict
<
TSDB_DB_STRICT_OFF
||
pCfg
->
strict
>
TSDB_DB_STRICT_ON
)
return
-
1
;
if
(
pCfg
->
schemaless
<
TSDB_DB_SCHEMALESS_OFF
||
pCfg
->
schemaless
>
TSDB_DB_SCHEMALESS_ON
)
return
-
1
;
if
(
pCfg
->
cacheLastRow
<
TSDB_MIN_DB_CACHE_LAST_ROW
||
pCfg
->
cacheLastRow
>
TSDB_MAX_DB_CACHE_LAST_ROW
)
return
-
1
;
if
(
pCfg
->
cacheLastRow
<
TSDB_MIN_DB_CACHE_LAST_ROW
||
pCfg
->
cacheLastRow
>
TSDB_MAX_DB_CACHE_LAST_ROW
)
return
-
1
;
if
(
pCfg
->
hashMethod
!=
1
)
return
-
1
;
if
(
pCfg
->
hashMethod
!=
1
)
return
-
1
;
if
(
pCfg
->
replications
>
mndGetDnodeSize
(
pMnode
))
{
if
(
pCfg
->
replications
>
mndGetDnodeSize
(
pMnode
))
{
...
@@ -411,6 +414,8 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
...
@@ -411,6 +414,8 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
strict
<
0
)
pCfg
->
strict
=
TSDB_DEFAULT_DB_STRICT
;
if
(
pCfg
->
strict
<
0
)
pCfg
->
strict
=
TSDB_DEFAULT_DB_STRICT
;
if
(
pCfg
->
cacheLastRow
<
0
)
pCfg
->
cacheLastRow
=
TSDB_DEFAULT_CACHE_LAST_ROW
;
if
(
pCfg
->
cacheLastRow
<
0
)
pCfg
->
cacheLastRow
=
TSDB_DEFAULT_CACHE_LAST_ROW
;
if
(
pCfg
->
numOfRetensions
<
0
)
pCfg
->
numOfRetensions
=
0
;
if
(
pCfg
->
numOfRetensions
<
0
)
pCfg
->
numOfRetensions
=
0
;
if
(
pCfg
->
schemaless
<
0
)
pCfg
->
schemaless
=
TSDB_DB_SCHEMALESS_OFF
;
}
}
static
int32_t
mndSetCreateDbRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroups
)
{
static
int32_t
mndSetCreateDbRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroups
)
{
...
@@ -521,6 +526,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
...
@@ -521,6 +526,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
.
strict
=
pCreate
->
strict
,
.
strict
=
pCreate
->
strict
,
.
cacheLastRow
=
pCreate
->
cacheLastRow
,
.
cacheLastRow
=
pCreate
->
cacheLastRow
,
.
hashMethod
=
1
,
.
hashMethod
=
1
,
.
schemaless
=
pCreate
->
schemaless
,
};
};
dbObj
.
cfg
.
numOfRetensions
=
pCreate
->
numOfRetensions
;
dbObj
.
cfg
.
numOfRetensions
=
pCreate
->
numOfRetensions
;
...
@@ -899,6 +905,7 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
...
@@ -899,6 +905,7 @@ static int32_t mndProcessGetDbCfgReq(SRpcMsg *pReq) {
cfgRsp
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
cfgRsp
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
cfgRsp
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
cfgRsp
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
cfgRsp
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
cfgRsp
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
cfgRsp
.
schemaless
=
pDb
->
cfg
.
schemaless
;
int32_t
contLen
=
tSerializeSDbCfgRsp
(
NULL
,
0
,
&
cfgRsp
);
int32_t
contLen
=
tSerializeSDbCfgRsp
(
NULL
,
0
,
&
cfgRsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
...
@@ -1542,8 +1549,11 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
...
@@ -1542,8 +1549,11 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
numOfStables
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
numOfStables
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
statusB
,
false
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
statusB
,
false
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
);
colDataAppend
(
pColInfo
,
rows
,
(
const
char
*
)
&
pDb
->
cfg
.
schemaless
,
false
);
}
}
}
}
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
4b9ea626
...
@@ -53,10 +53,10 @@ int32_t mndInitMnode(SMnode *pMnode) {
...
@@ -53,10 +53,10 @@ int32_t mndInitMnode(SMnode *pMnode) {
};
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_MNODE
,
mndProcessCreateMnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_MNODE
,
mndProcessCreateMnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_
D
ND_ALTER_MNODE
,
mndProcessAlterMnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_
M
ND_ALTER_MNODE
,
mndProcessAlterMnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_MNODE
,
mndProcessDropMnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_MNODE
,
mndProcessDropMnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_MNODE_RSP
,
mndProcessCreateMnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_MNODE_RSP
,
mndProcessCreateMnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_
D
ND_ALTER_MNODE_RSP
,
mndProcessAlterMnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_
M
ND_ALTER_MNODE_RSP
,
mndProcessAlterMnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_DROP_MNODE_RSP
,
mndProcessDropMnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_DROP_MNODE_RSP
,
mndProcessDropMnodeRsp
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_MNODE
,
mndRetrieveMnodes
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_MNODE
,
mndRetrieveMnodes
);
...
@@ -338,7 +338,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
...
@@ -338,7 +338,7 @@ static int32_t mndSetCreateMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDno
.
epSet
=
alterEpset
,
.
epSet
=
alterEpset
,
.
pCont
=
pReq
,
.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_
D
ND_ALTER_MNODE
,
.
msgType
=
TDMT_
M
ND_ALTER_MNODE
,
.
acceptableCode
=
0
,
.
acceptableCode
=
0
,
};
};
...
@@ -506,7 +506,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
...
@@ -506,7 +506,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
.
epSet
=
alterEpset
,
.
epSet
=
alterEpset
,
.
pCont
=
pReq
,
.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_
D
ND_ALTER_MNODE
,
.
msgType
=
TDMT_
M
ND_ALTER_MNODE
,
.
acceptableCode
=
0
,
.
acceptableCode
=
0
,
};
};
...
@@ -655,7 +655,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -655,7 +655,7 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
const
char
*
roles
=
"
OFFLINE
"
;
const
char
*
roles
=
"
offline
"
;
if
(
pObj
->
id
==
pMnode
->
selfDnodeId
)
{
if
(
pObj
->
id
==
pMnode
->
selfDnodeId
)
{
roles
=
syncStr
(
TAOS_SYNC_STATE_LEADER
);
roles
=
syncStr
(
TAOS_SYNC_STATE_LEADER
);
}
}
...
@@ -667,9 +667,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -667,9 +667,9 @@ static int32_t mndRetrieveMnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
const
char
*
status
=
"
READY
"
;
const
char
*
status
=
"
ready
"
;
if
(
objStatus
==
SDB_STATUS_CREATING
)
status
=
"
CREATING
"
;
if
(
objStatus
==
SDB_STATUS_CREATING
)
status
=
"
creating
"
;
if
(
objStatus
==
SDB_STATUS_DROPPING
)
status
=
"
DROPPING
"
;
if
(
objStatus
==
SDB_STATUS_DROPPING
)
status
=
"
dropping
"
;
char
b3
[
9
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
b3
[
9
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
b3
,
status
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b3
,
status
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
4b9ea626
...
@@ -390,7 +390,7 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -390,7 +390,7 @@ 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
(
"vgId:%d moved from consumer %"
PRId64
" to consumer %"
PRId64
,
pOutputRebVg
->
pVgEp
->
vgId
,
mInfo
(
"vgId:%d
,
moved from consumer %"
PRId64
" to consumer %"
PRId64
,
pOutputRebVg
->
pVgEp
->
vgId
,
pOutputRebVg
->
oldConsumerId
,
pOutputRebVg
->
newConsumerId
);
pOutputRebVg
->
oldConsumerId
,
pOutputRebVg
->
newConsumerId
);
}
}
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
4b9ea626
...
@@ -70,6 +70,56 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
...
@@ -70,6 +70,56 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
return
strchr
(
topic
,
'.'
)
+
1
;
return
strchr
(
topic
,
'.'
)
+
1
;
}
}
bool
mndCheckColAndTagModifiable
(
SMnode
*
pMnode
,
int64_t
suid
,
const
SArray
*
colAndTagIds
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
bool
found
=
false
;
while
(
1
)
{
SMqTopicObj
*
pTopic
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_TOPIC
,
pIter
,
(
void
**
)
&
pTopic
);
if
(
pIter
==
NULL
)
break
;
if
(
pTopic
->
subType
!=
TOPIC_SUB_TYPE__COLUMN
)
{
sdbRelease
(
pSdb
,
pTopic
);
continue
;
}
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
pTopic
->
ast
,
&
pAst
)
!=
0
)
{
ASSERT
(
0
);
return
false
;
}
SHashObj
*
pColHash
=
NULL
;
SNodeList
*
pNodeList
;
nodesCollectColumns
((
SSelectStmt
*
)
pAst
,
SQL_CLAUSE_FROM
,
NULL
,
COLLECT_COL_TYPE_ALL
,
&
pNodeList
);
SNode
*
pNode
=
NULL
;
FOREACH
(
pNode
,
pNodeList
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
pCol
->
tableId
!=
suid
)
goto
NEXT
;
if
(
pColHash
==
NULL
)
{
pColHash
=
taosHashInit
(
0
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_SMALLINT
),
false
,
HASH_NO_LOCK
);
}
if
(
pCol
->
colId
>
0
)
{
taosHashPut
(
pColHash
,
&
pCol
->
colId
,
sizeof
(
int16_t
),
NULL
,
0
);
}
}
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
colAndTagIds
);
i
++
)
{
int16_t
*
pColId
=
taosArrayGet
(
colAndTagIds
,
i
);
if
(
taosHashGet
(
pColHash
,
pColId
,
sizeof
(
int16_t
))
!=
NULL
)
{
found
=
true
;
goto
NEXT
;
}
}
NEXT:
sdbRelease
(
pSdb
,
pTopic
);
nodesDestroyNode
(
pAst
);
if
(
found
)
return
false
;
}
return
true
;
}
SSdbRaw
*
mndTopicActionEncode
(
SMqTopicObj
*
pTopic
)
{
SSdbRaw
*
mndTopicActionEncode
(
SMqTopicObj
*
pTopic
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
4b9ea626
...
@@ -705,7 +705,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -705,7 +705,7 @@ static int32_t mndRetrieveVgroups(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
}
}
char
buf1
[
20
]
=
{
0
};
char
buf1
[
20
]
=
{
0
};
const
char
*
role
=
online
?
syncStr
(
pVgroup
->
vnodeGid
[
i
].
role
)
:
"
OFFLINE
"
;
const
char
*
role
=
online
?
syncStr
(
pVgroup
->
vnodeGid
[
i
].
role
)
:
"
offline
"
;
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
pMeta
->
pSchemas
[
cols
].
bytes
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
...
...
source/dnode/vnode/CMakeLists.txt
浏览文件 @
4b9ea626
...
@@ -32,11 +32,10 @@ target_sources(
...
@@ -32,11 +32,10 @@ target_sources(
"src/sma/smaEnv.c"
"src/sma/smaEnv.c"
"src/sma/smaOpen.c"
"src/sma/smaOpen.c"
"src/sma/smaRollup.c"
"src/sma/smaRollup.c"
"src/sma/smaTimeRange.c"
"src/sma/smaTimeRange
2
.c"
# tsdb
# tsdb
"src/tsdb/tsdbCommit.c"
"src/tsdb/tsdbCommit.c"
"src/tsdb/tsdbCommit2.c"
"src/tsdb/tsdbFile.c"
"src/tsdb/tsdbFile.c"
"src/tsdb/tsdbFS.c"
"src/tsdb/tsdbFS.c"
"src/tsdb/tsdbOpen.c"
"src/tsdb/tsdbOpen.c"
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
4b9ea626
...
@@ -147,6 +147,9 @@ bool tqNextDataBlockFilterOut(STqReadHandle *pHandle, SHashObj *filterOutUids
...
@@ -147,6 +147,9 @@ bool tqNextDataBlockFilterOut(STqReadHandle *pHandle, SHashObj *filterOutUids
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
*
pNumOfRows
,
int16_t
*
pNumOfCols
);
int32_t
*
pNumOfRows
,
int16_t
*
pNumOfCols
);
// sma
int32_t
smaGetTSmaDays
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
// need to reposition
// need to reposition
// structs
// structs
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
4b9ea626
...
@@ -28,12 +28,12 @@ typedef struct SMetaDB SMetaDB;
...
@@ -28,12 +28,12 @@ typedef struct SMetaDB SMetaDB;
// metaDebug ==================
// metaDebug ==================
// clang-format off
// clang-format off
#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("M
E
TA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
#define metaFatal(...) do { if (metaDebugFlag & DEBUG_FATAL) { taosPrintLog("MTA FATAL ", DEBUG_FATAL, 255, __VA_ARGS__); }} while(0)
#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("M
E
TA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
#define metaError(...) do { if (metaDebugFlag & DEBUG_ERROR) { taosPrintLog("MTA ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }} while(0)
#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("M
E
TA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0)
#define metaWarn(...) do { if (metaDebugFlag & DEBUG_WARN) { taosPrintLog("MTA WARN ", DEBUG_WARN, 255, __VA_ARGS__); }} while(0)
#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("M
E
TA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0)
#define metaInfo(...) do { if (metaDebugFlag & DEBUG_INFO) { taosPrintLog("MTA ", DEBUG_INFO, 255, __VA_ARGS__); }} while(0)
#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("M
E
TA ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0)
#define metaDebug(...) do { if (metaDebugFlag & DEBUG_DEBUG) { taosPrintLog("MTA ", DEBUG_DEBUG, metaDebugFlag, __VA_ARGS__); }} while(0)
#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("M
E
TA ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0)
#define metaTrace(...) do { if (metaDebugFlag & DEBUG_TRACE) { taosPrintLog("MTA ", DEBUG_TRACE, metaDebugFlag, __VA_ARGS__); }} while(0)
// clang-format on
// clang-format on
// metaOpen ==================
// metaOpen ==================
...
...
source/dnode/vnode/src/inc/sma.h
浏览文件 @
4b9ea626
...
@@ -223,6 +223,8 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
...
@@ -223,6 +223,8 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
// TODO: This is the basic params, and should wrap the params to a queryHandle.
// TODO: This is the basic params, and should wrap the params to a queryHandle.
int32_t
tdGetTSmaDataImpl
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
);
int32_t
tdGetTSmaDataImpl
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
);
int32_t
tdGetTSmaDaysImpl
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/vnode/src/inc/vnd.h
浏览文件 @
4b9ea626
...
@@ -84,7 +84,7 @@ int32_t vnodeAsyncCommit(SVnode* pVnode);
...
@@ -84,7 +84,7 @@ int32_t vnodeAsyncCommit(SVnode* pVnode);
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
);
void
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncStart
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeSyncClose
(
SVnode
*
pVnode
);
void
vnodeSyncAlter
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
int32_t
vnodeSyncAlter
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/vnode/src/meta/metaOpen.c
浏览文件 @
4b9ea626
...
@@ -53,42 +53,42 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
...
@@ -53,42 +53,42 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
// open env
// open env
ret
=
tdbOpen
(
pMeta
->
path
,
pVnode
->
config
.
szPage
,
pVnode
->
config
.
szCache
,
&
pMeta
->
pEnv
);
ret
=
tdbOpen
(
pMeta
->
path
,
pVnode
->
config
.
szPage
,
pVnode
->
config
.
szCache
,
&
pMeta
->
pEnv
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta env since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta env since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pTbDb
// open pTbDb
ret
=
tdbTbOpen
(
"table.db"
,
sizeof
(
STbDbKey
),
-
1
,
tbDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTbDb
);
ret
=
tdbTbOpen
(
"table.db"
,
sizeof
(
STbDbKey
),
-
1
,
tbDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTbDb
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta table db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta table db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pSkmDb
// open pSkmDb
ret
=
tdbTbOpen
(
"schema.db"
,
sizeof
(
SSkmDbKey
),
-
1
,
skmDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSkmDb
);
ret
=
tdbTbOpen
(
"schema.db"
,
sizeof
(
SSkmDbKey
),
-
1
,
skmDbKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSkmDb
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta schema db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta schema db since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pUidIdx
// open pUidIdx
ret
=
tdbTbOpen
(
"uid.idx"
,
sizeof
(
tb_uid_t
),
sizeof
(
int64_t
),
uidIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pUidIdx
);
ret
=
tdbTbOpen
(
"uid.idx"
,
sizeof
(
tb_uid_t
),
sizeof
(
int64_t
),
uidIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pUidIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta uid idx since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta uid idx since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pNameIdx
// open pNameIdx
ret
=
tdbTbOpen
(
"name.idx"
,
-
1
,
sizeof
(
tb_uid_t
),
NULL
,
pMeta
->
pEnv
,
&
pMeta
->
pNameIdx
);
ret
=
tdbTbOpen
(
"name.idx"
,
-
1
,
sizeof
(
tb_uid_t
),
NULL
,
pMeta
->
pEnv
,
&
pMeta
->
pNameIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta name index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta name index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pCtbIdx
// open pCtbIdx
ret
=
tdbTbOpen
(
"ctb.idx"
,
sizeof
(
SCtbIdxKey
),
0
,
ctbIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pCtbIdx
);
ret
=
tdbTbOpen
(
"ctb.idx"
,
sizeof
(
SCtbIdxKey
),
0
,
ctbIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pCtbIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta child table index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta child table index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
...
@@ -100,14 +100,14 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
...
@@ -100,14 +100,14 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
taosMkDir
(
indexFullPath
);
taosMkDir
(
indexFullPath
);
ret
=
indexOpen
(
indexOptsCreate
(),
indexFullPath
,
(
SIndex
**
)
&
pMeta
->
pTagIvtIdx
);
ret
=
indexOpen
(
indexOptsCreate
(),
indexFullPath
,
(
SIndex
**
)
&
pMeta
->
pTagIvtIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
#else
#else
ret
=
tdbTbOpen
(
"tag.idx"
,
-
1
,
0
,
tagIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTagIdx
);
ret
=
tdbTbOpen
(
"tag.idx"
,
-
1
,
0
,
tagIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTagIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta tag index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
#endif
#endif
...
@@ -115,24 +115,24 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
...
@@ -115,24 +115,24 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
// open pTtlIdx
// open pTtlIdx
ret
=
tdbTbOpen
(
"ttl.idx"
,
sizeof
(
STtlIdxKey
),
0
,
ttlIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTtlIdx
);
ret
=
tdbTbOpen
(
"ttl.idx"
,
sizeof
(
STtlIdxKey
),
0
,
ttlIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pTtlIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta ttl index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta ttl index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open pSmaIdx
// open pSmaIdx
ret
=
tdbTbOpen
(
"sma.idx"
,
sizeof
(
SSmaIdxKey
),
0
,
smaIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSmaIdx
);
ret
=
tdbTbOpen
(
"sma.idx"
,
sizeof
(
SSmaIdxKey
),
0
,
smaIdxKeyCmpr
,
pMeta
->
pEnv
,
&
pMeta
->
pSmaIdx
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaError
(
"vgId:%d failed to open meta sma index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta sma index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
// open index
// open index
if
(
metaOpenIdx
(
pMeta
)
<
0
)
{
if
(
metaOpenIdx
(
pMeta
)
<
0
)
{
metaError
(
"vgId:%d failed to open meta index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
metaError
(
"vgId:%d
,
failed to open meta index since %s"
,
TD_VID
(
pVnode
),
tstrerror
(
terrno
));
goto
_err
;
goto
_err
;
}
}
metaDebug
(
"vgId:%d meta is opened"
,
TD_VID
(
pVnode
));
metaDebug
(
"vgId:%d
,
meta is opened"
,
TD_VID
(
pVnode
));
*
ppMeta
=
pMeta
;
*
ppMeta
=
pMeta
;
return
0
;
return
0
;
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
4b9ea626
...
@@ -425,7 +425,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
...
@@ -425,7 +425,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
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
)
{
metaWarn
(
"vgId:%d no entry for tbId: %"
PRIi64
", smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
uid
,
smaId
);
metaWarn
(
"vgId:%d
,
no entry for tbId: %"
PRIi64
", smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
uid
,
smaId
);
continue
;
continue
;
}
}
pTSma
=
pSW
->
tSma
+
smaIdx
;
pTSma
=
pSW
->
tSma
+
smaIdx
;
...
@@ -464,7 +464,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
...
@@ -464,7 +464,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
_err:
_err:
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
taosArrayDestroy
(
pSmaIds
);
taosArrayDestroy
(
pSmaIds
);
t
d
FreeTSmaWrapper
(
pSW
,
deepCopy
);
tFreeTSmaWrapper
(
pSW
,
deepCopy
);
return
NULL
;
return
NULL
;
}
}
...
@@ -473,7 +473,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
...
@@ -473,7 +473,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaReaderInit
(
&
mr
,
pMeta
,
0
);
if
(
metaGetTableEntryByUid
(
&
mr
,
indexUid
)
<
0
)
{
if
(
metaGetTableEntryByUid
(
&
mr
,
indexUid
)
<
0
)
{
metaWarn
(
"vgId:%d failed to get table entry for smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
indexUid
);
metaWarn
(
"vgId:%d
,
failed to get table entry for smaId: %"
PRIi64
,
TD_VID
(
pMeta
->
pVnode
),
indexUid
);
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
return
NULL
;
return
NULL
;
}
}
...
@@ -576,15 +576,15 @@ SArray *metaGetSmaTbUids(SMeta *pMeta) {
...
@@ -576,15 +576,15 @@ SArray *metaGetSmaTbUids(SMeta *pMeta) {
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
type
,
STagVal
*
val
)
{
const
void
*
metaGetTableTagVal
(
SMetaEntry
*
pEntry
,
int16_t
type
,
STagVal
*
val
)
{
ASSERT
(
pEntry
->
type
==
TSDB_CHILD_TABLE
);
ASSERT
(
pEntry
->
type
==
TSDB_CHILD_TABLE
);
STag
*
tag
=
(
STag
*
)
pEntry
->
ctbEntry
.
pTags
;
STag
*
tag
=
(
STag
*
)
pEntry
->
ctbEntry
.
pTags
;
if
(
type
==
TSDB_DATA_TYPE_JSON
){
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
tag
->
nTag
==
0
)
{
if
(
tag
->
nTag
==
0
)
{
return
NULL
;
return
NULL
;
}
}
return
tag
;
return
tag
;
}
}
bool
find
=
tTagGet
(
tag
,
val
);
bool
find
=
tTagGet
(
tag
,
val
);
if
(
!
find
)
{
if
(
!
find
)
{
return
NULL
;
return
NULL
;
}
}
return
val
;
return
val
;
...
@@ -605,8 +605,6 @@ typedef struct {
...
@@ -605,8 +605,6 @@ typedef struct {
int32_t
metaFilteTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
int32_t
metaFilteTableIds
(
SMeta
*
pMeta
,
SMetaFltParam
*
param
,
SArray
*
pUids
)
{
SIdxCursor
*
pCursor
=
NULL
;
SIdxCursor
*
pCursor
=
NULL
;
char
*
tagData
=
param
->
val
;
int32_t
ret
=
0
,
valid
=
0
;
int32_t
ret
=
0
,
valid
=
0
;
pCursor
=
(
SIdxCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SIdxCursor
));
pCursor
=
(
SIdxCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SIdxCursor
));
pCursor
->
pMeta
=
pMeta
;
pCursor
->
pMeta
=
pMeta
;
...
@@ -623,12 +621,16 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
...
@@ -623,12 +621,16 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
int32_t
nKey
=
0
;
int32_t
nKey
=
0
;
int32_t
nTagData
=
0
;
int32_t
nTagData
=
0
;
if
(
IS_VAR_DATA_TYPE
(
param
->
type
)){
void
*
tagData
=
NULL
;
nTagData
=
strlen
(
param
->
val
);
}
else
{
if
(
IS_VAR_DATA_TYPE
(
param
->
type
))
{
tagData
=
varDataVal
(
param
->
val
);
nTagData
=
varDataLen
(
param
->
val
);
}
else
{
tagData
=
param
->
val
;
nTagData
=
tDataTypes
[
param
->
type
].
bytes
;
nTagData
=
tDataTypes
[
param
->
type
].
bytes
;
}
}
ret
=
metaCreateTagIdxKey
(
pCursor
->
suid
,
pCursor
->
cid
,
param
->
val
,
nTagData
,
pCursor
->
type
,
ret
=
metaCreateTagIdxKey
(
pCursor
->
suid
,
pCursor
->
cid
,
tagData
,
nTagData
,
pCursor
->
type
,
param
->
reverse
?
INT64_MAX
:
INT64_MIN
,
&
pKey
,
&
nKey
);
param
->
reverse
?
INT64_MAX
:
INT64_MIN
,
&
pKey
,
&
nKey
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
goto
END
;
goto
END
;
...
@@ -637,6 +639,7 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
...
@@ -637,6 +639,7 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
if
(
tdbTbcMoveTo
(
pCursor
->
pCur
,
pKey
,
nKey
,
&
cmp
)
<
0
)
{
if
(
tdbTbcMoveTo
(
pCursor
->
pCur
,
pKey
,
nKey
,
&
cmp
)
<
0
)
{
goto
END
;
goto
END
;
}
}
void
*
entryKey
=
NULL
,
*
entryVal
=
NULL
;
void
*
entryKey
=
NULL
,
*
entryVal
=
NULL
;
int32_t
nEntryKey
,
nEntryVal
;
int32_t
nEntryKey
,
nEntryVal
;
while
(
1
)
{
while
(
1
)
{
...
@@ -649,7 +652,12 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
...
@@ -649,7 +652,12 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
int32_t
cmp
=
(
*
param
->
filterFunc
)(
p
->
data
,
pKey
->
data
,
pKey
->
type
);
int32_t
cmp
=
(
*
param
->
filterFunc
)(
p
->
data
,
pKey
->
data
,
pKey
->
type
);
if
(
cmp
==
0
)
{
if
(
cmp
==
0
)
{
// match
// match
tb_uid_t
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
tDataTypes
[
pCursor
->
type
].
bytes
);
tb_uid_t
tuid
=
0
;
if
(
IS_VAR_DATA_TYPE
(
pKey
->
type
))
{
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
varDataTLen
(
p
->
data
));
}
else
{
tuid
=
*
(
tb_uid_t
*
)(
p
->
data
+
tDataTypes
[
pCursor
->
type
].
bytes
);
}
taosArrayPush
(
pUids
,
&
tuid
);
taosArrayPush
(
pUids
,
&
tuid
);
}
else
if
(
cmp
==
1
)
{
}
else
if
(
cmp
==
1
)
{
// not match but should continue to iter
// not match but should continue to iter
...
@@ -670,4 +678,4 @@ END:
...
@@ -670,4 +678,4 @@ END:
taosMemoryFree
(
pCursor
);
taosMemoryFree
(
pCursor
);
return
ret
;
return
ret
;
}
}
\ No newline at end of file
source/dnode/vnode/src/meta/metaSma.c
浏览文件 @
4b9ea626
...
@@ -57,12 +57,12 @@ int32_t metaCreateTSma(SMeta *pMeta, int64_t version, SSmaCfg *pCfg) {
...
@@ -57,12 +57,12 @@ int32_t metaCreateTSma(SMeta *pMeta, int64_t version, SSmaCfg *pCfg) {
if
(
metaHandleSmaEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleSmaEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
metaDebug
(
"vgId:%d tsma is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
pCfg
->
indexUid
);
metaDebug
(
"vgId:%d
,
tsma is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
pCfg
->
indexUid
);
return
0
;
return
0
;
_err:
_err:
metaError
(
"vgId:%d failed to create tsma: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
metaError
(
"vgId:%d
,
failed to create tsma: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pCfg
->
indexName
,
pCfg
->
indexUid
,
tstrerror
(
terrno
));
pCfg
->
indexUid
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
4b9ea626
...
@@ -49,9 +49,9 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
...
@@ -49,9 +49,9 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
int
vLen
=
0
;
int
vLen
=
0
;
const
void
*
pKey
=
NULL
;
const
void
*
pKey
=
NULL
;
const
void
*
pVal
=
NULL
;
const
void
*
pVal
=
NULL
;
void
*
pBuf
=
NULL
;
void
*
pBuf
=
NULL
;
int32_t
szBuf
=
0
;
int32_t
szBuf
=
0
;
void
*
p
=
NULL
;
void
*
p
=
NULL
;
SMetaReader
mr
=
{
0
};
SMetaReader
mr
=
{
0
};
// validate req
// validate req
...
@@ -79,12 +79,12 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
...
@@ -79,12 +79,12 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
metaDebug
(
"vgId:%d super table is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
metaDebug
(
"vgId:%d
,
super table is created, name:%s uid: %"
PRId64
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
return
0
;
return
0
;
_err:
_err:
metaError
(
"vgId:%d failed to create super table: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
metaError
(
"vgId:%d
,
failed to create super table: %s uid: %"
PRId64
" since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
,
tstrerror
(
terrno
));
pReq
->
suid
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -105,7 +105,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq) {
...
@@ -105,7 +105,7 @@ int metaDropSTable(SMeta *pMeta, int64_t verison, SVDropStbReq *pReq) {
}
}
// drop all child tables
// drop all child tables
TBC
*
pCtbIdxc
=
NULL
;
TBC
*
pCtbIdxc
=
NULL
;
SArray
*
pArray
=
taosArrayInit
(
8
,
sizeof
(
tb_uid_t
));
SArray
*
pArray
=
taosArrayInit
(
8
,
sizeof
(
tb_uid_t
));
tdbTbcOpen
(
pMeta
->
pCtbIdx
,
&
pCtbIdxc
,
&
pMeta
->
txn
);
tdbTbcOpen
(
pMeta
->
pCtbIdx
,
&
pCtbIdxc
,
&
pMeta
->
txn
);
...
@@ -153,15 +153,15 @@ _drop_super_table:
...
@@ -153,15 +153,15 @@ _drop_super_table:
_exit:
_exit:
tdbFree
(
pKey
);
tdbFree
(
pKey
);
tdbFree
(
pData
);
tdbFree
(
pData
);
metaDebug
(
"vgId:%d super table %s uid:%"
PRId64
" is dropped"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
metaDebug
(
"vgId:%d
,
super table %s uid:%"
PRId64
" is dropped"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
suid
);
return
0
;
return
0
;
}
}
int
metaAlterSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
int
metaAlterSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
SMetaEntry
oStbEntry
=
{
0
};
SMetaEntry
oStbEntry
=
{
0
};
SMetaEntry
nStbEntry
=
{
0
};
SMetaEntry
nStbEntry
=
{
0
};
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pUidIdxc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
const
void
*
pData
;
const
void
*
pData
;
int
nData
;
int
nData
;
int64_t
oversion
;
int64_t
oversion
;
...
@@ -269,18 +269,18 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
...
@@ -269,18 +269,18 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
metaDebug
(
"vgId:%d table %s uid %"
PRId64
" is created, type:%"
PRId8
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
uid
,
metaDebug
(
"vgId:%d
,
table %s uid %"
PRId64
" is created, type:%"
PRId8
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
uid
,
pReq
->
type
);
pReq
->
type
);
return
0
;
return
0
;
_err:
_err:
metaError
(
"vgId:%d failed to create table:%s type:%s since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
metaError
(
"vgId:%d
,
failed to create table:%s type:%s since %s"
,
TD_VID
(
pMeta
->
pVnode
),
pReq
->
name
,
pReq
->
type
==
TSDB_CHILD_TABLE
?
"child table"
:
"normal table"
,
tstrerror
(
terrno
));
pReq
->
type
==
TSDB_CHILD_TABLE
?
"child table"
:
"normal table"
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
int
metaDropTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVDropTbReq
*
pReq
,
SArray
*
tbUids
)
{
int
metaDropTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVDropTbReq
*
pReq
,
SArray
*
tbUids
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int
nData
=
0
;
int
rc
=
0
;
int
rc
=
0
;
tb_uid_t
uid
;
tb_uid_t
uid
;
...
@@ -306,7 +306,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
...
@@ -306,7 +306,7 @@ int metaDropTable(SMeta *pMeta, int64_t version, SVDropTbReq *pReq, SArray *tbUi
}
}
static
int
metaDropTableByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int
*
type
)
{
static
int
metaDropTableByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int
*
type
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int
nData
=
0
;
int
rc
=
0
;
int
rc
=
0
;
int64_t
version
;
int64_t
version
;
...
@@ -341,15 +341,16 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
...
@@ -341,15 +341,16 @@ static int metaDropTableByUid(SMeta *pMeta, tb_uid_t uid, int *type) {
return
0
;
return
0
;
}
}
static
int
metaAlterTableColumn
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
,
STableMetaRsp
*
pMetaRsp
)
{
static
int
metaAlterTableColumn
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
,
STableMetaRsp
*
pMetaRsp
)
{
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
nVal
=
0
;
int
nVal
=
0
;
const
void
*
pData
=
NULL
;
const
void
*
pData
=
NULL
;
int
nData
=
0
;
int
nData
=
0
;
int
ret
=
0
;
int
ret
=
0
;
tb_uid_t
uid
;
tb_uid_t
uid
;
int64_t
oversion
;
int64_t
oversion
;
SSchema
*
pColumn
=
NULL
;
SSchema
*
pColumn
=
NULL
;
SMetaEntry
entry
=
{
0
};
SMetaEntry
entry
=
{
0
};
SSchemaWrapper
*
pSchema
;
SSchemaWrapper
*
pSchema
;
int
c
;
int
c
;
...
@@ -499,7 +500,7 @@ _err:
...
@@ -499,7 +500,7 @@ _err:
static
int
metaUpdateTableTagVal
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
)
{
static
int
metaUpdateTableTagVal
(
SMeta
*
pMeta
,
int64_t
version
,
SVAlterTbReq
*
pAlterTbReq
)
{
SMetaEntry
ctbEntry
=
{
0
};
SMetaEntry
ctbEntry
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
nVal
=
0
;
int
nVal
=
0
;
int
ret
;
int
ret
;
int
c
;
int
c
;
...
@@ -530,7 +531,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
...
@@ -530,7 +531,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
oversion
=
*
(
int64_t
*
)
pData
;
oversion
=
*
(
int64_t
*
)
pData
;
// search table.db
// search table.db
TBC
*
pTbDbc
=
NULL
;
TBC
*
pTbDbc
=
NULL
;
SDecoder
dc1
=
{
0
};
SDecoder
dc1
=
{
0
};
SDecoder
dc2
=
{
0
};
SDecoder
dc2
=
{
0
};
...
@@ -554,7 +555,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
...
@@ -554,7 +555,7 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
metaDecodeEntry
(
&
dc2
,
&
stbEntry
);
metaDecodeEntry
(
&
dc2
,
&
stbEntry
);
SSchemaWrapper
*
pTagSchema
=
&
stbEntry
.
stbEntry
.
schemaTag
;
SSchemaWrapper
*
pTagSchema
=
&
stbEntry
.
stbEntry
.
schemaTag
;
SSchema
*
pColumn
=
NULL
;
SSchema
*
pColumn
=
NULL
;
int32_t
iCol
=
0
;
int32_t
iCol
=
0
;
for
(;;)
{
for
(;;)
{
pColumn
=
NULL
;
pColumn
=
NULL
;
...
@@ -584,8 +585,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
...
@@ -584,8 +585,8 @@ static int metaUpdateTableTagVal(SMeta *pMeta, int64_t version, SVAlterTbReq *pA
memcpy
((
void
*
)
ctbEntry
.
ctbEntry
.
pTags
,
pAlterTbReq
->
pTagVal
,
pAlterTbReq
->
nTagVal
);
memcpy
((
void
*
)
ctbEntry
.
ctbEntry
.
pTags
,
pAlterTbReq
->
pTagVal
,
pAlterTbReq
->
nTagVal
);
}
else
{
}
else
{
const
STag
*
pOldTag
=
(
const
STag
*
)
ctbEntry
.
ctbEntry
.
pTags
;
const
STag
*
pOldTag
=
(
const
STag
*
)
ctbEntry
.
ctbEntry
.
pTags
;
STag
*
pNewTag
=
NULL
;
STag
*
pNewTag
=
NULL
;
SArray
*
pTagArray
=
taosArrayInit
(
pTagSchema
->
nCols
,
sizeof
(
STagVal
));
SArray
*
pTagArray
=
taosArrayInit
(
pTagSchema
->
nCols
,
sizeof
(
STagVal
));
if
(
!
pTagArray
)
{
if
(
!
pTagArray
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
goto
_err
;
...
@@ -669,8 +670,8 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta
...
@@ -669,8 +670,8 @@ int metaAlterTable(SMeta *pMeta, int64_t version, SVAlterTbReq *pReq, STableMeta
static
int
metaSaveToTbDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
static
int
metaSaveToTbDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
STbDbKey
tbDbKey
;
STbDbKey
tbDbKey
;
void
*
pKey
=
NULL
;
void
*
pKey
=
NULL
;
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
kLen
=
0
;
int
kLen
=
0
;
int
vLen
=
0
;
int
vLen
=
0
;
SEncoder
coder
=
{
0
};
SEncoder
coder
=
{
0
};
...
@@ -753,16 +754,11 @@ static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -753,16 +754,11 @@ static int metaUpdateCtbIdx(SMeta *pMeta, const SMetaEntry *pME) {
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int32_t
nTagData
,
int8_t
type
,
tb_uid_t
uid
,
int
metaCreateTagIdxKey
(
tb_uid_t
suid
,
int32_t
cid
,
const
void
*
pTagData
,
int32_t
nTagData
,
int8_t
type
,
tb_uid_t
uid
,
STagIdxKey
**
ppTagIdxKey
,
int32_t
*
nTagIdxKey
)
{
STagIdxKey
**
ppTagIdxKey
,
int32_t
*
nTagIdxKey
)
{
// int32_t nTagData = 0;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
*
nTagIdxKey
=
sizeof
(
STagIdxKey
)
+
nTagData
+
VARSTR_HEADER_SIZE
+
sizeof
(
tb_uid_t
);
// if (pTagData) {
}
else
{
// if (IS_VAR_DATA_TYPE(type)) {
*
nTagIdxKey
=
sizeof
(
STagIdxKey
)
+
nTagData
+
sizeof
(
tb_uid_t
);
// nTagData = varDataTLen(pTagData);
}
// } else {
// nTagData = tDataTypes[type].bytes;
// }
// }
*
nTagIdxKey
=
sizeof
(
STagIdxKey
)
+
nTagData
+
sizeof
(
tb_uid_t
);
*
ppTagIdxKey
=
(
STagIdxKey
*
)
taosMemoryMalloc
(
*
nTagIdxKey
);
*
ppTagIdxKey
=
(
STagIdxKey
*
)
taosMemoryMalloc
(
*
nTagIdxKey
);
if
(
*
ppTagIdxKey
==
NULL
)
{
if
(
*
ppTagIdxKey
==
NULL
)
{
...
@@ -774,8 +770,16 @@ int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_
...
@@ -774,8 +770,16 @@ int metaCreateTagIdxKey(tb_uid_t suid, int32_t cid, const void *pTagData, int32_
(
*
ppTagIdxKey
)
->
cid
=
cid
;
(
*
ppTagIdxKey
)
->
cid
=
cid
;
(
*
ppTagIdxKey
)
->
isNull
=
(
pTagData
==
NULL
)
?
1
:
0
;
(
*
ppTagIdxKey
)
->
isNull
=
(
pTagData
==
NULL
)
?
1
:
0
;
(
*
ppTagIdxKey
)
->
type
=
type
;
(
*
ppTagIdxKey
)
->
type
=
type
;
if
(
nTagData
)
memcpy
((
*
ppTagIdxKey
)
->
data
,
pTagData
,
nTagData
);
*
(
tb_uid_t
*
)((
*
ppTagIdxKey
)
->
data
+
nTagData
)
=
uid
;
// refactor
if
(
IS_VAR_DATA_TYPE
(
type
))
{
memcpy
((
*
ppTagIdxKey
)
->
data
,
(
uint16_t
*
)
&
nTagData
,
VARSTR_HEADER_SIZE
);
memcpy
((
*
ppTagIdxKey
)
->
data
+
VARSTR_HEADER_SIZE
,
pTagData
,
nTagData
);
*
(
tb_uid_t
*
)((
*
ppTagIdxKey
)
->
data
+
VARSTR_HEADER_SIZE
+
nTagData
)
=
uid
;
}
else
{
memcpy
((
*
ppTagIdxKey
)
->
data
,
pTagData
,
nTagData
);
*
(
tb_uid_t
*
)((
*
ppTagIdxKey
)
->
data
+
nTagData
)
=
uid
;
}
return
0
;
return
0
;
}
}
...
@@ -785,14 +789,14 @@ static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey) {
...
@@ -785,14 +789,14 @@ static void metaDestroyTagIdxKey(STagIdxKey *pTagIdxKey) {
}
}
static
int
metaUpdateTagIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
)
{
static
int
metaUpdateTagIdx
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pCtbEntry
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int
nData
=
0
;
STbDbKey
tbDbKey
=
{
0
};
STbDbKey
tbDbKey
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
SMetaEntry
stbEntry
=
{
0
};
STagIdxKey
*
pTagIdxKey
=
NULL
;
STagIdxKey
*
pTagIdxKey
=
NULL
;
int32_t
nTagIdxKey
;
int32_t
nTagIdxKey
;
const
SSchema
*
pTagColumn
;
// = &stbEntry.stbEntry.schema.pSchema[0];
const
SSchema
*
pTagColumn
;
// = &stbEntry.stbEntry.schema.pSchema[0];
const
void
*
pTagData
=
NULL
;
//
const
void
*
pTagData
=
NULL
;
//
int32_t
nTagData
=
0
;
int32_t
nTagData
=
0
;
SDecoder
dc
=
{
0
};
SDecoder
dc
=
{
0
};
...
@@ -849,7 +853,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
...
@@ -849,7 +853,7 @@ static int metaUpdateTagIdx(SMeta *pMeta, const SMetaEntry *pCtbEntry) {
static
int
metaSaveToSkmDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
static
int
metaSaveToSkmDb
(
SMeta
*
pMeta
,
const
SMetaEntry
*
pME
)
{
SEncoder
coder
=
{
0
};
SEncoder
coder
=
{
0
};
void
*
pVal
=
NULL
;
void
*
pVal
=
NULL
;
int
vLen
=
0
;
int
vLen
=
0
;
int
rcode
=
0
;
int
rcode
=
0
;
SSkmDbKey
skmDbKey
=
{
0
};
SSkmDbKey
skmDbKey
=
{
0
};
...
...
source/dnode/vnode/src/sma/sma.c
浏览文件 @
4b9ea626
...
@@ -20,7 +20,7 @@ int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg) {
...
@@ -20,7 +20,7 @@ int32_t tdProcessTSmaInsert(SSma* pSma, int64_t indexUid, const char* msg) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdProcessTSmaInsertImpl
(
pSma
,
indexUid
,
msg
))
<
0
)
{
if
((
code
=
tdProcessTSmaInsertImpl
(
pSma
,
indexUid
,
msg
))
<
0
)
{
smaWarn
(
"vgId:%d insert tsma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
insert tsma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
// TODO: destroy SSDataBlocks(msg)
// TODO: destroy SSDataBlocks(msg)
return
code
;
return
code
;
...
@@ -30,7 +30,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
...
@@ -30,7 +30,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdProcessTSmaCreateImpl
(
pSma
,
version
,
msg
))
<
0
)
{
if
((
code
=
tdProcessTSmaCreateImpl
(
pSma
,
version
,
msg
))
<
0
)
{
smaWarn
(
"vgId:%d create tsma failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
create tsma failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
// TODO: destroy SSDataBlocks(msg)
// TODO: destroy SSDataBlocks(msg)
return
code
;
return
code
;
...
@@ -39,7 +39,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
...
@@ -39,7 +39,7 @@ int32_t tdProcessTSmaCreate(SSma* pSma, int64_t version, const char* msg) {
int32_t
tdUpdateExpireWindow
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
int32_t
tdUpdateExpireWindow
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdUpdateExpiredWindowImpl
(
pSma
,
pMsg
,
version
))
<
0
)
{
if
((
code
=
tdUpdateExpiredWindowImpl
(
pSma
,
pMsg
,
version
))
<
0
)
{
smaWarn
(
"vgId:%d update expired sma window failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
update expired sma window failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
return
code
;
return
code
;
}
}
...
@@ -47,7 +47,15 @@ int32_t tdUpdateExpireWindow(SSma* pSma, const SSubmitReq* pMsg, int64_t version
...
@@ -47,7 +47,15 @@ int32_t tdUpdateExpireWindow(SSma* pSma, const SSubmitReq* pMsg, int64_t version
int32_t
tdGetTSmaData
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
)
{
int32_t
tdGetTSmaData
(
SSma
*
pSma
,
char
*
pData
,
int64_t
indexUid
,
TSKEY
querySKey
,
int32_t
nMaxResult
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdGetTSmaDataImpl
(
pSma
,
pData
,
indexUid
,
querySKey
,
nMaxResult
))
<
0
)
{
if
((
code
=
tdGetTSmaDataImpl
(
pSma
,
pData
,
indexUid
,
querySKey
,
nMaxResult
))
<
0
)
{
smaWarn
(
"vgId:%d get tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d, get tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
return
code
;
}
int32_t
smaGetTSmaDays
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdGetTSmaDaysImpl
(
pCfg
,
pCont
,
contLen
,
days
))
<
0
)
{
smaWarn
(
"vgId:%d get tSma days failed since %s"
,
pCfg
->
vgId
,
tstrerror
(
terrno
));
}
}
return
code
;
return
code
;
}
}
source/dnode/vnode/src/sma/smaEnv.c
浏览文件 @
4b9ea626
...
@@ -222,7 +222,7 @@ int32_t tdRefSmaStat(SSma *pSma, SSmaStat *pStat) {
...
@@ -222,7 +222,7 @@ int32_t tdRefSmaStat(SSma *pSma, SSmaStat *pStat) {
if
(
!
pStat
)
return
0
;
if
(
!
pStat
)
return
0
;
int
ref
=
T_REF_INC
(
pStat
);
int
ref
=
T_REF_INC
(
pStat
);
smaDebug
(
"vgId:%d ref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
smaDebug
(
"vgId:%d
,
ref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
return
0
;
return
0
;
}
}
...
@@ -230,7 +230,7 @@ int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
...
@@ -230,7 +230,7 @@ int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
if
(
!
pStat
)
return
0
;
if
(
!
pStat
)
return
0
;
int
ref
=
T_REF_DEC
(
pStat
);
int
ref
=
T_REF_DEC
(
pStat
);
smaDebug
(
"vgId:%d unref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
smaDebug
(
"vgId:%d
,
unref sma stat:%p, val:%d"
,
SMA_VID
(
pSma
),
pStat
,
ref
);
return
0
;
return
0
;
}
}
...
@@ -278,7 +278,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
...
@@ -278,7 +278,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
void
*
tdFreeSmaStatItem
(
SSmaStatItem
*
pSmaStatItem
)
{
void
*
tdFreeSmaStatItem
(
SSmaStatItem
*
pSmaStatItem
)
{
if
(
pSmaStatItem
)
{
if
(
pSmaStatItem
)
{
t
d
DestroyTSma
(
pSmaStatItem
->
pTSma
);
tDestroyTSma
(
pSmaStatItem
->
pTSma
);
taosMemoryFreeClear
(
pSmaStatItem
->
pTSma
);
taosMemoryFreeClear
(
pSmaStatItem
->
pTSma
);
taosHashCleanup
(
pSmaStatItem
->
expiredWindows
);
taosHashCleanup
(
pSmaStatItem
->
expiredWindows
);
taosMemoryFreeClear
(
pSmaStatItem
);
taosMemoryFreeClear
(
pSmaStatItem
);
...
@@ -321,7 +321,7 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
...
@@ -321,7 +321,7 @@ int32_t tdDestroySmaState(SSmaStat *pSmaStat, int8_t smaType) {
int32_t
tdLockSma
(
SSma
*
pSma
)
{
int32_t
tdLockSma
(
SSma
*
pSma
)
{
int
code
=
taosThreadMutexLock
(
&
pSma
->
mutex
);
int
code
=
taosThreadMutexLock
(
&
pSma
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
smaError
(
"vgId:%d failed to lock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
smaError
(
"vgId:%d
,
failed to lock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
@@ -334,7 +334,7 @@ int32_t tdUnLockSma(SSma *pSma) {
...
@@ -334,7 +334,7 @@ int32_t tdUnLockSma(SSma *pSma) {
pSma
->
locked
=
false
;
pSma
->
locked
=
false
;
int
code
=
taosThreadMutexUnlock
(
&
pSma
->
mutex
);
int
code
=
taosThreadMutexUnlock
(
&
pSma
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
smaError
(
"vgId:%d failed to unlock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
smaError
(
"vgId:%d
,
failed to unlock td since %s"
,
SMA_VID
(
pSma
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
@@ -376,7 +376,7 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) {
...
@@ -376,7 +376,7 @@ int32_t tdCheckAndInitSmaEnv(SSma *pSma, int8_t smaType) {
if
(
did
.
level
<
0
||
did
.
id
<
0
)
{
if
(
did
.
level
<
0
||
did
.
id
<
0
)
{
tdUnLockSma
(
pSma
);
tdUnLockSma
(
pSma
);
smaError
(
"vgId:%d init sma env failed since invalid did(%d,%d)"
,
SMA_VID
(
pSma
),
did
.
level
,
did
.
id
);
smaError
(
"vgId:%d
,
init sma env failed since invalid did(%d,%d)"
,
SMA_VID
(
pSma
),
did
.
level
,
did
.
id
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
4b9ea626
...
@@ -58,30 +58,30 @@ static FORCE_INLINE int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SA
...
@@ -58,30 +58,30 @@ static FORCE_INLINE int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SA
if
(
!
suid
||
!
tbUids
)
{
if
(
!
suid
||
!
tbUids
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaError
(
"vgId:%d failed to get rsma info for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
failed to get rsma info for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
suid
,
sizeof
(
tb_uid_t
));
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
smaError
(
"vgId:%d failed to get rsma info for uid:%"
PRIi64
,
SMA_VID
(
pSma
),
*
suid
);
smaError
(
"vgId:%d
,
failed to get rsma info for uid:%"
PRIi64
,
SMA_VID
(
pSma
),
*
suid
);
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
if
(
pRSmaInfo
->
taskInfo
[
0
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
0
],
tbUids
,
true
)
!=
0
))
{
if
(
pRSmaInfo
->
taskInfo
[
0
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
0
],
tbUids
,
true
)
!=
0
))
{
smaError
(
"vgId:%d update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
else
{
}
else
{
smaDebug
(
"vgId:%d update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
smaDebug
(
"vgId:%d
,
update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
pRSmaInfo
->
taskInfo
[
0
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
pRSmaInfo
->
taskInfo
[
0
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
}
}
if
(
pRSmaInfo
->
taskInfo
[
1
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
1
],
tbUids
,
true
)
!=
0
))
{
if
(
pRSmaInfo
->
taskInfo
[
1
]
&&
(
qUpdateQualifiedTableId
(
pRSmaInfo
->
taskInfo
[
1
],
tbUids
,
true
)
!=
0
))
{
smaError
(
"vgId:%d update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
update tbUidList failed for uid:%"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
*
suid
,
terrstr
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
else
{
}
else
{
smaDebug
(
"vgId:%d update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
smaDebug
(
"vgId:%d
,
update tbUidList succeed for qTaskInfo:%p with suid:%"
PRIi64
", uid:%"
PRIi64
,
SMA_VID
(
pSma
),
pRSmaInfo
->
taskInfo
[
1
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
pRSmaInfo
->
taskInfo
[
1
],
*
suid
,
*
(
int64_t
*
)
taosArrayGet
(
tbUids
,
0
));
}
}
...
@@ -170,14 +170,14 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -170,14 +170,14 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
SMeta
*
pMeta
=
pVnode
->
pMeta
;
SMeta
*
pMeta
=
pVnode
->
pMeta
;
SMsgCb
*
pMsgCb
=
&
pVnode
->
msgCb
;
SMsgCb
*
pMsgCb
=
&
pVnode
->
msgCb
;
if
(
!
pReq
->
rollup
)
{
if
(
!
pReq
->
rollup
)
{
smaTrace
(
"vgId:%d return directly since no rollup for stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
smaTrace
(
"vgId:%d
,
return directly since no rollup for stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
SRSmaParam
*
param
=
&
pReq
->
pRSmaParam
;
SRSmaParam
*
param
=
&
pReq
->
pRSmaParam
;
if
((
param
->
qmsg1Len
==
0
)
&&
(
param
->
qmsg2Len
==
0
))
{
if
((
param
->
qmsg1Len
==
0
)
&&
(
param
->
qmsg2Len
==
0
))
{
smaWarn
(
"vgId:%d no qmsg1/qmsg2 for rollup stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
smaWarn
(
"vgId:%d
,
no qmsg1/qmsg2 for rollup stable %s %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -192,7 +192,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -192,7 +192,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
));
if
(
pRSmaInfo
)
{
if
(
pRSmaInfo
)
{
smaWarn
(
"vgId:%d rsma info already exists for stb: %s, %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
smaWarn
(
"vgId:%d
,
rsma info already exists for stb: %s, %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -238,7 +238,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -238,7 +238,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
TSDB_CODE_SUCCESS
)
{
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
else
{
}
else
{
smaDebug
(
"vgId:%d register rsma info succeed for suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
suid
);
smaDebug
(
"vgId:%d
,
register rsma info succeed for suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
suid
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -372,11 +372,11 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
...
@@ -372,11 +372,11 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
SArray
*
pResult
=
NULL
;
SArray
*
pResult
=
NULL
;
if
(
!
taskInfo
)
{
if
(
!
taskInfo
)
{
smaDebug
(
"vgId:%d no qTaskInfo to execute rsma %"
PRIi8
" task for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
suid
);
smaDebug
(
"vgId:%d
,
no qTaskInfo to execute rsma %"
PRIi8
" task for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
smaDebug
(
"vgId:%d execute rsma %"
PRIi8
" task for qTaskInfo:%p suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
taskInfo
,
suid
);
smaDebug
(
"vgId:%d
,
execute rsma %"
PRIi8
" task for qTaskInfo:%p suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
taskInfo
,
suid
);
qSetStreamInput
(
taskInfo
,
pMsg
,
inputType
,
true
);
qSetStreamInput
(
taskInfo
,
pMsg
,
inputType
,
true
);
while
(
1
)
{
while
(
1
)
{
...
@@ -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
{
smaDebug
(
"vgId:%d no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
smaDebug
(
"vgId:%d
,
no rsma % "
PRIi8
" data generated since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
}
}
taosArrayDestroy
(
pResult
);
taosArrayDestroy
(
pResult
);
...
@@ -435,11 +435,11 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
...
@@ -435,11 +435,11 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_STAT_INFO_HASH
(
pStat
),
&
suid
,
sizeof
(
tb_uid_t
));
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
smaDebug
(
"vgId:%d no rsma info for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
smaDebug
(
"vgId:%d
,
no rsma info for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
!
pRSmaInfo
->
taskInfo
[
0
])
{
if
(
!
pRSmaInfo
->
taskInfo
[
0
])
{
smaDebug
(
"vgId:%d no rsma qTaskInfo for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
smaDebug
(
"vgId:%d
,
no rsma qTaskInfo for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/dnode/vnode/src/sma/smaTimeRange.c
浏览文件 @
4b9ea626
...
@@ -326,13 +326,13 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -326,13 +326,13 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
if
(
!
pDataBlocks
)
{
if
(
!
pDataBlocks
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaWarn
(
"vgId:%d insert tSma data failed since pDataBlocks is NULL"
,
SMA_VID
(
pSma
));
smaWarn
(
"vgId:%d
,
insert tSma data failed since pDataBlocks is NULL"
,
SMA_VID
(
pSma
));
return
terrno
;
return
terrno
;
}
}
if
(
taosArrayGetSize
(
pDataBlocks
)
<=
0
)
{
if
(
taosArrayGetSize
(
pDataBlocks
)
<=
0
)
{
terrno
=
TSDB_CODE_INVALID_PARA
;
terrno
=
TSDB_CODE_INVALID_PARA
;
smaWarn
(
"vgId:%d insert tSma data failed since pDataBlocks is empty"
,
SMA_VID
(
pSma
));
smaWarn
(
"vgId:%d
,
insert tSma data failed since pDataBlocks is empty"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -487,11 +487,11 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -487,11 +487,11 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
smaCloseDBF
(
&
tSmaH
.
dFile
);
smaCloseDBF
(
&
tSmaH
.
dFile
);
}
}
tdSetTSmaDataFile
(
&
tSmaH
,
indexUid
,
fid
);
tdSetTSmaDataFile
(
&
tSmaH
,
indexUid
,
fid
);
smaDebug
(
"
@@@ vgId:%d
write to DBF %s, days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi32
smaDebug
(
"
vgId:%d,
write to DBF %s, days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi32
" queryKey:%"
PRIi64
,
" queryKey:%"
PRIi64
,
SMA_VID
(
pSma
),
tSmaH
.
dFile
.
path
,
minutePerFile
,
tSmaH
.
interval
,
storageLevel
,
testSkey
);
SMA_VID
(
pSma
),
tSmaH
.
dFile
.
path
,
minutePerFile
,
tSmaH
.
interval
,
storageLevel
,
testSkey
);
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tSmaH
.
dFile
)
!=
0
)
{
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tSmaH
.
dFile
)
!=
0
)
{
smaWarn
(
"vgId:%d open DB file %s failed since %s"
,
SMA_VID
(
pSma
),
smaWarn
(
"vgId:%d
,
open DB file %s failed since %s"
,
SMA_VID
(
pSma
),
tSmaH
.
dFile
.
path
?
tSmaH
.
dFile
.
path
:
"path is NULL"
,
tstrerror
(
terrno
));
tSmaH
.
dFile
.
path
?
tSmaH
.
dFile
.
path
:
"path is NULL"
,
tstrerror
(
terrno
));
tdDestroyTSmaWriteH
(
&
tSmaH
);
tdDestroyTSmaWriteH
(
&
tSmaH
);
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
...
@@ -501,7 +501,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -501,7 +501,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
}
}
if
(
tdInsertTSmaBlocks
(
&
tSmaH
,
&
smaKey
,
SMA_KEY_LEN
,
dataBuf
,
tlen
,
&
pEnv
->
txn
)
!=
0
)
{
if
(
tdInsertTSmaBlocks
(
&
tSmaH
,
&
smaKey
,
SMA_KEY_LEN
,
dataBuf
,
tlen
,
&
pEnv
->
txn
)
!=
0
)
{
smaWarn
(
"vgId:%d insert tsma data blocks fail for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
smaWarn
(
"vgId:%d
,
insert tsma data blocks fail for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
" since %s"
,
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
,
tstrerror
(
terrno
));
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
,
tstrerror
(
terrno
));
tdSmaEndCommit
(
pEnv
);
tdSmaEndCommit
(
pEnv
);
...
@@ -510,14 +510,14 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -510,14 +510,14 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d insert tsma data blocks success for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
,
smaDebug
(
"vgId:%d
,
insert tsma data blocks success for index %"
PRIi64
", skey %"
PRIi64
", groupId %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
);
SMA_VID
(
pSma
),
indexUid
,
skey
,
groupId
);
// TODO:tsdbEndTSmaCommit();
// TODO:tsdbEndTSmaCommit();
// Step 3: reset the SSmaStat
// Step 3: reset the SSmaStat
tdResetExpiredWindow
(
pSma
,
pStat
,
indexUid
,
skey
);
tdResetExpiredWindow
(
pSma
,
pStat
,
indexUid
,
skey
);
}
else
{
}
else
{
smaWarn
(
"vgId:%d invalid data skey:%"
PRIi64
", tlen %"
PRIi32
" during insert tSma data for %"
PRIi64
,
smaWarn
(
"vgId:%d
,
invalid data skey:%"
PRIi64
", tlen %"
PRIi32
" during insert tSma data for %"
PRIi64
,
SMA_VID
(
pSma
),
skey
,
tlen
,
indexUid
);
SMA_VID
(
pSma
),
skey
,
tlen
,
indexUid
);
}
}
}
}
...
@@ -532,7 +532,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -532,7 +532,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
int32_t
tdDropTSmaData
(
SSma
*
pSma
,
int64_t
indexUid
)
{
int32_t
tdDropTSmaData
(
SSma
*
pSma
,
int64_t
indexUid
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
if
((
code
=
tdDropTSmaDataImpl
(
pSma
,
indexUid
))
<
0
)
{
if
((
code
=
tdDropTSmaDataImpl
(
pSma
,
indexUid
))
<
0
)
{
smaWarn
(
"vgId:%d drop tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
drop tSma data failed since %s"
,
SMA_VID
(
pSma
),
tstrerror
(
terrno
));
}
}
return
code
;
return
code
;
}
}
...
@@ -553,11 +553,11 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
...
@@ -553,11 +553,11 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
// TODO: insert tsma data blocks into B+Tree(TTB)
// TODO: insert tsma data blocks into B+Tree(TTB)
if
(
smaSaveSmaToDB
(
pDBFile
,
smaKey
,
keyLen
,
pData
,
dataLen
,
txn
)
!=
0
)
{
if
(
smaSaveSmaToDB
(
pDBFile
,
smaKey
,
keyLen
,
pData
,
dataLen
,
txn
)
!=
0
)
{
smaWarn
(
"vgId:%d insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" fail"
,
smaWarn
(
"vgId:%d
,
insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" fail"
,
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" succeed"
,
smaDebug
(
"vgId:%d
,
insert tsma data blocks into %s: smaKey %"
PRIx64
"-%"
PRIx64
", dataLen %"
PRIu32
" succeed"
,
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
SMA_VID
(
pSmaH
->
pSma
),
pDBFile
->
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
dataLen
);
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
...
@@ -565,7 +565,7 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
...
@@ -565,7 +565,7 @@ static int32_t tdInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, int32_t keyL
void
*
data
=
tdGetSmaDataByKey
(
pDBFile
,
smaKey
,
keyLen
,
&
valueSize
);
void
*
data
=
tdGetSmaDataByKey
(
pDBFile
,
smaKey
,
keyLen
,
&
valueSize
);
ASSERT
(
data
!=
NULL
);
ASSERT
(
data
!=
NULL
);
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
smaWarn
(
"vgId:%d insert sma data val[%d] %"
PRIi64
,
REPO_ID
(
pSmaH
->
pTsdb
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
data
,
v
));
smaWarn
(
"vgId:%d
,
insert sma data val[%d] %"
PRIi64
,
REPO_ID
(
pSmaH
->
pTsdb
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
data
,
v
));
}
}
#endif
#endif
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -594,11 +594,11 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
...
@@ -594,11 +594,11 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
if
(
taosHashRemove
(
pItem
->
expiredWindows
,
&
skey
,
sizeof
(
TSKEY
))
!=
0
)
{
if
(
taosHashRemove
(
pItem
->
expiredWindows
,
&
skey
,
sizeof
(
TSKEY
))
!=
0
)
{
// error handling
// error handling
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
smaWarn
(
"vgId:%d remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" fail"
,
SMA_VID
(
pSma
),
skey
,
smaWarn
(
"vgId:%d
,
remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" fail"
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
indexUid
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" succeed"
,
SMA_VID
(
pSma
),
smaDebug
(
"vgId:%d
,
remove skey %"
PRIi64
" from expired window for sma index %"
PRIi64
" succeed"
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
skey
,
indexUid
);
// TODO: use a standalone interface to received state upate notification from stream computing module.
// TODO: use a standalone interface to received state upate notification from stream computing module.
/**
/**
...
@@ -612,7 +612,7 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
...
@@ -612,7 +612,7 @@ static int32_t tdResetExpiredWindow(SSma *pSma, SSmaStat *pStat, int64_t indexUi
}
else
{
}
else
{
// error handling
// error handling
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
smaWarn
(
"vgId:%d expired window %"
PRIi64
" not exists for sma index %"
PRIi64
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
smaWarn
(
"vgId:%d
,
expired window %"
PRIi64
" not exists for sma index %"
PRIi64
,
SMA_VID
(
pSma
),
skey
,
indexUid
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -632,19 +632,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
...
@@ -632,19 +632,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
// clear local cache
// clear local cache
if
(
pEnv
)
{
if
(
pEnv
)
{
smaDebug
(
"vgId:%d drop tSma local cache for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
drop tSma local cache for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
SSmaStatItem
*
pItem
=
taosHashGet
(
SMA_ENV_STAT_ITEMS
(
pEnv
),
&
indexUid
,
sizeof
(
indexUid
));
SSmaStatItem
*
pItem
=
taosHashGet
(
SMA_ENV_STAT_ITEMS
(
pEnv
),
&
indexUid
,
sizeof
(
indexUid
));
if
((
pItem
)
||
((
pItem
=
*
(
SSmaStatItem
**
)
pItem
)))
{
if
((
pItem
)
||
((
pItem
=
*
(
SSmaStatItem
**
)
pItem
)))
{
if
(
tdSmaStatIsDropped
(
pItem
))
{
if
(
tdSmaStatIsDropped
(
pItem
))
{
smaDebug
(
"vgId:%d tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
}
}
tdWLockSmaEnv
(
pEnv
);
tdWLockSmaEnv
(
pEnv
);
if
(
tdSmaStatIsDropped
(
pItem
))
{
if
(
tdSmaStatIsDropped
(
pItem
))
{
tdUnLockSmaEnv
(
pEnv
);
tdUnLockSmaEnv
(
pEnv
);
smaDebug
(
"vgId:%d tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
tSma stat is already dropped for %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
return
TSDB_CODE_TDB_INVALID_ACTION
;
// TODO: duplicate drop msg would be intercepted by mnode
}
}
tdSmaStatSetDropped
(
pItem
);
tdSmaStatSetDropped
(
pItem
);
...
@@ -654,19 +654,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
...
@@ -654,19 +654,19 @@ static int32_t tdDropTSmaDataImpl(SSma *pSma, int64_t indexUid) {
int32_t
refVal
=
INT32_MAX
;
int32_t
refVal
=
INT32_MAX
;
while
(
true
)
{
while
(
true
)
{
if
((
refVal
=
T_REF_VAL_GET
(
SMA_ENV_STAT
(
pEnv
)))
<=
0
)
{
if
((
refVal
=
T_REF_VAL_GET
(
SMA_ENV_STAT
(
pEnv
)))
<=
0
)
{
smaDebug
(
"vgId:%d drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
smaDebug
(
"vgId:%d
,
drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
break
;
break
;
}
}
smaDebug
(
"vgId:%d wait 1s to drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
smaDebug
(
"vgId:%d
,
wait 1s to drop index %"
PRIi64
" since refVal=%d"
,
SMA_VID
(
pSma
),
indexUid
,
refVal
);
taosSsleep
(
1
);
taosSsleep
(
1
);
if
(
++
nSleep
>
SMA_DROP_EXPIRED_TIME
)
{
if
(
++
nSleep
>
SMA_DROP_EXPIRED_TIME
)
{
smaDebug
(
"vgId:%d drop index %"
PRIi64
" after wait %d (refVal=%d)"
,
SMA_VID
(
pSma
),
indexUid
,
nSleep
,
refVal
);
smaDebug
(
"vgId:%d
,
drop index %"
PRIi64
" after wait %d (refVal=%d)"
,
SMA_VID
(
pSma
),
indexUid
,
nSleep
,
refVal
);
break
;
break
;
};
};
}
}
tdFreeSmaStatItem
(
pItem
);
tdFreeSmaStatItem
(
pItem
);
smaDebug
(
"vgId:%d getTSmaDataImpl failed since no index %"
PRIi64
" in local cache"
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
getTSmaDataImpl failed since no index %"
PRIi64
" in local cache"
,
SMA_VID
(
pSma
),
indexUid
);
}
}
}
}
// clear sma data files
// clear sma data files
...
@@ -690,7 +690,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -690,7 +690,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
if
(
!
pEnv
)
{
if
(
!
pEnv
)
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaWarn
(
"vgId:%d getTSmaDataImpl failed since pTSmaEnv is NULL"
,
SMA_VID
(
pSma
));
smaWarn
(
"vgId:%d
,
getTSmaDataImpl failed since pTSmaEnv is NULL"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -703,7 +703,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -703,7 +703,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
// it's NULL.
// it's NULL.
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
terrno
=
TSDB_CODE_TDB_INVALID_ACTION
;
terrno
=
TSDB_CODE_TDB_INVALID_ACTION
;
smaDebug
(
"vgId:%d getTSmaDataImpl failed since no index %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
smaDebug
(
"vgId:%d
,
getTSmaDataImpl failed since no index %"
PRIi64
,
SMA_VID
(
pSma
),
indexUid
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -722,17 +722,17 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -722,17 +722,17 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
if
(
!
tdSmaStatIsOK
(
pItem
,
&
smaStat
))
{
// TODO: multiple check for large scale sma query
if
(
!
tdSmaStatIsOK
(
pItem
,
&
smaStat
))
{
// TODO: multiple check for large scale sma query
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
terrno
=
TSDB_CODE_TDB_INVALID_SMA_STAT
;
smaWarn
(
"vgId:%d getTSmaDataImpl failed from index %"
PRIi64
" since %s %"
PRIi8
,
SMA_VID
(
pSma
),
indexUid
,
smaWarn
(
"vgId:%d
,
getTSmaDataImpl failed from index %"
PRIi64
" since %s %"
PRIi8
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
),
smaStat
);
tstrerror
(
terrno
),
smaStat
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
if
(
taosHashGet
(
pItem
->
expiredWindows
,
&
querySKey
,
sizeof
(
TSKEY
)))
{
if
(
taosHashGet
(
pItem
->
expiredWindows
,
&
querySKey
,
sizeof
(
TSKEY
)))
{
// TODO: mark this window as expired.
// TODO: mark this window as expired.
smaDebug
(
"vgId:%d skey %"
PRIi64
" of window exists in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
smaDebug
(
"vgId:%d
,
skey %"
PRIi64
" of window exists in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
indexUid
);
indexUid
);
}
else
{
}
else
{
smaDebug
(
"vgId:%d skey %"
PRIi64
" of window not in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
smaDebug
(
"vgId:%d
,
skey %"
PRIi64
" of window not in expired window for index %"
PRIi64
,
SMA_VID
(
pSma
),
querySKey
,
indexUid
);
indexUid
);
}
}
...
@@ -750,7 +750,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -750,7 +750,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
smaDebug
(
"### vgId:%d read from DBF %s days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi8
" queryKey:%"
PRIi64
,
smaDebug
(
"### vgId:%d read from DBF %s days:%d, interval:%"
PRIi64
", storageLevel:%"
PRIi8
" queryKey:%"
PRIi64
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tReadH
.
days
,
tReadH
.
interval
,
tReadH
.
storageLevel
,
querySKey
);
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tReadH
.
days
,
tReadH
.
interval
,
tReadH
.
storageLevel
,
querySKey
);
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tReadH
.
dFile
)
!=
0
)
{
if
(
smaOpenDBF
(
pEnv
->
dbEnv
,
&
tReadH
.
dFile
)
!=
0
)
{
smaWarn
(
"vgId:%d open DBF %s failed since %s"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tstrerror
(
terrno
));
smaWarn
(
"vgId:%d
,
open DBF %s failed since %s"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
tstrerror
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -759,13 +759,13 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -759,13 +759,13 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
int64_t
queryGroupId
=
0
;
int64_t
queryGroupId
=
0
;
tdEncodeTSmaKey
(
queryGroupId
,
querySKey
,
(
void
**
)
&
pSmaKey
);
tdEncodeTSmaKey
(
queryGroupId
,
querySKey
,
(
void
**
)
&
pSmaKey
);
smaDebug
(
"vgId:%d get sma data from %s: smaKey %"
PRIx64
"-%"
PRIx64
", keyLen %d"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
smaDebug
(
"vgId:%d
,
get sma data from %s: smaKey %"
PRIx64
"-%"
PRIx64
", keyLen %d"
,
SMA_VID
(
pSma
),
tReadH
.
dFile
.
path
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
SMA_KEY_LEN
);
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
SMA_KEY_LEN
);
void
*
result
=
NULL
;
void
*
result
=
NULL
;
int32_t
valueSize
=
0
;
int32_t
valueSize
=
0
;
if
(
!
(
result
=
smaGetSmaDataByKey
(
&
tReadH
.
dFile
,
smaKey
,
SMA_KEY_LEN
,
&
valueSize
)))
{
if
(
!
(
result
=
smaGetSmaDataByKey
(
&
tReadH
.
dFile
,
smaKey
,
SMA_KEY_LEN
,
&
valueSize
)))
{
smaWarn
(
"vgId:%d get sma data failed from smaIndex %"
PRIi64
", smaKey %"
PRIx64
"-%"
PRIx64
" since %s"
,
smaWarn
(
"vgId:%d
,
get sma data failed from smaIndex %"
PRIi64
", smaKey %"
PRIx64
"-%"
PRIx64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
tstrerror
(
terrno
));
SMA_VID
(
pSma
),
indexUid
,
*
(
int64_t
*
)
smaKey
,
*
(
int64_t
*
)
POINTER_SHIFT
(
smaKey
,
8
),
tstrerror
(
terrno
));
smaCloseDBF
(
&
tReadH
.
dFile
);
smaCloseDBF
(
&
tReadH
.
dFile
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
...
@@ -774,7 +774,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
...
@@ -774,7 +774,7 @@ int32_t tdGetTSmaDataImpl(SSma *pSma, char *pData, int64_t indexUid, TSKEY query
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
#ifdef _TEST_SMA_PRINT_DEBUG_LOG_
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
for
(
uint32_t
v
=
0
;
v
<
valueSize
;
v
+=
8
)
{
smaWarn
(
"vgId:%d get sma data v[%d]=%"
PRIi64
,
SMA_VID
(
pSma
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
result
,
v
));
smaWarn
(
"vgId:%d
,
get sma data v[%d]=%"
PRIi64
,
SMA_VID
(
pSma
),
v
,
*
(
int64_t
*
)
POINTER_SHIFT
(
result
,
v
));
}
}
#endif
#endif
taosMemoryFreeClear
(
result
);
// TODO: fill the result to output
taosMemoryFreeClear
(
result
);
// TODO: fill the result to output
...
@@ -828,7 +828,7 @@ int32_t tdDropTSma(SSma *pSma, char *pMsg) {
...
@@ -828,7 +828,7 @@ int32_t tdDropTSma(SSma *pSma, char *pMsg) {
// TODO: send msg to stream computing to drop tSma
// TODO: send msg to stream computing to drop tSma
// if ((send msg to stream computing) < 0) {
// if ((send msg to stream computing) < 0) {
// t
d
DestroyTSma(&vCreateSmaReq);
// tDestroyTSma(&vCreateSmaReq);
// return -1;
// return -1;
// }
// }
//
//
...
@@ -888,7 +888,7 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
...
@@ -888,7 +888,7 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
terrno
=
TSDB_CODE_TDB_NO_SMA_INDEX_IN_META
;
terrno
=
TSDB_CODE_TDB_NO_SMA_INDEX_IN_META
;
taosHashCleanup
(
pItem
->
expiredWindows
);
taosHashCleanup
(
pItem
->
expiredWindows
);
taosMemoryFree
(
pItem
);
taosMemoryFree
(
pItem
);
smaWarn
(
"vgId:%d set expire window, get tsma meta failed for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
smaWarn
(
"vgId:%d
,
set expire window, get tsma meta failed for smaIndex %"
PRIi64
" since %s"
,
SMA_VID
(
pSma
),
indexUid
,
tstrerror
(
terrno
));
indexUid
,
tstrerror
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -915,12 +915,12 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
...
@@ -915,12 +915,12 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
taosHashCleanup
(
pItem
->
expiredWindows
);
taosHashCleanup
(
pItem
->
expiredWindows
);
taosMemoryFreeClear
(
pItem
->
pTSma
);
taosMemoryFreeClear
(
pItem
->
pTSma
);
taosHashRemove
(
pItemsHash
,
&
indexUid
,
sizeof
(
indexUid
));
taosHashRemove
(
pItemsHash
,
&
indexUid
,
sizeof
(
indexUid
));
smaWarn
(
"vgId:%d smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window fail"
,
SMA_VID
(
pSma
),
indexUid
,
smaWarn
(
"vgId:%d
,
smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window fail"
,
SMA_VID
(
pSma
),
indexUid
,
winSKey
);
winSKey
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
smaDebug
(
"vgId:%d smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window succeed"
,
SMA_VID
(
pSma
),
indexUid
,
smaDebug
(
"vgId:%d
,
smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window succeed"
,
SMA_VID
(
pSma
),
indexUid
,
winSKey
);
winSKey
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -935,18 +935,18 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
...
@@ -935,18 +935,18 @@ static int32_t tdSetExpiredWindow(SSma *pSma, SHashObj *pItemsHash, int64_t inde
int32_t
tdUpdateExpiredWindowImpl
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
int32_t
tdUpdateExpiredWindowImpl
(
SSma
*
pSma
,
const
SSubmitReq
*
pMsg
,
int64_t
version
)
{
// no time-range-sma, just return success
// no time-range-sma, just return success
if
(
atomic_load_16
(
&
SMA_TSMA_NUM
(
pSma
))
<=
0
)
{
if
(
atomic_load_16
(
&
SMA_TSMA_NUM
(
pSma
))
<=
0
)
{
smaTrace
(
"vgId:%d not update expire window since no tSma"
,
SMA_VID
(
pSma
));
smaTrace
(
"vgId:%d
,
not update expire window since no tSma"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
!
SMA_META
(
pSma
))
{
if
(
!
SMA_META
(
pSma
))
{
terrno
=
TSDB_CODE_INVALID_PTR
;
terrno
=
TSDB_CODE_INVALID_PTR
;
smaError
(
"vgId:%d update expire window failed since no meta ptr"
,
SMA_VID
(
pSma
));
smaError
(
"vgId:%d
,
update expire window failed since no meta ptr"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
if
(
tdCheckAndInitSmaEnv
(
pSma
,
TSDB_SMA_TYPE_TIME_RANGE
)
<
0
)
{
if
(
tdCheckAndInitSmaEnv
(
pSma
,
TSDB_SMA_TYPE_TIME_RANGE
)
<
0
)
{
smaError
(
"vgId:%d init sma env failed since %s"
,
SMA_VID
(
pSma
),
terrstr
(
terrno
));
smaError
(
"vgId:%d
,
init sma env failed since %s"
,
SMA_VID
(
pSma
),
terrstr
(
terrno
));
terrno
=
TSDB_CODE_TDB_INIT_FAILED
;
terrno
=
TSDB_CODE_TDB_INIT_FAILED
;
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -982,25 +982,25 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
...
@@ -982,25 +982,25 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
SSubmitBlkIter
blkIter
=
{
0
};
SSubmitBlkIter
blkIter
=
{
0
};
if
(
tInitSubmitBlkIter
(
&
msgIter
,
pBlock
,
&
blkIter
)
<
0
)
{
if
(
tInitSubmitBlkIter
(
&
msgIter
,
pBlock
,
&
blkIter
)
<
0
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
break
;
break
;
}
}
while
(
true
)
{
while
(
true
)
{
STSRow
*
row
=
tGetSubmitBlkNext
(
&
blkIter
);
STSRow
*
row
=
tGetSubmitBlkNext
(
&
blkIter
);
if
(
!
row
)
{
if
(
!
row
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
break
;
break
;
}
}
if
(
!
pSW
||
(
pTSma
&&
(
pTSma
->
tableUid
!=
msgIter
.
suid
)))
{
if
(
!
pSW
||
(
pTSma
&&
(
pTSma
->
tableUid
!=
msgIter
.
suid
)))
{
if
(
pSW
)
{
if
(
pSW
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
}
}
if
(
!
(
pSW
=
metaGetSmaInfoByTable
(
SMA_META
(
pSma
),
msgIter
.
suid
,
false
)))
{
if
(
!
(
pSW
=
metaGetSmaInfoByTable
(
SMA_META
(
pSma
),
msgIter
.
suid
,
false
)))
{
break
;
break
;
}
}
if
((
pSW
->
number
)
<=
0
||
!
pSW
->
tSma
)
{
if
((
pSW
->
number
)
<=
0
||
!
pSW
->
tSma
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
break
;
break
;
}
}
...
@@ -1020,12 +1020,12 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
...
@@ -1020,12 +1020,12 @@ int32_t tdUpdateExpiredWindowImpl(SSma *pSma, const SSubmitReq *pMsg, int64_t ve
if
(
lastWinSKey
!=
winSKey
)
{
if
(
lastWinSKey
!=
winSKey
)
{
lastWinSKey
=
winSKey
;
lastWinSKey
=
winSKey
;
if
(
tdSetExpiredWindow
(
pSma
,
pItemsHash
,
pTSma
->
indexUid
,
winSKey
,
version
)
<
0
)
{
if
(
tdSetExpiredWindow
(
pSma
,
pItemsHash
,
pTSma
->
indexUid
,
winSKey
,
version
)
<
0
)
{
pSW
=
t
d
FreeTSmaWrapper
(
pSW
,
false
);
pSW
=
tFreeTSmaWrapper
(
pSW
,
false
);
tdUnRefSmaStat
(
pSma
,
pStat
);
tdUnRefSmaStat
(
pSma
,
pStat
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
}
else
{
}
else
{
smaDebug
(
"vgId:%d smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window ignore as duplicated"
,
smaDebug
(
"vgId:%d
,
smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window ignore as duplicated"
,
SMA_VID
(
pSma
),
pTSma
->
indexUid
,
winSKey
);
SMA_VID
(
pSma
),
pTSma
->
indexUid
,
winSKey
);
}
}
}
}
...
...
source/dnode/vnode/src/sma/smaTimeRange2.c
0 → 100644
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tq/tqPush.c
浏览文件 @
4b9ea626
...
@@ -20,6 +20,28 @@ void tqTmrRspFunc(void* param, void* tmrId) {
...
@@ -20,6 +20,28 @@ void tqTmrRspFunc(void* param, void* tmrId) {
atomic_store_8
(
&
pHandle
->
pushHandle
.
tmrStopped
,
1
);
atomic_store_8
(
&
pHandle
->
pushHandle
.
tmrStopped
,
1
);
}
}
static
int32_t
tqLoopExecFromQueue
(
STQ
*
pTq
,
STqHandle
*
pHandle
,
SStreamDataSubmit
**
ppSubmit
,
SMqDataBlkRsp
*
pRsp
)
{
SStreamDataSubmit
*
pSubmit
=
*
ppSubmit
;
while
(
pSubmit
!=
NULL
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
pRsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
pRsp
->
blockNum
>
0
)
{
*
ppSubmit
=
pSubmit
;
return
0
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
}
*
ppSubmit
=
pSubmit
;
return
-
1
;
}
int32_t
tqExecFromInputQ
(
STQ
*
pTq
,
STqHandle
*
pHandle
)
{
int32_t
tqExecFromInputQ
(
STQ
*
pTq
,
STqHandle
*
pHandle
)
{
SMqDataBlkRsp
rsp
=
{
0
};
SMqDataBlkRsp
rsp
=
{
0
};
// 1. guard and set status executing
// 1. guard and set status executing
...
@@ -42,38 +64,14 @@ int32_t tqExecFromInputQ(STQ* pTq, STqHandle* pHandle) {
...
@@ -42,38 +64,14 @@ int32_t tqExecFromInputQ(STQ* pTq, STqHandle* pHandle) {
}
}
// 3. exec, after each success, update processed ver
// 3. exec, after each success, update processed ver
// first run
// first run
while
(
pSubmit
!=
NULL
)
{
if
(
tqLoopExecFromQueue
(
pTq
,
pHandle
,
&
pSubmit
,
&
rsp
)
==
0
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
goto
SEND_RSP
;
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
&
rsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
rsp
.
blockNum
>
0
)
{
goto
SEND_RSP
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
}
}
// set exec status closing
// set exec status closing
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__CLOSING
);
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__CLOSING
);
// second run
// second run
while
(
pSubmit
!=
NULL
)
{
if
(
tqLoopExecFromQueue
(
pTq
,
pHandle
,
&
pSubmit
,
&
rsp
)
==
0
)
{
ASSERT
(
pSubmit
->
ver
==
pHandle
->
pushHandle
.
processedVer
+
1
);
goto
SEND_RSP
;
if
(
tqDataExec
(
pTq
,
&
pHandle
->
execHandle
,
pSubmit
->
data
,
&
rsp
,
0
)
<
0
)
{
/*ASSERT(0);*/
}
// update processed
atomic_store_64
(
&
pHandle
->
pushHandle
.
processedVer
,
pSubmit
->
ver
);
streamQSetSuccess
(
&
pHandle
->
pushHandle
.
inputQ
);
streamDataSubmitRefDec
(
pSubmit
);
if
(
rsp
.
blockNum
>
0
)
{
goto
SEND_RSP
;
}
else
{
pSubmit
=
streamQNextItem
(
&
pHandle
->
pushHandle
.
inputQ
);
}
}
}
// set exec status idle
// set exec status idle
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__IDLE
);
atomic_store_8
(
&
pHandle
->
pushHandle
.
execStatus
,
TASK_STATUS__IDLE
);
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbCommit2.c
已删除
100644 → 0
浏览文件 @
3ff81a90
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbFS.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbFile.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbMemTable2.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbOpen.c
浏览文件 @
4b9ea626
...
@@ -74,7 +74,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
...
@@ -74,7 +74,7 @@ int tsdbOpen(SVnode *pVnode, STsdb **ppTsdb, const char *dir, STsdbKeepCfg *pKee
goto
_err
;
goto
_err
;
}
}
tsdbDebug
(
"vgId:%d tsdb is opened for %s, days:%d, keep:%d,%d,%d"
,
TD_VID
(
pVnode
),
pTsdb
->
path
,
pTsdb
->
keepCfg
.
days
,
tsdbDebug
(
"vgId:%d
,
tsdb is opened for %s, days:%d, keep:%d,%d,%d"
,
TD_VID
(
pVnode
),
pTsdb
->
path
,
pTsdb
->
keepCfg
.
days
,
pTsdb
->
keepCfg
.
keep0
,
pTsdb
->
keepCfg
.
keep1
,
pTsdb
->
keepCfg
.
keep2
);
pTsdb
->
keepCfg
.
keep0
,
pTsdb
->
keepCfg
.
keep1
,
pTsdb
->
keepCfg
.
keep2
);
*
ppTsdb
=
pTsdb
;
*
ppTsdb
=
pTsdb
;
...
@@ -99,7 +99,7 @@ int tsdbClose(STsdb **pTsdb) {
...
@@ -99,7 +99,7 @@ int tsdbClose(STsdb **pTsdb) {
int
tsdbLockRepo
(
STsdb
*
pTsdb
)
{
int
tsdbLockRepo
(
STsdb
*
pTsdb
)
{
int
code
=
taosThreadMutexLock
(
&
pTsdb
->
mutex
);
int
code
=
taosThreadMutexLock
(
&
pTsdb
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tsdbError
(
"vgId:%d failed to lock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
tsdbError
(
"vgId:%d
,
failed to lock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
@@ -112,7 +112,7 @@ int tsdbUnlockRepo(STsdb *pTsdb) {
...
@@ -112,7 +112,7 @@ int tsdbUnlockRepo(STsdb *pTsdb) {
pTsdb
->
repoLocked
=
false
;
pTsdb
->
repoLocked
=
false
;
int
code
=
taosThreadMutexUnlock
(
&
pTsdb
->
mutex
);
int
code
=
taosThreadMutexUnlock
(
&
pTsdb
->
mutex
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
tsdbError
(
"vgId:%d failed to unlock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
tsdbError
(
"vgId:%d
,
failed to unlock tsdb since %s"
,
REPO_ID
(
pTsdb
),
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
terrno
=
TAOS_SYSTEM_ERROR
(
code
);
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbWrite.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeBufPool.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeOpen.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/function/src/builtins.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/function/src/tudf.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/index/src/indexFilter.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCloneFuncs.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/parser/inc/parInt.h
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/parser/src/parInsert.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/planner/src/planLogicCreater.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/planner/src/planSpliter.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/planner/test/planOtherTest.cpp
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMain.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/libs/wal/src/walWrite.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
source/util/src/tworker.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/bnode/basic1.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/db/alter_option.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/db/alter_replica_13.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/dnode/basic1.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic1.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic2.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic3.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/mnode/basic4.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/qnode/basic1.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/query/explain.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/query/scalarNull.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/query/udf.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/snode/basic1.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/sync/3Replica1VgElect.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/sync/3Replica5VgElect.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/sync/oneReplica1VgElect.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/sync/oneReplica5VgElect.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/sync/threeReplica1VgElect.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/script/tsim/trans/create_db.sim
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/system-test/0-others/taosdMonitor.py
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/system-test/1-insert/influxdb_line_taosc_insert.py
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/system-test/1-insert/opentsdb_json_taosc_insert.py
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/system-test/1-insert/opentsdb_telnet_line_taosc_insert.py
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
100644 → 100755
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
tests/test/c/sdbDump.c
浏览文件 @
4b9ea626
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录