Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
24d93f57
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
24d93f57
编写于
12月 19, 2019
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
opt performance by removing the mmap during read header file
上级
a935e645
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
11 deletion
+28
-11
src/system/detail/src/vnodeQueryImpl.c
src/system/detail/src/vnodeQueryImpl.c
+28
-11
未找到文件。
src/system/detail/src/vnodeQueryImpl.c
浏览文件 @
24d93f57
...
...
@@ -431,7 +431,7 @@ char *vnodeGetHeaderFileData(SQueryRuntimeEnv *pRuntimeEnv, int32_t vnodeId, int
if
(
pVnodeFileInfo
->
current
!=
fileIndex
||
pVnodeFileInfo
->
pHeaderFileData
==
NULL
)
{
if
(
pVnodeFileInfo
->
current
>=
0
)
{
assert
(
pVnodeFileInfo
->
pHeaderFileData
!=
NULL
);
//
assert(pVnodeFileInfo->pHeaderFileData != NULL);
}
// do close the current memory mapped header file and corresponding fd
...
...
@@ -487,16 +487,17 @@ static int vnodeGetCompBlockInfo(SMeterObj *pMeterObj, SQueryRuntimeEnv *pRuntim
char
*
data
=
calloc
(
1
,
tmsize
+
TSDB_FILE_HEADER_LEN
);
read
(
fd
,
data
,
tmsize
+
TSDB_FILE_HEADER_LEN
);
#endif
int64_t
offset
=
TSDB_FILE_HEADER_LEN
+
sizeof
(
SCompHeader
)
*
pMeterObj
->
sid
;
#if 0
// check the offset value integrity
if (validateHeaderOffsetSegment(pQInfo, pRuntimeEnv->vnodeFileInfo.headerFilePath, pMeterObj->vnode, data,
getCompHeaderSegSize(pCfg)) < 0) {
return -1;
}
int64_t
offset
=
TSDB_FILE_HEADER_LEN
+
sizeof
(
SCompHeader
)
*
pMeterObj
->
sid
;
SCompHeader *compHeader = (SCompHeader *)(data + offset);
// no data in this file for specified meter, abort
if (compHeader->compInfoOffset == 0) {
return 0;
...
...
@@ -507,14 +508,29 @@ static int vnodeGetCompBlockInfo(SMeterObj *pMeterObj, SQueryRuntimeEnv *pRuntim
getCompHeaderStartPosition(pCfg)) < 0) {
return -1;
}
#else
char
*
buf
=
calloc
(
1
,
getCompHeaderSegSize
(
pCfg
));
SQueryFilesInfo
*
pVnodeFileInfo
=
&
pRuntimeEnv
->
vnodeFileInfo
;
lseek
(
pVnodeFileInfo
->
headerFd
,
TSDB_FILE_HEADER_LEN
,
SEEK_SET
);
read
(
pVnodeFileInfo
->
headerFd
,
buf
,
getCompHeaderSegSize
(
pCfg
));
// check the offset value integrity
if
(
validateHeaderOffsetSegment
(
pQInfo
,
pRuntimeEnv
->
vnodeFileInfo
.
headerFilePath
,
pMeterObj
->
vnode
,
buf
-
TSDB_FILE_HEADER_LEN
,
getCompHeaderSegSize
(
pCfg
))
<
0
)
{
return
-
1
;
}
#endif
#if
1
#if
0
SCompInfo *compInfo = (SCompInfo *)(data + compHeader->compInfoOffset);
#else
lseek
(
fd
,
compHeader
->
compInfoOffset
,
SEEK_SET
);
SCompHeader
*
compHeader
=
(
SCompHeader
*
)(
buf
+
sizeof
(
SCompHeader
)
*
pMeterObj
->
sid
);
lseek
(
pVnodeFileInfo
->
headerFd
,
compHeader
->
compInfoOffset
,
SEEK_SET
);
SCompInfo
CompInfo
=
{
0
};
SCompInfo
*
compInfo
=
&
CompInfo
;
read
(
f
d
,
compInfo
,
sizeof
(
SCompInfo
));
read
(
pVnodeFileInfo
->
headerF
d
,
compInfo
,
sizeof
(
SCompInfo
));
#endif
// check compblock info integrity
...
...
@@ -542,19 +558,19 @@ static int vnodeGetCompBlockInfo(SMeterObj *pMeterObj, SQueryRuntimeEnv *pRuntim
memset
(
pQuery
->
pBlock
,
0
,
(
size_t
)
pQuery
->
blockBufferSize
);
#if
1
#if
0
memcpy(pQuery->pBlock, (char *)compInfo + sizeof(SCompInfo), (size_t)compBlockSize);
TSCKSUM checksum = *(TSCKSUM *)((char *)compInfo + sizeof(SCompInfo) + compBlockSize);
#else
TSCKSUM
checksum
;
read
(
f
d
,
pQuery
->
pBlock
,
compBlockSize
);
read
(
f
d
,
&
checksum
,
sizeof
(
TSCKSUM
));
read
(
pVnodeFileInfo
->
headerF
d
,
pQuery
->
pBlock
,
compBlockSize
);
read
(
pVnodeFileInfo
->
headerF
d
,
&
checksum
,
sizeof
(
TSCKSUM
));
#endif
// check comp block integrity
if
(
validateCompBlockSegment
(
pQInfo
,
pRuntimeEnv
->
vnodeFileInfo
.
headerFilePath
,
compInfo
,
(
char
*
)
pQuery
->
pBlock
,
pMeterObj
->
vnode
,
checksum
)
<
0
)
{
return
-
1
;
return
-
1
;
//TODO free resource in error process
}
pQuery
->
pFields
=
(
SField
**
)((
char
*
)
pQuery
->
pBlock
+
compBlockSize
);
...
...
@@ -567,7 +583,8 @@ static int vnodeGetCompBlockInfo(SMeterObj *pMeterObj, SQueryRuntimeEnv *pRuntim
pSummary
->
totalCompInfoSize
+=
compBlockSize
;
pSummary
->
loadCompInfoUs
+=
(
et
-
st
);
free
(
buf
);
return
pQuery
->
numOfBlocks
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录