Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dgr6878
TDengine
提交
2ba941c8
T
TDengine
项目概览
dgr6878
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
8
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,发现更多精彩内容 >>
未验证
提交
2ba941c8
编写于
5月 06, 2020
作者:
S
slguan
提交者:
GitHub
5月 06, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1814 from taosdata/enhance/tqueue
use semphore instead of polling for tqeueu
上级
2c4d654f
19836961
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
21 addition
and
6 deletion
+21
-6
src/dnode/src/dnodeRead.c
src/dnode/src/dnodeRead.c
+5
-3
src/dnode/src/dnodeWrite.c
src/dnode/src/dnodeWrite.c
+3
-0
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+1
-1
src/util/src/tqueue.c
src/util/src/tqueue.c
+12
-2
未找到文件。
src/dnode/src/dnodeRead.c
浏览文件 @
2ba941c8
...
@@ -74,9 +74,11 @@ void dnodeCleanupRead() {
...
@@ -74,9 +74,11 @@ void dnodeCleanupRead() {
for
(
int
i
=
0
;
i
<
readPool
.
max
;
++
i
)
{
for
(
int
i
=
0
;
i
<
readPool
.
max
;
++
i
)
{
SReadWorker
*
pWorker
=
readPool
.
readWorker
+
i
;
SReadWorker
*
pWorker
=
readPool
.
readWorker
+
i
;
if
(
pWorker
->
thread
)
if
(
pWorker
->
thread
)
{
pthread_cancel
(
pWorker
->
thread
);
pthread_join
(
pWorker
->
thread
,
NULL
);
pthread_join
(
pWorker
->
thread
,
NULL
);
}
}
}
taosCloseQset
(
readQset
);
taosCloseQset
(
readQset
);
dPrint
(
"dnode read is closed"
);
dPrint
(
"dnode read is closed"
);
...
@@ -114,12 +116,12 @@ void dnodeRead(SRpcMsg *pMsg) {
...
@@ -114,12 +116,12 @@ void dnodeRead(SRpcMsg *pMsg) {
pRead
->
pCont
=
pCont
;
pRead
->
pCont
=
pCont
;
pRead
->
contLen
=
pHead
->
contLen
;
pRead
->
contLen
=
pHead
->
contLen
;
taosWriteQitem
(
queue
,
TAOS_QTYPE_RPC
,
pRead
);
// next vnode
// next vnode
leftLen
-=
pHead
->
contLen
;
leftLen
-=
pHead
->
contLen
;
pCont
-=
pHead
->
contLen
;
pCont
-=
pHead
->
contLen
;
queuedMsgNum
++
;
queuedMsgNum
++
;
taosWriteQitem
(
queue
,
TAOS_QTYPE_RPC
,
pRead
);
}
}
if
(
queuedMsgNum
==
0
)
{
if
(
queuedMsgNum
==
0
)
{
...
...
src/dnode/src/dnodeWrite.c
浏览文件 @
2ba941c8
...
@@ -71,7 +71,10 @@ void dnodeCleanupWrite() {
...
@@ -71,7 +71,10 @@ void dnodeCleanupWrite() {
for
(
int32_t
i
=
0
;
i
<
wWorkerPool
.
max
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
wWorkerPool
.
max
;
++
i
)
{
SWriteWorker
*
pWorker
=
wWorkerPool
.
writeWorker
+
i
;
SWriteWorker
*
pWorker
=
wWorkerPool
.
writeWorker
+
i
;
if
(
pWorker
->
thread
)
{
if
(
pWorker
->
thread
)
{
pthread_cancel
(
pWorker
->
thread
);
pthread_join
(
pWorker
->
thread
,
NULL
);
pthread_join
(
pWorker
->
thread
,
NULL
);
taosFreeQall
(
pWorker
->
qall
);
taosCloseQset
(
pWorker
->
qset
);
}
}
}
}
...
...
src/rpc/src/rpcMain.c
浏览文件 @
2ba941c8
...
@@ -1364,7 +1364,7 @@ static int rpcCheckAuthentication(SRpcConn *pConn, char *msg, int msgLen) {
...
@@ -1364,7 +1364,7 @@ static int rpcCheckAuthentication(SRpcConn *pConn, char *msg, int msgLen) {
}
}
}
}
}
else
{
}
else
{
tTrace
(
"%s %p, auth spi
not matched, msg discarded"
,
pRpc
->
label
,
pConn
);
tTrace
(
"%s %p, auth spi
:%d not matched with received:%d"
,
pRpc
->
label
,
pConn
,
pConn
->
spi
,
pHead
->
spi
);
code
=
TSDB_CODE_AUTH_FAILURE
;
code
=
TSDB_CODE_AUTH_FAILURE
;
}
}
...
...
src/util/src/tqueue.c
浏览文件 @
2ba941c8
...
@@ -41,6 +41,7 @@ typedef struct _taos_qset {
...
@@ -41,6 +41,7 @@ typedef struct _taos_qset {
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
int32_t
numOfQueues
;
int32_t
numOfQueues
;
int32_t
numOfItems
;
int32_t
numOfItems
;
tsem_t
sem
;
}
STaosQset
;
}
STaosQset
;
typedef
struct
_taos_qall
{
typedef
struct
_taos_qall
{
...
@@ -59,6 +60,7 @@ taos_queue taosOpenQueue() {
...
@@ -59,6 +60,7 @@ taos_queue taosOpenQueue() {
}
}
pthread_mutex_init
(
&
queue
->
mutex
,
NULL
);
pthread_mutex_init
(
&
queue
->
mutex
,
NULL
);
return
queue
;
return
queue
;
}
}
...
@@ -79,7 +81,7 @@ void taosCloseQueue(taos_queue param) {
...
@@ -79,7 +81,7 @@ void taosCloseQueue(taos_queue param) {
}
}
pthread_mutex_unlock
(
&
queue
->
mutex
);
pthread_mutex_unlock
(
&
queue
->
mutex
);
pthread_mutex_destroy
(
&
queue
->
mutex
);
free
(
queue
);
free
(
queue
);
}
}
...
@@ -116,11 +118,12 @@ int taosWriteQitem(taos_queue param, int type, void *item) {
...
@@ -116,11 +118,12 @@ int taosWriteQitem(taos_queue param, int type, void *item) {
queue
->
numOfItems
++
;
queue
->
numOfItems
++
;
if
(
queue
->
qset
)
atomic_add_fetch_32
(
&
queue
->
qset
->
numOfItems
,
1
);
if
(
queue
->
qset
)
atomic_add_fetch_32
(
&
queue
->
qset
->
numOfItems
,
1
);
uTrace
(
"item:%p is put into queue:%p, type:%d items:%d"
,
item
,
queue
,
type
,
queue
->
numOfItems
);
uTrace
(
"item:%p is put into queue:%p, type:%d items:%d"
,
item
,
queue
,
type
,
queue
->
numOfItems
);
pthread_mutex_unlock
(
&
queue
->
mutex
);
pthread_mutex_unlock
(
&
queue
->
mutex
);
if
(
queue
->
qset
)
tsem_post
(
&
queue
->
qset
->
sem
);
return
0
;
return
0
;
}
}
...
@@ -217,12 +220,15 @@ taos_qset taosOpenQset() {
...
@@ -217,12 +220,15 @@ taos_qset taosOpenQset() {
}
}
pthread_mutex_init
(
&
qset
->
mutex
,
NULL
);
pthread_mutex_init
(
&
qset
->
mutex
,
NULL
);
tsem_init
(
&
qset
->
sem
,
0
,
0
);
return
qset
;
return
qset
;
}
}
void
taosCloseQset
(
taos_qset
param
)
{
void
taosCloseQset
(
taos_qset
param
)
{
STaosQset
*
qset
=
(
STaosQset
*
)
param
;
STaosQset
*
qset
=
(
STaosQset
*
)
param
;
pthread_mutex_destroy
(
&
qset
->
mutex
);
tsem_destroy
(
&
qset
->
sem
);
free
(
qset
);
free
(
qset
);
}
}
...
@@ -298,6 +304,8 @@ int taosReadQitemFromQset(taos_qset param, int *type, void **pitem, void **phand
...
@@ -298,6 +304,8 @@ int taosReadQitemFromQset(taos_qset param, int *type, void **pitem, void **phand
STaosQnode
*
pNode
=
NULL
;
STaosQnode
*
pNode
=
NULL
;
int
code
=
0
;
int
code
=
0
;
tsem_wait
(
&
qset
->
sem
);
pthread_mutex_lock
(
&
qset
->
mutex
);
pthread_mutex_lock
(
&
qset
->
mutex
);
for
(
int
i
=
0
;
i
<
qset
->
numOfQueues
;
++
i
)
{
for
(
int
i
=
0
;
i
<
qset
->
numOfQueues
;
++
i
)
{
...
@@ -339,6 +347,7 @@ int taosReadAllQitemsFromQset(taos_qset param, taos_qall p2, void **phandle) {
...
@@ -339,6 +347,7 @@ int taosReadAllQitemsFromQset(taos_qset param, taos_qall p2, void **phandle) {
STaosQall
*
qall
=
(
STaosQall
*
)
p2
;
STaosQall
*
qall
=
(
STaosQall
*
)
p2
;
int
code
=
0
;
int
code
=
0
;
tsem_wait
(
&
qset
->
sem
);
pthread_mutex_lock
(
&
qset
->
mutex
);
pthread_mutex_lock
(
&
qset
->
mutex
);
for
(
int
i
=
0
;
i
<
qset
->
numOfQueues
;
++
i
)
{
for
(
int
i
=
0
;
i
<
qset
->
numOfQueues
;
++
i
)
{
...
@@ -364,6 +373,7 @@ int taosReadAllQitemsFromQset(taos_qset param, taos_qall p2, void **phandle) {
...
@@ -364,6 +373,7 @@ int taosReadAllQitemsFromQset(taos_qset param, taos_qall p2, void **phandle) {
queue
->
tail
=
NULL
;
queue
->
tail
=
NULL
;
queue
->
numOfItems
=
0
;
queue
->
numOfItems
=
0
;
atomic_sub_fetch_32
(
&
qset
->
numOfItems
,
qall
->
numOfItems
);
atomic_sub_fetch_32
(
&
qset
->
numOfItems
,
qall
->
numOfItems
);
for
(
int
j
=
1
;
j
<
qall
->
numOfItems
;
++
j
)
tsem_wait
(
&
qset
->
sem
);
}
}
pthread_mutex_unlock
(
&
queue
->
mutex
);
pthread_mutex_unlock
(
&
queue
->
mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录