Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5e579398
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看板
提交
5e579398
编写于
1月 03, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
0d7f9ac5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
50 addition
and
16 deletion
+50
-16
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+2
-4
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-0
source/dnode/vnode/src/tsdb/tsdbCompact.c
source/dnode/vnode/src/tsdb/tsdbCompact.c
+33
-6
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+14
-6
未找到文件。
source/common/src/tdataformat.c
浏览文件 @
5e579398
...
...
@@ -857,12 +857,10 @@ static int32_t tRowNoneUpsertColData(SColData *aColData, int32_t nColData, int32
if
(
flag
)
return
code
;
for
(
int32_t
iColData
=
0
;
iColData
<
nColData
;
iColData
++
)
{
SColData
*
pColData
=
&
aColData
[
iColData
];
code
=
tColDataAppendValueImpl
[
pColData
->
flag
][
CV_FLAG_NONE
](
pColData
,
NULL
,
0
);
if
(
code
)
goto
_exit
;
code
=
tColDataAppendValueImpl
[
aColData
[
iColData
].
flag
][
CV_FLAG_NONE
](
&
aColData
[
iColData
],
NULL
,
0
);
if
(
code
)
return
code
;
}
_exit:
return
code
;
}
static
int32_t
tRowNullUpsertColData
(
SColData
*
aColData
,
int32_t
nColData
,
STSchema
*
pSchema
,
int32_t
flag
)
{
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
5e579398
...
...
@@ -163,6 +163,7 @@ void tBlockDataDestroy(SBlockData *pBlockData);
int32_t
tBlockDataInit
(
SBlockData
*
pBlockData
,
TABLEID
*
pId
,
STSchema
*
pTSchema
,
int16_t
*
aCid
,
int32_t
nCid
);
void
tBlockDataReset
(
SBlockData
*
pBlockData
);
int32_t
tBlockDataAppendRow
(
SBlockData
*
pBlockData
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
,
int64_t
uid
);
int32_t
tBlockDataTryUpsertRow
(
SBlockData
*
pBlockData
,
TSDBROW
*
pRow
,
int64_t
uid
);
int32_t
tBlockDataUpsertRow
(
SBlockData
*
pBlockData
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
,
int64_t
uid
);
void
tBlockDataClear
(
SBlockData
*
pBlockData
);
void
tBlockDataGetColData
(
SBlockData
*
pBlockData
,
int16_t
cid
,
SColData
**
ppColData
);
...
...
source/dnode/vnode/src/tsdb/tsdbCompact.c
浏览文件 @
5e579398
...
...
@@ -852,13 +852,13 @@ static int32_t tsdbCompactFileSet(STsdbCompactor *pCompactor) {
if
(
pRowInfo
&&
(
code
=
tBlockDataInit
(
&
pCompactor
->
bData
,
(
TABLEID
*
)
pRowInfo
,
pTSchema
,
NULL
,
0
)))
{
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pCompactor
->
tableId
.
suid
=
pRowInfo
->
suid
;
pCompactor
->
tableId
.
uid
=
pRowInfo
->
uid
;
}
while
(
pRowInfo
)
{
// write block data according to table id if necessary (TODO)
if
((
pCompactor
->
tableId
.
suid
!=
pRowInfo
->
suid
)
||
(
pCompactor
->
tableId
.
uid
!=
pRowInfo
->
uid
&&
(
pRowInfo
->
suid
==
0
||
(
pCompactor
->
bData
.
uid
&&
pCompactor
->
bData
.
nRow
>=
pCompactor
->
minRows
))))
{
// if suid changed
if
(
pCompactor
->
tableId
.
suid
!=
pRowInfo
->
suid
)
{
code
=
tsdbCompactWriteBlockData
(
pCompactor
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
...
...
@@ -867,10 +867,37 @@ static int32_t tsdbCompactFileSet(STsdbCompactor *pCompactor) {
code
=
tBlockDataInit
(
&
pCompactor
->
bData
,
(
TABLEID
*
)
pRowInfo
,
pTSchema
,
NULL
,
0
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pCompactor
->
tableId
.
suid
=
pRowInfo
->
suid
;
pCompactor
->
tableId
.
uid
=
pRowInfo
->
uid
;
}
// if uid changed
if
(
pCompactor
->
tableId
.
uid
!=
pRowInfo
->
uid
)
{
// if need to write the block data
bool
init
=
false
;
if
(
pCompactor
->
bData
.
suid
==
0
)
{
code
=
tsdbCompactWriteBlockData
(
pCompactor
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
init
=
true
;
}
else
if
(
pCompactor
->
bData
.
uid
&&
pCompactor
->
bData
.
nRow
>=
pCompactor
->
minRows
)
{
code
=
tsdbCompactWriteBlockData
(
pCompactor
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
// write SDataBlk
code
=
tsdbCompactWriteDataBlk
(
pCompactor
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// init block data if need
if
(
init
&&
(
code
=
tBlockDataInit
(
&
pCompactor
->
bData
,
(
TABLEID
*
)
pRowInfo
,
pTSchema
,
NULL
,
0
)))
{
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pCompactor
->
tableId
.
suid
=
pRowInfo
->
suid
;
pCompactor
->
tableId
.
uid
=
pRowInfo
->
uid
;
}
}
//
check if append/merge the row causes nRow exceed maxRows (TODO)
if
(
0
/* add the row causes row exceed maxRows */
)
{
//
if append/merge the row causes nRow exceed maxRows
if
(
tBlockDataTryUpsertRow
(
&
pCompactor
->
bData
,
&
pRowInfo
->
row
,
pRowInfo
->
uid
)
>
pCompactor
->
maxRows
)
{
code
=
tsdbCompactWriteBlockData
(
pCompactor
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
5e579398
...
...
@@ -1051,12 +1051,7 @@ static int32_t tBlockDataUpsertBlockRow(SBlockData *pBlockData, SBlockData *pBlo
if
(
pColDataFrom
==
NULL
||
pColDataFrom
->
cid
>
pColDataTo
->
cid
)
{
cv
=
COL_VAL_NONE
(
pColDataTo
->
cid
,
pColDataTo
->
type
);
if
(
flag
)
{
code
=
tColDataUpdateValue
(
pColDataTo
,
&
cv
,
flag
>
0
);
}
else
{
code
=
tColDataAppendValue
(
pColDataTo
,
&
cv
);
}
if
(
code
)
goto
_exit
;
if
(
flag
==
0
&&
(
code
=
tColDataAppendValue
(
pColDataTo
,
&
cv
)))
goto
_exit
;
}
else
{
tColDataGetValue
(
pColDataFrom
,
iRow
,
&
cv
);
...
...
@@ -1137,6 +1132,19 @@ _exit:
return
code
;
}
int32_t
tBlockDataTryUpsertRow
(
SBlockData
*
pBlockData
,
TSDBROW
*
pRow
,
int64_t
uid
)
{
if
(
pBlockData
->
nRow
==
0
)
{
return
1
;
}
int64_t
luid
=
pBlockData
->
uid
?
pBlockData
->
uid
:
pBlockData
->
aUid
[
pBlockData
->
nRow
-
1
];
if
(
luid
==
uid
&&
pBlockData
->
aTSKEY
[
pBlockData
->
nRow
-
1
]
==
TSDBROW_TS
(
pRow
))
{
return
pBlockData
->
nRow
;
}
else
{
return
pBlockData
->
nRow
+
1
;
}
}
int32_t
tBlockDataUpsertRow
(
SBlockData
*
pBlockData
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
,
int64_t
uid
)
{
int32_t
code
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录