Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e6e9926d
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,发现更多精彩内容 >>
提交
e6e9926d
编写于
7月 13, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more vnode snapshot writer
上级
6c628ef6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
27 deletion
+38
-27
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+0
-5
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+0
-2
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
+38
-3
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+0
-17
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
e6e9926d
...
...
@@ -115,7 +115,6 @@ int32_t tGetBlock(uint8_t *p, void *ph);
int32_t
tBlockCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
bool
tBlockHasSma
(
SBlock
*
pBlock
);
// SBlockIdx
void
tBlockIdxReset
(
SBlockIdx
*
pBlockIdx
);
int32_t
tPutBlockIdx
(
uint8_t
*
p
,
void
*
ph
);
int32_t
tGetBlockIdx
(
uint8_t
*
p
,
void
*
ph
);
int32_t
tCmprBlockIdx
(
void
const
*
lhs
,
void
const
*
rhs
);
...
...
@@ -361,10 +360,6 @@ struct TSDBROW {
struct
SBlockIdx
{
int64_t
suid
;
int64_t
uid
;
TSKEY
minKey
;
TSKEY
maxKey
;
int64_t
minVersion
;
int64_t
maxVersion
;
int64_t
offset
;
int64_t
size
;
};
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
e6e9926d
...
...
@@ -500,9 +500,7 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
if
(
code
)
goto
_err
;
/* if (state->pBlockIdx) { */
/* tBlockIdxReset(state->blockIdx); */
/* } */
/* tBlockIdxReset(state->blockIdx); */
/* code = tMapDataSearch(&state->blockIdxMap, state->pBlockIdxExp, tGetBlockIdx, tCmprBlockIdx,
* &state->blockIdx);
*/
...
...
source/dnode/vnode/src/tsdb/tsdbSnapshot.c
浏览文件 @
e6e9926d
...
...
@@ -383,14 +383,15 @@ struct STsdbSnapWriter {
int32_t
iRow
;
SDataFWriter
*
pDataFWriter
;
SArray
*
aBlockIdxW
;
// SArray<SBlockIdx>
SBlockIdx
*
pBlockIdxW
;
SBlockIdx
blockIdx
;
SMapData
mBlockW
;
// SMapData<SBlock>
SBlock
*
pBlockW
;
SBlock
blockW
;
SBlockData
bDataW
;
SMapData
mBlockW
;
// SMapData<SBlock>
SArray
*
aBlockIdxW
;
// SArray<SBlockIdx>
// for del file
SDelFReader
*
pDelFReader
;
SDelFWriter
*
pDelFWriter
;
...
...
@@ -460,6 +461,7 @@ static int32_t tsdbSnapWriteTableDataEnd(STsdbSnapWriter* pWrite) {
return
code
;
}
#if 0
static int32_t tsdbSnapWriteTableData(STsdbSnapWriter* pWriter, uint8_t* pData, uint32_t nData) {
int32_t code = 0;
TABLEID id = {0}; // TODO
...
...
@@ -556,6 +558,38 @@ _err:
tsdbError("vgId:%d tsdb snapshot write table data failed since %s", TD_VID(pWriter->pTsdb->pVnode), tstrerror(code));
return code;
}
#endif
static
int32_t
tsdbSnapWriteDataImpl
(
STsdbSnapWriter
*
pWriter
,
TABLEID
id
)
{
int32_t
code
=
0
;
SBlockData
*
pBlockData
=
&
pWriter
->
bData
;
if
(
pWriter
->
pDataFReader
==
NULL
)
{
// no old data
// end last table data commit if id not same
if
(
pWriter
->
pBlockIdxW
)
{
int32_t
c
=
tTABLEIDCmprFn
(
pWriter
->
pBlockIdx
,
&
id
);
if
(
c
<
0
)
{
// commit last table data and reset (todo)
pWriter
->
pBlockIdxW
=
NULL
;
}
else
if
(
c
>
0
)
{
ASSERT
(
0
);
}
}
// start a new table data if need
if
(
pWriter
->
pBlockIdxW
==
NULL
)
{
pWriter
->
pBlockIdxW
=
&
pWriter
->
blockIdx
;
pWriter
->
pBlockIdxW
->
suid
=
id
.
suid
;
pWriter
->
pBlockIdxW
->
uid
=
id
.
uid
;
}
}
else
{
}
return
code
;
}
static
int32_t
tsdbSnapWriteData
(
STsdbSnapWriter
*
pWriter
,
uint8_t
*
pData
,
uint32_t
nData
)
{
int32_t
code
=
0
;
...
...
@@ -630,7 +664,8 @@ static int32_t tsdbSnapWriteData(STsdbSnapWriter* pWriter, uint8_t* pData, uint3
tBlockDataReset
(
&
pWriter
->
bDataW
);
}
// write data block (todo)
code
=
tsdbSnapWriteDataImpl
(
pWriter
,
id
);
if
(
code
)
goto
_err
;
tsdbInfo
(
"vgId:%d vnode snapshot tsdb write data, fid:%d suid:%"
PRId64
" uid:%"
PRId64
" nRow:%d"
,
TD_VID
(
pTsdb
->
pVnode
),
fid
,
id
.
suid
,
id
.
suid
,
pBlockData
->
nRow
);
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
e6e9926d
...
...
@@ -189,25 +189,12 @@ static FORCE_INLINE int32_t tGetTSDBKEY(uint8_t *p, TSDBKEY *pKey) {
}
// SBlockIdx ======================================================
void
tBlockIdxReset
(
SBlockIdx
*
pBlockIdx
)
{
pBlockIdx
->
minKey
=
TSKEY_MAX
;
pBlockIdx
->
maxKey
=
TSKEY_MIN
;
pBlockIdx
->
minVersion
=
VERSION_MAX
;
pBlockIdx
->
maxVersion
=
VERSION_MIN
;
pBlockIdx
->
offset
=
-
1
;
pBlockIdx
->
size
=
-
1
;
}
int32_t
tPutBlockIdx
(
uint8_t
*
p
,
void
*
ph
)
{
int32_t
n
=
0
;
SBlockIdx
*
pBlockIdx
=
(
SBlockIdx
*
)
ph
;
n
+=
tPutI64
(
p
?
p
+
n
:
p
,
pBlockIdx
->
suid
);
n
+=
tPutI64
(
p
?
p
+
n
:
p
,
pBlockIdx
->
uid
);
n
+=
tPutI64
(
p
?
p
+
n
:
p
,
pBlockIdx
->
minKey
);
n
+=
tPutI64
(
p
?
p
+
n
:
p
,
pBlockIdx
->
maxKey
);
n
+=
tPutI64v
(
p
?
p
+
n
:
p
,
pBlockIdx
->
minVersion
);
n
+=
tPutI64v
(
p
?
p
+
n
:
p
,
pBlockIdx
->
maxVersion
);
n
+=
tPutI64v
(
p
?
p
+
n
:
p
,
pBlockIdx
->
offset
);
n
+=
tPutI64v
(
p
?
p
+
n
:
p
,
pBlockIdx
->
size
);
...
...
@@ -220,10 +207,6 @@ int32_t tGetBlockIdx(uint8_t *p, void *ph) {
n
+=
tGetI64
(
p
+
n
,
&
pBlockIdx
->
suid
);
n
+=
tGetI64
(
p
+
n
,
&
pBlockIdx
->
uid
);
n
+=
tGetI64
(
p
+
n
,
&
pBlockIdx
->
minKey
);
n
+=
tGetI64
(
p
+
n
,
&
pBlockIdx
->
maxKey
);
n
+=
tGetI64v
(
p
+
n
,
&
pBlockIdx
->
minVersion
);
n
+=
tGetI64v
(
p
+
n
,
&
pBlockIdx
->
maxVersion
);
n
+=
tGetI64v
(
p
+
n
,
&
pBlockIdx
->
offset
);
n
+=
tGetI64v
(
p
+
n
,
&
pBlockIdx
->
size
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录