Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_50753323
TDengine
提交
c230d2ec
T
TDengine
项目概览
qq_50753323
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c230d2ec
编写于
11月 17, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2014
上级
ed8b8a41
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
57 addition
and
35 deletion
+57
-35
src/dnode/inc/dnodeVWrite.h
src/dnode/inc/dnodeVWrite.h
+2
-2
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+11
-14
src/inc/dnode.h
src/inc/dnode.h
+2
-2
src/inc/vnode.h
src/inc/vnode.h
+5
-4
src/os/src/detail/osTimer.c
src/os/src/detail/osTimer.c
+5
-1
src/vnode/inc/vnodeInt.h
src/vnode/inc/vnodeInt.h
+1
-0
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+31
-12
未找到文件。
src/dnode/inc/dnodeVWrite.h
浏览文件 @
c230d2ec
...
...
@@ -24,8 +24,8 @@ int32_t dnodeInitVWrite();
void
dnodeCleanupVWrite
();
void
dnodeDispatchToVWriteQueue
(
SRpcMsg
*
pMsg
);
void
*
dnodeAllocVWriteQueue
(
void
*
pVnode
);
void
dnodeFreeVWriteQueue
(
void
*
w
queue
);
void
dnodeSendRpcVWriteRsp
(
void
*
pVnode
,
void
*
p
aram
,
int32_t
code
);
void
dnodeFreeVWriteQueue
(
void
*
pW
queue
);
void
dnodeSendRpcVWriteRsp
(
void
*
pVnode
,
void
*
p
Write
,
int32_t
code
);
#ifdef __cplusplus
}
...
...
src/dnode/src/dnodeVWrite.c
浏览文件 @
c230d2ec
...
...
@@ -38,11 +38,11 @@ typedef struct {
}
SVWriteWorkerPool
;
static
SVWriteWorkerPool
tsVWriteWP
;
static
void
*
dnodeProcessVWriteQueue
(
void
*
p
aram
);
static
void
*
dnodeProcessVWriteQueue
(
void
*
p
Worker
);
int32_t
dnodeInitVWrite
()
{
tsVWriteWP
.
max
=
tsNumOfCores
;
tsVWriteWP
.
worker
=
(
SVWriteWorker
*
)
tcalloc
(
sizeof
(
SVWriteWorker
),
tsVWriteWP
.
max
);
tsVWriteWP
.
worker
=
tcalloc
(
sizeof
(
SVWriteWorker
),
tsVWriteWP
.
max
);
if
(
tsVWriteWP
.
worker
==
NULL
)
return
-
1
;
pthread_mutex_init
(
&
tsVWriteWP
.
mutex
,
NULL
);
...
...
@@ -162,13 +162,13 @@ void *dnodeAllocVWriteQueue(void *pVnode) {
return
queue
;
}
void
dnodeFreeVWriteQueue
(
void
*
w
queue
)
{
taosCloseQueue
(
w
queue
);
void
dnodeFreeVWriteQueue
(
void
*
pW
queue
)
{
taosCloseQueue
(
pW
queue
);
}
void
dnodeSendRpcVWriteRsp
(
void
*
pVnode
,
void
*
param
,
int32_t
code
)
{
if
(
param
==
NULL
)
return
;
SVWriteMsg
*
pWrite
=
param
;
void
dnodeSendRpcVWriteRsp
(
void
*
pVnode
,
void
*
w
param
,
int32_t
code
)
{
if
(
w
param
==
NULL
)
return
;
SVWriteMsg
*
pWrite
=
w
param
;
if
(
code
<
0
)
pWrite
->
code
=
code
;
int32_t
count
=
atomic_add_fetch_32
(
&
pWrite
->
processedCount
,
1
);
...
...
@@ -183,13 +183,11 @@ void dnodeSendRpcVWriteRsp(void *pVnode, void *param, int32_t code) {
};
rpcSendResponse
(
&
rpcRsp
);
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
vnodeFreeFromWQueue
(
pVnode
,
pWrite
);
}
static
void
*
dnodeProcessVWriteQueue
(
void
*
param
)
{
SVWriteWorker
*
pWorker
=
param
;
static
void
*
dnodeProcessVWriteQueue
(
void
*
w
param
)
{
SVWriteWorker
*
pWorker
=
w
param
;
SVWriteMsg
*
pWrite
;
void
*
pVnode
;
int32_t
numOfMsgs
;
...
...
@@ -232,8 +230,7 @@ static void *dnodeProcessVWriteQueue(void *param) {
if
(
pWrite
->
rspRet
.
rsp
)
{
rpcFreeCont
(
pWrite
->
rspRet
.
rsp
);
}
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
vnodeFreeFromWQueue
(
pVnode
,
pWrite
);
}
}
}
...
...
src/inc/dnode.h
浏览文件 @
c230d2ec
...
...
@@ -54,8 +54,8 @@ void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp, SRpcEpSet *epSet
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
tid
);
void
*
dnodeAllocVWriteQueue
(
void
*
pVnode
);
void
dnodeFreeVWriteQueue
(
void
*
w
queue
);
void
dnodeSendRpcVWriteRsp
(
void
*
pVnode
,
void
*
p
aram
,
int32_t
code
);
void
dnodeFreeVWriteQueue
(
void
*
pW
queue
);
void
dnodeSendRpcVWriteRsp
(
void
*
pVnode
,
void
*
p
Write
,
int32_t
code
);
void
*
dnodeAllocVReadQueue
(
void
*
pVnode
);
void
dnodeFreeVReadQueue
(
void
*
rqueue
);
...
...
src/inc/vnode.h
浏览文件 @
c230d2ec
...
...
@@ -70,11 +70,12 @@ void* vnodeAcquire(int32_t vgId); // add refcount
void
vnodeRelease
(
void
*
pVnode
);
// dec refCount
void
*
vnodeGetWal
(
void
*
pVnode
);
int32_t
vnodeWriteToWQueue
(
void
*
vparam
,
void
*
wparam
,
int32_t
qtype
,
void
*
rparam
);
int32_t
vnodeProcessWrite
(
void
*
vparam
,
void
*
wparam
,
int32_t
qtype
,
void
*
rparam
);
int32_t
vnodeWriteToWQueue
(
void
*
pVnode
,
void
*
pHead
,
int32_t
qtype
,
void
*
pRpcMsg
);
void
vnodeFreeFromWQueue
(
void
*
pVnode
,
SVWriteMsg
*
pWrite
);
int32_t
vnodeProcessWrite
(
void
*
pVnode
,
void
*
pHead
,
int32_t
qtype
,
void
*
pRspRet
);
int32_t
vnodeGetVnodeList
(
int32_t
vnodeList
[],
int32_t
*
numOfVnodes
);
void
vnodeBuildStatusMsg
(
void
*
p
aram
);
void
vnodeConfirmForward
(
void
*
p
aram
,
uint64_t
version
,
int32_t
code
);
void
vnodeBuildStatusMsg
(
void
*
p
Status
);
void
vnodeConfirmForward
(
void
*
p
Vnode
,
uint64_t
version
,
int32_t
code
);
void
vnodeSetAccess
(
SVgroupAccess
*
pAccess
,
int32_t
numOfVnodes
);
int32_t
vnodeInitResources
();
...
...
src/os/src/detail/osTimer.c
浏览文件 @
c230d2ec
...
...
@@ -111,6 +111,9 @@ void taosUninitTimer() {
pthread_sigmask(SIG_BLOCK, &set, NULL);
*/
void
taosMsleep
(
int
mseconds
)
{
#if 1
usleep
(
mseconds
*
1000
);
#else
struct
timeval
timeout
;
int
seconds
,
useconds
;
...
...
@@ -126,7 +129,8 @@ void taosMsleep(int mseconds) {
select
(
0
,
NULL
,
NULL
,
NULL
,
&
timeout
);
/* pthread_sigmask(SIG_UNBLOCK, &set, NULL); */
/* pthread_sigmask(SIG_UNBLOCK, &set, NULL); */
#endif
}
#endif
\ No newline at end of file
src/vnode/inc/vnodeInt.h
浏览文件 @
c230d2ec
...
...
@@ -37,6 +37,7 @@ extern int32_t vDebugFlag;
typedef
struct
{
int32_t
vgId
;
// global vnode group ID
int32_t
refCount
;
// reference count
int32_t
queuedMsg
;
int32_t
delay
;
int8_t
status
;
int8_t
role
;
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
c230d2ec
...
...
@@ -28,13 +28,15 @@
#include "syncInt.h"
#include "tcq.h"
static
int32_t
(
*
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SVnodeObj
*
,
void
*
,
SRspRet
*
);
static
int32_t
vnodeProcessSubmitMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessCreateTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessDropTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessAlterTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessDropStableMsg
(
SVnodeObj
*
pVnode
,
void
*
pMsg
,
SRspRet
*
);
static
int32_t
vnodeProcessUpdateTagValMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
pRet
);
#define MAX_QUEUED_MSG_NUM 10000
static
int32_t
(
*
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SVnodeObj
*
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessSubmitMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessCreateTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessDropTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessAlterTableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessDropStableMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
static
int32_t
vnodeProcessUpdateTagValMsg
(
SVnodeObj
*
pVnode
,
void
*
pCont
,
SRspRet
*
);
void
vnodeInitWriteFp
(
void
)
{
vnodeProcessWriteMsgFp
[
TSDB_MSG_TYPE_SUBMIT
]
=
vnodeProcessSubmitMsg
;
...
...
@@ -100,8 +102,8 @@ int32_t vnodeProcessWrite(void *vparam, void *wparam, int32_t qtype, void *rpara
return
syncCode
;
}
static
int32_t
vnodeCheckWrite
(
void
*
param
)
{
SVnodeObj
*
pVnode
=
param
;
static
int32_t
vnodeCheckWrite
(
void
*
v
param
)
{
SVnodeObj
*
pVnode
=
v
param
;
if
(
!
(
pVnode
->
accessState
&
TSDB_VN_WRITE_ACCCESS
))
{
vDebug
(
"vgId:%d, no write auth, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
return
TSDB_CODE_VND_NO_WRITE_AUTH
;
...
...
@@ -127,8 +129,8 @@ static int32_t vnodeCheckWrite(void *param) {
return
TSDB_CODE_SUCCESS
;
}
void
vnodeConfirmForward
(
void
*
param
,
uint64_t
version
,
int32_t
code
)
{
SVnodeObj
*
pVnode
=
(
SVnodeObj
*
)
param
;
void
vnodeConfirmForward
(
void
*
v
param
,
uint64_t
version
,
int32_t
code
)
{
SVnodeObj
*
pVnode
=
v
param
;
syncConfirmForward
(
pVnode
->
sync
,
version
,
code
);
}
...
...
@@ -242,8 +244,25 @@ int32_t vnodeWriteToWQueue(void *vparam, void *wparam, int32_t qtype, void *rpar
memcpy
(
pWrite
->
pHead
,
pHead
,
sizeof
(
SWalHead
)
+
pHead
->
len
);
atomic_add_fetch_32
(
&
pVnode
->
refCount
,
1
);
vTrace
(
"vgId:%d, get vnode wqueue, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
int32_t
queued
=
atomic_add_fetch_32
(
&
pVnode
->
queuedMsg
,
1
);
if
(
queued
>
MAX_QUEUED_MSG_NUM
)
{
vDebug
(
"vgId:%d, too many msg:%d in vwqueue, flow control"
,
pVnode
->
vgId
,
queued
);
taosMsleep
(
1
);
}
vTrace
(
"vgId:%d, write into vwqueue, refCount:%d queued:%d"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
->
queuedMsg
);
taosWriteQitem
(
pVnode
->
wqueue
,
qtype
,
pWrite
);
return
TSDB_CODE_SUCCESS
;
}
void
vnodeFreeFromWQueue
(
void
*
vparam
,
SVWriteMsg
*
pWrite
)
{
SVnodeObj
*
pVnode
=
vparam
;
atomic_sub_fetch_32
(
&
pVnode
->
queuedMsg
,
1
);
vTrace
(
"vgId:%d, free from vwqueue, refCount:%d queued:%d"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
->
queuedMsg
);
taosFreeQitem
(
pWrite
);
vnodeRelease
(
pVnode
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录