Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a60658a1
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看板
未验证
提交
a60658a1
编写于
10月 22, 2021
作者:
H
Hongze Cheng
提交者:
GitHub
10月 22, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8356 from taosdata/feature/TS-272
Feature/ts 272
上级
b5c96535
35f1f9c1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
11 addition
and
20 deletion
+11
-20
src/tsdb/inc/tsdbReadImpl.h
src/tsdb/inc/tsdbReadImpl.h
+7
-12
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+2
-6
src/tsdb/src/tsdbReadImpl.c
src/tsdb/src/tsdbReadImpl.c
+2
-2
未找到文件。
src/tsdb/inc/tsdbReadImpl.h
浏览文件 @
a60658a1
...
...
@@ -71,11 +71,10 @@ typedef struct {
* blkVer; // 0 - original block, 1 - block since importing .smad/.smal
* aggrOffset; // only valid when blkVer > 0 and aggrStat > 0
*/
#define SBlockFieldsP1 \
uint64_t aggrStat : 3; \
uint64_t blkVer : 5; \
uint64_t aggrOffset : 56; \
uint32_t aggrLen
#define SBlockFieldsP1 \
uint64_t aggrStat : 1; \
uint64_t blkVer : 7; \
uint64_t aggrOffset : 56
typedef
struct
{
SBlockFieldsP0
;
...
...
@@ -125,7 +124,6 @@ typedef struct {
int32_t
len
;
uint32_t
type
:
8
;
uint32_t
offset
:
24
;
// char padding[];
}
SBlockColV1
;
#define SBlockCol SBlockColV1 // latest SBlockCol definition
...
...
@@ -160,10 +158,8 @@ typedef struct {
uint64_t
uid
;
// For recovery usage
SBlockCol
cols
[];
}
SBlockData
;
typedef
struct
{
int32_t
numOfCols
;
// For recovery usage
SAggrBlkCol
cols
[];
}
SAggrBlkData
;
typedef
void
SAggrBlkData
;
// SBlockCol cols[];
struct
SReadH
{
STsdbRepo
*
pRepo
;
...
...
@@ -207,8 +203,7 @@ static FORCE_INLINE size_t tsdbBlockStatisSize(int nCols, uint32_t blkVer) {
}
}
#define TSDB_BLOCK_AGGR_SIZE(ncols, blkVer) \
(sizeof(SAggrBlkData) + sizeof(SAggrBlkColV##blkVer) * (ncols) + sizeof(TSCKSUM))
#define TSDB_BLOCK_AGGR_SIZE(ncols, blkVer) (sizeof(SAggrBlkColV##blkVer) * (ncols) + sizeof(TSCKSUM))
static
FORCE_INLINE
size_t
tsdbBlockAggrSize
(
int
nCols
,
uint32_t
blkVer
)
{
switch
(
blkVer
)
{
...
...
src/tsdb/src/tsdbCommit.c
浏览文件 @
a60658a1
...
...
@@ -1080,11 +1080,10 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
// Get # of cols not all NULL(not including key column)
int
nColsNotAllNull
=
0
;
int
nAggrCols
=
0
;
for
(
int
ncol
=
1
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
// ncol from 1, we skip the timestamp column
SDataCol
*
pDataCol
=
pDataCols
->
cols
+
ncol
;
SBlockCol
*
pBlockCol
=
pBlockData
->
cols
+
nColsNotAllNull
;
SAggrBlkCol
*
pAggrBlkCol
=
pAggrBlkData
->
cols
+
nColsNotAllNull
;
SAggrBlkCol
*
pAggrBlkCol
=
(
SAggrBlkCol
*
)
pAggrBlkData
+
nColsNotAllNull
;
if
(
isAllRowsNull
(
pDataCol
))
{
// all data to commit are NULL, just ignore it
continue
;
...
...
@@ -1106,7 +1105,6 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
(
*
tDataTypes
[
pDataCol
->
type
].
statisFunc
)(
pDataCol
->
pData
,
rowsToWrite
,
&
(
pAggrBlkCol
->
min
),
&
(
pAggrBlkCol
->
max
),
&
(
pAggrBlkCol
->
sum
),
&
(
pAggrBlkCol
->
minIndex
),
&
(
pAggrBlkCol
->
maxIndex
),
&
(
pAggrBlkCol
->
numOfNull
));
++
nAggrCols
;
}
nColsNotAllNull
++
;
}
...
...
@@ -1188,9 +1186,8 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
return
-
1
;
}
uint32_t
aggrStatus
=
((
n
AggrCols
>
0
)
&&
(
rowsToWrite
>
8
))
?
1
:
0
;
// TODO: How to make the decision?
uint32_t
aggrStatus
=
((
n
ColsNotAllNull
>
0
)
&&
(
rowsToWrite
>
8
))
?
1
:
0
;
// TODO: How to make the decision?
if
(
aggrStatus
>
0
)
{
pAggrBlkData
->
numOfCols
=
nColsNotAllNull
;
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
pAggrBlkData
,
tsizeAggr
);
tsdbUpdateDFileMagic
(
pDFileAggr
,
POINTER_SHIFT
(
pAggrBlkData
,
tsizeAggr
-
sizeof
(
TSCKSUM
)));
...
...
@@ -1216,7 +1213,6 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
pBlock
->
aggrStat
=
aggrStatus
;
pBlock
->
blkVer
=
SBlockVerLatest
;
pBlock
->
aggrOffset
=
(
uint64_t
)
offsetAggr
;
pBlock
->
aggrLen
=
tsizeAggr
;
tsdbDebug
(
"vgId:%d tid:%d a block of data is written to file %s, offset %"
PRId64
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
...
...
src/tsdb/src/tsdbReadImpl.c
浏览文件 @
a60658a1
...
...
@@ -580,12 +580,12 @@ void tsdbGetBlockStatis(SReadH *pReadh, SDataStatis *pStatis, int numOfCols, SBl
SAggrBlkData
*
pAggrBlkData
=
pReadh
->
pAggrBlkData
;
for
(
int
i
=
0
,
j
=
0
;
i
<
numOfCols
;)
{
if
(
j
>=
p
AggrBlkData
->
numOfCols
)
{
if
(
j
>=
p
Block
->
numOfCols
)
{
pStatis
[
i
].
numOfNull
=
-
1
;
i
++
;
continue
;
}
SAggrBlkCol
*
pAggrBlkCol
=
((
SAggrBlkCol
*
)(
pAggrBlkData
->
cols
))
+
j
;
SAggrBlkCol
*
pAggrBlkCol
=
((
SAggrBlkCol
*
)(
pAggrBlkData
))
+
j
;
if
(
pStatis
[
i
].
colId
==
pAggrBlkCol
->
colId
)
{
pStatis
[
i
].
sum
=
pAggrBlkCol
->
sum
;
pStatis
[
i
].
max
=
pAggrBlkCol
->
max
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录