Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
d320f261
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看板
提交
d320f261
编写于
11月 20, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TBASE-1128]
上级
0eeae785
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
171 addition
and
117 deletion
+171
-117
src/inc/tsdb.h
src/inc/tsdb.h
+0
-34
src/inc/tstatus.h
src/inc/tstatus.h
+68
-2
src/system/detail/inc/mgmt.h
src/system/detail/inc/mgmt.h
+3
-14
src/system/detail/src/dnodeMgmt.c
src/system/detail/src/dnodeMgmt.c
+4
-4
src/system/detail/src/mgmtDb.c
src/system/detail/src/mgmtDb.c
+6
-5
src/system/detail/src/mgmtDnode.c
src/system/detail/src/mgmtDnode.c
+3
-3
src/system/detail/src/mgmtMeter.c
src/system/detail/src/mgmtMeter.c
+2
-1
src/system/detail/src/mgmtShell.c
src/system/detail/src/mgmtShell.c
+1
-0
src/system/detail/src/mgmtVgroup.c
src/system/detail/src/mgmtVgroup.c
+2
-1
src/system/detail/src/vnodeCache.c
src/system/detail/src/vnodeCache.c
+2
-1
src/system/detail/src/vnodeMeter.c
src/system/detail/src/vnodeMeter.c
+1
-1
src/system/detail/src/vnodeShell.c
src/system/detail/src/vnodeShell.c
+2
-1
src/system/detail/src/vnodeStore.c
src/system/detail/src/vnodeStore.c
+11
-11
src/system/detail/src/vnodeStream.c
src/system/detail/src/vnodeStream.c
+2
-1
src/system/lite/src/mgmtBalance.spec.c
src/system/lite/src/mgmtBalance.spec.c
+2
-2
src/system/lite/src/mgmtDnode.spec.c
src/system/lite/src/mgmtDnode.spec.c
+1
-1
src/system/lite/src/mgmtDnodeInt.spec.c
src/system/lite/src/mgmtDnodeInt.spec.c
+4
-4
src/system/lite/src/vnodePeer.spec.c
src/system/lite/src/vnodePeer.spec.c
+1
-1
src/util/src/tstatus.c
src/util/src/tstatus.c
+56
-30
未找到文件。
src/inc/tsdb.h
浏览文件 @
d320f261
...
@@ -44,40 +44,6 @@ extern "C" {
...
@@ -44,40 +44,6 @@ extern "C" {
#define TSDB_TIME_PRECISION_MILLI_STR "ms"
#define TSDB_TIME_PRECISION_MILLI_STR "ms"
#define TSDB_TIME_PRECISION_MICRO_STR "us"
#define TSDB_TIME_PRECISION_MICRO_STR "us"
enum
_vnode_status
{
TSDB_VNODE_STATUS_OFFLINE
,
TSDB_VNODE_STATUS_CREATING
,
TSDB_VNODE_STATUS_UNSYNCED
,
TSDB_VNODE_STATUS_SLAVE
,
TSDB_VNODE_STATUS_MASTER
,
TSDB_VNODE_STATUS_CLOSING
,
TSDB_VNODE_STATUS_DELETING
,
};
enum
_vnode_sync_status
{
STDB_SSTATUS_INIT
,
TSDB_SSTATUS_SYNCING
,
TSDB_SSTATUS_SYNC_CACHE
,
TSDB_SSTATUS_SYNC_FILE
,
};
enum
_dnode_status
{
TSDB_DNODE_STATUS_OFFLINE
,
TSDB_DNODE_STATUS_READY
};
enum
_dnode_balance_status
{
LB_DNODE_STATE_BALANCED
,
LB_DNODE_STATE_BALANCING
,
LB_DNODE_STATE_OFFLINE_REMOVING
,
LB_DNODE_STATE_SHELL_REMOVING
};
enum
_vgroup_status
{
LB_VGROUP_STATE_READY
,
LB_VGROUP_STATE_UPDATE
};
#define TSDB_DATA_TYPE_BOOL 1 // 1 bytes
#define TSDB_DATA_TYPE_BOOL 1 // 1 bytes
#define TSDB_DATA_TYPE_TINYINT 2 // 1 byte
#define TSDB_DATA_TYPE_TINYINT 2 // 1 byte
#define TSDB_DATA_TYPE_SMALLINT 3 // 2 bytes
#define TSDB_DATA_TYPE_SMALLINT 3 // 2 bytes
...
...
src/inc/tstatus.h
浏览文件 @
d320f261
...
@@ -20,11 +20,77 @@
...
@@ -20,11 +20,77 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
enum
_TSDB_VG_STATUS
{
TSDB_VG_STATUS_READY
,
TSDB_VG_STATUS_IN_PROGRESS
,
TSDB_VG_STATUS_COMMITLOG_INIT_FAILED
,
TSDB_VG_STATUS_INIT_FAILED
,
TSDB_VG_STATUS_FULL
};
enum
_TSDB_DB_STATUS
{
TSDB_DB_STATUS_READY
,
TSDB_DB_STATUS_DROPPING
,
TSDB_DB_STATUS_DROP_FROM_SDB
};
enum
_TSDB_VN_STATUS
{
TSDB_VN_STATUS_OFFLINE
,
TSDB_VN_STATUS_CREATING
,
TSDB_VN_STATUS_UNSYNCED
,
TSDB_VN_STATUS_SLAVE
,
TSDB_VN_STATUS_MASTER
,
TSDB_VN_STATUS_CLOSING
,
TSDB_VN_STATUS_DELETING
,
};
enum
_TSDB_VN_SYNC_STATUS
{
TSDB_VN_SYNC_STATUS_INIT
,
TSDB_VN_SYNC_STATUS_SYNCING
,
TSDB_VN_SYNC_STATUS_SYNC_CACHE
,
TSDB_VN_SYNC_STATUS_SYNC_FILE
};
enum
_TSDB_VN_DROP_STATUS
{
TSDB_VN_DROP_STATUS_READY
,
TSDB_VN_DROP_STATUS_DROPPING
};
enum
_TSDB_DN_STATUS
{
TSDB_DN_STATUS_OFFLINE
,
TSDB_DN_STATUS_READY
};
enum
_TSDB_DN_LB_STATUS
{
TSDB_DN_LB_STATUS_BALANCED
,
TSDB_DN_LB_STATUS_BALANCING
,
TSDB_DN_LB_STATUS_OFFLINE_REMOVING
,
TSDB_DN_LB_STATE_SHELL_REMOVING
};
enum
_TSDB_VG_LB_STATUS
{
TSDB_VG_LB_STATUS_READY
,
TSDB_VG_LB_STATUS_UPDATE
};
enum
_TSDB_LB_TYPE
{
TSDB_LB_TYPE_SCHEDULE
,
TSDB_LB_TYPE_SOON
,
};
enum
_TSDB_LB_REASON
{
TSDB_LB_REASON_PERIOD
,
TSDB_LB_REASON_EVENT
,
};
const
char
*
taosGetVnodeStatusStr
(
int
vnodeStatus
);
const
char
*
taosGetVnodeStatusStr
(
int
vnodeStatus
);
const
char
*
taosGetDnodeStatusStr
(
int
dnodeStatus
);
const
char
*
taosGetDnodeBalanceStateStr
(
int
dnodeBalanceStatus
);
const
char
*
taosGetVnodeSyncStatusStr
(
int
vnodeSyncStatus
);
const
char
*
taosGetVnodeSyncStatusStr
(
int
vnodeSyncStatus
);
const
char
*
taosGetVnodeDropStatusStr
(
int
dropping
);
const
char
*
taosGetVnodeDropStatusStr
(
int
dropping
);
const
char
*
taosGetDnodeStatusStr
(
int
dnodeStatus
);
const
char
*
taosGetDnodeLbStatusStr
(
int
dnodeBalanceStatus
);
const
char
*
taosGetBalanceTypeStr
(
int
type
);
const
char
*
taosBalanceReasonStr
(
int
reason
);
const
char
*
taosGetVgroupLbStatusStr
(
int
vglbStatus
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/system/detail/inc/mgmt.h
浏览文件 @
d320f261
...
@@ -45,17 +45,6 @@ extern int mgmtShellConns;
...
@@ -45,17 +45,6 @@ extern int mgmtShellConns;
extern
int
mgmtDnodeConns
;
extern
int
mgmtDnodeConns
;
extern
char
mgmtDirectory
[];
extern
char
mgmtDirectory
[];
enum
_TSDB_VG_STATUS
{
TSDB_VG_STATUS_READY
,
TSDB_VG_STATUS_IN_PROGRESS
,
TSDB_VG_STATUS_COMMITLOG_INIT_FAILED
,
TSDB_VG_STATUS_INIT_FAILED
,
TSDB_VG_STATUS_FULL
};
enum
_TSDB_DB_STATUS
{
TSDB_DB_STATUS_READY
,
TSDB_DB_STATUS_DROPPING
,
TSDB_DB_STATUS_DROP_FROM_SDB
};
enum
_TSDB_VN_STATUS
{
TSDB_VN_STATUS_READY
,
TSDB_VN_STATUS_DROPPING
};
typedef
struct
{
typedef
struct
{
uint32_t
privateIp
;
uint32_t
privateIp
;
...
@@ -86,7 +75,7 @@ typedef struct {
...
@@ -86,7 +75,7 @@ typedef struct {
uint16_t
slot
;
uint16_t
slot
;
int32_t
customScore
;
// config by user
int32_t
customScore
;
// config by user
float
lbScore
;
// calc in balance function
float
lbScore
;
// calc in balance function
int16_t
lbStat
e
;
// set in balance function
int16_t
lbStat
us
;
// set in balance function
int16_t
lastAllocVnode
;
// increase while create vnode
int16_t
lastAllocVnode
;
// increase while create vnode
SVnodeLoad
vload
[
TSDB_MAX_VNODES
];
SVnodeLoad
vload
[
TSDB_MAX_VNODES
];
char
reserved
[
16
];
char
reserved
[
16
];
...
@@ -148,7 +137,7 @@ typedef struct _vg_obj {
...
@@ -148,7 +137,7 @@ typedef struct _vg_obj {
int32_t
numOfMeters
;
int32_t
numOfMeters
;
int32_t
lbIp
;
int32_t
lbIp
;
int32_t
lbTime
;
int32_t
lbTime
;
int8_t
lbStat
e
;
int8_t
lbStat
us
;
char
reserved
[
16
];
char
reserved
[
16
];
char
updateEnd
[
1
];
char
updateEnd
[
1
];
struct
_vg_obj
*
prev
,
*
next
;
struct
_vg_obj
*
prev
,
*
next
;
...
@@ -426,7 +415,7 @@ void mgmtSetDnodeShellRemoving(SDnodeObj *pDnode);
...
@@ -426,7 +415,7 @@ void mgmtSetDnodeShellRemoving(SDnodeObj *pDnode);
void
mgmtSetDnodeUnRemove
(
SDnodeObj
*
pDnode
);
void
mgmtSetDnodeUnRemove
(
SDnodeObj
*
pDnode
);
void
mgmtStartBalanceTimer
(
int
mseconds
);
void
mgmtStartBalanceTimer
(
int
mseconds
);
void
mgmtSetDnodeOfflineOnSdbChanged
();
void
mgmtSetDnodeOfflineOnSdbChanged
();
void
mgmtUpdateVgroupState
(
SVgObj
*
pVgroup
,
int
lbStat
e
,
int
srcIp
);
void
mgmtUpdateVgroupState
(
SVgObj
*
pVgroup
,
int
lbStat
us
,
int
srcIp
);
bool
mgmtAddVnode
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
);
bool
mgmtAddVnode
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
);
void
mgmtSetModuleInDnode
(
SDnodeObj
*
pDnode
,
int
moduleType
);
void
mgmtSetModuleInDnode
(
SDnodeObj
*
pDnode
,
int
moduleType
);
...
...
src/system/detail/src/dnodeMgmt.c
浏览文件 @
d320f261
...
@@ -116,7 +116,7 @@ int vnodeProcessCreateMeterRequest(char *pMsg, int msgLen, SMgmtObj *pObj) {
...
@@ -116,7 +116,7 @@ int vnodeProcessCreateMeterRequest(char *pMsg, int msgLen, SMgmtObj *pObj) {
goto
_over
;
goto
_over
;
}
}
if
(
pVnode
->
syncStatus
==
TSDB_
S
STATUS_SYNCING
)
{
if
(
pVnode
->
syncStatus
==
TSDB_
VN_SYNC_
STATUS_SYNCING
)
{
code
=
vnodeSaveCreateMsgIntoQueue
(
pVnode
,
pMsg
,
msgLen
);
code
=
vnodeSaveCreateMsgIntoQueue
(
pVnode
,
pMsg
,
msgLen
);
dTrace
(
"vid:%d, create msg is saved into sync queue"
,
vid
);
dTrace
(
"vid:%d, create msg is saved into sync queue"
,
vid
);
}
else
{
}
else
{
...
@@ -331,7 +331,7 @@ int vnodeProcessVPeerCfg(char *msg, int msgLen, SMgmtObj *pMgmtObj) {
...
@@ -331,7 +331,7 @@ int vnodeProcessVPeerCfg(char *msg, int msgLen, SMgmtObj *pMgmtObj) {
return
-
1
;
return
-
1
;
}
}
if
(
vnodeList
[
vnode
].
vnodeStatus
==
TSDB_VN
ODE
_STATUS_CREATING
)
{
if
(
vnodeList
[
vnode
].
vnodeStatus
==
TSDB_VN_STATUS_CREATING
)
{
dTrace
(
"vid:%d, vnode is still under creating"
,
vnode
);
dTrace
(
"vid:%d, vnode is still under creating"
,
vnode
);
return
0
;
return
0
;
}
}
...
@@ -362,7 +362,7 @@ int vnodeProcessVPeerCfg(char *msg, int msgLen, SMgmtObj *pMgmtObj) {
...
@@ -362,7 +362,7 @@ int vnodeProcessVPeerCfg(char *msg, int msgLen, SMgmtObj *pMgmtObj) {
if
(
vnodeList
[
vnode
].
cfg
.
maxSessions
==
0
)
{
if
(
vnodeList
[
vnode
].
cfg
.
maxSessions
==
0
)
{
dTrace
(
"vid:%d, vnode is empty"
,
vnode
);
dTrace
(
"vid:%d, vnode is empty"
,
vnode
);
if
(
pCfg
->
maxSessions
>
0
)
{
if
(
pCfg
->
maxSessions
>
0
)
{
if
(
vnodeList
[
vnode
].
vnodeStatus
==
TSDB_VN
ODE
_STATUS_OFFLINE
)
{
if
(
vnodeList
[
vnode
].
vnodeStatus
==
TSDB_VN_STATUS_OFFLINE
)
{
dTrace
(
"vid:%d, status:%s, start to create vnode"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
dTrace
(
"vid:%d, status:%s, start to create vnode"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
return
vnodeCreateVnode
(
vnode
,
pCfg
,
pMsg
->
vpeerDesc
);
return
vnodeCreateVnode
(
vnode
,
pCfg
,
pMsg
->
vpeerDesc
);
}
else
{
}
else
{
...
@@ -373,7 +373,7 @@ int vnodeProcessVPeerCfg(char *msg, int msgLen, SMgmtObj *pMgmtObj) {
...
@@ -373,7 +373,7 @@ int vnodeProcessVPeerCfg(char *msg, int msgLen, SMgmtObj *pMgmtObj) {
}
else
{
}
else
{
dTrace
(
"vid:%d, vnode is not empty"
,
vnode
);
dTrace
(
"vid:%d, vnode is not empty"
,
vnode
);
if
(
pCfg
->
maxSessions
>
0
)
{
if
(
pCfg
->
maxSessions
>
0
)
{
if
(
vnodeList
[
vnode
].
vnodeStatus
==
TSDB_VN
ODE
_STATUS_DELETING
)
{
if
(
vnodeList
[
vnode
].
vnodeStatus
==
TSDB_VN_STATUS_DELETING
)
{
dTrace
(
"vid:%d, status:%s, wait vnode delete finished"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
dTrace
(
"vid:%d, status:%s, wait vnode delete finished"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
}
else
{
}
else
{
dTrace
(
"vid:%d, status:%s, start to update vnode"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
dTrace
(
"vid:%d, status:%s, start to update vnode"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
...
...
src/system/detail/src/mgmtDb.c
浏览文件 @
d320f261
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "mgmtBalance.h"
#include "mgmtBalance.h"
#include "mgmtUtil.h"
#include "mgmtUtil.h"
#include "tschemautil.h"
#include "tschemautil.h"
#include "tstatus.h"
void
*
dbSdb
=
NULL
;
void
*
dbSdb
=
NULL
;
int
tsDbUpdateSize
;
int
tsDbUpdateSize
;
...
@@ -281,8 +282,8 @@ int mgmtSetDbDropping(SDbObj *pDb) {
...
@@ -281,8 +282,8 @@ int mgmtSetDbDropping(SDbObj *pDb) {
if
(
pDnode
==
NULL
)
continue
;
if
(
pDnode
==
NULL
)
continue
;
SVnodeLoad
*
pVload
=
&
pDnode
->
vload
[
pVnodeGid
->
vnode
];
SVnodeLoad
*
pVload
=
&
pDnode
->
vload
[
pVnodeGid
->
vnode
];
if
(
pVload
->
dropStatus
!=
TSDB_VN_STATUS_DROPPING
)
{
if
(
pVload
->
dropStatus
!=
TSDB_VN_
DROP_
STATUS_DROPPING
)
{
pVload
->
dropStatus
=
TSDB_VN_STATUS_DROPPING
;
pVload
->
dropStatus
=
TSDB_VN_
DROP_
STATUS_DROPPING
;
mPrint
(
"dnode:%s vnode:%d db:%s set to dropping status"
,
taosIpStr
(
pDnode
->
privateIp
),
pVnodeGid
->
vnode
,
pDb
->
name
);
mPrint
(
"dnode:%s vnode:%d db:%s set to dropping status"
,
taosIpStr
(
pDnode
->
privateIp
),
pVnodeGid
->
vnode
,
pDb
->
name
);
if
(
mgmtUpdateDnode
(
pDnode
)
<
0
)
{
if
(
mgmtUpdateDnode
(
pDnode
)
<
0
)
{
...
@@ -315,10 +316,10 @@ bool mgmtCheckDropDbFinished(SDbObj *pDb) {
...
@@ -315,10 +316,10 @@ bool mgmtCheckDropDbFinished(SDbObj *pDb) {
SDnodeObj
*
pDnode
=
mgmtGetDnode
(
pVnodeGid
->
ip
);
SDnodeObj
*
pDnode
=
mgmtGetDnode
(
pVnodeGid
->
ip
);
if
(
pDnode
==
NULL
)
continue
;
if
(
pDnode
==
NULL
)
continue
;
if
(
pDnode
->
status
==
TSDB_DN
ODE
_STATUS_OFFLINE
)
continue
;
if
(
pDnode
->
status
==
TSDB_DN_STATUS_OFFLINE
)
continue
;
SVnodeLoad
*
pVload
=
&
pDnode
->
vload
[
pVnodeGid
->
vnode
];
SVnodeLoad
*
pVload
=
&
pDnode
->
vload
[
pVnodeGid
->
vnode
];
if
(
pVload
->
dropStatus
==
TSDB_VN_STATUS_DROPPING
)
{
if
(
pVload
->
dropStatus
==
TSDB_VN_
DROP_
STATUS_DROPPING
)
{
mTrace
(
"dnode:%s, vnode:%d db:%s wait dropping"
,
taosIpStr
(
pDnode
->
privateIp
),
pVnodeGid
->
vnode
,
pDb
->
name
);
mTrace
(
"dnode:%s, vnode:%d db:%s wait dropping"
,
taosIpStr
(
pDnode
->
privateIp
),
pVnodeGid
->
vnode
,
pDb
->
name
);
return
false
;
return
false
;
}
}
...
@@ -444,7 +445,7 @@ int mgmtAlterDb(SAcctObj *pAcct, SAlterDbMsg *pAlter) {
...
@@ -444,7 +445,7 @@ int mgmtAlterDb(SAcctObj *pAcct, SAlterDbMsg *pAlter) {
SVgObj
*
pVgroup
=
pDb
->
pHead
;
SVgObj
*
pVgroup
=
pDb
->
pHead
;
while
(
pVgroup
!=
NULL
)
{
while
(
pVgroup
!=
NULL
)
{
mgmtUpdateVgroupState
(
pVgroup
,
LB_VGROUP_STATE
_UPDATE
,
0
);
mgmtUpdateVgroupState
(
pVgroup
,
TSDB_VG_LB_STATUS
_UPDATE
,
0
);
if
(
oldReplicaNum
<
pDb
->
cfg
.
replications
)
{
if
(
oldReplicaNum
<
pDb
->
cfg
.
replications
)
{
if
(
!
mgmtAddVnode
(
pVgroup
,
NULL
,
NULL
))
{
if
(
!
mgmtAddVnode
(
pVgroup
,
NULL
,
NULL
))
{
mWarn
(
"db:%s vgroup:%d not enough dnode to add vnode"
,
pAlter
->
db
,
pVgroup
->
vgId
);
mWarn
(
"db:%s vgroup:%d not enough dnode to add vnode"
,
pAlter
->
db
,
pVgroup
->
vgId
);
...
...
src/system/detail/src/mgmtDnode.c
浏览文件 @
d320f261
...
@@ -44,9 +44,9 @@ void mgmtSetDnodeMaxVnodes(SDnodeObj *pDnode) {
...
@@ -44,9 +44,9 @@ void mgmtSetDnodeMaxVnodes(SDnodeObj *pDnode) {
pDnode
->
openVnodes
=
0
;
pDnode
->
openVnodes
=
0
;
#ifdef CLUSTER
#ifdef CLUSTER
pDnode
->
status
=
TSDB_DN
ODE
_STATUS_OFFLINE
;
pDnode
->
status
=
TSDB_DN_STATUS_OFFLINE
;
#else
#else
pDnode
->
status
=
TSDB_DN
ODE
_STATUS_READY
;
pDnode
->
status
=
TSDB_DN_STATUS_READY
;
#endif
#endif
}
}
...
@@ -201,7 +201,7 @@ int mgmtRetrieveDnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn) {
...
@@ -201,7 +201,7 @@ int mgmtRetrieveDnodes(SShowObj *pShow, char *data, int rows, SConnObj *pConn) {
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
taosGetDnode
BalanceStateStr
(
pDnode
->
lbState
));
strcpy
(
pWrite
,
taosGetDnode
LbStatusStr
(
pDnode
->
lbStatus
));
cols
++
;
cols
++
;
tinet_ntoa
(
ipstr
,
pDnode
->
publicIp
);
tinet_ntoa
(
ipstr
,
pDnode
->
publicIp
);
...
...
src/system/detail/src/mgmtMeter.c
浏览文件 @
d320f261
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include "tsqlfunction.h"
#include "tsqlfunction.h"
#include "ttime.h"
#include "ttime.h"
#include "vnodeTagMgmt.h"
#include "vnodeTagMgmt.h"
#include "tstatus.h"
extern
int64_t
sdbVersion
;
extern
int64_t
sdbVersion
;
...
@@ -661,7 +662,7 @@ int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate) {
...
@@ -661,7 +662,7 @@ int mgmtCreateMeter(SDbObj *pDb, SCreateTableMsg *pCreate) {
pMeter
->
uid
=
(((
uint64_t
)
pMeter
->
gid
.
vgId
)
<<
40
)
+
((((
uint64_t
)
pMeter
->
gid
.
sid
)
&
((
1ul
<<
24
)
-
1ul
))
<<
16
)
+
pMeter
->
uid
=
(((
uint64_t
)
pMeter
->
gid
.
vgId
)
<<
40
)
+
((((
uint64_t
)
pMeter
->
gid
.
sid
)
&
((
1ul
<<
24
)
-
1ul
))
<<
16
)
+
((
uint64_t
)
sdbVersion
&
((
1ul
<<
16
)
-
1ul
));
((
uint64_t
)
sdbVersion
&
((
1ul
<<
16
)
-
1ul
));
mTrace
(
"table:%s, create table in vgroup, vgId:%d sid:%d vnode:%d uid:%d db:%s"
,
mTrace
(
"table:%s, create table in vgroup, vgId:%d sid:%d vnode:%d uid:%
l
d db:%s"
,
pMeter
->
meterId
,
pVgroup
->
vgId
,
sid
,
pVgroup
->
vnodeGid
[
0
].
vnode
,
pMeter
->
uid
,
pDb
->
name
);
pMeter
->
meterId
,
pVgroup
->
vgId
,
sid
,
pVgroup
->
vnodeGid
[
0
].
vnode
,
pMeter
->
uid
,
pDb
->
name
);
}
else
{
}
else
{
pMeter
->
uid
=
(((
uint64_t
)
pMeter
->
createdTime
)
<<
16
)
+
((
uint64_t
)
sdbVersion
&
((
1ul
<<
16
)
-
1ul
));
pMeter
->
uid
=
(((
uint64_t
)
pMeter
->
createdTime
)
<<
16
)
+
((
uint64_t
)
sdbVersion
&
((
1ul
<<
16
)
-
1ul
));
...
...
src/system/detail/src/mgmtShell.c
浏览文件 @
d320f261
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "mgmtProfile.h"
#include "mgmtProfile.h"
#include "taosmsg.h"
#include "taosmsg.h"
#include "tlog.h"
#include "tlog.h"
#include "tstatus.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic push
...
...
src/system/detail/src/mgmtVgroup.c
浏览文件 @
d320f261
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "mgmt.h"
#include "mgmt.h"
#include "tschemautil.h"
#include "tschemautil.h"
#include "tlog.h"
#include "tlog.h"
#include "tstatus.h"
void
*
vgSdb
=
NULL
;
void
*
vgSdb
=
NULL
;
int
tsVgUpdateSize
;
int
tsVgUpdateSize
;
...
@@ -312,7 +313,7 @@ int mgmtRetrieveVgroups(SShowObj *pShow, char *data, int rows, SConnObj *pConn)
...
@@ -312,7 +313,7 @@ int mgmtRetrieveVgroups(SShowObj *pShow, char *data, int rows, SConnObj *pConn)
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
pVgroup
->
lbState
?
"updating"
:
"ready"
);
strcpy
(
pWrite
,
taosGetVgroupLbStatusStr
(
pVgroup
->
lbStatus
)
);
cols
++
;
cols
++
;
for
(
int
i
=
0
;
i
<
maxReplica
;
++
i
)
{
for
(
int
i
=
0
;
i
<
maxReplica
;
++
i
)
{
...
...
src/system/detail/src/vnodeCache.c
浏览文件 @
d320f261
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "vnode.h"
#include "vnode.h"
#include "vnodeCache.h"
#include "vnodeCache.h"
#include "vnodeUtil.h"
#include "vnodeUtil.h"
#include "tstatus.h"
void
vnodeSearchPointInCache
(
SMeterObj
*
pObj
,
SQuery
*
pQuery
);
void
vnodeSearchPointInCache
(
SMeterObj
*
pObj
,
SQuery
*
pQuery
);
void
vnodeProcessCommitTimer
(
void
*
param
,
void
*
tmrId
);
void
vnodeProcessCommitTimer
(
void
*
param
,
void
*
tmrId
);
...
@@ -297,7 +298,7 @@ pthread_t vnodeCreateCommitThread(SVnodeObj *pVnode) {
...
@@ -297,7 +298,7 @@ pthread_t vnodeCreateCommitThread(SVnodeObj *pVnode) {
taosTmrStopA
(
&
pVnode
->
commitTimer
);
taosTmrStopA
(
&
pVnode
->
commitTimer
);
if
(
pVnode
->
vnodeStatus
==
TSDB_VN
ODE
_STATUS_UNSYNCED
)
{
if
(
pVnode
->
vnodeStatus
==
TSDB_VN_STATUS_UNSYNCED
)
{
taosTmrReset
(
vnodeProcessCommitTimer
,
pVnode
->
cfg
.
commitTime
*
1000
,
pVnode
,
vnodeTmrCtrl
,
&
pVnode
->
commitTimer
);
taosTmrReset
(
vnodeProcessCommitTimer
,
pVnode
->
cfg
.
commitTime
*
1000
,
pVnode
,
vnodeTmrCtrl
,
&
pVnode
->
commitTimer
);
dTrace
(
"vid:%d, it is in unsyc state, commit later"
,
pVnode
->
vnode
);
dTrace
(
"vid:%d, it is in unsyc state, commit later"
,
pVnode
->
vnode
);
return
pVnode
->
commitThread
;
return
pVnode
->
commitThread
;
...
...
src/system/detail/src/vnodeMeter.c
浏览文件 @
d320f261
...
@@ -484,7 +484,7 @@ int vnodeCreateMeterObj(SMeterObj *pNew, SConnSec *pSec) {
...
@@ -484,7 +484,7 @@ int vnodeCreateMeterObj(SMeterObj *pNew, SConnSec *pSec) {
vnodeSaveMeterObjToFile
(
pNew
);
vnodeSaveMeterObjToFile
(
pNew
);
// vnodeCreateMeterMgmt(pNew, pSec);
// vnodeCreateMeterMgmt(pNew, pSec);
vnodeCreateStream
(
pNew
);
vnodeCreateStream
(
pNew
);
dTrace
(
"vid:%d sid:%d id:%s, meterObj is created, uid:%ld"
,
pNew
->
vnode
,
pNew
->
sid
,
pNew
->
meterId
,
pNew
->
uid
);
dTrace
(
"vid:%d
,
sid:%d id:%s, meterObj is created, uid:%ld"
,
pNew
->
vnode
,
pNew
->
sid
,
pNew
->
meterId
,
pNew
->
uid
);
}
}
return
code
;
return
code
;
...
...
src/system/detail/src/vnodeShell.c
浏览文件 @
d320f261
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include "vnodeRead.h"
#include "vnodeRead.h"
#include "vnodeUtil.h"
#include "vnodeUtil.h"
#include "vnodeStore.h"
#include "vnodeStore.h"
#include "tstatus.h"
#pragma GCC diagnostic ignored "-Wint-conversion"
#pragma GCC diagnostic ignored "-Wint-conversion"
extern
int
tsMaxQueues
;
extern
int
tsMaxQueues
;
...
@@ -90,7 +91,7 @@ void *vnodeProcessMsgFromShell(char *msg, void *ahandle, void *thandle) {
...
@@ -90,7 +91,7 @@ void *vnodeProcessMsgFromShell(char *msg, void *ahandle, void *thandle) {
// if ( vnodeList[vnode].status != TSDB_STATUS_MASTER && pMsg->msgType != TSDB_MSG_TYPE_RETRIEVE ) {
// if ( vnodeList[vnode].status != TSDB_STATUS_MASTER && pMsg->msgType != TSDB_MSG_TYPE_RETRIEVE ) {
#ifdef CLUSTER
#ifdef CLUSTER
if
(
vnodeList
[
vnode
].
vnodeStatus
!=
TSDB_VN
ODE
_STATUS_MASTER
)
{
if
(
vnodeList
[
vnode
].
vnodeStatus
!=
TSDB_VN_STATUS_MASTER
)
{
taosSendSimpleRsp
(
thandle
,
pMsg
->
msgType
+
1
,
TSDB_CODE_NOT_READY
);
taosSendSimpleRsp
(
thandle
,
pMsg
->
msgType
+
1
,
TSDB_CODE_NOT_READY
);
dTrace
(
"vid:%d sid:%d, shell msg is ignored since in state:%d"
,
vnode
,
sid
,
vnodeList
[
vnode
].
vnodeStatus
);
dTrace
(
"vid:%d sid:%d, shell msg is ignored since in state:%d"
,
vnode
,
sid
,
vnodeList
[
vnode
].
vnodeStatus
);
}
else
{
}
else
{
...
...
src/system/detail/src/vnodeStore.c
浏览文件 @
d320f261
...
@@ -78,7 +78,7 @@ int vnodeOpenVnode(int vnode) {
...
@@ -78,7 +78,7 @@ int vnodeOpenVnode(int vnode) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
!
(
pVnode
->
vnodeStatus
==
TSDB_VN
ODE_STATUS_OFFLINE
||
pVnode
->
vnodeStatus
==
TSDB_VNODE
_STATUS_CREATING
))
{
if
(
!
(
pVnode
->
vnodeStatus
==
TSDB_VN
_STATUS_OFFLINE
||
pVnode
->
vnodeStatus
==
TSDB_VN
_STATUS_CREATING
))
{
dError
(
"vid:%d, status:%s, cannot enter open operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
dError
(
"vid:%d, status:%s, cannot enter open operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
return
TSDB_CODE_INVALID_VNODE_STATUS
;
return
TSDB_CODE_INVALID_VNODE_STATUS
;
}
}
...
@@ -140,12 +140,12 @@ static int vnodeCloseVnode(int vnode) {
...
@@ -140,12 +140,12 @@ static int vnodeCloseVnode(int vnode) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
pVnode
->
vnodeStatus
==
TSDB_VN
ODE
_STATUS_DELETING
)
{
if
(
pVnode
->
vnodeStatus
==
TSDB_VN_STATUS_DELETING
)
{
dTrace
(
"vid:%d, status:%s, another thread performed delete operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
dTrace
(
"vid:%d, status:%s, another thread performed delete operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
}
else
{
dTrace
(
"vid:%d, status:%s, enter close operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
dTrace
(
"vid:%d, status:%s, enter close operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
pVnode
->
vnodeStatus
=
TSDB_VN
ODE
_STATUS_CLOSING
;
pVnode
->
vnodeStatus
=
TSDB_VN_STATUS_CLOSING
;
}
}
// set the meter is dropped flag
// set the meter is dropped flag
...
@@ -155,7 +155,7 @@ static int vnodeCloseVnode(int vnode) {
...
@@ -155,7 +155,7 @@ static int vnodeCloseVnode(int vnode) {
}
}
dTrace
(
"vid:%d, status:%s, enter delete operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
dTrace
(
"vid:%d, status:%s, enter delete operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
pVnode
->
vnodeStatus
=
TSDB_VN
ODE
_STATUS_DELETING
;
pVnode
->
vnodeStatus
=
TSDB_VN_STATUS_DELETING
;
vnodeCloseStream
(
vnodeList
+
vnode
);
vnodeCloseStream
(
vnodeList
+
vnode
);
vnodeCancelCommit
(
vnodeList
+
vnode
);
vnodeCancelCommit
(
vnodeList
+
vnode
);
...
@@ -178,12 +178,12 @@ static int vnodeCloseVnode(int vnode) {
...
@@ -178,12 +178,12 @@ static int vnodeCloseVnode(int vnode) {
int
vnodeCreateVnode
(
int
vnode
,
SVnodeCfg
*
pCfg
,
SVPeerDesc
*
pDesc
)
{
int
vnodeCreateVnode
(
int
vnode
,
SVnodeCfg
*
pCfg
,
SVPeerDesc
*
pDesc
)
{
char
fileName
[
128
];
char
fileName
[
128
];
if
(
vnodeList
[
vnode
].
vnodeStatus
!=
TSDB_VN
ODE
_STATUS_OFFLINE
)
{
if
(
vnodeList
[
vnode
].
vnodeStatus
!=
TSDB_VN_STATUS_OFFLINE
)
{
dError
(
"vid:%d, status:%s, cannot enter create operation"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
dError
(
"vid:%d, status:%s, cannot enter create operation"
,
vnode
,
taosGetVnodeStatusStr
(
vnodeList
[
vnode
].
vnodeStatus
));
return
TSDB_CODE_INVALID_VNODE_STATUS
;
return
TSDB_CODE_INVALID_VNODE_STATUS
;
}
}
vnodeList
[
vnode
].
vnodeStatus
=
TSDB_VN
ODE
_STATUS_CREATING
;
vnodeList
[
vnode
].
vnodeStatus
=
TSDB_VN_STATUS_CREATING
;
sprintf
(
fileName
,
"%s/vnode%d"
,
tsDirectory
,
vnode
);
sprintf
(
fileName
,
"%s/vnode%d"
,
tsDirectory
,
vnode
);
mkdir
(
fileName
,
0755
);
mkdir
(
fileName
,
0755
);
...
@@ -258,9 +258,9 @@ int vnodeRemoveVnode(int vnode) {
...
@@ -258,9 +258,9 @@ int vnodeRemoveVnode(int vnode) {
if
(
vnodeList
[
vnode
].
cfg
.
maxSessions
>
0
)
{
if
(
vnodeList
[
vnode
].
cfg
.
maxSessions
>
0
)
{
SVnodeObj
*
pVnode
=
&
vnodeList
[
vnode
];
SVnodeObj
*
pVnode
=
&
vnodeList
[
vnode
];
if
(
pVnode
->
vnodeStatus
==
TSDB_VN
ODE
_STATUS_CREATING
if
(
pVnode
->
vnodeStatus
==
TSDB_VN_STATUS_CREATING
||
pVnode
->
vnodeStatus
==
TSDB_VN
ODE
_STATUS_OFFLINE
||
pVnode
->
vnodeStatus
==
TSDB_VN_STATUS_OFFLINE
||
pVnode
->
vnodeStatus
==
TSDB_VN
ODE
_STATUS_DELETING
)
{
||
pVnode
->
vnodeStatus
==
TSDB_VN_STATUS_DELETING
)
{
dError
(
"vid:%d, status:%s, cannot enter close/delete operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
dError
(
"vid:%d, status:%s, cannot enter close/delete operation"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
));
return
TSDB_CODE_ACTION_IN_PROGRESS
;
return
TSDB_CODE_ACTION_IN_PROGRESS
;
}
else
{
}
else
{
...
@@ -325,7 +325,7 @@ void vnodeCleanUpOneVnode(int vnode) {
...
@@ -325,7 +325,7 @@ void vnodeCleanUpOneVnode(int vnode) {
again
=
1
;
again
=
1
;
if
(
vnodeList
[
vnode
].
pCachePool
)
{
if
(
vnodeList
[
vnode
].
pCachePool
)
{
vnodeList
[
vnode
].
vnodeStatus
=
TSDB_VN
ODE
_STATUS_OFFLINE
;
vnodeList
[
vnode
].
vnodeStatus
=
TSDB_VN_STATUS_OFFLINE
;
vnodeClosePeerVnode
(
vnode
);
vnodeClosePeerVnode
(
vnode
);
}
}
...
@@ -354,7 +354,7 @@ void vnodeCleanUpVnodes() {
...
@@ -354,7 +354,7 @@ void vnodeCleanUpVnodes() {
for
(
int
vnode
=
0
;
vnode
<
TSDB_MAX_VNODES
;
++
vnode
)
{
for
(
int
vnode
=
0
;
vnode
<
TSDB_MAX_VNODES
;
++
vnode
)
{
if
(
vnodeList
[
vnode
].
pCachePool
)
{
if
(
vnodeList
[
vnode
].
pCachePool
)
{
vnodeList
[
vnode
].
vnodeStatus
=
TSDB_VN
ODE
_STATUS_OFFLINE
;
vnodeList
[
vnode
].
vnodeStatus
=
TSDB_VN_STATUS_OFFLINE
;
vnodeClosePeerVnode
(
vnode
);
vnodeClosePeerVnode
(
vnode
);
}
}
}
}
...
...
src/system/detail/src/vnodeStream.c
浏览文件 @
d320f261
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include "taosmsg.h"
#include "taosmsg.h"
#include "vnode.h"
#include "vnode.h"
#include "vnodeUtil.h"
#include "vnodeUtil.h"
#include "tstatus.h"
/* static TAOS *dbConn = NULL; */
/* static TAOS *dbConn = NULL; */
void
vnodeCloseStreamCallback
(
void
*
param
);
void
vnodeCloseStreamCallback
(
void
*
param
);
...
@@ -171,7 +172,7 @@ void vnodeCloseStream(SVnodeObj *pVnode) {
...
@@ -171,7 +172,7 @@ void vnodeCloseStream(SVnodeObj *pVnode) {
void
vnodeUpdateStreamRole
(
SVnodeObj
*
pVnode
)
{
void
vnodeUpdateStreamRole
(
SVnodeObj
*
pVnode
)
{
/* SMeterObj *pObj; */
/* SMeterObj *pObj; */
int
newRole
=
(
pVnode
->
vnodeStatus
==
TSDB_VN
ODE
_STATUS_MASTER
)
?
1
:
0
;
int
newRole
=
(
pVnode
->
vnodeStatus
==
TSDB_VN_STATUS_MASTER
)
?
1
:
0
;
if
(
newRole
!=
pVnode
->
streamRole
)
{
if
(
newRole
!=
pVnode
->
streamRole
)
{
dTrace
(
"vid:%d, stream role is changed to:%d"
,
pVnode
->
vnode
,
newRole
);
dTrace
(
"vid:%d, stream role is changed to:%d"
,
pVnode
->
vnode
,
newRole
);
pVnode
->
streamRole
=
newRole
;
pVnode
->
streamRole
=
newRole
;
...
...
src/system/lite/src/mgmtBalance.spec.c
浏览文件 @
d320f261
...
@@ -53,8 +53,8 @@ bool mgmtCheckModuleInDnode(SDnodeObj *pDnode, int moduleType) {
...
@@ -53,8 +53,8 @@ bool mgmtCheckModuleInDnode(SDnodeObj *pDnode, int moduleType) {
bool
mgmtCheckVnodeReady
(
SDnodeObj
*
pDnode
,
SVgObj
*
pVgroup
,
SVnodeGid
*
pVnode
)
{
return
true
;
}
bool
mgmtCheckVnodeReady
(
SDnodeObj
*
pDnode
,
SVgObj
*
pVgroup
,
SVnodeGid
*
pVnode
)
{
return
true
;
}
void
mgmtUpdateDnodeState
(
SDnodeObj
*
pDnode
,
int
lbStat
e
)
{}
void
mgmtUpdateDnodeState
(
SDnodeObj
*
pDnode
,
int
lbStat
us
)
{}
void
mgmtUpdateVgroupState
(
SVgObj
*
pVgroup
,
int
lbStat
e
,
int
srcIp
)
{}
void
mgmtUpdateVgroupState
(
SVgObj
*
pVgroup
,
int
lbStat
us
,
int
srcIp
)
{}
bool
mgmtAddVnode
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
)
{
return
false
;
}
bool
mgmtAddVnode
(
SVgObj
*
pVgroup
,
SDnodeObj
*
pSrcDnode
,
SDnodeObj
*
pDestDnode
)
{
return
false
;
}
\ No newline at end of file
src/system/lite/src/mgmtDnode.spec.c
浏览文件 @
d320f261
...
@@ -30,7 +30,7 @@ int mgmtInitDnodes() {
...
@@ -30,7 +30,7 @@ int mgmtInitDnodes() {
dnodeObj
.
createdTime
=
(
int64_t
)
tsRebootTime
*
1000
;
dnodeObj
.
createdTime
=
(
int64_t
)
tsRebootTime
*
1000
;
dnodeObj
.
lastReboot
=
tsRebootTime
;
dnodeObj
.
lastReboot
=
tsRebootTime
;
dnodeObj
.
numOfCores
=
(
uint16_t
)
tsNumOfCores
;
dnodeObj
.
numOfCores
=
(
uint16_t
)
tsNumOfCores
;
dnodeObj
.
status
=
TSDB_DN
ODE
_STATUS_READY
;
dnodeObj
.
status
=
TSDB_DN_STATUS_READY
;
dnodeObj
.
alternativeRole
=
TSDB_DNODE_ROLE_ANY
;
dnodeObj
.
alternativeRole
=
TSDB_DNODE_ROLE_ANY
;
dnodeObj
.
numOfTotalVnodes
=
tsNumOfTotalVnodes
;
dnodeObj
.
numOfTotalVnodes
=
tsNumOfTotalVnodes
;
dnodeObj
.
thandle
=
(
void
*
)(
1
);
//hack way
dnodeObj
.
thandle
=
(
void
*
)(
1
);
//hack way
...
...
src/system/lite/src/mgmtDnodeInt.spec.c
浏览文件 @
d320f261
...
@@ -82,7 +82,7 @@ void mgmtCleanUpDnodeInt() {}
...
@@ -82,7 +82,7 @@ void mgmtCleanUpDnodeInt() {}
void
mgmtProcessDnodeStatus
(
void
*
handle
,
void
*
tmrId
)
{
void
mgmtProcessDnodeStatus
(
void
*
handle
,
void
*
tmrId
)
{
SDnodeObj
*
pObj
=
&
dnodeObj
;
SDnodeObj
*
pObj
=
&
dnodeObj
;
pObj
->
openVnodes
=
tsOpenVnodes
;
pObj
->
openVnodes
=
tsOpenVnodes
;
pObj
->
status
=
TSDB_DN
ODE
_STATUS_READY
;
pObj
->
status
=
TSDB_DN_STATUS_READY
;
float
memoryUsedMB
=
0
;
float
memoryUsedMB
=
0
;
taosGetSysMemory
(
&
memoryUsedMB
);
taosGetSysMemory
(
&
memoryUsedMB
);
...
@@ -95,8 +95,8 @@ void mgmtProcessDnodeStatus(void *handle, void *tmrId) {
...
@@ -95,8 +95,8 @@ void mgmtProcessDnodeStatus(void *handle, void *tmrId) {
// wait vnode dropped
// wait vnode dropped
if
(
pVload
->
dropStatus
==
TSDB_VN_STATUS_DROPPING
)
{
if
(
pVload
->
dropStatus
==
TSDB_VN_STATUS_DROPPING
)
{
if
(
vnodeList
[
vnode
].
cfg
.
maxSessions
<=
0
)
{
if
(
vnodeList
[
vnode
].
cfg
.
maxSessions
<=
0
)
{
pVload
->
dropStatus
=
TSDB_VN_STATUS_READY
;
pVload
->
dropStatus
=
TSDB_VN_
DROP_
STATUS_READY
;
pVload
->
status
=
TSDB_VN_STATUS_
READY
;
pVload
->
status
=
TSDB_VN_STATUS_
OFFLINE
;
mPrint
(
"dnode:%s, vid:%d, drop finished"
,
taosIpStr
(
pObj
->
privateIp
),
vnode
);
mPrint
(
"dnode:%s, vid:%d, drop finished"
,
taosIpStr
(
pObj
->
privateIp
),
vnode
);
taosTmrStart
(
mgmtMonitorDbDrop
,
10000
,
NULL
,
mgmtTmr
);
taosTmrStart
(
mgmtMonitorDbDrop
,
10000
,
NULL
,
mgmtTmr
);
}
}
...
@@ -107,7 +107,7 @@ void mgmtProcessDnodeStatus(void *handle, void *tmrId) {
...
@@ -107,7 +107,7 @@ void mgmtProcessDnodeStatus(void *handle, void *tmrId) {
}
}
pVload
->
vnode
=
vnode
;
pVload
->
vnode
=
vnode
;
pVload
->
status
=
TSDB_VN_STATUS_
READY
;
pVload
->
status
=
TSDB_VN_STATUS_
MASTER
;
pVload
->
totalStorage
=
pVnode
->
vnodeStatistic
.
totalStorage
;
pVload
->
totalStorage
=
pVnode
->
vnodeStatistic
.
totalStorage
;
pVload
->
compStorage
=
pVnode
->
vnodeStatistic
.
compStorage
;
pVload
->
compStorage
=
pVnode
->
vnodeStatistic
.
compStorage
;
pVload
->
pointsWritten
=
pVnode
->
vnodeStatistic
.
pointsWritten
;
pVload
->
pointsWritten
=
pVnode
->
vnodeStatistic
.
pointsWritten
;
...
...
src/system/lite/src/vnodePeer.spec.c
浏览文件 @
d320f261
...
@@ -31,7 +31,7 @@ void vnodeBroadcastStatusToUnsyncedPeer(SVnodeObj *pVnode) {}
...
@@ -31,7 +31,7 @@ void vnodeBroadcastStatusToUnsyncedPeer(SVnodeObj *pVnode) {}
int
vnodeOpenPeerVnode
(
int
vnode
)
{
int
vnodeOpenPeerVnode
(
int
vnode
)
{
SVnodeObj
*
pVnode
=
vnodeList
+
vnode
;
SVnodeObj
*
pVnode
=
vnodeList
+
vnode
;
pVnode
->
vnodeStatus
=
(
pVnode
->
cfg
.
replications
>
1
)
?
TSDB_VN
ODE_STATUS_UNSYNCED
:
TSDB_VNODE
_STATUS_MASTER
;
pVnode
->
vnodeStatus
=
(
pVnode
->
cfg
.
replications
>
1
)
?
TSDB_VN
_STATUS_UNSYNCED
:
TSDB_VN
_STATUS_MASTER
;
dTrace
(
"vid:%d, status:%s numOfPeers:%d"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
),
pVnode
->
cfg
.
replications
-
1
);
dTrace
(
"vid:%d, status:%s numOfPeers:%d"
,
vnode
,
taosGetVnodeStatusStr
(
pVnode
->
vnodeStatus
),
pVnode
->
cfg
.
replications
-
1
);
vnodeUpdateStreamRole
(
pVnode
);
vnodeUpdateStreamRole
(
pVnode
);
return
0
;
return
0
;
...
...
src/util/src/tstatus.c
浏览文件 @
d320f261
...
@@ -15,52 +15,78 @@
...
@@ -15,52 +15,78 @@
#include "taosmsg.h"
#include "taosmsg.h"
#include "tsdb.h"
#include "tsdb.h"
#include "tstatus.h"
const
char
*
taosGetVnodeStatusStr
(
int
vnodeStatus
)
{
const
char
*
taosGetVnodeStatusStr
(
int
vnodeStatus
)
{
switch
(
vnodeStatus
)
{
switch
(
vnodeStatus
)
{
case
TSDB_VNODE_STATUS_OFFLINE
:
return
"offline"
;
case
TSDB_VN_STATUS_OFFLINE
:
return
"offline"
;
case
TSDB_VNODE_STATUS_CREATING
:
return
"creating"
;
case
TSDB_VN_STATUS_CREATING
:
return
"creating"
;
case
TSDB_VNODE_STATUS_UNSYNCED
:
return
"unsynced"
;
case
TSDB_VN_STATUS_UNSYNCED
:
return
"unsynced"
;
case
TSDB_VNODE_STATUS_SLAVE
:
return
"slave"
;
case
TSDB_VN_STATUS_SLAVE
:
return
"slave"
;
case
TSDB_VNODE_STATUS_MASTER
:
return
"master"
;
case
TSDB_VN_STATUS_MASTER
:
return
"master"
;
case
TSDB_VNODE_STATUS_CLOSING
:
return
"closing"
;
case
TSDB_VN_STATUS_CLOSING
:
return
"closing"
;
case
TSDB_VNODE_STATUS_DELETING
:
return
"deleting"
;
case
TSDB_VN_STATUS_DELETING
:
return
"deleting"
;
default:
return
"undefined"
;
default:
return
"undefined"
;
}
}
const
char
*
taosGetVnodeSyncStatusStr
(
int
vnodeSyncStatus
)
{
switch
(
vnodeSyncStatus
)
{
case
TSDB_VN_SYNC_STATUS_INIT
:
return
"init"
;
case
TSDB_VN_SYNC_STATUS_SYNCING
:
return
"syncing"
;
case
TSDB_VN_SYNC_STATUS_SYNC_CACHE
:
return
"sync_cache"
;
case
TSDB_VN_SYNC_STATUS_SYNC_FILE
:
return
"sync_file"
;
default:
return
"undefined"
;
}
}
const
char
*
taosGetVnodeDropStatusStr
(
int
dropping
)
{
switch
(
dropping
)
{
case
TSDB_VN_DROP_STATUS_READY
:
return
"ready"
;
case
TSDB_VN_DROP_STATUS_DROPPING
:
return
"dropping"
;
default:
return
"undefined"
;
}
}
}
}
const
char
*
taosGetDnodeStatusStr
(
int
dnodeStatus
)
{
const
char
*
taosGetDnodeStatusStr
(
int
dnodeStatus
)
{
switch
(
dnodeStatus
)
{
switch
(
dnodeStatus
)
{
case
TSDB_DN
ODE
_STATUS_OFFLINE
:
return
"offline"
;
case
TSDB_DN_STATUS_OFFLINE
:
return
"offline"
;
case
TSDB_DN
ODE_STATUS_READY
:
return
"ready"
;
case
TSDB_DN
_STATUS_READY
:
return
"ready"
;
default:
return
"undefined"
;
default:
return
"undefined"
;
}
}
}
}
const
char
*
taosGetDnode
BalanceState
Str
(
int
dnodeBalanceStatus
)
{
const
char
*
taosGetDnode
LbStatus
Str
(
int
dnodeBalanceStatus
)
{
switch
(
dnodeBalanceStatus
)
{
switch
(
dnodeBalanceStatus
)
{
case
LB_DNODE_STATE_BALANCED
:
return
"balanced"
;
case
TSDB_DN_LB_STATUS_BALANCED
:
return
"balanced"
;
case
LB_DNODE_STATE_BALANCING
:
return
"balancing"
;
case
TSDB_DN_LB_STATUS_BALANCING
:
return
"balancing"
;
case
LB_DNODE_STATE
_OFFLINE_REMOVING
:
return
"offline removing"
;
case
TSDB_DN_LB_STATUS
_OFFLINE_REMOVING
:
return
"offline removing"
;
case
LB_DNODE_STATE_SHELL_REMOVING
:
return
"removing"
;
case
TSDB_DN_LB_STATE_SHELL_REMOVING
:
return
"removing"
;
default:
return
"undefined"
;
default:
return
"undefined"
;
}
}
}
}
const
char
*
taosGetVnodeSyncStatusStr
(
int
vnodeSyncStatus
)
{
const
char
*
taosGetVgroupLbStatusStr
(
int
vglbStatus
)
{
switch
(
vnodeSyncStatus
)
{
switch
(
vglbStatus
)
{
case
STDB_SSTATUS_INIT
:
return
"init"
;
case
TSDB_VG_LB_STATUS_READY
:
return
"ready"
;
case
TSDB_SSTATUS_SYNCING
:
return
"syncing"
;
case
TSDB_VG_LB_STATUS_UPDATE
:
return
"updating"
;
case
TSDB_SSTATUS_SYNC_CACHE
:
return
"sync_cache"
;
default:
return
"undefined"
;
case
TSDB_SSTATUS_SYNC_FILE
:
return
"sync_file"
;
default:
return
"undefined"
;
}
}
}
}
const
char
*
taosGet
VnodeDropStatusStr
(
int
dropping
)
{
const
char
*
taosGet
BalanceTypeStr
(
int
type
)
{
switch
(
dropping
)
{
switch
(
type
)
{
case
0
:
return
"ready
"
;
case
TSDB_LB_TYPE_SCHEDULE
:
return
"schedule
"
;
case
1
:
return
"dropping
"
;
case
TSDB_LB_TYPE_SOON
:
return
"soon
"
;
default:
return
"undefined"
;
default:
return
"undefined"
;
}
}
}
}
\ No newline at end of file
const
char
*
taosBalanceReasonStr
(
int
reason
)
{
switch
(
reason
)
{
case
TSDB_LB_REASON_PERIOD
:
return
"period"
;
case
TSDB_LB_REASON_EVENT
:
return
"event"
;
default:
return
"undefined"
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录