Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
33164d4f
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
33164d4f
编写于
3月 25, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
3月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #10983 from taosdata/feature/shm
adjust logs and refcount
上级
092a7ad6
19554380
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
117 addition
and
57 deletion
+117
-57
source/common/src/tglobal.c
source/common/src/tglobal.c
+4
-0
source/dnode/mgmt/bnode/src/bmWorker.c
source/dnode/mgmt/bnode/src/bmWorker.c
+5
-1
source/dnode/mgmt/container/inc/dnd.h
source/dnode/mgmt/container/inc/dnd.h
+10
-12
source/dnode/mgmt/container/inc/dndInt.h
source/dnode/mgmt/container/inc/dndInt.h
+1
-5
source/dnode/mgmt/container/src/dndExec.c
source/dnode/mgmt/container/src/dndExec.c
+8
-1
source/dnode/mgmt/container/src/dndInt.c
source/dnode/mgmt/container/src/dndInt.c
+7
-8
source/dnode/mgmt/container/src/dndMonitor.c
source/dnode/mgmt/container/src/dndMonitor.c
+26
-7
source/dnode/mgmt/container/src/dndMsg.c
source/dnode/mgmt/container/src/dndMsg.c
+1
-1
source/dnode/mgmt/container/src/dndObj.c
source/dnode/mgmt/container/src/dndObj.c
+1
-1
source/dnode/mgmt/container/src/dndTransport.c
source/dnode/mgmt/container/src/dndTransport.c
+28
-8
source/dnode/mgmt/dnode/src/dmFile.c
source/dnode/mgmt/dnode/src/dmFile.c
+1
-1
source/dnode/mgmt/dnode/src/dmInt.c
source/dnode/mgmt/dnode/src/dmInt.c
+2
-2
source/dnode/mgmt/dnode/src/dmMsg.c
source/dnode/mgmt/dnode/src/dmMsg.c
+6
-2
source/dnode/mgmt/dnode/src/dmWorker.c
source/dnode/mgmt/dnode/src/dmWorker.c
+3
-1
source/dnode/mgmt/mnode/src/mmInt.c
source/dnode/mgmt/mnode/src/mmInt.c
+2
-1
source/dnode/mgmt/mnode/src/mmWorker.c
source/dnode/mgmt/mnode/src/mmWorker.c
+2
-0
source/dnode/mgmt/qnode/src/qmWorker.c
source/dnode/mgmt/qnode/src/qmWorker.c
+2
-0
source/dnode/mgmt/snode/src/smWorker.c
source/dnode/mgmt/snode/src/smWorker.c
+2
-0
source/dnode/mgmt/vnode/src/vmInt.c
source/dnode/mgmt/vnode/src/vmInt.c
+4
-4
source/dnode/mgmt/vnode/src/vmWorker.c
source/dnode/mgmt/vnode/src/vmWorker.c
+2
-2
未找到文件。
source/common/src/tglobal.c
浏览文件 @
33164d4f
...
...
@@ -180,6 +180,10 @@ static int32_t taosSetTfsCfg(SConfig *pCfg) {
memcpy
(
&
tsDiskCfg
[
index
],
pCfg
,
sizeof
(
SDiskCfg
));
if
(
pCfg
->
level
==
0
&&
pCfg
->
primary
==
1
)
{
tstrncpy
(
tsDataDir
,
pCfg
->
dir
,
PATH_MAX
);
if
(
taosMkDir
(
tsDataDir
)
!=
0
)
{
uError
(
"failed to create dataDir:%s since %s"
,
tsDataDir
,
terrstr
());
return
-
1
;
}
}
if
(
taosMkDir
(
pCfg
->
dir
)
!=
0
)
{
uError
(
"failed to create tfsDir:%s since %s"
,
tsDataDir
,
terrstr
());
...
...
source/dnode/mgmt/bnode/src/bmWorker.c
浏览文件 @
33164d4f
...
...
@@ -77,7 +77,11 @@ int32_t bmStartWorker(SBnodeMgmt *pMgmt) {
return
-
1
;
}
dDebug
(
"bnode workers are initialized"
);
return
0
;
}
void
bmStopWorker
(
SBnodeMgmt
*
pMgmt
)
{
tMultiWorkerCleanup
(
&
pMgmt
->
writeWorker
);
}
void
bmStopWorker
(
SBnodeMgmt
*
pMgmt
)
{
tMultiWorkerCleanup
(
&
pMgmt
->
writeWorker
);
dDebug
(
"bnode workers are closed"
);
}
source/dnode/mgmt/container/inc/dnd.h
浏览文件 @
33164d4f
...
...
@@ -19,7 +19,6 @@
#include "os.h"
#include "cJSON.h"
#include "monitor.h"
#include "tcache.h"
#include "tcrc32c.h"
#include "tdatablock.h"
...
...
@@ -36,8 +35,7 @@
#include "tworker.h"
#include "dnode.h"
#include "tfs.h"
#include "wal.h"
#include "monitor.h"
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -53,7 +51,6 @@ extern "C" {
typedef
enum
{
DNODE
,
VNODES
,
QNODE
,
SNODE
,
MNODE
,
BNODE
,
NODE_MAX
}
ENodeType
;
typedef
enum
{
DND_STAT_INIT
,
DND_STAT_RUNNING
,
DND_STAT_STOPPED
}
EDndStatus
;
typedef
enum
{
DND_ENV_INIT
,
DND_ENV_READY
,
DND_ENV_CLEANUP
}
EEnvStatus
;
typedef
enum
{
DND_WORKER_SINGLE
,
DND_WORKER_MULTI
}
EWorkerType
;
typedef
enum
{
PROC_SINGLE
,
PROC_CHILD
,
PROC_PARENT
}
EProcType
;
typedef
struct
SMgmtFp
SMgmtFp
;
...
...
@@ -127,29 +124,30 @@ typedef struct SDnode {
bool
dropped
;
EDndStatus
status
;
EDndEvent
event
;
EProcType
procType
;
SStartupReq
startup
;
TdFilePtr
pLockFile
;
STransMgmt
trans
;
SMgmtWrapper
wrappers
[
NODE_MAX
];
}
SDnode
;
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
SMgmtWrapper
*
dndAcquireWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int32_t
vgId
);
void
dndReportStartup
(
SDnode
*
pDnode
,
char
*
pName
,
char
*
pDesc
);
void
dndSendMonitorReport
(
SDnode
*
pDnode
);
EDndStatus
dndGetStatus
(
SDnode
*
pDnode
);
void
dndSetStatus
(
SDnode
*
pDnode
,
EDndStatus
stat
);
void
dndSetMsgHandle
(
SMgmtWrapper
*
pWrapper
,
int32_t
msgType
,
NodeMsgFp
nodeMsgFp
,
int32_t
vgId
);
void
dndReportStartup
(
SDnode
*
pDnode
,
const
char
*
pName
,
const
char
*
pDesc
);
void
dndSendMonitorReport
(
SDnode
*
pDnode
);
int32_t
dndSendReqToMnode
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pMsg
);
int32_t
dndSendReqToDnode
(
SMgmtWrapper
*
pWrapper
,
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
void
dndSendRsp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
);
int32_t
dndProcessNodeMsg
(
SDnode
*
pDnode
,
SNodeMsg
*
pMsg
);
int32_t
dndReadFile
(
SMgmtWrapper
*
pWrapper
,
bool
*
pDeployed
);
int32_t
dndWriteFile
(
SMgmtWrapper
*
pWrapper
,
bool
deployed
);
SMgmtWrapper
*
dndAcquireWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
);
int32_t
dndMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/mgmt/container/inc/dndInt.h
浏览文件 @
33164d4f
...
...
@@ -34,7 +34,7 @@ int32_t dndInit();
void
dndCleanup
();
const
char
*
dndStatStr
(
EDndStatus
stat
);
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartupReq
*
pStartup
);
TdFilePtr
dndCheckRunning
(
char
*
dataDir
);
TdFilePtr
dndCheckRunning
(
c
onst
c
har
*
dataDir
);
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
);
// dndMsg.c
...
...
@@ -50,10 +50,6 @@ SDnode *dndCreate(const SDnodeOpt *pOption);
void
dndClose
(
SDnode
*
pDnode
);
void
dndHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
);
SMgmtWrapper
*
dndAcquireWrapper
(
SDnode
*
pDnode
,
ENodeType
nodeType
);
int32_t
dndMarkWrapper
(
SMgmtWrapper
*
pWrapper
);
void
dndReleaseWrapper
(
SMgmtWrapper
*
pWrapper
);
// dndTransport.c
int32_t
dndInitServer
(
SDnode
*
pDnode
);
void
dndCleanupServer
(
SDnode
*
pDnode
);
...
...
source/dnode/mgmt/container/src/dndExec.c
浏览文件 @
33164d4f
...
...
@@ -50,16 +50,23 @@ int32_t dndOpenNode(SMgmtWrapper *pWrapper) {
}
void
dndCloseNode
(
SMgmtWrapper
*
pWrapper
)
{
dDebug
(
"node:%s, start to close"
,
pWrapper
->
name
);
taosWLockLatch
(
&
pWrapper
->
latch
);
if
(
pWrapper
->
deployed
)
{
(
*
pWrapper
->
fp
.
closeFp
)(
pWrapper
);
pWrapper
->
deployed
=
false
;
}
taosWUnLockLatch
(
&
pWrapper
->
latch
);
while
(
pWrapper
->
refCount
>
0
)
{
taosMsleep
(
10
);
}
if
(
pWrapper
->
pProc
)
{
taosProcCleanup
(
pWrapper
->
pProc
);
pWrapper
->
pProc
=
NULL
;
}
taosWUnLockLatch
(
&
pWrapper
->
latch
);
dDebug
(
"node:%s, has been closed"
,
pWrapper
->
name
);
}
static
int32_t
dndRunInSingleProcess
(
SDnode
*
pDnode
)
{
...
...
source/dnode/mgmt/container/src/dndInt.c
浏览文件 @
33164d4f
...
...
@@ -15,11 +15,12 @@
#define _DEFAULT_SOURCE
#include "dndInt.h"
#include "wal.h"
static
int8_t
once
=
DND_ENV_INIT
;
int32_t
dndInit
()
{
d
Debug
(
"start to init dnode env"
);
d
Info
(
"start to init dnode env"
);
if
(
atomic_val_compare_exchange_8
(
&
once
,
DND_ENV_INIT
,
DND_ENV_READY
)
!=
DND_ENV_INIT
)
{
terrno
=
TSDB_CODE_REPEAT_INIT
;
dError
(
"failed to init dnode env since %s"
,
terrstr
());
...
...
@@ -52,7 +53,7 @@ int32_t dndInit() {
}
void
dndCleanup
()
{
d
Debug
(
"start to cleanup dnode env"
);
d
Info
(
"start to cleanup dnode env"
);
if
(
atomic_val_compare_exchange_8
(
&
once
,
DND_ENV_READY
,
DND_ENV_CLEANUP
)
!=
DND_ENV_READY
)
{
dError
(
"dnode env is already cleaned up"
);
return
;
...
...
@@ -92,7 +93,7 @@ const char *dndStatStr(EDndStatus status) {
}
}
void
dndReportStartup
(
SDnode
*
pDnode
,
c
har
*
pName
,
char
*
pDesc
)
{
void
dndReportStartup
(
SDnode
*
pDnode
,
c
onst
char
*
pName
,
const
char
*
pDesc
)
{
SStartupReq
*
pStartup
=
&
pDnode
->
startup
;
tstrncpy
(
pStartup
->
name
,
pName
,
TSDB_STEP_NAME_LEN
);
tstrncpy
(
pStartup
->
desc
,
pDesc
,
TSDB_STEP_DESC_LEN
);
...
...
@@ -104,21 +105,21 @@ void dndGetStartup(SDnode *pDnode, SStartupReq *pStartup) {
pStartup
->
finished
=
(
dndGetStatus
(
pDnode
)
==
DND_STAT_RUNNING
);
}
TdFilePtr
dndCheckRunning
(
char
*
dataDir
)
{
TdFilePtr
dndCheckRunning
(
c
onst
c
har
*
dataDir
)
{
char
filepath
[
PATH_MAX
]
=
{
0
};
snprintf
(
filepath
,
sizeof
(
filepath
),
"%s/.running"
,
dataDir
);
TdFilePtr
pFile
=
taosOpenFile
(
filepath
,
TD_FILE_CTEATE
|
TD_FILE_WRITE
|
TD_FILE_TRUNC
);
if
(
pFile
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
dError
(
"failed to lock file:%s since %s
, quit
"
,
filepath
,
terrstr
());
dError
(
"failed to lock file:%s since %s"
,
filepath
,
terrstr
());
return
NULL
;
}
int32_t
ret
=
taosLockFile
(
pFile
);
if
(
ret
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
dError
(
"failed to lock file:%s since %s
, quit
"
,
filepath
,
terrstr
());
dError
(
"failed to lock file:%s since %s"
,
filepath
,
terrstr
());
taosCloseFile
(
&
pFile
);
return
NULL
;
}
...
...
@@ -129,12 +130,10 @@ TdFilePtr dndCheckRunning(char *dataDir) {
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"startup req is received"
);
SStartupReq
*
pStartup
=
rpcMallocCont
(
sizeof
(
SStartupReq
));
dndGetStartup
(
pDnode
,
pStartup
);
dDebug
(
"startup req is sent, step:%s desc:%s finished:%d"
,
pStartup
->
name
,
pStartup
->
desc
,
pStartup
->
finished
);
SRpcMsg
rpcRsp
=
{.
handle
=
pReq
->
handle
,
.
pCont
=
pStartup
,
.
contLen
=
sizeof
(
SStartupReq
)};
rpcSendResponse
(
&
rpcRsp
);
}
source/dnode/mgmt/container/src/dndMonitor.c
浏览文件 @
33164d4f
...
...
@@ -22,7 +22,12 @@ static int32_t dndGetMonitorDiskInfo(SDnode *pDnode, SMonDiskInfo *pInfo) {
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
return
vmMonitorTfsInfo
(
dndAcquireWrapper
(
pDnode
,
VNODES
),
pInfo
);
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
VNODES
);
if
(
pWrapper
!=
NULL
)
{
vmMonitorTfsInfo
(
pWrapper
,
pInfo
);
dndReleaseWrapper
(
pWrapper
);
}
return
0
;
}
static
void
dndGetMonitorBasicInfo
(
SDnode
*
pDnode
,
SMonBasicInfo
*
pInfo
)
{
...
...
@@ -45,8 +50,17 @@ static void dndGetMonitorDnodeInfo(SDnode *pDnode, SMonDnodeInfo *pInfo) {
taosGetCardInfo
(
&
pInfo
->
net_in
,
&
pInfo
->
net_out
);
taosGetProcIO
(
&
pInfo
->
io_read
,
&
pInfo
->
io_write
,
&
pInfo
->
io_read_disk
,
&
pInfo
->
io_write_disk
);
vmMonitorVnodeReqs
(
dndAcquireWrapper
(
pDnode
,
VNODES
),
pInfo
);
pInfo
->
has_mnode
=
(
dndAcquireWrapper
(
pDnode
,
MNODE
)
->
required
);
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
VNODES
);
if
(
pWrapper
!=
NULL
)
{
vmMonitorVnodeReqs
(
pWrapper
,
pInfo
);
dndReleaseWrapper
(
pWrapper
);
}
pWrapper
=
dndAcquireWrapper
(
pDnode
,
MNODE
);
if
(
pWrapper
!=
NULL
)
{
pInfo
->
has_mnode
=
pWrapper
->
required
;
dndReleaseWrapper
(
pWrapper
);
}
}
void
dndSendMonitorReport
(
SDnode
*
pDnode
)
{
...
...
@@ -63,10 +77,15 @@ void dndSendMonitorReport(SDnode *pDnode) {
SMonClusterInfo
clusterInfo
=
{
0
};
SMonVgroupInfo
vgroupInfo
=
{
0
};
SMonGrantInfo
grantInfo
=
{
0
};
if
(
mmMonitorMnodeInfo
(
dndAcquireWrapper
(
pDnode
,
MNODE
),
&
clusterInfo
,
&
vgroupInfo
,
&
grantInfo
)
==
0
)
{
monSetClusterInfo
(
pMonitor
,
&
clusterInfo
);
monSetVgroupInfo
(
pMonitor
,
&
vgroupInfo
);
monSetGrantInfo
(
pMonitor
,
&
grantInfo
);
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
MNODE
);
if
(
pWrapper
!=
NULL
)
{
if
(
mmMonitorMnodeInfo
(
pWrapper
,
&
clusterInfo
,
&
vgroupInfo
,
&
grantInfo
)
==
0
)
{
monSetClusterInfo
(
pMonitor
,
&
clusterInfo
);
monSetVgroupInfo
(
pMonitor
,
&
vgroupInfo
);
monSetGrantInfo
(
pMonitor
,
&
grantInfo
);
}
dndReleaseWrapper
(
pWrapper
);
}
SMonDnodeInfo
dnodeInfo
=
{
0
};
...
...
source/dnode/mgmt/container/src/dndMsg.c
浏览文件 @
33164d4f
...
...
@@ -20,8 +20,8 @@ static void dndUpdateMnodeEpSet(SDnode *pDnode, SEpSet *pEpSet) {
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
DNODE
);
if
(
pWrapper
!=
NULL
)
{
dmUpdateMnodeEpSet
(
pWrapper
->
pMgmt
,
pEpSet
);
dndReleaseWrapper
(
pWrapper
);
}
dndReleaseWrapper
(
pWrapper
);
}
static
inline
NodeMsgFp
dndGetMsgFp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRpc
)
{
...
...
source/dnode/mgmt/container/src/dndObj.c
浏览文件 @
33164d4f
...
...
@@ -58,7 +58,7 @@ static void dndClearMemory(SDnode *pDnode) {
SDnode
*
dndCreate
(
const
SDnodeOpt
*
pOption
)
{
dInfo
(
"start to create dnode object"
);
int32_t
code
=
-
1
;
char
path
[
PATH_MAX
];
char
path
[
PATH_MAX
]
=
{
0
}
;
SDnode
*
pDnode
=
NULL
;
pDnode
=
calloc
(
1
,
sizeof
(
SDnode
));
...
...
source/dnode/mgmt/container/src/dndTransport.c
浏览文件 @
33164d4f
...
...
@@ -146,9 +146,14 @@ static void dndProcessRequest(void *param, SRpcMsg *pReq, SEpSet *pEpSet) {
static
void
dndSendMsgToMnodeRecv
(
SDnode
*
pDnode
,
SRpcMsg
*
pRpcMsg
,
SRpcMsg
*
pRpcRsp
)
{
STransMgmt
*
pMgmt
=
&
pDnode
->
trans
;
SEpSet
epSet
=
{
0
};
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
DNODE
);
if
(
pWrapper
!=
NULL
)
{
dmGetMnodeEpSet
(
pWrapper
->
pMgmt
,
&
epSet
);
dndReleaseWrapper
(
pWrapper
);
}
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
dndAcquireWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
&
epSet
);
rpcSendRecv
(
pMgmt
->
clientRpc
,
&
epSet
,
pRpcMsg
,
pRpcRsp
);
}
...
...
@@ -182,9 +187,14 @@ static int32_t dndRetrieveUserAuthInfo(void *parent, char *user, char *spi, char
return
0
;
}
if
(
mmGetUserAuth
(
dndAcquireWrapper
(
pDnode
,
MNODE
),
user
,
spi
,
encrypt
,
secret
,
ckey
)
==
0
)
{
dTrace
(
"user:%s, get auth from mnode, spi:%d encrypt:%d"
,
user
,
*
spi
,
*
encrypt
);
return
0
;
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
MNODE
);
if
(
pWrapper
!=
NULL
)
{
if
(
mmGetUserAuth
(
pWrapper
,
user
,
spi
,
encrypt
,
secret
,
ckey
)
==
0
)
{
dndReleaseWrapper
(
pWrapper
);
dTrace
(
"user:%s, get auth from mnode, spi:%d encrypt:%d"
,
user
,
*
spi
,
*
encrypt
);
return
0
;
}
dndReleaseWrapper
(
pWrapper
);
}
if
(
terrno
!=
TSDB_CODE_APP_NOT_READY
)
{
...
...
@@ -271,7 +281,7 @@ int32_t dndInitMsgHandle(SDnode *pDnode) {
int32_t
vgId
=
pWrapper
->
msgVgIds
[
msgIndex
];
if
(
msgFp
==
NULL
)
continue
;
dTrace
(
"msg:%s will be processed by %s, vgId:%d"
,
tMsgInfo
[
msgIndex
],
pWrapper
->
name
,
vgId
);
//
dTrace("msg:%s will be processed by %s, vgId:%d", tMsgInfo[msgIndex], pWrapper->name, vgId);
SMsgHandle
*
pHandle
=
&
pMgmt
->
msgHandles
[
msgIndex
];
if
(
vgId
==
QND_VGID
)
{
...
...
@@ -328,7 +338,12 @@ int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pReq) {
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
STransMgmt
*
pTrans
=
&
pDnode
->
trans
;
SEpSet
epSet
=
{
0
};
dmGetMnodeEpSet
(
dndAcquireWrapper
(
pDnode
,
DNODE
)
->
pMgmt
,
&
epSet
);
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
DNODE
);
if
(
pWrapper
!=
NULL
)
{
dmGetMnodeEpSet
(
pWrapper
->
pMgmt
,
&
epSet
);
dndReleaseWrapper
(
pWrapper
);
}
return
dndSendRpcReq
(
pTrans
,
&
epSet
,
pReq
);
}
}
...
...
@@ -336,7 +351,12 @@ int32_t dndSendReqToMnode(SMgmtWrapper *pWrapper, SRpcMsg *pReq) {
void
dndSendRpcRsp
(
SMgmtWrapper
*
pWrapper
,
SRpcMsg
*
pRsp
)
{
if
(
pRsp
->
code
==
TSDB_CODE_APP_NOT_READY
)
{
SMgmtWrapper
*
pDnodeWrapper
=
dndAcquireWrapper
(
pWrapper
->
pDnode
,
DNODE
);
dmSendRedirectRsp
(
pDnodeWrapper
->
pMgmt
,
pRsp
);
if
(
pDnodeWrapper
!=
NULL
)
{
dmSendRedirectRsp
(
pDnodeWrapper
->
pMgmt
,
pRsp
);
dndReleaseWrapper
(
pDnodeWrapper
);
}
else
{
rpcSendResponse
(
pRsp
);
}
}
else
{
rpcSendResponse
(
pRsp
);
}
...
...
source/dnode/mgmt/dnode/src/dmFile.c
浏览文件 @
33164d4f
...
...
@@ -209,7 +209,7 @@ int32_t dmWriteFile(SDnodeMgmt *pMgmt) {
}
pMgmt
->
updateTime
=
taosGetTimestampMs
();
dDebug
(
"successed to write %s"
,
file
);
dDebug
(
"successed to write %s"
,
real
file
);
return
0
;
}
...
...
source/dnode/mgmt/dnode/src/dmInt.c
浏览文件 @
33164d4f
...
...
@@ -74,14 +74,14 @@ void dmSendRedirectRsp(SDnodeMgmt *pMgmt, SRpcMsg *pReq) {
}
static
int32_t
dmStart
(
SMgmtWrapper
*
pWrapper
)
{
dDebug
(
"dnode
mgmt start to run"
);
dDebug
(
"dnode
-
mgmt start to run"
);
return
dmStartThread
(
pWrapper
->
pMgmt
);
}
int32_t
dmInit
(
SMgmtWrapper
*
pWrapper
)
{
SDnode
*
pDnode
=
pWrapper
->
pDnode
;
SDnodeMgmt
*
pMgmt
=
calloc
(
1
,
sizeof
(
SDnodeMgmt
));
dInfo
(
"dnode-mgmt
is initialized
"
);
dInfo
(
"dnode-mgmt
start to init
"
);
pDnode
->
dnodeId
=
0
;
pDnode
->
dropped
=
0
;
...
...
source/dnode/mgmt/dnode/src/dmMsg.c
浏览文件 @
33164d4f
...
...
@@ -41,8 +41,12 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
memcpy
(
req
.
clusterCfg
.
charset
,
tsCharset
,
TD_LOCALE_LEN
);
taosRUnLockLatch
(
&
pMgmt
->
latch
);
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
vmMonitorVnodeLoads
(
dndAcquireWrapper
(
pDnode
,
VNODES
),
req
.
pVloads
);
SMgmtWrapper
*
pWrapper
=
dndAcquireWrapper
(
pDnode
,
VNODES
);
if
(
pWrapper
!=
NULL
)
{
req
.
pVloads
=
taosArrayInit
(
TSDB_MAX_VNODES
,
sizeof
(
SVnodeLoad
));
vmMonitorVnodeLoads
(
pWrapper
,
req
.
pVloads
);
dndReleaseWrapper
(
pWrapper
);
}
int32_t
contLen
=
tSerializeSStatusReq
(
NULL
,
0
,
&
req
);
void
*
pHead
=
rpcMallocCont
(
contLen
);
...
...
source/dnode/mgmt/dnode/src/dmWorker.c
浏览文件 @
33164d4f
...
...
@@ -114,6 +114,7 @@ int32_t dmStartWorker(SDnodeMgmt *pMgmt) {
return
-
1
;
}
dDebug
(
"dnode workers are initialized"
);
return
0
;
}
...
...
@@ -136,6 +137,7 @@ void dmStopWorker(SDnodeMgmt *pMgmt) {
taosDestoryThread
(
pMgmt
->
threadId
);
pMgmt
->
threadId
=
NULL
;
}
dDebug
(
"dnode workers are closed"
);
}
int32_t
dmProcessMgmtMsg
(
SDnodeMgmt
*
pMgmt
,
SNodeMsg
*
pMsg
)
{
...
...
@@ -144,6 +146,6 @@ int32_t dmProcessMgmtMsg(SDnodeMgmt *pMgmt, SNodeMsg *pMsg) {
pWorker
=
&
pMgmt
->
statusWorker
;
}
dTrace
(
"msg:%p,
will be written
to worker %s"
,
pMsg
,
pWorker
->
name
);
dTrace
(
"msg:%p,
put in
to worker %s"
,
pMsg
,
pWorker
->
name
);
return
taosWriteQitem
(
pWorker
->
queue
,
pMsg
);
}
source/dnode/mgmt/mnode/src/mmInt.c
浏览文件 @
33164d4f
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "mmInt.h"
#include "wal.h"
static
bool
mmDeployRequired
(
SDnode
*
pDnode
)
{
if
(
pDnode
->
dnodeId
>
0
)
return
false
;
...
...
@@ -226,7 +227,7 @@ static int32_t mmOpen(SMgmtWrapper *pWrapper) {
}
static
int32_t
mmStart
(
SMgmtWrapper
*
pWrapper
)
{
dDebug
(
"mnode
mgmt start to run"
);
dDebug
(
"mnode
-
mgmt start to run"
);
SMnodeMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
return
mndStart
(
pMgmt
->
pMnode
);
}
...
...
source/dnode/mgmt/mnode/src/mmWorker.c
浏览文件 @
33164d4f
...
...
@@ -108,6 +108,7 @@ int32_t mmStartWorker(SMnodeMgmt *pMgmt) {
return
-
1
;
}
dDebug
(
"mnode workers are initialized"
);
return
0
;
}
...
...
@@ -115,4 +116,5 @@ void mmStopWorker(SMnodeMgmt *pMgmt) {
tSingleWorkerCleanup
(
&
pMgmt
->
readWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
writeWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
syncWorker
);
dDebug
(
"mnode workers are closed"
);
}
source/dnode/mgmt/qnode/src/qmWorker.c
浏览文件 @
33164d4f
...
...
@@ -132,10 +132,12 @@ int32_t qmStartWorker(SQnodeMgmt *pMgmt) {
return
-
1
;
}
dDebug
(
"qnode workers are initialized"
);
return
0
;
}
void
qmStopWorker
(
SQnodeMgmt
*
pMgmt
)
{
tSingleWorkerCleanup
(
&
pMgmt
->
queryWorker
);
tSingleWorkerCleanup
(
&
pMgmt
->
fetchWorker
);
dDebug
(
"qnode workers are closed"
);
}
source/dnode/mgmt/snode/src/smWorker.c
浏览文件 @
33164d4f
...
...
@@ -80,6 +80,7 @@ int32_t smStartWorker(SSnodeMgmt *pMgmt) {
return
-
1
;
}
dDebug
(
"snode workers are initialized"
);
return
0
;
}
...
...
@@ -90,6 +91,7 @@ void smStopWorker(SSnodeMgmt *pMgmt) {
}
taosArrayDestroy
(
pMgmt
->
uniqueWorkers
);
tSingleWorkerCleanup
(
&
pMgmt
->
sharedWorker
);
dDebug
(
"snode workers are closed"
);
}
static
FORCE_INLINE
int32_t
smGetSWIdFromMsg
(
SRpcMsg
*
pMsg
)
{
...
...
source/dnode/mgmt/vnode/src/vmInt.c
浏览文件 @
33164d4f
...
...
@@ -257,14 +257,14 @@ static void vmCleanup(SMgmtWrapper *pWrapper) {
SVnodesMgmt
*
pMgmt
=
pWrapper
->
pMgmt
;
if
(
pMgmt
==
NULL
)
return
;
dInfo
(
"vnode
s
-mgmt start to cleanup"
);
dInfo
(
"vnode-mgmt start to cleanup"
);
vmCloseVnodes
(
pMgmt
);
vmStopWorker
(
pMgmt
);
vnodeCleanup
();
// walCleanUp();
free
(
pMgmt
);
pWrapper
->
pMgmt
=
NULL
;
dInfo
(
"vnode
s
-mgmt is cleaned up"
);
dInfo
(
"vnode-mgmt is cleaned up"
);
}
static
int32_t
vmInit
(
SMgmtWrapper
*
pWrapper
)
{
...
...
@@ -272,7 +272,7 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
SVnodesMgmt
*
pMgmt
=
calloc
(
1
,
sizeof
(
SVnodesMgmt
));
int32_t
code
=
-
1
;
dInfo
(
"vnode
s
-mgmt start to init"
);
dInfo
(
"vnode-mgmt start to init"
);
if
(
pMgmt
==
NULL
)
goto
_OVER
;
pMgmt
->
path
=
pWrapper
->
path
;
...
...
@@ -312,7 +312,7 @@ static int32_t vmInit(SMgmtWrapper *pWrapper) {
}
if
(
vmOpenVnodes
(
pMgmt
)
!=
0
)
{
dError
(
"failed to open vnode
s
since %s"
,
terrstr
());
dError
(
"failed to open vnode since %s"
,
terrstr
());
return
-
1
;
}
...
...
source/dnode/mgmt/vnode/src/vmWorker.c
浏览文件 @
33164d4f
...
...
@@ -356,7 +356,7 @@ int32_t vmStartWorker(SVnodesMgmt *pMgmt) {
return
-
1
;
}
dDebug
(
"vnode workers
is
initialized"
);
dDebug
(
"vnode workers
are
initialized"
);
return
0
;
}
...
...
@@ -366,5 +366,5 @@ void vmStopWorker(SVnodesMgmt *pMgmt) {
tQWorkerCleanup
(
&
pMgmt
->
queryPool
);
tWWorkerCleanup
(
&
pMgmt
->
writePool
);
tWWorkerCleanup
(
&
pMgmt
->
syncPool
);
dDebug
(
"vnode workers
is
closed"
);
dDebug
(
"vnode workers
are
closed"
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录