Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e4840cb5
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
e4840cb5
编写于
6月 12, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
bd01d08b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
39 deletion
+39
-39
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
+2
-2
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
+37
-37
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
浏览文件 @
e4840cb5
...
...
@@ -695,7 +695,7 @@ static int32_t tsdbDataFileWriteBrinBlock(SDataFileWriter *writer) {
brinBlk
->
size
[
i
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
brinBlk
->
dp
[
i
].
size
+=
brinBlk
->
size
[
i
];
brinBlk
->
dp
->
size
+=
brinBlk
->
size
[
i
];
writer
->
files
[
TSDB_FTYPE_HEAD
].
size
+=
brinBlk
->
size
[
i
];
}
...
...
@@ -710,7 +710,7 @@ static int32_t tsdbDataFileWriteBrinBlock(SDataFileWriter *writer) {
brinBlk
->
size
[
j
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
brinBlk
->
dp
[
i
].
size
+=
brinBlk
->
size
[
j
];
brinBlk
->
dp
->
size
+=
brinBlk
->
size
[
j
];
writer
->
files
[
TSDB_FTYPE_HEAD
].
size
+=
brinBlk
->
size
[
j
];
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
浏览文件 @
e4840cb5
...
...
@@ -39,8 +39,8 @@ typedef struct {
SSttLvl
*
lvl
;
STFileObj
*
fobj
;
TABLEID
tbid
[
1
];
int32_t
bDataIdx
;
SBlockData
bData
[
2
];
int32_t
b
lock
DataIdx
;
SBlockData
b
lock
Data
[
2
];
}
ctx
[
1
];
TFileOpArray
fopArr
[
1
];
...
...
@@ -96,8 +96,8 @@ static int32_t tsdbMergerClose(SMerger *merger) {
TARRAY2_DESTROY
(
merger
->
dataIterArr
,
NULL
);
TARRAY2_DESTROY
(
merger
->
sttReaderArr
,
NULL
);
TARRAY2_DESTROY
(
merger
->
fopArr
,
NULL
);
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
bData
);
i
++
)
{
tBlockDataDestroy
(
merger
->
ctx
->
bData
+
i
);
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
b
lock
Data
);
i
++
)
{
tBlockDataDestroy
(
merger
->
ctx
->
b
lock
Data
+
i
);
}
tDestroyTSchema
(
merger
->
skmTb
->
pTSchema
);
tDestroyTSchema
(
merger
->
skmRow
->
pTSchema
);
...
...
@@ -110,21 +110,21 @@ _exit:
}
static
int32_t
tsdbMergeToDataTableEnd
(
SMerger
*
merger
)
{
if
(
merger
->
ctx
->
b
Data
[
0
].
nRow
+
merger
->
ctx
->
b
Data
[
1
].
nRow
==
0
)
return
0
;
if
(
merger
->
ctx
->
b
lockData
[
0
].
nRow
+
merger
->
ctx
->
block
Data
[
1
].
nRow
==
0
)
return
0
;
int32_t
code
=
0
;
int32_t
lino
=
0
;
int32_t
cidx
=
merger
->
ctx
->
bDataIdx
;
int32_t
cidx
=
merger
->
ctx
->
b
lock
DataIdx
;
int32_t
pidx
=
(
cidx
+
1
)
%
2
;
int32_t
numRow
=
(
merger
->
ctx
->
b
Data
[
pidx
].
nRow
+
merger
->
ctx
->
b
Data
[
cidx
].
nRow
)
/
2
;
int32_t
numRow
=
(
merger
->
ctx
->
b
lockData
[
pidx
].
nRow
+
merger
->
ctx
->
block
Data
[
cidx
].
nRow
)
/
2
;
if
(
merger
->
ctx
->
bData
[
pidx
].
nRow
>
0
&&
numRow
>=
merger
->
minRow
)
{
ASSERT
(
merger
->
ctx
->
bData
[
pidx
].
nRow
==
merger
->
maxRow
);
if
(
merger
->
ctx
->
b
lock
Data
[
pidx
].
nRow
>
0
&&
numRow
>=
merger
->
minRow
)
{
ASSERT
(
merger
->
ctx
->
b
lock
Data
[
pidx
].
nRow
==
merger
->
maxRow
);
SRowInfo
row
[
1
]
=
{{
.
suid
=
merger
->
ctx
->
tbid
->
suid
,
.
uid
=
merger
->
ctx
->
tbid
->
uid
,
.
row
=
tsdbRowFromBlockData
(
merger
->
ctx
->
bData
+
pidx
,
0
),
.
row
=
tsdbRowFromBlockData
(
merger
->
ctx
->
b
lock
Data
+
pidx
,
0
),
}};
for
(
int32_t
i
=
0
;
i
<
numRow
;
i
++
)
{
...
...
@@ -137,34 +137,34 @@ static int32_t tsdbMergeToDataTableEnd(SMerger *merger) {
code
=
tsdbDataFileFlush
(
merger
->
dataWriter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
for
(
int32_t
i
=
numRow
;
i
<
merger
->
ctx
->
bData
[
pidx
].
nRow
;
i
++
)
{
for
(
int32_t
i
=
numRow
;
i
<
merger
->
ctx
->
b
lock
Data
[
pidx
].
nRow
;
i
++
)
{
row
->
row
.
iRow
=
i
;
code
=
tsdbDataFileWriteRow
(
merger
->
dataWriter
,
row
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
row
->
row
=
tsdbRowFromBlockData
(
merger
->
ctx
->
bData
+
cidx
,
0
);
for
(
int32_t
i
=
0
;
i
<
merger
->
ctx
->
bData
[
cidx
].
nRow
;
i
++
)
{
row
->
row
=
tsdbRowFromBlockData
(
merger
->
ctx
->
b
lock
Data
+
cidx
,
0
);
for
(
int32_t
i
=
0
;
i
<
merger
->
ctx
->
b
lock
Data
[
cidx
].
nRow
;
i
++
)
{
row
->
row
.
iRow
=
i
;
code
=
tsdbDataFileWriteRow
(
merger
->
dataWriter
,
row
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
else
{
if
(
merger
->
ctx
->
bData
[
pidx
].
nRow
>
0
)
{
code
=
tsdbDataFileWriteBlockData
(
merger
->
dataWriter
,
merger
->
ctx
->
bData
+
cidx
);
if
(
merger
->
ctx
->
b
lock
Data
[
pidx
].
nRow
>
0
)
{
code
=
tsdbDataFileWriteBlockData
(
merger
->
dataWriter
,
merger
->
ctx
->
b
lock
Data
+
cidx
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
merger
->
ctx
->
bData
[
cidx
].
nRow
<
merger
->
minRow
)
{
code
=
tsdbSttFileWriteBlockData
(
merger
->
sttWriter
,
merger
->
ctx
->
bData
+
cidx
);
if
(
merger
->
ctx
->
b
lock
Data
[
cidx
].
nRow
<
merger
->
minRow
)
{
code
=
tsdbSttFileWriteBlockData
(
merger
->
sttWriter
,
merger
->
ctx
->
b
lock
Data
+
cidx
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
{
code
=
tsdbDataFileWriteBlockData
(
merger
->
dataWriter
,
merger
->
ctx
->
bData
+
cidx
);
code
=
tsdbDataFileWriteBlockData
(
merger
->
dataWriter
,
merger
->
ctx
->
b
lock
Data
+
cidx
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
bData
);
i
++
)
{
tBlockDataReset
(
merger
->
ctx
->
bData
+
i
);
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
b
lock
Data
);
i
++
)
{
tBlockDataReset
(
merger
->
ctx
->
b
lock
Data
+
i
);
}
_exit:
...
...
@@ -181,9 +181,9 @@ static int32_t tsdbMergeToDataTableBegin(SMerger *merger) {
code
=
tsdbUpdateSkmTb
(
merger
->
tsdb
,
merger
->
ctx
->
tbid
,
merger
->
skmTb
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
merger
->
ctx
->
bDataIdx
=
0
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
bData
);
i
++
)
{
code
=
tBlockDataInit
(
merger
->
ctx
->
bData
+
i
,
merger
->
ctx
->
tbid
,
merger
->
skmTb
->
pTSchema
,
NULL
,
0
);
merger
->
ctx
->
b
lock
DataIdx
=
0
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
b
lock
Data
);
i
++
)
{
code
=
tBlockDataInit
(
merger
->
ctx
->
b
lock
Data
+
i
,
merger
->
ctx
->
tbid
,
merger
->
skmTb
->
pTSchema
,
NULL
,
0
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
@@ -213,27 +213,27 @@ static int32_t tsdbMergeToDataLevel(SMerger *merger) {
TSDBKEY
key
[
1
]
=
{
TSDBROW_KEY
(
&
row
->
row
)};
if
(
key
->
version
<=
merger
->
compactVersion
//
&&
merger
->
ctx
->
b
Data
[
merger
->
ctx
->
b
DataIdx
].
nRow
>
0
//
&&
merger
->
ctx
->
b
Data
[
merger
->
ctx
->
bDataIdx
].
aTSKEY
[
merger
->
ctx
->
bData
[
merger
->
ctx
->
bDataIdx
].
nRow
-
1
]
==
key
->
ts
)
{
if
(
key
->
version
<=
merger
->
compactVersion
//
&&
merger
->
ctx
->
b
lockData
[
merger
->
ctx
->
block
DataIdx
].
nRow
>
0
//
&&
merger
->
ctx
->
b
lockData
[
merger
->
ctx
->
blockDataIdx
]
.
aTSKEY
[
merger
->
ctx
->
blockData
[
merger
->
ctx
->
blockDataIdx
].
nRow
-
1
]
==
key
->
ts
)
{
// update
code
=
tBlockDataUpdateRow
(
merger
->
ctx
->
b
Data
+
merger
->
ctx
->
b
DataIdx
,
&
row
->
row
,
NULL
);
code
=
tBlockDataUpdateRow
(
merger
->
ctx
->
b
lockData
+
merger
->
ctx
->
block
DataIdx
,
&
row
->
row
,
NULL
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
else
{
if
(
merger
->
ctx
->
b
Data
[
merger
->
ctx
->
b
DataIdx
].
nRow
>=
merger
->
maxRow
)
{
int32_t
idx
=
(
merger
->
ctx
->
bDataIdx
+
1
)
%
2
;
if
(
merger
->
ctx
->
b
lockData
[
merger
->
ctx
->
block
DataIdx
].
nRow
>=
merger
->
maxRow
)
{
int32_t
idx
=
(
merger
->
ctx
->
b
lock
DataIdx
+
1
)
%
2
;
code
=
tsdbDataFileWriteBlockData
(
merger
->
dataWriter
,
merger
->
ctx
->
bData
+
idx
);
code
=
tsdbDataFileWriteBlockData
(
merger
->
dataWriter
,
merger
->
ctx
->
b
lock
Data
+
idx
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
tBlockDataClear
(
merger
->
ctx
->
bData
+
idx
);
tBlockDataClear
(
merger
->
ctx
->
b
lock
Data
+
idx
);
// switch to next bData
merger
->
ctx
->
bDataIdx
=
idx
;
merger
->
ctx
->
b
lock
DataIdx
=
idx
;
}
code
=
tBlockDataAppendRow
(
merger
->
ctx
->
b
Data
+
merger
->
ctx
->
b
DataIdx
,
&
row
->
row
,
NULL
,
row
->
uid
);
code
=
tBlockDataAppendRow
(
merger
->
ctx
->
b
lockData
+
merger
->
ctx
->
block
DataIdx
,
&
row
->
row
,
NULL
,
row
->
uid
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
@@ -510,9 +510,9 @@ static int32_t tsdbMergeFileSetBegin(SMerger *merger) {
merger
->
ctx
->
tbid
->
suid
=
0
;
merger
->
ctx
->
tbid
->
uid
=
0
;
merger
->
ctx
->
bDataIdx
=
0
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
bData
);
++
i
)
{
tBlockDataReset
(
merger
->
ctx
->
bData
+
i
);
merger
->
ctx
->
b
lock
DataIdx
=
0
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
b
lock
Data
);
++
i
)
{
tBlockDataReset
(
merger
->
ctx
->
b
lock
Data
+
i
);
}
// open reader
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录