Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5bcc9c54
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,发现更多精彩内容 >>
提交
5bcc9c54
编写于
5月 27, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
6668da43
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
53 addition
and
69 deletion
+53
-69
source/dnode/vnode/src/tsdb/dev/dev.h
source/dnode/vnode/src/tsdb/dev/dev.h
+2
-2
source/dnode/vnode/src/tsdb/dev/inc/tsdbCommit.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbCommit.h
+1
-1
source/dnode/vnode/src/tsdb/dev/inc/tsdbDataFileRW.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbDataFileRW.h
+3
-3
source/dnode/vnode/src/tsdb/dev/inc/tsdbMerge.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbMerge.h
+2
-2
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttFileRW.h
+5
-7
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
+1
-1
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
+39
-53
未找到文件。
source/dnode/vnode/src/tsdb/dev/dev.h
浏览文件 @
5bcc9c54
...
...
@@ -30,9 +30,9 @@ extern "C" {
#include "inc/tsdbFS.h"
#include "inc/tsdbSttF
ReaderWriter
.h"
#include "inc/tsdbSttF
ileRW
.h"
#include "inc/tsdbDataF
ReaderWriter
.h"
#include "inc/tsdbDataF
ileRW
.h"
#ifdef __cplusplus
}
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbCommit.h
浏览文件 @
5bcc9c54
...
...
@@ -14,7 +14,7 @@
*/
#include "tsdbFS.h"
#include "tsdbSttF
ReaderWriter
.h"
#include "tsdbSttF
ileRW
.h"
#ifndef _TSDB_COMMIT_H_
#define _TSDB_COMMIT_H_
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbDataF
ReaderWriter
.h
→
source/dnode/vnode/src/tsdb/dev/inc/tsdbDataF
ileRW
.h
浏览文件 @
5bcc9c54
...
...
@@ -15,8 +15,8 @@
#include "tsdbDef.h"
#ifndef _T
D_TSDB_DATA_F_READER_WRITER_H_
#define _T
D_TSDB_DATA_F_READER_WRITER_H_
#ifndef _T
SDB_DATA_FILE_RW_H
#define _T
SDB_DATA_FILE_RW_H
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -49,4 +49,4 @@ struct SDataFileWriterConfig {
}
#endif
#endif
/*_TD_TSDB_DATA_F_READER_WRITER_H_*/
\ No newline at end of file
#endif
/*_TSDB_DATA_FILE_RW_H*/
\ No newline at end of file
source/dnode/vnode/src/tsdb/dev/inc/tsdbMerge.h
浏览文件 @
5bcc9c54
...
...
@@ -13,9 +13,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tsdbDataF
ReaderWriter
.h"
#include "tsdbDataF
ileRW
.h"
#include "tsdbFS.h"
#include "tsdbSttF
ReaderWriter
.h"
#include "tsdbSttF
ileRW
.h"
#include "tsdbUtil.h"
#ifndef _TD_TSDB_MERGE_H_
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttF
ReaderWriter
.h
→
source/dnode/vnode/src/tsdb/dev/inc/tsdbSttF
ileRW
.h
浏览文件 @
5bcc9c54
...
...
@@ -16,8 +16,8 @@
#include "tsdbFS.h"
#include "tsdbUtil.h"
#ifndef _TSDB_STT_FILE_
WRITER
_H
#define _TSDB_STT_FILE_
WRITER
_H
#ifndef _TSDB_STT_FILE_
RW
_H
#define _TSDB_STT_FILE_
RW
_H
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -36,11 +36,9 @@ typedef TARRAY2(SSttSegReader *) TSttSegReaderArray;
// SSttFileReader
int32_t
tsdbSttFReaderOpen
(
const
SSttFileReaderConfig
*
config
,
SSttFileReader
**
reader
);
int32_t
tsdbSttFReaderClose
(
SSttFileReader
**
reader
);
int32_t
tsdbSttFReaderGetSegReader
(
SSttFileReader
*
reader
,
const
TSttSegReaderArray
**
segR
eaderArray
);
int32_t
tsdbSttFReaderGetSegReader
(
SSttFileReader
*
reader
,
const
TSttSegReaderArray
**
r
eaderArray
);
// SSttSegReader
int32_t
tsdbSttFReadBloomFilter
(
SSttSegReader
*
reader
,
const
void
*
pFilter
);
int32_t
tsdbSttFReadSttBlk
(
SSttSegReader
*
reader
,
const
TSttBlkArray
**
sttBlkArray
);
int32_t
tsdbSttFReadDelBlk
(
SSttSegReader
*
reader
,
const
TDelBlkArray
**
delBlkArray
);
int32_t
tsdbSttFReadStatisBlk
(
SSttSegReader
*
reader
,
const
TStatisBlkArray
**
statisBlkArray
);
...
...
@@ -55,7 +53,7 @@ struct SSttFileReaderConfig {
SSkmInfo
*
skmRow
;
uint8_t
**
aBuf
;
int32_t
szPage
;
STFile
file
;
STFile
file
[
1
]
;
};
// SSttFileWriter ==========================================
...
...
@@ -84,4 +82,4 @@ struct SSttFileWriterConfig {
}
#endif
#endif
/*_TSDB_STT_FILE_WRITER_H*/
\ No newline at end of file
#endif
/*_TSDB_STT_FILE_RW_H*/
\ No newline at end of file
source/dnode/vnode/src/tsdb/dev/tsdbDataF
ReaderWriter
.c
→
source/dnode/vnode/src/tsdb/dev/tsdbDataF
ileRW
.c
浏览文件 @
5bcc9c54
...
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "
dev
.h"
#include "
inc/tsdbDataFileRW
.h"
// SDataFileReader =============================================
struct
SDataFileReader
{
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttF
ReaderWriter
.c
→
source/dnode/vnode/src/tsdb/dev/tsdbSttF
ileRW
.c
浏览文件 @
5bcc9c54
...
...
@@ -13,7 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "inc/tsdbSttF
ReaderWriter
.h"
#include "inc/tsdbSttF
ileRW
.h"
typedef
struct
{
int64_t
prevFooter
;
...
...
@@ -26,40 +26,36 @@ typedef struct {
// SSttFReader ============================================================
struct
SSttFileReader
{
SSttFileReaderConfig
config
[
1
];
TSttSegReaderArray
segReaderArray
;
TSttSegReaderArray
readerArray
[
1
]
;
STsdbFD
*
fd
;
};
struct
SSttSegReader
{
SSttFileReader
*
reader
;
SSttFooter
footer
[
1
];
struct
{
bool
bloomFilterLoaded
;
bool
sttBlkLoaded
;
bool
delBlkLoaded
;
bool
statisBlkLoaded
;
}
ctx
;
SSttFooter
footer
[
1
];
void
*
bloomFilter
;
TSttBlkArray
sttBlkArray
;
TDelBlkArray
delBlkArray
;
TStatisBlkArray
statisBlkArray
;
TSttBlkArray
sttBlkArray
[
1
];
TDelBlkArray
delBlkArray
[
1
];
TStatisBlkArray
statisBlkArray
[
1
];
};
// SSttFileReader
static
int32_t
tsdbSttSegReaderOpen
(
SSttFileReader
*
reader
,
int64_t
offset
,
SSttSegReader
**
segReader
)
{
ASSERT
(
offset
>=
TSDB_FHDR_SIZE
);
int32_t
code
=
0
;
int32_t
lino
=
0
;
int32_t
vid
=
TD_VID
(
reader
->
config
->
tsdb
->
pVnode
);
ASSERT
(
offset
>=
TSDB_FHDR_SIZE
);
segReader
[
0
]
=
taosMemoryCalloc
(
1
,
sizeof
(
*
segReader
[
0
]));
if
(
segReader
[
0
]
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
if
(
!
segReader
[
0
]
)
return
TSDB_CODE_OUT_OF_MEMORY
;
segReader
[
0
]
->
reader
=
reader
;
code
=
tsdbReadFile
(
reader
->
fd
,
offset
,
(
uint8_t
*
)(
&
segReader
[
0
]
->
footer
),
sizeof
(
segReader
[
0
]
->
f
ooter
));
code
=
tsdbReadFile
(
reader
->
fd
,
offset
,
(
uint8_t
*
)(
segReader
[
0
]
->
footer
),
sizeof
(
SSttF
ooter
));
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
...
...
@@ -71,23 +67,20 @@ _exit:
return
code
;
}
static
int32_t
tsdbSttSegReaderClose
(
SSttSegReader
**
segR
eader
)
{
if
(
!
segR
eader
[
0
])
return
0
;
static
int32_t
tsdbSttSegReaderClose
(
SSttSegReader
**
r
eader
)
{
if
(
!
r
eader
[
0
])
return
0
;
if
(
segReader
[
0
]
->
ctx
.
bloomFilterLoaded
)
{
// TODO
}
if
(
segReader
[
0
]
->
ctx
.
sttBlkLoaded
)
{
TARRAY2_FREE
(
&
segReader
[
0
]
->
sttBlkArray
);
if
(
reader
[
0
]
->
ctx
.
sttBlkLoaded
)
{
TARRAY2_FREE
(
reader
[
0
]
->
sttBlkArray
);
}
if
(
segR
eader
[
0
]
->
ctx
.
delBlkLoaded
)
{
TARRAY2_FREE
(
&
segR
eader
[
0
]
->
delBlkArray
);
if
(
r
eader
[
0
]
->
ctx
.
delBlkLoaded
)
{
TARRAY2_FREE
(
r
eader
[
0
]
->
delBlkArray
);
}
if
(
segR
eader
[
0
]
->
ctx
.
statisBlkLoaded
)
{
TARRAY2_FREE
(
&
segR
eader
[
0
]
->
statisBlkArray
);
if
(
r
eader
[
0
]
->
ctx
.
statisBlkLoaded
)
{
TARRAY2_FREE
(
r
eader
[
0
]
->
statisBlkArray
);
}
taosMemoryFree
(
segR
eader
[
0
]);
segR
eader
[
0
]
=
NULL
;
taosMemoryFree
(
r
eader
[
0
]);
r
eader
[
0
]
=
NULL
;
return
0
;
}
...
...
@@ -100,29 +93,28 @@ int32_t tsdbSttFReaderOpen(const SSttFileReaderConfig *config, SSttFileReader **
if
(
reader
[
0
]
==
NULL
)
return
TSDB_CODE_OUT_OF_MEMORY
;
reader
[
0
]
->
config
[
0
]
=
config
[
0
];
TARRAY2_INIT
(
&
reader
[
0
]
->
segReaderArray
);
// open file
char
fname
[
TSDB_FILENAME_LEN
];
tsdbTFileName
(
config
->
tsdb
,
&
config
->
file
,
fname
);
tsdbTFileName
(
config
->
tsdb
,
config
->
file
,
fname
);
code
=
tsdbOpenFile
(
fname
,
config
->
szPage
,
TD_FILE_READ
,
&
reader
[
0
]
->
fd
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// open each segment reader
int64_t
size
=
config
->
file
.
size
;
int64_t
size
=
config
->
file
->
size
;
while
(
size
>
0
)
{
SSttSegReader
*
segReader
;
SSttSegReader
*
reader1
;
code
=
tsdbSttSegReaderOpen
(
reader
[
0
],
size
-
sizeof
(
SSttFooter
),
&
segReader
);
code
=
tsdbSttSegReaderOpen
(
reader
[
0
],
size
-
sizeof
(
SSttFooter
),
&
reader1
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
TARRAY2_APPEND
(
&
reader
[
0
]
->
segReaderArray
,
segReader
);
code
=
TARRAY2_APPEND
(
reader
[
0
]
->
readerArray
,
reader1
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
size
=
segReader
->
footer
->
prevFooter
;
size
=
reader1
->
footer
->
prevFooter
;
}
ASSERT
(
TARRAY2_SIZE
(
&
reader
[
0
]
->
segReaderArray
)
==
config
->
file
.
stt
->
nseg
);
ASSERT
(
TARRAY2_SIZE
(
reader
[
0
]
->
readerArray
)
==
config
->
file
->
stt
->
nseg
);
_exit:
if
(
code
)
{
...
...
@@ -134,24 +126,18 @@ _exit:
int32_t
tsdbSttFReaderClose
(
SSttFileReader
**
reader
)
{
tsdbCloseFile
(
&
reader
[
0
]
->
fd
);
TARRAY2_CLEAR_FREE
(
&
reader
[
0
]
->
segR
eaderArray
,
tsdbSttSegReaderClose
);
TARRAY2_CLEAR_FREE
(
reader
[
0
]
->
r
eaderArray
,
tsdbSttSegReaderClose
);
taosMemoryFree
(
reader
[
0
]);
reader
[
0
]
=
NULL
;
return
0
;
}
int32_t
tsdbSttFReaderGetSegReader
(
SSttFileReader
*
reader
,
const
TSttSegReaderArray
**
segR
eaderArray
)
{
segReaderArray
[
0
]
=
&
reader
->
segR
eaderArray
;
int32_t
tsdbSttFReaderGetSegReader
(
SSttFileReader
*
reader
,
const
TSttSegReaderArray
**
r
eaderArray
)
{
readerArray
[
0
]
=
reader
->
r
eaderArray
;
return
0
;
}
// SSttFSegReader
int32_t
tsdbSttFReadBloomFilter
(
SSttSegReader
*
reader
,
const
void
*
pFilter
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
int32_t
tsdbSttFReadStatisBlk
(
SSttSegReader
*
reader
,
const
TStatisBlkArray
**
statisBlkArray
)
{
if
(
!
reader
->
ctx
.
statisBlkLoaded
)
{
if
(
reader
->
footer
->
statisBlkPtr
->
size
>
0
)
{
...
...
@@ -165,15 +151,15 @@ int32_t tsdbSttFReadStatisBlk(SSttSegReader *reader, const TStatisBlkArray **sta
reader
->
footer
->
statisBlkPtr
->
size
);
if
(
code
)
return
code
;
TARRAY2_INIT_EX
(
&
reader
->
statisBlkArray
,
size
,
size
,
data
);
TARRAY2_INIT_EX
(
reader
->
statisBlkArray
,
size
,
size
,
data
);
}
else
{
TARRAY2_INIT
(
&
reader
->
statisBlkArray
);
TARRAY2_INIT
(
reader
->
statisBlkArray
);
}
reader
->
ctx
.
statisBlkLoaded
=
true
;
}
statisBlkArray
[
0
]
=
&
reader
->
statisBlkArray
;
statisBlkArray
[
0
]
=
reader
->
statisBlkArray
;
return
0
;
}
...
...
@@ -190,15 +176,15 @@ int32_t tsdbSttFReadDelBlk(SSttSegReader *reader, const TDelBlkArray **delBlkArr
tsdbReadFile
(
reader
->
reader
->
fd
,
reader
->
footer
->
delBlkPtr
->
offset
,
data
,
reader
->
footer
->
delBlkPtr
->
size
);
if
(
code
)
return
code
;
TARRAY2_INIT_EX
(
&
reader
->
delBlkArray
,
size
,
size
,
data
);
TARRAY2_INIT_EX
(
reader
->
delBlkArray
,
size
,
size
,
data
);
}
else
{
TARRAY2_INIT
(
&
reader
->
delBlkArray
);
TARRAY2_INIT
(
reader
->
delBlkArray
);
}
reader
->
ctx
.
delBlkLoaded
=
true
;
}
delBlkArray
[
0
]
=
&
reader
->
delBlkArray
;
delBlkArray
[
0
]
=
reader
->
delBlkArray
;
return
0
;
}
...
...
@@ -215,15 +201,15 @@ int32_t tsdbSttFReadSttBlk(SSttSegReader *reader, const TSttBlkArray **sttBlkArr
tsdbReadFile
(
reader
->
reader
->
fd
,
reader
->
footer
->
sttBlkPtr
->
offset
,
data
,
reader
->
footer
->
sttBlkPtr
->
size
);
if
(
code
)
return
code
;
TARRAY2_INIT_EX
(
&
reader
->
sttBlkArray
,
size
,
size
,
data
);
TARRAY2_INIT_EX
(
reader
->
sttBlkArray
,
size
,
size
,
data
);
}
else
{
TARRAY2_INIT
(
&
reader
->
sttBlkArray
);
TARRAY2_INIT
(
reader
->
sttBlkArray
);
}
reader
->
ctx
.
sttBlkLoaded
=
true
;
}
sttBlkArray
[
0
]
=
&
reader
->
sttBlkArray
;
sttBlkArray
[
0
]
=
reader
->
sttBlkArray
;
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录