Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
7499d3bc
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,发现更多精彩内容 >>
提交
7499d3bc
编写于
10月 21, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code optimization
上级
42ae4fc9
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
9 addition
and
15 deletion
+9
-15
src/tsdb/inc/tsdbReadImpl.h
src/tsdb/inc/tsdbReadImpl.h
+4
-6
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+3
-7
src/tsdb/src/tsdbReadImpl.c
src/tsdb/src/tsdbReadImpl.c
+2
-2
未找到文件。
src/tsdb/inc/tsdbReadImpl.h
浏览文件 @
7499d3bc
...
@@ -74,9 +74,7 @@ typedef struct {
...
@@ -74,9 +74,7 @@ typedef struct {
#define SBlockFieldsP1 \
#define SBlockFieldsP1 \
uint64_t aggrStat : 1; \
uint64_t aggrStat : 1; \
uint64_t blkVer : 7; \
uint64_t blkVer : 7; \
uint64_t aggrOffset : 56; \
uint64_t aggrOffset : 56
uint64_t aggrNumOfCols : 16; \
uint64_t padding : 48
typedef
struct
{
typedef
struct
{
SBlockFieldsP0
;
SBlockFieldsP0
;
...
...
src/tsdb/src/tsdbCommit.c
浏览文件 @
7499d3bc
...
@@ -1080,11 +1080,10 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
...
@@ -1080,11 +1080,10 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
// Get # of cols not all NULL(not including key column)
// Get # of cols not all NULL(not including key column)
int
nColsNotAllNull
=
0
;
int
nColsNotAllNull
=
0
;
int
nAggrCols
=
0
;
for
(
int
ncol
=
1
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
// ncol from 1, we skip the timestamp column
for
(
int
ncol
=
1
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
// ncol from 1, we skip the timestamp column
SDataCol
*
pDataCol
=
pDataCols
->
cols
+
ncol
;
SDataCol
*
pDataCol
=
pDataCols
->
cols
+
ncol
;
SBlockCol
*
pBlockCol
=
pBlockData
->
cols
+
nColsNotAllNull
;
SBlockCol
*
pBlockCol
=
pBlockData
->
cols
+
nColsNotAllNull
;
SAggrBlkCol
*
pAggrBlkCol
=
(
SAggrBlkCol
*
)
pAggrBlkData
+
n
AggrCols
;
SAggrBlkCol
*
pAggrBlkCol
=
(
SAggrBlkCol
*
)
pAggrBlkData
+
n
ColsNotAllNull
;
if
(
isAllRowsNull
(
pDataCol
))
{
// all data to commit are NULL, just ignore it
if
(
isAllRowsNull
(
pDataCol
))
{
// all data to commit are NULL, just ignore it
continue
;
continue
;
...
@@ -1106,7 +1105,6 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
...
@@ -1106,7 +1105,6 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
(
*
tDataTypes
[
pDataCol
->
type
].
statisFunc
)(
pDataCol
->
pData
,
rowsToWrite
,
&
(
pAggrBlkCol
->
min
),
&
(
pAggrBlkCol
->
max
),
(
*
tDataTypes
[
pDataCol
->
type
].
statisFunc
)(
pDataCol
->
pData
,
rowsToWrite
,
&
(
pAggrBlkCol
->
min
),
&
(
pAggrBlkCol
->
max
),
&
(
pAggrBlkCol
->
sum
),
&
(
pAggrBlkCol
->
minIndex
),
&
(
pAggrBlkCol
->
maxIndex
),
&
(
pAggrBlkCol
->
sum
),
&
(
pAggrBlkCol
->
minIndex
),
&
(
pAggrBlkCol
->
maxIndex
),
&
(
pAggrBlkCol
->
numOfNull
));
&
(
pAggrBlkCol
->
numOfNull
));
++
nAggrCols
;
}
}
nColsNotAllNull
++
;
nColsNotAllNull
++
;
}
}
...
@@ -1120,7 +1118,7 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
...
@@ -1120,7 +1118,7 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
int32_t
lsize
=
tsize
;
int32_t
lsize
=
tsize
;
int32_t
keyLen
=
0
;
int32_t
keyLen
=
0
;
uint32_t
tsizeAggr
=
(
uint32_t
)
tsdbBlockAggrSize
(
n
AggrCols
,
SBlockVerLatest
);
uint32_t
tsizeAggr
=
(
uint32_t
)
tsdbBlockAggrSize
(
n
ColsNotAllNull
,
SBlockVerLatest
);
for
(
int
ncol
=
0
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
for
(
int
ncol
=
0
;
ncol
<
pDataCols
->
numOfCols
;
ncol
++
)
{
// All not NULL columns finish
// All not NULL columns finish
...
@@ -1188,7 +1186,7 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
...
@@ -1188,7 +1186,7 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
return
-
1
;
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
)
{
if
(
aggrStatus
>
0
)
{
// pAggrBlkData->numOfCols = nColsNotAllNull;
// pAggrBlkData->numOfCols = nColsNotAllNull;
...
@@ -1216,8 +1214,6 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
...
@@ -1216,8 +1214,6 @@ int tsdbWriteBlockImpl(STsdbRepo *pRepo, STable *pTable, SDFile *pDFile, SDFile
pBlock
->
aggrStat
=
aggrStatus
;
pBlock
->
aggrStat
=
aggrStatus
;
pBlock
->
blkVer
=
SBlockVerLatest
;
pBlock
->
blkVer
=
SBlockVerLatest
;
pBlock
->
aggrOffset
=
(
uint64_t
)
offsetAggr
;
pBlock
->
aggrOffset
=
(
uint64_t
)
offsetAggr
;
pBlock
->
aggrNumOfCols
=
nAggrCols
;
pBlock
->
padding
=
0
;
// padding filled with 0
tsdbDebug
(
"vgId:%d tid:%d a block of data is written to file %s, offset %"
PRId64
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
,
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
...
...
src/tsdb/src/tsdbReadImpl.c
浏览文件 @
7499d3bc
...
@@ -469,7 +469,7 @@ static int tsdbLoadBlockStatisFromAggr(SReadH *pReadh, SBlock *pBlock) {
...
@@ -469,7 +469,7 @@ static int tsdbLoadBlockStatisFromAggr(SReadH *pReadh, SBlock *pBlock) {
return
-
1
;
return
-
1
;
}
}
size_t
sizeAggr
=
tsdbBlockAggrSize
(
pBlock
->
aggrN
umOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
size_t
sizeAggr
=
tsdbBlockAggrSize
(
pBlock
->
n
umOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
if
(
tsdbMakeRoom
((
void
**
)(
&
(
pReadh
->
pAggrBlkData
)),
sizeAggr
)
<
0
)
return
-
1
;
if
(
tsdbMakeRoom
((
void
**
)(
&
(
pReadh
->
pAggrBlkData
)),
sizeAggr
)
<
0
)
return
-
1
;
int64_t
nreadAggr
=
tsdbReadDFile
(
pDFileAggr
,
(
void
*
)(
pReadh
->
pAggrBlkData
),
sizeAggr
);
int64_t
nreadAggr
=
tsdbReadDFile
(
pDFileAggr
,
(
void
*
)(
pReadh
->
pAggrBlkData
),
sizeAggr
);
...
@@ -580,7 +580,7 @@ void tsdbGetBlockStatis(SReadH *pReadh, SDataStatis *pStatis, int numOfCols, SBl
...
@@ -580,7 +580,7 @@ void tsdbGetBlockStatis(SReadH *pReadh, SDataStatis *pStatis, int numOfCols, SBl
SAggrBlkData
*
pAggrBlkData
=
pReadh
->
pAggrBlkData
;
SAggrBlkData
*
pAggrBlkData
=
pReadh
->
pAggrBlkData
;
for
(
int
i
=
0
,
j
=
0
;
i
<
numOfCols
;)
{
for
(
int
i
=
0
,
j
=
0
;
i
<
numOfCols
;)
{
if
(
j
>=
pBlock
->
aggrN
umOfCols
)
{
if
(
j
>=
pBlock
->
n
umOfCols
)
{
pStatis
[
i
].
numOfNull
=
-
1
;
pStatis
[
i
].
numOfNull
=
-
1
;
i
++
;
i
++
;
continue
;
continue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录