Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
46aa6d48
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看板
提交
46aa6d48
编写于
6月 05, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact code
上级
37ae9181
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
72 deletion
+72
-72
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
+4
-4
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
+9
-9
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
+3
-3
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
+52
-52
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
+4
-4
未找到文件。
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
浏览文件 @
46aa6d48
...
...
@@ -25,7 +25,7 @@ extern "C" {
typedef
TARRAY2
(
SSttBlk
)
TSttBlkArray
;
typedef
TARRAY2
(
SStatisBlk
)
TStatisBlkArray
;
typedef
TARRAY2
(
S
DelBlk
)
TDel
BlkArray
;
typedef
TARRAY2
(
S
TombBlk
)
TTomb
BlkArray
;
// SSttFileReader ==========================================
typedef
struct
SSttFileReader
SSttFileReader
;
...
...
@@ -42,11 +42,11 @@ int32_t tsdbSttFileReaderGetSegReader(SSttFileReader *reader, const TSttSegReade
// SSttSegReader
int32_t
tsdbSttFileReadSttBlk
(
SSttSegReader
*
reader
,
const
TSttBlkArray
**
sttBlkArray
);
int32_t
tsdbSttFileReadStatisBlk
(
SSttSegReader
*
reader
,
const
TStatisBlkArray
**
statisBlkArray
);
int32_t
tsdbSttFileRead
DelBlk
(
SSttSegReader
*
reader
,
const
TDel
BlkArray
**
delBlkArray
);
int32_t
tsdbSttFileRead
TombBlk
(
SSttSegReader
*
reader
,
const
TTomb
BlkArray
**
delBlkArray
);
int32_t
tsdbSttFileReadDataBlock
(
SSttSegReader
*
reader
,
const
SSttBlk
*
sttBlk
,
SBlockData
*
bData
);
int32_t
tsdbSttFileReadStatisBlock
(
SSttSegReader
*
reader
,
const
SStatisBlk
*
statisBlk
,
STbStatisBlock
*
sData
);
int32_t
tsdbSttFileReadDelBlock
(
SSttSegReader
*
reader
,
const
S
DelBlk
*
delBlk
,
SDel
Block
*
dData
);
int32_t
tsdbSttFileReadDelBlock
(
SSttSegReader
*
reader
,
const
S
TombBlk
*
delBlk
,
STomb
Block
*
dData
);
struct
SSttFileReaderConfig
{
STsdb
*
tsdb
;
...
...
@@ -63,7 +63,7 @@ int32_t tsdbSttFileWriterOpen(const SSttFileWriterConfig *config, SSttFileWriter
int32_t
tsdbSttFileWriterClose
(
SSttFileWriter
**
writer
,
int8_t
abort
,
TFileOpArray
*
opArray
);
int32_t
tsdbSttFileWriteTSData
(
SSttFileWriter
*
writer
,
SRowInfo
*
row
);
int32_t
tsdbSttFileWriteTSDataBlock
(
SSttFileWriter
*
writer
,
SBlockData
*
pBlockData
);
int32_t
tsdbSttFileWrite
DelRecord
(
SSttFileWriter
*
writer
,
const
SDel
Record
*
record
);
int32_t
tsdbSttFileWrite
TombRecord
(
SSttFileWriter
*
writer
,
const
STomb
Record
*
record
);
struct
SSttFileWriterConfig
{
STsdb
*
tsdb
;
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
浏览文件 @
46aa6d48
...
...
@@ -34,7 +34,7 @@ typedef union {
int64_t
skey
;
int64_t
ekey
;
};
}
S
Del
Record
;
}
S
Tomb
Record
;
typedef
union
{
TARRAY2
(
int64_t
)
dataArr
[
DEL_RECORD_NUM_ELEM
];
...
...
@@ -45,9 +45,9 @@ typedef union {
TARRAY2
(
int64_t
)
skey
[
1
];
TARRAY2
(
int64_t
)
ekey
[
1
];
};
}
S
Del
Block
;
}
S
Tomb
Block
;
typedef
struct
SDelBlk
{
typedef
struct
{
int32_t
numRec
;
int32_t
size
[
DEL_RECORD_NUM_ELEM
];
TABLEID
minTid
;
...
...
@@ -55,14 +55,14 @@ typedef struct SDelBlk {
int64_t
minVer
;
int64_t
maxVer
;
SFDataPtr
dp
[
1
];
}
S
Del
Blk
;
}
S
Tomb
Blk
;
#define
DEL
_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
#define
TOMB
_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
int32_t
t
DelBlockInit
(
SDel
Block
*
delBlock
);
int32_t
t
DelBlockFree
(
SDel
Block
*
delBlock
);
int32_t
t
DelBlockClear
(
SDel
Block
*
delBlock
);
int32_t
t
DelBlockPut
(
SDelBlock
*
delBlock
,
const
SDel
Record
*
delRecord
);
int32_t
t
TombBlockInit
(
STomb
Block
*
delBlock
);
int32_t
t
TombBlockFree
(
STomb
Block
*
delBlock
);
int32_t
t
TombBlockClear
(
STomb
Block
*
delBlock
);
int32_t
t
TombBlockPut
(
STombBlock
*
delBlock
,
const
STomb
Record
*
delRecord
);
// STbStatisBlock ----------
#define STATIS_RECORD_NUM_ELEM 9
...
...
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
浏览文件 @
46aa6d48
...
...
@@ -231,8 +231,8 @@ static int32_t tsdbCommitDelData(SCommitter2 *committer) {
SRBTreeIter
iter
[
1
]
=
{
tRBTreeIterCreate
(
committer
->
tsdb
->
imem
->
tbDataTree
,
1
)};
for
(
SRBTreeNode
*
node
=
tRBTreeIterNext
(
iter
);
node
;
node
=
tRBTreeIterNext
(
iter
))
{
STbData
*
tbData
=
TCONTAINER_OF
(
node
,
STbData
,
rbtn
);
S
Del
Record
record
[
1
]
=
{{
STbData
*
tbData
=
TCONTAINER_OF
(
node
,
STbData
,
rbtn
);
S
Tomb
Record
record
[
1
]
=
{{
.
suid
=
tbData
->
suid
,
.
uid
=
tbData
->
uid
,
}};
...
...
@@ -258,7 +258,7 @@ static int32_t tsdbCommitDelData(SCommitter2 *committer) {
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
code
=
tsdbSttFileWrite
Del
Record
(
committer
->
sttWriter
,
record
);
code
=
tsdbSttFileWrite
Tomb
Record
(
committer
->
sttWriter
,
record
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
浏览文件 @
46aa6d48
...
...
@@ -18,8 +18,8 @@
typedef
struct
{
int64_t
prevFooter
;
SFDataPtr
sttBlkPtr
[
1
];
SFDataPtr
delBlkPtr
[
1
];
SFDataPtr
statisBlkPtr
[
1
];
SFDataPtr
tombBlkPtr
[
1
];
SFDataPtr
rsrvd
[
2
];
}
SSttFooter
;
...
...
@@ -36,12 +36,12 @@ struct SSttSegReader {
SSttFooter
footer
[
1
];
struct
{
bool
sttBlkLoaded
;
bool
delBlkLoaded
;
bool
statisBlkLoaded
;
bool
tombBlkLoaded
;
}
ctx
[
1
];
TSttBlkArray
sttBlkArray
[
1
];
TStatisBlkArray
statisBlkArray
[
1
];
T
DelBlkArray
del
BlkArray
[
1
];
T
TombBlkArray
tomb
BlkArray
[
1
];
};
// SSttFileReader
...
...
@@ -71,7 +71,7 @@ _exit:
static
int32_t
tsdbSttSegReaderClose
(
SSttSegReader
**
reader
)
{
if
(
reader
[
0
])
{
TARRAY2_FREE
(
reader
[
0
]
->
sttBlkArray
);
TARRAY2_FREE
(
reader
[
0
]
->
del
BlkArray
);
TARRAY2_FREE
(
reader
[
0
]
->
tomb
BlkArray
);
TARRAY2_FREE
(
reader
[
0
]
->
statisBlkArray
);
taosMemoryFree
(
reader
[
0
]);
reader
[
0
]
=
NULL
;
...
...
@@ -165,31 +165,31 @@ int32_t tsdbSttFileReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **
return
0
;
}
int32_t
tsdbSttFileRead
DelBlk
(
SSttSegReader
*
reader
,
const
TDelBlkArray
**
del
BlkArray
)
{
if
(
!
reader
->
ctx
->
del
BlkLoaded
)
{
if
(
reader
->
footer
->
del
BlkPtr
->
size
>
0
)
{
ASSERT
(
reader
->
footer
->
delBlkPtr
->
size
%
sizeof
(
SDel
Blk
)
==
0
);
int32_t
tsdbSttFileRead
TombBlk
(
SSttSegReader
*
reader
,
const
TTombBlkArray
**
tomb
BlkArray
)
{
if
(
!
reader
->
ctx
->
tomb
BlkLoaded
)
{
if
(
reader
->
footer
->
tomb
BlkPtr
->
size
>
0
)
{
ASSERT
(
reader
->
footer
->
tombBlkPtr
->
size
%
sizeof
(
STomb
Blk
)
==
0
);
int32_t
size
=
reader
->
footer
->
delBlkPtr
->
size
/
sizeof
(
SDel
Blk
);
void
*
data
=
taosMemoryMalloc
(
reader
->
footer
->
del
BlkPtr
->
size
);
int32_t
size
=
reader
->
footer
->
tombBlkPtr
->
size
/
sizeof
(
STomb
Blk
);
void
*
data
=
taosMemoryMalloc
(
reader
->
footer
->
tomb
BlkPtr
->
size
);
if
(
!
data
)
return
TSDB_CODE_OUT_OF_MEMORY
;
int32_t
code
=
tsdbReadFile
(
reader
->
reader
->
fd
,
reader
->
footer
->
delBlkPtr
->
offset
,
data
,
reader
->
footer
->
del
BlkPtr
->
size
);
tsdbReadFile
(
reader
->
reader
->
fd
,
reader
->
footer
->
tombBlkPtr
->
offset
,
data
,
reader
->
footer
->
tomb
BlkPtr
->
size
);
if
(
code
)
{
taosMemoryFree
(
data
);
return
code
;
}
TARRAY2_INIT_EX
(
reader
->
del
BlkArray
,
size
,
size
,
data
);
TARRAY2_INIT_EX
(
reader
->
tomb
BlkArray
,
size
,
size
,
data
);
}
else
{
TARRAY2_INIT
(
reader
->
del
BlkArray
);
TARRAY2_INIT
(
reader
->
tomb
BlkArray
);
}
reader
->
ctx
->
del
BlkLoaded
=
true
;
reader
->
ctx
->
tomb
BlkLoaded
=
true
;
}
delBlkArray
[
0
]
=
reader
->
del
BlkArray
;
tombBlkArray
[
0
]
=
reader
->
tomb
BlkArray
;
return
0
;
}
...
...
@@ -243,34 +243,34 @@ _exit:
return
code
;
}
int32_t
tsdbSttFileReadDelBlock
(
SSttSegReader
*
reader
,
const
S
DelBlk
*
delBlk
,
SDel
Block
*
dData
)
{
int32_t
tsdbSttFileReadDelBlock
(
SSttSegReader
*
reader
,
const
S
TombBlk
*
tombBlk
,
STomb
Block
*
dData
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
t
Del
BlockClear
(
dData
);
t
Tomb
BlockClear
(
dData
);
code
=
tRealloc
(
&
reader
->
reader
->
config
->
bufArr
[
0
],
del
Blk
->
dp
->
size
);
code
=
tRealloc
(
&
reader
->
reader
->
config
->
bufArr
[
0
],
tomb
Blk
->
dp
->
size
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbReadFile
(
reader
->
reader
->
fd
,
delBlk
->
dp
->
offset
,
reader
->
reader
->
config
->
bufArr
[
0
],
del
Blk
->
dp
->
size
);
code
=
tsdbReadFile
(
reader
->
reader
->
fd
,
tombBlk
->
dp
->
offset
,
reader
->
reader
->
config
->
bufArr
[
0
],
tomb
Blk
->
dp
->
size
);
if
(
code
)
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
int64_t
size
=
0
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
dData
->
dataArr
);
++
i
)
{
code
=
tsdbDecmprData
(
reader
->
reader
->
config
->
bufArr
[
0
]
+
size
,
del
Blk
->
size
[
i
],
TSDB_DATA_TYPE_BIGINT
,
TWO_STAGE_COMP
,
&
reader
->
reader
->
config
->
bufArr
[
1
],
sizeof
(
int64_t
)
*
del
Blk
->
numRec
,
code
=
tsdbDecmprData
(
reader
->
reader
->
config
->
bufArr
[
0
]
+
size
,
tomb
Blk
->
size
[
i
],
TSDB_DATA_TYPE_BIGINT
,
TWO_STAGE_COMP
,
&
reader
->
reader
->
config
->
bufArr
[
1
],
sizeof
(
int64_t
)
*
tomb
Blk
->
numRec
,
&
reader
->
reader
->
config
->
bufArr
[
2
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
for
(
int32_t
j
=
0
;
j
<
del
Blk
->
numRec
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
tomb
Blk
->
numRec
;
++
j
)
{
code
=
TARRAY2_APPEND
(
&
dData
->
dataArr
[
i
],
((
int64_t
*
)(
reader
->
reader
->
config
->
bufArr
[
1
]))[
j
]);
continue
;
}
size
+=
del
Blk
->
size
[
i
];
size
+=
tomb
Blk
->
size
[
i
];
}
ASSERT
(
size
==
del
Blk
->
dp
->
size
);
ASSERT
(
size
==
tomb
Blk
->
dp
->
size
);
_exit:
if
(
code
)
{
TSDB_ERROR_LOG
(
TD_VID
(
reader
->
reader
->
config
->
tsdb
->
pVnode
),
lino
,
code
);
...
...
@@ -327,11 +327,11 @@ struct SSttFileWriter {
// data
TSttBlkArray
sttBlkArray
[
1
];
TStatisBlkArray
statisBlkArray
[
1
];
T
DelBlkArray
del
BlkArray
[
1
];
T
TombBlkArray
tomb
BlkArray
[
1
];
SSttFooter
footer
[
1
];
SBlockData
bData
[
1
];
STbStatisBlock
sData
[
1
];
S
DelBlock
dData
[
1
];
S
TombBlock
dData
[
1
];
// helper data
SSkmInfo
skmTb
[
1
];
SSkmInfo
skmRow
[
1
];
...
...
@@ -444,14 +444,14 @@ _exit:
return
code
;
}
static
int32_t
tsdbSttFileDoWrite
Del
Block
(
SSttFileWriter
*
writer
)
{
if
(
DEL
_BLOCK_SIZE
(
writer
->
dData
)
==
0
)
return
0
;
static
int32_t
tsdbSttFileDoWrite
Tomb
Block
(
SSttFileWriter
*
writer
)
{
if
(
TOMB
_BLOCK_SIZE
(
writer
->
dData
)
==
0
)
return
0
;
int32_t
code
=
0
;
int32_t
lino
=
0
;
S
DelBlk
del
Blk
[
1
]
=
{{
.
numRec
=
DEL
_BLOCK_SIZE
(
writer
->
dData
),
S
TombBlk
tomb
Blk
[
1
]
=
{{
.
numRec
=
TOMB
_BLOCK_SIZE
(
writer
->
dData
),
.
minTid
=
{
.
suid
=
TARRAY2_FIRST
(
writer
->
dData
->
suid
),
...
...
@@ -471,9 +471,9 @@ static int32_t tsdbSttFileDoWriteDelBlock(SSttFileWriter *writer) {
},
}};
for
(
int32_t
i
=
1
;
i
<
DEL
_BLOCK_SIZE
(
writer
->
dData
);
i
++
)
{
delBlk
->
minVer
=
TMIN
(
del
Blk
->
minVer
,
TARRAY2_GET
(
writer
->
dData
->
version
,
i
));
delBlk
->
maxVer
=
TMAX
(
del
Blk
->
maxVer
,
TARRAY2_GET
(
writer
->
dData
->
version
,
i
));
for
(
int32_t
i
=
1
;
i
<
TOMB
_BLOCK_SIZE
(
writer
->
dData
);
i
++
)
{
tombBlk
->
minVer
=
TMIN
(
tomb
Blk
->
minVer
,
TARRAY2_GET
(
writer
->
dData
->
version
,
i
));
tombBlk
->
maxVer
=
TMAX
(
tomb
Blk
->
maxVer
,
TARRAY2_GET
(
writer
->
dData
->
version
,
i
));
}
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
writer
->
dData
->
dataArr
);
i
++
)
{
...
...
@@ -486,15 +486,15 @@ static int32_t tsdbSttFileDoWriteDelBlock(SSttFileWriter *writer) {
code
=
tsdbWriteFile
(
writer
->
fd
,
writer
->
file
->
size
,
writer
->
config
->
aBuf
[
0
],
size
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
del
Blk
->
size
[
i
]
=
size
;
del
Blk
->
dp
[
0
].
size
+=
size
;
tomb
Blk
->
size
[
i
]
=
size
;
tomb
Blk
->
dp
[
0
].
size
+=
size
;
writer
->
file
->
size
+=
size
;
}
code
=
TARRAY2_APPEND_PTR
(
writer
->
delBlkArray
,
del
Blk
);
code
=
TARRAY2_APPEND_PTR
(
writer
->
tombBlkArray
,
tomb
Blk
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
t
Del
BlockClear
(
writer
->
dData
);
t
Tomb
BlockClear
(
writer
->
dData
);
_exit:
if
(
code
)
{
...
...
@@ -545,18 +545,18 @@ _exit:
return
code
;
}
static
int32_t
tsdbSttFileDoWrite
Del
Blk
(
SSttFileWriter
*
writer
)
{
static
int32_t
tsdbSttFileDoWrite
Tomb
Blk
(
SSttFileWriter
*
writer
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
writer
->
footer
->
del
BlkPtr
->
offset
=
writer
->
file
->
size
;
writer
->
footer
->
delBlkPtr
->
size
=
TARRAY2_DATA_LEN
(
writer
->
del
BlkArray
);
writer
->
footer
->
tomb
BlkPtr
->
offset
=
writer
->
file
->
size
;
writer
->
footer
->
tombBlkPtr
->
size
=
TARRAY2_DATA_LEN
(
writer
->
tomb
BlkArray
);
if
(
writer
->
footer
->
del
BlkPtr
->
size
)
{
code
=
tsdbWriteFile
(
writer
->
fd
,
writer
->
file
->
size
,
(
const
uint8_t
*
)
TARRAY2_DATA
(
writer
->
del
BlkArray
),
writer
->
footer
->
del
BlkPtr
->
size
);
if
(
writer
->
footer
->
tomb
BlkPtr
->
size
)
{
code
=
tsdbWriteFile
(
writer
->
fd
,
writer
->
file
->
size
,
(
const
uint8_t
*
)
TARRAY2_DATA
(
writer
->
tomb
BlkArray
),
writer
->
footer
->
tomb
BlkPtr
->
size
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
writer
->
file
->
size
+=
writer
->
footer
->
del
BlkPtr
->
size
;
writer
->
file
->
size
+=
writer
->
footer
->
tomb
BlkPtr
->
size
;
}
_exit:
...
...
@@ -624,9 +624,9 @@ static void tsdbSttFWriterDoClose(SSttFileWriter *writer) {
tDestroyTSchema
(
writer
->
skmRow
->
pTSchema
);
tDestroyTSchema
(
writer
->
skmTb
->
pTSchema
);
tStatisBlockFree
(
writer
->
sData
);
t
Del
BlockFree
(
writer
->
dData
);
t
Tomb
BlockFree
(
writer
->
dData
);
tBlockDataDestroy
(
writer
->
bData
);
TARRAY2_FREE
(
writer
->
del
BlkArray
);
TARRAY2_FREE
(
writer
->
tomb
BlkArray
);
TARRAY2_FREE
(
writer
->
statisBlkArray
);
TARRAY2_FREE
(
writer
->
sttBlkArray
);
}
...
...
@@ -646,7 +646,7 @@ static int32_t tsdbSttFWriterCloseCommit(SSttFileWriter *writer, TFileOpArray *o
code
=
tsdbSttFileDoWriteStatisBlock
(
writer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbSttFileDoWrite
Del
Block
(
writer
);
code
=
tsdbSttFileDoWrite
Tomb
Block
(
writer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbSttFileDoWriteSttBlk
(
writer
);
...
...
@@ -655,7 +655,7 @@ static int32_t tsdbSttFWriterCloseCommit(SSttFileWriter *writer, TFileOpArray *o
code
=
tsdbSttFileDoWriteStatisBlk
(
writer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbSttFileDoWrite
Del
Blk
(
writer
);
code
=
tsdbSttFileDoWrite
Tomb
Blk
(
writer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbSttFileDoWriteFooter
(
writer
);
...
...
@@ -851,7 +851,7 @@ _exit:
return
code
;
}
int32_t
tsdbSttFileWrite
DelRecord
(
SSttFileWriter
*
writer
,
const
SDel
Record
*
record
)
{
int32_t
tsdbSttFileWrite
TombRecord
(
SSttFileWriter
*
writer
,
const
STomb
Record
*
record
)
{
int32_t
code
;
int32_t
lino
;
...
...
@@ -872,12 +872,12 @@ int32_t tsdbSttFileWriteDelRecord(SSttFileWriter *writer, const SDelRecord *reco
}
// write SDelRecord
code
=
t
Del
BlockPut
(
writer
->
dData
,
record
);
code
=
t
Tomb
BlockPut
(
writer
->
dData
,
record
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// write SDelBlock if need
if
(
DEL
_BLOCK_SIZE
(
writer
->
dData
)
>=
writer
->
config
->
maxRow
)
{
code
=
tsdbSttFileDoWrite
Del
Block
(
writer
);
if
(
TOMB
_BLOCK_SIZE
(
writer
->
dData
)
>=
writer
->
config
->
maxRow
)
{
code
=
tsdbSttFileDoWrite
Tomb
Block
(
writer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
浏览文件 @
46aa6d48
...
...
@@ -16,28 +16,28 @@
#include "dev.h"
// SDelBlock ----------
int32_t
t
DelBlockInit
(
SDel
Block
*
delBlock
)
{
int32_t
t
TombBlockInit
(
STomb
Block
*
delBlock
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
);
++
i
)
{
TARRAY2_INIT
(
&
delBlock
->
dataArr
[
i
]);
}
return
0
;
}
int32_t
t
DelBlockFree
(
SDel
Block
*
delBlock
)
{
int32_t
t
TombBlockFree
(
STomb
Block
*
delBlock
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
);
++
i
)
{
TARRAY2_FREE
(
&
delBlock
->
dataArr
[
i
]);
}
return
0
;
}
int32_t
t
DelBlockClear
(
SDel
Block
*
delBlock
)
{
int32_t
t
TombBlockClear
(
STomb
Block
*
delBlock
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
);
++
i
)
{
TARRAY2_CLEAR
(
&
delBlock
->
dataArr
[
i
],
NULL
);
}
return
0
;
}
int32_t
t
DelBlockPut
(
SDelBlock
*
delBlock
,
const
SDel
Record
*
delRecord
)
{
int32_t
t
TombBlockPut
(
STombBlock
*
delBlock
,
const
STomb
Record
*
delRecord
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
);
++
i
)
{
int32_t
code
=
TARRAY2_APPEND
(
&
delBlock
->
dataArr
[
i
],
delRecord
->
aData
[
i
]);
if
(
code
)
return
code
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录