Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1aad2670
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1aad2670
编写于
12月 26, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/main' into enh/TD-21492
上级
d4ff81ee
233322db
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
49 addition
and
21 deletion
+49
-21
source/dnode/vnode/src/vnd/vnodeCommit.c
source/dnode/vnode/src/vnd/vnodeCommit.c
+48
-19
source/libs/stream/src/streamState.c
source/libs/stream/src/streamState.c
+1
-2
未找到文件。
source/dnode/vnode/src/vnd/vnodeCommit.c
浏览文件 @
1aad2670
...
@@ -184,16 +184,51 @@ _err:
...
@@ -184,16 +184,51 @@ _err:
return
-
1
;
return
-
1
;
}
}
static
void
vnodePrepareCommit
(
SVnode
*
pVnode
)
{
static
int32_t
vnodePrepareCommit
(
SVnode
*
pVnode
,
SCommitInfo
*
pInfo
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
char
dir
[
TSDB_FILENAME_LEN
]
=
{
0
};
tsem_wait
(
&
pVnode
->
canCommit
);
tsem_wait
(
&
pVnode
->
canCommit
);
pVnode
->
state
.
commitTerm
=
pVnode
->
state
.
applyTerm
;
pInfo
->
info
.
config
=
pVnode
->
config
;
pInfo
->
info
.
state
.
committed
=
pVnode
->
state
.
applied
;
pInfo
->
info
.
state
.
commitTerm
=
pVnode
->
state
.
applyTerm
;
pInfo
->
info
.
state
.
commitID
=
pVnode
->
state
.
commitID
;
pInfo
->
pVnode
=
pVnode
;
pInfo
->
txn
=
metaGetTxn
(
pVnode
->
pMeta
);
// save info
if
(
pVnode
->
pTfs
)
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
);
}
else
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
pVnode
->
path
);
}
if
(
vnodeSaveInfo
(
dir
,
&
pInfo
->
info
)
<
0
)
{
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
tsdbPrepareCommit
(
pVnode
->
pTsdb
);
tsdbPrepareCommit
(
pVnode
->
pTsdb
);
metaPrepareAsyncCommit
(
pVnode
->
pMeta
);
smaPrepareAsyncCommit
(
pVnode
->
pSma
);
smaPrepareAsyncCommit
(
pVnode
->
pSma
);
metaPrepareAsyncCommit
(
pVnode
->
pMeta
);
vnodeBufPoolUnRef
(
pVnode
->
inUse
);
vnodeBufPoolUnRef
(
pVnode
->
inUse
);
pVnode
->
inUse
=
NULL
;
pVnode
->
inUse
=
NULL
;
_exit:
if
(
code
)
{
vError
(
"vgId:%d, %s failed at line %d since %s, commit id:%"
PRId64
,
TD_VID
(
pVnode
),
__func__
,
lino
,
tstrerror
(
code
),
pVnode
->
state
.
commitID
);
}
else
{
vDebug
(
"vgId:%d, %s done"
,
TD_VID
(
pVnode
),
__func__
);
}
return
code
;
}
}
static
int32_t
vnodeCommitTask
(
void
*
arg
)
{
static
int32_t
vnodeCommitTask
(
void
*
arg
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -213,27 +248,26 @@ _exit:
...
@@ -213,27 +248,26 @@ _exit:
int
vnodeAsyncCommit
(
SVnode
*
pVnode
)
{
int
vnodeAsyncCommit
(
SVnode
*
pVnode
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
// prepare to commit
vnodePrepareCommit
(
pVnode
);
// schedule the task
pVnode
->
state
.
commitTerm
=
pVnode
->
state
.
applyTerm
;
SCommitInfo
*
pInfo
=
(
SCommitInfo
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pInfo
));
SCommitInfo
*
pInfo
=
(
SCommitInfo
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pInfo
));
if
(
NULL
==
pInfo
)
{
if
(
NULL
==
pInfo
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
goto
_exit
;
}
}
pInfo
->
info
.
config
=
pVnode
->
config
;
pInfo
->
info
.
state
.
committed
=
pVnode
->
state
.
applied
;
// prepare to commit
pInfo
->
info
.
state
.
commitTerm
=
pVnode
->
state
.
applyTerm
;
code
=
vnodePrepareCommit
(
pVnode
,
pInfo
);
pInfo
->
info
.
state
.
commitID
=
pVnode
->
state
.
commitID
;
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
pInfo
->
pVnode
=
pVnode
;
goto
_exit
;
pInfo
->
txn
=
metaGetTxn
(
pVnode
->
pMeta
);
}
// schedule the task
vnodeScheduleTask
(
vnodeCommitTask
,
pInfo
);
vnodeScheduleTask
(
vnodeCommitTask
,
pInfo
);
_exit:
_exit:
if
(
code
)
{
if
(
code
)
{
if
(
NULL
!=
pInfo
)
{
taosMemoryFree
(
pInfo
);
}
vError
(
"vgId:%d, vnode async commit failed since %s, commitId:%"
PRId64
,
TD_VID
(
pVnode
),
tstrerror
(
code
),
vError
(
"vgId:%d, vnode async commit failed since %s, commitId:%"
PRId64
,
TD_VID
(
pVnode
),
tstrerror
(
code
),
pVnode
->
state
.
commitID
);
pVnode
->
state
.
commitID
);
}
else
{
}
else
{
...
@@ -266,16 +300,11 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
...
@@ -266,16 +300,11 @@ static int vnodeCommitImpl(SCommitInfo *pInfo) {
return
-
1
;
return
-
1
;
}
}
// save info
if
(
pVnode
->
pTfs
)
{
if
(
pVnode
->
pTfs
)
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
);
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s%s%s"
,
tfsGetPrimaryPath
(
pVnode
->
pTfs
),
TD_DIRSEP
,
pVnode
->
path
);
}
else
{
}
else
{
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
pVnode
->
path
);
snprintf
(
dir
,
TSDB_FILENAME_LEN
,
"%s"
,
pVnode
->
path
);
}
}
if
(
vnodeSaveInfo
(
dir
,
&
pInfo
->
info
)
<
0
)
{
code
=
terrno
;
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
// walBeginSnapshot(pVnode->pWal, pVnode->state.applied);
// walBeginSnapshot(pVnode->pWal, pVnode->state.applied);
syncBeginSnapshot
(
pVnode
->
sync
,
pVnode
->
state
.
applied
);
syncBeginSnapshot
(
pVnode
->
sync
,
pVnode
->
state
.
applied
);
...
...
source/libs/stream/src/streamState.c
浏览文件 @
1aad2670
...
@@ -656,8 +656,7 @@ int32_t streamStateSessionClear(SStreamState* pState) {
...
@@ -656,8 +656,7 @@ int32_t streamStateSessionClear(SStreamState* pState) {
void
*
buf
=
NULL
;
void
*
buf
=
NULL
;
int32_t
size
=
0
;
int32_t
size
=
0
;
int32_t
code
=
streamStateSessionGetKVByCur
(
pCur
,
&
delKey
,
&
buf
,
&
size
);
int32_t
code
=
streamStateSessionGetKVByCur
(
pCur
,
&
delKey
,
&
buf
,
&
size
);
if
(
code
==
0
)
{
if
(
code
==
0
&&
size
>
0
)
{
ASSERT
(
size
>
0
);
memset
(
buf
,
0
,
size
);
memset
(
buf
,
0
,
size
);
streamStateSessionPut
(
pState
,
&
delKey
,
buf
,
size
);
streamStateSessionPut
(
pState
,
&
delKey
,
buf
,
size
);
}
else
{
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录