Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
271353f0
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1185
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看板
未验证
提交
271353f0
编写于
7月 22, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
7月 22, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2741 from taosdata/bugfix/td-980
fix td-980
上级
6e03fa3e
41c76edc
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
47 addition
and
21 deletion
+47
-21
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+5
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+4
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+38
-19
未找到文件。
src/query/src/qExecutor.c
浏览文件 @
271353f0
...
@@ -6419,8 +6419,12 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
...
@@ -6419,8 +6419,12 @@ int32_t qDumpRetrieveResult(qinfo_t qinfo, SRetrieveTableRsp **pRsp, int32_t *co
size
+=
sizeof
(
STableIdInfo
)
*
taosArrayGetSize
(
pQInfo
->
arrTableIdInfo
);
size
+=
sizeof
(
STableIdInfo
)
*
taosArrayGetSize
(
pQInfo
->
arrTableIdInfo
);
*
contLen
=
size
+
sizeof
(
SRetrieveTableRsp
);
*
contLen
=
size
+
sizeof
(
SRetrieveTableRsp
);
// todo handle failed to allocate memory
// todo proper handle failed to allocate memory,
// current solution only avoid crash, but cannot return error code to client
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
*
contLen
);
*
pRsp
=
(
SRetrieveTableRsp
*
)
rpcMallocCont
(
*
contLen
);
if
(
*
pRsp
==
NULL
)
{
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
numOfRows
=
htonl
(
pQuery
->
rec
.
rows
);
(
*
pRsp
)
->
numOfRows
=
htonl
(
pQuery
->
rec
.
rows
);
int32_t
code
=
pQInfo
->
code
;
int32_t
code
=
pQInfo
->
code
;
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
271353f0
...
@@ -123,7 +123,10 @@ int tsdbCreateTable(TSDB_REPO_T *repo, STableCfg *pCfg) {
...
@@ -123,7 +123,10 @@ int tsdbCreateTable(TSDB_REPO_T *repo, STableCfg *pCfg) {
int
tlen2
=
tsdbGetTableEncodeSize
(
TSDB_UPDATE_META
,
table
);
int
tlen2
=
tsdbGetTableEncodeSize
(
TSDB_UPDATE_META
,
table
);
int
tlen
=
tlen1
+
tlen2
;
int
tlen
=
tlen1
+
tlen2
;
void
*
buf
=
tsdbAllocBytes
(
pRepo
,
tlen
);
void
*
buf
=
tsdbAllocBytes
(
pRepo
,
tlen
);
ASSERT
(
buf
!=
NULL
);
if
(
buf
==
NULL
)
{
goto
_err
;
}
if
(
newSuper
)
{
if
(
newSuper
)
{
void
*
pBuf
=
tsdbInsertTableAct
(
pRepo
,
TSDB_UPDATE_META
,
buf
,
super
);
void
*
pBuf
=
tsdbInsertTableAct
(
pRepo
,
TSDB_UPDATE_META
,
buf
,
super
);
ASSERT
(
POINTER_DISTANCE
(
pBuf
,
buf
)
==
tlen1
);
ASSERT
(
POINTER_DISTANCE
(
pBuf
,
buf
)
==
tlen1
);
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
271353f0
...
@@ -188,8 +188,7 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
...
@@ -188,8 +188,7 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
pQueryHandle
->
allocSize
=
0
;
pQueryHandle
->
allocSize
=
0
;
if
(
tsdbInitReadHelper
(
&
pQueryHandle
->
rhelper
,
(
STsdbRepo
*
)
tsdb
)
!=
0
)
{
if
(
tsdbInitReadHelper
(
&
pQueryHandle
->
rhelper
,
(
STsdbRepo
*
)
tsdb
)
!=
0
)
{
free
(
pQueryHandle
);
goto
out_of_memory
;
return
NULL
;
}
}
tsdbTakeMemSnapshot
(
pQueryHandle
->
pTsdb
,
&
pQueryHandle
->
mem
,
&
pQueryHandle
->
imem
);
tsdbTakeMemSnapshot
(
pQueryHandle
->
pTsdb
,
&
pQueryHandle
->
mem
,
&
pQueryHandle
->
imem
);
...
@@ -201,18 +200,30 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
...
@@ -201,18 +200,30 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
int32_t
numOfCols
=
pCond
->
numOfCols
;
int32_t
numOfCols
=
pCond
->
numOfCols
;
pQueryHandle
->
statis
=
calloc
(
numOfCols
,
sizeof
(
SDataStatis
));
pQueryHandle
->
statis
=
calloc
(
numOfCols
,
sizeof
(
SDataStatis
));
if
(
pQueryHandle
->
statis
==
NULL
)
{
goto
out_of_memory
;
}
pQueryHandle
->
pColumns
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
// todo: use list instead of array?
pQueryHandle
->
pColumns
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
// todo: use list instead of array?
if
(
pQueryHandle
->
pColumns
==
NULL
)
{
goto
out_of_memory
;
}
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
colInfo
=
{{
0
},
0
};
SColumnInfoData
colInfo
=
{{
0
},
0
};
colInfo
.
info
=
pCond
->
colList
[
i
];
colInfo
.
info
=
pCond
->
colList
[
i
];
colInfo
.
pData
=
calloc
(
1
,
EXTRA_BYTES
+
pQueryHandle
->
outputCapacity
*
pCond
->
colList
[
i
].
bytes
);
colInfo
.
pData
=
calloc
(
1
,
EXTRA_BYTES
+
pQueryHandle
->
outputCapacity
*
pCond
->
colList
[
i
].
bytes
);
if
(
colInfo
.
pData
==
NULL
)
{
goto
out_of_memory
;
}
taosArrayPush
(
pQueryHandle
->
pColumns
,
&
colInfo
);
taosArrayPush
(
pQueryHandle
->
pColumns
,
&
colInfo
);
pQueryHandle
->
statis
[
i
].
colId
=
colInfo
.
info
.
colId
;
pQueryHandle
->
statis
[
i
].
colId
=
colInfo
.
info
.
colId
;
}
}
pQueryHandle
->
pTableCheckInfo
=
taosArrayInit
(
groupList
->
numOfTables
,
sizeof
(
STableCheckInfo
));
pQueryHandle
->
pTableCheckInfo
=
taosArrayInit
(
groupList
->
numOfTables
,
sizeof
(
STableCheckInfo
));
if
(
pQueryHandle
->
pTableCheckInfo
==
NULL
)
{
goto
out_of_memory
;
}
STsdbMeta
*
pMeta
=
tsdbGetMeta
(
tsdb
);
STsdbMeta
*
pMeta
=
tsdbGetMeta
(
tsdb
);
assert
(
pMeta
!=
NULL
);
assert
(
pMeta
!=
NULL
);
...
@@ -247,6 +258,11 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
...
@@ -247,6 +258,11 @@ TsdbQueryHandleT* tsdbQueryTables(TSDB_REPO_T* tsdb, STsdbQueryCond* pCond, STab
tsdbInitCompBlockLoadInfo
(
&
pQueryHandle
->
compBlockLoadInfo
);
tsdbInitCompBlockLoadInfo
(
&
pQueryHandle
->
compBlockLoadInfo
);
return
(
TsdbQueryHandleT
)
pQueryHandle
;
return
(
TsdbQueryHandleT
)
pQueryHandle
;
out_of_memory:
terrno
=
TSDB_CODE_TDB_OUT_OF_MEMORY
;
tsdbCleanupQueryHandle
(
pQueryHandle
);
return
NULL
;
}
}
TsdbQueryHandleT
tsdbQueryLastRow
(
TSDB_REPO_T
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
)
{
TsdbQueryHandleT
tsdbQueryLastRow
(
TSDB_REPO_T
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
void
*
qinfo
)
{
...
@@ -2372,6 +2388,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
...
@@ -2372,6 +2388,7 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
return
;
return
;
}
}
if
(
pQueryHandle
->
pTableCheckInfo
!=
NULL
)
{
size_t
size
=
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
);
size_t
size
=
taosArrayGetSize
(
pQueryHandle
->
pTableCheckInfo
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
STableCheckInfo
*
pTableCheckInfo
=
taosArrayGet
(
pQueryHandle
->
pTableCheckInfo
,
i
);
STableCheckInfo
*
pTableCheckInfo
=
taosArrayGet
(
pQueryHandle
->
pTableCheckInfo
,
i
);
...
@@ -2384,16 +2401,18 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
...
@@ -2384,16 +2401,18 @@ void tsdbCleanupQueryHandle(TsdbQueryHandleT queryHandle) {
tfree
(
pTableCheckInfo
->
pDataCols
);
tfree
(
pTableCheckInfo
->
pDataCols
);
tfree
(
pTableCheckInfo
->
pCompInfo
);
tfree
(
pTableCheckInfo
->
pCompInfo
);
}
}
taosArrayDestroy
(
pQueryHandle
->
pTableCheckInfo
);
taosArrayDestroy
(
pQueryHandle
->
pTableCheckInfo
);
}
if
(
pQueryHandle
->
pColumns
!=
NULL
)
{
size_t
cols
=
taosArrayGetSize
(
pQueryHandle
->
pColumns
);
size_t
cols
=
taosArrayGetSize
(
pQueryHandle
->
pColumns
);
for
(
int32_t
i
=
0
;
i
<
cols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
cols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pQueryHandle
->
pColumns
,
i
);
tfree
(
pColInfo
->
pData
);
tfree
(
pColInfo
->
pData
);
}
}
taosArrayDestroy
(
pQueryHandle
->
pColumns
);
taosArrayDestroy
(
pQueryHandle
->
pColumns
);
}
taosArrayDestroy
(
pQueryHandle
->
defaultLoadColumn
);
taosArrayDestroy
(
pQueryHandle
->
defaultLoadColumn
);
tfree
(
pQueryHandle
->
pDataBlockInfo
);
tfree
(
pQueryHandle
->
pDataBlockInfo
);
tfree
(
pQueryHandle
->
statis
);
tfree
(
pQueryHandle
->
statis
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录