Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
88b2848d
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
88b2848d
编写于
4月 06, 2023
作者:
C
cadem
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
multi-threading
上级
18b039fe
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
1 deletion
+35
-1
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
+6
-0
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
+2
-0
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
+1
-0
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
+26
-1
未找到文件。
source/dnode/mgmt/mgmt_vnode/inc/vmInt.h
浏览文件 @
88b2848d
...
...
@@ -40,6 +40,7 @@ typedef struct SVnodeMgmt {
STfs
*
pTfs
;
TdThread
thread
;
bool
stop
;
TdThreadMutex
cfgMutex
;
}
SVnodeMgmt
;
typedef
struct
{
...
...
@@ -77,6 +78,11 @@ typedef struct {
SVnodeObj
**
ppVnodes
;
}
SVnodeThread
;
typedef
struct
{
SQueueInfo
*
pInfo
;
SRpcMsg
*
pMsg
;
}
SVnodeMgmtThreadParam
;
// vmInt.c
SVnodeObj
*
vmAcquireVnode
(
SVnodeMgmt
*
pMgmt
,
int32_t
vgId
);
void
vmReleaseVnode
(
SVnodeMgmt
*
pMgmt
,
SVnodeObj
*
pVnode
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmFile.c
浏览文件 @
88b2848d
...
...
@@ -194,6 +194,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
if
(
buffer
==
NULL
)
goto
_OVER
;
terrno
=
0
;
taosThreadMutexLock
(
&
pMgmt
->
cfgMutex
);
pFile
=
taosOpenFile
(
file
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_TRUNC
);
if
(
pFile
==
NULL
)
goto
_OVER
;
...
...
@@ -203,6 +204,7 @@ int32_t vmWriteVnodeListToFile(SVnodeMgmt *pMgmt) {
taosCloseFile
(
&
pFile
);
if
(
taosRenameFile
(
file
,
realfile
)
!=
0
)
goto
_OVER
;
taosThreadMutexUnlock
(
&
pMgmt
->
cfgMutex
);
code
=
0
;
dInfo
(
"succeed to write vnodes file:%s, vnodes:%d"
,
realfile
,
numOfVnodes
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmInt.c
浏览文件 @
88b2848d
...
...
@@ -422,6 +422,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
pMgmt
->
msgCb
.
qsizeFp
=
(
GetQueueSizeFp
)
vmGetQueueSize
;
pMgmt
->
msgCb
.
mgmt
=
pMgmt
;
taosThreadRwlockInit
(
&
pMgmt
->
lock
,
NULL
);
taosThreadMutexInit
(
&
pMgmt
->
cfgMutex
,
NULL
);
SDiskCfg
dCfg
=
{
0
};
tstrncpy
(
dCfg
.
dir
,
tsDataDir
,
TSDB_FILENAME_LEN
);
...
...
source/dnode/mgmt/mgmt_vnode/src/vmWorker.c
浏览文件 @
88b2848d
...
...
@@ -27,7 +27,11 @@ static inline void vmSendRsp(SRpcMsg *pMsg, int32_t code) {
tmsgSendRsp
(
&
rsp
);
}
static
void
vmProcessMgmtQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
static
void
*
vmMgmtThreadFun
(
void
*
param
){
SVnodeMgmtThreadParam
*
threadParam
=
(
SVnodeMgmtThreadParam
*
)
param
;
SQueueInfo
*
pInfo
=
threadParam
->
pInfo
;
SRpcMsg
*
pMsg
=
threadParam
->
pMsg
;
SVnodeMgmt
*
pMgmt
=
pInfo
->
ahandle
;
int32_t
code
=
-
1
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
...
...
@@ -68,6 +72,27 @@ static void vmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
dGTrace
(
"msg:%p, is freed, code:0x%x"
,
pMsg
,
code
);
rpcFreeCont
(
pMsg
->
pCont
);
taosFreeQitem
(
pMsg
);
taosMemoryFree
(
param
);
return
NULL
;
}
static
void
vmProcessMgmtQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
TdThread
thread1
;
TdThreadAttr
thAttr
;
taosThreadAttrInit
(
&
thAttr
);
taosThreadAttrSetDetachState
(
&
thAttr
,
PTHREAD_CREATE_JOINABLE
);
SVnodeMgmtThreadParam
*
param
=
taosMemoryCalloc
(
1
,
sizeof
(
SVnodeMgmtThreadParam
));
param
->
pInfo
=
pInfo
;
param
->
pMsg
=
pMsg
;
if
(
taosThreadCreate
(
&
thread1
,
&
thAttr
,
vmMgmtThreadFun
,
param
)
!=
0
)
{
dError
(
"failed to create vnode timer thread since %s"
,
strerror
(
errno
));
return
;
}
taosThreadAttrDestroy
(
&
thAttr
);
return
;
}
static
void
vmProcessQueryQueue
(
SQueueInfo
*
pInfo
,
SRpcMsg
*
pMsg
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录