Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6ee88322
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
6ee88322
编写于
11月 29, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 fix compile errors in mnode
上级
a17d9811
变更
41
隐藏空白更改
内联
并排
Showing
41 changed file
with
358 addition
and
393 deletion
+358
-393
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+14
-14
source/dnode/mgmt/impl/src/dndMnode.c
source/dnode/mgmt/impl/src/dndMnode.c
+23
-22
source/dnode/mnode/impl/inc/mndAcct.h
source/dnode/mnode/impl/inc/mndAcct.h
+2
-2
source/dnode/mnode/impl/inc/mndAuth.h
source/dnode/mnode/impl/inc/mndAuth.h
+2
-2
source/dnode/mnode/impl/inc/mndBalance.h
source/dnode/mnode/impl/inc/mndBalance.h
+2
-2
source/dnode/mnode/impl/inc/mndCluster.h
source/dnode/mnode/impl/inc/mndCluster.h
+2
-2
source/dnode/mnode/impl/inc/mndDb.h
source/dnode/mnode/impl/inc/mndDb.h
+2
-2
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+44
-52
source/dnode/mnode/impl/inc/mndDnode.h
source/dnode/mnode/impl/inc/mndDnode.h
+2
-2
source/dnode/mnode/impl/inc/mndFunc.h
source/dnode/mnode/impl/inc/mndFunc.h
+2
-2
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+19
-22
source/dnode/mnode/impl/inc/mndMnode.h
source/dnode/mnode/impl/inc/mndMnode.h
+2
-2
source/dnode/mnode/impl/inc/mndOper.h
source/dnode/mnode/impl/inc/mndOper.h
+2
-2
source/dnode/mnode/impl/inc/mndProfile.h
source/dnode/mnode/impl/inc/mndProfile.h
+2
-2
source/dnode/mnode/impl/inc/mndShow.h
source/dnode/mnode/impl/inc/mndShow.h
+2
-2
source/dnode/mnode/impl/inc/mndStable.h
source/dnode/mnode/impl/inc/mndStable.h
+2
-2
source/dnode/mnode/impl/inc/mndSync.h
source/dnode/mnode/impl/inc/mndSync.h
+2
-2
source/dnode/mnode/impl/inc/mndTelem.h
source/dnode/mnode/impl/inc/mndTelem.h
+2
-2
source/dnode/mnode/impl/inc/mndTrans.h
source/dnode/mnode/impl/inc/mndTrans.h
+2
-2
source/dnode/mnode/impl/inc/mndUser.h
source/dnode/mnode/impl/inc/mndUser.h
+2
-2
source/dnode/mnode/impl/inc/mndVgroup.h
source/dnode/mnode/impl/inc/mndVgroup.h
+2
-2
source/dnode/mnode/impl/inc/mnodeInt.h
source/dnode/mnode/impl/inc/mnodeInt.h
+0
-70
source/dnode/mnode/impl/inc/mnodeUser.h
source/dnode/mnode/impl/inc/mnodeUser.h
+0
-32
source/dnode/mnode/impl/src/mndAcct.c
source/dnode/mnode/impl/src/mndAcct.c
+2
-2
source/dnode/mnode/impl/src/mndAuth.c
source/dnode/mnode/impl/src/mndAuth.c
+3
-3
source/dnode/mnode/impl/src/mndBalance.c
source/dnode/mnode/impl/src/mndBalance.c
+2
-2
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+2
-2
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+2
-2
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+2
-2
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+2
-2
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+2
-2
source/dnode/mnode/impl/src/mndOper.c
source/dnode/mnode/impl/src/mndOper.c
+2
-2
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+2
-2
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+2
-2
source/dnode/mnode/impl/src/mndStable.c
source/dnode/mnode/impl/src/mndStable.c
+2
-2
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+2
-2
source/dnode/mnode/impl/src/mndTelem.c
source/dnode/mnode/impl/src/mndTelem.c
+4
-4
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+2
-2
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+3
-3
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-2
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+186
-109
未找到文件。
include/dnode/mnode/mnode.h
浏览文件 @
6ee88322
...
...
@@ -48,7 +48,7 @@ typedef struct {
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
struct
SDnode
*
pDnode
;
SDnode
*
pDnode
;
PutMsgToMnodeQFp
putMsgToApplyMsgFp
;
SendMsgToDnodeFp
sendMsgToDnodeFp
;
SendMsgToMnodeFp
sendMsgToMnodeFp
;
...
...
@@ -63,14 +63,14 @@ typedef struct {
* @param pOption Option of the mnode
* @return SMnode* The mnode object
*/
SMnode
*
mn
ode
Open
(
const
char
*
path
,
const
SMnodeOpt
*
pOption
);
SMnode
*
mn
d
Open
(
const
char
*
path
,
const
SMnodeOpt
*
pOption
);
/**
* @brief Close a mnode
*
* @param pMnode The mnode object to close
*/
void
mn
ode
Close
(
SMnode
*
pMnode
);
void
mn
d
Close
(
SMnode
*
pMnode
);
/**
* @brief Close a mnode
...
...
@@ -79,14 +79,14 @@ void mnodeClose(SMnode *pMnode);
* @param pOption Options of the mnode
* @return int32_t 0 for success, -1 for failure
*/
int32_t
mn
ode
Alter
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
);
int32_t
mn
d
Alter
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
);
/**
* @brief Drop a mnode.
*
* @param path Path of the mnode.
*/
void
mn
ode
Destroy
(
const
char
*
path
);
void
mn
d
Destroy
(
const
char
*
path
);
/**
* @brief Get mnode statistics info
...
...
@@ -95,7 +95,7 @@ void mnodeDestroy(const char *path);
* @param pLoad Statistics of the mnode.
* @return int32_t 0 for success, -1 for failure
*/
int32_t
mn
ode
GetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
);
int32_t
mn
d
GetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
);
/**
* @brief Get user authentication info
...
...
@@ -108,7 +108,7 @@ int32_t mnodeGetLoad(SMnode *pMnode, SMnodeLoad *pLoad);
* @param ckey
* @return int32_t 0 for success, -1 for failure
*/
int32_t
mn
ode
RetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
int32_t
mn
d
RetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
/**
* @brief Initialize mnode msg
...
...
@@ -117,14 +117,14 @@ int32_t mnodeRetriveAuth(SMnode *pMnode, char *user, char *spi, char *encrypt, c
* @param pMsg The request rpc msg
* @return int32_t The created mnode msg
*/
SMnodeMsg
*
mn
ode
InitMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pRpcMsg
);
SMnodeMsg
*
mn
d
InitMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pRpcMsg
);
/**
* @brief Cleanup mnode msg
*
* @param pMsg The request msg
*/
void
mn
ode
CleanupMsg
(
SMnodeMsg
*
pMsg
);
void
mn
d
CleanupMsg
(
SMnodeMsg
*
pMsg
);
/**
* @brief Cleanup mnode msg
...
...
@@ -132,7 +132,7 @@ void mnodeCleanupMsg(SMnodeMsg *pMsg);
* @param pMsg The request msg
* @param code The error code
*/
void
mn
ode
SendRsp
(
SMnodeMsg
*
pMsg
,
int32_t
code
);
void
mn
d
SendRsp
(
SMnodeMsg
*
pMsg
,
int32_t
code
);
/**
* @brief Process the read request
...
...
@@ -140,7 +140,7 @@ void mnodeSendRsp(SMnodeMsg *pMsg, int32_t code);
* @param pMsg The request msg
* @return int32_t 0 for success, -1 for failure
*/
void
mn
ode
ProcessReadMsg
(
SMnodeMsg
*
pMsg
);
void
mn
d
ProcessReadMsg
(
SMnodeMsg
*
pMsg
);
/**
* @brief Process the write request
...
...
@@ -148,7 +148,7 @@ void mnodeProcessReadMsg(SMnodeMsg *pMsg);
* @param pMsg The request msg
* @return int32_t 0 for success, -1 for failure
*/
void
mn
ode
ProcessWriteMsg
(
SMnodeMsg
*
pMsg
);
void
mn
d
ProcessWriteMsg
(
SMnodeMsg
*
pMsg
);
/**
* @brief Process the sync request
...
...
@@ -156,7 +156,7 @@ void mnodeProcessWriteMsg(SMnodeMsg *pMsg);
* @param pMsg The request msg
* @return int32_t 0 for success, -1 for failure
*/
void
mn
ode
ProcessSyncMsg
(
SMnodeMsg
*
pMsg
);
void
mn
d
ProcessSyncMsg
(
SMnodeMsg
*
pMsg
);
/**
* @brief Process the apply request
...
...
@@ -164,7 +164,7 @@ void mnodeProcessSyncMsg(SMnodeMsg *pMsg);
* @param pMsg The request msg
* @return int32_t 0 for success, -1 for failure
*/
void
mn
ode
ProcessApplyMsg
(
SMnodeMsg
*
pMsg
);
void
mn
d
ProcessApplyMsg
(
SMnodeMsg
*
pMsg
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/impl/src/dndMnode.c
浏览文件 @
6ee88322
...
...
@@ -396,7 +396,7 @@ static int32_t dndOpenMnode(SDnode *pDnode, SMnodeOpt *pOption) {
return
code
;
}
SMnode
*
pMnode
=
mn
ode
Open
(
pDnode
->
dir
.
mnode
,
pOption
);
SMnode
*
pMnode
=
mn
d
Open
(
pDnode
->
dir
.
mnode
,
pOption
);
if
(
pMnode
==
NULL
)
{
dError
(
"failed to open mnode since %s"
,
terrstr
());
code
=
terrno
;
...
...
@@ -409,8 +409,8 @@ static int32_t dndOpenMnode(SDnode *pDnode, SMnodeOpt *pOption) {
dError
(
"failed to write mnode file since %s"
,
terrstr
());
code
=
terrno
;
dndStopMnodeWorker
(
pDnode
);
mn
ode
Close
(
pMnode
);
mn
ode
Destroy
(
pDnode
->
dir
.
mnode
);
mn
d
Close
(
pMnode
);
mn
d
Destroy
(
pDnode
->
dir
.
mnode
);
terrno
=
code
;
return
code
;
}
...
...
@@ -432,7 +432,7 @@ static int32_t dndAlterMnode(SDnode *pDnode, SMnodeOpt *pOption) {
return
-
1
;
}
if
(
mn
ode
Alter
(
pMnode
,
pOption
)
!=
0
)
{
if
(
mn
d
Alter
(
pMnode
,
pOption
)
!=
0
)
{
dError
(
"failed to alter mnode since %s"
,
terrstr
());
dndReleaseMnode
(
pDnode
,
pMnode
);
return
-
1
;
...
...
@@ -467,8 +467,8 @@ static int32_t dndDropMnode(SDnode *pDnode) {
dndStopMnodeWorker
(
pDnode
);
dndWriteMnodeFile
(
pDnode
);
mn
ode
Close
(
pMnode
);
mn
ode
Destroy
(
pDnode
->
dir
.
mnode
);
mn
d
Close
(
pMnode
);
mn
d
Destroy
(
pDnode
->
dir
.
mnode
);
return
0
;
}
...
...
@@ -495,6 +495,7 @@ static int32_t dndProcessCreateMnodeReq(SDnode *pDnode, SRpcMsg *pRpcMsg) {
if
(
dndBuildMnodeOptionFromMsg
(
pDnode
,
&
option
,
pMsg
)
!=
0
)
{
return
-
1
;
}
return
dndOpenMnode
(
pDnode
,
&
option
);
}
}
...
...
@@ -554,13 +555,13 @@ static void dndProcessMnodeReadQueue(SDnode *pDnode, SMnodeMsg *pMsg) {
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
!=
NULL
)
{
mn
ode
ProcessReadMsg
(
pMsg
);
mn
d
ProcessReadMsg
(
pMsg
);
dndReleaseMnode
(
pDnode
,
pMnode
);
}
else
{
mn
ode
SendRsp
(
pMsg
,
terrno
);
mn
d
SendRsp
(
pMsg
,
terrno
);
}
mn
ode
CleanupMsg
(
pMsg
);
mn
d
CleanupMsg
(
pMsg
);
}
static
void
dndProcessMnodeWriteQueue
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
)
{
...
...
@@ -568,13 +569,13 @@ static void dndProcessMnodeWriteQueue(SDnode *pDnode, SMnodeMsg *pMsg) {
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
!=
NULL
)
{
mn
ode
ProcessWriteMsg
(
pMsg
);
mn
d
ProcessWriteMsg
(
pMsg
);
dndReleaseMnode
(
pDnode
,
pMnode
);
}
else
{
mn
ode
SendRsp
(
pMsg
,
terrno
);
mn
d
SendRsp
(
pMsg
,
terrno
);
}
mn
ode
CleanupMsg
(
pMsg
);
mn
d
CleanupMsg
(
pMsg
);
}
static
void
dndProcessMnodeApplyQueue
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
)
{
...
...
@@ -582,13 +583,13 @@ static void dndProcessMnodeApplyQueue(SDnode *pDnode, SMnodeMsg *pMsg) {
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
!=
NULL
)
{
mn
ode
ProcessApplyMsg
(
pMsg
);
mn
d
ProcessApplyMsg
(
pMsg
);
dndReleaseMnode
(
pDnode
,
pMnode
);
}
else
{
mn
ode
SendRsp
(
pMsg
,
terrno
);
mn
d
SendRsp
(
pMsg
,
terrno
);
}
mn
ode
CleanupMsg
(
pMsg
);
mn
d
CleanupMsg
(
pMsg
);
}
static
void
dndProcessMnodeSyncQueue
(
SDnode
*
pDnode
,
SMnodeMsg
*
pMsg
)
{
...
...
@@ -596,26 +597,26 @@ static void dndProcessMnodeSyncQueue(SDnode *pDnode, SMnodeMsg *pMsg) {
SMnode
*
pMnode
=
dndAcquireMnode
(
pDnode
);
if
(
pMnode
!=
NULL
)
{
mn
ode
ProcessSyncMsg
(
pMsg
);
mn
d
ProcessSyncMsg
(
pMsg
);
dndReleaseMnode
(
pDnode
,
pMnode
);
}
else
{
mn
ode
SendRsp
(
pMsg
,
terrno
);
mn
d
SendRsp
(
pMsg
,
terrno
);
}
mn
ode
CleanupMsg
(
pMsg
);
mn
d
CleanupMsg
(
pMsg
);
}
static
int32_t
dndWriteMnodeMsgToQueue
(
SMnode
*
pMnode
,
taos_queue
pQueue
,
SRpcMsg
*
pRpcMsg
)
{
assert
(
pQueue
);
SMnodeMsg
*
pMsg
=
mn
ode
InitMsg
(
pMnode
,
pRpcMsg
);
SMnodeMsg
*
pMsg
=
mn
d
InitMsg
(
pMnode
,
pRpcMsg
);
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
if
(
taosWriteQitem
(
pQueue
,
pMsg
)
!=
0
)
{
mn
ode
CleanupMsg
(
pMsg
);
mn
d
CleanupMsg
(
pMsg
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
...
...
@@ -877,7 +878,7 @@ int32_t dndInitMnode(SDnode *pDnode) {
if
(
pMgmt
->
dropped
)
{
dInfo
(
"mnode has been deployed and needs to be deleted"
);
mn
ode
Destroy
(
pDnode
->
dir
.
mnode
);
mn
d
Destroy
(
pDnode
->
dir
.
mnode
);
return
0
;
}
...
...
@@ -920,7 +921,7 @@ int32_t dndGetUserAuthFromMnode(SDnode *pDnode, char *user, char *spi, char *enc
return
-
1
;
}
int32_t
code
=
mn
ode
RetriveAuth
(
pMnode
,
user
,
spi
,
encrypt
,
secret
,
ckey
);
int32_t
code
=
mn
d
RetriveAuth
(
pMnode
,
user
,
spi
,
encrypt
,
secret
,
ckey
);
dndReleaseMnode
(
pDnode
,
pMnode
);
return
code
;
}
source/dnode/mnode/impl/inc/mndAcct.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitAcct
();
void
mn
ode
CleanupAcct
();
int32_t
mn
d
InitAcct
();
void
mn
d
CleanupAcct
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndAuth.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitAuth
();
void
mn
ode
CleanupAuth
();
int32_t
mn
d
InitAuth
();
void
mn
d
CleanupAuth
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndBalance.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitBalance
();
void
mn
ode
CleanupBalance
();
int32_t
mn
d
InitBalance
();
void
mn
d
CleanupBalance
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndCluster.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitCluster
();
void
mn
ode
CleanupCluster
();
int32_t
mn
d
InitCluster
();
void
mn
d
CleanupCluster
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndDb.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitDb
();
void
mn
ode
CleanupDb
();
int32_t
mn
d
InitDb
();
void
mn
d
CleanupDb
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
6ee88322
...
...
@@ -39,42 +39,34 @@ extern int32_t mDebugFlag;
#define mDebug(...) { if (mDebugFlag & DEBUG_DEBUG) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
#define mTrace(...) { if (mDebugFlag & DEBUG_TRACE) { taosPrintLog("MND ", mDebugFlag, __VA_ARGS__); }}
// #define mLError(...) { monSaveLog(2, __VA_ARGS__); mError(__VA_ARGS__) }
// #define mLWarn(...) { monSaveLog(1, __VA_ARGS__); mWarn(__VA_ARGS__) }
// #define mLInfo(...) { monSaveLog(0, __VA_ARGS__); mInfo(__VA_ARGS__) }
#define mLError(...) {mError(__VA_ARGS__) }
#define mLWarn(...) {mWarn(__VA_ARGS__) }
#define mLInfo(...) {mInfo(__VA_ARGS__) }
typedef
struct
SClusterObj
SClusterObj
;
typedef
struct
SDnodeObj
SDnodeObj
;
typedef
struct
SMnodeObj
SMnodeObj
;
typedef
struct
SAcctObj
SAcctObj
;
typedef
struct
SUserObj
SUserObj
;
typedef
struct
SDbObj
SDbObj
;
typedef
struct
SVgObj
SVgObj
;
typedef
struct
SSTableObj
SSTableObj
;
typedef
struct
SFuncObj
SFuncObj
;
typedef
struct
SOperObj
SOperObj
;
typedef
struct
SClusterObj
SClusterObj
;
typedef
struct
SDnodeObj
SDnodeObj
;
typedef
struct
SMnodeObj
SMnodeObj
;
typedef
struct
SAcctObj
SAcctObj
;
typedef
struct
SUserObj
SUserObj
;
typedef
struct
SDbObj
SDbObj
;
typedef
struct
SVgObj
SVgObj
;
typedef
struct
SSTableObj
SSTableObj
;
typedef
struct
SFuncObj
SFuncObj
;
typedef
struct
SOperObj
SOperObj
;
typedef
enum
{
MN_AUTH_ACCT_START
=
0
,
MN_AUTH_ACCT_USER
,
MN_AUTH_ACCT_DNODE
,
MN_AUTH_ACCT_MNODE
,
MN_AUTH_ACCT_DB
,
MN_AUTH_ACCT_TABLE
,
MN_AUTH_ACCT_MAX
}
E
Mn
AuthAcct
;
MN
D
_AUTH_ACCT_START
=
0
,
MN
D
_AUTH_ACCT_USER
,
MN
D
_AUTH_ACCT_DNODE
,
MN
D
_AUTH_ACCT_MNODE
,
MN
D
_AUTH_ACCT_DB
,
MN
D
_AUTH_ACCT_TABLE
,
MN
D
_AUTH_ACCT_MAX
}
EAuthAcct
;
typedef
enum
{
MN_AUTH_OP_START
=
0
,
MN_AUTH_OP_CREATE_USER
,
MN_AUTH_OP_ALTER_USER
,
MN_AUTH_OP_DROP_USER
,
MN_AUTH_MAX
}
E
Mn
AuthOp
;
MN
D
_AUTH_OP_START
=
0
,
MN
D
_AUTH_OP_CREATE_USER
,
MN
D
_AUTH_OP_ALTER_USER
,
MN
D
_AUTH_OP_DROP_USER
,
MN
D
_AUTH_MAX
}
EAuthOp
;
typedef
enum
{
TRN_STAGE_PREPARE
=
1
,
...
...
@@ -86,7 +78,6 @@ typedef enum {
typedef
enum
{
TRN_POLICY_ROLLBACK
=
1
,
TRN_POLICY_RETRY
=
2
}
ETrnPolicy
;
typedef
struct
STrans
{
int32_t
id
;
ETrnStage
stage
;
...
...
@@ -99,7 +90,6 @@ typedef struct STrans {
SArray
*
undoActions
;
}
STrans
;
typedef
struct
SClusterObj
{
int64_t
id
;
char
uid
[
TSDB_CLUSTER_ID_LEN
];
...
...
@@ -202,6 +192,7 @@ typedef struct SDbObj {
int64_t
createdTime
;
int64_t
updateTime
;
SDbCfg
cfg
;
int64_t
uid
;
int8_t
status
;
int32_t
numOfVgroups
;
int32_t
numOfTables
;
...
...
@@ -240,13 +231,13 @@ typedef struct SVgObj {
}
SVgObj
;
typedef
struct
SSTableObj
{
char
tableId
[
TSDB_TABLE_NAME_LEN
];
uint64_t
uid
;
int64_t
createdTime
;
int64_t
updateTime
;
int32_t
numOfColumns
;
// used by normal table
int32_t
numOfTags
;
SSchema
*
schema
;
char
tableId
[
TSDB_TABLE_NAME_LEN
];
uint64_t
uid
;
int64_t
createdTime
;
int64_t
updateTime
;
int32_t
numOfColumns
;
// used by normal table
int32_t
numOfTags
;
SSchema
*
schema
;
}
SSTableObj
;
typedef
struct
SFuncObj
{
...
...
@@ -284,21 +275,22 @@ typedef struct {
typedef
struct
{
int32_t
len
;
void
*
rsp
;
}
SMnRsp
;
}
SMn
ode
Rsp
;
typedef
struct
SMnodeMsg
{
SMnode
*
pMnode
;
void
(
*
fp
)(
SMnodeMsg
*
pMsg
,
int32_t
code
);
SRpcConnInfo
conn
;
SUserObj
*
pUser
;
int16_t
received
;
int16_t
successed
;
int16_t
expected
;
int16_t
retry
;
int32_t
code
;
int64_t
createdTime
;
SMn
Rsp
rpcRsp
;
SRpcMsg
rpcMsg
;
char
pCont
[];
SUserObj
*
pUser
;
int16_t
received
;
int16_t
successed
;
int16_t
expected
;
int16_t
retry
;
int32_t
code
;
int64_t
createdTime
;
SMn
odeRsp
rpcRsp
;
SRpcMsg
rpcMsg
;
char
pCont
[];
}
SMnodeMsg
;
#ifdef __cplusplus
...
...
source/dnode/mnode/impl/inc/mndDnode.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitDnode
();
void
mn
ode
CleanupDnode
();
int32_t
mn
d
InitDnode
();
void
mn
d
CleanupDnode
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndFunc.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitFunc
();
void
mn
ode
CleanupFunc
();
int32_t
mn
d
InitFunc
();
void
mn
d
CleanupFunc
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
6ee88322
...
...
@@ -18,23 +18,21 @@
#include "mndDef.h"
#include "sdb.h"
#include "t
step
.h"
#include "t
queue
.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
int32_t
(
*
MndMsgFp
)(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
);
typedef
int32_t
(
*
MndInitFp
)(
SMnode
*
pMnode
);
typedef
void
(
*
MndCleanupFp
)(
SMnode
*
pMnode
);
typedef
struct
SMnodeBak
{
int32_t
dnodeId
;
int64_t
clusterId
;
tmr_h
timer
;
SSteps
*
pInitSteps
;
SSteps
*
pStartSteps
;
SMnodeOpt
para
;
MndMsgFp
msgFp
[
TSDB_MSG_TYPE_MAX
];
}
SMnodeBak
;
typedef
struct
{
const
char
*
name
;
MndInitFp
initFp
;
MndCleanupFp
cleanupFp
;
}
SMnodeStep
;
typedef
struct
SMnode
{
int32_t
dnodeId
;
...
...
@@ -43,25 +41,24 @@ typedef struct SMnode {
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
tmr_h
timer
;
SSteps
*
pInitSteps
;
SSteps
*
pStartSteps
;
struct
SSdb
*
pSdb
;
struct
SDnode
*
pServer
;
SSdb
*
pSdb
;
SDnode
*
pDnode
;
SArray
steps
;
MndMsgFp
msgFp
[
TSDB_MSG_TYPE_MAX
];
PutMsgToMnodeQFp
putMsgToApplyMsgFp
;
SendMsgToDnodeFp
sendMsgToDnodeFp
;
SendMsgToMnodeFp
sendMsgToMnodeFp
;
SendRedirectMsgFp
sendRedirectMsgFp
;
PutMsgToMnodeQFp
putMsgToApplyMsgFp
;
}
SMnode
;
tmr_h
mn
odeGetTimer
(
);
int32_t
mn
odeGetDnodeId
(
);
int64_t
mn
odeGetClusterId
(
);
tmr_h
mn
dGetTimer
(
SMnode
*
pMnode
);
int32_t
mn
dGetDnodeId
(
SMnode
*
pMnode
);
int64_t
mn
dGetClusterId
(
SMnode
*
pMnode
);
void
mn
odeSendMsgToDnode
(
SMnode
*
pMnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
void
mn
odeSendMsgToMnode
(
SMnode
*
pMnode
,
struct
SRpcMsg
*
rpc
Msg
);
void
mn
odeSendRedirectMsg
(
SMnode
*
pMnode
,
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
);
void
mn
ode
SetMsgHandle
(
SMnode
*
pMnode
,
int32_t
msgType
,
MndMsgFp
fp
);
void
mn
dSendMsgToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
rpcMsg
);
void
mn
dSendMsgToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
p
Msg
);
void
mn
dSendRedirectMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
);
void
mn
d
SetMsgHandle
(
SMnode
*
pMnode
,
int32_t
msgType
,
MndMsgFp
fp
);
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndMnode.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitMnode
();
void
mn
ode
CleanupMnode
();
int32_t
mn
d
InitMnode
();
void
mn
d
CleanupMnode
();
void
mnodeGetMnodeEpSetForPeer
(
SEpSet
*
epSet
,
bool
redirect
);
void
mnodeGetMnodeEpSetForShell
(
SEpSet
*
epSet
,
bool
redirect
);
...
...
source/dnode/mnode/impl/inc/mndOper.h
浏览文件 @
6ee88322
...
...
@@ -20,8 +20,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitOper
();
void
mn
ode
CleanupOper
();
int32_t
mn
d
InitOper
();
void
mn
d
CleanupOper
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndProfile.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitProfile
();
void
mn
ode
CleanupProfile
();
int32_t
mn
d
InitProfile
();
void
mn
d
CleanupProfile
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndShow.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitShow
();
void
mn
odeCleanU
pShow
();
int32_t
mn
d
InitShow
();
void
mn
dCleanu
pShow
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndStable.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitStable
();
void
mn
ode
CleanupStable
();
int32_t
mn
d
InitStable
();
void
mn
d
CleanupStable
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndSync.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitSync
();
void
mn
odeCleanU
pSync
();
int32_t
mn
d
InitSync
();
void
mn
dCleanu
pSync
();
int32_t
mnodeSyncPropose
(
SSdbRaw
*
pRaw
,
void
*
pData
);
bool
mnodeIsMaster
();
...
...
source/dnode/mnode/impl/inc/mndTelem.h
浏览文件 @
6ee88322
...
...
@@ -21,8 +21,8 @@ extern "C" {
#endif
#include "mndInt.h"
int32_t
mn
ode
InitTelem
();
void
mn
ode
CleanupTelem
();
int32_t
mn
d
InitTelem
();
void
mn
d
CleanupTelem
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndTrans.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitTrans
();
void
mn
ode
CleanupTrans
();
int32_t
mn
d
InitTrans
();
void
mn
d
CleanupTrans
();
STrans
*
trnCreate
(
ETrnPolicy
policy
,
void
*
rpcHandle
);
void
trnDrop
(
STrans
*
pTrans
);
...
...
source/dnode/mnode/impl/inc/mndUser.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitUser
();
void
mn
ode
CleanupUser
();
int32_t
mn
d
InitUser
();
void
mn
d
CleanupUser
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mndVgroup.h
浏览文件 @
6ee88322
...
...
@@ -22,8 +22,8 @@
extern
"C"
{
#endif
int32_t
mn
ode
InitVgroup
();
void
mn
ode
CleanupVgroup
();
int32_t
mn
d
InitVgroup
();
void
mn
d
CleanupVgroup
();
#ifdef __cplusplus
}
...
...
source/dnode/mnode/impl/inc/mnodeInt.h
已删除
100644 → 0
浏览文件 @
a17d9811
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_MND_INT_H_
#define _TD_MND_INT_H_
#include "mndDef.h"
#include "sdb.h"
#include "tstep.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
int32_t
(
*
MndMsgFp
)(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
);
typedef
struct
SMnodeBak
{
int32_t
dnodeId
;
int64_t
clusterId
;
tmr_h
timer
;
SSteps
*
pInitSteps
;
SSteps
*
pStartSteps
;
SMnodeOpt
para
;
MndMsgFp
msgFp
[
TSDB_MSG_TYPE_MAX
];
}
SMnodeBak
;
typedef
struct
SMnode
{
int32_t
dnodeId
;
int64_t
clusterId
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
tmr_h
timer
;
SSteps
*
pInitSteps
;
SSteps
*
pStartSteps
;
struct
SSdb
*
pSdb
;
struct
SDnode
*
pServer
;
MndMsgFp
msgFp
[
TSDB_MSG_TYPE_MAX
];
PutMsgToMnodeQFp
putMsgToApplyMsgFp
;
SendMsgToDnodeFp
sendMsgToDnodeFp
;
SendMsgToMnodeFp
sendMsgToMnodeFp
;
SendRedirectMsgFp
sendRedirectMsgFp
;
}
SMnode
;
tmr_h
mnodeGetTimer
();
int32_t
mnodeGetDnodeId
();
int64_t
mnodeGetClusterId
();
void
mnodeSendMsgToDnode
(
SMnode
*
pMnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
void
mnodeSendMsgToMnode
(
SMnode
*
pMnode
,
struct
SRpcMsg
*
rpcMsg
);
void
mnodeSendRedirectMsg
(
SMnode
*
pMnode
,
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
);
void
mnodeSetMsgHandle
(
SMnode
*
pMnode
,
int32_t
msgType
,
MndMsgFp
fp
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MND_INT_H_*/
source/dnode/mnode/impl/inc/mnodeUser.h
已删除
100644 → 0
浏览文件 @
a17d9811
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_MND_USER_H_
#define _TD_MND_USER_H_
#include "mndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
mnodeInitUser
();
void
mnodeCleanupUser
();
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MND_USER_H_*/
source/dnode/mnode/impl/src/mndAcct.c
浏览文件 @
6ee88322
...
...
@@ -101,7 +101,7 @@ static int32_t mnodeCreateDefaultAcct() {
return
sdbWrite
(
pRaw
);
}
int32_t
mn
ode
InitAcct
()
{
int32_t
mn
d
InitAcct
()
{
SSdbTable
table
=
{.
sdbType
=
SDB_ACCT
,
.
keyType
=
SDB_KEY_BINARY
,
.
deployFp
=
(
SdbDeployFp
)
mnodeCreateDefaultAcct
,
...
...
@@ -115,4 +115,4 @@ int32_t mnodeInitAcct() {
return
0
;
}
void
mn
ode
CleanupAcct
()
{}
void
mn
d
CleanupAcct
()
{}
source/dnode/mnode/impl/src/mndAuth.c
浏览文件 @
6ee88322
...
...
@@ -17,9 +17,9 @@
#include "os.h"
#include "mndAuth.h"
int32_t
mn
ode
InitAuth
()
{
return
0
;
}
void
mn
ode
CleanupAuth
()
{}
int32_t
mn
d
InitAuth
()
{
return
0
;
}
void
mn
d
CleanupAuth
()
{}
int32_t
mn
ode
RetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
int32_t
mn
d
RetriveAuth
(
SMnode
*
pMnode
,
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
return
0
;
}
\ No newline at end of file
source/dnode/mnode/impl/src/mndBalance.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitBalance
()
{
return
0
;
}
void
mnodeCleanupBalance
()
{}
\ No newline at end of file
int32_t
mndInitBalance
()
{
return
0
;
}
void
mndCleanupBalance
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitCluster
()
{
return
0
;
}
void
mnodeCleanupCluster
()
{}
\ No newline at end of file
int32_t
mndInitCluster
()
{
return
0
;
}
void
mndCleanupCluster
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitDb
()
{
return
0
;
}
void
mnodeCleanupDb
()
{}
\ No newline at end of file
int32_t
mndInitDb
()
{
return
0
;
}
void
mndCleanupDb
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitDnode
()
{
return
0
;
}
void
mnodeCleanupDnode
()
{}
\ No newline at end of file
int32_t
mndInitDnode
()
{
return
0
;
}
void
mndCleanupDnode
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitFunc
()
{
return
0
;
}
void
mnodeCleanupFunc
()
{}
\ No newline at end of file
int32_t
mndInitFunc
()
{
return
0
;
}
void
mndCleanupFunc
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
6ee88322
...
...
@@ -17,8 +17,8 @@
#include "os.h"
#include "mndInt.h"
int32_t
mn
ode
InitMnode
()
{
return
0
;
}
void
mn
ode
CleanupMnode
()
{}
int32_t
mn
d
InitMnode
()
{
return
0
;
}
void
mn
d
CleanupMnode
()
{}
void
mnodeGetMnodeEpSetForPeer
(
SEpSet
*
epSet
,
bool
redirect
)
{}
void
mnodeGetMnodeEpSetForShell
(
SEpSet
*
epSet
,
bool
redirect
)
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndOper.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitOper
()
{
return
0
;
}
void
mnodeCleanupOper
()
{}
\ No newline at end of file
int32_t
mndInitOper
()
{
return
0
;
}
void
mndCleanupOper
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitProfile
()
{
return
0
;
}
void
mnodeCleanupProfile
()
{}
\ No newline at end of file
int32_t
mndInitProfile
()
{
return
0
;
}
void
mndCleanupProfile
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitShow
()
{
return
0
;
}
void
mnodeCleanUpShow
()
{}
\ No newline at end of file
int32_t
mndInitShow
()
{
return
0
;
}
void
mndCleanupShow
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndStable.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitStable
()
{
return
0
;
}
void
mnodeCleanupStable
()
{}
\ No newline at end of file
int32_t
mndInitStable
()
{
return
0
;
}
void
mndCleanupStable
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
6ee88322
...
...
@@ -18,8 +18,8 @@
#include "mndInt.h"
#include "mndTrans.h"
int32_t
mn
ode
InitSync
()
{
return
0
;
}
void
mn
odeCleanU
pSync
()
{}
int32_t
mn
d
InitSync
()
{
return
0
;
}
void
mn
dCleanu
pSync
()
{}
int32_t
mnodeSyncPropose
(
SSdbRaw
*
pRaw
,
void
*
pData
)
{
trnApply
(
pData
,
pData
,
0
);
...
...
source/dnode/mnode/impl/src/mndTelem.c
浏览文件 @
6ee88322
...
...
@@ -174,7 +174,7 @@ static void mnodeAddVersionInfo(SBufferWriter* bw) {
static
void
mnodeAddRuntimeInfo
(
SBufferWriter
*
bw
)
{
SMnodeLoad
load
=
{
0
};
if
(
mn
ode
GetLoad
(
NULL
,
&
load
)
!=
0
)
{
if
(
mn
d
GetLoad
(
NULL
,
&
load
)
!=
0
)
{
return
;
}
...
...
@@ -203,7 +203,7 @@ static void mnodeSendTelemetryReport() {
return
;
}
int64_t
clusterId
=
mn
odeGetClusterId
(
);
int64_t
clusterId
=
mn
dGetClusterId
(
NULL
);
char
clusterIdStr
[
20
]
=
{
0
};
snprintf
(
clusterIdStr
,
sizeof
(
clusterIdStr
),
"%"
PRId64
,
clusterId
);
...
...
@@ -278,7 +278,7 @@ static void mnodeGetEmail(char* filepath) {
taosCloseFile
(
fd
);
}
int32_t
mn
ode
InitTelem
()
{
int32_t
mn
d
InitTelem
()
{
tsTelem
.
enable
=
tsEnableTelemetryReporting
;
if
(
!
tsTelem
.
enable
)
return
0
;
...
...
@@ -303,7 +303,7 @@ int32_t mnodeInitTelem() {
return
0
;
}
void
mn
ode
CleanupTelem
()
{
void
mn
d
CleanupTelem
()
{
if
(
!
tsTelem
.
enable
)
return
;
if
(
taosCheckPthreadValid
(
tsTelem
.
thread
))
{
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
6ee88322
...
...
@@ -312,7 +312,7 @@ int32_t trnAppendUndoAction(STrans *pTrans, SEpSet *pEpSet, void *pMsg) {
return
code
;
}
int32_t
mn
ode
InitTrans
()
{
int32_t
mn
d
InitTrans
()
{
SSdbTable
table
=
{.
sdbType
=
SDB_TRANS
,
.
keyType
=
SDB_KEY_INT32
,
.
encodeFp
=
(
SdbEncodeFp
)
trnActionEncode
,
...
...
@@ -326,7 +326,7 @@ int32_t mnodeInitTrans() {
return
0
;
}
void
mn
ode
CleanupTrans
()
{
mInfo
(
"trn module is cleaned up"
);
}
void
mn
d
CleanupTrans
()
{
mInfo
(
"trn module is cleaned up"
);
}
int32_t
trnPrepare
(
STrans
*
pTrans
,
int32_t
(
*
syncfp
)(
SSdbRaw
*
pRaw
,
void
*
pData
))
{
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
6ee88322
...
...
@@ -220,7 +220,7 @@ static int32_t mnodeProcessCreateUserMsg(SMnode *pMnode, SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
int32_t
mn
ode
InitUser
()
{
int32_t
mn
d
InitUser
()
{
SSdbTable
table
=
{.
sdbType
=
SDB_USER
,
.
keyType
=
SDB_KEY_BINARY
,
.
deployFp
=
(
SdbDeployFp
)
mnodeCreateDefaultUsers
,
...
...
@@ -231,9 +231,9 @@ int32_t mnodeInitUser() {
.
deleteFp
=
(
SdbDeleteFp
)
mnodeUserActionDelete
};
sdbSetTable
(
table
);
mn
ode
SetMsgHandle
(
NULL
,
TSDB_MSG_TYPE_CREATE_USER
,
mnodeProcessCreateUserMsg
);
mn
d
SetMsgHandle
(
NULL
,
TSDB_MSG_TYPE_CREATE_USER
,
mnodeProcessCreateUserMsg
);
return
0
;
}
void
mnodeCleanupUser
()
{}
\ No newline at end of file
void
mndCleanupUser
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
6ee88322
...
...
@@ -17,5 +17,5 @@
#include "os.h"
#include "mndInt.h"
int32_t
mnodeInitVgroup
()
{
return
0
;
}
void
mnodeCleanupVgroup
()
{}
\ No newline at end of file
int32_t
mndInitVgroup
()
{
return
0
;
}
void
mndCleanupVgroup
()
{}
\ No newline at end of file
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
6ee88322
...
...
@@ -14,9 +14,6 @@
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "tglobal.h"
#include "tqueue.h"
#include "mndAcct.h"
#include "mndAuth.h"
#include "mndBalance.h"
...
...
@@ -35,55 +32,70 @@
#include "mndUser.h"
#include "mndVgroup.h"
SMnodeBak
tsMint
=
{
0
};
int32_t
mnodeGetDnodeId
()
{
return
tsMint
.
para
.
dnodeId
;
}
int32_t
mndGetDnodeId
(
SMnode
*
pMnode
)
{
if
(
pMnode
!=
NULL
)
{
return
pMnode
->
dnodeId
;
}
return
-
1
;
}
int64_t
mnodeGetClusterId
()
{
return
tsMint
.
para
.
clusterId
;
}
int64_t
mndGetClusterId
(
SMnode
*
pMnode
)
{
if
(
pMnode
!=
NULL
)
{
return
pMnode
->
clusterId
;
}
return
-
1
;
}
void
mnodeSendMsgToDnode
(
SMnode
*
pMnode
,
struct
SEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
)
{
assert
(
pMnode
);
(
*
pMnode
->
sendMsgToDnodeFp
)(
pMnode
->
pServer
,
epSet
,
rpcMsg
);
void
mndSendMsgToDnode
(
SMnode
*
pMnode
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
!=
NULL
&&
pMnode
->
sendMsgToDnodeFp
!=
NULL
)
{
(
*
pMnode
->
sendMsgToDnodeFp
)(
pMnode
->
pDnode
,
pEpSet
,
pMsg
);
}
}
void
mnodeSendMsgToMnode
(
SMnode
*
pMnode
,
struct
SRpcMsg
*
rpcMsg
)
{
assert
(
pMnode
);
(
*
pMnode
->
sendMsgToMnodeFp
)(
pMnode
->
pServer
,
rpcMsg
);
void
mndSendMsgToMnode
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
!=
NULL
&&
pMnode
->
sendMsgToMnodeFp
!=
NULL
)
{
(
*
pMnode
->
sendMsgToMnodeFp
)(
pMnode
->
pDnode
,
pMsg
);
}
}
void
mnodeSendRedirectMsg
(
SMnode
*
pMnode
,
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
)
{
assert
(
pMnode
);
(
*
pMnode
->
sendRedirectMsgFp
)(
pMnode
->
pServer
,
rpcMsg
);
void
mndSendRedirectMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
)
{
if
(
pMnode
!=
NULL
&&
pMnode
->
sendRedirectMsgFp
!=
NULL
)
{
(
*
pMnode
->
sendRedirectMsgFp
)(
pMnode
->
pDnode
,
pMsg
);
}
}
static
int32_t
mn
odeInitTimer
(
)
{
if
(
tsMint
.
timer
==
NULL
)
{
tsMint
.
timer
=
taosTmrInit
(
tsMaxShellConns
,
200
,
3600000
,
"MND"
);
static
int32_t
mn
dInitTimer
(
SMnode
*
pMnode
)
{
if
(
pMnode
->
timer
==
NULL
)
{
pMnode
->
timer
=
taosTmrInit
(
5000
,
200
,
3600000
,
"MND"
);
}
if
(
tsMint
.
timer
==
NULL
)
{
if
(
pMnode
->
timer
==
NULL
)
{
return
-
1
;
}
return
0
;
}
static
void
mn
odeCleanupTimer
(
)
{
if
(
tsMint
.
timer
!=
NULL
)
{
taosTmrCleanUp
(
tsMint
.
timer
);
tsMint
.
timer
=
NULL
;
static
void
mn
dCleanupTimer
(
SMnode
*
pMnode
)
{
if
(
pMnode
->
timer
!=
NULL
)
{
taosTmrCleanUp
(
pMnode
->
timer
);
pMnode
->
timer
=
NULL
;
}
}
tmr_h
mnodeGetTimer
()
{
return
tsMint
.
timer
;
}
tmr_h
mndGetTimer
(
SMnode
*
pMnode
)
{
if
(
pMnode
!=
NULL
)
{
return
pMnode
->
timer
;
}
}
static
int32_t
mn
ode
SetOptions
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
)
{
static
int32_t
mn
d
SetOptions
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
)
{
pMnode
->
dnodeId
=
pOption
->
dnodeId
;
pMnode
->
clusterId
=
pOption
->
clusterId
;
pMnode
->
replica
=
pOption
->
replica
;
pMnode
->
selfIndex
=
pOption
->
selfIndex
;
memcpy
(
&
pMnode
->
replicas
,
pOption
->
replicas
,
sizeof
(
SReplica
)
*
TSDB_MAX_REPLICA
);
pMnode
->
p
Server
=
pOption
->
pDnode
;
pMnode
->
p
Dnode
=
pOption
->
pDnode
;
pMnode
->
putMsgToApplyMsgFp
=
pOption
->
putMsgToApplyMsgFp
;
pMnode
->
sendMsgToDnodeFp
=
pOption
->
sendMsgToDnodeFp
;
pMnode
->
sendMsgToMnodeFp
=
pOption
->
sendMsgToMnodeFp
;
...
...
@@ -98,88 +110,143 @@ static int32_t mnodeSetOptions(SMnode *pMnode, const SMnodeOpt *pOption) {
return
0
;
}
static
int32_t
mnodeAllocInitSteps
()
{
struct
SSteps
*
steps
=
taosStepInit
(
16
,
NULL
);
if
(
steps
==
NULL
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-trans"
,
mnodeInitTrans
,
mnodeCleanupTrans
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-cluster"
,
mnodeInitCluster
,
mnodeCleanupCluster
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-dnode"
,
mnodeInitDnode
,
mnodeCleanupDnode
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-mnode"
,
mnodeInitMnode
,
mnodeCleanupMnode
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-acct"
,
mnodeInitAcct
,
mnodeCleanupAcct
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-auth"
,
mnodeInitAuth
,
mnodeCleanupAuth
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-user"
,
mnodeInitUser
,
mnodeCleanupUser
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-db"
,
mnodeInitDb
,
mnodeCleanupDb
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-vgroup"
,
mnodeInitVgroup
,
mnodeCleanupVgroup
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-stable"
,
mnodeInitStable
,
mnodeCleanupStable
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-func"
,
mnodeInitFunc
,
mnodeCleanupFunc
)
!=
0
)
return
-
1
;
if
(
taosStepAdd
(
steps
,
"mnode-sdb"
,
sdbInit
,
sdbCleanup
)
!=
0
)
return
-
1
;
tsMint
.
pInitSteps
=
steps
;
static
int32_t
mndAllocStep
(
SMnode
*
pMnode
,
char
*
name
,
MndInitFp
initFp
,
MndCleanupFp
cleanupFp
)
{
SMnodeStep
step
=
{
0
};
step
.
name
=
name
;
step
.
initFp
=
initFp
;
step
.
cleanupFp
=
cleanupFp
;
if
(
taosArrayPush
(
&
pMnode
->
steps
,
&
step
)
!=
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"failed to alloc step:%s since %s"
,
name
,
terrstr
());
return
-
1
;
}
return
0
;
}
static
int32_t
mnodeAllocStartSteps
()
{
struct
SSteps
*
steps
=
taosStepInit
(
8
,
NULL
);
if
(
steps
==
NULL
)
return
-
1
;
static
int32_t
mndInitSteps
(
SMnode
*
pMnode
)
{
if
(
mndAllocStep
(
pMnode
,
"mnode-trans"
,
mndInitTrans
,
mndCleanupTrans
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-cluster"
,
mndInitCluster
,
mndCleanupCluster
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-dnode"
,
mndInitDnode
,
mndCleanupDnode
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-mnode"
,
mndInitMnode
,
mndCleanupMnode
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-acct"
,
mndInitAcct
,
mndCleanupAcct
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-auth"
,
mndInitAuth
,
mndCleanupAuth
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-user"
,
mndInitUser
,
mndCleanupUser
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-db"
,
mndInitDb
,
mndCleanupDb
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-vgroup"
,
mndInitVgroup
,
mndCleanupVgroup
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-stable"
,
mndInitStable
,
mndCleanupStable
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-func"
,
mndInitFunc
,
mndCleanupFunc
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-sdb"
,
sdbInit
,
sdbCleanup
)
!=
0
)
return
-
1
;
if
(
pMnode
->
replica
==
1
)
{
if
(
mndAllocStep
(
pMnode
,
"mnode-deploy-sdb"
,
sdbDeploy
,
sdbClose
)
!=
0
)
return
-
1
;
}
else
{
if
(
mndAllocStep
(
pMnode
,
"mnode-open-sdb"
,
sdbOpen
,
sdbClose
)
!=
0
)
return
-
1
;
}
taosStepAdd
(
steps
,
"mnode-timer"
,
mnodeInitTimer
,
NULL
)
;
taosStepAdd
(
steps
,
"mnode-sdb-file"
,
sdbOpen
,
sdbClose
)
;
taosStepAdd
(
steps
,
"mnode-balance"
,
mnodeInitBalance
,
mnodeCleanupBalance
)
;
taosStepAdd
(
steps
,
"mnode-profile"
,
mnodeInitProfile
,
mnodeCleanupProfile
)
;
taosStepAdd
(
steps
,
"mnode-show"
,
mnodeInitShow
,
mnodeCleanUpShow
)
;
taosStepAdd
(
steps
,
"mnode-sync"
,
mnodeInitSync
,
mnodeCleanUpSync
)
;
taosStepAdd
(
steps
,
"mnode-telem"
,
mnodeInitTelem
,
mnodeCleanupTelem
)
;
taosStepAdd
(
steps
,
"mnode-timer"
,
NULL
,
mnodeCleanupTimer
)
;
if
(
mndAllocStep
(
pMnode
,
"mnode-timer"
,
mndInitTimer
,
NULL
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-sdb-file"
,
sdbOpen
,
sdbClose
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-balance"
,
mndInitBalance
,
mndCleanupBalance
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-profile"
,
mndInitProfile
,
mndCleanupProfile
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-show"
,
mndInitShow
,
mndCleanupShow
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-sync"
,
mndInitSync
,
mndCleanupSync
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-telem"
,
mndInitTelem
,
mndCleanupTelem
)
!=
0
)
return
-
1
;
if
(
mndAllocStep
(
pMnode
,
"mnode-timer"
,
NULL
,
mndCleanupTimer
)
!=
0
)
return
-
1
;
tsMint
.
pStartSteps
=
steps
;
return
0
;
}
SMnode
*
mnodeOpen
(
const
char
*
path
,
const
SMnodeOpt
*
pOption
)
{
SMnode
*
pMnode
=
calloc
(
1
,
sizeof
(
SMnode
));
if
(
mnodeSetOptions
(
pMnode
,
pOption
)
!=
0
)
{
free
(
pMnode
);
mError
(
"failed to init mnode options since %s"
,
terrstr
());
return
NULL
;
static
void
mndCleanupSteps
(
SMnode
*
pMnode
,
int32_t
pos
)
{
if
(
pos
==
-
1
)
{
pos
=
taosArrayGetSize
(
&
pMnode
->
steps
);
}
if
(
mnodeAllocInitSteps
()
!=
0
)
{
mError
(
"failed to alloc init steps since %s"
,
terrstr
());
return
NULL
;
for
(
int32_t
s
=
pos
;
s
>=
0
;
s
--
)
{
SMnodeStep
*
pStep
=
taosArrayGet
(
&
pMnode
->
steps
,
pos
);
mDebug
(
"step:%s will cleanup"
,
pStep
->
name
);
if
(
pStep
->
cleanupFp
!=
NULL
)
{
(
*
pStep
->
cleanupFp
)(
pMnode
);
}
}
if
(
mnodeAllocStartSteps
()
!=
0
)
{
mError
(
"failed to alloc start steps since %s"
,
terrstr
());
return
NULL
;
}
taosArrayClear
(
&
pMnode
->
steps
);
}
taosStepExec
(
tsMint
.
pInitSteps
);
static
int32_t
mndExecSteps
(
SMnode
*
pMnode
)
{
int32_t
size
=
taosArrayGetSize
(
&
pMnode
->
steps
);
for
(
int32_t
pos
=
0
;
pos
<
size
;
pos
++
)
{
SMnodeStep
*
pStep
=
taosArrayGet
(
&
pMnode
->
steps
,
pos
);
if
(
pStep
->
initFp
==
NULL
)
continue
;
if
(
tsMint
.
para
.
dnodeId
<=
0
&&
tsMint
.
para
.
clusterId
<=
0
)
{
if
(
sdbDeploy
()
!=
0
)
{
mError
(
"failed to deploy sdb since %s"
,
terrstr
());
return
NULL
;
// (*pMnode->reportProgress)(pStep->name, "start initialize");
int32_t
code
=
(
*
pStep
->
initFp
)(
pMnode
);
if
(
code
!=
0
)
{
mError
(
"step:%s exec failed since %s, start to cleanup"
,
pStep
->
name
,
tstrerror
(
code
));
mndCleanupSteps
(
pMnode
,
pos
);
terrno
=
code
;
return
code
;
}
else
{
m
Info
(
"mnode is deployed"
);
m
Debug
(
"step:%s is initialized"
,
pStep
->
name
);
}
// (*pMnode->reportProgress)(pStep->name, "initialize completed");
}
}
taosStepExec
(
tsMint
.
pStartSteps
);
SMnode
*
mndOpen
(
const
char
*
path
,
const
SMnodeOpt
*
pOption
)
{
SMnode
*
pMnode
=
calloc
(
1
,
sizeof
(
SMnode
));
int32_t
code
=
mndSetOptions
(
pMnode
,
pOption
);
if
(
code
!=
0
)
{
mndClose
(
pMnode
);
terrno
=
code
;
mError
(
"failed to set mnode options since %s"
,
terrstr
());
return
NULL
;
}
code
=
mndInitSteps
(
pMnode
);
if
(
code
!=
0
)
{
mndClose
(
pMnode
);
terrno
=
code
;
mError
(
"failed to int steps since %s"
,
terrstr
());
return
NULL
;
}
code
=
mndExecSteps
(
pMnode
);
if
(
code
!=
0
)
{
mndClose
(
pMnode
);
terrno
=
code
;
mError
(
"failed to execute steps since %s"
,
terrstr
());
return
NULL
;
}
mDebug
(
"mnode:%p object is created"
,
pMnode
);
return
pMnode
;
}
void
mnodeClose
(
SMnode
*
pMnode
)
{
free
(
pMnode
);
}
void
mndClose
(
SMnode
*
pMnode
)
{
mndCleanupSteps
(
pMnode
,
-
1
);
free
(
pMnode
);
mDebug
(
"mnode:%p object is cleaned up"
,
pMnode
);
}
int32_t
mnodeAlter
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
)
{
return
0
;
}
int32_t
mndAlter
(
SMnode
*
pMnode
,
const
SMnodeOpt
*
pOption
)
{
assert
(
1
);
return
0
;
}
void
mnodeDestroy
(
const
char
*
path
)
{
sdbUnDeploy
();
}
void
mndDestroy
(
const
char
*
path
)
{
mDebug
(
"mnode in %s will be destroyed"
,
path
);
sdbUnDeploy
();
}
int32_t
mnodeGetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
)
{
return
0
;
}
int32_t
mndGetLoad
(
SMnode
*
pMnode
,
SMnodeLoad
*
pLoad
)
{
assert
(
1
);
return
0
;
}
SMnodeMsg
*
mn
ode
InitMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pRpcMsg
)
{
SMnodeMsg
*
mn
d
InitMsg
(
SMnode
*
pMnode
,
SRpcMsg
*
pRpcMsg
)
{
SMnodeMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SMnodeMsg
));
if
(
pMsg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
...
@@ -187,7 +254,7 @@ SMnodeMsg *mnodeInitMsg(SMnode *pMnode, SRpcMsg *pRpcMsg) {
}
if
(
rpcGetConnInfo
(
pRpcMsg
->
handle
,
&
pMsg
->
conn
)
!=
0
)
{
mn
ode
CleanupMsg
(
pMsg
);
mn
d
CleanupMsg
(
pMsg
);
mError
(
"can not get user from conn:%p"
,
pMsg
->
rpcMsg
.
handle
);
terrno
=
TSDB_CODE_MND_NO_USER_FROM_CONN
;
return
NULL
;
...
...
@@ -199,7 +266,7 @@ SMnodeMsg *mnodeInitMsg(SMnode *pMnode, SRpcMsg *pRpcMsg) {
return
pMsg
;
}
void
mn
ode
CleanupMsg
(
SMnodeMsg
*
pMsg
)
{
void
mn
d
CleanupMsg
(
SMnodeMsg
*
pMsg
)
{
if
(
pMsg
->
pUser
!=
NULL
)
{
sdbRelease
(
pMsg
->
pUser
);
}
...
...
@@ -207,40 +274,50 @@ void mnodeCleanupMsg(SMnodeMsg *pMsg) {
taosFreeQitem
(
pMsg
);
}
void
mn
ode
SendRsp
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{}
void
mn
d
SendRsp
(
SMnodeMsg
*
pMsg
,
int32_t
code
)
{}
static
void
mnodeProcessRpcMsg
(
SMnodeMsg
*
pMsg
)
{
if
(
!
mnodeIsMaster
())
{
mnodeSendRedirectMsg
(
NULL
,
&
pMsg
->
rpcMsg
,
true
);
mnodeCleanupMsg
(
pMsg
);
static
void
mndProcessRpcMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
if
(
!
mnodeIsMaster
(
pMnode
))
{
mndSendRedirectMsg
(
pMnode
,
&
pMsg
->
rpcMsg
);
mndCleanupMsg
(
pMsg
);
return
;
}
int32_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
MndMsgFp
fp
=
tsMint
.
msgFp
[
msgType
];
int32_t
msgType
=
pMsg
->
rpcMsg
.
msgType
;
MndMsgFp
fp
=
pMnode
->
msgFp
[
msgType
];
if
(
fp
==
NULL
)
{
mError
(
"RPC %p, req:%s is not processed"
,
pMsg
->
rpcMsg
.
handle
,
taosMsg
[
msgType
]);
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
};
rpcSendResponse
(
&
rspMsg
);
mndCleanupMsg
(
pMsg
);
return
;
}
int32_t
code
=
(
*
fp
)(
NULL
,
pMsg
);
int32_t
code
=
(
*
fp
)(
pMnode
,
pMsg
);
if
(
code
!=
0
)
{
assert
(
code
);
mError
(
"RPC %p, req:%s processed error since %s"
,
pMsg
->
rpcMsg
.
handle
,
taosMsg
[
msgType
],
tstrerror
(
code
));
SRpcMsg
rspMsg
=
{.
handle
=
pMsg
->
rpcMsg
.
handle
,
.
code
=
TSDB_CODE_MSG_NOT_PROCESSED
};
rpcSendResponse
(
&
rspMsg
);
}
mndCleanupMsg
(
pMsg
);
}
void
mn
ode
SetMsgHandle
(
SMnode
*
pMnode
,
int32_t
msgType
,
MndMsgFp
fp
)
{
void
mn
d
SetMsgHandle
(
SMnode
*
pMnode
,
int32_t
msgType
,
MndMsgFp
fp
)
{
if
(
msgType
>=
0
&&
msgType
<
TSDB_MSG_TYPE_MAX
)
{
tsMint
.
msgFp
[
msgType
]
=
fp
;
pMnode
->
msgFp
[
msgType
]
=
fp
;
}
}
void
mn
odeProcessReadMsg
(
SMnodeMsg
*
pMsg
)
{
mnode
ProcessRpcMsg
(
pMsg
);
}
void
mn
dProcessReadMsg
(
SMnodeMsg
*
pMsg
)
{
mnd
ProcessRpcMsg
(
pMsg
);
}
void
mn
odeProcessWriteMsg
(
SMnodeMsg
*
pMsg
)
{
mnode
ProcessRpcMsg
(
pMsg
);
}
void
mn
dProcessWriteMsg
(
SMnodeMsg
*
pMsg
)
{
mnd
ProcessRpcMsg
(
pMsg
);
}
void
mn
odeProcessSyncMsg
(
SMnodeMsg
*
pMsg
)
{
mnode
ProcessRpcMsg
(
pMsg
);
}
void
mn
dProcessSyncMsg
(
SMnodeMsg
*
pMsg
)
{
mnd
ProcessRpcMsg
(
pMsg
);
}
void
mn
ode
ProcessApplyMsg
(
SMnodeMsg
*
pMsg
)
{}
void
mn
d
ProcessApplyMsg
(
SMnodeMsg
*
pMsg
)
{}
#if 0
...
...
@@ -256,7 +333,7 @@ static void mnodeProcessWriteReq(SMnodeMsg *pMsg, void *unused) {
}
if (!mnodeIsMaster()) {
SMnRsp *rpcRsp = &pMsg->rpcRsp;
SMn
ode
Rsp *rpcRsp = &pMsg->rpcRsp;
SEpSet *epSet = rpcMallocCont(sizeof(SEpSet));
mnodeGetMnodeEpSetForShell(epSet, true);
rpcRsp->rsp = epSet;
...
...
@@ -278,7 +355,7 @@ static void mnodeProcessWriteReq(SMnodeMsg *pMsg, void *unused) {
code = (*tsMworker.writeMsgFp[msgType])(pMsg);
PROCESS_WRITE_REQ_END:
mn
ode
SendRsp(pMsg, code);
mn
d
SendRsp(pMsg, code);
}
static void mnodeProcessReadReq(SMnodeMsg *pMsg, void *unused) {
...
...
@@ -293,7 +370,7 @@ static void mnodeProcessReadReq(SMnodeMsg *pMsg, void *unused) {
}
if (!mnodeIsMaster()) {
SMnRsp *rpcRsp = &pMsg->rpcRsp;
SMn
ode
Rsp *rpcRsp = &pMsg->rpcRsp;
SEpSet *epSet = rpcMallocCont(sizeof(SEpSet));
if (!epSet) {
code = TSDB_CODE_OUT_OF_MEMORY;
...
...
@@ -319,7 +396,7 @@ static void mnodeProcessReadReq(SMnodeMsg *pMsg, void *unused) {
code = (*tsMworker.readMsgFp[msgType])(pMsg);
PROCESS_READ_REQ_END:
mn
ode
SendRsp(pMsg, code);
mn
d
SendRsp(pMsg, code);
}
static void mnodeProcessPeerReq(SMnodeMsg *pMsg, void *unused) {
...
...
@@ -334,7 +411,7 @@ static void mnodeProcessPeerReq(SMnodeMsg *pMsg, void *unused) {
}
if (!mnodeIsMaster()) {
SMnRsp *rpcRsp = &pMsg->rpcRsp;
SMn
ode
Rsp *rpcRsp = &pMsg->rpcRsp;
SEpSet *epSet = rpcMallocCont(sizeof(SEpSet));
mnodeGetMnodeEpSetForPeer(epSet, true);
rpcRsp->rsp = epSet;
...
...
@@ -356,7 +433,7 @@ static void mnodeProcessPeerReq(SMnodeMsg *pMsg, void *unused) {
code = (*tsMworker.peerReqFp[msgType])(pMsg);
PROCESS_PEER_REQ_END:
mn
ode
SendRsp(pMsg, code);
mn
d
SendRsp(pMsg, code);
}
static void mnodeProcessPeerRsp(SMnodeMsg *pMsg, void *unused) {
...
...
@@ -365,7 +442,7 @@ static void mnodeProcessPeerRsp(SMnodeMsg *pMsg, void *unused) {
if (!mnodeIsMaster()) {
mError("msg:%p, ahandle:%p type:%s not processed for not master", pRpcMsg, pRpcMsg->ahandle, taosMsg[msgType]);
mn
ode
CleanupMsg2(pMsg);
mn
d
CleanupMsg2(pMsg);
}
if (tsMworker.peerRspFp[msgType]) {
...
...
@@ -374,6 +451,6 @@ static void mnodeProcessPeerRsp(SMnodeMsg *pMsg, void *unused) {
mError("msg:%p, ahandle:%p type:%s is not processed", pRpcMsg, pRpcMsg->ahandle, taosMsg[msgType]);
}
mn
ode
CleanupMsg2(pMsg);
mn
d
CleanupMsg2(pMsg);
}
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录