Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dea2e73d
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
dea2e73d
编写于
7月 17, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add checkpoint
上级
4b11a65b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
8 deletion
+9
-8
source/libs/stream/src/streamBackendRocksdb.c
source/libs/stream/src/streamBackendRocksdb.c
+8
-7
source/libs/stream/src/streamMeta.c
source/libs/stream/src/streamMeta.c
+1
-1
未找到文件。
source/libs/stream/src/streamBackendRocksdb.c
浏览文件 @
dea2e73d
...
@@ -180,17 +180,16 @@ _err:
...
@@ -180,17 +180,16 @@ _err:
taosMemoryFreeClear
(
absSrcPath
);
taosMemoryFreeClear
(
absSrcPath
);
taosMemoryFreeClear
(
absDstPath
);
taosMemoryFreeClear
(
absDstPath
);
taosCloseDir
(
&
pDir
);
taosCloseDir
(
&
pDir
);
return
code
;
return
code
>=
0
?
0
:
-
1
;
}
}
int32_t
rebuildDirFromCheckpoint
(
const
char
*
path
,
int64_t
chkpId
,
char
**
dst
)
{
int32_t
rebuildDirFromCheckpoint
(
const
char
*
path
,
int64_t
chkpId
,
char
**
dst
)
{
// impl later
// impl later
int32_t
code
=
0
;
int32_t
code
=
0
;
char
*
state
=
taosMemoryCalloc
(
1
,
strlen
(
path
)
+
32
);
char
*
state
=
taosMemoryCalloc
(
1
,
strlen
(
path
)
+
32
);
sprintf
(
state
,
"%s/%s"
,
path
,
"state"
);
sprintf
(
state
,
"%s/%s"
,
path
,
"state"
);
if
(
chkpId
!=
0
)
{
if
(
chkpId
!=
0
)
{
char
*
chkp
=
taosMemoryCalloc
(
1
,
strlen
(
path
)
+
64
);
char
*
chkp
=
taosMemoryCalloc
(
1
,
strlen
(
path
)
+
64
);
sprintf
(
chkp
,
"%s/%s/checkpoint
-
%"
PRId64
""
,
path
,
"checkpoints"
,
chkpId
);
sprintf
(
chkp
,
"%s/%s/checkpoint%"
PRId64
""
,
path
,
"checkpoints"
,
chkpId
);
if
(
taosIsDir
(
chkp
)
&&
isValidCheckpoint
(
chkp
))
{
if
(
taosIsDir
(
chkp
)
&&
isValidCheckpoint
(
chkp
))
{
if
(
taosIsDir
(
state
))
{
if
(
taosIsDir
(
state
))
{
// remove dir if exists
// remove dir if exists
...
@@ -201,6 +200,8 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
...
@@ -201,6 +200,8 @@ int32_t rebuildDirFromCheckpoint(const char* path, int64_t chkpId, char** dst) {
code
=
copyFiles
(
chkp
,
state
);
code
=
copyFiles
(
chkp
,
state
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
qError
(
"failed to restart stream backend from %s, reason: %s"
,
chkp
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
qError
(
"failed to restart stream backend from %s, reason: %s"
,
chkp
,
tstrerror
(
TAOS_SYSTEM_ERROR
(
errno
)));
}
else
{
qInfo
(
"succ to restart stream backend at checkpoint path: %s"
,
chkp
);
}
}
}
else
{
}
else
{
...
@@ -458,7 +459,7 @@ int32_t delObsoleteCheckpoint(void* arg, const char* path) {
...
@@ -458,7 +459,7 @@ int32_t delObsoleteCheckpoint(void* arg, const char* path) {
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
checkpointDel
);
i
++
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
checkpointDel
);
i
++
)
{
int64_t
id
=
*
(
int64_t
*
)
taosArrayGet
(
checkpointDel
,
i
);
int64_t
id
=
*
(
int64_t
*
)
taosArrayGet
(
checkpointDel
,
i
);
char
tbuf
[
256
]
=
{
0
};
char
tbuf
[
256
]
=
{
0
};
sprintf
(
tbuf
,
"%s/checkpoint
-
%"
PRId64
""
,
path
,
id
);
sprintf
(
tbuf
,
"%s/checkpoint%"
PRId64
""
,
path
,
id
);
if
(
taosIsDir
(
tbuf
))
{
if
(
taosIsDir
(
tbuf
))
{
taosRemoveDir
(
tbuf
);
taosRemoveDir
(
tbuf
);
}
}
...
@@ -499,7 +500,7 @@ int32_t streamBackendLoadCheckpointInfo(void* arg) {
...
@@ -499,7 +500,7 @@ int32_t streamBackendLoadCheckpointInfo(void* arg) {
char
checkpointPrefix
[
32
]
=
{
0
};
char
checkpointPrefix
[
32
]
=
{
0
};
int64_t
checkpointId
=
0
;
int64_t
checkpointId
=
0
;
int
ret
=
sscanf
(
taosGetDirEntryName
(
de
),
"checkpoint
-
%"
PRId64
""
,
&
checkpointId
);
int
ret
=
sscanf
(
taosGetDirEntryName
(
de
),
"checkpoint%"
PRId64
""
,
&
checkpointId
);
if
(
ret
==
1
)
{
if
(
ret
==
1
)
{
taosArrayPush
(
suffix
,
&
checkpointId
);
taosArrayPush
(
suffix
,
&
checkpointId
);
}
}
...
@@ -534,7 +535,7 @@ int32_t streamBackendDoCheckpoint(void* arg, uint64_t checkpointId) {
...
@@ -534,7 +535,7 @@ int32_t streamBackendDoCheckpoint(void* arg, uint64_t checkpointId) {
}
}
char
checkpointDir
[
256
]
=
{
0
};
char
checkpointDir
[
256
]
=
{
0
};
snprintf
(
checkpointDir
,
tListLen
(
checkpointDir
),
"%s/checkpoint
-
%"
PRId64
,
path
,
checkpointId
);
snprintf
(
checkpointDir
,
tListLen
(
checkpointDir
),
"%s/checkpoint%"
PRId64
,
path
,
checkpointId
);
SBackendWrapper
*
pHandle
=
taosAcquireRef
(
streamBackendId
,
backendRid
);
SBackendWrapper
*
pHandle
=
taosAcquireRef
(
streamBackendId
,
backendRid
);
if
(
pHandle
==
NULL
)
{
if
(
pHandle
==
NULL
)
{
...
@@ -1630,10 +1631,10 @@ SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState, const SWinK
...
@@ -1630,10 +1631,10 @@ SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState, const SWinK
SStreamStateCur
*
pCur
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamStateCur
));
SStreamStateCur
*
pCur
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamStateCur
));
if
(
pCur
==
NULL
)
return
NULL
;
if
(
pCur
==
NULL
)
return
NULL
;
pCur
->
number
=
pState
->
number
;
pCur
->
db
=
((
SBackendCfWrapper
*
)
pState
->
pTdbState
->
pBackendCfWrapper
)
->
rocksdb
;
pCur
->
db
=
((
SBackendCfWrapper
*
)
pState
->
pTdbState
->
pBackendCfWrapper
)
->
rocksdb
;
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"state"
,
(
rocksdb_snapshot_t
**
)
&
pCur
->
snapshot
,
pCur
->
iter
=
streamStateIterCreate
(
pState
,
"state"
,
(
rocksdb_snapshot_t
**
)
&
pCur
->
snapshot
,
(
rocksdb_readoptions_t
**
)
&
pCur
->
readOpt
);
(
rocksdb_readoptions_t
**
)
&
pCur
->
readOpt
);
pCur
->
number
=
pState
->
number
;
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
(
size_t
)
klen
);
rocksdb_iter_seek
(
pCur
->
iter
,
buf
,
(
size_t
)
klen
);
rocksdb_iter_prev
(
pCur
->
iter
);
rocksdb_iter_prev
(
pCur
->
iter
);
...
...
source/libs/stream/src/streamMeta.c
浏览文件 @
dea2e73d
...
@@ -102,7 +102,7 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
...
@@ -102,7 +102,7 @@ SStreamMeta* streamMetaOpen(const char* path, void* ahandle, FTaskExpand expandF
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_ENTRY_LOCK
);
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
false
,
HASH_ENTRY_LOCK
);
pMeta
->
checkpointSaved
=
taosArrayInit
(
4
,
sizeof
(
int64_t
));
pMeta
->
checkpointSaved
=
taosArrayInit
(
4
,
sizeof
(
int64_t
));
pMeta
->
checkpointInUse
=
taosArrayInit
(
4
,
sizeof
(
int64_t
));
pMeta
->
checkpointInUse
=
taosArrayInit
(
4
,
sizeof
(
int64_t
));
pMeta
->
checkpointCap
=
4
;
pMeta
->
checkpointCap
=
8
;
taosInitRWLatch
(
&
pMeta
->
checkpointDirLock
);
taosInitRWLatch
(
&
pMeta
->
checkpointDirLock
);
int64_t
chkpId
=
streamGetLatestCheckpointId
(
pMeta
);
int64_t
chkpId
=
streamGetLatestCheckpointId
(
pMeta
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录