Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
8a68dd6e
T
TDengine
项目概览
慢慢CG
/
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看板
提交
8a68dd6e
编写于
8月 02, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-1033] change clusterId to string
上级
b536877f
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
57 addition
and
47 deletion
+57
-47
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+10
-11
src/dnode/src/dnodeTelemetry.c
src/dnode/src/dnodeTelemetry.c
+1
-1
src/inc/taosdef.h
src/inc/taosdef.h
+1
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+3
-3
src/mnode/inc/mnodeCluster.h
src/mnode/inc/mnodeCluster.h
+1
-7
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+5
-6
src/mnode/src/mnodeCluster.c
src/mnode/src/mnodeCluster.c
+16
-14
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+4
-5
src/os/inc/osSysinfo.h
src/os/inc/osSysinfo.h
+1
-0
src/os/src/detail/osSysinfo.c
src/os/src/detail/osSysinfo.c
+15
-0
未找到文件。
src/dnode/src/dnodeMgmt.c
浏览文件 @
8a68dd6e
...
@@ -490,7 +490,6 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
...
@@ -490,7 +490,6 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
pCfg
->
numOfVnodes
=
htonl
(
pCfg
->
numOfVnodes
);
pCfg
->
numOfVnodes
=
htonl
(
pCfg
->
numOfVnodes
);
pCfg
->
moduleStatus
=
htonl
(
pCfg
->
moduleStatus
);
pCfg
->
moduleStatus
=
htonl
(
pCfg
->
moduleStatus
);
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pCfg
->
clusterId
=
htonl
(
pCfg
->
clusterId
);
for
(
int32_t
i
=
0
;
i
<
pMnodes
->
nodeNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pMnodes
->
nodeNum
;
++
i
)
{
SDMMnodeInfo
*
pMnodeInfo
=
&
pMnodes
->
nodeInfos
[
i
];
SDMMnodeInfo
*
pMnodeInfo
=
&
pMnodes
->
nodeInfos
[
i
];
...
@@ -696,12 +695,12 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
...
@@ -696,12 +695,12 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
//strcpy(pStatus->dnodeName, tsDnodeName);
//strcpy(pStatus->dnodeName, tsDnodeName);
pStatus
->
version
=
htonl
(
tsVersion
);
pStatus
->
version
=
htonl
(
tsVersion
);
pStatus
->
dnodeId
=
htonl
(
tsDnodeCfg
.
dnodeId
);
pStatus
->
dnodeId
=
htonl
(
tsDnodeCfg
.
dnodeId
);
pStatus
->
clusterId
=
htonl
(
tsDnodeCfg
.
clusterId
);
strcpy
(
pStatus
->
dnodeEp
,
tsLocalEp
);
pStatus
->
lastReboot
=
htonl
(
tsRebootTime
);
pStatus
->
lastReboot
=
htonl
(
tsRebootTime
);
pStatus
->
numOfCores
=
htons
((
uint16_t
)
tsNumOfCores
);
pStatus
->
numOfCores
=
htons
((
uint16_t
)
tsNumOfCores
);
pStatus
->
diskAvailable
=
tsAvailDataDirGB
;
pStatus
->
diskAvailable
=
tsAvailDataDirGB
;
pStatus
->
alternativeRole
=
(
uint8_t
)
tsAlternativeRole
;
pStatus
->
alternativeRole
=
(
uint8_t
)
tsAlternativeRole
;
tstrncpy
(
pStatus
->
clusterId
,
tsDnodeCfg
.
clusterId
,
TSDB_CLUSTER_ID_LEN
);
tstrncpy
(
pStatus
->
dnodeEp
,
tsLocalEp
,
TSDB_EP_LEN
);
// fill cluster cfg parameters
// fill cluster cfg parameters
pStatus
->
clusterCfg
.
numOfMnodes
=
htonl
(
tsNumOfMnodes
);
pStatus
->
clusterCfg
.
numOfMnodes
=
htonl
(
tsNumOfMnodes
);
...
@@ -768,11 +767,11 @@ static bool dnodeReadDnodeCfg() {
...
@@ -768,11 +767,11 @@ static bool dnodeReadDnodeCfg() {
tsDnodeCfg
.
dnodeId
=
dnodeId
->
valueint
;
tsDnodeCfg
.
dnodeId
=
dnodeId
->
valueint
;
cJSON
*
clusterId
=
cJSON_GetObjectItem
(
root
,
"clusterId"
);
cJSON
*
clusterId
=
cJSON_GetObjectItem
(
root
,
"clusterId"
);
if
(
!
clusterId
||
clusterId
->
type
!=
cJSON_
Number
)
{
if
(
!
clusterId
||
clusterId
->
type
!=
cJSON_
String
)
{
dError
(
"failed to read dnodeCfg.json, clusterId not found"
);
dError
(
"failed to read dnodeCfg.json, clusterId not found"
);
goto
PARSE_CFG_OVER
;
goto
PARSE_CFG_OVER
;
}
}
ts
DnodeCfg
.
clusterId
=
clusterId
->
valueint
;
ts
trncpy
(
tsDnodeCfg
.
clusterId
,
clusterId
->
valuestring
,
TSDB_CLUSTER_ID_LEN
)
;
ret
=
true
;
ret
=
true
;
...
@@ -793,12 +792,12 @@ static void dnodeSaveDnodeCfg() {
...
@@ -793,12 +792,12 @@ static void dnodeSaveDnodeCfg() {
if
(
!
fp
)
return
;
if
(
!
fp
)
return
;
int32_t
len
=
0
;
int32_t
len
=
0
;
int32_t
maxLen
=
1
00
;
int32_t
maxLen
=
2
00
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodeId
\"
: %d,
\n
"
,
tsDnodeCfg
.
dnodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodeId
\"
: %d,
\n
"
,
tsDnodeCfg
.
dnodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
clusterId
\"
:
%d
\n
"
,
tsDnodeCfg
.
clusterId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
clusterId
\"
:
\"
%s
\"
\n
"
,
tsDnodeCfg
.
clusterId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fwrite
(
content
,
1
,
len
,
fp
);
...
@@ -811,9 +810,9 @@ static void dnodeSaveDnodeCfg() {
...
@@ -811,9 +810,9 @@ static void dnodeSaveDnodeCfg() {
void
dnodeUpdateDnodeCfg
(
SDMDnodeCfg
*
pCfg
)
{
void
dnodeUpdateDnodeCfg
(
SDMDnodeCfg
*
pCfg
)
{
if
(
tsDnodeCfg
.
dnodeId
==
0
)
{
if
(
tsDnodeCfg
.
dnodeId
==
0
)
{
dInfo
(
"dnodeId is set to %d, clusterId is set to %
d
"
,
pCfg
->
dnodeId
,
pCfg
->
clusterId
);
dInfo
(
"dnodeId is set to %d, clusterId is set to %
s
"
,
pCfg
->
dnodeId
,
pCfg
->
clusterId
);
tsDnodeCfg
.
dnodeId
=
pCfg
->
dnodeId
;
tsDnodeCfg
.
dnodeId
=
pCfg
->
dnodeId
;
ts
DnodeCfg
.
clusterId
=
pCfg
->
clusterId
;
ts
trncpy
(
tsDnodeCfg
.
clusterId
,
pCfg
->
clusterId
,
TSDB_CLUSTER_ID_LEN
)
;
dnodeSaveDnodeCfg
();
dnodeSaveDnodeCfg
();
}
}
}
}
...
...
src/dnode/src/dnodeTelemetry.c
浏览文件 @
8a68dd6e
...
@@ -174,7 +174,7 @@ static void addVersionInfo(SBufferWriter* bw) {
...
@@ -174,7 +174,7 @@ static void addVersionInfo(SBufferWriter* bw) {
}
}
static
void
addRuntimeInfo
(
SBufferWriter
*
bw
)
{
static
void
addRuntimeInfo
(
SBufferWriter
*
bw
)
{
add
Int
Field
(
bw
,
"clusterId"
,
mnodeGetClusterId
());
add
String
Field
(
bw
,
"clusterId"
,
mnodeGetClusterId
());
// addIntField(&bw, "numOfDnode", 1);
// addIntField(&bw, "numOfDnode", 1);
// addIntField(&bw, "numOfVnode", 1);
// addIntField(&bw, "numOfVnode", 1);
// addIntField(&bw, "numOfStable", 1);
// addIntField(&bw, "numOfStable", 1);
...
...
src/inc/taosdef.h
浏览文件 @
8a68dd6e
...
@@ -254,6 +254,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
...
@@ -254,6 +254,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_TIMEZONE_LEN 96
#define TSDB_TIMEZONE_LEN 96
#define TSDB_LABEL_LEN 8
#define TSDB_LABEL_LEN 8
#define TSDB_CLUSTER_ID_LEN 40
#define TSDB_FQDN_LEN 128
#define TSDB_FQDN_LEN 128
#define TSDB_EP_LEN (TSDB_FQDN_LEN+6)
#define TSDB_EP_LEN (TSDB_FQDN_LEN+6)
#define TSDB_IPv4ADDR_LEN 16
#define TSDB_IPv4ADDR_LEN 16
...
...
src/inc/taosmsg.h
浏览文件 @
8a68dd6e
...
@@ -548,10 +548,10 @@ typedef struct {
...
@@ -548,10 +548,10 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
int32_t
clusterId
;
uint32_t
moduleStatus
;
uint32_t
moduleStatus
;
uint32_t
numOfVnodes
;
uint32_t
numOfVnodes
;
uint32_t
reserved
;
char
clusterId
[
TSDB_CLUSTER_ID_LEN
];
char
reserved
[
16
];
}
SDMDnodeCfg
;
}
SDMDnodeCfg
;
typedef
struct
{
typedef
struct
{
...
@@ -589,7 +589,7 @@ typedef struct {
...
@@ -589,7 +589,7 @@ typedef struct {
uint16_t
openVnodes
;
uint16_t
openVnodes
;
uint16_t
numOfCores
;
uint16_t
numOfCores
;
float
diskAvailable
;
// GB
float
diskAvailable
;
// GB
int32_t
clusterId
;
char
clusterId
[
TSDB_CLUSTER_ID_LEN
]
;
uint8_t
alternativeRole
;
uint8_t
alternativeRole
;
uint8_t
reserve2
[
15
];
uint8_t
reserve2
[
15
];
SClusterCfg
clusterCfg
;
SClusterCfg
clusterCfg
;
...
...
src/mnode/inc/mnodeCluster.h
浏览文件 @
8a68dd6e
...
@@ -20,16 +20,10 @@
...
@@ -20,16 +20,10 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
struct
SClusterObj
;
int32_t
mnodeInitCluster
();
int32_t
mnodeInitCluster
();
void
mnodeCleanupCluster
();
void
mnodeCleanupCluster
();
int32_t
mnodeGetClusterId
();
void
mnodeUpdateClusterId
();
void
mnodeUpdateClusterId
();
void
*
mnodeGetCluster
(
int32_t
clusterId
);
const
char
*
mnodeGetClusterId
();
void
*
mnodeGetNextCluster
(
void
*
pIter
,
struct
SClusterObj
**
pCluster
);
void
mnodeIncClusterRef
(
struct
SClusterObj
*
pCluster
);
void
mnodeDecClusterRef
(
struct
SClusterObj
*
pCluster
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
8a68dd6e
...
@@ -37,9 +37,9 @@ struct define notes:
...
@@ -37,9 +37,9 @@ struct define notes:
*/
*/
typedef
struct
SClusterObj
{
typedef
struct
SClusterObj
{
int32_t
clusterId
;
char
uid
[
TSDB_CLUSTER_ID_LEN
]
;
int64_t
createdTime
;
int64_t
createdTime
;
int8_t
reserved
[
36
];
int8_t
reserved
[
12
];
int8_t
updateEnd
[
4
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
int32_t
refCount
;
}
SClusterObj
;
}
SClusterObj
;
...
@@ -90,7 +90,7 @@ typedef struct STableObj {
...
@@ -90,7 +90,7 @@ typedef struct STableObj {
typedef
struct
SSuperTableObj
{
typedef
struct
SSuperTableObj
{
STableObj
info
;
STableObj
info
;
int8_t
reserved0
[
1
];
// for fill struct STableObj to 4byte align
int8_t
reserved0
[
9
];
// for fill struct STableObj to 4byte align
int16_t
nextColId
;
int16_t
nextColId
;
int32_t
sversion
;
int32_t
sversion
;
uint64_t
uid
;
uint64_t
uid
;
...
@@ -103,12 +103,11 @@ typedef struct SSuperTableObj {
...
@@ -103,12 +103,11 @@ typedef struct SSuperTableObj {
int32_t
numOfTables
;
int32_t
numOfTables
;
SSchema
*
schema
;
SSchema
*
schema
;
void
*
vgHash
;
void
*
vgHash
;
int8_t
reserved2
[
6
];
}
SSuperTableObj
;
}
SSuperTableObj
;
typedef
struct
{
typedef
struct
{
STableObj
info
;
STableObj
info
;
int8_t
reserved0
[
1
];
// for fill struct STableObj to 4byte align
int8_t
reserved0
[
9
];
// for fill struct STableObj to 4byte align
int16_t
nextColId
;
//used by normal table
int16_t
nextColId
;
//used by normal table
int32_t
sversion
;
//used by normal table
int32_t
sversion
;
//used by normal table
uint64_t
uid
;
uint64_t
uid
;
...
@@ -144,7 +143,7 @@ typedef struct SVgObj {
...
@@ -144,7 +143,7 @@ typedef struct SVgObj {
int8_t
status
;
int8_t
status
;
int8_t
reserved0
[
4
];
int8_t
reserved0
[
4
];
SVnodeGid
vnodeGid
[
TSDB_MAX_REPLICA
];
SVnodeGid
vnodeGid
[
TSDB_MAX_REPLICA
];
int8_t
reserved1
[
4
];
int8_t
reserved1
[
12
];
int8_t
updateEnd
[
4
];
int8_t
updateEnd
[
4
];
int32_t
refCount
;
int32_t
refCount
;
int32_t
numOfTables
;
int32_t
numOfTables
;
...
...
src/mnode/src/mnodeCluster.c
浏览文件 @
8a68dd6e
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
static
void
*
tsClusterSdb
=
NULL
;
static
void
*
tsClusterSdb
=
NULL
;
static
int32_t
tsClusterUpdateSize
;
static
int32_t
tsClusterUpdateSize
;
static
int32_t
tsClusterId
;
static
char
tsClusterId
[
TSDB_CLUSTER_ID_LEN
]
;
static
int32_t
mnodeCreateCluster
();
static
int32_t
mnodeCreateCluster
();
static
int32_t
mnodeGetClusterMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
static
int32_t
mnodeGetClusterMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
...
@@ -90,7 +90,7 @@ int32_t mnodeInitCluster() {
...
@@ -90,7 +90,7 @@ int32_t mnodeInitCluster() {
.
hashSessions
=
TSDB_DEFAULT_CLUSTER_HASH_SIZE
,
.
hashSessions
=
TSDB_DEFAULT_CLUSTER_HASH_SIZE
,
.
maxRowSize
=
tsClusterUpdateSize
,
.
maxRowSize
=
tsClusterUpdateSize
,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
refCountPos
=
(
int8_t
*
)(
&
tObj
.
refCount
)
-
(
int8_t
*
)
&
tObj
,
.
keyType
=
SDB_KEY_
INT
,
.
keyType
=
SDB_KEY_
STRING
,
.
insertFp
=
mnodeClusterActionInsert
,
.
insertFp
=
mnodeClusterActionInsert
,
.
deleteFp
=
mnodeClusterActionDelete
,
.
deleteFp
=
mnodeClusterActionDelete
,
.
updateFp
=
mnodeClusterActionUpdate
,
.
updateFp
=
mnodeClusterActionUpdate
,
...
@@ -118,10 +118,6 @@ void mnodeCleanupCluster() {
...
@@ -118,10 +118,6 @@ void mnodeCleanupCluster() {
tsClusterSdb
=
NULL
;
tsClusterSdb
=
NULL
;
}
}
void
*
mnodeGetCluster
(
int32_t
clusterId
)
{
return
sdbGetRow
(
tsClusterSdb
,
&
clusterId
);
}
void
*
mnodeGetNextCluster
(
void
*
pIter
,
SClusterObj
**
pCluster
)
{
void
*
mnodeGetNextCluster
(
void
*
pIter
,
SClusterObj
**
pCluster
)
{
return
sdbFetchRow
(
tsClusterSdb
,
pIter
,
(
void
**
)
pCluster
);
return
sdbFetchRow
(
tsClusterSdb
,
pIter
,
(
void
**
)
pCluster
);
}
}
...
@@ -141,7 +137,13 @@ static int32_t mnodeCreateCluster() {
...
@@ -141,7 +137,13 @@ static int32_t mnodeCreateCluster() {
SClusterObj
*
pCluster
=
malloc
(
sizeof
(
SClusterObj
));
SClusterObj
*
pCluster
=
malloc
(
sizeof
(
SClusterObj
));
memset
(
pCluster
,
0
,
sizeof
(
SClusterObj
));
memset
(
pCluster
,
0
,
sizeof
(
SClusterObj
));
pCluster
->
createdTime
=
taosGetTimestampMs
();
pCluster
->
createdTime
=
taosGetTimestampMs
();
pCluster
->
clusterId
=
labs
((
pCluster
->
createdTime
>>
32
)
&
(
pCluster
->
createdTime
))
|
(
*
(
int32_t
*
)
tsFirst
);
bool
getuid
=
taosGetSystemUid
(
pCluster
->
uid
);
if
(
!
getuid
)
{
strcpy
(
pCluster
->
uid
,
"tdengine2.0"
);
mError
(
"failed to get uid from system, set to default val %s"
,
pCluster
->
uid
);
}
else
{
mDebug
(
"uid is %s"
,
pCluster
->
uid
);
}
SSdbOper
oper
=
{
SSdbOper
oper
=
{
.
type
=
SDB_OPER_GLOBAL
,
.
type
=
SDB_OPER_GLOBAL
,
...
@@ -152,7 +154,7 @@ static int32_t mnodeCreateCluster() {
...
@@ -152,7 +154,7 @@ static int32_t mnodeCreateCluster() {
return
sdbInsertRow
(
&
oper
);
return
sdbInsertRow
(
&
oper
);
}
}
int32_t
mnodeGetClusterId
()
{
const
char
*
mnodeGetClusterId
()
{
return
tsClusterId
;
return
tsClusterId
;
}
}
...
@@ -160,8 +162,8 @@ void mnodeUpdateClusterId() {
...
@@ -160,8 +162,8 @@ void mnodeUpdateClusterId() {
SClusterObj
*
pCluster
=
NULL
;
SClusterObj
*
pCluster
=
NULL
;
void
*
pIter
=
mnodeGetNextCluster
(
NULL
,
&
pCluster
);
void
*
pIter
=
mnodeGetNextCluster
(
NULL
,
&
pCluster
);
if
(
pCluster
!=
NULL
)
{
if
(
pCluster
!=
NULL
)
{
ts
ClusterId
=
pCluster
->
clusterId
;
ts
trncpy
(
tsClusterId
,
pCluster
->
uid
,
TSDB_CLUSTER_ID_LEN
)
;
mInfo
(
"cluster id is
%d
"
,
tsClusterId
);
mInfo
(
"cluster id is
set to %s
"
,
tsClusterId
);
}
}
mnodeDecClusterRef
(
pCluster
);
mnodeDecClusterRef
(
pCluster
);
...
@@ -172,8 +174,8 @@ static int32_t mnodeGetClusterMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *
...
@@ -172,8 +174,8 @@ static int32_t mnodeGetClusterMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
schema
;
SSchema
*
pSchema
=
pMeta
->
schema
;
pShow
->
bytes
[
cols
]
=
4
;
pShow
->
bytes
[
cols
]
=
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_
INT
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_
BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"clusterId"
);
strcpy
(
pSchema
[
cols
].
name
,
"clusterId"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
...
@@ -212,7 +214,7 @@ static int32_t mnodeRetrieveClusters(SShowObj *pShow, char *data, int32_t rows,
...
@@ -212,7 +214,7 @@ static int32_t mnodeRetrieveClusters(SShowObj *pShow, char *data, int32_t rows,
cols
=
0
;
cols
=
0
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
pCluster
->
clusterId
;
STR_WITH_MAXSIZE_TO_VARSTR
(
pWrite
,
pCluster
->
uid
,
TSDB_CLUSTER_ID_LEN
)
;
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
8a68dd6e
...
@@ -353,7 +353,6 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -353,7 +353,6 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
clusterId
=
htonl
(
pStatus
->
clusterId
);
uint32_t
version
=
htonl
(
pStatus
->
version
);
uint32_t
version
=
htonl
(
pStatus
->
version
);
if
(
version
!=
tsVersion
)
{
if
(
version
!=
tsVersion
)
{
...
@@ -383,10 +382,10 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -383,10 +382,10 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pDnode
->
moduleStatus
=
pStatus
->
moduleStatus
;
pDnode
->
moduleStatus
=
pStatus
->
moduleStatus
;
if
(
pStatus
->
dnodeId
==
0
)
{
if
(
pStatus
->
dnodeId
==
0
)
{
mDebug
(
"dnode:%d %s, first access, set clusterId %
d
"
,
pDnode
->
dnodeId
,
pDnode
->
dnodeEp
,
mnodeGetClusterId
());
mDebug
(
"dnode:%d %s, first access, set clusterId %
s
"
,
pDnode
->
dnodeId
,
pDnode
->
dnodeEp
,
mnodeGetClusterId
());
}
else
{
}
else
{
if
(
pStatus
->
clusterId
!=
mnodeGetClusterId
()
)
{
if
(
strncmp
(
pStatus
->
clusterId
,
mnodeGetClusterId
(),
TSDB_CLUSTER_ID_LEN
-
1
)
!=
0
)
{
mError
(
"dnode:%d, input clusterId %
d not match with exist %d
"
,
pDnode
->
dnodeId
,
pStatus
->
clusterId
,
mError
(
"dnode:%d, input clusterId %
s not match with exist %s
"
,
pDnode
->
dnodeId
,
pStatus
->
clusterId
,
mnodeGetClusterId
());
mnodeGetClusterId
());
return
TSDB_CODE_MND_INVALID_CLUSTER_ID
;
return
TSDB_CODE_MND_INVALID_CLUSTER_ID
;
}
else
{
}
else
{
...
@@ -405,7 +404,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
...
@@ -405,7 +404,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pRsp
->
dnodeCfg
.
dnodeId
=
htonl
(
pDnode
->
dnodeId
);
pRsp
->
dnodeCfg
.
dnodeId
=
htonl
(
pDnode
->
dnodeId
);
pRsp
->
dnodeCfg
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeCfg
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeCfg
.
numOfVnodes
=
htonl
(
openVnodes
);
pRsp
->
dnodeCfg
.
numOfVnodes
=
htonl
(
openVnodes
);
pRsp
->
dnodeCfg
.
clusterId
=
htonl
(
mnodeGetClusterId
()
);
tstrncpy
(
pRsp
->
dnodeCfg
.
clusterId
,
mnodeGetClusterId
(),
TSDB_CLUSTER_ID_LEN
);
SDMVgroupAccess
*
pAccess
=
(
SDMVgroupAccess
*
)((
char
*
)
pRsp
+
sizeof
(
SDMStatusRsp
));
SDMVgroupAccess
*
pAccess
=
(
SDMVgroupAccess
*
)((
char
*
)
pRsp
+
sizeof
(
SDMStatusRsp
));
for
(
int32_t
j
=
0
;
j
<
openVnodes
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
openVnodes
;
++
j
)
{
...
...
src/os/inc/osSysinfo.h
浏览文件 @
8a68dd6e
...
@@ -31,6 +31,7 @@ bool taosGetSysMemory(float *memoryUsedMB);
...
@@ -31,6 +31,7 @@ bool taosGetSysMemory(float *memoryUsedMB);
void
taosPrintOsInfo
();
void
taosPrintOsInfo
();
int
taosSystem
(
const
char
*
cmd
)
;
int
taosSystem
(
const
char
*
cmd
)
;
void
taosKillSystem
();
void
taosKillSystem
();
bool
taosGetSystemUid
(
char
*
uid
);
// TAOS_OS_FUNC_SYSINFO_CORE
// TAOS_OS_FUNC_SYSINFO_CORE
void
taosSetCoreDump
();
void
taosSetCoreDump
();
...
...
src/os/src/detail/osSysinfo.c
浏览文件 @
8a68dd6e
...
@@ -639,4 +639,19 @@ void taosSetCoreDump() {
...
@@ -639,4 +639,19 @@ void taosSetCoreDump() {
}
}
bool
taosGetSystemUid
(
char
*
uid
)
{
int
fd
;
int
len
=
0
;
fd
=
open
(
"/proc/sys/kernel/random/uuid"
,
0
);
if
(
fd
<
0
)
{
return
false
;
}
else
{
len
=
read
(
fd
,
uid
,
TSDB_CLUSTER_ID_LEN
);
close
(
fd
);
}
return
len
>
0
;
}
#endif
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录