Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
519d3b74
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看板
提交
519d3b74
编写于
7月 20, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix stream state transfer
上级
6e5be0d3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
31 deletion
+40
-31
source/dnode/vnode/src/tq/tqStreamStateSnap.c
source/dnode/vnode/src/tq/tqStreamStateSnap.c
+1
-9
source/libs/stream/src/streamSnapshot.c
source/libs/stream/src/streamSnapshot.c
+38
-21
source/libs/tdb/test/tdbPageRecycleTest.cpp
source/libs/tdb/test/tdbPageRecycleTest.cpp
+1
-1
未找到文件。
source/dnode/vnode/src/tq/tqStreamStateSnap.c
浏览文件 @
519d3b74
...
...
@@ -51,15 +51,7 @@ int32_t streamStateSnapReaderOpen(STQ* pTq, int64_t sver, int64_t ever, SStreamS
SStreamSnapReader
*
pSnapReader
=
NULL
;
// restore from checkpoint if checkpointid != 0
if
(
checkpointId
!=
0
)
{
sprintf
(
tdir
,
"%s%s%s%s%s%scheckpoint%"
PRId64
""
,
pTq
->
path
,
TD_DIRSEP
,
VNODE_TQ_STREAM
,
TD_DIRSEP
,
"checkpoints"
,
TD_DIRSEP
,
checkpointId
);
}
else
{
sprintf
(
tdir
,
"%s%s%s%s%s"
,
pTq
->
path
,
TD_DIRSEP
,
VNODE_TQ_STREAM
,
TD_DIRSEP
,
"state"
);
}
if
(
streamSnapReaderOpen
(
pTq
,
sver
,
checkpointId
,
tdir
,
&
pSnapReader
)
==
0
)
{
if
(
streamSnapReaderOpen
(
pTq
,
sver
,
checkpointId
,
pTq
->
path
,
&
pSnapReader
)
==
0
)
{
pReader
->
complete
=
1
;
}
else
{
code
=
-
1
;
...
...
source/libs/stream/src/streamSnapshot.c
浏览文件 @
519d3b74
...
...
@@ -79,31 +79,42 @@ const char* ROCKSDB_CURRENT = "CURRENT";
const
char
*
ROCKSDB_CHECKPOINT_META
=
"CHECKPOINT"
;
static
int64_t
kBlockSize
=
64
*
1024
;
int32_t
streamSnapHandleInit
(
SStreamSnapHandle
*
handle
,
char
*
path
);
int32_t
streamSnapHandleInit
(
SStreamSnapHandle
*
handle
,
char
*
path
,
int64_t
chkpId
);
void
streamSnapHandleDestroy
(
SStreamSnapHandle
*
handle
);
// static void streamBuildFname(char* path, char* file, char* fullname)
#define STREAM_ROCKSDB_BUILD_FULLNAME(path, file, fullname) \
do { \
sprintf(fullname, "%s
/%s", path, file);
\
sprintf(fullname, "%s
%s%s", path, TD_DIRSEP, file);
\
} while (0)
int32_t
streamSnapHandleInit
(
SStreamSnapHandle
*
pHandle
,
char
*
path
)
{
int32_t
streamSnapHandleInit
(
SStreamSnapHandle
*
pHandle
,
char
*
path
,
int64_t
chkpId
)
{
// impl later
int
len
=
strlen
(
path
);
char
*
tdir
=
taosMemoryCalloc
(
1
,
len
+
128
);
memcpy
(
tdir
,
path
,
len
);
if
(
chkpId
!=
0
)
{
sprintf
(
tdir
,
"%s%s%s%s%s%scheckpoint%"
PRId64
""
,
path
,
TD_DIRSEP
,
"stream"
,
TD_DIRSEP
,
"checkpoints"
,
TD_DIRSEP
,
chkpId
);
}
else
{
sprintf
(
tdir
,
"%s%s%s%s%s"
,
path
,
TD_DIRSEP
,
"stream"
,
TD_DIRSEP
,
"state"
);
}
int32_t
code
=
0
;
TdDirPtr
pDir
=
taosOpenDir
(
path
);
TdDirPtr
pDir
=
taosOpenDir
(
tdir
);
if
(
NULL
==
pDir
)
{
qError
(
"stream-state failed to open %s"
,
tdir
);
goto
_err
;
}
SBanckendFile
*
pFile
=
taosMemoryCalloc
(
1
,
sizeof
(
SBanckendFile
));
pHandle
->
pBackendFile
=
pFile
;
pHandle
->
checkpointId
=
0
;
pHandle
->
checkpointId
=
chkpId
;
pHandle
->
seraial
=
0
;
pFile
->
path
=
t
aosStrdup
(
path
)
;
pFile
->
path
=
t
dir
;
pFile
->
pSst
=
taosArrayInit
(
16
,
sizeof
(
void
*
));
TdDirEntryPtr
pDirEntry
;
...
...
@@ -135,7 +146,9 @@ int32_t streamSnapHandleInit(SStreamSnapHandle* pHandle, char* path) {
taosCloseDir
(
&
pDir
);
if
(
pFile
->
pCurrent
==
NULL
)
{
qError
(
"stream-state failed to open %s, reason: no valid file"
,
tdir
);
code
=
-
1
;
tdir
=
NULL
;
goto
_err
;
}
SArray
*
list
=
taosArrayInit
(
64
,
sizeof
(
SBackendFileItem
));
...
...
@@ -176,11 +189,13 @@ int32_t streamSnapHandleInit(SStreamSnapHandle* pHandle, char* path) {
pHandle
->
pFileList
=
list
;
char
fullname
[
256
]
=
{
0
};
char
*
file
=
taosArrayGet
(
pHandle
->
pFileList
,
pHandle
->
currFileIdx
)
;
char
*
file
=
((
SBackendFileItem
*
)
taosArrayGet
(
pHandle
->
pFileList
,
pHandle
->
currFileIdx
))
->
name
;
STREAM_ROCKSDB_BUILD_FULLNAME
(
pFile
->
path
,
file
,
fullname
);
pHandle
->
fd
=
taosOpenFile
(
fullname
,
TD_FILE_READ
);
if
(
pHandle
->
fd
==
NULL
)
{
qError
(
"stream-state failed to open %s, reason: %s"
,
tdir
,
tstrerror
(
errno
));
tdir
=
NULL
;
goto
_err
;
}
pHandle
->
seraial
=
0
;
...
...
@@ -188,6 +203,7 @@ int32_t streamSnapHandleInit(SStreamSnapHandle* pHandle, char* path) {
return
0
;
_err:
streamSnapHandleDestroy
(
pHandle
);
taosMemoryFreeClear
(
tdir
);
code
=
-
1
;
return
code
;
...
...
@@ -195,32 +211,33 @@ _err:
void
streamSnapHandleDestroy
(
SStreamSnapHandle
*
handle
)
{
SBanckendFile
*
pFile
=
handle
->
pBackendFile
;
taosMemoryFree
(
pFile
->
pCheckpointMeta
);
taosMemoryFree
(
pFile
->
pCurrent
);
taosMemoryFree
(
pFile
->
pMainfest
);
taosMemoryFree
(
pFile
->
pOptions
);
taosMemoryFree
(
pFile
->
path
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pFile
->
pSst
);
i
++
)
{
char
*
sst
=
taosArrayGetP
(
pFile
->
pSst
,
i
);
taosMemoryFree
(
sst
);
if
(
pFile
)
{
taosMemoryFree
(
pFile
->
pCheckpointMeta
);
taosMemoryFree
(
pFile
->
pCurrent
);
taosMemoryFree
(
pFile
->
pMainfest
);
taosMemoryFree
(
pFile
->
pOptions
);
taosMemoryFree
(
pFile
->
path
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pFile
->
pSst
);
i
++
)
{
char
*
sst
=
taosArrayGetP
(
pFile
->
pSst
,
i
);
taosMemoryFree
(
sst
);
}
taosArrayDestroy
(
pFile
->
pSst
);
taosMemoryFree
(
pFile
);
}
taosArrayDestroy
(
pFile
->
pSst
);
taosMemoryFree
(
pFile
);
taosArrayDestroy
(
handle
->
pFileList
);
taosCloseFile
(
&
handle
->
fd
);
return
;
}
int32_t
streamSnapReaderOpen
(
void
*
pMeta
,
int64_t
sver
,
int64_t
ever
,
char
*
path
,
SStreamSnapReader
**
ppReader
)
{
int32_t
streamSnapReaderOpen
(
void
*
pMeta
,
int64_t
sver
,
int64_t
chkpId
,
char
*
path
,
SStreamSnapReader
**
ppReader
)
{
// impl later
SStreamSnapReader
*
pReader
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamSnapReader
));
if
(
pReader
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pReader
->
handle
.
checkpointId
=
ever
;
// const char* path = NULL;
if
(
streamSnapHandleInit
(
&
pReader
->
handle
,
(
char
*
)
path
)
<
0
)
{
if
(
streamSnapHandleInit
(
&
pReader
->
handle
,
(
char
*
)
path
,
chkpId
)
<
0
)
{
taosMemoryFree
(
pReader
);
return
-
1
;
}
...
...
source/libs/tdb/test/tdbPageRecycleTest.cpp
浏览文件 @
519d3b74
...
...
@@ -804,7 +804,7 @@ TEST(TdbPageRecycleTest, recycly_delete_interior_ofp_nocommit) {
// sprintf(&key[count - 2], "%c", i);
key
[
count
-
2
]
=
'0'
+
i
;
ret
=
tdbTbInsert
(
pDb
,
key
,
count
,
NULL
,
NULL
,
txn
);
ret
=
tdbTbInsert
(
pDb
,
key
,
count
,
NULL
,
0
,
txn
);
GTEST_ASSERT_EQ
(
ret
,
0
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录