Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f40383e4
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看板
提交
f40383e4
编写于
3月 13, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rename files
上级
6c8cf998
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
229 addition
and
127 deletion
+229
-127
source/dnode/mgmt/dnode/inc/dndInt.h
source/dnode/mgmt/dnode/inc/dndInt.h
+4
-3
source/dnode/mgmt/dnode/inc/dndMgmt.h
source/dnode/mgmt/dnode/inc/dndMgmt.h
+4
-4
source/dnode/mgmt/dnode/inc/dndMonitor.h
source/dnode/mgmt/dnode/inc/dndMonitor.h
+31
-0
source/dnode/mgmt/dnode/src/dndInt.c
source/dnode/mgmt/dnode/src/dndInt.c
+3
-8
source/dnode/mgmt/dnode/src/dndMain.c
source/dnode/mgmt/dnode/src/dndMain.c
+158
-110
source/dnode/mgmt/dnode/src/dndMgmt.c
source/dnode/mgmt/dnode/src/dndMgmt.c
+0
-2
source/dnode/mgmt/dnode/src/dndMonitor.c
source/dnode/mgmt/dnode/src/dndMonitor.c
+29
-0
未找到文件。
source/dnode/mgmt/dnode/inc/dndInt.h
浏览文件 @
f40383e4
...
...
@@ -59,7 +59,7 @@ typedef enum { MNODE, NODE_MAX, VNODES, QNODE, SNODE, BNODE } ENodeType;
typedef
enum
{
PROC_SINGLE
,
PROC_CHILD
,
PROC_PARENT
}
EProcType
;
typedef
enum
{
DND_STAT_INIT
,
DND_STAT_RUNNING
,
DND_STAT_STOPPED
}
EDndStatus
;
typedef
enum
{
DND_WORKER_SINGLE
,
DND_WORKER_MULTI
}
EWorkerType
;
typedef
enum
{
DND_ENV_INIT
,
DND_ENV_READY
,
DND_ENV_CLEANU
}
EEnvStat
;
typedef
enum
{
DND_ENV_INIT
,
DND_ENV_READY
,
DND_ENV_CLEANU
P
}
EEnvStat
;
typedef
struct
SMgmtFp
SMgmtFp
;
typedef
struct
SMgmtWrapper
SMgmtWrapper
;
...
...
@@ -68,7 +68,7 @@ typedef void (*DndMsgFp)(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEps);
typedef
int32_t
(
*
MndMsgFp
)(
SDnode
*
pDnode
,
SMndMsg
*
pMsg
);
typedef
SMgmtWrapper
*
(
*
MgmtOpenFp
)(
SDnode
*
pDnode
,
const
char
*
path
);
typedef
void
(
*
MgmtCloseFp
)(
SDnode
*
pDnode
,
SMgmtWrapper
*
pMgmt
);
typedef
bool
(
*
MgmtRequiredFp
)(
S
Dnode
*
pDnode
,
const
char
*
path
);
typedef
bool
(
*
MgmtRequiredFp
)(
S
MgmtWrapper
*
pMgmt
);
typedef
SArray
*
(
*
MgmtMsgFp
)(
SMgmtWrapper
*
pNode
,
SNodeMsg
*
pMsg
);
typedef
struct
{
...
...
@@ -192,6 +192,7 @@ typedef struct SMgmtWrapper {
SProcObj
*
pProc
;
void
*
pMgmt
;
SMgmtFp
fp
;
SDnode
*
pDnode
;
}
SMgmtWrapper
;
typedef
struct
SDnode
{
...
...
@@ -203,6 +204,7 @@ typedef struct SDnode {
TdFilePtr
pLockFile
;
SDnodeMgmt
dmgmt
;
STransMgmt
tmgmt
;
STfs
*
pTfs
;
SMgmtFp
fps
[
NODE_MAX
];
SMgmtWrapper
mgmts
[
NODE_MAX
];
}
SDnode
;
...
...
@@ -213,7 +215,6 @@ const char *dndStatStr(EDndStatus stat);
void
dndReportStartup
(
SDnode
*
pDnode
,
char
*
pName
,
char
*
pDesc
);
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartupReq
*
pStartup
);
TdFilePtr
dndCheckRunning
(
char
*
dataDir
);
int32_t
dndGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
);
#ifdef __cplusplus
}
...
...
source/dnode/mgmt/
impl
/inc/dndMgmt.h
→
source/dnode/mgmt/
dnode
/inc/dndMgmt.h
浏览文件 @
f40383e4
...
...
@@ -13,13 +13,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_DND_
DNODE
_H_
#define _TD_DND_
DNODE
_H_
#ifndef _TD_DND_
MGMT
_H_
#define _TD_DND_
MGMT
_H_
#ifdef __cplusplus
extern
"C"
{
#endif
#include "dnd
Env
.h"
#include "dnd
Int.h
.h"
int32_t
dndInitMgmt
(
SDnode
*
pDnode
);
void
dndStopMgmt
(
SDnode
*
pDnode
);
...
...
@@ -39,4 +39,4 @@ void dndProcessStartupReq(SDnode *pDnode, SRpcMsg *pMsg);
}
#endif
#endif
/*_TD_DND_DNODE_H_*/
\ No newline at end of file
#endif
/*_TD_DND_MGMT_H_*/
\ No newline at end of file
source/dnode/mgmt/dnode/inc/dndMonitor.h
0 → 100644
浏览文件 @
f40383e4
/*
* 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_DND_MONITOR_H_
#define _TD_DND_MONITOR_H_
#include "dndInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int32_t
dndGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_DND_MONITOR_H_*/
\ No newline at end of file
source/dnode/mgmt/dnode/src/dndInt.c
浏览文件 @
f40383e4
...
...
@@ -72,12 +72,7 @@ TdFilePtr dndCheckRunning(char *dataDir) {
return
pFile
;
}
int32_t
dndGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
pInfo
->
logdir
.
size
=
tsLogSpace
.
size
;
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
//return tfsGetMonitorInfo(pDnode->pTfs, pInfo);
return
tfsGetMonitorInfo
(
NULL
,
pInfo
);
void
dndeHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
)
{
dInfo
(
"dnode object receive event %d, data:%p"
,
event
,
pDnode
);
pDnode
->
event
=
event
;
}
source/dnode/mgmt/dnode/src/dndMain.c
浏览文件 @
f40383e4
...
...
@@ -14,135 +14,194 @@
*/
#define _DEFAULT_SOURCE
#include "dndBnode.h"
#include "dndMgmt.h"
#include "mm.h"
#include "dndQnode.h"
#include "dndSnode.h"
#include "dndTransport.h"
#include "dndVnodes.h"
#include "monitor.h"
#include "sync.h"
#include "tfs.h"
#include "wal.h"
#include "dndMain.h"
// #include "dndBnode.h"
// #include "dndMgmt.h"
// #include "mm.h"
// #include "dndQnode.h"
// #include "dndSnode.h"
// #include "dndTransport.h"
// #include "dndVnodes.h"
// #include "monitor.h"
// #include "sync.h"
// #include "tfs.h"
// #include "wal.h"
static
int8_t
once
=
DND_ENV_INIT
;
static
int32_t
dndInitDir
(
SDnode
*
pDnode
,
SDndCfg
*
pCfg
)
{
pDnode
->
pLockFile
=
dndCheckRunning
(
pCfg
->
dataDir
);
if
(
pDnode
->
pLockFile
==
NULL
)
{
return
-
1
;
}
SMgmtFp
mmGetNodeFp
()
{
SMgmtFp
nullFp
=
{
0
};
return
nullFp
;
}
char
path
[
PATH_MAX
+
100
];
snprintf
(
path
,
sizeof
(
path
),
"%s%smnode"
,
pCfg
->
dataDir
,
TD_DIRSEP
);
pDnode
->
dir
.
mnode
=
tstrdup
(
path
);
snprintf
(
path
,
sizeof
(
path
),
"%s%svnode"
,
pCfg
->
dataDir
,
TD_DIRSEP
);
pDnode
->
dir
.
vnodes
=
tstrdup
(
path
);
snprintf
(
path
,
sizeof
(
path
),
"%s%sdnode"
,
pCfg
->
dataDir
,
TD_DIRSEP
);
pDnode
->
dir
.
dnode
=
tstrdup
(
path
);
snprintf
(
path
,
sizeof
(
path
),
"%s%ssnode"
,
pCfg
->
dataDir
,
TD_DIRSEP
);
pDnode
->
dir
.
snode
=
tstrdup
(
path
);
snprintf
(
path
,
sizeof
(
path
),
"%s%sbnode"
,
pCfg
->
dataDir
,
TD_DIRSEP
);
pDnode
->
dir
.
bnode
=
tstrdup
(
path
);
if
(
pDnode
->
dir
.
mnode
==
NULL
||
pDnode
->
dir
.
vnodes
==
NULL
||
pDnode
->
dir
.
dnode
==
NULL
||
pDnode
->
dir
.
snode
==
NULL
||
pDnode
->
dir
.
bnode
==
NULL
)
{
dError
(
"failed to malloc dir object"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
SMgmtFp
vndGetNodeFp
()
{
SMgmtFp
nullFp
=
{
0
};
return
nullFp
;
}
SMgmtFp
qndGetNodeFp
()
{
SMgmtFp
nullFp
=
{
0
};
return
nullFp
;
}
SMgmtFp
sndGetNodeFp
()
{
SMgmtFp
nullFp
=
{
0
};
return
nullFp
;
}
SMgmtFp
bndGetNodeFp
()
{
SMgmtFp
nullFp
=
{
0
};
return
nullFp
;
}
static
void
dndResetLog
(
SMgmtWrapper
*
pMgmt
)
{
char
logname
[
24
]
=
{
0
};
snprintf
(
logname
,
sizeof
(
logname
),
"%slog"
,
pMgmt
->
name
);
dInfo
(
"node:%s, reset log to %s"
,
pMgmt
->
name
,
logname
);
taosCloseLog
();
taosInitLog
(
logname
,
1
);
}
static
bool
dndRequireOpenNode
(
SMgmtWrapper
*
pMgmt
)
{
bool
required
=
(
*
pMgmt
->
fp
.
requiredFp
)(
pMgmt
);
if
(
!
required
)
{
dDebug
(
"node:%s, no need to start on this dnode"
,
pMgmt
->
name
);
}
else
{
dDebug
(
"node:%s, need to start on this dnode"
,
pMgmt
->
name
);
}
return
required
;
}
if
(
taosMkDir
(
pDnode
->
dir
.
dnode
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
dnode
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
)
;
return
-
1
;
static
void
dndClearDnodeMem
(
SDnode
*
pDnode
)
{
for
(
ENodeType
n
=
0
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pMgmt
=
&
pDnode
->
mgmts
[
n
]
;
tfree
(
pMgmt
->
path
)
;
}
if
(
pDnode
->
pLockFile
!=
NULL
)
{
taosUnLockFile
(
pDnode
->
pLockFile
);
taosCloseFile
(
&
pDnode
->
pLockFile
);
}
dDebug
(
"dnode object memory is cleared, data:%p"
,
pDnode
);
}
if
(
taosMkDir
(
pDnode
->
dir
.
mnode
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
mnode
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
static
int32_t
dndInitDnodeResource
(
SDnode
*
pDnode
)
{
SDiskCfg
dCfg
=
{
0
};
tstrncpy
(
dCfg
.
dir
,
pDnode
->
cfg
.
dataDir
,
TSDB_FILENAME_LEN
);
dCfg
.
level
=
0
;
dCfg
.
primary
=
1
;
SDiskCfg
*
pDisks
=
pDnode
->
cfg
.
pDisks
;
int32_t
numOfDisks
=
pDnode
->
cfg
.
numOfDisks
;
if
(
numOfDisks
<=
0
||
pDisks
==
NULL
)
{
pDisks
=
&
dCfg
;
numOfDisks
=
1
;
}
if
(
taosMkDir
(
pDnode
->
dir
.
vnodes
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
vnodes
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
pDnode
->
pTfs
=
tfsOpen
(
pDisks
,
numOfDisks
);
if
(
pDnode
->
pTfs
==
NULL
)
{
dError
(
"failed to init tfs since %s"
,
terrstr
()
);
return
-
1
;
}
if
(
taosMkDir
(
pDnode
->
dir
.
snode
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
snode
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
if
(
dndInitMgmt
(
pDnode
)
!=
0
)
{
dError
(
"failed to init mgmt since %s"
,
terrstr
());
return
-
1
;
}
if
(
taosMkDir
(
pDnode
->
dir
.
bnode
)
!=
0
)
{
dError
(
"failed to create dir:%s since %s"
,
pDnode
->
dir
.
bnode
,
strerror
(
errno
));
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
if
(
dndInitTrans
(
pDnode
)
!=
0
)
{
dError
(
"failed to init transport since %s"
,
terrstr
());
return
-
1
;
}
memcpy
(
&
pDnode
->
cfg
,
pCfg
,
sizeof
(
SDndCfg
));
dndSetStatus
(
pDnode
,
DND_STAT_RUNNING
);
dndSendStatusReq
(
pDnode
);
dndReportStartup
(
pDnode
,
"TDengine"
,
"initialized successfully"
);
return
0
;
}
static
void
dndCloseDir
(
SDnode
*
pDnode
)
{
tfree
(
pDnode
->
dir
.
mnode
);
tfree
(
pDnode
->
dir
.
vnodes
);
tfree
(
pDnode
->
dir
.
dnode
);
tfree
(
pDnode
->
dir
.
snode
);
tfree
(
pDnode
->
dir
.
bnode
);
if
(
pDnode
->
pLockFile
!=
NULL
)
{
taosUnLockFile
(
pDnode
->
pLockFile
);
taosCloseFile
(
&
pDnode
->
pLockFile
);
pDnode
->
pLockFile
=
NULL
;
}
static
void
dndClearDnodeResource
(
SDnode
*
pDnode
)
{
dndCleanupTrans
(
pDnode
);
dndStopMgmt
(
pDnode
);
tfsClose
(
pDnode
->
pTfs
);
dDebug
(
"dnode object resource is cleared, data:%p"
,
pDnode
);
}
SDnode
*
dndCreate
(
SDndCfg
*
pCfg
)
{
dInfo
(
"start to create dnode object"
);
int32_t
code
=
-
1
;
char
path
[
PATH_MAX
+
100
];
SDnode
*
pDnode
=
NULL
;
SDnode
*
pDnode
=
calloc
(
1
,
sizeof
(
SDnode
));
pDnode
=
calloc
(
1
,
sizeof
(
SDnode
));
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
dError
(
"failed to create dnode object since %s"
,
terrstr
());
return
NULL
;
goto
_OVER
;
}
dndSetStatus
(
pDnode
,
DND_STAT_INIT
);
pDnode
->
mgmts
[
MNODE
].
fp
=
mmGetNodeFp
();
pDnode
->
mgmts
[
VNODES
].
fp
=
vndGetNodeFp
();
pDnode
->
mgmts
[
QNODE
].
fp
=
qndGetNodeFp
();
pDnode
->
mgmts
[
SNODE
].
fp
=
sndGetNodeFp
();
pDnode
->
mgmts
[
BNODE
].
fp
=
bndGetNodeFp
();
pDnode
->
mgmts
[
MNODE
].
name
=
"mnode"
;
pDnode
->
mgmts
[
VNODES
].
name
=
"vnodes"
;
pDnode
->
mgmts
[
QNODE
].
name
=
"qnode"
;
pDnode
->
mgmts
[
SNODE
].
name
=
"snode"
;
pDnode
->
mgmts
[
BNODE
].
name
=
"bnode"
;
memcpy
(
&
pDnode
->
cfg
,
pCfg
,
sizeof
(
SDndCfg
));
if
(
dndInitDir
(
pDnode
,
pCfg
)
!=
0
)
{
dError
(
"failed to init dnode dir since %s"
,
terrstr
());
dndClose
(
pDnode
);
return
NULL
;
for
(
ENodeType
n
=
0
;
n
<
NODE_MAX
;
++
n
)
{
SMgmtWrapper
*
pMgmt
=
&
pDnode
->
mgmts
[
n
];
snprintf
(
path
,
sizeof
(
path
),
"%s%s%s"
,
pCfg
->
dataDir
,
TD_DIRSEP
,
pDnode
->
mgmts
[
n
].
name
);
pMgmt
->
path
=
strdup
(
path
);
if
(
pDnode
->
mgmts
[
n
].
path
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
pMgmt
->
procType
=
PROC_SINGLE
;
pMgmt
->
required
=
dndRequireOpenNode
(
pMgmt
);
if
(
pMgmt
->
required
)
{
if
(
taosMkDir
(
pMgmt
->
path
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
dError
(
"failed to create dir:%s since %s"
,
pMgmt
->
path
,
terrstr
());
goto
_OVER
;
}
}
}
SDiskCfg
dCfg
=
{
0
};
tstrncpy
(
dCfg
.
dir
,
pDnode
->
cfg
.
dataDir
,
TSDB_FILENAME_LEN
);
dCfg
.
level
=
0
;
dCfg
.
primary
=
1
;
SDiskCfg
*
pDisks
=
pDnode
->
cfg
.
pDisks
;
int32_t
numOfDisks
=
pDnode
->
cfg
.
numOfDisks
;
if
(
numOfDisks
<=
0
||
pDisks
==
NULL
)
{
pDisks
=
&
dCfg
;
numOfDisks
=
1
;
pDnode
->
pLockFile
=
dndCheckRunning
(
pCfg
->
dataDir
);
if
(
pDnode
->
pLockFile
==
NULL
)
{
goto
_OVER
;
}
pDnode
->
pTfs
=
tfsOpen
(
pDisks
,
numOfDisks
);
if
(
pDnode
->
pTfs
==
NULL
)
{
dError
(
"failed to init tfs since %s"
,
terrstr
()
);
d
ndClose
(
pDnode
);
return
NULL
;
snprintf
(
path
,
sizeof
(
path
),
"%s%sdnode"
,
pCfg
->
dataDir
,
TD_DIRSEP
);
if
(
taosMkDir
(
path
)
!=
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
d
Error
(
"failed to create dir:%s since %s"
,
path
,
terrstr
()
);
goto
_OVER
;
}
if
(
dndInitMgmt
(
pDnode
)
!=
0
)
{
dError
(
"failed to init mgmt since %s"
,
terrstr
());
dndClose
(
pDnode
);
return
NULL
;
_OVER:
if
(
code
!=
0
&&
pDnode
)
{
dndClearDnodeMem
(
pDnode
);
tfree
(
pDnode
);
dError
(
"failed to create dnode object since %s"
,
terrstr
());
}
else
{
dInfo
(
"dnode object is created, data:%p"
,
pDnode
);
}
return
pDnode
;
}
#if 0
if (dndInitVnodes(pDnode) != 0) {
dError("failed to init vnodes since %s", terrstr());
dndClose(pDnode);
...
...
@@ -173,19 +232,18 @@ SDnode *dndCreate(SDndCfg *pCfg) {
return NULL;
}
if
(
dndInitTrans
(
pDnode
)
!=
0
)
{
dError
(
"failed to init transport since %s"
,
terrstr
());
dndClose
(
pDnode
);
return
NULL
;
}
dndSetStatus
(
pDnode
,
DND_STAT_RUNNING
);
dndSendStatusReq
(
pDnode
);
dndReportStartup
(
pDnode
,
"TDengine"
,
"initialized successfully"
);
dInfo
(
"dnode object is created, data:%p"
,
pDnode
);
// mmCleanup(pDnode);
// dndCleanupBnode(pDnode);
// dndCleanupSnode(pDnode);
// dndCleanupQnode(pDnode);
// dndCleanupVnodes(pDnode);
// dndCleanupMgmt(pDnode);
return pDnode;
}
#endif
void
dndClose
(
SDnode
*
pDnode
)
{
if
(
pDnode
==
NULL
)
return
;
...
...
@@ -197,18 +255,10 @@ void dndClose(SDnode *pDnode) {
dInfo
(
"start to close dnode, data:%p"
,
pDnode
);
dndSetStatus
(
pDnode
,
DND_STAT_STOPPED
);
dndCleanupTrans
(
pDnode
);
dndStopMgmt
(
pDnode
);
mmCleanup
(
pDnode
);
dndCleanupBnode
(
pDnode
);
dndCleanupSnode
(
pDnode
);
dndCleanupQnode
(
pDnode
);
dndCleanupVnodes
(
pDnode
);
dndCleanupMgmt
(
pDnode
);
tfsClose
(
pDnode
->
pTfs
);
dndCloseDir
(
pDnode
);
free
(
pDnode
);
dndClearDnodeResource
(
pDnode
);
dndClearDnodeMem
(
pDnode
);
tfree
(
pDnode
);
dInfo
(
"dnode object is closed, data:%p"
,
pDnode
);
}
...
...
@@ -275,5 +325,3 @@ void dndRun(SDnode *pDnode) {
taosMsleep
(
100
);
}
}
void
dndeHandleEvent
(
SDnode
*
pDnode
,
EDndEvent
event
)
{
pDnode
->
event
=
event
;
}
\ No newline at end of file
source/dnode/mgmt/
impl
/src/dndMgmt.c
→
source/dnode/mgmt/
dnode
/src/dndMgmt.c
浏览文件 @
f40383e4
...
...
@@ -187,7 +187,6 @@ static int32_t dndReadDnodes(SDnode *pDnode) {
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
cJSON
*
root
=
NULL
;
// fp = fopen(pMgmt->file, "r");
TdFilePtr
pFile
=
taosOpenFile
(
pMgmt
->
file
,
TD_FILE_READ
);
if
(
pFile
==
NULL
)
{
dDebug
(
"file %s not exist"
,
pMgmt
->
file
);
...
...
@@ -310,7 +309,6 @@ PRASE_DNODE_OVER:
static
int32_t
dndWriteDnodes
(
SDnode
*
pDnode
)
{
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
// FILE *fp = fopen(pMgmt->file, "w");
TdFilePtr
pFile
=
taosOpenFile
(
pMgmt
->
file
,
TD_FILE_CTEATE
|
TD_FILE_WRITE
|
TD_FILE_TRUNC
);
if
(
pFile
==
NULL
)
{
dError
(
"failed to write %s since %s"
,
pMgmt
->
file
,
strerror
(
errno
));
...
...
source/dnode/mgmt/dnode/src/dndMonitor.c
0 → 100644
浏览文件 @
f40383e4
/*
* 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/>.
*/
#define _DEFAULT_SOURCE
#include "dndMonitor.h"
int32_t
dndGetMonitorDiskInfo
(
SDnode
*
pDnode
,
SMonDiskInfo
*
pInfo
)
{
tstrncpy
(
pInfo
->
logdir
.
name
,
tsLogDir
,
sizeof
(
pInfo
->
logdir
.
name
));
pInfo
->
logdir
.
size
=
tsLogSpace
.
size
;
tstrncpy
(
pInfo
->
tempdir
.
name
,
tsTempDir
,
sizeof
(
pInfo
->
tempdir
.
name
));
pInfo
->
tempdir
.
size
=
tsTempSpace
.
size
;
if
(
pDnode
->
pTfs
!=
NULL
)
{
return
tfsGetMonitorInfo
(
NULL
,
pInfo
);
}
return
0
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录