Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6a27e819
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
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看板
提交
6a27e819
编写于
7月 24, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix stream state transfer
上级
82df77eb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
8 deletion
+9
-8
source/libs/stream/src/streamSnapshot.c
source/libs/stream/src/streamSnapshot.c
+9
-8
未找到文件。
source/libs/stream/src/streamSnapshot.c
浏览文件 @
6a27e819
...
@@ -200,7 +200,7 @@ int32_t streamSnapHandleInit(SStreamSnapHandle* pHandle, char* path, int64_t chk
...
@@ -200,7 +200,7 @@ int32_t streamSnapHandleInit(SStreamSnapHandle* pHandle, char* path, int64_t chk
tdir
=
NULL
;
tdir
=
NULL
;
goto
_err
;
goto
_err
;
}
}
qDebug
(
"open file %s, current offset %"
PRId64
""
,
file
,
(
int64_t
)
0
);
qDebug
(
"
stream-state
open file %s, current offset %"
PRId64
""
,
file
,
(
int64_t
)
0
);
pHandle
->
seraial
=
0
;
pHandle
->
seraial
=
0
;
pHandle
->
offset
=
0
;
pHandle
->
offset
=
0
;
return
0
;
return
0
;
...
@@ -264,33 +264,34 @@ int32_t streamSnapRead(SStreamSnapReader* pReader, uint8_t** ppData, int64_t* si
...
@@ -264,33 +264,34 @@ int32_t streamSnapRead(SStreamSnapReader* pReader, uint8_t** ppData, int64_t* si
SBackendFileItem
*
item
=
taosArrayGet
(
pHandle
->
pFileList
,
pHandle
->
currFileIdx
);
SBackendFileItem
*
item
=
taosArrayGet
(
pHandle
->
pFileList
,
pHandle
->
currFileIdx
);
qDebug
(
"start to read file %s, current offset %"
PRId64
", size : % "
PRId64
", file no. %d"
,
item
->
name
,
qDebug
(
"st
ream-state st
art to read file %s, current offset %"
PRId64
", size : % "
PRId64
", file no. %d"
,
item
->
name
,
(
int64_t
)
pHandle
->
offset
,
item
->
size
,
pHandle
->
currFileIdx
);
(
int64_t
)
pHandle
->
offset
,
item
->
size
,
pHandle
->
currFileIdx
);
uint8_t
*
buf
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamSnapBlockHdr
)
+
kBlockSize
);
uint8_t
*
buf
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamSnapBlockHdr
)
+
kBlockSize
);
int64_t
nread
=
taosPReadFile
(
pHandle
->
fd
,
buf
+
sizeof
(
SStreamSnapBlockHdr
),
kBlockSize
,
pHandle
->
offset
);
int64_t
nread
=
taosPReadFile
(
pHandle
->
fd
,
buf
+
sizeof
(
SStreamSnapBlockHdr
),
kBlockSize
,
pHandle
->
offset
);
if
(
nread
==
-
1
)
{
if
(
nread
==
-
1
)
{
code
=
TAOS_SYSTEM_ERROR
(
terrno
);
code
=
TAOS_SYSTEM_ERROR
(
terrno
);
qError
(
"stream snap failed to read snap, file name:%s, type:%d, reason:%s"
,
item
->
name
,
item
->
type
,
qError
(
"stream
-state
snap failed to read snap, file name:%s, type:%d, reason:%s"
,
item
->
name
,
item
->
type
,
tstrerror
(
code
));
tstrerror
(
code
));
qDebug
(
"
failed to read file %s, current offset %"
PRId64
", size : % "
PRId64
", file no. %d"
,
item
->
name
,
qDebug
(
"
stream-state failed to read file %s, current offset %"
PRId64
", size : % "
PRId64
", file no. %d"
,
(
int64_t
)
pHandle
->
offset
,
item
->
size
,
pHandle
->
currFileIdx
);
item
->
name
,
(
int64_t
)
pHandle
->
offset
,
item
->
size
,
pHandle
->
currFileIdx
);
return
code
;
return
code
;
// handle later
// handle later
return
-
1
;
return
-
1
;
}
else
if
(
nread
>
0
&&
nread
<=
kBlockSize
)
{
}
else
if
(
nread
>
0
&&
nread
<=
kBlockSize
)
{
// left bytes less than kBlockSize
// left bytes less than kBlockSize
qDebug
(
"read file %s, current offset %"
PRId64
", size : % "
PRId64
", file no. %d"
,
item
->
name
,
qDebug
(
"
stream-state
read file %s, current offset %"
PRId64
", size : % "
PRId64
", file no. %d"
,
item
->
name
,
(
int64_t
)
pHandle
->
offset
,
item
->
size
,
pHandle
->
currFileIdx
);
(
int64_t
)
pHandle
->
offset
,
item
->
size
,
pHandle
->
currFileIdx
);
pHandle
->
offset
+=
nread
;
pHandle
->
offset
+=
nread
;
if
(
pHandle
->
offset
>=
item
->
size
||
nread
<
kBlockSize
)
{
if
(
pHandle
->
offset
>=
item
->
size
||
nread
<
kBlockSize
)
{
taosCloseFile
(
&
pHandle
->
fd
);
taosCloseFile
(
&
pHandle
->
fd
);
qDebug
(
"close file no.%d, move to next file, next file no.%d"
,
pHandle
->
currFileIdx
,
pHandle
->
currFileIdx
+
1
);
qDebug
(
"stream-state close file no.%d, move to next file, next file no.%d"
,
pHandle
->
currFileIdx
,
pHandle
->
currFileIdx
+
1
);
pHandle
->
offset
=
0
;
pHandle
->
offset
=
0
;
pHandle
->
currFileIdx
+=
1
;
pHandle
->
currFileIdx
+=
1
;
}
}
}
else
{
}
else
{
qDebug
(
"no data read, close file no.%d, move to next file, open and read"
,
pHandle
->
currFileIdx
);
qDebug
(
"
stream-state
no data read, close file no.%d, move to next file, open and read"
,
pHandle
->
currFileIdx
);
taosCloseFile
(
&
pHandle
->
fd
);
taosCloseFile
(
&
pHandle
->
fd
);
pHandle
->
offset
=
0
;
pHandle
->
offset
=
0
;
pHandle
->
currFileIdx
+=
1
;
pHandle
->
currFileIdx
+=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录