Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a1c8ec36
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看板
提交
a1c8ec36
编写于
4月 17, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-52] fix bug in sdb sync
上级
f3b76d1a
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
31 addition
and
28 deletion
+31
-28
src/dnode/inc/dnodeMClient.h
src/dnode/inc/dnodeMClient.h
+0
-2
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+1
-1
src/dnode/src/dnodeModule.c
src/dnode/src/dnodeModule.c
+1
-1
src/inc/dnode.h
src/inc/dnode.h
+2
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+0
-1
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+5
-7
src/mnode/src/mgmtMain.c
src/mnode/src/mgmtMain.c
+5
-4
src/mnode/src/mgmtMnode.c
src/mnode/src/mgmtMnode.c
+6
-0
src/mnode/src/mgmtSdb.c
src/mnode/src/mgmtSdb.c
+7
-5
src/mnode/src/mgmtUser.c
src/mnode/src/mgmtUser.c
+2
-1
src/util/src/tglobalcfg.c
src/util/src/tglobalcfg.c
+1
-6
未找到文件。
src/dnode/inc/dnodeMClient.h
浏览文件 @
a1c8ec36
...
...
@@ -23,8 +23,6 @@ extern "C" {
int32_t
dnodeInitMClient
();
void
dnodeCleanupMClient
();
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
);
void
*
dnodeGetMnodeList
();
int32_t
dnodeGetDnodeId
();
#ifdef __cplusplus
}
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
a1c8ec36
...
...
@@ -22,11 +22,11 @@
#include "trpc.h"
#include "tsdb.h"
#include "twal.h"
#include "vnode.h"
#include "dnodeMClient.h"
#include "dnodeMgmt.h"
#include "dnodeRead.h"
#include "dnodeWrite.h"
#include "vnode.h"
static
int32_t
dnodeOpenVnodes
();
static
void
dnodeCloseVnodes
();
...
...
src/dnode/src/dnodeModule.c
浏览文件 @
a1c8ec36
...
...
@@ -118,7 +118,7 @@ void dnodeProcessModuleStatus(uint32_t moduleStatus) {
dPrint
(
"module status is received, start mgmt module"
,
tsModuleStatus
,
moduleStatus
);
tsModule
[
TSDB_MOD_MGMT
].
enable
=
true
;
dnodeSetModuleStatus
(
TSDB_MOD_MGMT
);
(
*
tsModule
[
TSDB_MOD_MGMT
].
st
op
Fp
)();
(
*
tsModule
[
TSDB_MOD_MGMT
].
st
art
Fp
)();
}
if
(
tsModule
[
TSDB_MOD_MGMT
].
enable
&&
!
enableMgmtModule
)
{
...
...
src/inc/dnode.h
浏览文件 @
a1c8ec36
...
...
@@ -43,6 +43,8 @@ void dnodeSendRpcWriteRsp(void *pVnode, void *param, int32_t code);
bool
dnodeIsFirstDeploy
();
uint32_t
dnodeGetMnodeMasteIp
();
void
*
dnodeGetMnodeList
();
int32_t
dnodeGetDnodeId
();
#ifdef __cplusplus
}
...
...
src/inc/taosmsg.h
浏览文件 @
a1c8ec36
...
...
@@ -584,6 +584,7 @@ typedef struct {
char
dnodeName
[
TSDB_NODE_NAME_LEN
+
1
];
uint32_t
privateIp
;
uint32_t
publicIp
;
uint32_t
moduleStatus
;
uint32_t
lastReboot
;
// time stamp for last reboot
uint16_t
numOfTotalVnodes
;
// from config file
uint16_t
openVnodes
;
...
...
src/mnode/inc/mgmtDnode.h
浏览文件 @
a1c8ec36
...
...
@@ -31,7 +31,6 @@ int32_t mgmtInitDnodes();
void
mgmtCleanupDnodes
();
char
*
mgmtGetDnodeStatusStr
(
int32_t
dnodeStatus
);
bool
mgmtCheckModuleInDnode
(
SDnodeObj
*
pDnode
,
int
moduleType
);
void
mgmtMonitorDnodeModule
();
int32_t
mgmtGetDnodesNum
();
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
a1c8ec36
...
...
@@ -129,7 +129,7 @@ static int32_t mgmtDnodeActionDecode(SSdbOperDesc *pOper) {
static
int32_t
mgmtDnodeActionRestored
()
{
int32_t
numOfRows
=
sdbGetNumOfRows
(
tsDnodeSdb
);
if
(
numOfRows
<=
0
&&
strcmp
(
tsMasterIp
,
tsPrivateIp
)
==
0
)
{
if
(
numOfRows
<=
0
&&
dnodeIsFirstDeploy
()
)
{
uint32_t
ip
=
inet_addr
(
tsPrivateIp
);
mgmtCreateDnode
(
ip
);
SDnodeObj
*
pDnode
=
mgmtGetDnodeByIp
(
ip
);
...
...
@@ -276,6 +276,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
pStatus
->
dnodeId
=
htonl
(
pStatus
->
dnodeId
);
pStatus
->
privateIp
=
htonl
(
pStatus
->
privateIp
);
pStatus
->
publicIp
=
htonl
(
pStatus
->
publicIp
);
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
numOfTotalVnodes
=
htons
(
pStatus
->
numOfTotalVnodes
);
...
...
@@ -311,6 +312,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
pDnode
->
diskAvailable
=
pStatus
->
diskAvailable
;
pDnode
->
alternativeRole
=
pStatus
->
alternativeRole
;
pDnode
->
totalVnodes
=
pStatus
->
numOfTotalVnodes
;
pDnode
->
moduleStatus
=
pStatus
->
moduleStatus
;
if
(
pStatus
->
dnodeId
==
0
)
{
mTrace
(
"dnode:%d, first access, privateIp:%s, name:%s"
,
pDnode
->
dnodeId
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
dnodeName
);
...
...
@@ -353,7 +355,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
mgmtGetMnodeList
(
&
pRsp
->
mnodes
);
pRsp
->
dnodeState
.
dnodeId
=
htonl
(
pDnode
->
dnodeId
);
pRsp
->
dnodeState
.
moduleStatus
=
htonl
(
pDnode
->
moduleStatus
);
pRsp
->
dnodeState
.
moduleStatus
=
htonl
(
(
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeState
.
createdTime
=
htonl
(
pDnode
->
createdTime
/
1000
);
pRsp
->
dnodeState
.
numOfVnodes
=
0
;
...
...
@@ -391,10 +393,6 @@ static int32_t mgmtCreateDnode(uint32_t ip) {
pDnode
->
totalVnodes
=
TSDB_INVALID_VNODE_NUM
;
sprintf
(
pDnode
->
dnodeName
,
"n%d"
,
sdbGetId
(
tsDnodeSdb
)
+
1
);
if
(
pDnode
->
privateIp
==
inet_addr
(
tsMasterIp
))
{
pDnode
->
moduleStatus
|=
(
1
<<
TSDB_MOD_MGMT
);
}
SSdbOperDesc
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
table
=
tsDnodeSdb
,
...
...
@@ -620,7 +618,7 @@ static int32_t mgmtRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, voi
return
numOfRows
;
}
bool
mgmtCheckModuleInDnode
(
SDnodeObj
*
pDnode
,
int32_t
moduleType
)
{
static
bool
mgmtCheckModuleInDnode
(
SDnodeObj
*
pDnode
,
int32_t
moduleType
)
{
uint32_t
status
=
pDnode
->
moduleStatus
&
(
1
<<
moduleType
);
return
status
>
0
;
}
...
...
src/mnode/src/mgmtMain.c
浏览文件 @
a1c8ec36
...
...
@@ -20,6 +20,7 @@
#include "treplica.h"
#include "tgrant.h"
#include "ttimer.h"
#include "dnode.h"
#include "mgmtDef.h"
#include "mgmtLog.h"
#include "mgmtAcct.h"
...
...
@@ -100,6 +101,10 @@ int32_t mgmtStartSystem() {
return
-
1
;
}
if
(
replicaInit
()
<
0
)
{
mError
(
"failed to init replica"
)
}
if
(
mgmtInitDClient
()
<
0
)
{
return
-
1
;
}
...
...
@@ -108,10 +113,6 @@ int32_t mgmtStartSystem() {
return
-
1
;
}
if
(
replicaInit
()
<
0
)
{
mError
(
"failed to init dnode balance"
)
}
grantReset
(
TSDB_GRANT_ALL
,
0
);
tsMgmtIsRunning
=
true
;
...
...
src/mnode/src/mgmtMnode.c
浏览文件 @
a1c8ec36
...
...
@@ -55,6 +55,12 @@ static int32_t mgmtMnodeActionInsert(SSdbOperDesc *pOper) {
static
int32_t
mgmtMnodeActionDelete
(
SSdbOperDesc
*
pOper
)
{
SMnodeObj
*
pMnode
=
pOper
->
pObj
;
SDnodeObj
*
pDnode
=
mgmtGetDnode
(
pMnode
->
mnodeId
);
if
(
pDnode
==
NULL
)
return
TSDB_CODE_DNODE_NOT_EXIST
;
pDnode
->
isMgmt
=
false
;
mgmtReleaseDnode
(
pDnode
);
mTrace
(
"mnode:%d, is dropped from sdb"
,
pMnode
->
mnodeId
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/mnode/src/mgmtSdb.c
浏览文件 @
a1c8ec36
...
...
@@ -69,10 +69,16 @@ static void *(*sdbGetIndexFp[])(void *handle, void *key) = {sdbGetStrHashData, s
static
void
(
*
sdbCleanUpIndexFp
[])(
void
*
handle
)
=
{
sdbCloseStrHash
,
sdbCloseIntHash
,
sdbCloseIntHash
};
static
void
*
(
*
sdbFetchRowFp
[])(
void
*
handle
,
void
*
ptr
,
void
**
ppRow
)
=
{
sdbFetchStrHashData
,
sdbFetchIntHashData
,
sdbFetchIntHashData
};
uint64_t
sdbGetVersion
()
{
return
tsSdbObj
->
version
;
}
int32_t
sdbGetId
(
void
*
handle
)
{
return
((
SSdbTable
*
)
handle
)
->
autoIndex
;
}
int64_t
sdbGetNumOfRows
(
void
*
handle
)
{
return
((
SSdbTable
*
)
handle
)
->
numOfRows
;
}
uint64_t
sdbGetVersion
()
{
if
(
tsSdbObj
)
return
tsSdbObj
->
version
;
else
return
0
;
}
static
char
*
sdbGetActionStr
(
int32_t
action
)
{
switch
(
action
)
{
case
SDB_ACTION_INSERT
:
...
...
@@ -147,10 +153,6 @@ void sdbCleanUp() {
}
}
SSdbObject
*
sdbGetObj
()
{
return
tsSdbObj
;
}
void
sdbIncRef
(
void
*
handle
,
void
*
pRow
)
{
if
(
pRow
)
{
SSdbTable
*
pTable
=
handle
;
...
...
src/mnode/src/mgmtUser.c
浏览文件 @
a1c8ec36
...
...
@@ -18,6 +18,7 @@
#include "trpc.h"
#include "ttime.h"
#include "tutil.h"
#include "dnode.h"
#include "mgmtDef.h"
#include "mgmtLog.h"
#include "mgmtAcct.h"
...
...
@@ -93,7 +94,7 @@ static int32_t mgmtUserActionDecode(SSdbOperDesc *pOper) {
}
static
int32_t
mgmtUserActionRestored
()
{
if
(
strcmp
(
tsMasterIp
,
tsPrivateIp
)
==
0
)
{
if
(
dnodeIsFirstDeploy
()
)
{
SAcctObj
*
pAcct
=
mgmtGetAcct
(
"root"
);
mgmtCreateUser
(
pAcct
,
"root"
,
"taosdata"
);
mgmtCreateUser
(
pAcct
,
"monitor"
,
tsInternalPass
);
...
...
src/util/src/tglobalcfg.c
浏览文件 @
a1c8ec36
...
...
@@ -110,12 +110,7 @@ short tsDaysPerFile = 10;
int
tsDaysToKeep
=
3650
;
int
tsReplications
=
TSDB_REPLICA_MIN_NUM
;
#ifdef _MPEER
int
tsNumOfMPeers
=
3
;
#else
int
tsNumOfMPeers
=
1
;
#endif
int
tsMaxShellConns
=
2000
;
int
tsMaxTables
=
100000
;
...
...
@@ -556,7 +551,7 @@ static void doInitGlobalConfig() {
tsInitConfigOption
(
cfg
++
,
"tblocks"
,
&
tsNumOfBlocksPerMeter
,
TSDB_CFG_VTYPE_SHORT
,
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
,
32
,
4096
,
0
,
TSDB_CFG_UTYPE_NONE
);
#ifdef _
MPEER
#ifdef _
SYNC
tsInitConfigOption
(
cfg
++
,
"numOfMPeers"
,
&
tsNumOfMPeers
,
TSDB_CFG_VTYPE_INT
,
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_SHOW
|
TSDB_CFG_CTYPE_B_CLUSTER
,
1
,
3
,
0
,
TSDB_CFG_UTYPE_NONE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录