Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
f5e2d44f
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,发现更多精彩内容 >>
未验证
提交
f5e2d44f
编写于
11月 12, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
11月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4197 from taosdata/feature/wal
Feature/wal
上级
1c306696
d4a5104c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
4 deletion
+21
-4
src/inc/tsdb.h
src/inc/tsdb.h
+2
-0
src/os/src/detail/osFile.c
src/os/src/detail/osFile.c
+1
-1
src/sync/src/syncMain.c
src/sync/src/syncMain.c
+1
-1
src/tsdb/src/tsdbCommitQueue.c
src/tsdb/src/tsdbCommitQueue.c
+15
-2
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+2
-0
未找到文件。
src/inc/tsdb.h
浏览文件 @
f5e2d44f
...
...
@@ -324,6 +324,8 @@ void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int
int
tsdbInitCommitQueue
(
int
nthreads
);
void
tsdbDestroyCommitQueue
();
int
tsdbSyncCommit
(
TSDB_REPO_T
*
repo
);
void
tsdbIncCommitRef
(
int
vgId
);
void
tsdbDecCommitRef
(
int
vgId
);
#ifdef __cplusplus
}
...
...
src/os/src/detail/osFile.c
浏览文件 @
f5e2d44f
...
...
@@ -132,7 +132,7 @@ int64_t taosSendFile(int32_t dfd, int32_t sfd, int64_t *offset, int64_t size) {
// if (leftbytes > 1000000000) leftbytes = 1000000000;
sentbytes
=
sendfile
(
dfd
,
sfd
,
offset
,
leftbytes
);
if
(
sentbytes
==
-
1
)
{
if
(
errno
==
EINTR
)
{
if
(
errno
==
EINTR
||
errno
==
EAGAIN
||
errno
==
EWOULDBLOCK
)
{
continue
;
}
else
{
return
-
1
;
...
...
src/sync/src/syncMain.c
浏览文件 @
f5e2d44f
...
...
@@ -1222,7 +1222,7 @@ static int32_t syncForwardToPeerImpl(SSyncNode *pNode, void *data, void *mhandle
// always update version
nodeVersion
=
pWalHead
->
version
;
s
Debug
(
"vgId:%d, forward to peer, replica:%d role:%s qtype:%s hver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
s
Trace
(
"vgId:%d, forward to peer, replica:%d role:%s qtype:%s hver:%"
PRIu64
,
pNode
->
vgId
,
pNode
->
replica
,
syncRole
[
nodeRole
],
qtypeStr
[
qtype
],
pWalHead
->
version
);
if
(
pNode
->
replica
==
1
||
nodeRole
!=
TAOS_SYNC_ROLE_MASTER
)
return
0
;
...
...
src/tsdb/src/tsdbCommitQueue.c
浏览文件 @
f5e2d44f
...
...
@@ -15,6 +15,7 @@
#include "os.h"
#include "tlist.h"
#include "tref.h"
#include "tsdbMain.h"
typedef
struct
{
...
...
@@ -22,6 +23,7 @@ typedef struct {
pthread_mutex_t
lock
;
pthread_cond_t
queueNotEmpty
;
int
nthreads
;
int
refCount
;
SList
*
queue
;
pthread_t
*
threads
;
}
SCommitQueue
;
...
...
@@ -103,7 +105,7 @@ int tsdbScheduleCommit(STsdbRepo *pRepo) {
pthread_mutex_lock
(
&
(
pQueue
->
lock
));
ASSERT
(
!
pQueue
->
stop
);
// ASSERT(
pQueue->stop);
tdListAppendNode
(
pQueue
->
queue
,
pNode
);
pthread_cond_signal
(
&
(
pQueue
->
queueNotEmpty
));
...
...
@@ -123,7 +125,7 @@ static void *tsdbLoopCommit(void *arg) {
while
(
true
)
{
pNode
=
tdListPopHead
(
pQueue
->
queue
);
if
(
pNode
==
NULL
)
{
if
(
pQueue
->
stop
)
{
if
(
pQueue
->
stop
&&
pQueue
->
refCount
<=
0
)
{
pthread_mutex_unlock
(
&
(
pQueue
->
lock
));
goto
_exit
;
}
else
{
...
...
@@ -145,3 +147,14 @@ static void *tsdbLoopCommit(void *arg) {
_exit:
return
NULL
;
}
void
tsdbIncCommitRef
(
int
vgId
)
{
int
refCount
=
atomic_add_fetch_32
(
&
tsCommitQueue
.
refCount
,
1
);
tsdbDebug
(
"vgId:%d, inc commit queue ref to %d"
,
vgId
,
refCount
);
}
void
tsdbDecCommitRef
(
int
vgId
)
{
int
refCount
=
atomic_sub_fetch_32
(
&
tsCommitQueue
.
refCount
,
1
);
pthread_cond_broadcast
(
&
(
tsCommitQueue
.
queueNotEmpty
));
tsdbDebug
(
"vgId:%d, dec commit queue ref to %d"
,
vgId
,
refCount
);
}
\ No newline at end of file
src/vnode/src/vnodeMain.c
浏览文件 @
f5e2d44f
...
...
@@ -355,6 +355,7 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
pVnode
->
status
=
TAOS_VN_STATUS_READY
;
vDebug
(
"vgId:%d, vnode is opened in %s, pVnode:%p"
,
pVnode
->
vgId
,
rootDir
,
pVnode
);
tsdbIncCommitRef
(
pVnode
->
vgId
);
taosHashPut
(
tsVnodesHash
,
(
const
char
*
)
&
pVnode
->
vgId
,
sizeof
(
int32_t
),
(
char
*
)(
&
pVnode
),
sizeof
(
SVnodeObj
*
));
return
TSDB_CODE_SUCCESS
;
...
...
@@ -446,6 +447,7 @@ void vnodeRelease(void *pVnodeRaw) {
tsem_destroy
(
&
pVnode
->
sem
);
free
(
pVnode
);
tsdbDecCommitRef
(
vgId
);
int32_t
count
=
taosHashGetSize
(
tsVnodesHash
);
vDebug
(
"vgId:%d, vnode is destroyed, vnodes:%d"
,
vgId
,
count
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录