Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c5c3ee4c
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看板
提交
c5c3ee4c
编写于
6月 22, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-4802]<fix>: fix crash caused by too many vgroups;
上级
fbe1ff81
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
56 addition
and
16 deletion
+56
-16
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+42
-10
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+14
-6
未找到文件。
src/mnode/src/mnodeTable.c
浏览文件 @
c5c3ee4c
...
...
@@ -1740,16 +1740,22 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) {
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
calculateVgroupMsgLength
(
SSTableVgroupMsg
*
pInfo
,
int32_t
numOfTable
)
{
static
int32_t
doGetVgroupInfoLength
(
char
*
name
)
{
SSTableObj
*
pTable
=
mnodeGetSuperTable
(
name
);
int32_t
len
=
0
;
if
(
pTable
!=
NULL
&&
pTable
->
vgHash
!=
NULL
)
{
len
=
(
taosHashGetSize
(
pTable
->
vgHash
)
*
sizeof
(
SVgroupMsg
)
+
sizeof
(
SVgroupsMsg
));
}
mnodeDecTableRef
(
pTable
);
return
len
;
}
static
int32_t
getVgroupInfoLength
(
SSTableVgroupMsg
*
pInfo
,
int32_t
numOfTable
)
{
int32_t
contLen
=
sizeof
(
SSTableVgroupRspMsg
)
+
32
*
sizeof
(
SVgroupMsg
)
+
sizeof
(
SVgroupsMsg
);
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SSTableVgroupMsg
)
+
(
TSDB_TABLE_FNAME_LEN
)
*
i
;
SSTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
if
(
pTable
!=
NULL
&&
pTable
->
vgHash
!=
NULL
)
{
contLen
+=
(
taosHashGetSize
(
pTable
->
vgHash
)
*
sizeof
(
SVgroupMsg
)
+
sizeof
(
SVgroupsMsg
));
}
mnodeDecTableRef
(
pTable
);
contLen
+=
doGetVgroupInfoLength
(
stableName
);
}
return
contLen
;
...
...
@@ -1820,7 +1826,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
int32_t
numOfTable
=
htonl
(
pInfo
->
numOfTables
);
// calculate the required space.
int32_t
contLen
=
calculateVgroupMsg
Length
(
pInfo
,
numOfTable
);
int32_t
contLen
=
getVgroupInfo
Length
(
pInfo
,
numOfTable
);
SSTableVgroupRspMsg
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
return
TSDB_CODE_MND_OUT_OF_MEMORY
;
...
...
@@ -2860,6 +2866,27 @@ static void mnodeProcessAlterTableRsp(SRpcMsg *rpcMsg) {
}
}
static
SMultiTableMeta
*
ensureMsgBufferSpace
(
SMultiTableMeta
*
pMultiMeta
,
SArray
*
pList
,
int32_t
*
totalMallocLen
,
int32_t
numOfVgroupList
)
{
int32_t
len
=
0
;
for
(
int32_t
i
=
0
;
i
<
numOfVgroupList
;
++
i
)
{
char
*
name
=
taosArrayGetP
(
pList
,
i
);
len
+=
doGetVgroupInfoLength
(
name
);
}
if
(
len
+
pMultiMeta
->
contLen
>
(
*
totalMallocLen
))
{
while
(
len
+
pMultiMeta
->
contLen
>
(
*
totalMallocLen
))
{
(
*
totalMallocLen
)
*=
2
;
}
pMultiMeta
=
rpcReallocCont
(
pMultiMeta
,
*
totalMallocLen
);
if
(
pMultiMeta
==
NULL
)
{
return
NULL
;
}
}
return
pMultiMeta
;
}
static
int32_t
mnodeProcessMultiTableMetaMsg
(
SMnodeMsg
*
pMsg
)
{
SMultiTableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
...
...
@@ -2950,8 +2977,6 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
}
}
char
*
msg
=
(
char
*
)
pMultiMeta
+
pMultiMeta
->
contLen
;
// add the additional super table names that needs the vgroup info
for
(;
t
<
num
;
++
t
)
{
taosArrayPush
(
pList
,
&
nameList
[
t
]);
...
...
@@ -2961,6 +2986,13 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
int32_t
numOfVgroupList
=
(
int32_t
)
taosArrayGetSize
(
pList
);
pMultiMeta
->
numOfVgroup
=
htonl
(
numOfVgroupList
);
pMultiMeta
=
ensureMsgBufferSpace
(
pMultiMeta
,
pList
,
&
totalMallocLen
,
numOfVgroupList
);
if
(
pMultiMeta
==
NULL
)
{
code
=
TSDB_CODE_MND_OUT_OF_MEMORY
;
goto
_end
;
}
char
*
msg
=
(
char
*
)
pMultiMeta
+
pMultiMeta
->
contLen
;
for
(
int32_t
i
=
0
;
i
<
numOfVgroupList
;
++
i
)
{
char
*
name
=
taosArrayGetP
(
pList
,
i
);
...
...
src/query/src/qExecutor.c
浏览文件 @
c5c3ee4c
...
...
@@ -1305,9 +1305,16 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
continue
;
}
if
(
memcmp
(
pInfo
->
prevData
,
val
,
bytes
)
==
0
)
{
num
++
;
continue
;
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
varDataLen
(
val
)
==
varDataLen
(
pInfo
->
prevData
)
&&
memcmp
(
pInfo
->
prevData
,
val
,
varDataLen
(
val
))
==
0
)
{
num
++
;
continue
;
}
}
else
{
if
(
memcmp
(
pInfo
->
prevData
,
val
,
bytes
))
{
num
++
;
continue
;
}
}
if
(
pQueryAttr
->
stableQuery
&&
pQueryAttr
->
stabledev
&&
(
pRuntimeEnv
->
prevResult
!=
NULL
))
{
...
...
@@ -1416,9 +1423,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
}
static
void
setResultRowKey
(
SResultRow
*
pResultRow
,
char
*
pData
,
int16_t
type
)
{
int64_t
v
=
-
1
;
GET_TYPED_DATA
(
v
,
int64_t
,
type
,
pData
);
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
IS_VAR_DATA_TYPE
(
type
))
{
if
(
pResultRow
->
key
==
NULL
)
{
pResultRow
->
key
=
malloc
(
varDataTLen
(
pData
));
varDataCopy
(
pResultRow
->
key
,
pData
);
...
...
@@ -1426,6 +1431,9 @@ static void setResultRowKey(SResultRow* pResultRow, char* pData, int16_t type) {
assert
(
memcmp
(
pResultRow
->
key
,
pData
,
varDataTLen
(
pData
))
==
0
);
}
}
else
{
int64_t
v
=
-
1
;
GET_TYPED_DATA
(
v
,
int64_t
,
type
,
pData
);
pResultRow
->
win
.
skey
=
v
;
pResultRow
->
win
.
ekey
=
v
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录