Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
59dc24f7
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
59dc24f7
编写于
10月 16, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact mnodeInt
上级
8f4da154
变更
33
隐藏空白更改
内联
并排
Showing
33 changed file
with
877 addition
and
27 deletion
+877
-27
include/common/taosmsg.h
include/common/taosmsg.h
+2
-6
include/util/taoserror.h
include/util/taoserror.h
+3
-0
include/util/tstep.h
include/util/tstep.h
+5
-4
source/server/mnode/inc/mnodeAcct.h
source/server/mnode/inc/mnodeAcct.h
+29
-0
source/server/mnode/inc/mnodeAuth.h
source/server/mnode/inc/mnodeAuth.h
+29
-0
source/server/mnode/inc/mnodeBalance.h
source/server/mnode/inc/mnodeBalance.h
+29
-0
source/server/mnode/inc/mnodeCluster.h
source/server/mnode/inc/mnodeCluster.h
+29
-0
source/server/mnode/inc/mnodeDb.h
source/server/mnode/inc/mnodeDb.h
+29
-0
source/server/mnode/inc/mnodeDef.h
source/server/mnode/inc/mnodeDef.h
+29
-0
source/server/mnode/inc/mnodeDnode.h
source/server/mnode/inc/mnodeDnode.h
+29
-0
source/server/mnode/inc/mnodeInt.h
source/server/mnode/inc/mnodeInt.h
+11
-5
source/server/mnode/inc/mnodeMnode.h
source/server/mnode/inc/mnodeMnode.h
+29
-0
source/server/mnode/inc/mnodeSdb.h
source/server/mnode/inc/mnodeSdb.h
+12
-11
source/server/mnode/inc/mnodeSync.h
source/server/mnode/inc/mnodeSync.h
+29
-0
source/server/mnode/inc/mnodeTable.h
source/server/mnode/inc/mnodeTable.h
+29
-0
source/server/mnode/inc/mnodeUser.h
source/server/mnode/inc/mnodeUser.h
+29
-0
source/server/mnode/inc/mnodeVgroup.h
source/server/mnode/inc/mnodeVgroup.h
+29
-0
source/server/mnode/inc/mnodeWorker.h
source/server/mnode/inc/mnodeWorker.h
+29
-0
source/server/mnode/src/mnodeAcct.c
source/server/mnode/src/mnodeAcct.c
+18
-0
source/server/mnode/src/mnodeAuth.c
source/server/mnode/src/mnodeAuth.c
+18
-0
source/server/mnode/src/mnodeBalance.c
source/server/mnode/src/mnodeBalance.c
+18
-0
source/server/mnode/src/mnodeCluster.c
source/server/mnode/src/mnodeCluster.c
+18
-0
source/server/mnode/src/mnodeDb.c
source/server/mnode/src/mnodeDb.c
+18
-0
source/server/mnode/src/mnodeDnode.c
source/server/mnode/src/mnodeDnode.c
+18
-0
source/server/mnode/src/mnodeMnode.c
source/server/mnode/src/mnodeMnode.c
+18
-0
source/server/mnode/src/mnodeSdb.c
source/server/mnode/src/mnodeSdb.c
+18
-0
source/server/mnode/src/mnodeSync.c
source/server/mnode/src/mnodeSync.c
+18
-0
source/server/mnode/src/mnodeTable.c
source/server/mnode/src/mnodeTable.c
+18
-0
source/server/mnode/src/mnodeUser.c
source/server/mnode/src/mnodeUser.c
+18
-0
source/server/mnode/src/mnodeVgruop.c
source/server/mnode/src/mnodeVgruop.c
+18
-0
source/server/mnode/src/mnodeWorker.c
source/server/mnode/src/mnodeWorker.c
+18
-0
source/server/mnode/src/mondeInt.c
source/server/mnode/src/mondeInt.c
+232
-0
source/util/src/tstep.c
source/util/src/tstep.c
+1
-1
未找到文件。
include/common/taosmsg.h
浏览文件 @
59dc24f7
...
...
@@ -361,6 +361,8 @@ typedef struct {
}
SConnectRsp
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
int32_t
maxUsers
;
int32_t
maxDbs
;
int32_t
maxTimeSeries
;
...
...
@@ -372,12 +374,6 @@ typedef struct {
int64_t
maxInbound
;
int64_t
maxOutbound
;
int8_t
accessState
;
// Configured only by command
}
SAcctCfg
;
typedef
struct
{
char
user
[
TSDB_USER_LEN
];
char
pass
[
TSDB_KEY_LEN
];
SAcctCfg
cfg
;
}
SCreateAcctMsg
,
SAlterAcctMsg
;
typedef
struct
{
...
...
include/util/taoserror.h
浏览文件 @
59dc24f7
...
...
@@ -166,6 +166,9 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_NO_USER_FROM_CONN TAOS_DEF_ERROR_CODE(0, 0x0354) //"Can not get user from conn")
#define TSDB_CODE_MND_TOO_MANY_USERS TAOS_DEF_ERROR_CODE(0, 0x0355) //"Too many users")
#define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0348) //"Mnode already exists")
#define TSDB_CODE_MND_MNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0349) //"Mnode not there")
#define TSDB_CODE_MND_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360) //"Table already exists")
#define TSDB_CODE_MND_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0361) //"Table name too long")
#define TSDB_CODE_MND_INVALID_TABLE_NAME TAOS_DEF_ERROR_CODE(0, 0x0362) //"Table does not exist")
...
...
include/util/tstep.h
浏览文件 @
59dc24f7
...
...
@@ -20,14 +20,15 @@
extern
"C"
{
#endif
typedef
struct
SSteps
SSteps
;
typedef
int32_t
(
*
InitFp
)();
typedef
void
(
*
CleanupFp
)();
typedef
void
(
*
ReportFp
)(
char
*
name
,
char
*
desc
);
struct
SSteps
*
taosStepInit
(
int32_t
maxsize
,
ReportFp
fp
);
int32_t
taosStepExec
(
struct
SSteps
*
steps
);
void
taosStepCleanup
(
struct
SSteps
*
steps
);
int32_t
taosStepAdd
(
struct
SSteps
*
steps
,
char
*
name
,
InitFp
initFp
,
CleanupFp
cleanupFp
);
SSteps
*
taosStepInit
(
int32_t
maxsize
,
ReportFp
fp
);
int32_t
taosStepExec
(
SSteps
*
steps
);
void
taosStepCleanup
(
SSteps
*
steps
);
int32_t
taosStepAdd
(
SSteps
*
steps
,
char
*
name
,
InitFp
initFp
,
CleanupFp
cleanupFp
);
#ifdef __cplusplus
}
...
...
source/server/mnode/inc/mnodeAcct.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_ACCT_H_
#define _TD_MNODE_ACCT_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_ACCT_H_*/
source/server/mnode/inc/mnodeAuth.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_AUTH_H_
#define _TD_MNODE_AUTH_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_AUTH_H_*/
source/server/mnode/inc/mnodeBalance.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_BALANCE_H_
#define _TD_MNODE_BALANCE_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_BALANCE_H_*/
source/server/mnode/inc/mnodeCluster.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_CLUSTER_H_
#define _TD_MNODE_CLUSTER_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_CLUSTER_H_*/
source/server/mnode/inc/mnodeDb.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_DATABASE_H_
#define _TD_MNODE_DATABASE_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_DATABASE_H_*/
source/server/mnode/inc/mnodeDef.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_DEF_H_
#define _TD_MNODE_DEF_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_DEF_H_*/
source/server/mnode/inc/mnodeDnode.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_DNODE_H_
#define _TD_MNODE_DNODE_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_DNODE_H_*/
source/server/mnode/inc/mnodeInt.h
浏览文件 @
59dc24f7
...
...
@@ -16,17 +16,23 @@
#ifndef _TD_MNODE_INT_H_
#define _TD_MNODE_INT_H_
#include "mnodeDef.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#include "os.h"
#include "taosmsg.h"
#include "trpc.h"
#include "mnode.h"
tmr_h
mnodeGetTimer
();
int32_t
mnodeGetDnodeId
();
char
*
mnodeGetClusterId
();
bool
mnodeIsRunning
();
void
mnodeSendMsgToDnode
(
struct
SRpcEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
);
void
mnodeSendMsgToMnode
(
struct
SRpcMsg
*
rpcMsg
);
void
mnodeSendRedirectMsg
(
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_INT_H_*/
\ No newline at end of file
#endif
/*_TD_MNODE_INT_H_*/
source/server/mnode/inc/mnodeMnode.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_MNODE_H_
#define _TD_MNODE_MNODE_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_MNODE_H_*/
source/server/mnode/
src/mnodeMain.c
→
source/server/mnode/
inc/mnodeSdb.h
浏览文件 @
59dc24f7
...
...
@@ -13,20 +13,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mnodeInt.h"
int32_t
mnodeInit
(
SMnodePara
para
)
{
return
0
;
}
#ifndef _TD_MNODE_SDB_H_
#define _TD_MNODE_SDB_H_
void
mnodeCleanup
()
{}
int32_t
mnodeDeploy
(
struct
SMInfos
*
minfos
)
{
return
0
;
}
#include "mnodeInt.h"
void
mnodeUnDeploy
()
{}
#ifdef __cplusplus
extern
"C"
{
#endif
bool
mnodeIsServing
()
{
return
false
;
}
int32_t
sdbInit
();
void
sdbCleanup
();
int32_t
mnodeGetStatistics
(
SMnodeStat
*
stat
)
{
return
0
;
}
int32_t
mnodeRetriveAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
return
0
;
}
#ifdef __cplusplus
}
#endif
void
mnodeProcessMsg
(
SRpcMsg
*
rpcMsg
)
{}
#endif
/*_TD_MNODE_INT_H_*/
source/server/mnode/inc/mnodeSync.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_SYNC_H_
#define _TD_MNODE_SYNC_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_SYNC_H_*/
source/server/mnode/inc/mnodeTable.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_TABLE_H_
#define _TD_MNODE_TABLE_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_TABLE_H_*/
source/server/mnode/inc/mnodeUser.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_USER_H_
#define _TD_MNODE_USER_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_USER_H_*/
source/server/mnode/inc/mnodeVgroup.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_VGROUP_H_
#define _TD_MNODE_VGROUP_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_VGROUP_H_*/
source/server/mnode/inc/mnodeWorker.h
0 → 100644
浏览文件 @
59dc24f7
/*
* 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_MNODE_WORKER_H_
#define _TD_MNODE_WORKER_H_
#include "mnodeInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#ifdef __cplusplus
}
#endif
#endif
/*_TD_MNODE_WORKER_H_*/
source/server/mnode/src/mnodeAcct.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeAuth.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeBalance.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeCluster.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeDb.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeDnode.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeMnode.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeSdb.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeSync.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeTable.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeUser.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeVgruop.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mnodeWorker.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "mnodeInt.h"
source/server/mnode/src/mondeInt.c
0 → 100644
浏览文件 @
59dc24f7
/*
* 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 "os.h"
#include "tglobal.h"
#include "tstep.h"
#include "mnodeInt.h"
#include "mnodeCluster.h"
#include "mnodeDb.h"
#include "mnodeDnode.h"
#include "mnodeFunc.h"
#include "mnodeMnode.h"
#include "mnodeProfile.h"
#include "mnodeSdb.h"
#include "mnodeShow.h"
#include "mnodeTable.h"
#include "mnodeUser.h"
#include "mnodeVgroup.h"
#include "mnodeWorker.h"
#include "mnodeDb.h"
#include "mnodeRaft.h"
static
struct
{
int32_t
state
;
int32_t
dnodeId
;
char
clusterId
[
TSDB_CLUSTER_ID_LEN
];
tmr_h
timer
;
SMnodeFp
fp
;
SSteps
*
steps
;
}
tsMint
;
tmr_h
mnodeGetTimer
()
{
return
tsMint
.
timer
;
}
int32_t
mnodeGetDnodeId
()
{
return
tsMint
.
dnodeId
;
}
char
*
mnodeGetClusterId
()
{
return
tsMint
.
clusterId
;
}
bool
mnodeIsServing
()
{
return
tsMint
.
state
==
TAOS_MN_STATUS_READY
;
}
void
mnodeSendMsgToDnode
(
struct
SRpcEpSet
*
epSet
,
struct
SRpcMsg
*
rpcMsg
)
{
(
*
tsMint
.
fp
.
SendMsgToDnode
)(
epSet
,
rpcMsg
);
}
void
mnodeSendMsgToMnode
(
struct
SRpcMsg
*
rpcMsg
)
{
return
(
*
tsMint
.
fp
.
SendMsgToMnode
)(
rpcMsg
);
}
void
mnodeSendRedirectMsg
(
struct
SRpcMsg
*
rpcMsg
,
bool
forShell
)
{
(
*
tsMint
.
fp
.
SendRedirectMsg
)(
rpcMsg
,
forShell
);
}
int32_t
mnodeGetStatistics
(
SMnodeStat
*
stat
)
{
return
0
;
}
static
int32_t
mnodeSetPara
(
SMnodePara
para
)
{
tsMint
.
fp
=
para
.
fp
;
tsMint
.
dnodeId
=
para
.
dnodeId
;
strncpy
(
tsMint
.
clusterId
,
para
.
clusterId
,
TSDB_CLUSTER_ID_LEN
);
if
(
tsMint
.
fp
.
GetDnodeEp
==
NULL
)
return
-
1
;
if
(
tsMint
.
fp
.
SendMsgToDnode
==
NULL
)
return
-
1
;
if
(
tsMint
.
fp
.
SendMsgToMnode
==
NULL
)
return
-
1
;
if
(
tsMint
.
fp
.
SendRedirectMsg
==
NULL
)
return
-
1
;
if
(
tsMint
.
dnodeId
<
0
)
return
-
1
;
return
0
;
}
static
bool
mnodeNeedDeploy
()
{
if
(
tsMint
.
dnodeId
>
0
)
return
false
;
if
(
tsMint
.
clusterId
[
0
]
!=
0
)
return
false
;
if
(
strcmp
(
tsFirst
,
tsLocalEp
)
!=
0
)
return
false
;
return
true
;
}
static
bool
mnodeIsDeployed
()
{
struct
stat
dirstat
;
char
filename
[
PATH_MAX
+
20
]
=
{
0
};
snprintf
(
filename
,
sizeof
(
filename
),
"%s/wal/wal0"
,
tsMnodeDir
);
return
(
stat
(
filename
,
&
dirstat
)
==
0
);
}
int32_t
mnodeDeploy
(
struct
SMInfos
*
pMinfos
)
{
if
(
pMinfos
==
NULL
)
{
// first deploy
tsMint
.
dnodeId
=
1
;
bool
getuid
=
taosGetSystemUid
(
tsMint
.
clusterId
);
if
(
!
getuid
)
{
strcpy
(
tsMint
.
clusterId
,
"tdengine3.0"
);
mError
(
"deploy new mnode but failed to get uid, set to default val %s"
,
tsMint
.
clusterId
);
}
else
{
mDebug
(
"deploy new mnode and uid is %s"
,
tsMint
.
clusterId
);
}
}
else
{
// todo
}
if
(
mkdir
(
tsMnodeDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
mError
(
"failed to init mnode dir:%s, reason:%s"
,
tsMnodeDir
,
strerror
(
errno
));
return
-
1
;
}
return
0
;
}
void
mnodeUnDeploy
()
{
if
(
remove
(
tsMnodeDir
)
!=
0
)
{
mInfo
(
"failed to remove mnode file, reason:%s"
,
strerror
(
errno
));
}
else
{
mInfo
(
"mnode file is removed"
);
}
}
static
int32_t
mnodeInitTimer
()
{
if
(
tsMint
.
timer
==
NULL
)
{
tsMint
.
timer
=
taosTmrInit
(
tsMaxShellConns
,
200
,
3600000
,
"MND"
);
}
return
0
;
}
static
void
mnodeCleanupTimer
()
{
if
(
tsMint
.
timer
!=
NULL
)
{
taosTmrCleanUp
(
tsMint
.
timer
);
tsMint
.
timer
=
NULL
;
}
}
static
int32_t
mnodeInitSteps
()
{
struct
SSteps
*
steps
=
taosStepInit
(
20
,
NULL
);
if
(
steps
==
NULL
)
return
-
1
;
taosStepAdd
(
steps
,
"mnode-timer"
,
mnodeInitTimer
,
NULL
);
taosStepAdd
(
steps
,
"mnode-worker"
,
mnodeInitWorker
,
NULL
);
taosStepAdd
(
steps
,
"mnode-sdbref"
,
sdbInitRef
,
sdbCleanUpRef
);
taosStepAdd
(
steps
,
"mnode-profile"
,
mnodeInitProfile
,
mnodeCleanupProfile
);
taosStepAdd
(
steps
,
"mnode-funcs"
,
mnodeInitFuncs
,
mnodeCleanupFuncs
);
taosStepAdd
(
steps
,
"mnode-dnodes"
,
mnodeInitDnodes
,
mnodeCleanupDnodes
);
taosStepAdd
(
steps
,
"mnode-dbs"
,
mnodeInitDbs
,
mnodeCleanupDbs
);
taosStepAdd
(
steps
,
"mnode-vgroups"
,
mnodeInitVgroups
,
mnodeCleanupVgroups
);
taosStepAdd
(
steps
,
"mnode-tables"
,
mnodeInitTables
,
mnodeCleanupTables
);
taosStepAdd
(
steps
,
"mnode-mnodes"
,
mnodeInitMnodes
,
mnodeCleanupMnodes
);
taosStepAdd
(
steps
,
"mnode-sdb"
,
sdbInit
,
sdbCleanUp
);
taosStepAdd
(
steps
,
"mnode-balance"
,
bnInit
,
bnCleanUp
);
taosStepAdd
(
steps
,
"mnode-grant"
,
grantInit
,
grantCleanUp
);
taosStepAdd
(
steps
,
"mnode-show"
,
mnodeInitShow
,
mnodeCleanUpShow
);
taosStepAdd
(
steps
,
"mnode-kv"
,
mnodeInitKv
,
mnodeCleanupKv
);
taosStepAdd
(
steps
,
"mnode-raft"
,
mnodeInitRaft
,
mnodeCleanupRaft
);
taosStepAdd
(
steps
,
"mnode-cluster"
,
mnodeInitCluster
,
mnodeCleanupCluster
);
taosStepAdd
(
steps
,
"mnode-users"
,
mnodeInitUsers
,
mnodeCleanupUsers
);
taosStepAdd
(
steps
,
"mnode-worker"
,
NULL
,
mnodeCleanupWorker
);
taosStepAdd
(
steps
,
"mnode-timer"
,
NULL
,
mnodeCleanupTimer
);
tsMint
.
steps
=
steps
;
return
taosStepExec
(
tsMint
.
steps
);
}
static
void
mnodeCleanupSteps
()
{
taosStepCleanup
(
tsMint
.
steps
);
}
int32_t
mnodeInit
(
SMnodePara
para
)
{
int32_t
code
=
0
;
if
(
tsMint
.
state
!=
TAOS_MN_STATUS_UNINIT
)
{
return
0
;
}
else
{
tsMint
.
state
=
TAOS_MN_STATUS_INIT
;
}
code
=
mnodeSetPara
(
para
);
if
(
code
!=
0
)
{
tsMint
.
state
=
TAOS_MN_STATUS_UNINIT
;
return
code
;
}
bool
needDeploy
=
mnodeNeedDeploy
();
bool
deployed
=
mnodeIsDeployed
();
if
(
!
deployed
)
{
if
(
needDeploy
)
{
code
=
mnodeDeploy
(
NULL
);
if
(
code
!=
0
)
{
tsMint
.
state
=
TAOS_MN_STATUS_UNINIT
;
return
code
;
}
}
else
{
tsMint
.
state
=
TAOS_MN_STATUS_UNINIT
;
return
0
;
}
}
mInfo
(
"starting to initialize mnode ..."
);
code
=
mnodeInitSteps
();
if
(
code
!=
0
)
{
tsMint
.
state
=
TAOS_MN_STATUS_UNINIT
;
return
-
1
;
}
// todo
grantReset
(
TSDB_GRANT_ALL
,
0
);
sdbUpdateSync
(
NULL
);
tsMint
.
state
=
TAOS_MN_STATUS_READY
;
mInfo
(
"mnode is initialized successfully"
);
return
0
;
}
void
mnodeCleanup
()
{
if
(
tsMint
.
state
!=
TAOS_MN_STATUS_UNINIT
&&
tsMint
.
state
!=
TAOS_MN_STATUS_CLOSING
)
{
mInfo
(
"starting to clean up mnode"
);
tsMint
.
state
=
TAOS_MN_STATUS_CLOSING
;
mnodeCleanupSteps
();
tsMint
.
state
=
TAOS_MN_STATUS_UNINIT
;
mInfo
(
"mnode is cleaned up"
);
}
}
int32_t
mnodeRetriveAuth
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
)
{
return
0
;
}
void
mnodeProcessMsg
(
SRpcMsg
*
rpcMsg
)
{}
\ No newline at end of file
source/util/src/tstep.c
浏览文件 @
59dc24f7
...
...
@@ -18,7 +18,7 @@
#include "ulog.h"
#include "tstep.h"
typedef
struct
SStepObj
{
typedef
struct
{
char
*
name
;
InitFp
initFp
;
CleanupFp
cleanupFp
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录