Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e0d3ceb5
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e0d3ceb5
编写于
4月 20, 2022
作者:
J
jiacy-jcy
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into test/jcy
上级
a2e0d746
a87c4f09
变更
83
展开全部
隐藏空白更改
内联
并排
Showing
83 changed file
with
1356 addition
and
1722 deletion
+1356
-1722
include/client/taos.h
include/client/taos.h
+10
-0
include/common/tmsg.h
include/common/tmsg.h
+45
-14
include/common/tmsgcb.h
include/common/tmsgcb.h
+3
-0
include/common/tmsgdef.h
include/common/tmsgdef.h
+7
-5
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+1
-0
include/libs/function/function.h
include/libs/function/function.h
+13
-13
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+8
-0
include/libs/sync/sync.h
include/libs/sync/sync.h
+2
-0
include/util/tdef.h
include/util/tdef.h
+59
-99
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+65
-0
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+4
-4
source/common/src/tmsg.c
source/common/src/tmsg.c
+121
-12
source/common/src/tmsgcb.c
source/common/src/tmsgcb.c
+4
-0
source/dnode/mgmt/implement/inc/dmImp.h
source/dnode/mgmt/implement/inc/dmImp.h
+2
-0
source/dnode/mgmt/implement/src/dmExec.c
source/dnode/mgmt/implement/src/dmExec.c
+8
-9
source/dnode/mgmt/implement/src/dmHandle.c
source/dnode/mgmt/implement/src/dmHandle.c
+23
-7
source/dnode/mgmt/implement/src/dmMonitor.c
source/dnode/mgmt/implement/src/dmMonitor.c
+26
-0
source/dnode/mgmt/implement/src/dmTransport.c
source/dnode/mgmt/implement/src/dmTransport.c
+4
-3
source/dnode/mgmt/implement/src/dmWorker.c
source/dnode/mgmt/implement/src/dmWorker.c
+2
-0
source/dnode/mgmt/interface/inc/dmDef.h
source/dnode/mgmt/interface/inc/dmDef.h
+11
-1
source/dnode/mgmt/interface/inc/dmInt.h
source/dnode/mgmt/interface/inc/dmInt.h
+2
-1
source/dnode/mgmt/interface/src/dmInt.c
source/dnode/mgmt/interface/src/dmInt.c
+52
-13
source/dnode/mgmt/mgmt_bnode/src/bmInt.c
source/dnode/mgmt/mgmt_bnode/src/bmInt.c
+2
-0
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
+2
-0
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+33
-4
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
+2
-0
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
+2
-0
source/dnode/mgmt/mgmt_qnode/src/qmInt.c
source/dnode/mgmt/mgmt_qnode/src/qmInt.c
+2
-0
source/dnode/mgmt/mgmt_snode/src/smInt.c
source/dnode/mgmt/mgmt_snode/src/smInt.c
+2
-0
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
+0
-4
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+75
-144
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+9
-33
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+0
-9
source/dnode/mgmt/test/vnode/vnode.cpp
source/dnode/mgmt/test/vnode/vnode.cpp
+3
-3
source/dnode/mnode/impl/inc/mndAuth.h
source/dnode/mnode/impl/inc/mndAuth.h
+1
-1
source/dnode/mnode/impl/inc/mndDb.h
source/dnode/mnode/impl/inc/mndDb.h
+2
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+2
-2
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+0
-16
source/dnode/mnode/impl/inc/mndMnode.h
source/dnode/mnode/impl/inc/mndMnode.h
+7
-8
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+1
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+275
-254
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+3
-3
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+1
-1
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+1
-14
source/dnode/mnode/impl/src/mndTelem.c
source/dnode/mnode/impl/src/mndTelem.c
+53
-13
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+6
-10
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+8
-27
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+5
-5
source/dnode/mnode/impl/test/sma/sma.cpp
source/dnode/mnode/impl/test/sma/sma.cpp
+2
-1
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+2
-1
source/dnode/mnode/impl/test/topic/topic.cpp
source/dnode/mnode/impl/test/topic/topic.cpp
+2
-1
source/dnode/mnode/impl/test/user/user.cpp
source/dnode/mnode/impl/test/user/user.cpp
+2
-1
source/dnode/vnode/src/tsdb/tsdbMain.c
source/dnode/vnode/src/tsdb/tsdbMain.c
+10
-10
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+1
-1
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+1
-1
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+2
-0
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+2
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+4
-5
source/libs/executor/inc/tfill.h
source/libs/executor/inc/tfill.h
+17
-3
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+78
-64
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+2
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+3
-3
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+54
-42
source/libs/function/src/taggfunction.c
source/libs/function/src/taggfunction.c
+8
-8
source/libs/monitor/src/monMsg.c
source/libs/monitor/src/monMsg.c
+29
-2
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+0
-3
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+21
-26
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+13
-0
tests/script/basicSuite.sim
tests/script/basicSuite.sim
+0
-19
tests/script/bug.sim
tests/script/bug.sim
+0
-2
tests/script/fullGeneralSuite.sim
tests/script/fullGeneralSuite.sim
+0
-225
tests/script/regressionSuite.sim
tests/script/regressionSuite.sim
+0
-221
tests/script/tsim/db/alter_option.sim
tests/script/tsim/db/alter_option.sim
+20
-20
tests/script/tsim/db/create_all_options.sim
tests/script/tsim/db/create_all_options.sim
+11
-11
tests/script/tsim/query/explain.sim
tests/script/tsim/query/explain.sim
+3
-3
tests/script/tsim/sync/oneReplica1VgElect.sim
tests/script/tsim/sync/oneReplica1VgElect.sim
+0
-1
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
+0
-1
tests/script/tsim/sync/threeReplica1VgElect.sim
tests/script/tsim/sync/threeReplica1VgElect.sim
+0
-1
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
+0
-1
tests/script/tsim/testCaseSuite.sim
tests/script/tsim/testCaseSuite.sim
+0
-31
tools/shell/inc/shell.h
tools/shell/inc/shell.h
+2
-1
tools/shell/src/shellMain.c
tools/shell/src/shellMain.c
+91
-67
tools/shell/src/tnettest.c
tools/shell/src/tnettest.c
+7
-209
未找到文件。
include/client/taos.h
浏览文件 @
e0d3ceb5
...
@@ -315,6 +315,16 @@ DLL_EXPORT TAOS_RES *tmq_create_stream(TAOS *taos, const char *streamName, const
...
@@ -315,6 +315,16 @@ DLL_EXPORT TAOS_RES *tmq_create_stream(TAOS *taos, const char *streamName, const
typedef
void
(
*
TAOS_SUBSCRIBE_CALLBACK
)(
TAOS_SUB
*
tsub
,
TAOS_RES
*
res
,
void
*
param
,
int
code
);
typedef
void
(
*
TAOS_SUBSCRIBE_CALLBACK
)(
TAOS_SUB
*
tsub
,
TAOS_RES
*
res
,
void
*
param
,
int
code
);
#endif
#endif
typedef
enum
{
TSDB_SRV_STATUS_UNAVAILABLE
=
0
,
TSDB_SRV_STATUS_NETWORK_OK
=
1
,
TSDB_SRV_STATUS_SERVICE_OK
=
2
,
TSDB_SRV_STATUS_SERVICE_DEGRADED
=
3
,
TSDB_SRV_STATUS_EXTING
=
4
,
}
TSDB_SERVER_STATUS
;
DLL_EXPORT
TSDB_SERVER_STATUS
taos_check_server_status
(
const
char
*
fqdn
,
int
port
,
char
*
details
,
int
maxlen
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/common/tmsg.h
浏览文件 @
e0d3ceb5
...
@@ -513,7 +513,7 @@ typedef struct {
...
@@ -513,7 +513,7 @@ typedef struct {
int8_t
precision
;
// time resolution
int8_t
precision
;
// time resolution
int8_t
compression
;
int8_t
compression
;
int8_t
replications
;
int8_t
replications
;
int8_t
quorum
;
int8_t
strict
;
int8_t
update
;
int8_t
update
;
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int8_t
ignoreExist
;
int8_t
ignoreExist
;
...
@@ -535,7 +535,7 @@ typedef struct {
...
@@ -535,7 +535,7 @@ typedef struct {
int32_t
daysToKeep2
;
int32_t
daysToKeep2
;
int32_t
fsyncPeriod
;
int32_t
fsyncPeriod
;
int8_t
walLevel
;
int8_t
walLevel
;
int8_t
quorum
;
int8_t
strict
;
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int8_t
replications
;
int8_t
replications
;
}
SAlterDbReq
;
}
SAlterDbReq
;
...
@@ -608,7 +608,7 @@ typedef struct {
...
@@ -608,7 +608,7 @@ typedef struct {
int8_t
precision
;
int8_t
precision
;
int8_t
compression
;
int8_t
compression
;
int8_t
replications
;
int8_t
replications
;
int8_t
quorum
;
int8_t
strict
;
int8_t
update
;
int8_t
update
;
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int8_t
streamMode
;
int8_t
streamMode
;
...
@@ -645,10 +645,10 @@ void tFreeSUseDbBatchRsp(SUseDbBatchRsp* pRsp);
...
@@ -645,10 +645,10 @@ void tFreeSUseDbBatchRsp(SUseDbBatchRsp* pRsp);
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
}
S
SyncDbReq
,
S
CompactDbReq
;
}
SCompactDbReq
;
int32_t
tSerializeS
SyncDbReq
(
void
*
buf
,
int32_t
bufLen
,
SSync
DbReq
*
pReq
);
int32_t
tSerializeS
CompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompact
DbReq
*
pReq
);
int32_t
tDeserializeS
SyncDbReq
(
void
*
buf
,
int32_t
bufLen
,
SSync
DbReq
*
pReq
);
int32_t
tDeserializeS
CompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompact
DbReq
*
pReq
);
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
char
name
[
TSDB_FUNC_NAME_LEN
];
...
@@ -729,7 +729,7 @@ typedef struct {
...
@@ -729,7 +729,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
int
8_t
rol
e
;
int
32_t
syncStat
e
;
int64_t
numOfTables
;
int64_t
numOfTables
;
int64_t
numOfTimeSeries
;
int64_t
numOfTimeSeries
;
int64_t
totalStorage
;
int64_t
totalStorage
;
...
@@ -742,6 +742,10 @@ typedef struct {
...
@@ -742,6 +742,10 @@ typedef struct {
int64_t
numOfBatchInsertSuccessReqs
;
int64_t
numOfBatchInsertSuccessReqs
;
}
SVnodeLoad
;
}
SVnodeLoad
;
typedef
struct
{
int32_t
syncState
;
}
SMnodeLoad
;
typedef
struct
{
typedef
struct
{
int32_t
sver
;
// software version
int32_t
sver
;
// software version
int64_t
dnodeVer
;
// dnode table version in sdb
int64_t
dnodeVer
;
// dnode table version in sdb
...
@@ -816,7 +820,7 @@ typedef struct {
...
@@ -816,7 +820,7 @@ typedef struct {
int8_t
walLevel
;
int8_t
walLevel
;
int8_t
precision
;
int8_t
precision
;
int8_t
compression
;
int8_t
compression
;
int8_t
quorum
;
int8_t
strict
;
int8_t
update
;
int8_t
update
;
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int8_t
replica
;
int8_t
replica
;
...
@@ -825,7 +829,7 @@ typedef struct {
...
@@ -825,7 +829,7 @@ typedef struct {
SReplica
replicas
[
TSDB_MAX_REPLICA
];
SReplica
replicas
[
TSDB_MAX_REPLICA
];
int32_t
numOfRetensions
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
// SRetention
SArray
*
pRetensions
;
// SRetention
}
SCreateVnodeReq
,
SAlterVnodeReq
;
}
SCreateVnodeReq
;
int32_t
tSerializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
);
int32_t
tSerializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
);
int32_t
tDeserializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
);
int32_t
tDeserializeSCreateVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateVnodeReq
*
pReq
);
...
@@ -836,11 +840,36 @@ typedef struct {
...
@@ -836,11 +840,36 @@ typedef struct {
int32_t
dnodeId
;
int32_t
dnodeId
;
int64_t
dbUid
;
int64_t
dbUid
;
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
}
SDropVnodeReq
,
SSyncVnodeReq
,
SCompactVnodeReq
;
}
SDropVnodeReq
;
int32_t
tSerializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
);
int32_t
tSerializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
);
int32_t
tDeserializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
);
int32_t
tDeserializeSDropVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDropVnodeReq
*
pReq
);
typedef
struct
{
int64_t
dbUid
;
char
db
[
TSDB_DB_FNAME_LEN
];
}
SCompactVnodeReq
;
int32_t
tSerializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
);
int32_t
tDeserializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
);
typedef
struct
{
int32_t
vgVersion
;
int32_t
totalBlocks
;
int32_t
daysToKeep0
;
int32_t
daysToKeep1
;
int32_t
daysToKeep2
;
int8_t
walLevel
;
int8_t
strict
;
int8_t
cacheLastRow
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
}
SAlterVnodeReq
;
int32_t
tSerializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
);
int32_t
tDeserializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
);
typedef
struct
{
typedef
struct
{
SMsgHead
header
;
SMsgHead
header
;
char
dbFName
[
TSDB_DB_FNAME_LEN
];
char
dbFName
[
TSDB_DB_FNAME_LEN
];
...
@@ -1077,10 +1106,12 @@ int32_t tSerializeSAuthReq(void* buf, int32_t bufLen, SAuthReq* pReq);
...
@@ -1077,10 +1106,12 @@ int32_t tSerializeSAuthReq(void* buf, int32_t bufLen, SAuthReq* pReq);
int32_t
tDeserializeSAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SAuthReq
*
pReq
);
int32_t
tDeserializeSAuthReq
(
void
*
buf
,
int32_t
bufLen
,
SAuthReq
*
pReq
);
typedef
struct
{
typedef
struct
{
int8_t
finished
;
int32_t
statusCode
;
char
name
[
TSDB_STEP_NAME_LEN
];
char
details
[
1024
];
char
desc
[
TSDB_STEP_DESC_LEN
];
}
SServerStatusRsp
;
}
SStartupReq
;
int32_t
tSerializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
);
int32_t
tDeserializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
);
/**
/**
* The layout of the query message payload is as following:
* The layout of the query message payload is as following:
...
...
include/common/tmsgcb.h
浏览文件 @
e0d3ceb5
...
@@ -44,6 +44,7 @@ typedef int32_t (*SendMnodeReqFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq);
...
@@ -44,6 +44,7 @@ typedef int32_t (*SendMnodeReqFp)(SMgmtWrapper* pWrapper, SRpcMsg* pReq);
typedef
void
(
*
SendRspFp
)(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
);
typedef
void
(
*
SendRspFp
)(
SMgmtWrapper
*
pWrapper
,
const
SRpcMsg
*
pRsp
);
typedef
void
(
*
RegisterBrokenLinkArgFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
typedef
void
(
*
RegisterBrokenLinkArgFp
)(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
typedef
void
(
*
ReleaseHandleFp
)(
SMgmtWrapper
*
pWrapper
,
void
*
handle
,
int8_t
type
);
typedef
void
(
*
ReleaseHandleFp
)(
SMgmtWrapper
*
pWrapper
,
void
*
handle
,
int8_t
type
);
typedef
void
(
*
ReportStartup
)(
SMgmtWrapper
*
pWrapper
,
const
char
*
name
,
const
char
*
desc
);
typedef
struct
{
typedef
struct
{
SMgmtWrapper
*
pWrapper
;
SMgmtWrapper
*
pWrapper
;
...
@@ -53,6 +54,7 @@ typedef struct {
...
@@ -53,6 +54,7 @@ typedef struct {
SendRspFp
sendRspFp
;
SendRspFp
sendRspFp
;
RegisterBrokenLinkArgFp
registerBrokenLinkArgFp
;
RegisterBrokenLinkArgFp
registerBrokenLinkArgFp
;
ReleaseHandleFp
releaseHandleFp
;
ReleaseHandleFp
releaseHandleFp
;
ReportStartup
reportStartupFp
;
}
SMsgCb
;
}
SMsgCb
;
void
tmsgSetDefaultMsgCb
(
const
SMsgCb
*
pMsgCb
);
void
tmsgSetDefaultMsgCb
(
const
SMsgCb
*
pMsgCb
);
...
@@ -62,6 +64,7 @@ int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq);
...
@@ -62,6 +64,7 @@ int32_t tmsgSendReq(const SMsgCb* pMsgCb, const SEpSet* epSet, SRpcMsg* pReq);
void
tmsgSendRsp
(
const
SRpcMsg
*
pRsp
);
void
tmsgSendRsp
(
const
SRpcMsg
*
pRsp
);
void
tmsgRegisterBrokenLinkArg
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pMsg
);
void
tmsgRegisterBrokenLinkArg
(
const
SMsgCb
*
pMsgCb
,
SRpcMsg
*
pMsg
);
void
tmsgReleaseHandle
(
void
*
handle
,
int8_t
type
);
void
tmsgReleaseHandle
(
void
*
handle
,
int8_t
type
);
void
tmsgReportStartup
(
const
char
*
name
,
const
char
*
desc
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/common/tmsgdef.h
浏览文件 @
e0d3ceb5
...
@@ -82,12 +82,9 @@ enum {
...
@@ -82,12 +82,9 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_BNODE
,
"dnode-alter-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
,
"dnode-create-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_ALTER_VNODE
,
"dnode-alter-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_VNODE
,
"dnode-drop-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_DROP_VNODE
,
"dnode-drop-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_SYNC_VNODE
,
"dnode-sync-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_COMPACT_VNODE
,
"dnode-compact-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CONFIG_DNODE
,
"dnode-config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CONFIG_DNODE
,
"dnode-config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
NETWORK_TEST
,
"dnode-nettest
"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_
SERVER_STATUS
,
"dnode-server-status
"
,
NULL
,
NULL
)
// Requests handled by MNODE
// Requests handled by MNODE
TD_NEW_MSG_SEG
(
TDMT_MND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_MND_MSG
)
...
@@ -206,6 +203,10 @@ enum {
...
@@ -206,6 +203,10 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_VND_CANCEL_SMA
,
"vnode-cancel-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_CANCEL_SMA
,
"vnode-cancel-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_SMA
,
"vnode-drop-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_DROP_SMA
,
"vnode-drop-sma"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_SYNC_VNODE
,
"vnode-sync-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_ALTER_VNODE
,
"vnode-alter-vnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_VND_COMPACT_VNODE
,
"vnode-compact-vnode"
,
NULL
,
NULL
)
// Requests handled by QNODE
// Requests handled by QNODE
TD_NEW_MSG_SEG
(
TDMT_QND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_QND_MSG
)
...
@@ -228,7 +229,8 @@ enum {
...
@@ -228,7 +229,8 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MON_SM_INFO
,
"monitor-sinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_SM_INFO
,
"monitor-sinfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_BM_INFO
,
"monitor-binfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_BM_INFO
,
"monitor-binfo"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_VM_LOAD
,
"monitor-vload"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_VM_LOAD
,
"monitor-vload"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MON_MM_LOAD
,
"monitor-mload"
,
NULL
,
NULL
)
#if defined(TD_MSG_NUMBER_)
#if defined(TD_MSG_NUMBER_)
TDMT_MAX
TDMT_MAX
#endif
#endif
...
...
include/dnode/mnode/mnode.h
浏览文件 @
e0d3ceb5
...
@@ -80,6 +80,7 @@ void mndStop(SMnode *pMnode);
...
@@ -80,6 +80,7 @@ void mndStop(SMnode *pMnode);
* @return int32_t 0 for success, -1 for failure.
* @return int32_t 0 for success, -1 for failure.
*/
*/
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pCluster
,
SMonVgroupInfo
*
pVgroup
,
SMonGrantInfo
*
pGrant
);
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pCluster
,
SMonVgroupInfo
*
pVgroup
,
SMonGrantInfo
*
pGrant
);
int32_t
mndGetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
);
/**
/**
* @brief Process the read, write, sync request.
* @brief Process the read, write, sync request.
...
...
include/libs/function/function.h
浏览文件 @
e0d3ceb5
...
@@ -295,19 +295,19 @@ typedef struct SPoint {
...
@@ -295,19 +295,19 @@ typedef struct SPoint {
void
*
val
;
void
*
val
;
}
SPoint
;
}
SPoint
;
void
taosFillSetStartInfo
(
struct
SFillInfo
*
pFillInfo
,
int32_t
numOfRows
,
TSKEY
endKey
);
//
void taosFillSetStartInfo(struct SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey);
void
taosResetFillInfo
(
struct
SFillInfo
*
pFillInfo
,
TSKEY
startTimestamp
);
//
void taosResetFillInfo(struct SFillInfo* pFillInfo, TSKEY startTimestamp);
void
taosFillSetInputDataBlock
(
struct
SFillInfo
*
pFillInfo
,
const
struct
SSDataBlock
*
pInput
);
//
void taosFillSetInputDataBlock(struct SFillInfo* pFillInfo, const struct SSDataBlock* pInput);
struct
SFillColInfo
*
createFillColInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
const
int64_t
*
fillV
al
);
//struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfOutput, const SValueNode* v
al);
bool
taosFillHasMoreResults
(
struct
SFillInfo
*
pFillInfo
);
//
bool taosFillHasMoreResults(struct SFillInfo* pFillInfo);
//
struct
SFillInfo
*
taosCreateFillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
//
struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols,
int64_t
slidingTime
,
int8_t
slidingUnit
,
int8_t
precision
,
int32_t
fillType
,
// SInterval* pInterval
, int32_t fillType,
struct
SFillColInfo
*
pFill
Col
,
const
char
*
id
);
// struct SFillColInfo* p
Col, const char* id);
//
void
*
taosDestroyFillInfo
(
struct
SFillInfo
*
pFillInfo
);
//
void* taosDestroyFillInfo(struct SFillInfo *pFillInfo);
int64_t
taosFillResultDataBlock
(
struct
SFillInfo
*
pFillInfo
,
void
**
output
,
int32_t
capacity
);
//
int64_t taosFillResultDataBlock(struct SFillInfo* pFillInfo, void** output, int32_t capacity);
int64_t
getFillInfoStart
(
struct
SFillInfo
*
pFillInfo
);
//
int64_t getFillInfoStart(struct SFillInfo *pFillInfo);
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
);
int32_t
taosGetLinearInterpolationVal
(
SPoint
*
point
,
int32_t
outputType
,
SPoint
*
point1
,
SPoint
*
point2
,
int32_t
inputType
);
...
...
include/libs/monitor/monitor.h
浏览文件 @
e0d3ceb5
...
@@ -202,6 +202,14 @@ int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo)
...
@@ -202,6 +202,14 @@ int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo)
int32_t
tDeserializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
);
int32_t
tDeserializeSMonVloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonVloadInfo
*
pInfo
);
void
tFreeSMonVloadInfo
(
SMonVloadInfo
*
pInfo
);
void
tFreeSMonVloadInfo
(
SMonVloadInfo
*
pInfo
);
typedef
struct
{
int8_t
isMnode
;
SMnodeLoad
load
;
}
SMonMloadInfo
;
int32_t
tSerializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
);
int32_t
tDeserializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
);
typedef
struct
{
typedef
struct
{
const
char
*
server
;
const
char
*
server
;
uint16_t
port
;
uint16_t
port
;
...
...
include/libs/sync/sync.h
浏览文件 @
e0d3ceb5
...
@@ -172,6 +172,8 @@ int32_t syncForwardToPeer(int64_t rid, const SRpcMsg* pMsg, bool isWeak);
...
@@ -172,6 +172,8 @@ int32_t syncForwardToPeer(int64_t rid, const SRpcMsg* pMsg, bool isWeak);
extern
int32_t
sDebugFlag
;
extern
int32_t
sDebugFlag
;
const
char
*
syncStr
(
ESyncState
state
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/util/tdef.h
浏览文件 @
e0d3ceb5
...
@@ -297,16 +297,6 @@ typedef enum ELogicConditionType {
...
@@ -297,16 +297,6 @@ typedef enum ELogicConditionType {
#define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_DNODE_CONFIG_LEN 128
#define TSDB_DNODE_VALUE_LEN 256
#define TSDB_DNODE_VALUE_LEN 256
#define TSDB_MQTT_HOSTNAME_LEN 64
#define TSDB_MQTT_PORT_LEN 8
#define TSDB_MQTT_USER_LEN 24
#define TSDB_MQTT_PASS_LEN 24
#define TSDB_MQTT_TOPIC_LEN 64
#define TSDB_MQTT_CLIENT_ID_LEN 32
#define TSDB_DB_TYPE_DEFAULT 0
#define TSDB_DB_TYPE_TOPIC 1
#define TSDB_DEFAULT_PKT_SIZE 65480 // same as RPC_MAX_UDP_SIZE
#define TSDB_DEFAULT_PKT_SIZE 65480 // same as RPC_MAX_UDP_SIZE
#define TSDB_PAYLOAD_SIZE TSDB_DEFAULT_PKT_SIZE
#define TSDB_PAYLOAD_SIZE TSDB_DEFAULT_PKT_SIZE
...
@@ -315,9 +305,6 @@ typedef enum ELogicConditionType {
...
@@ -315,9 +305,6 @@ typedef enum ELogicConditionType {
#define TSDB_CQ_SQL_SIZE 1024
#define TSDB_CQ_SQL_SIZE 1024
#define TSDB_MIN_VNODES 16
#define TSDB_MIN_VNODES 16
#define TSDB_MAX_VNODES 512
#define TSDB_MAX_VNODES 512
#define TSDB_MIN_VNODES_PER_DB 1
#define TSDB_MAX_VNODES_PER_DB 4096
#define TSDB_DEFAULT_VN_PER_DB 2
#define TSDB_DNODE_ROLE_ANY 0
#define TSDB_DNODE_ROLE_ANY 0
#define TSDB_DNODE_ROLE_MGMT 1
#define TSDB_DNODE_ROLE_MGMT 1
...
@@ -331,108 +318,81 @@ typedef enum ELogicConditionType {
...
@@ -331,108 +318,81 @@ typedef enum ELogicConditionType {
#define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta
#define TSDB_MULTI_TABLEMETA_MAX_NUM 100000 // maximum batch size allowed to load table meta
#define TSDB_MIN_VNODES_PER_DB 1
#define TSDB_MAX_VNODES_PER_DB 4096
#define TSDB_DEFAULT_VN_PER_DB 2
#define TSDB_MIN_CACHE_BLOCK_SIZE 1
#define TSDB_MIN_CACHE_BLOCK_SIZE 1
#define TSDB_MAX_CACHE_BLOCK_SIZE 128 // 128MB for each vnode
#define TSDB_MAX_CACHE_BLOCK_SIZE 128 // 128MB for each vnode
#define TSDB_DEFAULT_CACHE_BLOCK_SIZE 16
#define TSDB_DEFAULT_CACHE_BLOCK_SIZE 16
#define TSDB_MIN_TOTAL_BLOCKS 3
#define TSDB_MIN_TOTAL_BLOCKS 3
#define TSDB_MAX_TOTAL_BLOCKS 10000
#define TSDB_MAX_TOTAL_BLOCKS 10000
#define TSDB_DEFAULT_TOTAL_BLOCKS 6
#define TSDB_DEFAULT_TOTAL_BLOCKS 6
#define TSDB_MIN_DAYS_PER_FILE 60 // unit minute
#define TSDB_MAX_DAYS_PER_FILE (3650 * 1440)
#define TSDB_MIN_DAYS_PER_FILE 60 // unit minute
#define TSDB_DEFAULT_DAYS_PER_FILE (10 * 1440)
#define TSDB_MAX_DAYS_PER_FILE (3650 * 1440)
#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute
#define TSDB_DEFAULT_DAYS_PER_FILE (10 * 1440)
#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved.
#define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years
#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute
#define TSDB_MIN_MINROWS_FBLOCK 10
#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved.
#define TSDB_MAX_MINROWS_FBLOCK 1000
#define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years
#define TSDB_DEFAULT_MINROWS_FBLOCK 100
#define TSDB_MIN_MAXROWS_FBLOCK 200
#define TSDB_MIN_MIN_ROW_FBLOCK 10
#define TSDB_MAX_MAXROWS_FBLOCK 10000
#define TSDB_MAX_MIN_ROW_FBLOCK 1000
#define TSDB_DEFAULT_MAXROWS_FBLOCK 4096
#define TSDB_DEFAULT_MIN_ROW_FBLOCK 100
#define TSDB_MIN_COMMIT_TIME 30
#define TSDB_MAX_COMMIT_TIME 40960
#define TSDB_MIN_MAX_ROW_FBLOCK 200
#define TSDB_DEFAULT_COMMIT_TIME 3600
#define TSDB_MAX_MAX_ROW_FBLOCK 10000
#define TSDB_MIN_FSYNC_PERIOD 0
#define TSDB_DEFAULT_MAX_ROW_FBLOCK 4096
#define TSDB_MAX_FSYNC_PERIOD 180000 // millisecond
#define TSDB_DEFAULT_FSYNC_PERIOD 3000 // three second
#define TSDB_MIN_COMMIT_TIME 30
#define TSDB_MIN_DB_TTL 1
#define TSDB_MAX_COMMIT_TIME 40960
#define TSDB_DEFAULT_DB_TTL 1
#define TSDB_DEFAULT_COMMIT_TIME 3600
#define TSDB_MIN_WAL_LEVEL 1
#define TSDB_MAX_WAL_LEVEL 2
#define TSDB_MIN_FSYNC_PERIOD 0
#define TSDB_DEFAULT_WAL_LEVEL 1
#define TSDB_MAX_FSYNC_PERIOD 180000 // millisecond
#define TSDB_MIN_PRECISION TSDB_TIME_PRECISION_MILLI
#define TSDB_DEFAULT_FSYNC_PERIOD 3000 // three second
#define TSDB_MAX_PRECISION TSDB_TIME_PRECISION_NANO
#define TSDB_DEFAULT_PRECISION TSDB_TIME_PRECISION_MILLI
#define TSDB_MIN_WAL_LEVEL 1
#define TSDB_MIN_COMP_LEVEL 0
#define TSDB_MAX_WAL_LEVEL 2
#define TSDB_MAX_COMP_LEVEL 2
#define TSDB_DEFAULT_WAL_LEVEL 1
#define TSDB_DEFAULT_COMP_LEVEL 2
#define TSDB_MIN_DB_REPLICA 1
#define TSDB_MIN_PRECISION TSDB_TIME_PRECISION_MILLI
#define TSDB_MAX_DB_REPLICA 3
#define TSDB_MAX_PRECISION TSDB_TIME_PRECISION_NANO
#define TSDB_DEFAULT_DB_REPLICA 1
#define TSDB_DEFAULT_PRECISION TSDB_TIME_PRECISION_MILLI
#define TSDB_DB_STRICT_OFF 0
#define TSDB_DB_STRICT_ON 1
#define TSDB_MIN_COMP_LEVEL 0
#define TSDB_DEFAULT_DB_STRICT 0
#define TSDB_MAX_COMP_LEVEL 2
#define TSDB_DEFAULT_COMP_LEVEL 2
#define TSDB_MIN_DB_REPLICA_OPTION 1
#define TSDB_MAX_DB_REPLICA_OPTION 3
#define TSDB_DEFAULT_DB_REPLICA_OPTION 1
#define TSDB_MIN_DB_QUORUM_OPTION 1
#define TSDB_MAX_DB_QUORUM_OPTION 2
#define TSDB_DEFAULT_DB_QUORUM_OPTION 1
#define TSDB_MIN_DB_TTL_OPTION 1
#define TSDB_DEFAULT_DB_TTL_OPTION 0
#define TSDB_MIN_DB_SINGLE_STABLE_OPTION 0
#define TSDB_MAX_DB_SINGLE_STABLE_OPTION 1
#define TSDB_DEFAULT_DB_SINGLE_STABLE_OPTION 0
#define TSDB_DB_STREAM_MODE_OPTION_OFF 0
#define TSDB_DB_STREAM_MODE_OPTION_ON 1
#define TSDB_DEFAULT_DB_STREAM_MODE_OPTION 0
#define TSDB_DB_STRICT_OPTION_OFF 0
#define TSDB_DB_STRICT_OPTION_ON 1
#define TSDB_DEFAULT_DB_STRICT_OPTION 0
#define TSDB_MAX_JOIN_TABLE_NUM 10
#define TSDB_MAX_UNION_CLAUSE 5
#define TSDB_MIN_DB_UPDATE 0
#define TSDB_MIN_DB_UPDATE 0
#define TSDB_MAX_DB_UPDATE 2
#define TSDB_MAX_DB_UPDATE 2
#define TSDB_DEFAULT_DB_UPDATE_OPTION 0
#define TSDB_DEFAULT_DB_UPDATE 0
#define TSDB_MIN_DB_CACHE_LAST_ROW 0
#define TSDB_MIN_DB_CACHE_LAST_ROW 0
#define TSDB_MAX_DB_CACHE_LAST_ROW 3
#define TSDB_MAX_DB_CACHE_LAST_ROW 3
#define TSDB_DEFAULT_CACHE_LAST_ROW 0
#define TSDB_DEFAULT_CACHE_LAST_ROW 0
#define TSDB_DB_STREAM_MODE_OFF 0
#define TSDB_DB_STREAM_MODE_ON 1
#define TSDB_MIN_DB_STREAM_MODE 0
#define TSDB_DEFAULT_DB_STREAM_MODE 0
#define TSDB_MAX_DB_STREAM_MODE 1
#define TSDB_DB_SINGLE_STABLE_ON 0
#define TSDB_DEFAULT_DB_STREAM_MODE 0
#define TSDB_DB_SINGLE_STABLE_OFF 1
#define TSDB_DEFAULT_DB_SINGLE_STABLE 0
#define TSDB_MIN_DB_FILE_FACTOR 0
#define TSDB_MIN_DB_FILE_FACTOR 0
#define TSDB_MAX_DB_FILE_FACTOR 1
#define TSDB_MAX_DB_FILE_FACTOR 1
#define TSDB_DEFAULT_DB_FILE_FACTOR 0.1
#define TSDB_DEFAULT_DB_FILE_FACTOR 0.1
#define TSDB_MIN_DB_DELAY 1
#define TSDB_MAX_DB_DELAY 10
#define TSDB_DEFAULT_DB_DELAY 2
#define TSDB_MIN_EXPLAIN_RATIO 0
#define TSDB_MAX_EXPLAIN_RATIO 1
#define TSDB_DEFAULT_EXPLAIN_RATIO 0.001
#define TSDB_MIN_DB_DELAY 1
#define TSDB_MAX_JOIN_TABLE_NUM 10
#define TSDB_MAX_DB_DELAY 10
#define TSDB_MAX_UNION_CLAUSE 5
#define TSDB_DEFAULT_DB_DELAY 2
#define TSDB_DEFAULT_EXPLAIN_VERBOSE false
#define TSDB_DEFAULT_EXPLAIN_VERBOSE false
#define TSDB_MIN_EXPLAIN_RATIO 0
#define TSDB_MAX_EXPLAIN_RATIO 1
#define TSDB_DEFAULT_EXPLAIN_RATIO 0.001
#define TSDB_EXPLAIN_RESULT_ROW_SIZE 1024
#define TSDB_EXPLAIN_RESULT_ROW_SIZE 1024
#define TSDB_EXPLAIN_RESULT_COLUMN_NAME "QUERY PLAN"
#define TSDB_EXPLAIN_RESULT_COLUMN_NAME "QUERY PLAN"
#define TSDB_MAX_JOIN_TABLE_NUM 10
#define TSDB_MAX_UNION_CLAUSE 5
#define TSDB_MAX_FIELD_LEN 16384
#define TSDB_MAX_FIELD_LEN 16384
#define TSDB_MAX_BINARY_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384
#define TSDB_MAX_BINARY_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384
#define TSDB_MAX_NCHAR_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384
#define TSDB_MAX_NCHAR_LEN (TSDB_MAX_FIELD_LEN - TSDB_KEYSIZE) // keep 16384
...
...
source/client/src/clientImpl.c
浏览文件 @
e0d3ceb5
...
@@ -815,3 +815,68 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
...
@@ -815,3 +815,68 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
return
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
,
return
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
,
convertUcs4
);
convertUcs4
);
}
}
TSDB_SERVER_STATUS
taos_check_server_status
(
const
char
*
fqdn
,
int
port
,
char
*
details
,
int
maxlen
)
{
TSDB_SERVER_STATUS
code
=
TSDB_SRV_STATUS_UNAVAILABLE
;
void
*
clientRpc
=
NULL
;
SServerStatusRsp
statusRsp
=
{
0
};
SEpSet
epSet
=
{.
inUse
=
0
,
.
numOfEps
=
1
};
SRpcMsg
rpcMsg
=
{.
ahandle
=
(
void
*
)
0x9526
,
.
msgType
=
TDMT_DND_SERVER_STATUS
};
SRpcMsg
rpcRsp
=
{
0
};
SRpcInit
rpcInit
=
{
0
};
char
pass
[
TSDB_PASSWORD_LEN
+
1
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)(
"_pwd"
),
strlen
(
"_pwd"
),
pass
);
rpcInit
.
label
=
"CHK"
;
rpcInit
.
numOfThreads
=
1
;
rpcInit
.
cfp
=
NULL
;
rpcInit
.
sessions
=
16
;
rpcInit
.
connType
=
TAOS_CONN_CLIENT
;
rpcInit
.
idleTime
=
tsShellActivityTimer
*
1000
;
rpcInit
.
user
=
"_dnd"
;
rpcInit
.
ckey
=
"_key"
;
rpcInit
.
spi
=
1
;
rpcInit
.
secret
=
pass
;
clientRpc
=
rpcOpen
(
&
rpcInit
);
if
(
clientRpc
==
NULL
)
{
tscError
(
"failed to init server status client"
);
goto
_OVER
;
}
if
(
fqdn
==
NULL
)
{
fqdn
=
tsLocalFqdn
;
}
if
(
port
==
0
)
{
port
=
tsServerPort
;
}
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
fqdn
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
(
uint16_t
)
port
;
rpcSendRecv
(
clientRpc
,
&
epSet
,
&
rpcMsg
,
&
rpcRsp
);
if
(
rpcRsp
.
code
!=
0
||
rpcRsp
.
contLen
<=
0
||
rpcRsp
.
pCont
==
NULL
)
{
tscError
(
"failed to send server status req since %s"
,
terrstr
());
goto
_OVER
;
}
if
(
tDeserializeSServerStatusRsp
(
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
&
statusRsp
)
!=
0
)
{
tscError
(
"failed to parse server status rsp since %s"
,
terrstr
());
goto
_OVER
;
}
code
=
statusRsp
.
statusCode
;
if
(
details
!=
NULL
&&
statusRsp
.
details
!=
NULL
)
{
tstrncpy
(
details
,
statusRsp
.
details
,
maxlen
);
}
_OVER:
if
(
clientRpc
!=
NULL
)
{
rpcClose
(
clientRpc
);
}
if
(
rpcRsp
.
pCont
!=
NULL
)
{
rpcFreeCont
(
rpcRsp
.
pCont
);
}
return
code
;
}
source/client/src/clientMsgHandler.c
浏览文件 @
e0d3ceb5
...
@@ -209,9 +209,9 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -209,9 +209,9 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) {
}
}
void
initMsgHandleFp
()
{
void
initMsgHandleFp
()
{
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CONNECT
)]
=
processConnectRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CONNECT
)]
=
processConnectRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CREATE_DB
)]
=
processCreateDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CREATE_DB
)]
=
processCreateDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_USE_DB
)]
=
processUseDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_USE_DB
)]
=
processUseDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CREATE_STB
)]
=
processCreateTableRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_CREATE_STB
)]
=
processCreateTableRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_DROP_DB
)]
=
processDropDbRsp
;
handleRequestRspFp
[
TMSG_INDEX
(
TDMT_MND_DROP_DB
)]
=
processDropDbRsp
;
}
}
source/common/src/tmsg.c
浏览文件 @
e0d3ceb5
...
@@ -1027,7 +1027,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1027,7 +1027,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
SVnodeLoad
*
pload
=
taosArrayGet
(
pReq
->
pVloads
,
i
);
SVnodeLoad
*
pload
=
taosArrayGet
(
pReq
->
pVloads
,
i
);
if
(
tEncodeI32
(
&
encoder
,
pload
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pload
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI
8
(
&
encoder
,
pload
->
rol
e
)
<
0
)
return
-
1
;
if
(
tEncodeI
32
(
&
encoder
,
pload
->
syncStat
e
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
totalStorage
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pload
->
totalStorage
)
<
0
)
return
-
1
;
...
@@ -1078,7 +1078,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1078,7 +1078,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
vlen
;
++
i
)
{
SVnodeLoad
vload
=
{
0
};
SVnodeLoad
vload
=
{
0
};
if
(
tDecodeI32
(
&
decoder
,
&
vload
.
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
vload
.
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI
8
(
&
decoder
,
&
vload
.
rol
e
)
<
0
)
return
-
1
;
if
(
tDecodeI
32
(
&
decoder
,
&
vload
.
syncStat
e
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
numOfTables
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
numOfTables
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
totalStorage
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
vload
.
totalStorage
)
<
0
)
return
-
1
;
...
@@ -1760,7 +1760,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
...
@@ -1760,7 +1760,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
if
(
tEncodeI8
(
&
encoder
,
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
...
@@ -1803,7 +1803,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
...
@@ -1803,7 +1803,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
ignoreExist
)
<
0
)
return
-
1
;
...
@@ -1851,7 +1851,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
...
@@ -1851,7 +1851,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep2
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep2
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
fsyncPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
fsyncPeriod
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replications
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
...
@@ -1873,7 +1873,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
...
@@ -1873,7 +1873,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep2
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep2
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
fsyncPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
fsyncPeriod
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replications
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
...
@@ -2030,7 +2030,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
...
@@ -2030,7 +2030,7 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
epSetList
);
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
epSetList
);
}
int32_t
tSerializeS
SyncDbReq
(
void
*
buf
,
int32_t
bufLen
,
SSync
DbReq
*
pReq
)
{
int32_t
tSerializeS
CompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompact
DbReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
@@ -2043,7 +2043,7 @@ int32_t tSerializeSSyncDbReq(void *buf, int32_t bufLen, SSyncDbReq *pReq) {
...
@@ -2043,7 +2043,7 @@ int32_t tSerializeSSyncDbReq(void *buf, int32_t bufLen, SSyncDbReq *pReq) {
return
tlen
;
return
tlen
;
}
}
int32_t
tDeserializeS
SyncDbReq
(
void
*
buf
,
int32_t
bufLen
,
SSync
DbReq
*
pReq
)
{
int32_t
tDeserializeS
CompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompact
DbReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
...
@@ -2231,7 +2231,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
...
@@ -2231,7 +2231,7 @@ int32_t tSerializeSDbCfgRsp(void *buf, int32_t bufLen, const SDbCfgRsp *pRsp) {
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
quorum
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
update
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
update
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
streamMode
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pRsp
->
streamMode
)
<
0
)
return
-
1
;
...
@@ -2270,7 +2270,7 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
...
@@ -2270,7 +2270,7 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
replications
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
quorum
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
update
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
update
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
streamMode
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
streamMode
)
<
0
)
return
-
1
;
...
@@ -2880,7 +2880,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
...
@@ -2880,7 +2880,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
if
(
tEncodeI8
(
&
encoder
,
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replica
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replica
)
<
0
)
return
-
1
;
...
@@ -2931,7 +2931,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
...
@@ -2931,7 +2931,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
precision
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
compression
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
quorum
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
update
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replica
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replica
)
<
0
)
return
-
1
;
...
@@ -3003,6 +3003,87 @@ int32_t tDeserializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq
...
@@ -3003,6 +3003,87 @@ int32_t tDeserializeSDropVnodeReq(void *buf, int32_t bufLen, SDropVnodeReq *pReq
return
0
;
return
0
;
}
}
int32_t
tSerializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
dbUid
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSCompactVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactVnodeReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
dbUid
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
totalBlocks
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep2
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
replica
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
selfIndex
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
SReplica
*
pReplica
=
&
pReq
->
replicas
[
i
];
if
(
tEncodeSReplica
(
&
encoder
,
pReplica
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSAlterVnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SAlterVnodeReq
*
pReq
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
vgVersion
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
totalBlocks
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep2
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
walLevel
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
replica
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
selfIndex
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
TSDB_MAX_REPLICA
;
++
i
)
{
SReplica
*
pReplica
=
&
pReq
->
replicas
[
i
];
if
(
tDecodeSReplica
(
&
decoder
,
pReplica
)
<
0
)
return
-
1
;
}
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
)
{
int32_t
tSerializeSKillQueryReq
(
void
*
buf
,
int32_t
bufLen
,
SKillQueryReq
*
pReq
)
{
SCoder
encoder
=
{
0
};
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
...
@@ -3148,6 +3229,34 @@ int32_t tDeserializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) {
...
@@ -3148,6 +3229,34 @@ int32_t tDeserializeSAuthReq(void *buf, int32_t bufLen, SAuthReq *pReq) {
return
0
;
return
0
;
}
}
int32_t
tSerializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pRsp
->
statusCode
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pRsp
->
details
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSServerStatusRsp
(
void
*
buf
,
int32_t
bufLen
,
SServerStatusRsp
*
pRsp
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
statusCode
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pRsp
->
details
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
int32_t
tEncodeSMqOffset
(
SCoder
*
encoder
,
const
SMqOffset
*
pOffset
)
{
int32_t
tEncodeSMqOffset
(
SCoder
*
encoder
,
const
SMqOffset
*
pOffset
)
{
if
(
tEncodeI32
(
encoder
,
pOffset
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
encoder
,
pOffset
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pOffset
->
offset
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
encoder
,
pOffset
->
offset
)
<
0
)
return
-
1
;
...
...
source/common/src/tmsgcb.c
浏览文件 @
e0d3ceb5
...
@@ -40,4 +40,8 @@ void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) {
...
@@ -40,4 +40,8 @@ void tmsgRegisterBrokenLinkArg(const SMsgCb* pMsgCb, SRpcMsg* pMsg) {
void
tmsgReleaseHandle
(
void
*
handle
,
int8_t
type
)
{
void
tmsgReleaseHandle
(
void
*
handle
,
int8_t
type
)
{
(
*
tsDefaultMsgCb
.
releaseHandleFp
)(
tsDefaultMsgCb
.
pWrapper
,
handle
,
type
);
(
*
tsDefaultMsgCb
.
releaseHandleFp
)(
tsDefaultMsgCb
.
pWrapper
,
handle
,
type
);
}
void
tmsgReportStartup
(
const
char
*
name
,
const
char
*
desc
)
{
(
*
tsDefaultMsgCb
.
reportStartupFp
)(
tsDefaultMsgCb
.
pWrapper
,
name
,
desc
);
}
}
\ No newline at end of file
source/dnode/mgmt/implement/inc/dmImp.h
浏览文件 @
e0d3ceb5
...
@@ -49,6 +49,7 @@ int32_t dmProcessDropNodeReq(SDnode *pDnode, EDndNodeType ntype, SNodeMsg *pMsg)
...
@@ -49,6 +49,7 @@ int32_t dmProcessDropNodeReq(SDnode *pDnode, EDndNodeType ntype, SNodeMsg *pMsg)
// dmMonitor.c
// dmMonitor.c
void
dmGetVnodeLoads
(
SDnode
*
pDnode
,
SMonVloadInfo
*
pInfo
);
void
dmGetVnodeLoads
(
SDnode
*
pDnode
,
SMonVloadInfo
*
pInfo
);
void
dmGetMnodeLoads
(
SDnode
*
pDnode
,
SMonMloadInfo
*
pInfo
);
void
dmSendMonitorReport
(
SDnode
*
pDnode
);
void
dmSendMonitorReport
(
SDnode
*
pDnode
);
// dmWorker.c
// dmWorker.c
...
@@ -70,6 +71,7 @@ void vmSetMgmtFp(SMgmtWrapper *pWrapper);
...
@@ -70,6 +71,7 @@ void vmSetMgmtFp(SMgmtWrapper *pWrapper);
void
mmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
mmSetMgmtFp
(
SMgmtWrapper
*
pWrapper
);
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
);
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
);
void
mmGetMnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonMloadInfo
*
pInfo
);
void
mmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonMmInfo
*
mmInfo
);
void
mmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonMmInfo
*
mmInfo
);
void
vmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonVmInfo
*
vmInfo
);
void
vmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonVmInfo
*
vmInfo
);
void
qmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonQmInfo
*
qmInfo
);
void
qmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonQmInfo
*
qmInfo
);
...
...
source/dnode/mgmt/implement/src/dmExec.c
浏览文件 @
e0d3ceb5
...
@@ -140,6 +140,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
...
@@ -140,6 +140,7 @@ int32_t dmOpenNode(SMgmtWrapper *pWrapper) {
if
(
dmRunParentProc
(
pWrapper
)
!=
0
)
return
-
1
;
if
(
dmRunParentProc
(
pWrapper
)
!=
0
)
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
pWrapper
->
name
,
"openned"
);
return
0
;
return
0
;
}
}
...
@@ -161,6 +162,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) {
...
@@ -161,6 +162,7 @@ int32_t dmStartNode(SMgmtWrapper *pWrapper) {
}
}
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
pWrapper
->
name
,
"started"
);
return
0
;
return
0
;
}
}
...
@@ -172,6 +174,11 @@ void dmStopNode(SMgmtWrapper *pWrapper) {
...
@@ -172,6 +174,11 @@ void dmStopNode(SMgmtWrapper *pWrapper) {
void
dmCloseNode
(
SMgmtWrapper
*
pWrapper
)
{
void
dmCloseNode
(
SMgmtWrapper
*
pWrapper
)
{
dInfo
(
"node:%s, start to close"
,
pWrapper
->
name
);
dInfo
(
"node:%s, start to close"
,
pWrapper
->
name
);
while
(
pWrapper
->
refCount
>
0
)
{
taosMsleep
(
10
);
}
if
(
pWrapper
->
procType
==
DND_PROC_PARENT
)
{
if
(
pWrapper
->
procType
==
DND_PROC_PARENT
)
{
if
(
pWrapper
->
procId
>
0
&&
taosProcExist
(
pWrapper
->
procId
))
{
if
(
pWrapper
->
procId
>
0
&&
taosProcExist
(
pWrapper
->
procId
))
{
dInfo
(
"node:%s, send kill signal to the child process:%d"
,
pWrapper
->
name
,
pWrapper
->
procId
);
dInfo
(
"node:%s, send kill signal to the child process:%d"
,
pWrapper
->
name
,
pWrapper
->
procId
);
...
@@ -184,18 +191,10 @@ void dmCloseNode(SMgmtWrapper *pWrapper) {
...
@@ -184,18 +191,10 @@ void dmCloseNode(SMgmtWrapper *pWrapper) {
dmStopNode
(
pWrapper
);
dmStopNode
(
pWrapper
);
pWrapper
->
required
=
false
;
taosWLockLatch
(
&
pWrapper
->
latch
);
taosWLockLatch
(
&
pWrapper
->
latch
);
if
(
pWrapper
->
deployed
)
{
(
*
pWrapper
->
fp
.
closeFp
)(
pWrapper
);
(
*
pWrapper
->
fp
.
closeFp
)(
pWrapper
);
pWrapper
->
deployed
=
false
;
}
taosWUnLockLatch
(
&
pWrapper
->
latch
);
taosWUnLockLatch
(
&
pWrapper
->
latch
);
while
(
pWrapper
->
refCount
>
0
)
{
taosMsleep
(
10
);
}
if
(
pWrapper
->
procObj
)
{
if
(
pWrapper
->
procObj
)
{
taosProcCleanup
(
pWrapper
->
procObj
);
taosProcCleanup
(
pWrapper
->
procObj
);
pWrapper
->
procObj
=
NULL
;
pWrapper
->
procObj
=
NULL
;
...
...
source/dnode/mgmt/implement/src/dmHandle.c
浏览文件 @
e0d3ceb5
...
@@ -36,7 +36,8 @@ static int32_t dmProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp) {
...
@@ -36,7 +36,8 @@ static int32_t dmProcessStatusRsp(SDnode *pDnode, SRpcMsg *pRsp) {
}
}
}
else
{
}
else
{
SStatusRsp
statusRsp
=
{
0
};
SStatusRsp
statusRsp
=
{
0
};
if
(
pRsp
->
pCont
!=
NULL
&&
pRsp
->
contLen
>
0
&&
tDeserializeSStatusRsp
(
pRsp
->
pCont
,
pRsp
->
contLen
,
&
statusRsp
)
==
0
)
{
if
(
pRsp
->
pCont
!=
NULL
&&
pRsp
->
contLen
>
0
&&
tDeserializeSStatusRsp
(
pRsp
->
pCont
,
pRsp
->
contLen
,
&
statusRsp
)
==
0
)
{
pDnode
->
data
.
dnodeVer
=
statusRsp
.
dnodeVer
;
pDnode
->
data
.
dnodeVer
=
statusRsp
.
dnodeVer
;
dmUpdateDnodeCfg
(
pDnode
,
&
statusRsp
.
dnodeCfg
);
dmUpdateDnodeCfg
(
pDnode
,
&
statusRsp
.
dnodeCfg
);
dmUpdateEps
(
pDnode
,
statusRsp
.
pDnodeEps
);
dmUpdateEps
(
pDnode
,
statusRsp
.
pDnodeEps
);
...
@@ -71,12 +72,26 @@ void dmSendStatusReq(SDnode *pDnode) {
...
@@ -71,12 +72,26 @@ void dmSendStatusReq(SDnode *pDnode) {
memcpy
(
req
.
clusterCfg
.
charset
,
tsCharset
,
TD_LOCALE_LEN
);
memcpy
(
req
.
clusterCfg
.
charset
,
tsCharset
,
TD_LOCALE_LEN
);
taosRUnLockLatch
(
&
pDnode
->
data
.
latch
);
taosRUnLockLatch
(
&
pDnode
->
data
.
latch
);
SMonVloadInfo
info
=
{
0
};
SMonVloadInfo
vinfo
=
{
0
};
dmGetVnodeLoads
(
pDnode
,
&
info
);
dmGetVnodeLoads
(
pDnode
,
&
vinfo
);
req
.
pVloads
=
info
.
pVloads
;
req
.
pVloads
=
vinfo
.
pVloads
;
pDnode
->
data
.
unsyncedVgId
=
0
;
pDnode
->
data
.
vndState
=
TAOS_SYNC_STATE_LEADER
;
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
req
.
pVloads
);
++
i
)
{
SVnodeLoad
*
pLoad
=
taosArrayGet
(
req
.
pVloads
,
i
);
if
(
pLoad
->
syncState
!=
TAOS_SYNC_STATE_LEADER
&&
pLoad
->
syncState
!=
TAOS_SYNC_STATE_FOLLOWER
)
{
pDnode
->
data
.
unsyncedVgId
=
pLoad
->
vgId
;
pDnode
->
data
.
vndState
=
pLoad
->
syncState
;
}
}
SMonMloadInfo
minfo
=
{
0
};
dmGetMnodeLoads
(
pDnode
,
&
minfo
);
pDnode
->
data
.
isMnode
=
minfo
.
isMnode
;
pDnode
->
data
.
mndState
=
minfo
.
load
.
syncState
;
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
tSerializeSStatusReq
(
pHead
,
contLen
,
&
req
);
tSerializeSStatusReq
(
pHead
,
contLen
,
&
req
);
tFreeSStatusReq
(
&
req
);
tFreeSStatusReq
(
&
req
);
...
@@ -101,7 +116,7 @@ int32_t dmProcessGrantRsp(SDnode *pDnode, SNodeMsg *pMsg) {
...
@@ -101,7 +116,7 @@ int32_t dmProcessGrantRsp(SDnode *pDnode, SNodeMsg *pMsg) {
}
}
int32_t
dmProcessConfigReq
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
)
{
int32_t
dmProcessConfigReq
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDCfgDnodeReq
*
pCfg
=
pReq
->
pCont
;
SDCfgDnodeReq
*
pCfg
=
pReq
->
pCont
;
dError
(
"config req is received, but not supported yet"
);
dError
(
"config req is received, but not supported yet"
);
return
TSDB_CODE_OPS_NOT_SUPPORT
;
return
TSDB_CODE_OPS_NOT_SUPPORT
;
...
@@ -160,9 +175,9 @@ int32_t dmProcessDropNodeReq(SDnode *pDnode, EDndNodeType ntype, SNodeMsg *pMsg)
...
@@ -160,9 +175,9 @@ int32_t dmProcessDropNodeReq(SDnode *pDnode, EDndNodeType ntype, SNodeMsg *pMsg)
dmReleaseWrapper
(
pWrapper
);
dmReleaseWrapper
(
pWrapper
);
if
(
code
==
0
)
{
if
(
code
==
0
)
{
dmCloseNode
(
pWrapper
);
pWrapper
->
required
=
false
;
pWrapper
->
required
=
false
;
pWrapper
->
deployed
=
false
;
pWrapper
->
deployed
=
false
;
dmCloseNode
(
pWrapper
);
taosRemoveDir
(
pWrapper
->
path
);
taosRemoveDir
(
pWrapper
->
path
);
}
}
taosThreadMutexUnlock
(
&
pDnode
->
mutex
);
taosThreadMutexUnlock
(
&
pDnode
->
mutex
);
...
@@ -230,6 +245,7 @@ static int32_t dmInitMgmt(SMgmtWrapper *pWrapper) {
...
@@ -230,6 +245,7 @@ static int32_t dmInitMgmt(SMgmtWrapper *pWrapper) {
dError
(
"failed to init transport since %s"
,
terrstr
());
dError
(
"failed to init transport since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pDnode
,
"dnode-transport"
,
"initialized"
);
dInfo
(
"dnode-mgmt is initialized"
);
dInfo
(
"dnode-mgmt is initialized"
);
return
0
;
return
0
;
...
...
source/dnode/mgmt/implement/src/dmMonitor.c
浏览文件 @
e0d3ceb5
...
@@ -183,3 +183,29 @@ void dmGetVnodeLoads(SDnode *pDnode, SMonVloadInfo *pInfo) {
...
@@ -183,3 +183,29 @@ void dmGetVnodeLoads(SDnode *pDnode, SMonVloadInfo *pInfo) {
}
}
dmReleaseWrapper
(
pWrapper
);
dmReleaseWrapper
(
pWrapper
);
}
}
void
dmGetMnodeLoads
(
SDnode
*
pDnode
,
SMonMloadInfo
*
pInfo
)
{
SMgmtWrapper
*
pWrapper
=
dmAcquireWrapper
(
pDnode
,
MNODE
);
if
(
pWrapper
==
NULL
)
{
pInfo
->
isMnode
=
0
;
return
;
}
bool
getFromAPI
=
!
tsMultiProcess
;
if
(
getFromAPI
)
{
mmGetMnodeLoads
(
pWrapper
,
pInfo
);
}
else
{
SRpcMsg
req
=
{.
msgType
=
TDMT_MON_MM_LOAD
};
SRpcMsg
rsp
=
{
0
};
SEpSet
epset
=
{.
inUse
=
0
,
.
numOfEps
=
1
};
tstrncpy
(
epset
.
eps
[
0
].
fqdn
,
pDnode
->
data
.
localFqdn
,
TSDB_FQDN_LEN
);
epset
.
eps
[
0
].
port
=
tsServerPort
;
dmSendRecv
(
pDnode
,
&
epset
,
&
req
,
&
rsp
);
if
(
rsp
.
code
==
0
&&
rsp
.
contLen
>
0
)
{
tDeserializeSMonMloadInfo
(
rsp
.
pCont
,
rsp
.
contLen
,
pInfo
);
}
rpcFreeCont
(
rsp
.
pCont
);
}
dmReleaseWrapper
(
pWrapper
);
}
source/dnode/mgmt/implement/src/dmTransport.c
浏览文件 @
e0d3ceb5
...
@@ -125,9 +125,9 @@ static void dmProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -125,9 +125,9 @@ static void dmProcessMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
SMsgHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
SMsgHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
SMgmtWrapper
*
pWrapper
=
pHandle
->
pNdWrapper
;
SMgmtWrapper
*
pWrapper
=
pHandle
->
pNdWrapper
;
if
(
msgType
==
TDMT_DND_
NETWORK_TEST
)
{
if
(
msgType
==
TDMT_DND_
SERVER_STATUS
)
{
dTrace
(
"
network test
req will be processed, handle:%p, app:%p"
,
pMsg
->
handle
,
pMsg
->
ahandle
);
dTrace
(
"
server status
req will be processed, handle:%p, app:%p"
,
pMsg
->
handle
,
pMsg
->
ahandle
);
dmProcessS
tartup
Req
(
pDnode
,
pMsg
);
dmProcessS
erverStatus
Req
(
pDnode
,
pMsg
);
return
;
return
;
}
}
...
@@ -519,6 +519,7 @@ SMsgCb dmGetMsgcb(SMgmtWrapper *pWrapper) {
...
@@ -519,6 +519,7 @@ SMsgCb dmGetMsgcb(SMgmtWrapper *pWrapper) {
.
sendRspFp
=
dmSendRsp
,
.
sendRspFp
=
dmSendRsp
,
.
registerBrokenLinkArgFp
=
dmRegisterBrokenLinkArg
,
.
registerBrokenLinkArgFp
=
dmRegisterBrokenLinkArg
,
.
releaseHandleFp
=
dmReleaseHandle
,
.
releaseHandleFp
=
dmReleaseHandle
,
.
reportStartupFp
=
dmReportStartupByWrapper
,
.
pWrapper
=
pWrapper
,
.
pWrapper
=
pWrapper
,
};
};
return
msgCb
;
return
msgCb
;
...
...
source/dnode/mgmt/implement/src/dmWorker.c
浏览文件 @
e0d3ceb5
...
@@ -74,6 +74,7 @@ int32_t dmStartStatusThread(SDnode *pDnode) {
...
@@ -74,6 +74,7 @@ int32_t dmStartStatusThread(SDnode *pDnode) {
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pDnode
,
"dnode-status"
,
"initialized"
);
return
0
;
return
0
;
}
}
...
@@ -92,6 +93,7 @@ int32_t dmStartMonitorThread(SDnode *pDnode) {
...
@@ -92,6 +93,7 @@ int32_t dmStartMonitorThread(SDnode *pDnode) {
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pDnode
,
"dnode-monitor"
,
"initialized"
);
return
0
;
return
0
;
}
}
...
...
source/dnode/mgmt/interface/inc/dmDef.h
浏览文件 @
e0d3ceb5
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include "dnode.h"
#include "dnode.h"
#include "mnode.h"
#include "mnode.h"
#include "monitor.h"
#include "monitor.h"
#include "sync.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -110,6 +111,10 @@ typedef struct {
...
@@ -110,6 +111,10 @@ typedef struct {
int64_t
dnodeVer
;
int64_t
dnodeVer
;
int64_t
updateTime
;
int64_t
updateTime
;
int64_t
rebootTime
;
int64_t
rebootTime
;
int32_t
unsyncedVgId
;
ESyncState
vndState
;
ESyncState
mndState
;
bool
isMnode
;
bool
dropped
;
bool
dropped
;
SEpSet
mnodeEps
;
SEpSet
mnodeEps
;
SArray
*
dnodeEps
;
SArray
*
dnodeEps
;
...
@@ -132,12 +137,17 @@ typedef struct {
...
@@ -132,12 +137,17 @@ typedef struct {
uint16_t
serverPort
;
uint16_t
serverPort
;
}
SDnodeData
;
}
SDnodeData
;
typedef
struct
{
char
name
[
TSDB_STEP_NAME_LEN
];
char
desc
[
TSDB_STEP_DESC_LEN
];
}
SStartupInfo
;
typedef
struct
SDnode
{
typedef
struct
SDnode
{
EDndProcType
ptype
;
EDndProcType
ptype
;
EDndNodeType
ntype
;
EDndNodeType
ntype
;
EDndRunStatus
status
;
EDndRunStatus
status
;
EDndEvent
event
;
EDndEvent
event
;
SStartup
Req
startup
;
SStartup
Info
startup
;
SDnodeTrans
trans
;
SDnodeTrans
trans
;
SDnodeData
data
;
SDnodeData
data
;
TdThreadMutex
mutex
;
TdThreadMutex
mutex
;
...
...
source/dnode/mgmt/interface/inc/dmInt.h
浏览文件 @
e0d3ceb5
...
@@ -35,7 +35,8 @@ void dmSetStatus(SDnode *pDnode, EDndRunStatus stat);
...
@@ -35,7 +35,8 @@ void dmSetStatus(SDnode *pDnode, EDndRunStatus stat);
void
dmSetEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dmSetEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
void
dmSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
void
dmSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
tmsg_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int8_t
vgId
);
void
dmReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dmReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dmProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmReportStartupByWrapper
(
SMgmtWrapper
*
pWrapper
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dmProcessServerStatusReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
void
dmGetMonitorSysInfo
(
SMonSysInfo
*
pInfo
);
void
dmGetMonitorSysInfo
(
SMonSysInfo
*
pInfo
);
// dmFile.c
// dmFile.c
...
...
source/dnode/mgmt/interface/src/dmInt.c
浏览文件 @
e0d3ceb5
...
@@ -137,26 +137,65 @@ void dmReleaseWrapper(SMgmtWrapper *pWrapper) {
...
@@ -137,26 +137,65 @@ void dmReleaseWrapper(SMgmtWrapper *pWrapper) {
}
}
void
dmReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
)
{
void
dmReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
)
{
SStartup
Req
*
pStartup
=
&
pDnode
->
startup
;
SStartup
Info
*
pStartup
=
&
pDnode
->
startup
;
tstrncpy
(
pStartup
->
name
,
pName
,
TSDB_STEP_NAME_LEN
);
tstrncpy
(
pStartup
->
name
,
pName
,
TSDB_STEP_NAME_LEN
);
tstrncpy
(
pStartup
->
desc
,
pDesc
,
TSDB_STEP_DESC_LEN
);
tstrncpy
(
pStartup
->
desc
,
pDesc
,
TSDB_STEP_DESC_LEN
);
pStartup
->
finished
=
0
;
dInfo
(
"step:%s, %s"
,
pStartup
->
name
,
pStartup
->
desc
)
;
}
}
static
void
dmGetStartup
(
SDnode
*
pDnode
,
SStartupReq
*
pStartup
)
{
void
dmReportStartupByWrapper
(
SMgmtWrapper
*
pWrapper
,
const
char
*
pName
,
const
char
*
pDesc
)
{
memcpy
(
pStartup
,
&
pDnode
->
startup
,
sizeof
(
SStartupReq
));
dmReportStartup
(
pWrapper
->
pDnode
,
pName
,
pDesc
);
pStartup
->
finished
=
(
pDnode
->
status
==
DND_STAT_RUNNING
);
}
}
void
dmProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
static
void
dmGetServerStatus
(
SDnode
*
pDnode
,
SServerStatusRsp
*
pStatus
)
{
dDebug
(
"startup req is received"
);
pStatus
->
details
[
0
]
=
0
;
SStartupReq
*
pStartup
=
rpcMallocCont
(
sizeof
(
SStartupReq
));
dmGetStartup
(
pDnode
,
pStartup
);
dDebug
(
"startup req is sent, step:%s desc:%s finished:%d"
,
pStartup
->
name
,
pStartup
->
desc
,
pStartup
->
finished
);
if
(
pDnode
->
status
==
DND_STAT_INIT
)
{
SRpcMsg
rpcRsp
=
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_NETWORK_OK
;
.
handle
=
pReq
->
handle
,
.
pCont
=
pStartup
,
.
contLen
=
sizeof
(
SStartupReq
),
.
ahandle
=
pReq
->
ahandle
};
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"%s: %s"
,
pDnode
->
startup
.
name
,
pDnode
->
startup
.
desc
);
rpcSendResponse
(
&
rpcRsp
);
}
else
if
(
pDnode
->
status
==
DND_STAT_STOPPED
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_EXTING
;
}
else
{
SDnodeData
*
pData
=
&
pDnode
->
data
;
if
(
pData
->
isMnode
&&
pData
->
mndState
!=
TAOS_SYNC_STATE_LEADER
&&
pData
->
mndState
==
TAOS_SYNC_STATE_FOLLOWER
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"mnode sync state is %s"
,
syncStr
(
pData
->
mndState
));
}
else
if
(
pData
->
unsyncedVgId
!=
0
&&
pData
->
vndState
!=
TAOS_SYNC_STATE_LEADER
&&
pData
->
vndState
!=
TAOS_SYNC_STATE_FOLLOWER
)
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_DEGRADED
;
snprintf
(
pStatus
->
details
,
sizeof
(
pStatus
->
details
),
"vnode:%d sync state is %s"
,
pData
->
unsyncedVgId
,
syncStr
(
pData
->
vndState
));
}
else
{
pStatus
->
statusCode
=
TSDB_SRV_STATUS_SERVICE_OK
;
}
}
}
void
dmProcessServerStatusReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"server status req is received"
);
SServerStatusRsp
statusRsp
=
{
0
};
dmGetServerStatus
(
pDnode
,
&
statusRsp
);
SRpcMsg
rspMsg
=
{.
handle
=
pReq
->
handle
,
.
ahandle
=
pReq
->
ahandle
};
int32_t
rspLen
=
tSerializeSServerStatusRsp
(
NULL
,
0
,
&
statusRsp
);
if
(
rspLen
<
0
)
{
rspMsg
.
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
rspMsg
.
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
tSerializeSServerStatusRsp
(
pRsp
,
rspLen
,
&
statusRsp
);
rspMsg
.
pCont
=
pRsp
;
rspMsg
.
contLen
=
rspLen
;
_OVER:
rpcSendResponse
(
&
rspMsg
);
}
}
void
dmGetMonitorSysInfo
(
SMonSysInfo
*
pInfo
)
{
void
dmGetMonitorSysInfo
(
SMonSysInfo
*
pInfo
)
{
...
...
source/dnode/mgmt/mgmt_bnode/src/bmInt.c
浏览文件 @
e0d3ceb5
...
@@ -61,12 +61,14 @@ int32_t bmOpen(SMgmtWrapper *pWrapper) {
...
@@ -61,12 +61,14 @@ int32_t bmOpen(SMgmtWrapper *pWrapper) {
bmClose
(
pWrapper
);
bmClose
(
pWrapper
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"bnode-impl"
,
"initialized"
);
if
(
bmStartWorker
(
pMgmt
)
!=
0
)
{
if
(
bmStartWorker
(
pMgmt
)
!=
0
)
{
dError
(
"failed to start bnode worker since %s"
,
terrstr
());
dError
(
"failed to start bnode worker since %s"
,
terrstr
());
bmClose
(
pWrapper
);
bmClose
(
pWrapper
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"bnode-worker"
,
"initialized"
);
return
0
;
return
0
;
}
}
...
...
source/dnode/mgmt/mgmt_mnode/inc/mmInt.h
浏览文件 @
e0d3ceb5
...
@@ -52,6 +52,8 @@ int32_t mmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
...
@@ -52,6 +52,8 @@ int32_t mmProcessCreateReq(SMgmtWrapper *pWrapper, SNodeMsg *pMsg);
int32_t
mmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessDropReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessAlterReq
(
SMnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessAlterReq
(
SMnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
);
int32_t
mmProcessGetMonMmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
int32_t
mmProcessGetMonMmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
int32_t
mmProcessGetMnodeLoadsReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
void
mmGetMnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonMloadInfo
*
pInfo
);
// mmWorker.c
// mmWorker.c
int32_t
mmStartWorker
(
SMnodeMgmt
*
pMgmt
);
int32_t
mmStartWorker
(
SMnodeMgmt
*
pMgmt
);
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
e0d3ceb5
...
@@ -46,6 +46,34 @@ int32_t mmProcessGetMonMmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
...
@@ -46,6 +46,34 @@ int32_t mmProcessGetMonMmInfoReq(SMgmtWrapper *pWrapper, SNodeMsg *pReq) {
return
0
;
return
0
;
}
}
void
mmGetMnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonMloadInfo
*
pInfo
)
{
SMnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
pInfo
->
isMnode
=
1
;
mndGetLoad
(
pMgmt
->
pMnode
,
&
pInfo
->
load
);
}
int32_t
mmProcessGetMnodeLoadsReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
SMonMloadInfo
mloads
=
{
0
};
mmGetMnodeLoads
(
pWrapper
,
&
mloads
);
int32_t
rspLen
=
tSerializeSMonMloadInfo
(
NULL
,
0
,
&
mloads
);
if
(
rspLen
<
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
tSerializeSMonMloadInfo
(
pRsp
,
rspLen
,
&
mloads
);
pReq
->
pRsp
=
pRsp
;
pReq
->
rspLen
=
rspLen
;
return
0
;
}
int32_t
mmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
int32_t
mmProcessCreateReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pMsg
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
...
@@ -117,6 +145,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
...
@@ -117,6 +145,7 @@ int32_t mmProcessAlterReq(SMnodeMgmt *pMgmt, SNodeMsg *pMsg) {
void
mmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
void
mmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_MM_INFO
,
mmProcessMonitorMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_MM_INFO
,
mmProcessMonitorMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_MM_LOAD
,
mmProcessMonitorMsg
,
DEFAULT_HANDLE
);
// Requests handled by DNODE
// Requests handled by DNODE
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_MNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
...
@@ -129,10 +158,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
...
@@ -129,10 +158,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_BNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_BNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_BNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_BNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_SYNC_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_COMPACT_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CONFIG_DNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CONFIG_DNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
// Requests handled by MNODE
// Requests handled by MNODE
...
@@ -159,7 +185,6 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
...
@@ -159,7 +185,6 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_DROP_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_DROP_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_USE_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_USE_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_ALTER_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_ALTER_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_SYNC_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_COMPACT_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_COMPACT_DB
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_CREATE_FUNC
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_CREATE_FUNC
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_RETRIEVE_FUNC
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MND_RETRIEVE_FUNC
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
...
@@ -206,4 +231,8 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
...
@@ -206,4 +231,8 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) {
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_FETCH
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_FETCH
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_TASK
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_TASK
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
mmProcessQueryMsg
,
MNODE_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_ALTER_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_SYNC_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_COMPACT_VNODE_RSP
,
mmProcessWriteMsg
,
DEFAULT_HANDLE
);
}
}
source/dnode/mgmt/mgmt_mnode/src/mmInt.c
浏览文件 @
e0d3ceb5
...
@@ -176,12 +176,14 @@ static int32_t mmOpen(SMgmtWrapper *pWrapper) {
...
@@ -176,12 +176,14 @@ static int32_t mmOpen(SMgmtWrapper *pWrapper) {
mmClose
(
pWrapper
);
mmClose
(
pWrapper
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"mnode-impl"
,
"initialized"
);
if
(
mmStartWorker
(
pMgmt
)
!=
0
)
{
if
(
mmStartWorker
(
pMgmt
)
!=
0
)
{
dError
(
"failed to start mnode worker since %s"
,
terrstr
());
dError
(
"failed to start mnode worker since %s"
,
terrstr
());
mmClose
(
pWrapper
);
mmClose
(
pWrapper
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"mnode-worker"
,
"initialized"
);
if
(
!
deployed
)
{
if
(
!
deployed
)
{
deployed
=
true
;
deployed
=
true
;
...
...
source/dnode/mgmt/mgmt_mnode/src/mmWorker.c
浏览文件 @
e0d3ceb5
...
@@ -36,6 +36,8 @@ static void mmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
...
@@ -36,6 +36,8 @@ static void mmProcessQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
code
=
mmProcessAlterReq
(
pMgmt
,
pMsg
);
code
=
mmProcessAlterReq
(
pMgmt
,
pMsg
);
}
else
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_MM_INFO
)
{
}
else
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_MM_INFO
)
{
code
=
mmProcessGetMonMmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
code
=
mmProcessGetMonMmInfoReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
if
(
pMsg
->
rpcMsg
.
msgType
==
TDMT_MON_MM_LOAD
)
{
code
=
mmProcessGetMnodeLoadsReq
(
pMgmt
->
pWrapper
,
pMsg
);
}
else
{
}
else
{
pMsg
->
pNode
=
pMgmt
->
pMnode
;
pMsg
->
pNode
=
pMgmt
->
pMnode
;
code
=
mndProcessMsg
(
pMsg
);
code
=
mndProcessMsg
(
pMsg
);
...
...
source/dnode/mgmt/mgmt_qnode/src/qmInt.c
浏览文件 @
e0d3ceb5
...
@@ -64,12 +64,14 @@ static int32_t qmOpen(SMgmtWrapper *pWrapper) {
...
@@ -64,12 +64,14 @@ static int32_t qmOpen(SMgmtWrapper *pWrapper) {
qmClose
(
pWrapper
);
qmClose
(
pWrapper
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"qnode-impl"
,
"initialized"
);
if
(
qmStartWorker
(
pMgmt
)
!=
0
)
{
if
(
qmStartWorker
(
pMgmt
)
!=
0
)
{
dError
(
"failed to start qnode worker since %s"
,
terrstr
());
dError
(
"failed to start qnode worker since %s"
,
terrstr
());
qmClose
(
pWrapper
);
qmClose
(
pWrapper
);
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"qnode-worker"
,
"initialized"
);
dInfo
(
"qnode-mgmt is initialized"
);
dInfo
(
"qnode-mgmt is initialized"
);
return
0
;
return
0
;
...
...
source/dnode/mgmt/mgmt_snode/src/smInt.c
浏览文件 @
e0d3ceb5
...
@@ -60,11 +60,13 @@ int32_t smOpen(SMgmtWrapper *pWrapper) {
...
@@ -60,11 +60,13 @@ int32_t smOpen(SMgmtWrapper *pWrapper) {
dError
(
"failed to open snode since %s"
,
terrstr
());
dError
(
"failed to open snode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"snode-impl"
,
"initialized"
);
if
(
smStartWorker
(
pMgmt
)
!=
0
)
{
if
(
smStartWorker
(
pMgmt
)
!=
0
)
{
dError
(
"failed to start snode worker since %s"
,
terrstr
());
dError
(
"failed to start snode worker since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pWrapper
->
pDnode
,
"snode-worker"
,
"initialized"
);
return
0
;
return
0
;
}
}
...
...
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
浏览文件 @
e0d3ceb5
...
@@ -29,7 +29,6 @@ typedef struct SVnodesMgmt {
...
@@ -29,7 +29,6 @@ typedef struct SVnodesMgmt {
SHashObj
*
hash
;
SHashObj
*
hash
;
SRWLatch
latch
;
SRWLatch
latch
;
SVnodesStat
state
;
SVnodesStat
state
;
SVnodesStat
lastState
;
STfs
*
pTfs
;
STfs
*
pTfs
;
SQWorkerPool
queryPool
;
SQWorkerPool
queryPool
;
SQWorkerPool
fetchPool
;
SQWorkerPool
fetchPool
;
...
@@ -90,10 +89,7 @@ void vmCloseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode);
...
@@ -90,10 +89,7 @@ void vmCloseVnode(SVnodesMgmt *pMgmt, SVnodeObj *pVnode);
// vmHandle.c
// vmHandle.c
void
vmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
void
vmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
);
int32_t
vmProcessCreateVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessCreateVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessAlterVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessSyncVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessCompactVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pReq
);
int32_t
vmProcessGetMonVmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
int32_t
vmProcessGetMonVmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
int32_t
vmProcessGetVnodeLoadsReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
int32_t
vmProcessGetVnodeLoadsReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
);
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
);
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
e0d3ceb5
...
@@ -16,21 +16,42 @@
...
@@ -16,21 +16,42 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "vmInt.h"
#include "vmInt.h"
void
vmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonVmInfo
*
vm
Info
)
{
void
vmGetMonitorInfo
(
SMgmtWrapper
*
pWrapper
,
SMonVmInfo
*
p
Info
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
tfsGetMonitorInfo
(
pMgmt
->
pTfs
,
&
vmInfo
->
tfs
);
SMonVloadInfo
vloads
=
{
0
};
taosWLockLatch
(
&
pMgmt
->
latch
);
vmGetVnodeLoads
(
pWrapper
,
&
vloads
);
vmInfo
->
vstat
.
totalVnodes
=
pMgmt
->
state
.
totalVnodes
;
if
(
vloads
.
pVloads
==
NULL
)
return
;
vmInfo
->
vstat
.
masterNum
=
pMgmt
->
state
.
masterNum
;
vmInfo
->
vstat
.
numOfSelectReqs
=
pMgmt
->
state
.
numOfSelectReqs
-
pMgmt
->
lastState
.
numOfSelectReqs
;
int32_t
totalVnodes
=
0
;
vmInfo
->
vstat
.
numOfInsertReqs
=
pMgmt
->
state
.
numOfInsertReqs
-
pMgmt
->
lastState
.
numOfInsertReqs
;
int32_t
masterNum
=
0
;
vmInfo
->
vstat
.
numOfInsertSuccessReqs
=
pMgmt
->
state
.
numOfInsertSuccessReqs
-
pMgmt
->
lastState
.
numOfInsertSuccessReqs
;
int64_t
numOfSelectReqs
=
0
;
vmInfo
->
vstat
.
numOfBatchInsertReqs
=
pMgmt
->
state
.
numOfBatchInsertReqs
-
pMgmt
->
lastState
.
numOfBatchInsertReqs
;
int64_t
numOfInsertReqs
=
0
;
vmInfo
->
vstat
.
numOfBatchInsertSuccessReqs
=
int64_t
numOfInsertSuccessReqs
=
0
;
pMgmt
->
state
.
numOfBatchInsertSuccessReqs
-
pMgmt
->
lastState
.
numOfBatchInsertSuccessReqs
;
int64_t
numOfBatchInsertReqs
=
0
;
pMgmt
->
lastState
=
pMgmt
->
state
;
int64_t
numOfBatchInsertSuccessReqs
=
0
;
taosWUnLockLatch
(
&
pMgmt
->
latch
);
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
vloads
.
pVloads
);
++
i
)
{
SVnodeLoad
*
pLoad
=
taosArrayGet
(
vloads
.
pVloads
,
i
);
numOfSelectReqs
+=
pLoad
->
numOfSelectReqs
;
numOfInsertReqs
+=
pLoad
->
numOfInsertReqs
;
numOfInsertSuccessReqs
+=
pLoad
->
numOfInsertSuccessReqs
;
numOfBatchInsertReqs
+=
pLoad
->
numOfBatchInsertReqs
;
numOfBatchInsertSuccessReqs
+=
pLoad
->
numOfBatchInsertSuccessReqs
;
if
(
pLoad
->
syncState
==
TAOS_SYNC_STATE_LEADER
)
masterNum
++
;
totalVnodes
++
;
}
pInfo
->
vstat
.
totalVnodes
=
totalVnodes
;
pInfo
->
vstat
.
masterNum
=
masterNum
;
pInfo
->
vstat
.
numOfSelectReqs
=
numOfSelectReqs
-
pMgmt
->
state
.
numOfSelectReqs
;
pInfo
->
vstat
.
numOfInsertReqs
=
numOfInsertReqs
-
pMgmt
->
state
.
numOfInsertReqs
;
pInfo
->
vstat
.
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
-
pMgmt
->
state
.
numOfInsertSuccessReqs
;
pInfo
->
vstat
.
numOfBatchInsertReqs
=
numOfBatchInsertReqs
-
pMgmt
->
state
.
numOfBatchInsertReqs
;
pInfo
->
vstat
.
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
-
pMgmt
->
state
.
numOfBatchInsertSuccessReqs
;
pMgmt
->
state
=
pInfo
->
vstat
;
taosArrayDestroy
(
vloads
.
pVloads
);
}
}
int32_t
vmProcessGetMonVmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
int32_t
vmProcessGetMonVmInfoReq
(
SMgmtWrapper
*
pWrapper
,
SNodeMsg
*
pReq
)
{
...
@@ -182,48 +203,6 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
...
@@ -182,48 +203,6 @@ int32_t vmProcessCreateVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
vmProcessAlterVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SAlterVnodeReq
alterReq
=
{
0
};
if
(
tDeserializeSCreateVnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
alterReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
dDebug
(
"vgId:%d, alter vnode req is received"
,
alterReq
.
vgId
);
SVnodeCfg
vnodeCfg
=
{
0
};
vmGenerateVnodeCfg
(
&
alterReq
,
&
vnodeCfg
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
alterReq
.
vgId
);
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to alter vnode since %s"
,
alterReq
.
vgId
,
terrstr
());
return
-
1
;
}
if
(
alterReq
.
vgVersion
==
pVnode
->
vgVersion
)
{
vmReleaseVnode
(
pMgmt
,
pVnode
);
dDebug
(
"vgId:%d, no need to alter vnode cfg for version unchanged "
,
alterReq
.
vgId
);
return
0
;
}
if
(
vnodeAlter
(
pVnode
->
pImpl
,
&
vnodeCfg
)
!=
0
)
{
dError
(
"vgId:%d, failed to alter vnode since %s"
,
alterReq
.
vgId
,
terrstr
());
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
}
int32_t
oldVersion
=
pVnode
->
vgVersion
;
pVnode
->
vgVersion
=
alterReq
.
vgVersion
;
int32_t
code
=
vmWriteVnodesToFile
(
pMgmt
);
if
(
code
!=
0
)
{
pVnode
->
vgVersion
=
oldVersion
;
}
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
code
;
}
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
int32_t
vmProcessDropVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SDropVnodeReq
dropReq
=
{
0
};
SDropVnodeReq
dropReq
=
{
0
};
...
@@ -255,100 +234,52 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
...
@@ -255,100 +234,52 @@ int32_t vmProcessDropVnodeReq(SVnodesMgmt *pMgmt, SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
int32_t
vmProcessSyncVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SSyncVnodeReq
syncReq
=
{
0
};
tDeserializeSDropVnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
syncReq
);
int32_t
vgId
=
syncReq
.
vgId
;
dDebug
(
"vgId:%d, sync vnode req is received"
,
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to sync since %s"
,
vgId
,
terrstr
());
return
-
1
;
}
if
(
vnodeSync
(
pVnode
->
pImpl
)
!=
0
)
{
dError
(
"vgId:%d, failed to sync vnode since %s"
,
vgId
,
terrstr
());
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
}
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
0
;
}
int32_t
vmProcessCompactVnodeReq
(
SVnodesMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
SRpcMsg
*
pReq
=
&
pMsg
->
rpcMsg
;
SCompactVnodeReq
compatcReq
=
{
0
};
tDeserializeSDropVnodeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
compatcReq
);
int32_t
vgId
=
compatcReq
.
vgId
;
dDebug
(
"vgId:%d, compact vnode req is received"
,
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
if
(
pVnode
==
NULL
)
{
dDebug
(
"vgId:%d, failed to compact since %s"
,
vgId
,
terrstr
());
return
-
1
;
}
if
(
vnodeCompact
(
pVnode
->
pImpl
)
!=
0
)
{
dError
(
"vgId:%d, failed to compact vnode since %s"
,
vgId
,
terrstr
());
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
-
1
;
}
vmReleaseVnode
(
pMgmt
,
pVnode
);
return
0
;
}
void
vmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
void
vmInitMsgHandle
(
SMgmtWrapper
*
pWrapper
)
{
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_VM_INFO
,
vmProcessMonitorMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_VM_INFO
,
vmProcessMonitorMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_VM_LOAD
,
vmProcessMonitorMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_MON_VM_LOAD
,
vmProcessMonitorMsg
,
DEFAULT_HANDLE
);
// Requests handled by VNODE
// Requests handled by VNODE
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_SUBMIT
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_SUBMIT
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY
,
(
NodeMsgFp
)
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY
,
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_CONTINUE
,
(
NodeMsgFp
)
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_CONTINUE
,
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_FETCH
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_FETCH
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_FETCH_RSP
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_FETCH_RSP
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_ALTER_TABLE
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_ALTER_TABLE
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_UPDATE_TAG_VAL
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_UPDATE_TAG_VAL
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TABLE_META
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TABLE_META
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TABLES_META
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TABLES_META
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CONSUME
,
(
NodeMsgFp
)
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CONSUME
,
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_QUERY
,
(
NodeMsgFp
)
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_QUERY
,
vmProcessQueryMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CONNECT
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CONNECT
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_DISCONNECT
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_DISCONNECT
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_RES_READY
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_RES_READY
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASKS_STATUS
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASKS_STATUS
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_TASK
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_TASK
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_TASK
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_TASK
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_STB
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_STB
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_ALTER_STB
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_ALTER_STB
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_STB
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_STB
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_TABLE
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_TABLE
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_TABLE
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_TABLE
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_SMA
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CREATE_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_SMA
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CANCEL_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_SMA
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_DROP_SMA
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CONN
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CONN
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_REB
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_REB
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CANCEL_CONN
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_CANCEL_CONN
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_MQ_SET_CUR
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CONSUME
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_CONSUME
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_DEPLOY
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_QUERY_HEARTBEAT
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_PIPE_EXEC
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_PIPE_EXEC
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_MERGE_EXEC
,
(
NodeMsgFp
)
vmProcessMergeMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_MERGE_EXEC
,
vmProcessMergeMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_WRITE_EXEC
,
(
NodeMsgFp
)
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_TASK_WRITE_EXEC
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_STREAM_TRIGGER
,
(
NodeMsgFp
)
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_STREAM_TRIGGER
,
vmProcessFetchMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_ALTER_VNODE
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_VND_COMPACT_VNODE
,
vmProcessWriteMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_VNODE
,
vmProcessMgmtMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_CREATE_VNODE
,
vmProcessMgmtMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_ALTER_VNODE
,
vmProcessMgmtMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_VNODE
,
vmProcessMgmtMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_DROP_VNODE
,
vmProcessMgmtMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_SYNC_VNODE
,
vmProcessMgmtMsg
,
DEFAULT_HANDLE
);
dmSetMsgHandle
(
pWrapper
,
TDMT_DND_COMPACT_VNODE
,
vmProcessMgmtMsg
,
DEFAULT_HANDLE
);
}
}
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
e0d3ceb5
...
@@ -130,7 +130,7 @@ static void *vmOpenVnodeFunc(void *param) {
...
@@ -130,7 +130,7 @@ static void *vmOpenVnodeFunc(void *param) {
char
stepDesc
[
TSDB_STEP_DESC_LEN
]
=
{
0
};
char
stepDesc
[
TSDB_STEP_DESC_LEN
]
=
{
0
};
snprintf
(
stepDesc
,
TSDB_STEP_DESC_LEN
,
"vgId:%d, start to restore, %d of %d have been opened"
,
pCfg
->
vgId
,
snprintf
(
stepDesc
,
TSDB_STEP_DESC_LEN
,
"vgId:%d, start to restore, %d of %d have been opened"
,
pCfg
->
vgId
,
pMgmt
->
state
.
openVnodes
,
pMgmt
->
state
.
totalVnodes
);
pMgmt
->
state
.
openVnodes
,
pMgmt
->
state
.
totalVnodes
);
dmReportStartup
(
pDnode
,
"
open-vnodes
"
,
stepDesc
);
dmReportStartup
(
pDnode
,
"
vnode-open
"
,
stepDesc
);
SMsgCb
msgCb
=
pMgmt
->
pDnode
->
data
.
msgCb
;
SMsgCb
msgCb
=
pMgmt
->
pDnode
->
data
.
msgCb
;
msgCb
.
pWrapper
=
pMgmt
->
pWrapper
;
msgCb
.
pWrapper
=
pMgmt
->
pWrapper
;
...
@@ -298,25 +298,30 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
...
@@ -298,25 +298,30 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
dError
(
"failed to init tfs since %s"
,
terrstr
());
dError
(
"failed to init tfs since %s"
,
terrstr
());
goto
_OVER
;
goto
_OVER
;
}
}
dmReportStartup
(
pDnode
,
"vnode-tfs"
,
"initialized"
);
if
(
walInit
()
!=
0
)
{
if
(
walInit
()
!=
0
)
{
dError
(
"failed to init wal since %s"
,
terrstr
());
dError
(
"failed to init wal since %s"
,
terrstr
());
goto
_OVER
;
goto
_OVER
;
}
}
dmReportStartup
(
pDnode
,
"vnode-wal"
,
"initialized"
);
if
(
vnodeInit
(
tsNumOfCommitThreads
)
!=
0
)
{
if
(
vnodeInit
(
tsNumOfCommitThreads
)
!=
0
)
{
dError
(
"failed to init vnode since %s"
,
terrstr
());
dError
(
"failed to init vnode since %s"
,
terrstr
());
goto
_OVER
;
goto
_OVER
;
}
}
dmReportStartup
(
pDnode
,
"vnode-commit"
,
"initialized"
);
if
(
vmStartWorker
(
pMgmt
)
!=
0
)
{
if
(
vmStartWorker
(
pMgmt
)
!=
0
)
{
dError
(
"failed to init workers since %s"
,
terrstr
())
goto
_OVER
;
dError
(
"failed to init workers since %s"
,
terrstr
())
goto
_OVER
;
}
}
dmReportStartup
(
pDnode
,
"vnode-worker"
,
"initialized"
);
if
(
vmOpenVnodes
(
pMgmt
)
!=
0
)
{
if
(
vmOpenVnodes
(
pMgmt
)
!=
0
)
{
dError
(
"failed to open vnode since %s"
,
terrstr
());
dError
(
"failed to open vnode since %s"
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
dmReportStartup
(
pDnode
,
"vnode-vnodes"
,
"initialized"
);
code
=
0
;
code
=
0
;
...
@@ -351,19 +356,9 @@ void vmSetMgmtFp(SMgmtWrapper *pWrapper) {
...
@@ -351,19 +356,9 @@ void vmSetMgmtFp(SMgmtWrapper *pWrapper) {
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
)
{
void
vmGetVnodeLoads
(
SMgmtWrapper
*
pWrapper
,
SMonVloadInfo
*
pInfo
)
{
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
SVnodesStat
*
pStat
=
&
pMgmt
->
state
;
SArray
*
pLoads
=
taosArrayInit
(
pMgmt
->
state
.
totalVnodes
,
sizeof
(
SVnodeLoad
));
int32_t
totalVnodes
=
0
;
pInfo
->
pVloads
=
taosArrayInit
(
pMgmt
->
state
.
totalVnodes
,
sizeof
(
SVnodeLoad
));
int32_t
masterNum
=
0
;
if
(
pInfo
->
pVloads
==
NULL
)
return
;
int64_t
numOfSelectReqs
=
0
;
int64_t
numOfInsertReqs
=
0
;
int64_t
numOfInsertSuccessReqs
=
0
;
int64_t
numOfBatchInsertReqs
=
0
;
int64_t
numOfBatchInsertSuccessReqs
=
0
;
pInfo
->
pVloads
=
pLoads
;
if
(
pLoads
==
NULL
)
return
;
taosRLockLatch
(
&
pMgmt
->
latch
);
taosRLockLatch
(
&
pMgmt
->
latch
);
...
@@ -375,28 +370,9 @@ void vmGetVnodeLoads(SMgmtWrapper *pWrapper, SMonVloadInfo *pInfo) {
...
@@ -375,28 +370,9 @@ void vmGetVnodeLoads(SMgmtWrapper *pWrapper, SMonVloadInfo *pInfo) {
SVnodeObj
*
pVnode
=
*
ppVnode
;
SVnodeObj
*
pVnode
=
*
ppVnode
;
SVnodeLoad
vload
=
{
0
};
SVnodeLoad
vload
=
{
0
};
vnodeGetLoad
(
pVnode
->
pImpl
,
&
vload
);
vnodeGetLoad
(
pVnode
->
pImpl
,
&
vload
);
taosArrayPush
(
pLoads
,
&
vload
);
taosArrayPush
(
pInfo
->
pVloads
,
&
vload
);
numOfSelectReqs
+=
vload
.
numOfSelectReqs
;
numOfInsertReqs
+=
vload
.
numOfInsertReqs
;
numOfInsertSuccessReqs
+=
vload
.
numOfInsertSuccessReqs
;
numOfBatchInsertReqs
+=
vload
.
numOfBatchInsertReqs
;
numOfBatchInsertSuccessReqs
+=
vload
.
numOfBatchInsertSuccessReqs
;
totalVnodes
++
;
if
(
vload
.
role
==
TAOS_SYNC_STATE_LEADER
)
masterNum
++
;
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
pIter
);
pIter
=
taosHashIterate
(
pMgmt
->
hash
,
pIter
);
}
}
taosRUnLockLatch
(
&
pMgmt
->
latch
);
taosRUnLockLatch
(
&
pMgmt
->
latch
);
taosWLockLatch
(
&
pMgmt
->
latch
);
pStat
->
totalVnodes
=
totalVnodes
;
pStat
->
masterNum
=
masterNum
;
pStat
->
numOfSelectReqs
=
numOfSelectReqs
;
pStat
->
numOfInsertReqs
=
numOfInsertReqs
;
pStat
->
numOfInsertSuccessReqs
=
numOfInsertSuccessReqs
;
pStat
->
numOfBatchInsertReqs
=
numOfBatchInsertReqs
;
pStat
->
numOfBatchInsertSuccessReqs
=
numOfBatchInsertSuccessReqs
;
taosWUnLockLatch
(
&
pMgmt
->
latch
);
}
}
\ No newline at end of file
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
e0d3ceb5
...
@@ -42,18 +42,9 @@ static void vmProcessMgmtQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
...
@@ -42,18 +42,9 @@ static void vmProcessMgmtQueue(SQueueInfo *pInfo, SNodeMsg *pMsg) {
case
TDMT_DND_CREATE_VNODE
:
case
TDMT_DND_CREATE_VNODE
:
code
=
vmProcessCreateVnodeReq
(
pMgmt
,
pMsg
);
code
=
vmProcessCreateVnodeReq
(
pMgmt
,
pMsg
);
break
;
break
;
case
TDMT_DND_ALTER_VNODE
:
code
=
vmProcessAlterVnodeReq
(
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_DROP_VNODE
:
case
TDMT_DND_DROP_VNODE
:
code
=
vmProcessDropVnodeReq
(
pMgmt
,
pMsg
);
code
=
vmProcessDropVnodeReq
(
pMgmt
,
pMsg
);
break
;
break
;
case
TDMT_DND_SYNC_VNODE
:
code
=
vmProcessSyncVnodeReq
(
pMgmt
,
pMsg
);
break
;
case
TDMT_DND_COMPACT_VNODE
:
code
=
vmProcessCompactVnodeReq
(
pMgmt
,
pMsg
);
break
;
default:
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
dError
(
"msg:%p, not processed in vnode-mgmt queue"
,
pMsg
);
dError
(
"msg:%p, not processed in vnode-mgmt queue"
,
pMsg
);
...
...
source/dnode/mgmt/test/vnode/vnode.cpp
浏览文件 @
e0d3ceb5
...
@@ -47,7 +47,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
...
@@ -47,7 +47,7 @@ TEST_F(DndTestVnode, 01_Create_Vnode) {
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replica
=
1
;
createReq
.
replica
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
selfIndex
=
0
;
createReq
.
selfIndex
=
0
;
...
@@ -94,7 +94,7 @@ TEST_F(DndTestVnode, 02_Alter_Vnode) {
...
@@ -94,7 +94,7 @@ TEST_F(DndTestVnode, 02_Alter_Vnode) {
alterReq
.
precision
=
0
;
alterReq
.
precision
=
0
;
alterReq
.
compression
=
2
;
alterReq
.
compression
=
2
;
alterReq
.
replica
=
1
;
alterReq
.
replica
=
1
;
alterReq
.
quorum
=
1
;
alterReq
.
strict
=
1
;
alterReq
.
update
=
0
;
alterReq
.
update
=
0
;
alterReq
.
cacheLastRow
=
0
;
alterReq
.
cacheLastRow
=
0
;
alterReq
.
selfIndex
=
0
;
alterReq
.
selfIndex
=
0
;
...
@@ -108,7 +108,7 @@ TEST_F(DndTestVnode, 02_Alter_Vnode) {
...
@@ -108,7 +108,7 @@ TEST_F(DndTestVnode, 02_Alter_Vnode) {
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSCreateVnodeReq
(
pReq
,
contLen
,
&
alterReq
);
tSerializeSCreateVnodeReq
(
pReq
,
contLen
,
&
alterReq
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
D
ND_ALTER_VNODE
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_
V
ND_ALTER_VNODE
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
ASSERT_EQ
(
pRsp
->
code
,
0
);
}
}
...
...
source/dnode/mnode/impl/inc/mndAuth.h
浏览文件 @
e0d3ceb5
...
@@ -33,7 +33,7 @@ int32_t mndCheckNodeAuth(SUserObj *pOperUser);
...
@@ -33,7 +33,7 @@ int32_t mndCheckNodeAuth(SUserObj *pOperUser);
int32_t
mndCheckFuncAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckFuncAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
);
int32_t
mndCheckAlterDropCompact
Sync
DbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckAlterDropCompactDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckUseDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckWriteAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
int32_t
mndCheckWriteAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
);
...
...
source/dnode/mnode/impl/inc/mndDb.h
浏览文件 @
e0d3ceb5
...
@@ -27,9 +27,10 @@ void mndCleanupDb(SMnode *pMnode);
...
@@ -27,9 +27,10 @@ void mndCleanupDb(SMnode *pMnode);
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
const
char
*
db
);
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
const
char
*
db
);
void
mndReleaseDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
);
void
mndReleaseDb
(
SMnode
*
pMnode
,
SDbObj
*
pDb
);
int32_t
mndValidateDbInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
);
int32_t
mndValidateDbInfo
(
SMnode
*
pMnode
,
SDbVgVersion
*
pDbs
,
int32_t
numOfDbs
,
void
**
ppRsp
,
int32_t
*
pRspLen
);
char
*
mndGetDbStr
(
char
*
src
);
int32_t
mndExtractDbInfo
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SUseDbRsp
*
pRsp
,
const
SUseDbReq
*
pReq
);
int32_t
mndExtractDbInfo
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SUseDbRsp
*
pRsp
,
const
SUseDbReq
*
pReq
);
const
char
*
mndGetDbStr
(
const
char
*
src
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
e0d3ceb5
...
@@ -265,11 +265,12 @@ typedef struct {
...
@@ -265,11 +265,12 @@ typedef struct {
int8_t
precision
;
int8_t
precision
;
int8_t
compression
;
int8_t
compression
;
int8_t
replications
;
int8_t
replications
;
int8_t
quorum
;
int8_t
strict
;
int8_t
update
;
int8_t
update
;
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int8_t
streamMode
;
int8_t
streamMode
;
int8_t
singleSTable
;
int8_t
singleSTable
;
int8_t
hashMethod
;
// default is 1
int32_t
numOfRetensions
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
SArray
*
pRetensions
;
}
SDbCfg
;
}
SDbCfg
;
...
@@ -283,7 +284,6 @@ typedef struct {
...
@@ -283,7 +284,6 @@ typedef struct {
int64_t
uid
;
int64_t
uid
;
int32_t
cfgVersion
;
int32_t
cfgVersion
;
int32_t
vgVersion
;
int32_t
vgVersion
;
int8_t
hashMethod
;
// default is 1
SDbCfg
cfg
;
SDbCfg
cfg
;
SRWLatch
lock
;
SRWLatch
lock
;
}
SDbObj
;
}
SDbObj
;
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
e0d3ceb5
...
@@ -47,21 +47,6 @@ typedef int32_t (*MndInitFp)(SMnode *pMnode);
...
@@ -47,21 +47,6 @@ typedef int32_t (*MndInitFp)(SMnode *pMnode);
typedef
void
(
*
MndCleanupFp
)(
SMnode
*
pMnode
);
typedef
void
(
*
MndCleanupFp
)(
SMnode
*
pMnode
);
typedef
int32_t
(
*
ShowRetrieveFp
)(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
typedef
int32_t
(
*
ShowRetrieveFp
)(
SNodeMsg
*
pMsg
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
typedef
void
(
*
ShowFreeIterFp
)(
SMnode
*
pMnode
,
void
*
pIter
);
typedef
void
(
*
ShowFreeIterFp
)(
SMnode
*
pMnode
,
void
*
pIter
);
typedef
struct
SMnodeLoad
{
int64_t
numOfDnode
;
int64_t
numOfMnode
;
int64_t
numOfVgroup
;
int64_t
numOfDatabase
;
int64_t
numOfSuperTable
;
int64_t
numOfChildTable
;
int64_t
numOfNormalTable
;
int64_t
numOfColumn
;
int64_t
totalPoints
;
int64_t
totalStorage
;
int64_t
compStorage
;
}
SMnodeLoad
;
typedef
struct
SQWorkerMgmt
SQHandle
;
typedef
struct
SQWorkerMgmt
SQHandle
;
typedef
struct
{
typedef
struct
{
...
@@ -129,7 +114,6 @@ struct SMnode {
...
@@ -129,7 +114,6 @@ struct SMnode {
void
mndSetMsgHandle
(
SMnode
*
pMnode
,
tmsg_t
msgType
,
MndMsgFp
fp
);
void
mndSetMsgHandle
(
SMnode
*
pMnode
,
tmsg_t
msgType
,
MndMsgFp
fp
);
int64_t
mndGenerateUid
(
char
*
name
,
int32_t
len
);
int64_t
mndGenerateUid
(
char
*
name
,
int32_t
len
);
void
mndGetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/inc/mndMnode.h
浏览文件 @
e0d3ceb5
...
@@ -22,14 +22,13 @@
...
@@ -22,14 +22,13 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
int32_t
mndInitMnode
(
SMnode
*
pMnode
);
int32_t
mndInitMnode
(
SMnode
*
pMnode
);
void
mndCleanupMnode
(
SMnode
*
pMnode
);
void
mndCleanupMnode
(
SMnode
*
pMnode
);
SMnodeObj
*
mndAcquireMnode
(
SMnode
*
pMnode
,
int32_t
mnodeId
);
SMnodeObj
*
mndAcquireMnode
(
SMnode
*
pMnode
,
int32_t
mnodeId
);
void
mndReleaseMnode
(
SMnode
*
pMnode
,
SMnodeObj
*
pObj
);
void
mndReleaseMnode
(
SMnode
*
pMnode
,
SMnodeObj
*
pObj
);
bool
mndIsMnode
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
bool
mndIsMnode
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
void
mndGetMnodeEpSet
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
);
void
mndGetMnodeEpSet
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
);
void
mndUpdateMnodeRole
(
SMnode
*
pMnode
);
void
mndUpdateMnodeRole
(
SMnode
*
pMnode
);
const
char
*
mndGetRoleStr
(
int32_t
role
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
e0d3ceb5
...
@@ -146,7 +146,7 @@ int32_t mndCheckFuncAuth(SUserObj *pOperUser) {
...
@@ -146,7 +146,7 @@ int32_t mndCheckFuncAuth(SUserObj *pOperUser) {
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
)
{
return
0
;
}
int32_t
mndCheckCreateDbAuth
(
SUserObj
*
pOperUser
)
{
return
0
;
}
int32_t
mndCheckAlterDropCompact
Sync
DbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
int32_t
mndCheckAlterDropCompactDbAuth
(
SUserObj
*
pOperUser
,
SDbObj
*
pDb
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
if
(
pOperUser
->
superUser
||
strcmp
(
pOperUser
->
user
,
pDb
->
createUser
)
==
0
)
{
return
0
;
return
0
;
}
}
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
e0d3ceb5
此差异已折叠。
点击以展开。
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
e0d3ceb5
...
@@ -326,7 +326,7 @@ static int32_t mndProcessStatusReq(SNodeMsg *pReq) {
...
@@ -326,7 +326,7 @@ static int32_t mndProcessStatusReq(SNodeMsg *pReq) {
SVgObj
*
pVgroup
=
mndAcquireVgroup
(
pMnode
,
pVload
->
vgId
);
SVgObj
*
pVgroup
=
mndAcquireVgroup
(
pMnode
,
pVload
->
vgId
);
if
(
pVgroup
!=
NULL
)
{
if
(
pVgroup
!=
NULL
)
{
if
(
pVload
->
rol
e
==
TAOS_SYNC_STATE_LEADER
)
{
if
(
pVload
->
syncStat
e
==
TAOS_SYNC_STATE_LEADER
)
{
pVgroup
->
numOfTables
=
pVload
->
numOfTables
;
pVgroup
->
numOfTables
=
pVload
->
numOfTables
;
pVgroup
->
numOfTimeSeries
=
pVload
->
numOfTimeSeries
;
pVgroup
->
numOfTimeSeries
=
pVload
->
numOfTimeSeries
;
pVgroup
->
totalStorage
=
pVload
->
totalStorage
;
pVgroup
->
totalStorage
=
pVload
->
totalStorage
;
...
@@ -335,10 +335,10 @@ static int32_t mndProcessStatusReq(SNodeMsg *pReq) {
...
@@ -335,10 +335,10 @@ static int32_t mndProcessStatusReq(SNodeMsg *pReq) {
}
}
bool
roleChanged
=
false
;
bool
roleChanged
=
false
;
for
(
int32_t
vg
=
0
;
vg
<
pVgroup
->
replica
;
++
vg
)
{
for
(
int32_t
vg
=
0
;
vg
<
pVgroup
->
replica
;
++
vg
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
role
!=
pVload
->
rol
e
)
{
if
(
pVgroup
->
vnodeGid
[
vg
].
role
!=
pVload
->
syncStat
e
)
{
roleChanged
=
true
;
roleChanged
=
true
;
}
}
pVgroup
->
vnodeGid
[
vg
].
role
=
pVload
->
rol
e
;
pVgroup
->
vnodeGid
[
vg
].
role
=
pVload
->
syncStat
e
;
}
}
if
(
roleChanged
)
{
if
(
roleChanged
)
{
// notify scheduler role has changed
// notify scheduler role has changed
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
e0d3ceb5
...
@@ -75,7 +75,7 @@ static const SInfosTableSchema userDBSchema[] = {
...
@@ -75,7 +75,7 @@ static const SInfosTableSchema userDBSchema[] = {
{.
name
=
"vgroups"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
},
{.
name
=
"vgroups"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_SMALLINT
},
{.
name
=
"ntables"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"ntables"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_BIGINT
},
{.
name
=
"replica"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"replica"
,
.
bytes
=
2
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"
quorum"
,
.
bytes
=
1
,
.
type
=
TSDB_DATA_TYPE_TINYINT
},
{.
name
=
"
strict"
,
.
bytes
=
9
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"days"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"days"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"keep"
,
.
bytes
=
24
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"keep"
,
.
bytes
=
24
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"cache"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"cache"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
e0d3ceb5
...
@@ -75,19 +75,6 @@ void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj) {
...
@@ -75,19 +75,6 @@ void mndReleaseMnode(SMnode *pMnode, SMnodeObj *pObj) {
sdbRelease
(
pMnode
->
pSdb
,
pObj
);
sdbRelease
(
pMnode
->
pSdb
,
pObj
);
}
}
const
char
*
mndGetRoleStr
(
int32_t
showType
)
{
switch
(
showType
)
{
case
TAOS_SYNC_STATE_FOLLOWER
:
return
"FOLLOWER"
;
case
TAOS_SYNC_STATE_CANDIDATE
:
return
"CANDIDATE"
;
case
TAOS_SYNC_STATE_LEADER
:
return
"LEADER"
;
default:
return
"ERROR"
;
}
}
void
mndUpdateMnodeRole
(
SMnode
*
pMnode
)
{
void
mndUpdateMnodeRole
(
SMnode
*
pMnode
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
...
@@ -637,7 +624,7 @@ static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -637,7 +624,7 @@ static int32_t mndRetrieveMnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *p
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
b1
,
false
);
const
char
*
roles
=
mndGetRole
Str
(
pObj
->
role
);
const
char
*
roles
=
sync
Str
(
pObj
->
role
);
char
*
b2
=
taosMemoryCalloc
(
1
,
strlen
(
roles
)
+
VARSTR_HEADER_SIZE
);
char
*
b2
=
taosMemoryCalloc
(
1
,
strlen
(
roles
)
+
VARSTR_HEADER_SIZE
);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
roles
,
pShow
->
bytes
[
cols
]);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
roles
,
pShow
->
bytes
[
cols
]);
...
...
source/dnode/mnode/impl/src/mndTelem.c
浏览文件 @
e0d3ceb5
...
@@ -24,20 +24,60 @@
...
@@ -24,20 +24,60 @@
#define TELEMETRY_SERVER "telemetry.taosdata.com"
#define TELEMETRY_SERVER "telemetry.taosdata.com"
#define TELEMETRY_PORT 80
#define TELEMETRY_PORT 80
typedef
struct
{
int64_t
numOfDnode
;
int64_t
numOfMnode
;
int64_t
numOfVgroup
;
int64_t
numOfDatabase
;
int64_t
numOfSuperTable
;
int64_t
numOfChildTable
;
int64_t
numOfNormalTable
;
int64_t
numOfColumn
;
int64_t
totalPoints
;
int64_t
totalStorage
;
int64_t
compStorage
;
}
SMnodeStat
;
static
void
mndGetStat
(
SMnode
*
pMnode
,
SMnodeStat
*
pStat
)
{
memset
(
pStat
,
0
,
sizeof
(
SMnodeStat
));
SSdb
*
pSdb
=
pMnode
->
pSdb
;
pStat
->
numOfDnode
=
sdbGetSize
(
pSdb
,
SDB_DNODE
);
pStat
->
numOfMnode
=
sdbGetSize
(
pSdb
,
SDB_MNODE
);
pStat
->
numOfVgroup
=
sdbGetSize
(
pSdb
,
SDB_VGROUP
);
pStat
->
numOfDatabase
=
sdbGetSize
(
pSdb
,
SDB_DB
);
pStat
->
numOfSuperTable
=
sdbGetSize
(
pSdb
,
SDB_STB
);
void
*
pIter
=
NULL
;
while
(
1
)
{
SVgObj
*
pVgroup
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
pStat
->
numOfChildTable
+=
pVgroup
->
numOfTables
;
pStat
->
numOfColumn
+=
pVgroup
->
numOfTimeSeries
;
pStat
->
totalPoints
+=
pVgroup
->
pointsWritten
;
pStat
->
totalStorage
+=
pVgroup
->
totalStorage
;
pStat
->
compStorage
+=
pVgroup
->
compStorage
;
sdbRelease
(
pSdb
,
pVgroup
);
}
}
static
void
mndBuildRuntimeInfo
(
SMnode
*
pMnode
,
SJson
*
pJson
)
{
static
void
mndBuildRuntimeInfo
(
SMnode
*
pMnode
,
SJson
*
pJson
)
{
SMnode
Load
load
=
{
0
};
SMnode
Stat
mstat
=
{
0
};
mndGet
Load
(
pMnode
,
&
load
);
mndGet
Stat
(
pMnode
,
&
mstat
);
tjsonAddDoubleToObject
(
pJson
,
"numOfDnode"
,
load
.
numOfDnode
);
tjsonAddDoubleToObject
(
pJson
,
"numOfDnode"
,
mstat
.
numOfDnode
);
tjsonAddDoubleToObject
(
pJson
,
"numOfMnode"
,
load
.
numOfMnode
);
tjsonAddDoubleToObject
(
pJson
,
"numOfMnode"
,
mstat
.
numOfMnode
);
tjsonAddDoubleToObject
(
pJson
,
"numOfVgroup"
,
load
.
numOfVgroup
);
tjsonAddDoubleToObject
(
pJson
,
"numOfVgroup"
,
mstat
.
numOfVgroup
);
tjsonAddDoubleToObject
(
pJson
,
"numOfDatabase"
,
load
.
numOfDatabase
);
tjsonAddDoubleToObject
(
pJson
,
"numOfDatabase"
,
mstat
.
numOfDatabase
);
tjsonAddDoubleToObject
(
pJson
,
"numOfSuperTable"
,
load
.
numOfSuperTable
);
tjsonAddDoubleToObject
(
pJson
,
"numOfSuperTable"
,
mstat
.
numOfSuperTable
);
tjsonAddDoubleToObject
(
pJson
,
"numOfChildTable"
,
load
.
numOfChildTable
);
tjsonAddDoubleToObject
(
pJson
,
"numOfChildTable"
,
mstat
.
numOfChildTable
);
tjsonAddDoubleToObject
(
pJson
,
"numOfColumn"
,
load
.
numOfColumn
);
tjsonAddDoubleToObject
(
pJson
,
"numOfColumn"
,
mstat
.
numOfColumn
);
tjsonAddDoubleToObject
(
pJson
,
"numOfPoint"
,
load
.
totalPoints
);
tjsonAddDoubleToObject
(
pJson
,
"numOfPoint"
,
mstat
.
totalPoints
);
tjsonAddDoubleToObject
(
pJson
,
"totalStorage"
,
load
.
totalStorage
);
tjsonAddDoubleToObject
(
pJson
,
"totalStorage"
,
mstat
.
totalStorage
);
tjsonAddDoubleToObject
(
pJson
,
"compStorage"
,
load
.
compStorage
);
tjsonAddDoubleToObject
(
pJson
,
"compStorage"
,
mstat
.
compStorage
);
}
}
static
char
*
mndBuildTelemetryReport
(
SMnode
*
pMnode
)
{
static
char
*
mndBuildTelemetryReport
(
SMnode
*
pMnode
)
{
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
e0d3ceb5
...
@@ -32,7 +32,6 @@ static int32_t mndVgroupActionUpdate(SSdb *pSdb, SVgObj *pOld, SVgObj *pNew);
...
@@ -32,7 +32,6 @@ static int32_t mndVgroupActionUpdate(SSdb *pSdb, SVgObj *pOld, SVgObj *pNew);
static
int32_t
mndProcessCreateVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessCreateVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessAlterVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessAlterVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessDropVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessDropVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessSyncVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessCompactVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndProcessCompactVnodeRsp
(
SNodeMsg
*
pRsp
);
static
int32_t
mndRetrieveVgroups
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
static
int32_t
mndRetrieveVgroups
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
);
...
@@ -50,10 +49,9 @@ int32_t mndInitVgroup(SMnode *pMnode) {
...
@@ -50,10 +49,9 @@ int32_t mndInitVgroup(SMnode *pMnode) {
.
deleteFp
=
(
SdbDeleteFp
)
mndVgroupActionUpdate
};
.
deleteFp
=
(
SdbDeleteFp
)
mndVgroupActionUpdate
};
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_VNODE_RSP
,
mndProcessCreateVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CREATE_VNODE_RSP
,
mndProcessCreateVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_
D
ND_ALTER_VNODE_RSP
,
mndProcessAlterVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_
V
ND_ALTER_VNODE_RSP
,
mndProcessAlterVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_DROP_VNODE_RSP
,
mndProcessDropVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_DROP_VNODE_RSP
,
mndProcessDropVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_SYNC_VNODE_RSP
,
mndProcessSyncVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_COMPACT_VNODE_RSP
,
mndProcessCompactVnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_COMPACT_VNODE_RSP
,
mndProcessCompactVnodeRsp
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_VGROUP
,
mndRetrieveVgroups
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_VGROUP
,
mndRetrieveVgroups
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_VGROUP
,
mndCancelGetNextVgroup
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_VGROUP
,
mndCancelGetNextVgroup
);
...
@@ -205,7 +203,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
...
@@ -205,7 +203,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
createReq
.
walLevel
=
pDb
->
cfg
.
walLevel
;
createReq
.
walLevel
=
pDb
->
cfg
.
walLevel
;
createReq
.
precision
=
pDb
->
cfg
.
precision
;
createReq
.
precision
=
pDb
->
cfg
.
precision
;
createReq
.
compression
=
pDb
->
cfg
.
compression
;
createReq
.
compression
=
pDb
->
cfg
.
compression
;
createReq
.
quorum
=
pDb
->
cfg
.
quorum
;
createReq
.
strict
=
pDb
->
cfg
.
strict
;
createReq
.
update
=
pDb
->
cfg
.
update
;
createReq
.
update
=
pDb
->
cfg
.
update
;
createReq
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
createReq
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
createReq
.
replica
=
pVgroup
->
replica
;
createReq
.
replica
=
pVgroup
->
replica
;
...
@@ -213,7 +211,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
...
@@ -213,7 +211,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
createReq
.
streamMode
=
pVgroup
->
streamMode
;
createReq
.
streamMode
=
pVgroup
->
streamMode
;
createReq
.
hashBegin
=
pVgroup
->
hashBegin
;
createReq
.
hashBegin
=
pVgroup
->
hashBegin
;
createReq
.
hashEnd
=
pVgroup
->
hashEnd
;
createReq
.
hashEnd
=
pVgroup
->
hashEnd
;
createReq
.
hashMethod
=
pDb
->
hashMethod
;
createReq
.
hashMethod
=
pDb
->
cfg
.
hashMethod
;
createReq
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
createReq
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
createReq
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
createReq
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
...
@@ -465,8 +463,6 @@ static int32_t mndProcessDropVnodeRsp(SNodeMsg *pRsp) {
...
@@ -465,8 +463,6 @@ static int32_t mndProcessDropVnodeRsp(SNodeMsg *pRsp) {
return
0
;
return
0
;
}
}
static
int32_t
mndProcessSyncVnodeRsp
(
SNodeMsg
*
pRsp
)
{
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
SNodeMsg
*
pRsp
)
{
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
SNodeMsg
*
pRsp
)
{
return
0
;
}
static
bool
mndGetVgroupMaxReplicaFp
(
SMnode
*
pMnode
,
void
*
pObj
,
void
*
p1
,
void
*
p2
,
void
*
p3
)
{
static
bool
mndGetVgroupMaxReplicaFp
(
SMnode
*
pMnode
,
void
*
pObj
,
void
*
p1
,
void
*
p2
,
void
*
p3
)
{
...
@@ -545,7 +541,7 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock*
...
@@ -545,7 +541,7 @@ static int32_t mndRetrieveVgroups(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock*
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgroup
->
vnodeGid
[
i
].
dnodeId
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
pVgroup
->
vnodeGid
[
i
].
dnodeId
,
false
);
char
buf1
[
20
]
=
{
0
};
char
buf1
[
20
]
=
{
0
};
const
char
*
role
=
mndGetRole
Str
(
pVgroup
->
vnodeGid
[
i
].
role
);
const
char
*
role
=
sync
Str
(
pVgroup
->
vnodeGid
[
i
].
role
);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
bytes
[
cols
]);
STR_WITH_MAXSIZE_TO_VARSTR
(
buf1
,
role
,
pShow
->
bytes
[
cols
]);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
...
@@ -636,7 +632,7 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* p
...
@@ -636,7 +632,7 @@ static int32_t mndRetrieveVnodes(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock* p
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
val
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
&
val
,
false
);
char
buf
[
20
]
=
{
0
};
char
buf
[
20
]
=
{
0
};
STR_TO_VARSTR
(
buf
,
mndGetRole
Str
(
pVgid
->
role
));
STR_TO_VARSTR
(
buf
,
sync
Str
(
pVgid
->
role
));
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf
,
false
);
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
e0d3ceb5
...
@@ -262,6 +262,7 @@ static int32_t mndExecSteps(SMnode *pMnode) {
...
@@ -262,6 +262,7 @@ static int32_t mndExecSteps(SMnode *pMnode) {
return
-
1
;
return
-
1
;
}
else
{
}
else
{
mDebug
(
"%s is initialized"
,
pStep
->
name
);
mDebug
(
"%s is initialized"
,
pStep
->
name
);
tmsgReportStartup
(
pStep
->
name
,
"initialized"
);
}
}
}
}
...
@@ -413,31 +414,6 @@ int64_t mndGenerateUid(char *name, int32_t len) {
...
@@ -413,31 +414,6 @@ int64_t mndGenerateUid(char *name, int32_t len) {
}
while
(
true
);
}
while
(
true
);
}
}
void
mndGetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
)
{
memset
(
pLoad
,
0
,
sizeof
(
SMnodeLoad
));
SSdb
*
pSdb
=
pMnode
->
pSdb
;
pLoad
->
numOfDnode
=
sdbGetSize
(
pSdb
,
SDB_DNODE
);
pLoad
->
numOfMnode
=
sdbGetSize
(
pSdb
,
SDB_MNODE
);
pLoad
->
numOfVgroup
=
sdbGetSize
(
pSdb
,
SDB_VGROUP
);
pLoad
->
numOfDatabase
=
sdbGetSize
(
pSdb
,
SDB_DB
);
pLoad
->
numOfSuperTable
=
sdbGetSize
(
pSdb
,
SDB_STB
);
void
*
pIter
=
NULL
;
while
(
1
)
{
SVgObj
*
pVgroup
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
pLoad
->
numOfChildTable
+=
pVgroup
->
numOfTables
;
pLoad
->
numOfColumn
+=
pVgroup
->
numOfTimeSeries
;
pLoad
->
totalPoints
+=
pVgroup
->
pointsWritten
;
pLoad
->
totalStorage
+=
pVgroup
->
totalStorage
;
pLoad
->
compStorage
+=
pVgroup
->
compStorage
;
sdbRelease
(
pSdb
,
pVgroup
);
}
}
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
)
{
SMonGrantInfo
*
pGrantInfo
)
{
...
@@ -485,7 +461,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -485,7 +461,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
SMonMnodeDesc
desc
=
{
0
};
SMonMnodeDesc
desc
=
{
0
};
desc
.
mnode_id
=
pObj
->
id
;
desc
.
mnode_id
=
pObj
->
id
;
tstrncpy
(
desc
.
mnode_ep
,
pObj
->
pDnode
->
ep
,
sizeof
(
desc
.
mnode_ep
));
tstrncpy
(
desc
.
mnode_ep
,
pObj
->
pDnode
->
ep
,
sizeof
(
desc
.
mnode_ep
));
tstrncpy
(
desc
.
role
,
mndGetRole
Str
(
pObj
->
role
),
sizeof
(
desc
.
role
));
tstrncpy
(
desc
.
role
,
sync
Str
(
pObj
->
role
),
sizeof
(
desc
.
role
));
taosArrayPush
(
pClusterInfo
->
mnodes
,
&
desc
);
taosArrayPush
(
pClusterInfo
->
mnodes
,
&
desc
);
sdbRelease
(
pSdb
,
pObj
);
sdbRelease
(
pSdb
,
pObj
);
...
@@ -519,7 +495,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -519,7 +495,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SMonVnodeDesc
*
pVnDesc
=
&
desc
.
vnodes
[
i
];
SMonVnodeDesc
*
pVnDesc
=
&
desc
.
vnodes
[
i
];
pVnDesc
->
dnode_id
=
pVgid
->
dnodeId
;
pVnDesc
->
dnode_id
=
pVgid
->
dnodeId
;
tstrncpy
(
pVnDesc
->
vnode_role
,
mndGetRole
Str
(
pVgid
->
role
),
sizeof
(
pVnDesc
->
vnode_role
));
tstrncpy
(
pVnDesc
->
vnode_role
,
sync
Str
(
pVgid
->
role
),
sizeof
(
pVnDesc
->
vnode_role
));
if
(
pVgid
->
role
==
TAOS_SYNC_STATE_LEADER
)
{
if
(
pVgid
->
role
==
TAOS_SYNC_STATE_LEADER
)
{
tstrncpy
(
desc
.
status
,
"ready"
,
sizeof
(
desc
.
status
));
tstrncpy
(
desc
.
status
,
"ready"
,
sizeof
(
desc
.
status
));
pClusterInfo
->
vgroups_alive
++
;
pClusterInfo
->
vgroups_alive
++
;
...
@@ -544,3 +520,8 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -544,3 +520,8 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
return
0
;
return
0
;
}
}
int32_t
mndGetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
)
{
pLoad
->
syncState
=
pMnode
->
syncMgmt
.
state
;
return
0
;
}
\ No newline at end of file
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
e0d3ceb5
...
@@ -45,12 +45,12 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
...
@@ -45,12 +45,12 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
createReq
.
maxRows
=
4096
;
createReq
.
maxRows
=
4096
;
createReq
.
commitTime
=
3600
;
createReq
.
commitTime
=
3600
;
createReq
.
fsyncPeriod
=
3000
;
createReq
.
fsyncPeriod
=
3000
;
createReq
.
ttl
=
0
;
createReq
.
ttl
=
1
;
createReq
.
walLevel
=
1
;
createReq
.
walLevel
=
1
;
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replications
=
1
;
createReq
.
replications
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
...
@@ -82,7 +82,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
...
@@ -82,7 +82,7 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
alterdbReq
.
daysToKeep2
=
500
;
alterdbReq
.
daysToKeep2
=
500
;
alterdbReq
.
fsyncPeriod
=
4000
;
alterdbReq
.
fsyncPeriod
=
4000
;
alterdbReq
.
walLevel
=
2
;
alterdbReq
.
walLevel
=
2
;
alterdbReq
.
quorum
=
2
;
alterdbReq
.
strict
=
2
;
alterdbReq
.
cacheLastRow
=
1
;
alterdbReq
.
cacheLastRow
=
1
;
int32_t
contLen
=
tSerializeSAlterDbReq
(
NULL
,
0
,
&
alterdbReq
);
int32_t
contLen
=
tSerializeSAlterDbReq
(
NULL
,
0
,
&
alterdbReq
);
...
@@ -139,12 +139,12 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
...
@@ -139,12 +139,12 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
createReq
.
maxRows
=
4096
;
createReq
.
maxRows
=
4096
;
createReq
.
commitTime
=
3600
;
createReq
.
commitTime
=
3600
;
createReq
.
fsyncPeriod
=
3000
;
createReq
.
fsyncPeriod
=
3000
;
createReq
.
ttl
=
0
;
createReq
.
ttl
=
1
;
createReq
.
walLevel
=
1
;
createReq
.
walLevel
=
1
;
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replications
=
1
;
createReq
.
replications
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
...
...
source/dnode/mnode/impl/test/sma/sma.cpp
浏览文件 @
e0d3ceb5
...
@@ -54,9 +54,10 @@ void* MndTestSma::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
...
@@ -54,9 +54,10 @@ void* MndTestSma::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replications
=
1
;
createReq
.
replications
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ttl
=
1
;
createReq
.
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
e0d3ceb5
...
@@ -55,9 +55,10 @@ void* MndTestStb::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
...
@@ -55,9 +55,10 @@ void* MndTestStb::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replications
=
1
;
createReq
.
replications
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ttl
=
1
;
createReq
.
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
...
...
source/dnode/mnode/impl/test/topic/topic.cpp
浏览文件 @
e0d3ceb5
...
@@ -47,9 +47,10 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
...
@@ -47,9 +47,10 @@ void* MndTestTopic::BuildCreateDbReq(const char* dbname, int32_t* pContLen) {
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replications
=
1
;
createReq
.
replications
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ttl
=
1
;
createReq
.
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
...
...
source/dnode/mnode/impl/test/user/user.cpp
浏览文件 @
e0d3ceb5
...
@@ -300,9 +300,10 @@ TEST_F(MndTestUser, 03_Alter_User) {
...
@@ -300,9 +300,10 @@ TEST_F(MndTestUser, 03_Alter_User) {
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replications
=
1
;
createReq
.
replications
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ttl
=
1
;
createReq
.
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
...
...
source/dnode/vnode/src/tsdb/tsdbMain.c
浏览文件 @
e0d3ceb5
...
@@ -601,26 +601,26 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
...
@@ -601,26 +601,26 @@ static int32_t tsdbCheckAndSetDefaultCfg(STsdbCfg *pCfg) {
// Check minRowsPerFileBlock and maxRowsPerFileBlock
// Check minRowsPerFileBlock and maxRowsPerFileBlock
if (pCfg->minRowsPerFileBlock == -1) {
if (pCfg->minRowsPerFileBlock == -1) {
pCfg->minRowsPerFileBlock = TSDB_DEFAULT_MIN
_ROW
_FBLOCK;
pCfg->minRowsPerFileBlock = TSDB_DEFAULT_MIN
ROWS
_FBLOCK;
} else {
} else {
if (pCfg->minRowsPerFileBlock < TSDB_MIN_MIN
_ROW_FBLOCK || pCfg->minRowsPerFileBlock > TSDB_MAX_MIN_ROW
_FBLOCK) {
if (pCfg->minRowsPerFileBlock < TSDB_MIN_MIN
ROWS_FBLOCK || pCfg->minRowsPerFileBlock > TSDB_MAX_MINROWS
_FBLOCK) {
tsdbError(
tsdbError(
"vgId:%d invalid minRowsPerFileBlock configuration! minRowsPerFileBlock %d TSDB_MIN_MIN
_ROW
_FBLOCK %d "
"vgId:%d invalid minRowsPerFileBlock configuration! minRowsPerFileBlock %d TSDB_MIN_MIN
ROWS
_FBLOCK %d "
"TSDB_MAX_MIN
_ROW
_FBLOCK %d",
"TSDB_MAX_MIN
ROWS
_FBLOCK %d",
pCfg->tsdbId, pCfg->minRowsPerFileBlock, TSDB_MIN_MIN
_ROW_FBLOCK, TSDB_MAX_MIN_ROW
_FBLOCK);
pCfg->tsdbId, pCfg->minRowsPerFileBlock, TSDB_MIN_MIN
ROWS_FBLOCK, TSDB_MAX_MINROWS
_FBLOCK);
terrno = TSDB_CODE_TDB_INVALID_CONFIG;
terrno = TSDB_CODE_TDB_INVALID_CONFIG;
return -1;
return -1;
}
}
}
}
if (pCfg->maxRowsPerFileBlock == -1) {
if (pCfg->maxRowsPerFileBlock == -1) {
pCfg->maxRowsPerFileBlock = TSDB_DEFAULT_MAX
_ROW
_FBLOCK;
pCfg->maxRowsPerFileBlock = TSDB_DEFAULT_MAX
ROWS
_FBLOCK;
} else {
} else {
if (pCfg->maxRowsPerFileBlock < TSDB_MIN_MAX
_ROW_FBLOCK || pCfg->maxRowsPerFileBlock > TSDB_MAX_MAX_ROW
_FBLOCK) {
if (pCfg->maxRowsPerFileBlock < TSDB_MIN_MAX
ROWS_FBLOCK || pCfg->maxRowsPerFileBlock > TSDB_MAX_MAXROWS
_FBLOCK) {
tsdbError(
tsdbError(
"vgId:%d invalid maxRowsPerFileBlock configuration! maxRowsPerFileBlock %d TSDB_MIN_MAX
_ROW
_FBLOCK %d "
"vgId:%d invalid maxRowsPerFileBlock configuration! maxRowsPerFileBlock %d TSDB_MIN_MAX
ROWS
_FBLOCK %d "
"TSDB_MAX_MAX
_ROW
_FBLOCK %d",
"TSDB_MAX_MAX
ROWS
_FBLOCK %d",
pCfg->tsdbId, pCfg->maxRowsPerFileBlock, TSDB_MIN_MIN
_ROW_FBLOCK, TSDB_MAX_MIN_ROW
_FBLOCK);
pCfg->tsdbId, pCfg->maxRowsPerFileBlock, TSDB_MIN_MIN
ROWS_FBLOCK, TSDB_MAX_MINROWS
_FBLOCK);
terrno = TSDB_CODE_TDB_INVALID_CONFIG;
terrno = TSDB_CODE_TDB_INVALID_CONFIG;
return -1;
return -1;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
e0d3ceb5
...
@@ -652,7 +652,7 @@ static bool initTableMemIterator(STsdbReadHandle* pHandle, STableCheckInfo* pChe
...
@@ -652,7 +652,7 @@ static bool initTableMemIterator(STsdbReadHandle* pHandle, STableCheckInfo* pChe
STbData
**
pMem
=
NULL
;
STbData
**
pMem
=
NULL
;
STbData
**
pIMem
=
NULL
;
STbData
**
pIMem
=
NULL
;
TSKEY
tLastKey
=
0
;
///
keyToTkey(pCheckInfo->lastKey);
TSKEY
tLastKey
=
keyToTkey
(
pCheckInfo
->
lastKey
);
if
(
pHandle
->
pTsdb
->
mem
!=
NULL
)
{
if
(
pHandle
->
pTsdb
->
mem
!=
NULL
)
{
pMem
=
taosHashGet
(
pHandle
->
pTsdb
->
mem
->
pHashIdx
,
&
pCheckInfo
->
tableId
,
sizeof
(
pCheckInfo
->
tableId
));
pMem
=
taosHashGet
(
pHandle
->
pTsdb
->
mem
->
pHashIdx
,
&
pCheckInfo
->
tableId
,
sizeof
(
pCheckInfo
->
tableId
));
if
(
pMem
!=
NULL
)
{
if
(
pMem
!=
NULL
)
{
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
e0d3ceb5
...
@@ -152,7 +152,7 @@ _exit:
...
@@ -152,7 +152,7 @@ _exit:
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
)
{
int32_t
vnodeGetLoad
(
SVnode
*
pVnode
,
SVnodeLoad
*
pLoad
)
{
pLoad
->
vgId
=
TD_VID
(
pVnode
);
pLoad
->
vgId
=
TD_VID
(
pVnode
);
pLoad
->
rol
e
=
TAOS_SYNC_STATE_LEADER
;
pLoad
->
syncStat
e
=
TAOS_SYNC_STATE_LEADER
;
pLoad
->
numOfTables
=
metaGetTbNum
(
pVnode
->
pMeta
);
pLoad
->
numOfTables
=
metaGetTbNum
(
pVnode
->
pMeta
);
pLoad
->
numOfTimeSeries
=
400
;
pLoad
->
numOfTimeSeries
=
400
;
pLoad
->
totalStorage
=
300
;
pLoad
->
totalStorage
=
300
;
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
e0d3ceb5
...
@@ -117,6 +117,8 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
...
@@ -117,6 +117,8 @@ int vnodeProcessWriteReq(SVnode *pVnode, SRpcMsg *pMsg, int64_t version, SRpcMsg
// }
// }
}
break
;
}
break
;
case
TDMT_VND_ALTER_VNODE
:
break
;
default:
default:
ASSERT
(
0
);
ASSERT
(
0
);
break
;
break
;
...
...
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
e0d3ceb5
...
@@ -108,9 +108,10 @@ void sendCreateDbMsg(void *shandle, SEpSet *pEpSet) {
...
@@ -108,9 +108,10 @@ void sendCreateDbMsg(void *shandle, SEpSet *pEpSet) {
createReq
.
precision
=
0
;
createReq
.
precision
=
0
;
createReq
.
compression
=
2
;
createReq
.
compression
=
2
;
createReq
.
replications
=
1
;
createReq
.
replications
=
1
;
createReq
.
quorum
=
1
;
createReq
.
strict
=
1
;
createReq
.
update
=
0
;
createReq
.
update
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
cacheLastRow
=
0
;
createReq
.
ttl
=
1
;
createReq
.
ignoreExist
=
1
;
createReq
.
ignoreExist
=
1
;
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
int32_t
contLen
=
tSerializeSCreateDbReq
(
NULL
,
0
,
&
createReq
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
e0d3ceb5
...
@@ -427,6 +427,7 @@ typedef struct STableIntervalOperatorInfo {
...
@@ -427,6 +427,7 @@ typedef struct STableIntervalOperatorInfo {
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
SArray
*
pUpdatedWindow
;
// updated time window due to the input data block from the downstream operator.
SArray
*
pUpdatedWindow
;
// updated time window due to the input data block from the downstream operator.
STimeWindowAggSupp
twAggSup
;
STimeWindowAggSupp
twAggSup
;
struct
SFillInfo
*
pFillInfo
;
// fill info
}
STableIntervalOperatorInfo
;
}
STableIntervalOperatorInfo
;
typedef
struct
SAggOperatorInfo
{
typedef
struct
SAggOperatorInfo
{
...
@@ -467,7 +468,6 @@ typedef struct SFillOperatorInfo {
...
@@ -467,7 +468,6 @@ typedef struct SFillOperatorInfo {
SSDataBlock
*
existNewGroupBlock
;
SSDataBlock
*
existNewGroupBlock
;
bool
multigroupResult
;
bool
multigroupResult
;
SInterval
intervalInfo
;
SInterval
intervalInfo
;
int32_t
capacity
;
}
SFillOperatorInfo
;
}
SFillOperatorInfo
;
typedef
struct
{
typedef
struct
{
...
@@ -609,7 +609,7 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t
...
@@ -609,7 +609,7 @@ int32_t appendDownstream(SOperatorInfo* p, SOperatorInfo** pDownstream, int32_t
int32_t
initAggInfo
(
SOptrBasicInfo
*
pBasicInfo
,
SAggSupporter
*
pAggSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
int32_t
initAggInfo
(
SOptrBasicInfo
*
pBasicInfo
,
SAggSupporter
*
pAggSup
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResultBlock
,
size_t
keyBufSize
,
const
char
*
pkey
);
SSDataBlock
*
pResultBlock
,
size_t
keyBufSize
,
const
char
*
pkey
);
void
initResultSizeInfo
(
SOperatorInfo
*
pOperator
,
int32_t
numOfRows
);
void
initResultSizeInfo
(
SOperatorInfo
*
pOperator
,
int32_t
numOfRows
);
void
toS
Datablock
(
SSDataBlock
*
pBlock
,
int32_t
rowCapacity
,
SGroupResInfo
*
pGroupResInfo
,
SExprInfo
*
pExprInfo
,
void
doBuildResult
Datablock
(
SSDataBlock
*
pBlock
,
int32_t
rowCapacity
,
SGroupResInfo
*
pGroupResInfo
,
SExprInfo
*
pExprInfo
,
SDiskbasedBuf
*
pBuf
,
int32_t
*
rowCellOffset
);
SDiskbasedBuf
*
pBuf
,
int32_t
*
rowCellOffset
);
void
finalizeMultiTupleQueryResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SDiskbasedBuf
*
pBuf
,
void
finalizeMultiTupleQueryResult
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
,
SDiskbasedBuf
*
pBuf
,
SResultRowInfo
*
pResultRowInfo
,
int32_t
*
rowCellInfoOffset
);
SResultRowInfo
*
pResultRowInfo
,
int32_t
*
rowCellInfoOffset
);
...
@@ -621,7 +621,7 @@ void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput);
...
@@ -621,7 +621,7 @@ void doDestroyBasicInfo(SOptrBasicInfo* pInfo, int32_t numOfOutput);
int32_t
setSDataBlockFromFetchRsp
(
SSDataBlock
*
pRes
,
SLoadRemoteDataInfo
*
pLoadInfo
,
int32_t
numOfRows
,
char
*
pData
,
int32_t
setSDataBlockFromFetchRsp
(
SSDataBlock
*
pRes
,
SLoadRemoteDataInfo
*
pLoadInfo
,
int32_t
numOfRows
,
char
*
pData
,
int32_t
compLen
,
int32_t
numOfOutput
,
int64_t
startTs
,
uint64_t
*
total
,
int32_t
compLen
,
int32_t
numOfOutput
,
int64_t
startTs
,
uint64_t
*
total
,
SArray
*
pColList
);
SArray
*
pColList
);
void
getAlignQueryTimeWindow
(
SInterval
*
pInterval
,
int32_t
precision
,
int64_t
key
,
int64_t
keyFirst
,
int64_t
keyLast
,
STimeWindow
*
win
);
void
getAlignQueryTimeWindow
(
SInterval
*
pInterval
,
int32_t
precision
,
int64_t
key
,
STimeWindow
*
win
);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
);
...
@@ -645,8 +645,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
...
@@ -645,8 +645,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
SExecTaskInfo
*
pTaskInfo
,
bool
showRewrite
,
int32_t
accountId
);
SExecTaskInfo
*
pTaskInfo
,
bool
showRewrite
,
int32_t
accountId
);
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
STimeWindowAggSupp
*
pTwAggSupp
,
const
STableGroupInfo
*
pTableGroupInfo
,
STimeWindowAggSupp
*
pTwAggSupp
,
const
STableGroupInfo
*
pTableGroupInfo
,
SExecTaskInfo
*
pTaskInfo
);
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createSessionAggOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
int64_t
gap
,
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
);
SSDataBlock
*
pResBlock
,
int64_t
gap
,
STimeWindowAggSupp
*
pTwAggSupp
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createGroupOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createGroupOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
...
...
source/libs/
function
/inc/tfill.h
→
source/libs/
executor
/inc/tfill.h
浏览文件 @
e0d3ceb5
...
@@ -22,15 +22,18 @@ extern "C" {
...
@@ -22,15 +22,18 @@ extern "C" {
#include "os.h"
#include "os.h"
#include "taosdef.h"
#include "taosdef.h"
#include "tcommon.h"
struct
SSDataBlock
;
struct
SSDataBlock
;
typedef
struct
SFillColInfo
{
typedef
struct
SFillColInfo
{
STColumn
col
;
// column info
// STColumn col; // column info
SResSchema
col
;
int16_t
functionId
;
// sql function id
int16_t
functionId
;
// sql function id
int16_t
flag
;
// column flag: TAG COLUMN|NORMAL COLUMN
int16_t
flag
;
// column flag: TAG COLUMN|NORMAL COLUMN
int16_t
tagIndex
;
// index of current tag in SFillTagColInfo array list
int16_t
tagIndex
;
// index of current tag in SFillTagColInfo array list
union
{
int64_t
i
;
double
d
;}
fillVal
;
int32_t
offset
;
union
{
int64_t
i
;
double
d
;}
val
;
}
SFillColInfo
;
}
SFillColInfo
;
typedef
struct
{
typedef
struct
{
...
@@ -57,7 +60,6 @@ typedef struct SFillInfo {
...
@@ -57,7 +60,6 @@ typedef struct SFillInfo {
char
*
nextValues
;
// next row of data
char
*
nextValues
;
// next row of data
char
**
pData
;
// original result data block involved in filling data
char
**
pData
;
// original result data block involved in filling data
int32_t
alloc
;
// data buffer size in rows
int32_t
alloc
;
// data buffer size in rows
int8_t
precision
;
// time resoluation
SFillColInfo
*
pFillCol
;
// column info for fill operations
SFillColInfo
*
pFillCol
;
// column info for fill operations
SFillTagColInfo
*
pTags
;
// tags value for filling gap
SFillTagColInfo
*
pTags
;
// tags value for filling gap
...
@@ -67,7 +69,19 @@ typedef struct SFillInfo {
...
@@ -67,7 +69,19 @@ typedef struct SFillInfo {
int64_t
getNumOfResultsAfterFillGap
(
SFillInfo
*
pFillInfo
,
int64_t
ekey
,
int32_t
maxNumOfRows
);
int64_t
getNumOfResultsAfterFillGap
(
SFillInfo
*
pFillInfo
,
int64_t
ekey
,
int32_t
maxNumOfRows
);
void
taosFillSetStartInfo
(
struct
SFillInfo
*
pFillInfo
,
int32_t
numOfRows
,
TSKEY
endKey
);
void
taosResetFillInfo
(
struct
SFillInfo
*
pFillInfo
,
TSKEY
startTimestamp
);
void
taosFillSetInputDataBlock
(
struct
SFillInfo
*
pFillInfo
,
const
struct
SSDataBlock
*
pInput
);
struct
SFillColInfo
*
createFillColInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
const
struct
SValueNode
*
val
);
bool
taosFillHasMoreResults
(
struct
SFillInfo
*
pFillInfo
);
SFillInfo
*
taosCreateFillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
SInterval
*
pInterval
,
int32_t
fillType
,
struct
SFillColInfo
*
pCol
,
const
char
*
id
);
void
*
taosDestroyFillInfo
(
struct
SFillInfo
*
pFillInfo
);
int64_t
taosFillResultDataBlock
(
struct
SFillInfo
*
pFillInfo
,
void
**
output
,
int32_t
capacity
);
int64_t
getFillInfoStart
(
struct
SFillInfo
*
pFillInfo
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
e0d3ceb5
...
@@ -14,11 +14,12 @@
...
@@ -14,11 +14,12 @@
*/
*/
#include "filter.h"
#include "filter.h"
#include "functionMgt.h"
#include "function.h"
#include "function.h"
#include "functionMgt.h"
#include "os.h"
#include "querynodes.h"
#include "querynodes.h"
#include "tname.h"
#include "tname.h"
#include "
os
.h"
#include "
tfill
.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "tglobal.h"
#include "tglobal.h"
...
@@ -514,13 +515,12 @@ static SResultRow* doSetResultOutBufByKey_rv(SDiskbasedBuf* pResultBuf, SResultR
...
@@ -514,13 +515,12 @@ static SResultRow* doSetResultOutBufByKey_rv(SDiskbasedBuf* pResultBuf, SResultR
return
pResult
;
return
pResult
;
}
}
static
void
getInitialStartTimeWindow
(
SInterval
*
pInterval
,
int32_t
precision
,
TSKEY
ts
,
STimeWindow
*
w
,
TSKEY
ekey
,
static
void
getInitialStartTimeWindow
(
SInterval
*
pInterval
,
int32_t
precision
,
TSKEY
ts
,
STimeWindow
*
w
,
bool
ascQuery
)
{
bool
ascQuery
)
{
if
(
ascQuery
)
{
if
(
ascQuery
)
{
getAlignQueryTimeWindow
(
pInterval
,
precision
,
ts
,
ts
,
ekey
,
w
);
getAlignQueryTimeWindow
(
pInterval
,
precision
,
ts
,
w
);
}
else
{
}
else
{
// the start position of the first time window in the endpoint that spreads beyond the queried last timestamp
// the start position of the first time window in the endpoint that spreads beyond the queried last timestamp
getAlignQueryTimeWindow
(
pInterval
,
precision
,
ts
,
ekey
,
ts
,
w
);
getAlignQueryTimeWindow
(
pInterval
,
precision
,
ts
,
w
);
int64_t
key
=
w
->
skey
;
int64_t
key
=
w
->
skey
;
while
(
key
<
ts
)
{
// moving towards end
while
(
key
<
ts
)
{
// moving towards end
...
@@ -540,7 +540,7 @@ static STimeWindow getActiveTimeWindow(SDiskbasedBuf * pBuf, SResultRowInfo* pRe
...
@@ -540,7 +540,7 @@ static STimeWindow getActiveTimeWindow(SDiskbasedBuf * pBuf, SResultRowInfo* pRe
STimeWindow
w
=
{
0
};
STimeWindow
w
=
{
0
};
if
(
pResultRowInfo
->
cur
.
pageId
==
-
1
)
{
// the first window, from the previous stored value
if
(
pResultRowInfo
->
cur
.
pageId
==
-
1
)
{
// the first window, from the previous stored value
getInitialStartTimeWindow
(
pInterval
,
precision
,
ts
,
&
w
,
win
->
ekey
,
true
);
getInitialStartTimeWindow
(
pInterval
,
precision
,
ts
,
&
w
,
true
);
w
.
ekey
=
taosTimeAdd
(
w
.
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
w
.
ekey
=
taosTimeAdd
(
w
.
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
}
else
{
}
else
{
w
=
getResultRowByPos
(
pBuf
,
&
pResultRowInfo
->
cur
)
->
win
;
w
=
getResultRowByPos
(
pBuf
,
&
pResultRowInfo
->
cur
)
->
win
;
...
@@ -2015,20 +2015,16 @@ static bool isCachedLastQuery(STaskAttr* pQueryAttr) {
...
@@ -2015,20 +2015,16 @@ static bool isCachedLastQuery(STaskAttr* pQueryAttr) {
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
// todo refactor : return window
// todo refactor : return window
void
getAlignQueryTimeWindow
(
SInterval
*
pInterval
,
int32_t
precision
,
int64_t
key
,
int64_t
keyFirst
,
int64_t
keyLast
,
void
getAlignQueryTimeWindow
(
SInterval
*
pInterval
,
int32_t
precision
,
int64_t
key
,
STimeWindow
*
win
)
{
STimeWindow
*
win
)
{
ASSERT
(
key
>=
keyFirst
&&
key
<=
keyLast
);
win
->
skey
=
taosTimeTruncate
(
key
,
pInterval
,
precision
);
win
->
skey
=
taosTimeTruncate
(
key
,
pInterval
,
precision
);
/*
/*
* if the realSkey > INT64_MAX - pInterval->interval, the query duration between
* if the realSkey > INT64_MAX - pInterval->interval, the query duration between
* realSkey and realEkey must be less than one interval.Therefore, no need to adjust the query ranges.
* realSkey and realEkey must be less than one interval.Therefore, no need to adjust the query ranges.
*/
*/
if
(
keyFirst
>
(
INT64_MAX
-
pInterval
->
interval
))
{
win
->
ekey
=
taosTimeAdd
(
win
->
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
assert
(
keyLast
-
keyFirst
<
pInterval
->
interval
);
if
(
win
->
ekey
<
win
->
skey
)
{
win
->
ekey
=
INT64_MAX
;
win
->
ekey
=
INT64_MAX
;
}
else
{
win
->
ekey
=
taosTimeAdd
(
win
->
skey
,
pInterval
->
interval
,
pInterval
->
intervalUnit
,
precision
)
-
1
;
}
}
}
}
...
@@ -3176,10 +3172,12 @@ int32_t doCopyToSDataBlock(SSDataBlock* pBlock, int32_t rowCapacity, SExprInfo*
...
@@ -3176,10 +3172,12 @@ int32_t doCopyToSDataBlock(SSDataBlock* pBlock, int32_t rowCapacity, SExprInfo*
// qDebug("QInfo:0x%"PRIx64" copy data to query buf completed", GET_TASKID(pRuntimeEnv));
// qDebug("QInfo:0x%"PRIx64" copy data to query buf completed", GET_TASKID(pRuntimeEnv));
pBlock
->
info
.
rows
=
numOfResult
;
pBlock
->
info
.
rows
=
numOfResult
;
blockDataUpdateTsWindow
(
pBlock
);
return
0
;
return
0
;
}
}
void
toS
Datablock
(
SSDataBlock
*
pBlock
,
int32_t
rowCapacity
,
SGroupResInfo
*
pGroupResInfo
,
SExprInfo
*
pExprInfo
,
SDiskbasedBuf
*
pBuf
,
void
doBuildResult
Datablock
(
SSDataBlock
*
pBlock
,
int32_t
rowCapacity
,
SGroupResInfo
*
pGroupResInfo
,
SExprInfo
*
pExprInfo
,
SDiskbasedBuf
*
pBuf
,
int32_t
*
rowCellOffset
)
{
int32_t
*
rowCellOffset
)
{
assert
(
pGroupResInfo
->
currentGroup
<=
pGroupResInfo
->
totalGroup
);
assert
(
pGroupResInfo
->
currentGroup
<=
pGroupResInfo
->
totalGroup
);
...
@@ -4813,7 +4811,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator, bool* newgroup)
...
@@ -4813,7 +4811,7 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator, bool* newgroup)
}
}
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
toS
Datablock
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pAggInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pAggInfo
->
aggSup
.
pResultBuf
,
pInfo
->
rowCellInfoOffset
);
doBuildResult
Datablock
(
pInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pAggInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pAggInfo
->
aggSup
.
pResultBuf
,
pInfo
->
rowCellInfoOffset
);
if
(
pInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pAggInfo
->
groupResInfo
))
{
if
(
pInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pAggInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
...
@@ -5126,6 +5124,8 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator, bool* newgro
...
@@ -5126,6 +5124,8 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator, bool* newgro
return
NULL
;
return
NULL
;
}
}
SSDataBlock
*
pBlock
=
pInfo
->
binfo
.
pRes
;
if
(
pInfo
->
execModel
==
OPTR_EXEC_MODEL_STREAM
)
{
if
(
pInfo
->
execModel
==
OPTR_EXEC_MODEL_STREAM
)
{
return
pOperator
->
getStreamResFn
(
pOperator
,
newgroup
);
return
pOperator
->
getStreamResFn
(
pOperator
,
newgroup
);
}
else
{
}
else
{
...
@@ -5134,15 +5134,15 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator, bool* newgro
...
@@ -5134,15 +5134,15 @@ static SSDataBlock* doBuildIntervalResult(SOperatorInfo* pOperator, bool* newgro
return
NULL
;
return
NULL
;
}
}
blockDataEnsureCapacity
(
p
Info
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
p
Block
,
pOperator
->
resultInfo
.
capacity
);
toSDatablock
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
doBuildResultDatablock
(
pBlock
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
if
(
p
Info
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
p
Block
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
return
p
Info
->
binfo
.
pRes
->
info
.
rows
==
0
?
NULL
:
pInfo
->
binfo
.
pRes
;
return
p
Block
->
info
.
rows
==
0
?
NULL
:
pBlock
;
}
}
}
}
...
@@ -5155,7 +5155,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup
...
@@ -5155,7 +5155,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup
}
}
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
toS
Datablock
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
doBuildResult
Datablock
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
if
(
pInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
pInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
}
}
...
@@ -5190,7 +5190,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup
...
@@ -5190,7 +5190,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo *pOperator, bool* newgroup
initMultiResInfoFromArrayList
(
&
pInfo
->
groupResInfo
,
pUpdated
);
initMultiResInfoFromArrayList
(
&
pInfo
->
groupResInfo
,
pUpdated
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
toS
Datablock
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
doBuildResult
Datablock
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
ASSERT
(
pInfo
->
binfo
.
pRes
->
info
.
rows
>
0
);
ASSERT
(
pInfo
->
binfo
.
pRes
->
info
.
rows
>
0
);
pOperator
->
status
=
OP_RES_TO_RETURN
;
pOperator
->
status
=
OP_RES_TO_RETURN
;
...
@@ -5205,7 +5205,7 @@ static SSDataBlock* doAllIntervalAgg(SOperatorInfo *pOperator, bool* newgroup) {
...
@@ -5205,7 +5205,7 @@ static SSDataBlock* doAllIntervalAgg(SOperatorInfo *pOperator, bool* newgroup) {
STimeSliceOperatorInfo
*
pSliceInfo
=
pOperator
->
info
;
STimeSliceOperatorInfo
*
pSliceInfo
=
pOperator
->
info
;
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
//
toS
Datablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
//
doBuildResult
Datablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pIntervalInfo->pRes);
if
(
pSliceInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pSliceInfo
->
groupResInfo
))
{
if
(
pSliceInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pSliceInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
...
@@ -5238,7 +5238,7 @@ static SSDataBlock* doAllIntervalAgg(SOperatorInfo *pOperator, bool* newgroup) {
...
@@ -5238,7 +5238,7 @@ static SSDataBlock* doAllIntervalAgg(SOperatorInfo *pOperator, bool* newgroup) {
finalizeQueryResult
(
pSliceInfo
->
binfo
.
pCtx
,
pOperator
->
numOfOutput
);
finalizeQueryResult
(
pSliceInfo
->
binfo
.
pCtx
,
pOperator
->
numOfOutput
);
initGroupResInfo
(
&
pSliceInfo
->
groupResInfo
,
&
pSliceInfo
->
binfo
.
resultRowInfo
);
initGroupResInfo
(
&
pSliceInfo
->
groupResInfo
,
&
pSliceInfo
->
binfo
.
resultRowInfo
);
//
toS
Datablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pSliceInfo->pRes);
//
doBuildResult
Datablock(&pRuntimeEnv->groupResInfo, pRuntimeEnv, pSliceInfo->pRes);
if
(
pSliceInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pSliceInfo
->
groupResInfo
))
{
if
(
pSliceInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pSliceInfo
->
groupResInfo
))
{
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
...
@@ -5292,7 +5292,7 @@ static SSDataBlock* doSTableIntervalAgg(SOperatorInfo* pOperator, bool* newgroup
...
@@ -5292,7 +5292,7 @@ static SSDataBlock* doSTableIntervalAgg(SOperatorInfo* pOperator, bool* newgroup
OPTR_SET_OPENED
(
pOperator
);
OPTR_SET_OPENED
(
pOperator
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
);
toS
Datablock
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
doBuildResult
Datablock
(
pInfo
->
binfo
.
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
if
(
pInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
pInfo
->
binfo
.
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
...
@@ -5383,7 +5383,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -5383,7 +5383,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator, bool* newgroup) {
SOptrBasicInfo
*
pBInfo
=
&
pInfo
->
binfo
;
SOptrBasicInfo
*
pBInfo
=
&
pInfo
->
binfo
;
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
toS
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
doBuildResult
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
return
NULL
;
return
NULL
;
...
@@ -5415,7 +5415,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -5415,7 +5415,7 @@ static SSDataBlock* doStateWindowAgg(SOperatorInfo* pOperator, bool* newgroup) {
initGroupResInfo
(
&
pInfo
->
groupResInfo
,
&
pBInfo
->
resultRowInfo
);
initGroupResInfo
(
&
pInfo
->
groupResInfo
,
&
pBInfo
->
resultRowInfo
);
blockDataEnsureCapacity
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
toS
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
doBuildResult
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
...
@@ -5432,7 +5432,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator, bool* newgroup)
...
@@ -5432,7 +5432,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator, bool* newgroup)
SOptrBasicInfo
*
pBInfo
=
&
pInfo
->
binfo
;
SOptrBasicInfo
*
pBInfo
=
&
pInfo
->
binfo
;
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
toS
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
doBuildResult
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
return
NULL
;
return
NULL
;
...
@@ -5464,7 +5464,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator, bool* newgroup)
...
@@ -5464,7 +5464,7 @@ static SSDataBlock* doSessionWindowAgg(SOperatorInfo* pOperator, bool* newgroup)
initGroupResInfo
(
&
pInfo
->
groupResInfo
,
&
pBInfo
->
resultRowInfo
);
initGroupResInfo
(
&
pInfo
->
groupResInfo
,
&
pBInfo
->
resultRowInfo
);
blockDataEnsureCapacity
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
blockDataEnsureCapacity
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
);
toS
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
doBuildResult
Datablock
(
pBInfo
->
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pBInfo
->
rowCellInfoOffset
);
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
pBInfo
->
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
...
@@ -5509,14 +5509,16 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -5509,14 +5509,16 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator, bool* newgroup) {
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
blockDataCleanup
(
pInfo
->
pRes
);
SSDataBlock
*
pResBlock
=
pInfo
->
pRes
;
blockDataCleanup
(
pResBlock
);
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
return
NULL
;
}
}
doHandleRemainBlockFromNewGroup
(
pInfo
,
pResultInfo
,
newgroup
,
pTaskInfo
);
doHandleRemainBlockFromNewGroup
(
pInfo
,
pResultInfo
,
newgroup
,
pTaskInfo
);
if
(
p
Info
->
pRes
->
info
.
rows
>
pResultInfo
->
threshold
||
(
!
pInfo
->
multigroupResult
&&
pInfo
->
pRes
->
info
.
rows
>
0
))
{
if
(
p
ResBlock
->
info
.
rows
>
pResultInfo
->
threshold
||
(
!
pInfo
->
multigroupResult
&&
pResBlock
->
info
.
rows
>
0
))
{
return
p
Info
->
pRes
;
return
p
ResBlock
;
}
}
SOperatorInfo
*
pDownstream
=
pOperator
->
pDownstream
[
0
];
SOperatorInfo
*
pDownstream
=
pOperator
->
pDownstream
[
0
];
...
@@ -5551,25 +5553,25 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -5551,25 +5553,25 @@ static SSDataBlock* doFill(SOperatorInfo* pOperator, bool* newgroup) {
}
}
}
}
doFillTimeIntervalGapsInResults
(
pInfo
->
pFillInfo
,
p
Info
->
pRes
,
pInfo
->
capacity
,
pInfo
->
p
);
doFillTimeIntervalGapsInResults
(
pInfo
->
pFillInfo
,
p
ResBlock
,
pOperator
->
resultInfo
.
capacity
,
pInfo
->
p
);
// current group has no more result to return
// current group has no more result to return
if
(
p
Info
->
pRes
->
info
.
rows
>
0
)
{
if
(
p
ResBlock
->
info
.
rows
>
0
)
{
// 1. The result in current group not reach the threshold of output result, continue
// 1. The result in current group not reach the threshold of output result, continue
// 2. If multiple group results existing in one SSDataBlock is not allowed, return immediately
// 2. If multiple group results existing in one SSDataBlock is not allowed, return immediately
if
(
p
Info
->
pRes
->
info
.
rows
>
pResultInfo
->
threshold
||
pBlock
==
NULL
||
(
!
pInfo
->
multigroupResult
))
{
if
(
p
ResBlock
->
info
.
rows
>
pResultInfo
->
threshold
||
pBlock
==
NULL
||
(
!
pInfo
->
multigroupResult
))
{
return
p
Info
->
pRes
;
return
p
ResBlock
;
}
}
doHandleRemainBlockFromNewGroup
(
pInfo
,
pResultInfo
,
newgroup
,
pTaskInfo
);
doHandleRemainBlockFromNewGroup
(
pInfo
,
pResultInfo
,
newgroup
,
pTaskInfo
);
if
(
p
Info
->
pRes
->
info
.
rows
>
pOperator
->
resultInfo
.
threshold
||
pBlock
==
NULL
)
{
if
(
p
ResBlock
->
info
.
rows
>
pOperator
->
resultInfo
.
threshold
||
pBlock
==
NULL
)
{
return
p
Info
->
pRes
;
return
p
ResBlock
;
}
}
}
else
if
(
pInfo
->
existNewGroupBlock
)
{
// try next group
}
else
if
(
pInfo
->
existNewGroupBlock
)
{
// try next group
assert
(
pBlock
!=
NULL
);
assert
(
pBlock
!=
NULL
);
doHandleRemainBlockForNewGroupImpl
(
pInfo
,
pResultInfo
,
newgroup
,
pTaskInfo
);
doHandleRemainBlockForNewGroupImpl
(
pInfo
,
pResultInfo
,
newgroup
,
pTaskInfo
);
if
(
p
Info
->
pRes
->
info
.
rows
>
pResultInfo
->
threshold
)
{
if
(
p
ResBlock
->
info
.
rows
>
pResultInfo
->
threshold
)
{
return
p
Info
->
pRes
;
return
p
ResBlock
;
}
}
}
else
{
}
else
{
return
NULL
;
return
NULL
;
...
@@ -5615,7 +5617,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
...
@@ -5615,7 +5617,7 @@ int32_t doInitAggInfoSup(SAggSupporter* pAggSup, SqlFunctionCtx* pCtx, int32_t n
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
pAggSup
->
resultRowSize
=
getResultRowSize
(
pCtx
,
numOfOutput
);
pAggSup
->
resultRowSize
=
getResultRowSize
(
pCtx
,
numOfOutput
);
pAggSup
->
keyBuf
=
taosMemoryCalloc
(
1
,
keyBufSize
);
pAggSup
->
keyBuf
=
taosMemoryCalloc
(
1
,
keyBufSize
+
POINTER_BYTES
+
sizeof
(
int64_t
)
);
pAggSup
->
pResultRowHashTable
=
taosHashInit
(
10
,
hashFn
,
true
,
HASH_NO_LOCK
);
pAggSup
->
pResultRowHashTable
=
taosHashInit
(
10
,
hashFn
,
true
,
HASH_NO_LOCK
);
pAggSup
->
pResultRowListSet
=
taosHashInit
(
100
,
hashFn
,
false
,
HASH_NO_LOCK
);
pAggSup
->
pResultRowListSet
=
taosHashInit
(
100
,
hashFn
,
false
,
HASH_NO_LOCK
);
pAggSup
->
pResultRowArrayList
=
taosArrayInit
(
10
,
sizeof
(
SResultRowCell
));
pAggSup
->
pResultRowArrayList
=
taosArrayInit
(
10
,
sizeof
(
SResultRowCell
));
...
@@ -5878,8 +5880,7 @@ _error:
...
@@ -5878,8 +5880,7 @@ _error:
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SOperatorInfo
*
createIntervalOperatorInfo
(
SOperatorInfo
*
downstream
,
SExprInfo
*
pExprInfo
,
int32_t
numOfCols
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
SSDataBlock
*
pResBlock
,
SInterval
*
pInterval
,
int32_t
primaryTsSlotId
,
STimeWindowAggSupp
*
pTwAggSupp
,
const
STableGroupInfo
*
pTableGroupInfo
,
STimeWindowAggSupp
*
pTwAggSupp
,
const
STableGroupInfo
*
pTableGroupInfo
,
SExecTaskInfo
*
pTaskInfo
)
{
SExecTaskInfo
*
pTaskInfo
)
{
STableIntervalOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STableIntervalOperatorInfo
));
STableIntervalOperatorInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STableIntervalOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
@@ -5890,10 +5891,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
...
@@ -5890,10 +5891,8 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
pInfo
->
interval
=
*
pInterval
;
pInfo
->
interval
=
*
pInterval
;
pInfo
->
execModel
=
pTaskInfo
->
execModel
;
pInfo
->
execModel
=
pTaskInfo
->
execModel
;
pInfo
->
win
=
pTaskInfo
->
window
;
pInfo
->
win
=
pTaskInfo
->
window
;
pInfo
->
win
.
skey
=
0
;
pInfo
->
win
.
ekey
=
INT64_MAX
;
pInfo
->
primaryTsIndex
=
primaryTsSlotId
;
pInfo
->
twAggSup
=
*
pTwAggSupp
;
pInfo
->
twAggSup
=
*
pTwAggSupp
;
pInfo
->
primaryTsIndex
=
primaryTsSlotId
;
int32_t
numOfRows
=
4096
;
int32_t
numOfRows
=
4096
;
size_t
keyBufSize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
POINTER_BYTES
;
size_t
keyBufSize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
POINTER_BYTES
;
...
@@ -6063,18 +6062,14 @@ _error:
...
@@ -6063,18 +6062,14 @@ _error:
static
int32_t
initFillInfo
(
SFillOperatorInfo
*
pInfo
,
SExprInfo
*
pExpr
,
int32_t
numOfCols
,
int64_t
*
fillVal
,
static
int32_t
initFillInfo
(
SFillOperatorInfo
*
pInfo
,
SExprInfo
*
pExpr
,
int32_t
numOfCols
,
int64_t
*
fillVal
,
STimeWindow
win
,
int32_t
capacity
,
const
char
*
id
,
SInterval
*
pInterval
,
int32_t
fillType
)
{
STimeWindow
win
,
int32_t
capacity
,
const
char
*
id
,
SInterval
*
pInterval
,
int32_t
fillType
)
{
struct
SFillColInfo
*
pColInfo
=
createFillColInfo
(
pExpr
,
numOfCols
,
(
int64_t
*
)
fillVal
);
SFillColInfo
*
pColInfo
=
createFillColInfo
(
pExpr
,
numOfCols
,
NULL
);
TSKEY
sk
=
TMIN
(
win
.
skey
,
win
.
ekey
);
TSKEY
ek
=
TMAX
(
win
.
skey
,
win
.
ekey
);
// TODO set correct time precision
// TODO set correct time precision
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
STimeWindow
w
=
TSWINDOW_INITIALIZER
;
getAlignQueryTimeWindow
(
pInterval
,
TSDB_TIME_PRECISION_MILLI
,
win
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pInterval
,
TSDB_TIME_PRECISION_MILLI
,
win
.
skey
,
&
w
);
int32_t
order
=
TSDB_ORDER_ASC
;
int32_t
order
=
TSDB_ORDER_ASC
;
pInfo
->
pFillInfo
=
taosCreateFillInfo
(
order
,
w
.
skey
,
0
,
capacity
,
numOfCols
,
pInterval
->
sliding
,
pInfo
->
pFillInfo
=
taosCreateFillInfo
(
order
,
w
.
skey
,
0
,
capacity
,
numOfCols
,
pInterval
,
fillType
,
pColInfo
,
id
);
pInterval
->
slidingUnit
,
(
int8_t
)
pInterval
->
precision
,
fillType
,
pColInfo
,
id
);
pInfo
->
p
=
taosMemoryCalloc
(
numOfCols
,
POINTER_BYTES
);
pInfo
->
p
=
taosMemoryCalloc
(
numOfCols
,
POINTER_BYTES
);
...
@@ -6095,23 +6090,37 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExp
...
@@ -6095,23 +6090,37 @@ SOperatorInfo* createFillOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExp
pInfo
->
multigroupResult
=
multigroupResult
;
pInfo
->
multigroupResult
=
multigroupResult
;
pInfo
->
intervalInfo
=
*
pInterval
;
pInfo
->
intervalInfo
=
*
pInterval
;
int32_t
type
=
TSDB_FILL_NONE
;
switch
(
fillType
)
{
case
FILL_MODE_PREV
:
type
=
TSDB_FILL_PREV
;
break
;
case
FILL_MODE_NONE
:
type
=
TSDB_FILL_NONE
;
break
;
case
FILL_MODE_NULL
:
type
=
TSDB_FILL_NULL
;
break
;
case
FILL_MODE_NEXT
:
type
=
TSDB_FILL_NEXT
;
break
;
case
FILL_MODE_VALUE
:
type
=
TSDB_FILL_SET_VALUE
;
break
;
case
FILL_MODE_LINEAR
:
type
=
TSDB_FILL_LINEAR
;
break
;
default:
type
=
TSDB_FILL_NONE
;
}
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
SResultInfo
*
pResultInfo
=
&
pOperator
->
resultInfo
;
int32_t
code
=
initFillInfo
(
pInfo
,
pExpr
,
numOfCols
,
(
int64_t
*
)
fillVal
,
pTaskInfo
->
window
,
pResultInfo
->
capacity
,
initResultSizeInfo
(
pOperator
,
4096
);
pTaskInfo
->
id
.
str
,
pInterval
,
fillType
);
int32_t
code
=
initFillInfo
(
pInfo
,
pExpr
,
numOfCols
,
(
int64_t
*
)
fillVal
,
pTaskInfo
->
window
,
pResultInfo
->
capacity
,
pTaskInfo
->
id
.
str
,
pInterval
,
type
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
goto
_error
;
}
}
pOperator
->
name
=
"FillOperator"
;
pOperator
->
name
=
"FillOperator"
;
pOperator
->
blockingOptr
=
false
;
pOperator
->
blockingOptr
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
// pOperator->operatorType = OP_Fill;
// pOperator->operatorType = OP_Fill;
pOperator
->
pExpr
=
pExpr
;
pOperator
->
pExpr
=
pExpr
;
pOperator
->
numOfOutput
=
numOfCols
;
pOperator
->
numOfOutput
=
numOfCols
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
_openFn
=
operatorDummyOpenFn
;
pOperator
->
_openFn
=
operatorDummyOpenFn
;
pOperator
->
getNextFn
=
doFill
;
pOperator
->
getNextFn
=
doFill
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
closeFn
=
destroySFillOperatorInfo
;
pOperator
->
closeFn
=
destroySFillOperatorInfo
;
...
@@ -6582,6 +6591,11 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -6582,6 +6591,11 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
int32_t
primaryTsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
int32_t
primaryTsSlotId
=
((
SColumnNode
*
)
pIntervalPhyNode
->
window
.
pTspk
)
->
slotId
;
pOptr
=
createIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
primaryTsSlotId
,
&
as
,
pTableGroupInfo
,
pTaskInfo
);
pOptr
=
createIntervalOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
&
interval
,
primaryTsSlotId
,
&
as
,
pTableGroupInfo
,
pTaskInfo
);
if
(
pIntervalPhyNode
->
pFill
!=
NULL
)
{
pOptr
=
createFillOperatorInfo
(
pOptr
,
pExprInfo
,
num
,
&
interval
,
pResBlock
,
pIntervalPhyNode
->
pFill
->
mode
,
NULL
,
false
,
pTaskInfo
);
}
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SORT
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SORT
==
type
)
{
SSortPhysiNode
*
pSortPhyNode
=
(
SSortPhysiNode
*
)
pPhyNode
;
SSortPhysiNode
*
pSortPhyNode
=
(
SSortPhysiNode
*
)
pPhyNode
;
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
e0d3ceb5
...
@@ -265,7 +265,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator, bool* newgrou
...
@@ -265,7 +265,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator, bool* newgrou
SSDataBlock
*
pRes
=
pInfo
->
binfo
.
pRes
;
SSDataBlock
*
pRes
=
pInfo
->
binfo
.
pRes
;
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
if
(
pOperator
->
status
==
OP_RES_TO_RETURN
)
{
toS
Datablock
(
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
doBuildResult
Datablock
(
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
if
(
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
if
(
pRes
->
info
.
rows
==
0
||
!
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
))
{
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
}
}
...
@@ -311,7 +311,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator, bool* newgrou
...
@@ -311,7 +311,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator, bool* newgrou
initGroupResInfo
(
&
pInfo
->
groupResInfo
,
&
pInfo
->
binfo
.
resultRowInfo
);
initGroupResInfo
(
&
pInfo
->
groupResInfo
,
&
pInfo
->
binfo
.
resultRowInfo
);
while
(
1
)
{
while
(
1
)
{
toS
Datablock
(
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
doBuildResult
Datablock
(
pRes
,
pOperator
->
resultInfo
.
capacity
,
&
pInfo
->
groupResInfo
,
pOperator
->
pExpr
,
pInfo
->
aggSup
.
pResultBuf
,
pInfo
->
binfo
.
rowCellInfoOffset
);
doFilter
(
pInfo
->
pCondition
,
pRes
);
doFilter
(
pInfo
->
pCondition
,
pRes
);
bool
hasRemain
=
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
);
bool
hasRemain
=
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
e0d3ceb5
...
@@ -129,7 +129,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -129,7 +129,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
// TSKEY ek = MAX(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// TSKEY ek = MAX(pQueryAttr->window.skey, pQueryAttr->window.ekey);
if
(
true
)
{
if
(
true
)
{
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
pBlockInfo
->
window
.
skey
,
sk
,
ek
,
&
w
);
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
pBlockInfo
->
window
.
skey
,
&
w
);
assert
(
w
.
ekey
>=
pBlockInfo
->
window
.
skey
);
assert
(
w
.
ekey
>=
pBlockInfo
->
window
.
skey
);
if
(
w
.
ekey
<
pBlockInfo
->
window
.
ekey
)
{
if
(
w
.
ekey
<
pBlockInfo
->
window
.
ekey
)
{
...
@@ -451,8 +451,8 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -451,8 +451,8 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator, bool* newgroup) {
STableBlockDistInfo
tableBlockDist
=
{
0
};
STableBlockDistInfo
tableBlockDist
=
{
0
};
tableBlockDist
.
numOfTables
=
1
;
// TODO set the correct number of tables
tableBlockDist
.
numOfTables
=
1
;
// TODO set the correct number of tables
int32_t
numRowSteps
=
TSDB_DEFAULT_MAX
_ROW
_FBLOCK
/
TSDB_BLOCK_DIST_STEP_ROWS
;
int32_t
numRowSteps
=
TSDB_DEFAULT_MAX
ROWS
_FBLOCK
/
TSDB_BLOCK_DIST_STEP_ROWS
;
if
(
TSDB_DEFAULT_MAX
_ROW
_FBLOCK
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
if
(
TSDB_DEFAULT_MAX
ROWS
_FBLOCK
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
++
numRowSteps
;
++
numRowSteps
;
}
}
...
...
source/libs/
function
/src/tfill.c
→
source/libs/
executor
/src/tfill.c
浏览文件 @
e0d3ceb5
...
@@ -13,17 +13,18 @@
...
@@ -13,17 +13,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include
<function.h>
#include
"function.h"
#include "os.h"
#include "os.h"
#include "querynodes.h"
#include "taosdef.h"
#include "taosdef.h"
#include "tmsg.h"
#include "tmsg.h"
#include "ttypes.h"
#include "ttypes.h"
#include "tfill.h"
#include "tfill.h"
#include "thash.h"
#include "function.h"
#include "function.h"
#include "tcommon.h"
#include "tcommon.h"
#include "thash.h"
#include "ttime.h"
#include "ttime.h"
#define FILL_IS_ASC_FILL(_f) ((_f)->order == TSDB_ORDER_ASC)
#define FILL_IS_ASC_FILL(_f) ((_f)->order == TSDB_ORDER_ASC)
...
@@ -41,7 +42,7 @@ static void setTagsValue(SFillInfo* pFillInfo, void** data, int32_t genRows) {
...
@@ -41,7 +42,7 @@ static void setTagsValue(SFillInfo* pFillInfo, void** data, int32_t genRows) {
assert
(
pCol
->
tagIndex
>=
0
&&
pCol
->
tagIndex
<
pFillInfo
->
numOfTags
);
assert
(
pCol
->
tagIndex
>=
0
&&
pCol
->
tagIndex
<
pFillInfo
->
numOfTags
);
SFillTagColInfo
*
pTag
=
&
pFillInfo
->
pTags
[
pCol
->
tagIndex
];
SFillTagColInfo
*
pTag
=
&
pFillInfo
->
pTags
[
pCol
->
tagIndex
];
assert
(
pTag
->
col
.
colId
==
pCol
->
col
.
colId
);
//
assert (pTag->col.colId == pCol->col.colId);
assignVal
(
val1
,
pTag
->
tagVal
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
assignVal
(
val1
,
pTag
->
tagVal
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
}
}
}
}
...
@@ -80,7 +81,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
...
@@ -80,7 +81,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
}
}
char
*
output
=
elePtrAt
(
data
[
i
],
pCol
->
col
.
bytes
,
index
);
char
*
output
=
elePtrAt
(
data
[
i
],
pCol
->
col
.
bytes
,
index
);
assignVal
(
output
,
p
+
pCol
->
col
.
offset
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
// assignVal(output, p + pCol->
offset, pCol->col.bytes, pCol->col.type);
}
}
}
else
{
// no prev value yet, set the value for NULL
}
else
{
// no prev value yet, set the value for NULL
setNullValueForRow
(
pFillInfo
,
data
,
pFillInfo
->
numOfCols
,
index
);
setNullValueForRow
(
pFillInfo
,
data
,
pFillInfo
->
numOfCols
,
index
);
...
@@ -96,7 +97,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
...
@@ -96,7 +97,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
}
}
char
*
output
=
elePtrAt
(
data
[
i
],
pCol
->
col
.
bytes
,
index
);
char
*
output
=
elePtrAt
(
data
[
i
],
pCol
->
col
.
bytes
,
index
);
assignVal
(
output
,
p
+
pCol
->
col
.
offset
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
// assignVal(output, p + pCol->
offset, pCol->col.bytes, pCol->col.type);
}
}
}
else
{
// no prev value yet, set the value for NULL
}
else
{
// no prev value yet, set the value for NULL
setNullValueForRow
(
pFillInfo
,
data
,
pFillInfo
->
numOfCols
,
index
);
setNullValueForRow
(
pFillInfo
,
data
,
pFillInfo
->
numOfCols
,
index
);
...
@@ -119,7 +120,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
...
@@ -119,7 +120,7 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
continue
;
continue
;
}
}
point1
=
(
SPoint
){.
key
=
*
(
TSKEY
*
)(
prev
),
.
val
=
prev
+
pCol
->
col
.
offset
};
point1
=
(
SPoint
){.
key
=
*
(
TSKEY
*
)(
prev
),
.
val
=
prev
+
pCol
->
offset
};
point2
=
(
SPoint
){.
key
=
ts
,
.
val
=
srcData
[
i
]
+
pFillInfo
->
index
*
bytes
};
point2
=
(
SPoint
){.
key
=
ts
,
.
val
=
srcData
[
i
]
+
pFillInfo
->
index
*
bytes
};
point
=
(
SPoint
){.
key
=
pFillInfo
->
currentKey
,
.
val
=
val1
};
point
=
(
SPoint
){.
key
=
pFillInfo
->
currentKey
,
.
val
=
val1
};
taosGetLinearInterpolationVal
(
&
point
,
type
,
&
point1
,
&
point2
,
type
);
taosGetLinearInterpolationVal
(
&
point
,
type
,
&
point1
,
&
point2
,
type
);
...
@@ -135,12 +136,13 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
...
@@ -135,12 +136,13 @@ static void doFillOneRowResult(SFillInfo* pFillInfo, void** data, char** srcData
}
}
char
*
val1
=
elePtrAt
(
data
[
i
],
pCol
->
col
.
bytes
,
index
);
char
*
val1
=
elePtrAt
(
data
[
i
],
pCol
->
col
.
bytes
,
index
);
assignVal
(
val1
,
(
char
*
)
&
pCol
->
fillVal
.
i
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
assignVal
(
val1
,
(
char
*
)
&
pCol
->
val
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
}
}
}
}
setTagsValue
(
pFillInfo
,
data
,
index
);
setTagsValue
(
pFillInfo
,
data
,
index
);
pFillInfo
->
currentKey
=
taosTimeAdd
(
pFillInfo
->
currentKey
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
pFillInfo
->
currentKey
=
taosTimeAdd
(
pFillInfo
->
currentKey
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
interval
.
precision
);
pFillInfo
->
numOfCurrent
++
;
pFillInfo
->
numOfCurrent
++
;
}
}
...
@@ -152,7 +154,7 @@ static void initBeforeAfterDataBuf(SFillInfo* pFillInfo, char** next) {
...
@@ -152,7 +154,7 @@ static void initBeforeAfterDataBuf(SFillInfo* pFillInfo, char** next) {
*
next
=
taosMemoryCalloc
(
1
,
pFillInfo
->
rowSize
);
*
next
=
taosMemoryCalloc
(
1
,
pFillInfo
->
rowSize
);
for
(
int
i
=
1
;
i
<
pFillInfo
->
numOfCols
;
i
++
)
{
for
(
int
i
=
1
;
i
<
pFillInfo
->
numOfCols
;
i
++
)
{
SFillColInfo
*
pCol
=
&
pFillInfo
->
pFillCol
[
i
];
SFillColInfo
*
pCol
=
&
pFillInfo
->
pFillCol
[
i
];
setNull
(
*
next
+
pCol
->
col
.
offset
,
pCol
->
col
.
type
,
pCol
->
col
.
bytes
);
setNull
(
*
next
+
pCol
->
offset
,
pCol
->
col
.
type
,
pCol
->
col
.
bytes
);
}
}
}
}
...
@@ -160,7 +162,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, char** srcData, char* bu
...
@@ -160,7 +162,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, char** srcData, char* bu
int32_t
rowIndex
=
pFillInfo
->
index
;
int32_t
rowIndex
=
pFillInfo
->
index
;
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
SFillColInfo
*
pCol
=
&
pFillInfo
->
pFillCol
[
i
];
SFillColInfo
*
pCol
=
&
pFillInfo
->
pFillCol
[
i
];
memcpy
(
buf
+
pCol
->
col
.
offset
,
srcData
[
i
]
+
rowIndex
*
pCol
->
col
.
bytes
,
pCol
->
col
.
bytes
);
memcpy
(
buf
+
pCol
->
offset
,
srcData
[
i
]
+
rowIndex
*
pCol
->
col
.
bytes
,
pCol
->
col
.
bytes
);
}
}
}
}
...
@@ -227,21 +229,21 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR
...
@@ -227,21 +229,21 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR
if
(
i
==
0
||
(
pCol
->
functionId
!=
FUNCTION_COUNT
&&
!
isNull
(
src
,
pCol
->
col
.
type
))
||
if
(
i
==
0
||
(
pCol
->
functionId
!=
FUNCTION_COUNT
&&
!
isNull
(
src
,
pCol
->
col
.
type
))
||
(
pCol
->
functionId
==
FUNCTION_COUNT
&&
GET_INT64_VAL
(
src
)
!=
0
))
{
(
pCol
->
functionId
==
FUNCTION_COUNT
&&
GET_INT64_VAL
(
src
)
!=
0
))
{
assignVal
(
output
,
src
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
assignVal
(
output
,
src
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
memcpy
(
*
prev
+
pCol
->
col
.
offset
,
src
,
pCol
->
col
.
bytes
);
memcpy
(
*
prev
+
pCol
->
offset
,
src
,
pCol
->
col
.
bytes
);
}
else
{
// i > 0 and data is null , do interpolation
}
else
{
// i > 0 and data is null , do interpolation
if
(
pFillInfo
->
type
==
TSDB_FILL_PREV
)
{
if
(
pFillInfo
->
type
==
TSDB_FILL_PREV
)
{
assignVal
(
output
,
*
prev
+
pCol
->
col
.
offset
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
assignVal
(
output
,
*
prev
+
pCol
->
offset
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
}
else
if
(
pFillInfo
->
type
==
TSDB_FILL_LINEAR
)
{
}
else
if
(
pFillInfo
->
type
==
TSDB_FILL_LINEAR
)
{
assignVal
(
output
,
src
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
assignVal
(
output
,
src
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
memcpy
(
*
prev
+
pCol
->
col
.
offset
,
src
,
pCol
->
col
.
bytes
);
memcpy
(
*
prev
+
pCol
->
offset
,
src
,
pCol
->
col
.
bytes
);
}
else
if
(
pFillInfo
->
type
==
TSDB_FILL_NEXT
)
{
}
else
if
(
pFillInfo
->
type
==
TSDB_FILL_NEXT
)
{
if
(
*
next
)
{
if
(
*
next
)
{
assignVal
(
output
,
*
next
+
pCol
->
col
.
offset
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
assignVal
(
output
,
*
next
+
pCol
->
offset
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
}
else
{
}
else
{
setNull
(
output
,
pCol
->
col
.
type
,
pCol
->
col
.
bytes
);
setNull
(
output
,
pCol
->
col
.
type
,
pCol
->
col
.
bytes
);
}
}
}
else
{
}
else
{
assignVal
(
output
,
(
char
*
)
&
pCol
->
fillVal
.
i
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
assignVal
(
output
,
(
char
*
)
&
pCol
->
val
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
}
}
}
}
}
}
...
@@ -250,7 +252,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR
...
@@ -250,7 +252,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR
setTagsValue
(
pFillInfo
,
data
,
pFillInfo
->
numOfCurrent
);
setTagsValue
(
pFillInfo
,
data
,
pFillInfo
->
numOfCurrent
);
pFillInfo
->
currentKey
=
taosTimeAdd
(
pFillInfo
->
currentKey
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
currentKey
=
taosTimeAdd
(
pFillInfo
->
currentKey
,
pFillInfo
->
interval
.
sliding
*
step
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
interval
.
precision
);
pFillInfo
->
index
+=
1
;
pFillInfo
->
index
+=
1
;
pFillInfo
->
numOfCurrent
+=
1
;
pFillInfo
->
numOfCurrent
+=
1
;
}
}
...
@@ -301,7 +303,7 @@ static int32_t setTagColumnInfo(SFillInfo* pFillInfo, int32_t numOfCols, int32_t
...
@@ -301,7 +303,7 @@ static int32_t setTagColumnInfo(SFillInfo* pFillInfo, int32_t numOfCols, int32_t
bool
exists
=
false
;
bool
exists
=
false
;
int32_t
index
=
-
1
;
int32_t
index
=
-
1
;
for
(
int32_t
j
=
0
;
j
<
k
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
k
;
++
j
)
{
if
(
pFillInfo
->
pTags
[
j
].
col
.
colId
==
pColInfo
->
col
.
col
Id
)
{
if
(
pFillInfo
->
pTags
[
j
].
col
.
colId
==
pColInfo
->
col
.
slot
Id
)
{
exists
=
true
;
exists
=
true
;
index
=
j
;
index
=
j
;
break
;
break
;
...
@@ -310,7 +312,7 @@ static int32_t setTagColumnInfo(SFillInfo* pFillInfo, int32_t numOfCols, int32_t
...
@@ -310,7 +312,7 @@ static int32_t setTagColumnInfo(SFillInfo* pFillInfo, int32_t numOfCols, int32_t
if
(
!
exists
)
{
if
(
!
exists
)
{
SSchema
*
pSchema
=
&
pFillInfo
->
pTags
[
k
].
col
;
SSchema
*
pSchema
=
&
pFillInfo
->
pTags
[
k
].
col
;
pSchema
->
colId
=
pColInfo
->
col
.
col
Id
;
pSchema
->
colId
=
pColInfo
->
col
.
slot
Id
;
pSchema
->
type
=
pColInfo
->
col
.
type
;
pSchema
->
type
=
pColInfo
->
col
.
type
;
pSchema
->
bytes
=
pColInfo
->
col
.
bytes
;
pSchema
->
bytes
=
pColInfo
->
col
.
bytes
;
...
@@ -341,30 +343,40 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
...
@@ -341,30 +343,40 @@ static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
}
}
struct
SFillInfo
*
taosCreateFillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
struct
SFillInfo
*
taosCreateFillInfo
(
int32_t
order
,
TSKEY
skey
,
int32_t
numOfTags
,
int32_t
capacity
,
int32_t
numOfCols
,
int64_t
slidingTime
,
int8_t
slidingUnit
,
int8_t
precision
,
int32_t
fillType
,
SInterval
*
pInterval
,
int32_t
fillType
,
struct
SFillColInfo
*
pCol
,
const
char
*
id
)
{
struct
SFillColInfo
*
pCol
,
const
char
*
id
)
{
if
(
fillType
==
TSDB_FILL_NONE
)
{
if
(
fillType
==
TSDB_FILL_NONE
)
{
return
NULL
;
return
NULL
;
}
}
SFillInfo
*
pFillInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SFillInfo
));
SFillInfo
*
pFillInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SFillInfo
));
if
(
pFillInfo
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
}
taosResetFillInfo
(
pFillInfo
,
skey
);
taosResetFillInfo
(
pFillInfo
,
skey
);
pFillInfo
->
order
=
order
;
pFillInfo
->
order
=
order
;
switch
(
fillType
)
{
case
FILL_MODE_NONE
:
pFillInfo
->
type
=
TSDB_FILL_NONE
;
break
;
case
FILL_MODE_PREV
:
pFillInfo
->
type
=
TSDB_FILL_PREV
;
break
;
case
FILL_MODE_NULL
:
pFillInfo
->
type
=
TSDB_FILL_NULL
;
break
;
case
FILL_MODE_LINEAR
:
pFillInfo
->
type
=
TSDB_FILL_LINEAR
;
break
;
case
FILL_MODE_NEXT
:
pFillInfo
->
type
=
TSDB_FILL_NEXT
;
break
;
default:
terrno
=
TSDB_CODE_INVALID_PARA
;
return
NULL
;
}
pFillInfo
->
type
=
fillType
;
pFillInfo
->
type
=
fillType
;
pFillInfo
->
pFillCol
=
pCol
;
pFillInfo
->
pFillCol
=
pCol
;
pFillInfo
->
numOfTags
=
numOfTags
;
pFillInfo
->
numOfTags
=
numOfTags
;
pFillInfo
->
numOfCols
=
numOfCols
;
pFillInfo
->
numOfCols
=
numOfCols
;
pFillInfo
->
precision
=
precision
;
pFillInfo
->
alloc
=
capacity
;
pFillInfo
->
alloc
=
capacity
;
pFillInfo
->
id
=
id
;
pFillInfo
->
id
=
id
;
pFillInfo
->
interval
=
*
pInterval
;
pFillInfo
->
interval
.
interval
=
slidingTime
;
pFillInfo
->
pData
=
taosMemoryMalloc
(
POINTER_BYTES
*
numOfCols
);
pFillInfo
->
interval
.
intervalUnit
=
slidingUnit
;
pFillInfo
->
interval
.
sliding
=
slidingTime
;
pFillInfo
->
interval
.
slidingUnit
=
slidingUnit
;
pFillInfo
->
pData
=
taosMemoryMalloc
(
POINTER_BYTES
*
numOfCols
);
// if (numOfTags > 0) {
// if (numOfTags > 0) {
pFillInfo
->
pTags
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
SFillTagColInfo
));
pFillInfo
->
pTags
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
SFillTagColInfo
));
...
@@ -375,7 +387,6 @@ struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTag
...
@@ -375,7 +387,6 @@ struct SFillInfo* taosCreateFillInfo(int32_t order, TSKEY skey, int32_t numOfTag
pFillInfo
->
rowSize
=
setTagColumnInfo
(
pFillInfo
,
pFillInfo
->
numOfCols
,
pFillInfo
->
alloc
);
pFillInfo
->
rowSize
=
setTagColumnInfo
(
pFillInfo
,
pFillInfo
->
numOfCols
,
pFillInfo
->
alloc
);
assert
(
pFillInfo
->
rowSize
>
0
);
assert
(
pFillInfo
->
rowSize
>
0
);
return
pFillInfo
;
return
pFillInfo
;
}
}
...
@@ -417,7 +428,7 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
...
@@ -417,7 +428,7 @@ void taosFillSetStartInfo(SFillInfo* pFillInfo, int32_t numOfRows, TSKEY endKey)
pFillInfo
->
end
=
endKey
;
pFillInfo
->
end
=
endKey
;
if
(
!
FILL_IS_ASC_FILL
(
pFillInfo
))
{
if
(
!
FILL_IS_ASC_FILL
(
pFillInfo
))
{
pFillInfo
->
end
=
taosTimeTruncate
(
endKey
,
&
pFillInfo
->
interval
,
pFillInfo
->
precision
);
pFillInfo
->
end
=
taosTimeTruncate
(
endKey
,
&
pFillInfo
->
interval
,
pFillInfo
->
interval
.
precision
);
}
}
pFillInfo
->
index
=
0
;
pFillInfo
->
index
=
0
;
...
@@ -433,7 +444,7 @@ void taosFillSetInputDataBlock(SFillInfo* pFillInfo, const SSDataBlock* pInput)
...
@@ -433,7 +444,7 @@ void taosFillSetInputDataBlock(SFillInfo* pFillInfo, const SSDataBlock* pInput)
if
(
TSDB_COL_IS_TAG
(
pCol
->
flag
))
{
// copy the tag value to tag value buffer
if
(
TSDB_COL_IS_TAG
(
pCol
->
flag
))
{
// copy the tag value to tag value buffer
SFillTagColInfo
*
pTag
=
&
pFillInfo
->
pTags
[
pCol
->
tagIndex
];
SFillTagColInfo
*
pTag
=
&
pFillInfo
->
pTags
[
pCol
->
tagIndex
];
assert
(
pTag
->
col
.
colId
==
pCol
->
col
.
col
Id
);
assert
(
pTag
->
col
.
colId
==
pCol
->
col
.
slot
Id
);
memcpy
(
pTag
->
tagVal
,
pColData
->
pData
,
pCol
->
col
.
bytes
);
// TODO not memcpy??
memcpy
(
pTag
->
tagVal
,
pColData
->
pData
,
pCol
->
col
.
bytes
);
// TODO not memcpy??
}
}
}
}
...
@@ -460,7 +471,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
...
@@ -460,7 +471,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
TSKEY
ekey1
=
ekey
;
TSKEY
ekey1
=
ekey
;
if
(
!
FILL_IS_ASC_FILL
(
pFillInfo
))
{
if
(
!
FILL_IS_ASC_FILL
(
pFillInfo
))
{
pFillInfo
->
end
=
taosTimeTruncate
(
ekey
,
&
pFillInfo
->
interval
,
pFillInfo
->
precision
);
pFillInfo
->
end
=
taosTimeTruncate
(
ekey
,
&
pFillInfo
->
interval
,
pFillInfo
->
interval
.
precision
);
}
}
int64_t
numOfRes
=
-
1
;
int64_t
numOfRes
=
-
1
;
...
@@ -471,7 +482,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
...
@@ -471,7 +482,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
pFillInfo
->
currentKey
,
pFillInfo
->
currentKey
,
pFillInfo
->
interval
.
sliding
,
pFillInfo
->
interval
.
sliding
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
pFillInfo
->
interval
.
precision
);
numOfRes
+=
1
;
numOfRes
+=
1
;
assert
(
numOfRes
>=
numOfRows
);
assert
(
numOfRes
>=
numOfRows
);
}
else
{
// reach the end of data
}
else
{
// reach the end of data
...
@@ -484,7 +495,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
...
@@ -484,7 +495,7 @@ int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t ma
pFillInfo
->
currentKey
,
pFillInfo
->
currentKey
,
pFillInfo
->
interval
.
sliding
,
pFillInfo
->
interval
.
sliding
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
interval
.
slidingUnit
,
pFillInfo
->
precision
);
pFillInfo
->
interval
.
precision
);
numOfRes
+=
1
;
numOfRes
+=
1
;
}
}
...
@@ -527,7 +538,7 @@ int64_t getFillInfoStart(struct SFillInfo *pFillInfo) {
...
@@ -527,7 +538,7 @@ int64_t getFillInfoStart(struct SFillInfo *pFillInfo) {
return
pFillInfo
->
start
;
return
pFillInfo
->
start
;
}
}
struct
SFillColInfo
*
createFillColInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
const
int64_t
*
fillV
al
)
{
struct
SFillColInfo
*
createFillColInfo
(
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
const
struct
SValueNode
*
v
al
)
{
int32_t
offset
=
0
;
int32_t
offset
=
0
;
struct
SFillColInfo
*
pFillCol
=
taosMemoryCalloc
(
numOfOutput
,
sizeof
(
SFillColInfo
));
struct
SFillColInfo
*
pFillCol
=
taosMemoryCalloc
(
numOfOutput
,
sizeof
(
SFillColInfo
));
...
@@ -538,14 +549,15 @@ struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfOutput, co
...
@@ -538,14 +549,15 @@ struct SFillColInfo* createFillColInfo(SExprInfo* pExpr, int32_t numOfOutput, co
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SExprInfo
*
pExprInfo
=
&
pExpr
[
i
];
SExprInfo
*
pExprInfo
=
&
pExpr
[
i
];
pFillCol
[
i
].
col
.
bytes
=
pExprInfo
->
base
.
resSchema
.
bytes
;
pFillCol
[
i
].
col
=
pExprInfo
->
base
.
resSchema
;
pFillCol
[
i
].
col
.
type
=
(
int8_t
)
pExprInfo
->
base
.
resSchema
.
type
;
pFillCol
[
i
].
offset
=
offset
;
pFillCol
[
i
].
col
.
offset
=
offset
;
pFillCol
[
i
].
col
.
colId
=
pExprInfo
->
base
.
resSchema
.
slotId
;
pFillCol
[
i
].
tagIndex
=
-
2
;
pFillCol
[
i
].
tagIndex
=
-
2
;
pFillCol
[
i
].
flag
=
pExprInfo
->
base
.
pParam
[
0
].
pCol
->
flag
;
// always be the normal column for table query
if
(
pExprInfo
->
base
.
numOfParams
>
0
)
{
pFillCol
[
i
].
flag
=
pExprInfo
->
base
.
pParam
[
0
].
pCol
->
flag
;
// always be the normal column for table query
}
// pFillCol[i].functionId = pExprInfo->pExpr->_function.functionId;
// pFillCol[i].functionId = pExprInfo->pExpr->_function.functionId;
pFillCol
[
i
].
fillVal
.
i
=
fillVal
[
i
]
;
// pFillCol[i].val.d = *val
;
offset
+=
pExprInfo
->
base
.
resSchema
.
bytes
;
offset
+=
pExprInfo
->
base
.
resSchema
.
bytes
;
}
}
...
...
source/libs/function/src/taggfunction.c
浏览文件 @
e0d3ceb5
...
@@ -19,14 +19,14 @@
...
@@ -19,14 +19,14 @@
#include "thash.h"
#include "thash.h"
#include "ttypes.h"
#include "ttypes.h"
//#include "tfill.h"
#include "function.h"
#include "function.h"
#include "taggfunction.h"
#include "taggfunction.h"
#include "tfill.h"
#include "thistogram.h"
#include "ttszip.h"
#include "tpercentile.h"
#include "tbuffer.h"
#include "tbuffer.h"
#include "tcompression.h"
#include "tcompression.h"
#include "thistogram.h"
#include "tpercentile.h"
#include "ttszip.h"
//#include "queryLog.h"
//#include "queryLog.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "tudf.h"
#include "tudf.h"
...
@@ -3608,7 +3608,7 @@ static void interp_function_impl(SqlFunctionCtx *pCtx) {
...
@@ -3608,7 +3608,7 @@ static void interp_function_impl(SqlFunctionCtx *pCtx) {
if
(
isNull
((
char
*
)
&
pCtx
->
start
.
val
,
srcType
)
||
isNull
((
char
*
)
&
pCtx
->
end
.
val
,
srcType
))
{
if
(
isNull
((
char
*
)
&
pCtx
->
start
.
val
,
srcType
)
||
isNull
((
char
*
)
&
pCtx
->
end
.
val
,
srcType
))
{
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
}
else
{
}
else
{
taosGetLinearInterpolationVal
(
&
point
,
pCtx
->
resDataInfo
.
type
,
&
point1
,
&
point2
,
TSDB_DATA_TYPE_DOUBLE
);
//
taosGetLinearInterpolationVal(&point, pCtx->resDataInfo.type, &point1, &point2, TSDB_DATA_TYPE_DOUBLE);
}
}
}
else
{
}
else
{
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
...
@@ -3681,7 +3681,7 @@ static void interp_function_impl(SqlFunctionCtx *pCtx) {
...
@@ -3681,7 +3681,7 @@ static void interp_function_impl(SqlFunctionCtx *pCtx) {
if
(
isNull
(
start
,
srcType
)
||
isNull
(
end
,
srcType
))
{
if
(
isNull
(
start
,
srcType
)
||
isNull
(
end
,
srcType
))
{
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
}
else
{
}
else
{
taosGetLinearInterpolationVal
(
&
point
,
pCtx
->
resDataInfo
.
type
,
&
point1
,
&
point2
,
srcType
);
//
taosGetLinearInterpolationVal(&point, pCtx->resDataInfo.type, &point1, &point2, srcType);
}
}
}
else
{
}
else
{
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
setNull
(
pCtx
->
pOutput
,
srcType
,
pCtx
->
inputBytes
);
...
@@ -4034,8 +4034,8 @@ static void mergeTableBlockDist(SResultRowEntryInfo* pResInfo, const STableBlock
...
@@ -4034,8 +4034,8 @@ static void mergeTableBlockDist(SResultRowEntryInfo* pResInfo, const STableBlock
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
maxRows
=
pSrc
->
maxRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
pDist
->
minRows
=
pSrc
->
minRows
;
int32_t
maxSteps
=
TSDB_MAX_MAX
_ROW
_FBLOCK
/
TSDB_BLOCK_DIST_STEP_ROWS
;
int32_t
maxSteps
=
TSDB_MAX_MAX
ROWS
_FBLOCK
/
TSDB_BLOCK_DIST_STEP_ROWS
;
if
(
TSDB_MAX_MAX
_ROW
_FBLOCK
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
if
(
TSDB_MAX_MAX
ROWS
_FBLOCK
%
TSDB_BLOCK_DIST_STEP_ROWS
!=
0
)
{
++
maxSteps
;
++
maxSteps
;
}
}
pDist
->
dataBlockInfos
=
taosArrayInit
(
maxSteps
,
sizeof
(
SFileBlockInfo
));
pDist
->
dataBlockInfos
=
taosArrayInit
(
maxSteps
,
sizeof
(
SFileBlockInfo
));
...
...
source/libs/monitor/src/monMsg.c
浏览文件 @
e0d3ceb5
...
@@ -473,7 +473,7 @@ int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo)
...
@@ -473,7 +473,7 @@ int32_t tSerializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInfo)
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
pVloads
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
pVloads
);
++
i
)
{
SVnodeLoad
*
pLoad
=
taosArrayGet
(
pInfo
->
pVloads
,
i
);
SVnodeLoad
*
pLoad
=
taosArrayGet
(
pInfo
->
pVloads
,
i
);
if
(
tEncodeI32
(
&
encoder
,
pLoad
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pLoad
->
vgId
)
<
0
)
return
-
1
;
if
(
tEncodeI
8
(
&
encoder
,
pLoad
->
rol
e
)
<
0
)
return
-
1
;
if
(
tEncodeI
32
(
&
encoder
,
pLoad
->
syncStat
e
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pLoad
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pLoad
->
numOfTables
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pLoad
->
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pLoad
->
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pLoad
->
totalStorage
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pLoad
->
totalStorage
)
<
0
)
return
-
1
;
...
@@ -507,7 +507,7 @@ int32_t tDeserializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInf
...
@@ -507,7 +507,7 @@ int32_t tDeserializeSMonVloadInfo(void *buf, int32_t bufLen, SMonVloadInfo *pInf
for
(
int32_t
i
=
0
;
i
<
arraySize
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
arraySize
;
++
i
)
{
SVnodeLoad
load
=
{
0
};
SVnodeLoad
load
=
{
0
};
if
(
tDecodeI32
(
&
decoder
,
&
load
.
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
load
.
vgId
)
<
0
)
return
-
1
;
if
(
tDecodeI
8
(
&
decoder
,
&
load
.
rol
e
)
<
0
)
return
-
1
;
if
(
tDecodeI
32
(
&
decoder
,
&
load
.
syncStat
e
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
load
.
numOfTables
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
load
.
numOfTables
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
load
.
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
load
.
numOfTimeSeries
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
load
.
totalStorage
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
load
.
totalStorage
)
<
0
)
return
-
1
;
...
@@ -530,3 +530,30 @@ void tFreeSMonVloadInfo(SMonVloadInfo *pInfo) {
...
@@ -530,3 +530,30 @@ void tFreeSMonVloadInfo(SMonVloadInfo *pInfo) {
taosArrayDestroy
(
pInfo
->
pVloads
);
taosArrayDestroy
(
pInfo
->
pVloads
);
pInfo
->
pVloads
=
NULL
;
pInfo
->
pVloads
=
NULL
;
}
}
int32_t
tSerializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
)
{
SCoder
encoder
=
{
0
};
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_ENCODER
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pInfo
->
isMnode
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
load
.
syncState
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tCoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSMonMloadInfo
(
void
*
buf
,
int32_t
bufLen
,
SMonMloadInfo
*
pInfo
)
{
SCoder
decoder
=
{
0
};
tCoderInit
(
&
decoder
,
TD_LITTLE_ENDIAN
,
buf
,
bufLen
,
TD_DECODER
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pInfo
->
isMnode
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pInfo
->
load
.
syncState
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tCoderClear
(
&
decoder
);
return
0
;
}
\ No newline at end of file
source/libs/parser/src/parAstCreater.c
浏览文件 @
e0d3ceb5
...
@@ -677,9 +677,6 @@ SNode* setDatabaseAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOp
...
@@ -677,9 +677,6 @@ SNode* setDatabaseAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOp
case
DB_OPTION_PRECISION
:
case
DB_OPTION_PRECISION
:
((
SDatabaseOptions
*
)
pOptions
)
->
pPrecision
=
pAlterOption
->
pVal
;
((
SDatabaseOptions
*
)
pOptions
)
->
pPrecision
=
pAlterOption
->
pVal
;
break
;
break
;
case
DB_OPTION_QUORUM
:
((
SDatabaseOptions
*
)
pOptions
)
->
pQuorum
=
pAlterOption
->
pVal
;
break
;
case
DB_OPTION_REPLICA
:
case
DB_OPTION_REPLICA
:
((
SDatabaseOptions
*
)
pOptions
)
->
pReplica
=
pAlterOption
->
pVal
;
((
SDatabaseOptions
*
)
pOptions
)
->
pReplica
=
pAlterOption
->
pVal
;
break
;
break
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
e0d3ceb5
...
@@ -1403,22 +1403,22 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS
...
@@ -1403,22 +1403,22 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS
pReq
->
daysToKeep0
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
0
),
TSDB_DEFAULT_KEEP
);
pReq
->
daysToKeep0
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
0
),
TSDB_DEFAULT_KEEP
);
pReq
->
daysToKeep1
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
1
),
TSDB_DEFAULT_KEEP
);
pReq
->
daysToKeep1
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
1
),
TSDB_DEFAULT_KEEP
);
pReq
->
daysToKeep2
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
2
),
TSDB_DEFAULT_KEEP
);
pReq
->
daysToKeep2
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
2
),
TSDB_DEFAULT_KEEP
);
pReq
->
minRows
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pMinRowsPerBlock
,
TSDB_DEFAULT_MIN
_ROW
_FBLOCK
);
pReq
->
minRows
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pMinRowsPerBlock
,
TSDB_DEFAULT_MIN
ROWS
_FBLOCK
);
pReq
->
maxRows
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pMaxRowsPerBlock
,
TSDB_DEFAULT_MAX
_ROW
_FBLOCK
);
pReq
->
maxRows
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pMaxRowsPerBlock
,
TSDB_DEFAULT_MAX
ROWS
_FBLOCK
);
pReq
->
commitTime
=
-
1
;
pReq
->
commitTime
=
-
1
;
pReq
->
fsyncPeriod
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pFsyncPeriod
,
TSDB_DEFAULT_FSYNC_PERIOD
);
pReq
->
fsyncPeriod
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pFsyncPeriod
,
TSDB_DEFAULT_FSYNC_PERIOD
);
pReq
->
walLevel
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pWalLevel
,
TSDB_DEFAULT_WAL_LEVEL
);
pReq
->
walLevel
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pWalLevel
,
TSDB_DEFAULT_WAL_LEVEL
);
pReq
->
precision
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pPrecision
,
TSDB_TIME_PRECISION_MILLI
);
pReq
->
precision
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pPrecision
,
TSDB_TIME_PRECISION_MILLI
);
pReq
->
compression
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pCompressionLevel
,
TSDB_DEFAULT_COMP_LEVEL
);
pReq
->
compression
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pCompressionLevel
,
TSDB_DEFAULT_COMP_LEVEL
);
pReq
->
replications
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pReplica
,
TSDB_DEFAULT_DB_REPLICA_OPTION
);
pReq
->
replications
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pReplica
,
TSDB_DEFAULT_DB_REPLICA
);
pReq
->
quorum
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pQuorum
,
TSDB_DEFAULT_DB_QUORUM_OPTION
);
pReq
->
update
=
-
1
;
pReq
->
update
=
-
1
;
pReq
->
cacheLastRow
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pCachelast
,
TSDB_DEFAULT_CACHE_LAST_ROW
);
pReq
->
cacheLastRow
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pCachelast
,
TSDB_DEFAULT_CACHE_LAST_ROW
);
pReq
->
ignoreExist
=
pStmt
->
ignoreExists
;
pReq
->
ignoreExist
=
pStmt
->
ignoreExists
;
pReq
->
streamMode
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pStreamMode
,
TSDB_DEFAULT_DB_STREAM_MODE_OPTION
);
pReq
->
streamMode
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pStreamMode
,
TSDB_DEFAULT_DB_STREAM_MODE
);
pReq
->
ttl
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pTtl
,
TSDB_DEFAULT_DB_TTL_OPTION
);
pReq
->
ttl
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pTtl
,
TSDB_DEFAULT_DB_TTL
);
pReq
->
singleSTable
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pSingleStable
,
TSDB_DEFAULT_DB_SINGLE_STABLE_OPTION
);
pReq
->
singleSTable
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pSingleStable
,
TSDB_DEFAULT_DB_SINGLE_STABLE
);
// pReq->strict = GET_OPTION_VAL(pStmt->pOptions->pStrict, TSDB_DEFAULT_DB_SINGLE_STABLE_OPTION);
pReq
->
strict
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pStrict
,
TSDB_DEFAULT_DB_STRICT
);
return
buildCreateDbRetentions
(
pStmt
->
pOptions
->
pRetentions
,
pReq
);
return
buildCreateDbRetentions
(
pStmt
->
pOptions
->
pRetentions
,
pReq
);
}
}
...
@@ -1485,8 +1485,8 @@ static int32_t checkTtlOption(STranslateContext* pCxt, SValueNode* pVal) {
...
@@ -1485,8 +1485,8 @@ static int32_t checkTtlOption(STranslateContext* pCxt, SValueNode* pVal) {
return
pCxt
->
errCode
;
return
pCxt
->
errCode
;
}
}
int64_t
val
=
pVal
->
datum
.
i
;
int64_t
val
=
pVal
->
datum
.
i
;
if
(
val
<
TSDB_MIN_DB_TTL
_OPTION
)
{
if
(
val
<
TSDB_MIN_DB_TTL
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_TTL_OPTION
,
val
,
TSDB_MIN_DB_TTL
_OPTION
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_TTL_OPTION
,
val
,
TSDB_MIN_DB_TTL
);
}
}
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -1593,12 +1593,12 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, SDatabaseOptions* p
...
@@ -1593,12 +1593,12 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, SDatabaseOptions* p
code
=
checkRangeOption
(
pCxt
,
"fsyncPeriod"
,
pOptions
->
pFsyncPeriod
,
TSDB_MIN_FSYNC_PERIOD
,
TSDB_MAX_FSYNC_PERIOD
);
code
=
checkRangeOption
(
pCxt
,
"fsyncPeriod"
,
pOptions
->
pFsyncPeriod
,
TSDB_MIN_FSYNC_PERIOD
,
TSDB_MAX_FSYNC_PERIOD
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkRangeOption
(
pCxt
,
"maxRowsPerBlock"
,
pOptions
->
pMaxRowsPerBlock
,
TSDB_MIN_MAX
_ROW
_FBLOCK
,
code
=
checkRangeOption
(
pCxt
,
"maxRowsPerBlock"
,
pOptions
->
pMaxRowsPerBlock
,
TSDB_MIN_MAX
ROWS
_FBLOCK
,
TSDB_MAX_MAX
_ROW
_FBLOCK
);
TSDB_MAX_MAX
ROWS
_FBLOCK
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkRangeOption
(
pCxt
,
"minRowsPerBlock"
,
pOptions
->
pMinRowsPerBlock
,
TSDB_MIN_MIN
_ROW
_FBLOCK
,
code
=
checkRangeOption
(
pCxt
,
"minRowsPerBlock"
,
pOptions
->
pMinRowsPerBlock
,
TSDB_MIN_MIN
ROWS
_FBLOCK
,
TSDB_MAX_MIN
_ROW
_FBLOCK
);
TSDB_MAX_MIN
ROWS
_FBLOCK
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkKeepOption
(
pCxt
,
pOptions
->
pKeep
);
code
=
checkKeepOption
(
pCxt
,
pOptions
->
pKeep
);
...
@@ -1607,11 +1607,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, SDatabaseOptions* p
...
@@ -1607,11 +1607,7 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, SDatabaseOptions* p
code
=
checkDbPrecisionOption
(
pCxt
,
pOptions
->
pPrecision
);
code
=
checkDbPrecisionOption
(
pCxt
,
pOptions
->
pPrecision
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkRangeOption
(
pCxt
,
"quorum"
,
pOptions
->
pQuorum
,
TSDB_MIN_DB_QUORUM_OPTION
,
TSDB_MAX_DB_QUORUM_OPTION
);
code
=
checkDbEnumOption
(
pCxt
,
"replications"
,
pOptions
->
pReplica
,
TSDB_MIN_DB_REPLICA
,
TSDB_MAX_DB_REPLICA
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbEnumOption
(
pCxt
,
"replications"
,
pOptions
->
pReplica
,
TSDB_MIN_DB_REPLICA_OPTION
,
TSDB_MAX_DB_REPLICA_OPTION
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkTtlOption
(
pCxt
,
pOptions
->
pTtl
);
code
=
checkTtlOption
(
pCxt
,
pOptions
->
pTtl
);
...
@@ -1623,19 +1619,18 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, SDatabaseOptions* p
...
@@ -1623,19 +1619,18 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, SDatabaseOptions* p
code
=
checkRangeOption
(
pCxt
,
"vgroups"
,
pOptions
->
pNumOfVgroups
,
TSDB_MIN_VNODES_PER_DB
,
TSDB_MAX_VNODES_PER_DB
);
code
=
checkRangeOption
(
pCxt
,
"vgroups"
,
pOptions
->
pNumOfVgroups
,
TSDB_MIN_VNODES_PER_DB
,
TSDB_MAX_VNODES_PER_DB
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbEnumOption
(
pCxt
,
"singleStable"
,
pOptions
->
pSingleStable
,
TSDB_
MIN_DB_SINGLE_STABLE_OPTI
ON
,
code
=
checkDbEnumOption
(
pCxt
,
"singleStable"
,
pOptions
->
pSingleStable
,
TSDB_
DB_SINGLE_STABLE_
ON
,
TSDB_
MAX_DB_SINGLE_STABLE_OPTION
);
TSDB_
DB_SINGLE_STABLE_OFF
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbEnumOption
(
pCxt
,
"streamMode"
,
pOptions
->
pStreamMode
,
TSDB_DB_STREAM_MODE_OPTION_OFF
,
code
=
TSDB_DB_STREAM_MODE_OPTION
_ON
);
checkDbEnumOption
(
pCxt
,
"streamMode"
,
pOptions
->
pStreamMode
,
TSDB_DB_STREAM_MODE_OFF
,
TSDB_DB_STREAM_MODE
_ON
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbRetentionsOption
(
pCxt
,
pOptions
->
pRetentions
);
code
=
checkDbRetentionsOption
(
pCxt
,
pOptions
->
pRetentions
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
checkDbEnumOption
(
pCxt
,
"strict"
,
pOptions
->
pStrict
,
TSDB_DB_STRICT_OPTION_OFF
,
code
=
checkDbEnumOption
(
pCxt
,
"strict"
,
pOptions
->
pStrict
,
TSDB_DB_STRICT_OFF
,
TSDB_DB_STRICT_ON
);
TSDB_DB_STRICT_OPTION_ON
);
}
}
return
code
;
return
code
;
}
}
...
@@ -1698,7 +1693,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt,
...
@@ -1698,7 +1693,7 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt,
pReq
->
daysToKeep2
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
2
),
-
1
);
pReq
->
daysToKeep2
=
GET_OPTION_VAL
(
nodesListGetNode
(
pStmt
->
pOptions
->
pKeep
,
2
),
-
1
);
pReq
->
fsyncPeriod
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pFsyncPeriod
,
-
1
);
pReq
->
fsyncPeriod
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pFsyncPeriod
,
-
1
);
pReq
->
walLevel
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pWalLevel
,
-
1
);
pReq
->
walLevel
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pWalLevel
,
-
1
);
pReq
->
quorum
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pQuorum
,
-
1
);
pReq
->
strict
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pQuorum
,
-
1
);
pReq
->
cacheLastRow
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pCachelast
,
-
1
);
pReq
->
cacheLastRow
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pCachelast
,
-
1
);
pReq
->
replications
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pReplica
,
-
1
);
pReq
->
replications
=
GET_OPTION_VAL
(
pStmt
->
pOptions
->
pReplica
,
-
1
);
return
;
return
;
...
...
source/libs/sync/src/syncMain.c
浏览文件 @
e0d3ceb5
...
@@ -929,4 +929,17 @@ static void syncFreeNode(void* param) {
...
@@ -929,4 +929,17 @@ static void syncFreeNode(void* param) {
syncNodePrint2
((
char
*
)
"==syncFreeNode=="
,
pNode
);
syncNodePrint2
((
char
*
)
"==syncFreeNode=="
,
pNode
);
taosMemoryFree
(
pNode
);
taosMemoryFree
(
pNode
);
}
const
char
*
syncStr
(
ESyncState
state
)
{
switch
(
state
)
{
case
TAOS_SYNC_STATE_FOLLOWER
:
return
"FOLLOWER"
;
case
TAOS_SYNC_STATE_CANDIDATE
:
return
"CANDIDATE"
;
case
TAOS_SYNC_STATE_LEADER
:
return
"LEADER"
;
default:
return
"ERROR"
;
}
}
}
\ No newline at end of file
tests/script/basicSuite.sim
已删除
100644 → 0
浏览文件 @
a2e0d746
run general/cache/new_metrics.sim
run general/compute/interval.sim
run general/http/restful_full.sim
run general/import/commit.sim
run general/import/replica1.sim
run general/parser/auto_create_tb_drop_tb.sim
run general/parser/binary_escapeCharacter.sim
run general/parser/select_from_cache_disk.sim
run general/parser/null_char.sim
run general/parser/alter.sim
run general/stable/vnode3.sim
run general/tag/filter.sim
run general/table/vgroup.sim
run general/user/authority.sim
run general/vector/metrics_mix.sim
run general/vector/table_field.sim
run general/tag/set.sim
run general/table/delete_writing.sim
run general/stable/disk.sim
tests/script/bug.sim
已删除
100644 → 0
浏览文件 @
a2e0d746
run general/parser/projection_limit_offset.sim
run general/parser/limit2.sim
\ No newline at end of file
tests/script/fullGeneralSuite.sim
已删除
100644 → 0
浏览文件 @
a2e0d746
#unsupport run general/alter/cached_schema_after_alter.sim
run general/alter/count.sim
run general/alter/import.sim
#unsupport run general/alter/insert1.sim
run general/alter/insert2.sim
run general/alter/metrics.sim
run general/alter/table.sim
run general/cache/new_metrics.sim
run general/cache/restart_metrics.sim
run general/cache/restart_table.sim
run general/connection/connection.sim
run general/column/commit.sim
run general/column/metrics.sim
run general/column/table.sim
run general/compress/commitlog.sim
run general/compress/compress.sim
run general/compress/compress2.sim
run general/compress/uncompress.sim
run general/compute/avg.sim
run general/compute/bottom.sim
run general/compute/count.sim
run general/compute/diff.sim
run general/compute/diff2.sim
run general/compute/first.sim
run general/compute/interval.sim
run general/compute/last.sim
run general/compute/last_row.sim
run general/compute/leastsquare.sim
run general/compute/max.sim
run general/compute/min.sim
run general/compute/null.sim
run general/compute/percentile.sim
run general/compute/stddev.sim
run general/compute/sum.sim
run general/compute/top.sim
run general/compute/block_dist.sim
run general/db/alter_option.sim
run general/db/alter_tables_d2.sim
run general/db/alter_tables_v1.sim
run general/db/alter_tables_v4.sim
run general/db/alter_vgroups.sim
run general/db/basic.sim
run general/db/basic1.sim
run general/db/basic2.sim
run general/db/basic3.sim
run general/db/basic4.sim
run general/db/basic5.sim
run general/db/delete_reuse1.sim
run general/db/delete_reuse2.sim
run general/db/delete_reusevnode.sim
run general/db/delete_reusevnode2.sim
run general/db/delete_writing1.sim
run general/db/delete_writing2.sim
run general/db/delete.sim
run general/db/len.sim
run general/db/repeat.sim
run general/db/tables.sim
run general/db/vnodes.sim
run general/field/2.sim
run general/field/3.sim
run general/field/4.sim
run general/field/5.sim
run general/field/6.sim
run general/field/bigint.sim
run general/field/binary.sim
run general/field/bool.sim
run general/field/single.sim
run general/field/smallint.sim
run general/field/tinyint.sim
run general/http/restful.sim
run general/http/restful_insert.sim
run general/http/restful_limit.sim
run general/http/restful_full.sim
run general/http/prepare.sim
run general/http/telegraf.sim
run general/http/grafana_bug.sim
run general/http/grafana.sim
run general/import/basic.sim
run general/import/commit.sim
run general/import/large.sim
run general/import/replica1.sim
run general/insert/basic.sim
run general/insert/insert_drop.sim
run general/insert/query_block1_memory.sim
run general/insert/query_block2_memory.sim
run general/insert/query_block1_file.sim
run general/insert/query_block2_file.sim
run general/insert/query_file_memory.sim
run general/insert/query_multi_file.sim
run general/insert/tcp.sim
#unsupport run general/parser/alter.sim
run general/parser/alter1.sim
run general/parser/alter_stable.sim
run general/parser/auto_create_tb.sim
run general/parser/auto_create_tb_drop_tb.sim
run general/parser/col_arithmetic_operation.sim
run general/parser/columnValue.sim
run general/parser/commit.sim
run general/parser/create_db.sim
run general/parser/create_mt.sim
run general/parser/create_tb.sim
run general/parser/dbtbnameValidate.sim
run general/parser/import_commit1.sim
run general/parser/import_commit2.sim
run general/parser/import_commit3.sim
run general/parser/insert_tb.sim
run general/parser/first_last.sim
run general/parser/line_insert.sim
#unsupport run general/parser/import_file.sim
run general/parser/lastrow.sim
run general/parser/nchar.sim
#unsupport run general/parser/null_char.sim
run general/parser/single_row_in_tb.sim
run general/parser/select_from_cache_disk.sim
run general/parser/limit.sim
run general/parser/limit1.sim
run general/parser/limit1_tblocks100.sim
run general/parser/mixed_blocks.sim
run general/parser/selectResNum.sim
run general/parser/select_across_vnodes.sim
run general/parser/slimit1.sim
run general/parser/tbnameIn.sim
run general/parser/binary_escapeCharacter.sim
run general/parser/projection_limit_offset.sim
run general/parser/limit2.sim
run general/parser/slimit.sim
run general/parser/fill.sim
run general/parser/fill_stb.sim
run general/parser/interp.sim
run general/parser/where.sim
run general/parser/join.sim
run general/parser/join_multivnode.sim
run general/parser/select_with_tags.sim
run general/parser/groupby.sim
run general/parser/top_groupby.sim
run general/parser/tags_dynamically_specifiy.sim
run general/parser/set_tag_vals.sim
#unsupport run general/parser/repeatAlter.sim
#unsupport run general/parser/slimit_alter_tags.sim
run general/parser/precision_ns.sim
run general/stable/disk.sim
run general/stable/dnode3.sim
run general/stable/metrics.sim
run general/stable/values.sim
run general/stable/vnode3.sim
run general/table/autocreate.sim
run general/table/basic1.sim
run general/table/basic2.sim
run general/table/basic3.sim
run general/table/bigint.sim
run general/table/binary.sim
run general/table/bool.sim
run general/table/column_name.sim
run general/table/column_num.sim
run general/table/column_value.sim
run general/table/column2.sim
run general/table/date.sim
run general/table/db.table.sim
run general/table/delete_reuse1.sim
run general/table/delete_reuse2.sim
run general/table/delete_writing.sim
run general/table/describe.sim
run general/table/double.sim
run general/table/fill.sim
run general/table/float.sim
run general/table/int.sim
run general/table/limit.sim
run general/table/smallint.sim
run general/table/table_len.sim
run general/table/table.sim
run general/table/tinyint.sim
run general/table/vgroup.sim
run general/tag/3.sim
run general/tag/4.sim
run general/tag/5.sim
run general/tag/6.sim
run general/tag/add.sim
run general/tag/bigint.sim
run general/tag/binary_binary.sim
run general/tag/binary.sim
run general/tag/bool_binary.sim
run general/tag/bool_int.sim
run general/tag/bool.sim
run general/tag/change.sim
run general/tag/column.sim
#unsupport run general/tag/commit.sim
run general/tag/create.sim
run general/tag/delete.sim
run general/tag/double.sim
run general/tag/filter.sim
run general/tag/float.sim
run general/tag/int_binary.sim
run general/tag/int_float.sim
run general/tag/int.sim
run general/tag/set.sim
run general/tag/smallint.sim
run general/tag/tinyint.sim
run general/user/authority.sim
run general/user/monitor.sim
run general/user/pass_alter.sim
run general/user/pass_len.sim
run general/user/user_create.sim
run general/user/user_len.sim
run general/vector/metrics_field.sim
run general/vector/metrics_mix.sim
run general/vector/metrics_query.sim
run general/vector/metrics_tag.sim
run general/vector/metrics_time.sim
run general/vector/multi.sim
run general/vector/single.sim
run general/vector/table_field.sim
run general/vector/table_mix.sim
run general/vector/table_query.sim
run general/vector/table_time.sim
run general/stream/restart_stream.sim
run general/stream/stream_3.sim
run general/stream/stream_restart.sim
run general/stream/table_del.sim
run general/stream/metrics_del.sim
run general/stream/table_replica1_vnoden.sim
run general/stream/metrics_replica1_vnoden.sim
run general/db/show_create_db.sim
run general/db/show_create_table.sim
run general/parser/like.sim
run general/parser/regex.sim
tests/script/regressionSuite.sim
已删除
100644 → 0
浏览文件 @
a2e0d746
##unsupport run general/alter/cached_schema_after_alter.sim
run general/alter/count.sim
run general/alter/import.sim
##unsupport run general/alter/insert1.sim
run general/alter/insert2.sim
run general/alter/metrics.sim
run general/alter/table.sim
run general/cache/new_metrics.sim
run general/cache/restart_metrics.sim
run general/cache/restart_table.sim
run general/connection/connection.sim
run general/column/commit.sim
run general/column/metrics.sim
run general/column/table.sim
run general/compress/commitlog.sim
run general/compress/compress.sim
run general/compress/compress2.sim
run general/compress/uncompress.sim
run general/compute/avg.sim
run general/compute/bottom.sim
run general/compute/count.sim
run general/compute/diff.sim
run general/compute/diff2.sim
run general/compute/first.sim
run general/compute/interval.sim
run general/compute/last.sim
run general/compute/leastsquare.sim
run general/compute/max.sim
run general/compute/min.sim
run general/compute/null.sim
run general/compute/percentile.sim
run general/compute/stddev.sim
run general/compute/sum.sim
run general/compute/top.sim
run general/compute/block_dist.sim
run general/db/alter_option.sim
run general/db/alter_tables_d2.sim
run general/db/alter_tables_v1.sim
run general/db/alter_tables_v4.sim
run general/db/alter_vgroups.sim
run general/db/basic.sim
run general/db/basic1.sim
run general/db/basic2.sim
run general/db/basic3.sim
run general/db/basic4.sim
run general/db/basic5.sim
run general/db/delete_reuse1.sim
run general/db/delete_reuse2.sim
run general/db/delete_reusevnode.sim
run general/db/delete_reusevnode2.sim
run general/db/delete_writing1.sim
run general/db/delete_writing2.sim
run general/db/delete.sim
run general/db/len.sim
run general/db/repeat.sim
run general/db/tables.sim
run general/db/vnodes.sim
run general/field/2.sim
run general/field/3.sim
run general/field/4.sim
run general/field/5.sim
run general/field/6.sim
run general/field/bigint.sim
run general/field/binary.sim
run general/field/bool.sim
run general/field/single.sim
run general/field/smallint.sim
run general/field/tinyint.sim
run general/http/restful.sim
run general/http/restful_insert.sim
run general/http/restful_limit.sim
run general/http/restful_full.sim
run general/http/prepare.sim
run general/http/telegraf.sim
run general/http/grafana_bug.sim
run general/http/grafana.sim
run general/import/basic.sim
run general/import/commit.sim
run general/import/large.sim
run general/import/replica1.sim
run general/insert/basic.sim
run general/insert/insert_drop.sim
run general/insert/query_block1_memory.sim
run general/insert/query_block2_memory.sim
run general/insert/query_block1_file.sim
run general/insert/query_block2_file.sim
run general/insert/query_file_memory.sim
run general/insert/query_multi_file.sim
run general/insert/tcp.sim
run general/parser/alter.sim
run general/parser/alter1.sim
run general/parser/alter_stable.sim
run general/parser/auto_create_tb.sim
run general/parser/auto_create_tb_drop_tb.sim
run general/parser/col_arithmetic_operation.sim
run general/parser/columnValue.sim
run general/parser/commit.sim
run general/parser/create_db.sim
run general/parser/create_mt.sim
run general/parser/create_tb.sim
run general/parser/dbtbnameValidate.sim
run general/parser/import_commit1.sim
run general/parser/import_commit2.sim
run general/parser/import_commit3.sim
run general/parser/insert_tb.sim
run general/parser/first_last.sim
##unsupport run general/parser/import_file.sim
run general/parser/lastrow.sim
run general/parser/nchar.sim
run general/parser/null_char.sim
run general/parser/single_row_in_tb.sim
run general/parser/select_from_cache_disk.sim
run general/parser/limit.sim
run general/parser/limit1.sim
run general/parser/limit1_tblocks100.sim
run general/parser/mixed_blocks.sim
run general/parser/selectResNum.sim
run general/parser/select_across_vnodes.sim
run general/parser/slimit1.sim
run general/parser/tbnameIn.sim
run general/parser/binary_escapeCharacter.sim
run general/parser/projection_limit_offset.sim
run general/parser/limit2.sim
run general/parser/slimit.sim
run general/parser/fill.sim
run general/parser/fill_stb.sim
run general/parser/interp.sim
run general/parser/where.sim
run general/parser/join.sim
run general/parser/join_multivnode.sim
run general/parser/select_with_tags.sim
run general/parser/groupby.sim
run general/parser/bug.sim
run general/parser/tags_dynamically_specifiy.sim
run general/parser/set_tag_vals.sim
run general/parser/repeatAlter.sim
run general/parser/precision_ns.sim
##unsupport run general/parser/slimit_alter_tags.sim
run general/stable/disk.sim
run general/stable/dnode3.sim
run general/stable/metrics.sim
run general/stable/values.sim
run general/stable/vnode3.sim
run general/stable/refcount.sim
run general/stable/show.sim
run general/table/autocreate.sim
run general/table/basic1.sim
run general/table/basic2.sim
run general/table/basic3.sim
run general/table/bigint.sim
run general/table/binary.sim
run general/table/bool.sim
run general/table/column_name.sim
run general/table/column_num.sim
run general/table/column_value.sim
run general/table/column2.sim
run general/table/date.sim
run general/table/db.table.sim
run general/table/delete_reuse1.sim
run general/table/delete_reuse2.sim
run general/table/delete_writing.sim
run general/table/describe.sim
run general/table/double.sim
run general/table/fill.sim
run general/table/float.sim
run general/table/int.sim
run general/table/limit.sim
run general/table/smallint.sim
run general/table/table_len.sim
run general/table/table.sim
run general/table/tinyint.sim
run general/table/vgroup.sim
run general/tag/3.sim
run general/tag/4.sim
run general/tag/5.sim
run general/tag/6.sim
run general/tag/add.sim
run general/tag/bigint.sim
run general/tag/binary_binary.sim
run general/tag/binary.sim
run general/tag/bool_binary.sim
run general/tag/bool_int.sim
run general/tag/bool.sim
run general/tag/change.sim
run general/tag/column.sim
##unsupport run general/tag/commit.sim
run general/tag/create.sim
run general/tag/delete.sim
run general/tag/double.sim
run general/tag/filter.sim
run general/tag/float.sim
run general/tag/int_binary.sim
run general/tag/int_float.sim
run general/tag/int.sim
run general/tag/set.sim
run general/tag/smallint.sim
run general/tag/tinyint.sim
run general/user/authority.sim
run general/user/monitor.sim
run general/user/pass_alter.sim
run general/user/pass_len.sim
run general/user/user_create.sim
run general/user/user_len.sim
run general/vector/metrics_field.sim
run general/vector/metrics_mix.sim
run general/vector/metrics_query.sim
run general/vector/metrics_tag.sim
run general/vector/metrics_time.sim
run general/vector/multi.sim
run general/vector/single.sim
run general/vector/table_field.sim
run general/vector/table_mix.sim
run general/vector/table_query.sim
run general/vector/table_time.sim
run general/stream/restart_stream.sim
run general/stream/stream_3.sim
run general/stream/stream_restart.sim
run general/stream/table_del.sim
run general/stream/metrics_del.sim
run general/stream/table_replica1_vnoden.sim
run general/stream/metrics_replica1_vnoden.sim
tests/script/tsim/db/alter_option.sim
浏览文件 @
e0d3ceb5
...
@@ -66,7 +66,7 @@ print ============= create database
...
@@ -66,7 +66,7 @@ print ============= create database
# | REPLICA value [1 | 3]
# | REPLICA value [1 | 3]
# | WAL value [1 | 2]
# | WAL value [1 | 2]
sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 345600 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1440000 PRECISION 'ns'
QUORUM 1
REPLICA 3 TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1
sql create database db BLOCKS 7 CACHE 3 CACHELAST 3 COMP 0 DAYS 345600 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1440000 PRECISION 'ns' REPLICA 3 TTL 7 WAL 2 VGROUPS 6 SINGLE_STABLE 1 STREAM_MODE 1
sql show databases
sql show databases
print rows: $rows
print rows: $rows
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
...
@@ -89,7 +89,7 @@ endi
...
@@ -89,7 +89,7 @@ endi
if $data4_db != 3 then # replica
if $data4_db != 3 then # replica
return -1
return -1
endi
endi
if $data5_db !=
1 then # quorum
if $data5_db !=
nostrict then # strict
return -1
return -1
endi
endi
if $data6_db != 345600 then # days
if $data6_db != 345600 then # days
...
@@ -156,25 +156,25 @@ sql_error alter database db replica 0
...
@@ -156,25 +156,25 @@ sql_error alter database db replica 0
# return -1
# return -1
#endi
#endi
print ============== modify quorum
#
print ============== modify quorum
sql alter database db quorum 2
#
sql alter database db quorum 2
sql show databases
#
sql show databases
print quorum $data5_db
#
print quorum $data5_db
if $data5_db != 2 then
#
if $data5_db != 2 then
return -1
#
return -1
endi
#
endi
sql alter database db quorum 1
#
sql alter database db quorum 1
sql show databases
#
sql show databases
print quorum $data5_db
#
print quorum $data5_db
if $data5_db != 1 then
#
if $data5_db != 1 then
return -1
#
return -1
endi
#
endi
sql_error alter database db quorum -1
#
sql_error alter database db quorum -1
sql_error alter database db quorum 0
#
sql_error alter database db quorum 0
sql_error alter database db quorum 3
#
sql_error alter database db quorum 3
sql_error alter database db quorum 4
#
sql_error alter database db quorum 4
sql_error alter database db quorum 5
#
sql_error alter database db quorum 5
#print ============== modify days
#print ============== modify days
sql_error alter database db days 480
sql_error alter database db days 480
...
...
tests/script/tsim/db/create_all_options.sim
浏览文件 @
e0d3ceb5
...
@@ -115,7 +115,7 @@ if $data4_db != 1 then # replica
...
@@ -115,7 +115,7 @@ if $data4_db != 1 then # replica
print expect 1, actual: $data4_db
print expect 1, actual: $data4_db
return -1
return -1
endi
endi
if $data5_db !=
1 then # quorum
if $data5_db !=
nostrict then # strict
return -1
return -1
endi
endi
if $data6_db != 14400 then # days
if $data6_db != 14400 then # days
...
@@ -355,16 +355,16 @@ print ====> QUORUM value [1 | 2, default: 1]
...
@@ -355,16 +355,16 @@ print ====> QUORUM value [1 | 2, default: 1]
#endi
#endi
#sql drop database db
#sql drop database db
sql create database db QUORUM 1
#
sql create database db QUORUM 1
sql show databases
#
sql show databases
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
#
print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db
if $data5_db != 1 then
#
if $data5_db != 1 then
return -1
#
return -1
endi
#
endi
sql drop database db
#
sql drop database db
sql_error create database db QUORUM 3
#
sql_error create database db QUORUM 3
sql_error create database db QUORUM 0
#
sql_error create database db QUORUM 0
sql_error create database db QUORUM -1
#
sql_error create database db QUORUM -1
print ====> REPLICA value [1 | 3, default: 1]
print ====> REPLICA value [1 | 3, default: 1]
sql create database db REPLICA 3
sql create database db REPLICA 3
...
...
tests/script/tsim/query/explain.sim
浏览文件 @
e0d3ceb5
...
@@ -45,7 +45,7 @@ sql explain select * from information_schema.user_stables;
...
@@ -45,7 +45,7 @@ sql explain select * from information_schema.user_stables;
sql explain select count(*),sum(f1) from tb1;
sql explain select count(*),sum(f1) from tb1;
sql explain select count(*),sum(f1) from st1;
sql explain select count(*),sum(f1) from st1;
sql explain select count(*),sum(f1) from st1 group by f1;
sql explain select count(*),sum(f1) from st1 group by f1;
sql explain select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
#
sql explain select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
sql explain select min(f1) from st1 interval(1m, 2a) sliding(30s);
sql explain select min(f1) from st1 interval(1m, 2a) sliding(30s);
print ======== step3
print ======== step3
...
@@ -65,7 +65,7 @@ sql explain analyze select * from information_schema.user_stables;
...
@@ -65,7 +65,7 @@ sql explain analyze select * from information_schema.user_stables;
sql explain analyze select count(*),sum(f1) from tb1;
sql explain analyze select count(*),sum(f1) from tb1;
sql explain analyze select count(*),sum(f1) from st1;
sql explain analyze select count(*),sum(f1) from st1;
sql explain analyze select count(*),sum(f1) from st1 group by f1;
sql explain analyze select count(*),sum(f1) from st1 group by f1;
sql explain analyze select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
#
sql explain analyze select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
sql explain analyze select min(f1) from st1 interval(3m, 2a) sliding(1m);
sql explain analyze select min(f1) from st1 interval(3m, 2a) sliding(1m);
print ======== step5
print ======== step5
...
@@ -78,7 +78,7 @@ sql explain analyze verbose true select * from information_schema.user_stables;
...
@@ -78,7 +78,7 @@ sql explain analyze verbose true select * from information_schema.user_stables;
sql explain analyze verbose true select count(*),sum(f1) from tb1;
sql explain analyze verbose true select count(*),sum(f1) from tb1;
sql explain analyze verbose true select count(*),sum(f1) from st1;
sql explain analyze verbose true select count(*),sum(f1) from st1;
sql explain analyze verbose true select count(*),sum(f1) from st1 group by f1;
sql explain analyze verbose true select count(*),sum(f1) from st1 group by f1;
sql explain analyze verbose true select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
#
sql explain analyze verbose true select count(f1) from tb1 interval(10s, 2s) sliding(3s) fill(prev);
sql explain analyze verbose true select ts from tb1 where f1 > 0;
sql explain analyze verbose true select ts from tb1 where f1 > 0;
sql explain analyze verbose true select f1 from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00';
sql explain analyze verbose true select f1 from st1 where f1 > 0 and ts > '2020-10-31 00:00:00' and ts < '2021-10-31 00:00:00';
sql explain analyze verbose true select * from information_schema.user_stables where db_name='db2';
sql explain analyze verbose true select * from information_schema.user_stables where db_name='db2';
...
...
tests/script/tsim/sync/oneReplica1VgElect.sim
浏览文件 @
e0d3ceb5
...
@@ -203,7 +203,6 @@ if $data[0][4] == LEADER then
...
@@ -203,7 +203,6 @@ if $data[0][4] == LEADER then
$dnodeId = $data[0][3]
$dnodeId = $data[0][3]
elif $data[0][6] == LEADER then
elif $data[0][6] == LEADER then
$dnodeId = $data[0][5]
$dnodeId = $data[0][5]
endi
elif $data[0][8] == LEADER then
elif $data[0][8] == LEADER then
$dnodeId = $data[0][7]
$dnodeId = $data[0][7]
else
else
...
...
tests/script/tsim/sync/oneReplica1VgElectWithInsert.sim
浏览文件 @
e0d3ceb5
...
@@ -212,7 +212,6 @@ if $data[0][4] == LEADER then
...
@@ -212,7 +212,6 @@ if $data[0][4] == LEADER then
$dnodeId = $data[0][3]
$dnodeId = $data[0][3]
elif $data[0][6] == LEADER then
elif $data[0][6] == LEADER then
$dnodeId = $data[0][5]
$dnodeId = $data[0][5]
endi
elif $data[0][8] == LEADER then
elif $data[0][8] == LEADER then
$dnodeId = $data[0][7]
$dnodeId = $data[0][7]
else
else
...
...
tests/script/tsim/sync/threeReplica1VgElect.sim
浏览文件 @
e0d3ceb5
...
@@ -203,7 +203,6 @@ if $data[0][4] == LEADER then
...
@@ -203,7 +203,6 @@ if $data[0][4] == LEADER then
$dnodeId = $data[0][3]
$dnodeId = $data[0][3]
elif $data[0][6] == LEADER then
elif $data[0][6] == LEADER then
$dnodeId = $data[0][5]
$dnodeId = $data[0][5]
endi
elif $data[0][8] == LEADER then
elif $data[0][8] == LEADER then
$dnodeId = $data[0][7]
$dnodeId = $data[0][7]
else
else
...
...
tests/script/tsim/sync/threeReplica1VgElectWihtInsert.sim
浏览文件 @
e0d3ceb5
...
@@ -212,7 +212,6 @@ if $data[0][4] == LEADER then
...
@@ -212,7 +212,6 @@ if $data[0][4] == LEADER then
$dnodeId = $data[0][3]
$dnodeId = $data[0][3]
elif $data[0][6] == LEADER then
elif $data[0][6] == LEADER then
$dnodeId = $data[0][5]
$dnodeId = $data[0][5]
endi
elif $data[0][8] == LEADER then
elif $data[0][8] == LEADER then
$dnodeId = $data[0][7]
$dnodeId = $data[0][7]
else
else
...
...
tests/script/tsim/testCaseSuite.sim
已删除
100644 → 0
浏览文件 @
a2e0d746
run tsim/user/basic1.sim
run tsim/db/alter_option.sim
run tsim/db/basic1.sim
run tsim/db/basic2.sim
run tsim/db/basic3.sim
run tsim/db/basic6.sim
run tsim/db/basic7.sim
run tsim/db/error1.sim
run tsim/dnode/basic1.sim
run tsim/insert/basic0.sim
run tsim/insert/basic1.sim
run tsim/insert/backquote.sim
run tsim/insert/null.sim
#run tsim/parser/groupby-basic.sim
#run tsim/parser/fourArithmetic-basic.sim
run tsim/query/interval.sim
run tsim/query/interval-offset.sim
#run tsim/query/scalarFunction.sim
run tsim/show/basic.sim
run tsim/table/basic1.sim
run tsim/tmq/basic.sim
run tsim/tmq/basic1.sim
tools/shell/inc/shell.h
浏览文件 @
e0d3ceb5
...
@@ -50,6 +50,8 @@ typedef struct SShellArguments {
...
@@ -50,6 +50,8 @@ typedef struct SShellArguments {
char
dir
[
TSDB_FILENAME_LEN
];
char
dir
[
TSDB_FILENAME_LEN
];
int
threadNum
;
int
threadNum
;
int
check
;
int
check
;
bool
status
;
bool
verbose
;
char
*
commands
;
char
*
commands
;
int
abort
;
int
abort
;
int
port
;
int
port
;
...
@@ -72,7 +74,6 @@ void read_history();
...
@@ -72,7 +74,6 @@ void read_history();
void
write_history
();
void
write_history
();
void
source_file
(
TAOS
*
con
,
char
*
fptr
);
void
source_file
(
TAOS
*
con
,
char
*
fptr
);
void
source_dir
(
TAOS
*
con
,
SShellArguments
*
args
);
void
source_dir
(
TAOS
*
con
,
SShellArguments
*
args
);
void
shellCheck
(
TAOS
*
con
,
SShellArguments
*
args
);
void
get_history_path
(
char
*
history
);
void
get_history_path
(
char
*
history
);
void
shellCheck
(
TAOS
*
con
,
SShellArguments
*
args
);
void
shellCheck
(
TAOS
*
con
,
SShellArguments
*
args
);
void
cleanup_handler
(
void
*
arg
);
void
cleanup_handler
(
void
*
arg
);
...
...
tools/shell/src/shellMain.c
浏览文件 @
e0d3ceb5
...
@@ -35,6 +35,7 @@ static char args_doc[] = "";
...
@@ -35,6 +35,7 @@ static char args_doc[] = "";
TdThread
pid
;
TdThread
pid
;
static
tsem_t
cancelSem
;
static
tsem_t
cancelSem
;
extern
void
taos_init
();
static
struct
argp_option
options
[]
=
{
static
struct
argp_option
options
[]
=
{
{
"host"
,
'h'
,
"HOST"
,
0
,
"TDengine server FQDN to connect. The default host is localhost."
},
{
"host"
,
'h'
,
"HOST"
,
0
,
"TDengine server FQDN to connect. The default host is localhost."
},
...
@@ -52,6 +53,8 @@ static struct argp_option options[] = {
...
@@ -52,6 +53,8 @@ static struct argp_option options[] = {
{
"check"
,
'k'
,
"CHECK"
,
0
,
"Check tables."
},
{
"check"
,
'k'
,
"CHECK"
,
0
,
"Check tables."
},
{
"database"
,
'd'
,
"DATABASE"
,
0
,
"Database to use when connecting to the server."
},
{
"database"
,
'd'
,
"DATABASE"
,
0
,
"Database to use when connecting to the server."
},
{
"timezone"
,
'z'
,
"TIMEZONE"
,
0
,
"Time zone of the shell, default is local."
},
{
"timezone"
,
'z'
,
"TIMEZONE"
,
0
,
"Time zone of the shell, default is local."
},
{
"status"
,
't'
,
NULL
,
0
,
"Check the service status."
},
{
"verbose"
,
'v'
,
NULL
,
0
,
"Check the details of the service status."
},
{
"netrole"
,
'n'
,
"NETROLE"
,
0
,
"Net role when network connectivity test, default is startup, options: client|server|rpc|startup|sync|speed|fqdn."
},
{
"netrole"
,
'n'
,
"NETROLE"
,
0
,
"Net role when network connectivity test, default is startup, options: client|server|rpc|startup|sync|speed|fqdn."
},
{
"pktlen"
,
'l'
,
"PKTLEN"
,
0
,
"Packet length used for net test, default is 1000 bytes."
},
{
"pktlen"
,
'l'
,
"PKTLEN"
,
0
,
"Packet length used for net test, default is 1000 bytes."
},
{
"pktnum"
,
'N'
,
"PKTNUM"
,
0
,
"Packet numbers used for net test, default is 100."
},
{
"pktnum"
,
'N'
,
"PKTNUM"
,
0
,
"Packet numbers used for net test, default is 100."
},
...
@@ -138,6 +141,12 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
...
@@ -138,6 +141,12 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case
'k'
:
case
'k'
:
arguments
->
check
=
atoi
(
arg
);
arguments
->
check
=
atoi
(
arg
);
break
;
break
;
case
't'
:
arguments
->
status
=
true
;
break
;
case
'v'
:
arguments
->
verbose
=
true
;
break
;
case
'd'
:
case
'd'
:
arguments
->
database
=
arg
;
arguments
->
database
=
arg
;
break
;
break
;
...
@@ -522,10 +531,10 @@ void showOnScreen(Command *cmd) {
...
@@ -522,10 +531,10 @@ void showOnScreen(Command *cmd) {
void
cleanup_handler
(
void
*
arg
)
{
resetTerminalMode
();
}
void
cleanup_handler
(
void
*
arg
)
{
resetTerminalMode
();
}
void
exitShell
()
{
void
exitShell
()
{
/*int32_t ret =*/
resetTerminalMode
();
taos_cleanup
();
taos_cleanup
();
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
void
shellQueryInterruptHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
)
{
tsem_post
(
&
cancelSem
);
}
void
shellQueryInterruptHandler
(
int32_t
signum
,
void
*
sigInfo
,
void
*
context
)
{
tsem_post
(
&
cancelSem
);
}
void
*
cancelHandler
(
void
*
arg
)
{
void
*
cancelHandler
(
void
*
arg
)
{
...
@@ -537,21 +546,9 @@ void *cancelHandler(void *arg) {
...
@@ -537,21 +546,9 @@ void *cancelHandler(void *arg) {
continue
;
continue
;
}
}
#ifdef LINUX
#if 0
int64_t rid = atomic_val_compare_exchange_64(&result, result, 0);
SSqlObj* pSql = taosAcquireRef(tscObjRef, rid);
taos_stop_query(pSql);
taosReleaseRef(tscObjRef, rid);
#endif
#else
resetTerminalMode
();
resetTerminalMode
();
printf
(
"
\n
Receive ctrl+c or other signal, quit shell.
\n
"
);
printf
(
"
\n
Receive ctrl+c or other signal, quit shell.
\n
"
);
exit
(
0
);
exitShell
();
#endif
resetTerminalMode
();
printf
(
"
\n
Receive ctrl+c or other signal, quit shell.
\n
"
);
exit
(
0
);
}
}
return
NULL
;
return
NULL
;
...
@@ -578,93 +575,120 @@ int checkVersion() {
...
@@ -578,93 +575,120 @@ int checkVersion() {
}
}
// Global configurations
// Global configurations
SShellArguments
args
=
{.
host
=
NULL
,
SShellArguments
args
=
{
.
host
=
NULL
,
.
user
=
NULL
,
.
database
=
NULL
,
.
timezone
=
NULL
,
.
is_raw_time
=
false
,
.
is_use_passwd
=
false
,
.
dump_config
=
false
,
.
file
=
"
\0
"
,
.
dir
=
"
\0
"
,
.
threadNum
=
5
,
.
commands
=
NULL
,
.
pktLen
=
1000
,
.
pktNum
=
100
,
.
pktType
=
"TCP"
,
.
netTestRole
=
NULL
,
#ifndef TD_WINDOWS
#ifndef TD_WINDOWS
.
password
=
NULL
,
.
password
=
NULL
,
#endif
#endif
.
user
=
NULL
,
};
.
database
=
NULL
,
.
timezone
=
NULL
,
.
is_raw_time
=
false
,
.
is_use_passwd
=
false
,
.
dump_config
=
false
,
.
file
=
"
\0
"
,
.
dir
=
"
\0
"
,
.
threadNum
=
5
,
.
commands
=
NULL
,
.
pktLen
=
1000
,
.
pktNum
=
100
,
.
pktType
=
"TCP"
,
.
netTestRole
=
NULL
};
/*
void
shellDumpConfig
()
{
* Main function.
if
(
!
args
.
dump_config
)
return
;
*/
int
main
(
int
argc
,
char
*
argv
[])
{
/*setlocale(LC_ALL, "en_US.UTF-8"); */
if
(
!
checkVersion
())
{
SConfig
*
pCfg
=
taosGetCfg
();
if
(
NULL
==
pCfg
)
{
printf
(
"TDengine read global config failed!
\n
"
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
cfgDumpCfg
(
pCfg
,
0
,
1
);
exitShell
();
}
shellParseArgument
(
argc
,
argv
,
&
args
);
void
shellTestNetWork
()
{
if
(
args
.
netTestRole
&&
args
.
netTestRole
[
0
]
!=
0
)
{
taosNetTest
(
args
.
netTestRole
,
args
.
host
,
args
.
port
,
args
.
pktLen
,
args
.
pktNum
,
args
.
pktType
);
exitShell
();
}
}
if
(
args
.
dump_config
)
{
void
shellCheckServerStatus
(
)
{
taosInitCfg
(
configDir
,
NULL
,
NULL
,
NULL
,
1
)
;
if
(
!
args
.
status
&&
!
args
.
verbose
)
return
;
SConfig
*
pCfg
=
taosGetCfg
();
TSDB_SERVER_STATUS
code
;
if
(
NULL
==
pCfg
)
{
do
{
printf
(
"TDengine read global config failed!
\n
"
);
char
details
[
1024
]
=
{
0
};
exit
(
EXIT_FAILURE
);
code
=
taos_check_server_status
(
args
.
host
,
args
.
port
,
details
,
args
.
verbose
?
1024
:
0
);
switch
(
code
)
{
case
TSDB_SRV_STATUS_UNAVAILABLE
:
printf
(
"0: unavailable
\n
"
);
break
;
case
TSDB_SRV_STATUS_NETWORK_OK
:
printf
(
"1: network ok
\n
"
);
break
;
case
TSDB_SRV_STATUS_SERVICE_OK
:
printf
(
"2: service ok
\n
"
);
break
;
case
TSDB_SRV_STATUS_SERVICE_DEGRADED
:
printf
(
"3: service degraded
\n
"
);
break
;
case
TSDB_SRV_STATUS_EXTING
:
printf
(
"4: exiting
\n
"
);
break
;
}
}
cfgDumpCfg
(
pCfg
,
0
,
1
);
if
(
strlen
(
details
)
!=
0
)
{
exit
(
0
);
printf
(
"%s
\n\n
"
,
details
);
}
}
if
(
code
==
TSDB_SRV_STATUS_NETWORK_OK
&&
args
.
verbose
)
{
if
(
args
.
netTestRole
&&
args
.
netTestRole
[
0
]
!=
0
)
{
taosMsleep
(
1000
);
TAOS
*
con
=
NULL
;
if
(
args
.
auth
==
NULL
)
{
con
=
taos_connect
(
args
.
host
,
args
.
user
,
args
.
password
,
args
.
database
,
args
.
port
);
}
else
{
}
else
{
con
=
taos_connect_auth
(
args
.
host
,
args
.
user
,
args
.
auth
,
args
.
database
,
args
.
port
)
;
break
;
}
}
}
while
(
1
);
// if (taos_init()) {
exitShell
();
// printf("Failed to init taos");
}
// exit(EXIT_FAILURE);
// }
taosNetTest
(
args
.
netTestRole
,
args
.
host
,
args
.
port
,
args
.
pktLen
,
args
.
pktNum
,
args
.
pktType
);
taos_close
(
con
);
exit
(
0
);
}
/* Initialize the shell */
void
shellExecute
()
{
TAOS
*
con
=
shellInit
(
&
args
);
TAOS
*
con
=
shellInit
(
&
args
);
if
(
con
==
NULL
)
{
if
(
con
==
NULL
)
{
exit
(
EXIT_FAILURE
);
exit
Shell
(
);
}
}
if
(
tsem_init
(
&
cancelSem
,
0
,
0
)
!=
0
)
{
if
(
tsem_init
(
&
cancelSem
,
0
,
0
)
!=
0
)
{
printf
(
"failed to create cancel semphore
\n
"
);
printf
(
"failed to create cancel semphore
\n
"
);
exit
(
EXIT_FAILURE
);
exit
Shell
(
);
}
}
TdThread
spid
;
TdThread
spid
;
taosThreadCreate
(
&
spid
,
NULL
,
cancelHandler
,
NULL
);
taosThreadCreate
(
&
spid
,
NULL
,
cancelHandler
,
NULL
);
/* Interrupt handler. */
taosSetSignal
(
SIGTERM
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGTERM
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGINT
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGINT
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGHUP
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGHUP
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGABRT
,
shellQueryInterruptHandler
);
taosSetSignal
(
SIGABRT
,
shellQueryInterruptHandler
);
/* Get grant information */
shellGetGrantInfo
(
con
);
shellGetGrantInfo
(
con
);
/* Loop to query the input. */
while
(
1
)
{
while
(
1
)
{
taosThreadCreate
(
&
pid
,
NULL
,
shellLoopQuery
,
con
);
taosThreadCreate
(
&
pid
,
NULL
,
shellLoopQuery
,
con
);
taosThreadJoin
(
pid
,
NULL
);
taosThreadJoin
(
pid
,
NULL
);
}
}
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
!
checkVersion
())
exitShell
();
shellParseArgument
(
argc
,
argv
,
&
args
);
taos_init
();
shellDumpConfig
();
shellCheckServerStatus
();
shellTestNetWork
();
shellExecute
();
return
0
;
}
tools/shell/src/tnettest.c
浏览文件 @
e0d3ceb5
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录