Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8be0e171
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
8be0e171
编写于
6月 12, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact code
上级
0c6acda1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
23 deletion
+30
-23
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
+30
-23
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
浏览文件 @
8be0e171
...
...
@@ -662,6 +662,7 @@ static int32_t tsdbDataFileWriterDoOpenReader(SDataFileWriter *writer) {
SDataFileReaderConfig
config
[
1
]
=
{{
.
tsdb
=
writer
->
config
->
tsdb
,
.
szPage
=
writer
->
config
->
szPage
,
.
bufArr
=
writer
->
config
->
bufArr
,
}};
for
(
int32_t
i
=
0
;
i
<
TSDB_FTYPE_MAX
;
++
i
)
{
...
...
@@ -1030,8 +1031,8 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const TS
key
->
version
<
writer
->
ctx
->
blockData
->
aVersion
[
writer
->
ctx
->
blockDataIdx
]))
{
goto
_exit
;
}
else
{
TSDBROW
row
1
=
tsdbRowFromBlockData
(
writer
->
ctx
->
blockData
,
writer
->
ctx
->
blockDataIdx
);
code
=
tsdbDataFileDoWriteTSRow
(
writer
,
&
row
1
);
TSDBROW
row
=
tsdbRowFromBlockData
(
writer
->
ctx
->
blockData
,
writer
->
ctx
->
blockDataIdx
);
code
=
tsdbDataFileDoWriteTSRow
(
writer
,
&
row
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
...
...
@@ -1054,9 +1055,7 @@ static int32_t tsdbDataFileDoWriteTableOldData(SDataFileWriter *writer, const TS
}
else
{
SBrinRecord
record
[
1
];
tBrinBlockGet
(
writer
->
ctx
->
brinBlock
,
writer
->
ctx
->
brinBlockIdx
,
record
);
if
(
key
->
ts
>
TARRAY2_GET
(
writer
->
ctx
->
brinBlock
->
lastKey
,
writer
->
ctx
->
brinBlockIdx
)
//
||
(
key
->
ts
==
TARRAY2_GET
(
writer
->
ctx
->
brinBlock
->
lastKey
,
writer
->
ctx
->
brinBlockIdx
)
&&
key
->
version
>
TARRAY2_GET
(
writer
->
ctx
->
brinBlock
->
lastKeyVer
,
writer
->
ctx
->
brinBlockIdx
)))
{
if
(
key
->
ts
>
record
->
lastKey
||
(
key
->
ts
==
record
->
lastKey
&&
key
->
version
>
record
->
lastKeyVer
))
{
if
(
writer
->
blockData
->
nRow
>
0
)
{
code
=
tsdbDataFileDoWriteBlockData
(
writer
,
writer
->
blockData
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
@@ -1167,6 +1166,8 @@ static int32_t tsdbDataFileWriteTableDataBegin(SDataFileWriter *writer, const TA
int32_t
code
=
0
;
int32_t
lino
=
0
;
SMetaInfo
info
;
bool
drop
=
false
;
TABLEID
tbid1
[
1
];
ASSERT
(
writer
->
ctx
->
blockDataIdx
==
writer
->
ctx
->
blockData
->
nRow
);
ASSERT
(
writer
->
blockData
->
nRow
==
0
);
...
...
@@ -1174,29 +1175,35 @@ static int32_t tsdbDataFileWriteTableDataBegin(SDataFileWriter *writer, const TA
writer
->
ctx
->
tbHasOldData
=
false
;
while
(
writer
->
ctx
->
brinBlkArray
)
{
// skip data of previous table
for
(;
writer
->
ctx
->
brinBlockIdx
<
BRIN_BLOCK_SIZE
(
writer
->
ctx
->
brinBlock
);
writer
->
ctx
->
brinBlockIdx
++
)
{
// skip removed table
int64_t
uid
=
TARRAY2_GET
(
writer
->
ctx
->
brinBlock
->
uid
,
writer
->
ctx
->
brinBlockIdx
);
if
(
metaGetInfo
(
writer
->
config
->
tsdb
->
pVnode
->
pMeta
,
uid
,
&
info
,
NULL
)
==
TSDB_CODE_NOT_FOUND
)
{
for
(
int32_t
idx
=
writer
->
ctx
->
brinBlockIdx
+
1
;
//
idx
<
BRIN_BLOCK_SIZE
(
writer
->
ctx
->
brinBlock
)
//
&&
uid
==
TARRAY2_GET
(
writer
->
ctx
->
brinBlock
->
uid
,
idx
);
idx
++
,
writer
->
ctx
->
brinBlockIdx
++
)
{
TABLEID
tbid2
[
1
]
=
{{
.
suid
=
TARRAY2_GET
(
writer
->
ctx
->
brinBlock
->
suid
,
writer
->
ctx
->
brinBlockIdx
),
.
uid
=
TARRAY2_GET
(
writer
->
ctx
->
brinBlock
->
uid
,
writer
->
ctx
->
brinBlockIdx
),
}};
if
(
tbid2
->
uid
==
tbid
->
uid
)
{
writer
->
ctx
->
tbHasOldData
=
true
;
goto
_begin
;
}
else
if
(
tbid2
->
suid
>
tbid
->
suid
||
(
tbid2
->
suid
==
tbid
->
suid
&&
tbid2
->
uid
>
tbid
->
uid
))
{
goto
_begin
;
}
else
{
if
(
tbid2
->
uid
!=
writer
->
ctx
->
tbid
->
uid
)
{
if
(
drop
&&
tbid1
->
uid
==
tbid2
->
uid
)
{
continue
;
}
else
if
(
metaGetInfo
(
writer
->
config
->
tsdb
->
pVnode
->
pMeta
,
tbid2
->
uid
,
&
info
,
NULL
)
!=
0
)
{
drop
=
true
;
*
tbid1
=
*
tbid2
;
continue
;
}
else
{
drop
=
false
;
writer
->
ctx
->
tbid
[
0
]
=
*
tbid2
;
}
}
continue
;
}
SBrinRecord
record
[
1
];
tBrinBlockGet
(
writer
->
ctx
->
brinBlock
,
writer
->
ctx
->
brinBlockIdx
,
record
);
SBrinRecord
record
[
1
];
tBrinBlockGet
(
writer
->
ctx
->
brinBlock
,
writer
->
ctx
->
brinBlockIdx
,
record
);
int32_t
c
=
tTABLEIDCmprFn
(
record
,
tbid
);
if
(
c
<
0
)
{
code
=
tsdbDataFileWriteBrinRecord
(
writer
,
record
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
{
if
(
c
==
0
)
{
writer
->
ctx
->
tbHasOldData
=
true
;
}
goto
_begin
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录