Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
024a7a58
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看板
提交
024a7a58
编写于
12月 27, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: add some logs to detect vnodes.json emptyed
上级
c801f3a7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
22 addition
and
13 deletion
+22
-13
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
+13
-5
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+4
-3
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+5
-5
未找到文件。
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
浏览文件 @
024a7a58
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "vmInt.h"
#include "vmInt.h"
#define MAX_CONTENT_LEN 1024 * 1024
#define MAX_CONTENT_LEN
2 *
1024 * 1024
SVnodeObj
**
vmGetVnodeListFromHash
(
SVnodeMgmt
*
pMgmt
,
int32_t
*
numOfVnodes
)
{
SVnodeObj
**
vmGetVnodeListFromHash
(
SVnodeMgmt
*
pMgmt
,
int32_t
*
numOfVnodes
)
{
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
taosThreadRwlockRdlock
(
&
pMgmt
->
lock
);
...
@@ -60,7 +60,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
...
@@ -60,7 +60,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
pFile
=
taosOpenFile
(
file
,
TD_FILE_READ
);
pFile
=
taosOpenFile
(
file
,
TD_FILE_READ
);
if
(
pFile
==
NULL
)
{
if
(
pFile
==
NULL
)
{
d
Debug
(
"file %s not exist"
,
file
);
d
Info
(
"file %s not exist"
,
file
);
code
=
0
;
code
=
0
;
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -133,7 +133,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
...
@@ -133,7 +133,7 @@ int32_t vmGetVnodeListFromFile(SVnodeMgmt *pMgmt, SWrapperCfg **ppCfgs, int32_t
*
numOfVnodes
=
vnodesNum
;
*
numOfVnodes
=
vnodesNum
;
code
=
0
;
code
=
0
;
d
Debug
(
"succcessed to read file %s, numOfVnodes:%d"
,
file
,
vnodesNum
);
d
Info
(
"succcessed to read file %s, numOfVnodes:%d"
,
file
,
vnodesNum
);
_OVER:
_OVER:
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
if
(
content
!=
NULL
)
taosMemoryFree
(
content
);
...
@@ -163,6 +163,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
...
@@ -163,6 +163,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
if
(
ppVnodes
==
NULL
)
{
if
(
ppVnodes
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
-
1
;
code
=
-
1
;
dError
(
"failed to write %s while get vnodelist"
,
file
);
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -172,6 +173,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
...
@@ -172,6 +173,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
if
(
content
==
NULL
)
{
if
(
content
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
-
1
;
code
=
-
1
;
dError
(
"failed to write %s while malloc content"
,
file
);
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -213,6 +215,12 @@ _OVER:
...
@@ -213,6 +215,12 @@ _OVER:
if
(
code
!=
0
)
return
-
1
;
if
(
code
!=
0
)
return
-
1
;
dDebug
(
"successed to write %s, numOfVnodes:%d"
,
realfile
,
numOfVnodes
);
dInfo
(
"successed to write %s, numOfVnodes:%d"
,
realfile
,
numOfVnodes
);
return
taosRenameFile
(
file
,
realfile
);
code
=
taosRenameFile
(
file
,
realfile
);
if
(
code
!=
0
)
{
dError
(
"failed to rename %s to %s"
,
file
,
realfile
);
}
return
code
;
}
}
\ No newline at end of file
source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
浏览文件 @
024a7a58
...
@@ -213,7 +213,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -213,7 +213,7 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
req
.
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
req
.
vgId
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
d
Debug
(
"vgId:%d, already exist"
,
req
.
vgId
);
d
Info
(
"vgId:%d, already exist"
,
req
.
vgId
);
tFreeSCreateVnodeReq
(
&
req
);
tFreeSCreateVnodeReq
(
&
req
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
vmReleaseVnode
(
pMgmt
,
pVnode
);
terrno
=
TSDB_CODE_VND_ALREADY_EXIST
;
terrno
=
TSDB_CODE_VND_ALREADY_EXIST
;
...
@@ -358,7 +358,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -358,7 +358,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
}
int32_t
vgId
=
dropReq
.
vgId
;
int32_t
vgId
=
dropReq
.
vgId
;
d
Debug
(
"vgId:%d, start to drop vnode"
,
vgId
);
d
Info
(
"vgId:%d, start to drop vnode"
,
vgId
);
if
(
dropReq
.
dnodeId
!=
pMgmt
->
pData
->
dnodeId
)
{
if
(
dropReq
.
dnodeId
!=
pMgmt
->
pData
->
dnodeId
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
...
@@ -368,7 +368,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -368,7 +368,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
SVnodeObj
*
pVnode
=
vmAcquireVnode
(
pMgmt
,
vgId
);
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
d
Debug
(
"vgId:%d, failed to drop since %s"
,
vgId
,
terrstr
());
d
Info
(
"vgId:%d, failed to drop since %s"
,
vgId
,
terrstr
());
terrno
=
TSDB_CODE_VND_NOT_EXIST
;
terrno
=
TSDB_CODE_VND_NOT_EXIST
;
return
-
1
;
return
-
1
;
}
}
...
@@ -383,6 +383,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -383,6 +383,7 @@ int32_t vmProcessDropVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
vmCloseVnode
(
pMgmt
,
pVnode
);
vmCloseVnode
(
pMgmt
,
pVnode
);
vmWriteVnodeListToFile
(
pMgmt
);
vmWriteVnodeListToFile
(
pMgmt
);
dInfo
(
"vgId:%d, is dropped"
,
vgId
);
return
0
;
return
0
;
}
}
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
024a7a58
...
@@ -138,7 +138,7 @@ static void *vmOpenVnodeInThread(void *param) {
...
@@ -138,7 +138,7 @@ static void *vmOpenVnodeInThread(void *param) {
SVnodeMgmt
*
pMgmt
=
pThread
->
pMgmt
;
SVnodeMgmt
*
pMgmt
=
pThread
->
pMgmt
;
char
path
[
TSDB_FILENAME_LEN
];
char
path
[
TSDB_FILENAME_LEN
];
d
Debug
(
"thread:%d, start to open %d vnodes"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
);
d
Info
(
"thread:%d, start to open %d vnodes"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
);
setThreadName
(
"open-vnodes"
);
setThreadName
(
"open-vnodes"
);
for
(
int32_t
v
=
0
;
v
<
pThread
->
vnodeNum
;
++
v
)
{
for
(
int32_t
v
=
0
;
v
<
pThread
->
vnodeNum
;
++
v
)
{
...
@@ -156,13 +156,13 @@ static void *vmOpenVnodeInThread(void *param) {
...
@@ -156,13 +156,13 @@ static void *vmOpenVnodeInThread(void *param) {
pThread
->
failed
++
;
pThread
->
failed
++
;
}
else
{
}
else
{
vmOpenVnode
(
pMgmt
,
pCfg
,
pImpl
);
vmOpenVnode
(
pMgmt
,
pCfg
,
pImpl
);
d
Debug
(
"vgId:%d, is opened by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
d
Info
(
"vgId:%d, is opened by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
pThread
->
opened
++
;
pThread
->
opened
++
;
atomic_add_fetch_32
(
&
pMgmt
->
state
.
openVnodes
,
1
);
atomic_add_fetch_32
(
&
pMgmt
->
state
.
openVnodes
,
1
);
}
}
}
}
d
Debug
(
"thread:%d, numOfVnodes:%d, opened:%d failed:%d"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
,
pThread
->
opened
,
d
Info
(
"thread:%d, numOfVnodes:%d, opened:%d failed:%d"
,
pThread
->
threadIndex
,
pThread
->
vnodeNum
,
pThread
->
opened
,
pThread
->
failed
);
pThread
->
failed
);
return
NULL
;
return
NULL
;
}
}
...
@@ -496,7 +496,7 @@ static void *vmRestoreVnodeInThread(void *param) {
...
@@ -496,7 +496,7 @@ static void *vmRestoreVnodeInThread(void *param) {
dError
(
"vgId:%d, failed to restore vnode by thread:%d"
,
pVnode
->
vgId
,
pThread
->
threadIndex
);
dError
(
"vgId:%d, failed to restore vnode by thread:%d"
,
pVnode
->
vgId
,
pThread
->
threadIndex
);
pThread
->
failed
++
;
pThread
->
failed
++
;
}
else
{
}
else
{
d
Debug
(
"vgId:%d, is restored by thread:%d"
,
pVnode
->
vgId
,
pThread
->
threadIndex
);
d
Info
(
"vgId:%d, is restored by thread:%d"
,
pVnode
->
vgId
,
pThread
->
threadIndex
);
pThread
->
opened
++
;
pThread
->
opened
++
;
atomic_add_fetch_32
(
&
pMgmt
->
state
.
openVnodes
,
1
);
atomic_add_fetch_32
(
&
pMgmt
->
state
.
openVnodes
,
1
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录