Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bb3a0b21
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看板
提交
bb3a0b21
编写于
12月 26, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change clusterid from int32 to int64
上级
791c6c84
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
37 addition
and
31 deletion
+37
-31
include/common/tmsg.h
include/common/tmsg.h
+3
-3
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+1
-1
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+2
-2
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+3
-2
source/dnode/mgmt/impl/src/dndDnode.c
source/dnode/mgmt/impl/src/dndDnode.c
+4
-4
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+1
-1
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+11
-11
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+5
-4
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+1
-1
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+5
-1
未找到文件。
include/common/tmsg.h
浏览文件 @
bb3a0b21
...
...
@@ -320,7 +320,7 @@ typedef struct SEpSet {
typedef
struct
{
int32_t
acctId
;
uint32_t
clusterId
;
int64_t
clusterId
;
int32_t
connId
;
int8_t
superUser
;
int8_t
reserved
[
5
];
...
...
@@ -644,7 +644,7 @@ typedef struct {
typedef
struct
{
int32_t
sver
;
int32_t
dnodeId
;
int
32
_t
clusterId
;
int
64
_t
clusterId
;
int64_t
rebootTime
;
int64_t
updateTime
;
int16_t
numOfCores
;
...
...
@@ -660,7 +660,7 @@ typedef struct {
typedef
struct
{
int32_t
dnodeId
;
int
32
_t
clusterId
;
int
64
_t
clusterId
;
int8_t
dropped
;
char
reserved
[
7
];
}
SDnodeCfg
;
...
...
source/client/inc/clientInt.h
浏览文件 @
bb3a0b21
...
...
@@ -59,7 +59,7 @@ typedef struct SAppInstInfo {
SCorEpSet
mgmtEp
;
SInstanceActivity
summary
;
SList
*
pConnList
;
// STscObj linked list
uint32_t
clusterId
;
int64_t
clusterId
;
void
*
pTransporter
;
}
SAppInstInfo
;
...
...
source/client/src/clientImpl.c
浏览文件 @
bb3a0b21
...
...
@@ -170,8 +170,8 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
if
(
pDcl
->
msgType
==
TDMT_MND_CREATE_TABLE
)
{
struct
SCatalog
*
pCatalog
=
NULL
;
char
buf
[
1
2
]
=
{
0
};
sprintf
(
buf
,
"%
d"
,
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
);
char
buf
[
1
8
]
=
{
0
};
sprintf
(
buf
,
"%
"
PRId64
,
pRequest
->
pTscObj
->
pAppInfo
->
clusterId
);
int32_t
code
=
catalogGetHandle
(
buf
,
&
pCatalog
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
bb3a0b21
...
...
@@ -59,7 +59,7 @@ int processConnectRsp(SRequestObj *pRequest, const char* pMsg, int32_t msgLen) {
SConnectRsp
*
pConnect
=
(
SConnectRsp
*
)
pMsg
;
pConnect
->
acctId
=
htonl
(
pConnect
->
acctId
);
pConnect
->
connId
=
htonl
(
pConnect
->
connId
);
pConnect
->
clusterId
=
hto
nl
(
pConnect
->
clusterId
);
pConnect
->
clusterId
=
hto
be64
(
pConnect
->
clusterId
);
assert
(
pConnect
->
epSet
.
numOfEps
>
0
);
for
(
int32_t
i
=
0
;
i
<
pConnect
->
epSet
.
numOfEps
;
++
i
)
{
...
...
@@ -82,7 +82,8 @@ int processConnectRsp(SRequestObj *pRequest, const char* pMsg, int32_t msgLen) {
atomic_add_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
pRequest
->
body
.
resInfo
.
pRspMsg
=
pMsg
;
tscDebug
(
"0x%"
PRIx64
" clusterId:%d, totalConn:%"
PRId64
,
pRequest
->
requestId
,
pConnect
->
clusterId
,
pTscObj
->
pAppInfo
->
numOfConns
);
tscDebug
(
"0x%"
PRIx64
" clusterId:%"
PRId64
", totalConn:%"
PRId64
,
pRequest
->
requestId
,
pConnect
->
clusterId
,
pTscObj
->
pAppInfo
->
numOfConns
);
return
0
;
}
...
...
source/dnode/mgmt/impl/src/dndDnode.c
浏览文件 @
bb3a0b21
...
...
@@ -307,7 +307,7 @@ static int32_t dndWriteDnodes(SDnode *pDnode) {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodeId
\"
: %d,
\n
"
,
pMgmt
->
dnodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
clusterId
\"
:
%d
,
\n
"
,
pMgmt
->
clusterId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
clusterId
\"
:
\"
%"
PRId64
"
\"
,
\n
"
,
pMgmt
->
clusterId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dropped
\"
: %d,
\n
"
,
pMgmt
->
dropped
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodes
\"
: [{
\n
"
);
for
(
int32_t
i
=
0
;
i
<
pMgmt
->
dnodeEps
->
num
;
++
i
)
{
...
...
@@ -348,7 +348,7 @@ void dndSendStatusMsg(SDnode *pDnode) {
taosRLockLatch
(
&
pMgmt
->
latch
);
pStatus
->
sver
=
htonl
(
pDnode
->
opt
.
sver
);
pStatus
->
dnodeId
=
htonl
(
pMgmt
->
dnodeId
);
pStatus
->
clusterId
=
hto
nl
(
pMgmt
->
clusterId
);
pStatus
->
clusterId
=
hto
be64
(
pMgmt
->
clusterId
);
pStatus
->
rebootTime
=
htobe64
(
pMgmt
->
rebootTime
);
pStatus
->
updateTime
=
htobe64
(
pMgmt
->
updateTime
);
pStatus
->
numOfCores
=
htons
(
pDnode
->
opt
.
numOfCores
);
...
...
@@ -378,7 +378,7 @@ void dndSendStatusMsg(SDnode *pDnode) {
static
void
dndUpdateDnodeCfg
(
SDnode
*
pDnode
,
SDnodeCfg
*
pCfg
)
{
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
if
(
pMgmt
->
dnodeId
==
0
||
pMgmt
->
dropped
!=
pCfg
->
dropped
)
{
dInfo
(
"set dnodeId:%d clusterId:%
d
dropped:%d"
,
pCfg
->
dnodeId
,
pCfg
->
clusterId
,
pCfg
->
dropped
);
dInfo
(
"set dnodeId:%d clusterId:%
"
PRId64
"
dropped:%d"
,
pCfg
->
dnodeId
,
pCfg
->
clusterId
,
pCfg
->
dropped
);
taosWLockLatch
(
&
pMgmt
->
latch
);
pMgmt
->
dnodeId
=
pCfg
->
dnodeId
;
...
...
@@ -424,7 +424,7 @@ static void dndProcessStatusRsp(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
SStatusRsp
*
pRsp
=
pMsg
->
pCont
;
SDnodeCfg
*
pCfg
=
&
pRsp
->
dnodeCfg
;
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
clusterId
=
hto
nl
(
pCfg
->
clusterId
);
pCfg
->
clusterId
=
hto
be64
(
pCfg
->
clusterId
);
dndUpdateDnodeCfg
(
pDnode
,
pCfg
);
if
(
pCfg
->
dropped
)
{
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
bb3a0b21
...
...
@@ -111,7 +111,7 @@ typedef struct {
}
STrans
;
typedef
struct
{
int
32
_t
id
;
int
64
_t
id
;
char
name
[
TSDB_CLUSTER_ID_LEN
];
int64_t
createdTime
;
int64_t
updateTime
;
...
...
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
bb3a0b21
...
...
@@ -70,7 +70,7 @@ typedef struct {
typedef
struct
SMnode
{
int32_t
dnodeId
;
int
32
_t
clusterId
;
int
64
_t
clusterId
;
int8_t
replica
;
int8_t
selfIndex
;
SReplica
replicas
[
TSDB_MAX_REPLICA
];
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
bb3a0b21
...
...
@@ -67,7 +67,7 @@ static SSdbRaw *mndClusterActionEncode(SClusterObj *pCluster) {
if
(
pRaw
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
SDB_SET_INT
32
(
pRaw
,
dataPos
,
pCluster
->
id
);
SDB_SET_INT
64
(
pRaw
,
dataPos
,
pCluster
->
id
);
SDB_SET_INT64
(
pRaw
,
dataPos
,
pCluster
->
createdTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pCluster
->
updateTime
)
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pCluster
->
name
,
TSDB_CLUSTER_ID_LEN
)
...
...
@@ -91,7 +91,7 @@ static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
if
(
pCluster
==
NULL
)
return
NULL
;
int32_t
dataPos
=
0
;
SDB_GET_INT
32
(
pRaw
,
pRow
,
dataPos
,
&
pCluster
->
id
)
SDB_GET_INT
64
(
pRaw
,
pRow
,
dataPos
,
&
pCluster
->
id
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pCluster
->
createdTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pCluster
->
updateTime
)
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pCluster
->
name
,
TSDB_CLUSTER_ID_LEN
)
...
...
@@ -101,17 +101,17 @@ static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) {
}
static
int32_t
mndClusterActionInsert
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
)
{
mTrace
(
"cluster:%
d
, perform insert action"
,
pCluster
->
id
);
mTrace
(
"cluster:%
"
PRId64
"
, perform insert action"
,
pCluster
->
id
);
return
0
;
}
static
int32_t
mndClusterActionDelete
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
)
{
mTrace
(
"cluster:%
d
, perform delete action"
,
pCluster
->
id
);
mTrace
(
"cluster:%
"
PRId64
"
, perform delete action"
,
pCluster
->
id
);
return
0
;
}
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
pOldCluster
,
SClusterObj
*
pNewCluster
)
{
mTrace
(
"cluster:%
d
, perform update action"
,
pOldCluster
->
id
);
mTrace
(
"cluster:%
"
PRId64
"
, perform update action"
,
pOldCluster
->
id
);
return
0
;
}
...
...
@@ -125,17 +125,17 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
strcpy
(
clusterObj
.
name
,
"tdengine2.0"
);
mError
(
"failed to get name from system, set to default val %s"
,
clusterObj
.
name
);
}
else
{
mDebug
(
"cluster:%
d
, name is %s"
,
clusterObj
.
id
,
clusterObj
.
name
);
mDebug
(
"cluster:%
"
PRId64
"
, name is %s"
,
clusterObj
.
id
,
clusterObj
.
name
);
}
clusterObj
.
id
=
MurmurHash3_32
(
clusterObj
.
name
,
TSDB_CLUSTER_ID_LEN
);
clusterObj
.
id
=
abs
(
clusterObj
.
id
);
clusterObj
.
id
=
(
clusterObj
.
id
>=
0
?
clusterObj
.
id
:
-
clusterObj
.
id
);
pMnode
->
clusterId
=
clusterObj
.
id
;
SSdbRaw
*
pRaw
=
mndClusterActionEncode
(
&
clusterObj
);
if
(
pRaw
==
NULL
)
return
-
1
;
sdbSetRawStatus
(
pRaw
,
SDB_STATUS_READY
);
mDebug
(
"cluster:%
d
, will be created while deploy sdb"
,
clusterObj
.
id
);
mDebug
(
"cluster:%
"
PRId64
"
, will be created while deploy sdb"
,
clusterObj
.
id
);
return
sdbWrite
(
pMnode
->
pSdb
,
pRaw
);
}
...
...
@@ -143,8 +143,8 @@ static int32_t mndGetClusterMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_
BIG
INT
;
strcpy
(
pSchema
[
cols
].
name
,
"id"
);
pSchema
[
cols
].
bytes
=
htonl
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -192,7 +192,7 @@ static int32_t mndRetrieveClusters(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int
32
_t
*
)
pWrite
=
pCluster
->
id
;
*
(
int
64
_t
*
)
pWrite
=
pCluster
->
id
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
bb3a0b21
...
...
@@ -276,7 +276,7 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, const SClusterCfg *pCfg) {
static
void
mndParseStatusMsg
(
SStatusMsg
*
pStatus
)
{
pStatus
->
sver
=
htonl
(
pStatus
->
sver
);
pStatus
->
dnodeId
=
htonl
(
pStatus
->
dnodeId
);
pStatus
->
clusterId
=
hto
nl
(
pStatus
->
clusterId
);
pStatus
->
clusterId
=
hto
be64
(
pStatus
->
clusterId
);
pStatus
->
rebootTime
=
htobe64
(
pStatus
->
rebootTime
);
pStatus
->
updateTime
=
htobe64
(
pStatus
->
updateTime
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
...
...
@@ -323,13 +323,14 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
}
if
(
pStatus
->
dnodeId
==
0
)
{
mDebug
(
"dnode:%d %s, first access, set clusterId %
d"
,
pDnode
->
id
,
pDnode
->
ep
,
pMnode
->
clusterId
);
mDebug
(
"dnode:%d %s, first access, set clusterId %
"
PRId64
,
pDnode
->
id
,
pDnode
->
ep
,
pMnode
->
clusterId
);
}
else
{
if
(
pStatus
->
clusterId
!=
pMnode
->
clusterId
)
{
if
(
pDnode
!=
NULL
&&
pDnode
->
status
!=
DND_STATUS_READY
)
{
pDnode
->
offlineReason
=
DND_REASON_CLUSTER_ID_NOT_MATCH
;
}
mError
(
"dnode:%d, clusterId %d not match exist %d"
,
pDnode
->
id
,
pStatus
->
clusterId
,
pMnode
->
clusterId
);
mError
(
"dnode:%d, clusterId %"
PRId64
" not match exist %"
PRId64
,
pDnode
->
id
,
pStatus
->
clusterId
,
pMnode
->
clusterId
);
mndReleaseDnode
(
pMnode
,
pDnode
);
terrno
!=
TSDB_CODE_MND_INVALID_CLUSTER_ID
;
return
-
1
;
...
...
@@ -370,7 +371,7 @@ static int32_t mndProcessStatusMsg(SMnodeMsg *pMsg) {
pRsp
->
dnodeCfg
.
dnodeId
=
htonl
(
pDnode
->
id
);
pRsp
->
dnodeCfg
.
dropped
=
0
;
pRsp
->
dnodeCfg
.
clusterId
=
hto
nl
(
pMnode
->
clusterId
);
pRsp
->
dnodeCfg
.
clusterId
=
hto
be64
(
pMnode
->
clusterId
);
mndGetDnodeData
(
pMnode
,
&
pRsp
->
dnodeEps
,
numOfEps
);
pMsg
->
contLen
=
contLen
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
bb3a0b21
...
...
@@ -225,7 +225,7 @@ static int32_t mndProcessConnectMsg(SMnodeMsg *pMsg) {
mndReleaseUser
(
pMnode
,
pUser
);
}
pRsp
->
clusterId
=
hto
nl
(
pMnode
->
clusterId
);
pRsp
->
clusterId
=
hto
be64
(
pMnode
->
clusterId
);
pRsp
->
connId
=
htonl
(
pConn
->
id
);
mndGetMnodeEpSet
(
pMnode
,
&
pRsp
->
epSet
);
mndReleaseConn
(
pMnode
,
pConn
);
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
bb3a0b21
...
...
@@ -51,6 +51,7 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans);
static
void
mndTransExecute
(
SMnode
*
pMnode
,
STrans
*
pTrans
);
static
void
mndTransSendRpcRsp
(
STrans
*
pTrans
);
static
int32_t
mndProcessTransMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessTransRsp
(
SMnodeMsg
*
pMsg
);
int32_t
mndInitTrans
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_TRANS
,
...
...
@@ -62,6 +63,7 @@ int32_t mndInitTrans(SMnode *pMnode) {
.
deleteFp
=
(
SdbDeleteFp
)
mndTransActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TRANS
,
mndProcessTransMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_TRANS_RSP
,
mndProcessTransRsp
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -901,4 +903,6 @@ static int32_t mndProcessTransMsg(SMnodeMsg *pMsg) {
mndTransExecute
(
pMnode
,
pTrans
);
sdbRelease
(
pMnode
->
pSdb
,
pTrans
);
}
}
\ No newline at end of file
}
static
int32_t
mndProcessTransRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录