Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
~笨蛋陪你哭
TDengine
提交
69a55916
T
TDengine
项目概览
~笨蛋陪你哭
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
69a55916
编写于
4月 22, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add dnode offline timer
上级
d099ab73
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
81 addition
and
1 deletion
+81
-1
src/mnode/inc/mgmtDnode.h
src/mnode/inc/mgmtDnode.h
+2
-0
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+2
-0
src/mnode/src/mgmtMain.c
src/mnode/src/mgmtMain.c
+1
-1
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+76
-0
未找到文件。
src/mnode/inc/mgmtDnode.h
浏览文件 @
69a55916
...
...
@@ -42,6 +42,8 @@ void * mgmtGetDnodeByIp(uint32_t ip);
void
mgmtUpdateDnode
(
SDnodeObj
*
pDnode
);
int32_t
mgmtDropDnode
(
SDnodeObj
*
pDnode
);
extern
int32_t
tsAccessSquence
;
#ifdef __cplusplus
}
#endif
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
69a55916
...
...
@@ -38,6 +38,7 @@
void
*
tsDnodeSdb
=
NULL
;
int32_t
tsDnodeUpdateSize
=
0
;
int32_t
tsAccessSquence
=
0
;
extern
void
*
tsVgroupSdb
;
static
int32_t
mgmtCreateDnode
(
uint32_t
ip
);
...
...
@@ -323,6 +324,7 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
pDnode
->
alternativeRole
=
pStatus
->
alternativeRole
;
pDnode
->
totalVnodes
=
pStatus
->
numOfTotalVnodes
;
pDnode
->
moduleStatus
=
pStatus
->
moduleStatus
;
pDnode
->
lastAccess
=
tsAccessSquence
;
if
(
pStatus
->
dnodeId
==
0
)
{
mTrace
(
"dnode:%d, first access, privateIp:%s, name:%s"
,
pDnode
->
dnodeId
,
taosIpStr
(
pDnode
->
privateIp
),
pDnode
->
dnodeName
);
...
...
src/mnode/src/mgmtMain.c
浏览文件 @
69a55916
...
...
@@ -149,12 +149,12 @@ void mgmtCleanUpSystem() {
mgmtCleanUpShell
();
mgmtCleanupDClient
();
mgmtCleanupDServer
();
mgmtCleanUpAccts
();
mgmtCleanUpTables
();
mgmtCleanUpVgroups
();
mgmtCleanUpDbs
();
mgmtCleanupDnodes
();
mgmtCleanUpUsers
();
mgmtCleanUpAccts
();
sdbCleanUp
();
taosTmrCleanUp
(
tsMgmtTmr
);
tsMgmtIsRunning
=
false
;
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
69a55916
...
...
@@ -38,6 +38,8 @@ static void vnodeBuildVloadMsg(char *pNode, void * param);
static
int
vnodeWalCallback
(
void
*
arg
);
static
int32_t
vnodeSaveCfg
(
SMDCreateVnodeMsg
*
pVnodeCfg
);
static
int32_t
vnodeReadCfg
(
SVnodeObj
*
pVnode
);
static
int32_t
vnodeSaveVersion
(
SVnodeObj
*
pVnode
);
static
int32_t
vnodeReadVersion
(
SVnodeObj
*
pVnode
);
static
int
vnodeWalCallback
(
void
*
arg
);
static
uint32_t
vnodeGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
);
static
int
vnodeGetWalInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
);
...
...
@@ -151,6 +153,8 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
return
code
;
}
vnodeReadVersion
(
pVnode
);
pVnode
->
wqueue
=
dnodeAllocateWqueue
(
pVnode
);
pVnode
->
rqueue
=
dnodeAllocateRqueue
(
pVnode
);
...
...
@@ -303,6 +307,7 @@ static void vnodeCleanUp(SVnodeObj *pVnode) {
//syncStop(pVnode->sync);
tsdbCloseRepo
(
pVnode
->
tsdb
);
walClose
(
pVnode
->
wal
);
vnodeSaveVersion
(
pVnode
);
vnodeRelease
(
pVnode
);
}
...
...
@@ -562,3 +567,74 @@ PARSE_OVER:
fclose
(
fp
);
return
ret
;
}
static
int32_t
vnodeSaveVersion
(
SVnodeObj
*
pVnode
)
{
char
versionFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"w"
);
if
(
!
fp
)
{
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
);
return
errno
;
}
int32_t
len
=
0
;
int32_t
maxLen
=
30
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
version
\"
: %"
PRId64
"
\n
"
,
pVnode
->
version
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fclose
(
fp
);
free
(
content
);
dPrint
(
"pVnode:%p vgId:%d, save vnode version successed"
,
pVnode
,
pVnode
->
vgId
);
return
0
;
}
static
int32_t
vnodeReadVersion
(
SVnodeObj
*
pVnode
)
{
char
versionFile
[
TSDB_FILENAME_LEN
+
30
]
=
{
0
};
sprintf
(
versionFile
,
"%s/vnode%d/version.json"
,
tsVnodeDir
,
pVnode
->
vgId
);
FILE
*
fp
=
fopen
(
versionFile
,
"w"
);
if
(
!
fp
)
{
dError
(
"pVnode:%p vgId:%d, failed to open vnode version file for write, error:%s"
,
pVnode
,
pVnode
->
vgId
);
return
errno
;
}
int
ret
=
TSDB_CODE_OTHERS
;
int
maxLen
=
100
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
int
len
=
fread
(
content
,
1
,
maxLen
,
fp
);
if
(
len
<=
0
)
{
free
(
content
);
fclose
(
fp
);
dError
(
"pVnode:%p vgId:%d, failed to read vnode version, content is null"
,
pVnode
,
pVnode
->
vgId
);
return
false
;
}
cJSON
*
root
=
cJSON_Parse
(
content
);
if
(
root
==
NULL
)
{
dError
(
"pVnode:%p vgId:%d, failed to read vnode version, invalid json format"
,
pVnode
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
cJSON
*
version
=
cJSON_GetObjectItem
(
root
,
"version"
);
if
(
!
version
||
version
->
type
!=
cJSON_Number
)
{
dError
(
"pVnode:%p vgId:%d, failed to read vnode version, version not found"
,
pVnode
,
pVnode
->
vgId
);
goto
PARSE_OVER
;
}
pVnode
->
version
=
version
->
valueint
;
ret
=
0
;
dPrint
(
"pVnode:%p vgId:%d, read vnode version successed, version:%%"
PRId64
,
pVnode
,
pVnode
->
vgId
,
pVnode
->
version
);
PARSE_OVER:
free
(
content
);
cJSON_Delete
(
root
);
fclose
(
fp
);
return
ret
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录