Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN产品汪
TDengine
提交
d7480130
T
TDengine
项目概览
CSDN产品汪
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
5
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d7480130
编写于
6月 28, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225] handle error code.
上级
1d3a13b4
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
25 deletion
+48
-25
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+2
-2
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+40
-20
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+6
-3
未找到文件。
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
d7480130
...
...
@@ -120,7 +120,7 @@ int tsdbSetAndOpenHelperFile(SRWHelper *pHelper, SFileGroup *pGroup) {
if
(
tsendfile
(
pHelper
->
files
.
nHeadF
.
fd
,
pHelper
->
files
.
headF
.
fd
,
NULL
,
TSDB_FILE_HEAD_SIZE
)
<
TSDB_FILE_HEAD_SIZE
)
{
tsdbError
(
"vgId:%d failed to sendfile %d bytes from file %s to %s since %s"
,
REPO_ID
(
pHelper
->
pRepo
),
TSDB_FILE_HEAD_SIZE
,
pHelper
->
files
.
headF
.
fname
,
pHelper
->
files
.
nHeadF
.
fname
,
strerror
(
errno
));
errno
=
TAOS_SYSTEM_ERROR
(
errno
);
t
errno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
}
...
...
@@ -143,7 +143,7 @@ int tsdbSetAndOpenHelperFile(SRWHelper *pHelper, SFileGroup *pGroup) {
return
tsdbLoadCompIdx
(
pHelper
,
NULL
);
_err:
return
-
1
;
return
terrno
;
}
int
tsdbCloseHelperFile
(
SRWHelper
*
pHelper
,
bool
hasError
)
{
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
d7480130
...
...
@@ -148,7 +148,7 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
pQueryHandle
->
type
=
TSDB_QUERY_TYPE_ALL
;
pQueryHandle
->
cur
.
fid
=
-
1
;
pQueryHandle
->
cur
.
win
=
TSWINDOW_INITIALIZER
;
pQueryHandle
->
checkFiles
=
true
;
//ASCENDING_TRAVERSE(pQueryHandle->order);
pQueryHandle
->
checkFiles
=
true
;
pQueryHandle
->
activeIndex
=
0
;
// current active table index
pQueryHandle
->
qinfo
=
qinfo
;
pQueryHandle
->
outputCapacity
=
((
STsdbRepo
*
)
tsdb
)
->
config
.
maxRowsPerFileBlock
;
...
...
@@ -475,11 +475,15 @@ static int32_t binarySearchForBlock(SCompBlock* pBlock, int32_t numOfBlocks, TSK
}
static
int32_t
getFileCompInfo
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
*
numOfBlocks
,
int32_t
type
)
{
// todo check open file failed
SFileGroup
*
fileGroup
=
pQueryHandle
->
pFileGroup
;
assert
(
fileGroup
->
files
[
TSDB_FILE_TYPE_HEAD
].
fname
>
0
);
tsdbSetAndOpenHelperFile
(
&
pQueryHandle
->
rhelper
,
fileGroup
);
int32_t
code
=
tsdbSetAndOpenHelperFile
(
&
pQueryHandle
->
rhelper
,
fileGroup
);
//open file failed, return error code to client
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
// load all the comp offset value for all tables in this file
*
numOfBlocks
=
0
;
...
...
@@ -593,8 +597,7 @@ static bool doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SCompBlock* pBlo
if
(
pCheckInfo
->
pDataCols
==
NULL
)
{
STsdbMeta
*
pMeta
=
tsdbGetMeta
(
pRepo
);
// TODO
pCheckInfo
->
pDataCols
=
tdNewDataCols
(
pMeta
->
maxRowBytes
,
pMeta
->
maxCols
,
pRepo
->
config
.
maxRowsPerFileBlock
);
pCheckInfo
->
pDataCols
=
tdNewDataCols
(
pMeta
->
maxRowBytes
,
pMeta
->
maxCols
,
pRepo
->
config
.
maxRowsPerFileBlock
);
}
tdInitDataCols
(
pCheckInfo
->
pDataCols
,
tsdbGetTableSchema
(
pCheckInfo
->
pTableObj
));
...
...
@@ -1359,16 +1362,18 @@ static int32_t createDataBlocksInfo(STsdbQueryHandle* pQueryHandle, int32_t numO
}
// todo opt for only one table case
static
bool
getDataBlocksInFilesImpl
(
STsdbQueryHandle
*
pQueryHandle
)
{
static
int32_t
getDataBlocksInFilesImpl
(
STsdbQueryHandle
*
pQueryHandle
,
bool
*
exists
)
{
pQueryHandle
->
numOfBlocks
=
0
;
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
numOfBlocks
=
0
;
int32_t
numOfTables
=
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
);
while
((
pQueryHandle
->
pFileGroup
=
tsdbGetFileGroupNext
(
&
pQueryHandle
->
fileIter
))
!=
NULL
)
{
int32_t
type
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
QUERY_RANGE_GREATER_EQUAL
:
QUERY_RANGE_LESS_EQUAL
;
if
(
getFileCompInfo
(
pQueryHandle
,
&
numOfBlocks
,
type
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
(
code
=
getFileCompInfo
(
pQueryHandle
,
&
numOfBlocks
,
type
)
)
!=
TSDB_CODE_SUCCESS
)
{
break
;
}
...
...
@@ -1393,20 +1398,25 @@ static bool getDataBlocksInFilesImpl(STsdbQueryHandle* pQueryHandle) {
// no data in file anymore
if
(
pQueryHandle
->
numOfBlocks
<=
0
)
{
assert
(
pQueryHandle
->
pFileGroup
==
NULL
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
assert
(
pQueryHandle
->
pFileGroup
==
NULL
);
}
cur
->
fid
=
-
1
;
// denote that there are no data in file anymore
return
fals
e
;
*
exists
=
false
;
return
cod
e
;
}
cur
->
slot
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
0
:
pQueryHandle
->
numOfBlocks
-
1
;
cur
->
fid
=
pQueryHandle
->
pFileGroup
->
fileId
;
STableBlockInfo
*
pBlockInfo
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
return
loadFileDataBlock
(
pQueryHandle
,
pBlockInfo
->
compBlock
,
pBlockInfo
->
pTableCheckInfo
);
*
exists
=
loadFileDataBlock
(
pQueryHandle
,
pBlockInfo
->
compBlock
,
pBlockInfo
->
pTableCheckInfo
);
return
TSDB_CODE_SUCCESS
;
}
static
bool
getDataBlocksInFiles
(
STsdbQueryHandle
*
pQueryHandle
)
{
static
int32_t
getDataBlocksInFiles
(
STsdbQueryHandle
*
pQueryHandle
,
bool
*
exists
)
{
STsdbFileH
*
pFileHandle
=
tsdbGetFile
(
pQueryHandle
->
pTsdb
);
SQueryFilePos
*
cur
=
&
pQueryHandle
->
cur
;
...
...
@@ -1419,7 +1429,7 @@ static bool getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle) {
tsdbInitFileGroupIter
(
pFileHandle
,
&
pQueryHandle
->
fileIter
,
pQueryHandle
->
order
);
tsdbSeekFileGroupIter
(
&
pQueryHandle
->
fileIter
,
fid
);
return
getDataBlocksInFilesImpl
(
pQueryHandle
);
return
getDataBlocksInFilesImpl
(
pQueryHandle
,
exists
);
}
else
{
// check if current file block is all consumed
STableBlockInfo
*
pBlockInfo
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
...
...
@@ -1430,7 +1440,7 @@ static bool getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle) {
if
((
cur
->
slot
==
pQueryHandle
->
numOfBlocks
-
1
&&
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
))
||
(
cur
->
slot
==
0
&&
!
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)))
{
// all data blocks in current file has been checked already, try next file if exists
return
getDataBlocksInFilesImpl
(
pQueryHandle
);
return
getDataBlocksInFilesImpl
(
pQueryHandle
,
exists
);
}
else
{
// next block of the same file
int32_t
step
=
ASCENDING_TRAVERSE
(
pQueryHandle
->
order
)
?
1
:
-
1
;
...
...
@@ -1440,11 +1450,15 @@ static bool getDataBlocksInFiles(STsdbQueryHandle* pQueryHandle) {
cur
->
blockCompleted
=
false
;
STableBlockInfo
*
pNext
=
&
pQueryHandle
->
pDataBlockInfo
[
cur
->
slot
];
return
loadFileDataBlock
(
pQueryHandle
,
pNext
->
compBlock
,
pNext
->
pTableCheckInfo
);
*
exists
=
loadFileDataBlock
(
pQueryHandle
,
pNext
->
compBlock
,
pNext
->
pTableCheckInfo
);
return
TSDB_CODE_SUCCESS
;
}
}
else
{
handleDataMergeIfNeeded
(
pQueryHandle
,
pBlockInfo
->
compBlock
,
pCheckInfo
);
return
pQueryHandle
->
realNumOfRows
>
0
;
*
exists
=
pQueryHandle
->
realNumOfRows
>
0
;
return
TSDB_CODE_SUCCESS
;
}
}
}
...
...
@@ -1576,8 +1590,14 @@ bool tsdbNextDataBlock(TsdbQueryHandleT* pHandle) {
}
if
(
pQueryHandle
->
checkFiles
)
{
if
(
getDataBlocksInFiles
(
pQueryHandle
))
{
return
true
;
bool
exists
=
true
;
int32_t
code
=
getDataBlocksInFiles
(
pQueryHandle
,
&
exists
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
false
;
}
if
(
exists
)
{
return
exists
;
}
pQueryHandle
->
activeIndex
=
0
;
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
d7480130
...
...
@@ -110,11 +110,14 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SReadMsg *pReadMsg) {
pRet
->
rsp
=
pRsp
;
// current connect is broken
if
(
vnodeNotifyCurrentQhandle
(
pReadMsg
->
rpcMsg
.
handle
,
pQInfo
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
)
{
vError
(
"vgId:%d, QInfo:%p, dnode query discarded since link is broken, %p"
,
pVnode
->
vgId
,
pQInfo
,
pReadMsg
->
rpcMsg
.
handle
);
if
((
code
==
TSDB_CODE_SUCCESS
)
&&
(
vnodeNotifyCurrentQhandle
(
pReadMsg
->
rpcMsg
.
handle
,
pQInfo
,
pVnode
->
vgId
)
!=
TSDB_CODE_SUCCESS
))
{
vError
(
"vgId:%d, QInfo:%p, dnode query discarded since link is broken, %p"
,
pVnode
->
vgId
,
pQInfo
,
pReadMsg
->
rpcMsg
.
handle
);
pRsp
->
code
=
TSDB_CODE_RPC_NETWORK_UNAVAIL
;
//NOTE: there two refcount, needs to kill twice, todo refactor
//
NOTE: there two refcount, needs to kill twice, todo refactor
qKillQuery
(
pQInfo
,
vnodeRelease
,
pVnode
);
qKillQuery
(
pQInfo
,
vnodeRelease
,
pVnode
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录