Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
木子87
TDengine
提交
dfafa1be
T
TDengine
项目概览
木子87
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dfafa1be
编写于
2月 20, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reorganize the file mgmtSystem.c
上级
23693d9c
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
72 addition
and
98 deletion
+72
-98
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+8
-8
src/inc/mnode.h
src/inc/mnode.h
+3
-6
src/mnode/inc/mgmtSystem.h
src/mnode/inc/mgmtSystem.h
+0
-1
src/mnode/src/mgmtDb.c
src/mnode/src/mgmtDb.c
+1
-1
src/mnode/src/mgmtDnodeInt.c
src/mnode/src/mgmtDnodeInt.c
+2
-2
src/mnode/src/mgmtShell.c
src/mnode/src/mgmtShell.c
+7
-7
src/mnode/src/mgmtSuperTable.c
src/mnode/src/mgmtSuperTable.c
+1
-1
src/mnode/src/mgmtSystem.c
src/mnode/src/mgmtSystem.c
+45
-67
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+1
-1
src/mnode/src/mgmtVgroup.c
src/mnode/src/mgmtVgroup.c
+2
-2
src/util/inc/tglobalcfg.h
src/util/inc/tglobalcfg.h
+1
-1
src/vnode/detail/inc/vnode.h
src/vnode/detail/inc/vnode.h
+1
-1
未找到文件。
src/dnode/src/dnodeSystem.c
浏览文件 @
dfafa1be
...
...
@@ -85,6 +85,8 @@ void dnodeSetRunStatus(SDnodeRunStatus status) {
}
void
dnodeCleanUpSystem
()
{
tclearModuleStatus
(
TSDB_MOD_MGMT
);
if
(
dnodeGetRunStatus
()
==
TSDB_DNODE_RUN_STATUS_STOPPED
)
{
return
;
}
else
{
...
...
@@ -131,29 +133,27 @@ void dnodeInitPlugins() {
}
int32_t
dnodeInitSystem
()
{
char
temp
[
128
]
;
struct
stat
dirstat
;
tsRebootTime
=
taosGetTimestampSec
()
;
tscEmbedded
=
1
;
dnodeSetRunStatus
(
TSDB_DNODE_RUN_STATUS_INITIALIZE
);
taosResolveCRC
();
tsRebootTime
=
taosGetTimestampSec
();
tscEmbedded
=
1
;
// Read global configuration.
tsReadGlobalLogConfig
();
struct
stat
dirstat
;
if
(
stat
(
logDir
,
&
dirstat
)
<
0
)
{
mkdir
(
logDir
,
0755
);
}
char
temp
[
128
];
sprintf
(
temp
,
"%s/taosdlog"
,
logDir
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
1
)
<
0
)
{
printf
(
"failed to init log file
\n
"
);
}
if
(
!
tsReadGlobalConfig
())
{
// TODO : Change this function
if
(
!
tsReadGlobalConfig
())
{
tsPrintGlobalConfig
();
dError
(
"TDengine read global config failed"
);
return
-
1
;
...
...
@@ -249,7 +249,7 @@ int32_t dnodeInitStorageImp() {
sprintf
(
fileName
,
"%s/data"
,
tsDirectory
);
mkdir
(
fileName
,
0755
);
sprintf
(
m
gmtDirectory
,
"%s/mgmt"
,
tsDirectory
);
sprintf
(
tsM
gmtDirectory
,
"%s/mgmt"
,
tsDirectory
);
sprintf
(
tsDirectory
,
"%s/tsdb"
,
dataDir
);
dnodeCheckDataDirOpenned
(
dataDir
);
...
...
src/inc/mnode.h
浏览文件 @
dfafa1be
...
...
@@ -43,12 +43,9 @@ extern "C" {
// internal globals
extern
char
version
[];
extern
void
*
mgmtTmr
;
extern
void
*
mgmtQhandle
;
extern
void
*
mgmtTranQhandle
;
extern
int
mgmtShellConns
;
extern
int
mgmtDnodeConns
;
extern
char
mgmtDirectory
[];
extern
void
*
tsMgmtTmr
;
extern
void
*
tsMgmtTranQhandle
;
extern
char
tsMgmtDirectory
[];
extern
int
tsAcctUpdateSize
;
extern
int
tsDbUpdateSize
;
...
...
src/mnode/inc/mgmtSystem.h
浏览文件 @
dfafa1be
...
...
@@ -28,7 +28,6 @@ void mgmtCleanUpSystem();
extern
int32_t
(
*
mgmtInitSystem
)();
extern
int32_t
(
*
mgmtCheckMgmtRunning
)();
extern
void
(
*
mgmtDoStatistic
)(
void
*
handle
,
void
*
tmrId
);
extern
void
(
*
mgmtStartMgmtTimer
)();
extern
void
(
*
mgmtStopSystem
)();
extern
void
(
*
mgmtCleanUpRedirect
)();
...
...
src/mnode/src/mgmtDb.c
浏览文件 @
dfafa1be
...
...
@@ -83,7 +83,7 @@ int32_t mgmtInitDbs() {
mgmtDbActionInit
();
dbSdb
=
sdbOpenTable
(
tsMaxDbs
,
sizeof
(
SDbObj
),
"db"
,
SDB_KEYTYPE_STRING
,
m
gmtDirectory
,
mgmtDbAction
);
dbSdb
=
sdbOpenTable
(
tsMaxDbs
,
sizeof
(
SDbObj
),
"db"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtDbAction
);
if
(
dbSdb
==
NULL
)
{
mError
(
"failed to init db data"
);
return
-
1
;
...
...
src/mnode/src/mgmtDnodeInt.c
浏览文件 @
dfafa1be
...
...
@@ -556,7 +556,7 @@ void mgmtProcessDnodeStatusImp(void *handle, void *tmrId) {
pVload->dropStatus = TSDB_VN_DROP_STATUS_READY;
pVload->status = TSDB_VN_STATUS_OFFLINE;
mPrint("dnode:%s, vid:%d, drop finished", taosIpStr(pObj->privateIp), vnode);
taosTmrStart(mgmtMonitorDbDrop, 10000, NULL,
m
gmtTmr);
taosTmrStart(mgmtMonitorDbDrop, 10000, NULL,
tsM
gmtTmr);
}
}
...
...
@@ -590,7 +590,7 @@ void mgmtProcessDnodeStatusImp(void *handle, void *tmrId) {
}
}
taosTmrReset(mgmtProcessDnodeStatus, tsStatusInterval * 1000, NULL,
m
gmtTmr, &mgmtStatusTimer);
taosTmrReset(mgmtProcessDnodeStatus, tsStatusInterval * 1000, NULL,
tsM
gmtTmr, &mgmtStatusTimer);
if (mgmtStatusTimer == NULL) {
mError("Failed to start status timer");
}
...
...
src/mnode/src/mgmtShell.c
浏览文件 @
dfafa1be
...
...
@@ -46,7 +46,7 @@ static RetrieveMetaFp* mgmtRetrieveFp;
static
void
mgmtInitShowMsgFp
();
void
*
p
ShellConn
=
NULL
;
void
*
ts
ShellConn
=
NULL
;
SConnObj
*
connList
;
void
*
mgmtProcessMsgFromShell
(
char
*
msg
,
void
*
ahandle
,
void
*
thandle
);
int
(
*
mgmtProcessShellMsg
[
TSDB_MSG_TYPE_MAX
])(
char
*
,
int
,
SConnObj
*
);
...
...
@@ -95,8 +95,8 @@ int mgmtInitShell() {
rpcInit
.
idleTime
=
tsShellActivityTimer
*
2000
;
rpcInit
.
afp
=
mgmtRetriveUserAuthInfo
;
p
ShellConn
=
rpcOpen
(
&
rpcInit
);
if
(
p
ShellConn
==
NULL
)
{
ts
ShellConn
=
rpcOpen
(
&
rpcInit
);
if
(
ts
ShellConn
==
NULL
)
{
mError
(
"failed to init tcp connection to shell"
);
return
-
1
;
}
...
...
@@ -105,9 +105,9 @@ int mgmtInitShell() {
}
void
mgmtCleanUpShell
()
{
if
(
p
ShellConn
)
{
rpcClose
(
p
ShellConn
);
p
ShellConn
=
NULL
;
if
(
ts
ShellConn
)
{
rpcClose
(
ts
ShellConn
);
ts
ShellConn
=
NULL
;
}
tfree
(
connList
);
}
...
...
@@ -1489,7 +1489,7 @@ void *mgmtProcessMsgFromShell(char *msg, void *ahandle, void *thandle) {
// schedMsg.tfp = NULL;
// schedMsg.thandle = pConn;
//
// taosScheduleTask(
m
gmtTranQhandle, &schedMsg);
// taosScheduleTask(
tsM
gmtTranQhandle, &schedMsg);
// } else {
// mError("%s from shell is not processed", taosMsg[pMsg->msgType]);
// }
...
...
src/mnode/src/mgmtSuperTable.c
浏览文件 @
dfafa1be
...
...
@@ -175,7 +175,7 @@ int32_t mgmtInitSuperTables() {
mgmtSuperTableActionInit
();
tsSuperTableSdb
=
sdbOpenTable
(
tsMaxTables
,
sizeof
(
STabObj
)
+
sizeof
(
SSchema
)
*
TSDB_MAX_COLUMNS
+
TSDB_MAX_SQL_LEN
,
"meters"
,
SDB_KEYTYPE_STRING
,
m
gmtDirectory
,
mgmtSuperTableAction
);
"meters"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtSuperTableAction
);
if
(
tsSuperTableSdb
==
NULL
)
{
mError
(
"failed to init meter data"
);
return
-
1
;
...
...
src/mnode/src/mgmtSystem.c
浏览文件 @
dfafa1be
...
...
@@ -15,8 +15,8 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "
dnodeSystem
.h"
#include "taosdef.h"
#include "
tsched
.h"
#include "mnode.h"
#include "mgmtAcct.h"
#include "mgmtBalance.h"
...
...
@@ -29,60 +29,39 @@
#include "mgmtTable.h"
#include "mgmtShell.h"
#include "dnodeModule.h"
#include "taosdef.h"
// global, not configurable
char
mgmtDirectory
[
128
];
void
*
mgmtTmr
;
void
*
mgmtQhandle
=
NULL
;
void
*
mgmtTranQhandle
=
NULL
;
void
*
mgmtStatisticTimer
=
NULL
;
int
mgmtShellConns
=
0
;
int
mgmtDnodeConns
=
0
;
extern
void
*
pShellConn
;
extern
void
**
tsRpcQhandle
;
extern
SMgmtIpList
mgmtIpList
;
extern
SMgmtIpList
mgmtPublicIpList
;
extern
char
mgmtIpStr
[
TSDB_MAX_MGMT_IPS
][
20
];
extern
void
*
acctSdb
;
char
tsMgmtDirectory
[
128
]
=
{
0
};
void
*
tsMgmtTmr
=
NULL
;
void
*
tsMgmtTranQhandle
=
NULL
;
void
*
tsMgmtStatisTimer
=
NULL
;
void
mgmtCleanUpSystem
()
{
if
(
tsModuleStatus
&
(
1
<<
TSDB_MOD_MGMT
))
{
mTrace
(
"mgmt is running, clean it up"
);
taosTmrStopA
(
&
mgmtStatisticTimer
);
sdbCleanUpPeers
();
mgmtCleanupBalance
();
mgmtCleanUpDnodeInt
();
mgmtCleanUpShell
();
mgmtCleanUpMeters
();
mgmtCleanUpVgroups
();
mgmtCleanUpDbs
();
mgmtCleanUpDnodes
();
mgmtCleanUpUsers
();
mgmtCleanUpAccts
();
taosTmrCleanUp
(
mgmtTmr
);
taosCleanUpScheduler
(
mgmtQhandle
);
taosCleanUpScheduler
(
mgmtTranQhandle
);
}
else
{
mgmtCleanUpRedirect
();
}
mgmtTmr
=
NULL
;
mgmtQhandle
=
NULL
;
mgmtShellConns
=
0
;
mgmtDnodeConns
=
0
;
tclearModuleStatus
(
TSDB_MOD_MGMT
);
pShellConn
=
NULL
;
mTrace
(
"mgmt is cleaned up"
);
mPrint
(
"starting to clean up mgmt"
);
taosTmrStopA
(
&
tsMgmtStatisTimer
);
mgmtCleanUpRedirect
();
sdbCleanUpPeers
();
mgmtCleanupBalance
();
mgmtCleanUpDnodeInt
();
mgmtCleanUpShell
();
mgmtCleanUpMeters
();
mgmtCleanUpVgroups
();
mgmtCleanUpDbs
();
mgmtCleanUpDnodes
();
mgmtCleanUpUsers
();
mgmtCleanUpAccts
();
taosTmrCleanUp
(
tsMgmtTmr
);
taosCleanUpScheduler
(
tsMgmtTranQhandle
);
mPrint
(
"mgmt is cleaned up"
);
}
int
mgmtStartSystem
()
{
int
32_t
mgmtStartSystem
()
{
mPrint
(
"starting to initialize TDengine mgmt ..."
);
struct
stat
dirstat
;
if
(
stat
(
m
gmtDirectory
,
&
dirstat
)
<
0
)
{
mkdir
(
m
gmtDirectory
,
0755
);
if
(
stat
(
tsM
gmtDirectory
,
&
dirstat
)
<
0
)
{
mkdir
(
tsM
gmtDirectory
,
0755
);
}
if
(
mgmtCheckMgmtRunning
()
!=
0
)
{
...
...
@@ -90,14 +69,10 @@ int mgmtStartSystem() {
return
0
;
}
int
numOfThreads
=
tsNumOfCores
*
tsNumOfThreadsPerCore
/
2
.
0
;
if
(
numOfThreads
<
1
)
numOfThreads
=
1
;
mgmtQhandle
=
taosInitScheduler
(
tsMaxDnodes
+
tsMaxShellConns
,
numOfThreads
,
"mnode"
);
mgmtTranQhandle
=
taosInitScheduler
(
tsMaxDnodes
+
tsMaxShellConns
,
1
,
"mnodeT"
);
tsMgmtTranQhandle
=
taosInitScheduler
(
tsMaxDnodes
+
tsMaxShellConns
,
1
,
"mnodeT"
);
m
gmtTmr
=
taosTmrInit
((
tsMaxDnodes
+
tsMaxShellConns
)
*
3
,
200
,
3600000
,
"MND"
);
if
(
m
gmtTmr
==
NULL
)
{
tsM
gmtTmr
=
taosTmrInit
((
tsMaxDnodes
+
tsMaxShellConns
)
*
3
,
200
,
3600000
,
"MND"
);
if
(
tsM
gmtTmr
==
NULL
)
{
mError
(
"failed to init timer, exit"
);
return
-
1
;
}
...
...
@@ -142,7 +117,7 @@ int mgmtStartSystem() {
return
-
1
;
}
if
(
sdbInitPeers
(
m
gmtDirectory
)
<
0
)
{
if
(
sdbInitPeers
(
tsM
gmtDirectory
)
<
0
)
{
mError
(
"failed to init peers"
);
return
-
1
;
}
...
...
@@ -153,9 +128,7 @@ int mgmtStartSystem() {
mgmtCheckAcct
();
taosTmrReset
(
mgmtDoStatistic
,
tsStatusInterval
*
30000
,
NULL
,
mgmtTmr
,
&
mgmtStatisticTimer
);
mgmtStartMgmtTimer
();
taosTmrReset
(
mgmtDoStatistic
,
tsStatusInterval
*
30000
,
NULL
,
tsMgmtTmr
,
&
tsMgmtStatisTimer
);
mPrint
(
"TDengine mgmt is initialized successfully"
);
...
...
@@ -163,26 +136,31 @@ int mgmtStartSystem() {
}
int32_t
mgmtInitSystemImp
()
{
return
mgmtStartSystem
();
int32_t
code
=
mgmtStartSystem
();
if
(
code
!=
0
)
{
return
code
;
}
taosTmrReset
(
mgmtProcessDnodeStatus
,
500
,
NULL
,
tsMgmtTmr
,
&
mgmtStatusTimer
);
return
code
;
}
int32_t
(
*
mgmtInitSystem
)()
=
mgmtInitSystemImp
;
int32_t
mgmtCheckMgmtRunningImp
()
{
return
0
;
}
int32_t
mgmtCheckMgmtRunningImp
()
{
return
0
;
}
int32_t
(
*
mgmtCheckMgmtRunning
)()
=
mgmtCheckMgmtRunningImp
;
void
mgmtDoStatisticImp
(
void
*
handle
,
void
*
tmrId
)
{}
void
(
*
mgmtDoStatistic
)(
void
*
handle
,
void
*
tmrId
)
=
mgmtDoStatisticImp
;
void
mgmtStartMgmtTimerImp
()
{
taosTmrReset
(
mgmtProcessDnodeStatus
,
500
,
NULL
,
mgmtTmr
,
&
mgmtStatusTimer
);
}
void
(
*
mgmtStartMgmtTimer
)()
=
mgmtStartMgmtTimerImp
;
void
(
*
mgmtDoStatistic
)(
void
*
handle
,
void
*
tmrId
)
=
mgmtDoStatisticImp
;
void
mgmtStopSystemImp
()
{}
void
(
*
mgmtStopSystem
)()
=
mgmtStopSystemImp
;
void
mgmtCleanUpRedirectImp
()
{}
void
(
*
mgmtCleanUpRedirect
)()
=
mgmtCleanUpRedirectImp
;
void
(
*
mgmtCleanUpRedirect
)()
=
mgmtCleanUpRedirectImp
;
src/mnode/src/mgmtUser.c
浏览文件 @
dfafa1be
...
...
@@ -68,7 +68,7 @@ int mgmtInitUsers() {
mgmtUserActionInit
();
userSdb
=
sdbOpenTable
(
tsMaxUsers
,
sizeof
(
SUserObj
),
"user"
,
SDB_KEYTYPE_STRING
,
m
gmtDirectory
,
mgmtUserAction
);
userSdb
=
sdbOpenTable
(
tsMaxUsers
,
sizeof
(
SUserObj
),
"user"
,
SDB_KEYTYPE_STRING
,
tsM
gmtDirectory
,
mgmtUserAction
);
if
(
userSdb
==
NULL
)
{
mError
(
"failed to init user data"
);
return
-
1
;
...
...
src/mnode/src/mgmtVgroup.c
浏览文件 @
dfafa1be
...
...
@@ -76,7 +76,7 @@ int mgmtInitVgroups() {
SVgObj
tObj
;
tsVgUpdateSize
=
tObj
.
updateEnd
-
(
int8_t
*
)
&
tObj
;
vgSdb
=
sdbOpenTable
(
tsMaxVGroups
,
sizeof
(
SVgObj
),
"vgroups"
,
SDB_KEYTYPE_AUTO
,
m
gmtDirectory
,
mgmtVgroupAction
);
vgSdb
=
sdbOpenTable
(
tsMaxVGroups
,
sizeof
(
SVgObj
),
"vgroups"
,
SDB_KEYTYPE_AUTO
,
tsM
gmtDirectory
,
mgmtVgroupAction
);
if
(
vgSdb
==
NULL
)
{
mError
(
"failed to init vgroup data"
);
return
-
1
;
...
...
@@ -205,7 +205,7 @@ SVgObj *mgmtCreateVgroup(SDbObj *pDb) {
mError
(
"db:%s, no enough free dnode to alloc %d vnodes"
,
pDb
->
name
,
pVgroup
->
numOfVnodes
);
free
(
pVgroup
);
pDb
->
vgStatus
=
TSDB_VG_STATUS_FULL
;
taosTmrReset
(
mgmtProcessVgTimer
,
5000
,
pDb
,
m
gmtTmr
,
&
pDb
->
vgTimer
);
taosTmrReset
(
mgmtProcessVgTimer
,
5000
,
pDb
,
tsM
gmtTmr
,
&
pDb
->
vgTimer
);
return
NULL
;
}
...
...
src/util/inc/tglobalcfg.h
浏览文件 @
dfafa1be
...
...
@@ -262,7 +262,7 @@ SGlobalConfig *tsGetConfigOption(const char *option);
#define NEEDTO_COMPRESSS_MSG(size) (tsCompressMsgSize != -1 && (size) > tsCompressMsgSize)
extern
char
m
gmtDirectory
[];
extern
char
tsM
gmtDirectory
[];
#ifdef __cplusplus
...
...
src/vnode/detail/inc/vnode.h
浏览文件 @
dfafa1be
...
...
@@ -564,7 +564,7 @@ extern int (*pDecompFunc[])(const char *const input, int compressedSize, const i
// global variable and APIs provided by mgmt
extern
char
mgmtStatus
;
extern
char
m
gmtDirectory
[];
extern
char
tsM
gmtDirectory
[];
extern
const
int16_t
vnodeFileVersion
;
#ifdef __cplusplus
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录