Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
dc76f2e9
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看板
提交
dc76f2e9
编写于
4月 18, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: refactor hash module to invoke the freeFp when destroying the hash node.
上级
ea8832ba
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
12 deletion
+12
-12
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-4
source/util/src/thash.c
source/util/src/thash.c
+11
-8
未找到文件。
source/libs/executor/src/executorimpl.c
浏览文件 @
dc76f2e9
...
...
@@ -20,23 +20,19 @@
#include "tname.h"
#include "os.h"
#include "parser.h"
#include "tdatablock.h"
#include "texception.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tsort.h"
#include "ttime.h"
#include "executorimpl.h"
#include "function.h"
#include "query.h"
#include "tcompare.h"
#include "tcompression.h"
#include "thash.h"
#include "vnode.h"
#include "ttypes.h"
#include "vnode.h"
#define IS_MAIN_SCAN(runtime) ((runtime)->scanFlag == MAIN_SCAN)
#define IS_REVERSE_SCAN(runtime) ((runtime)->scanFlag == REVERSE_SCAN)
...
...
@@ -4879,6 +4875,7 @@ bool aggDecodeResultRow(SOperatorInfo* pOperator, SAggSupporter *pSup, SOptrBasi
if
(
!
resultRow
)
{
longjmp
(
pOperator
->
pTaskInfo
->
env
,
TSDB_CODE_TSC_INVALID_INPUT
);
}
// add a new result set for a new group
SResultRowPosition
pos
=
{.
pageId
=
resultRow
->
pageId
,
.
offset
=
resultRow
->
offset
};
taosHashPut
(
pSup
->
pResultRowHashTable
,
result
+
offset
,
keyLen
,
&
pos
,
sizeof
(
SResultRowPosition
));
...
...
source/util/src/thash.c
浏览文件 @
dc76f2e9
...
...
@@ -31,9 +31,12 @@
#define GET_HASH_NODE_DATA(_n) ((char*)(_n) + sizeof(SHashNode))
#define GET_HASH_PNODE(_n) ((SHashNode *)((char*)(_n) - sizeof(SHashNode)))
#define FREE_HASH_NODE(_n) \
do { \
taosMemoryFreeClear(_n); \
#define FREE_HASH_NODE(_fp, _n) \
do { \
if (_fp != NULL) { \
(_fp)(_n); \
} \
taosMemoryFreeClear(_n); \
} while (0);
struct
SHashNode
{
...
...
@@ -195,7 +198,7 @@ static FORCE_INLINE void doUpdateHashNode(SHashObj *pHashObj, SHashEntry* pe, SH
if
(
pNode
->
refCount
<=
0
)
{
pNewNode
->
next
=
pNode
->
next
;
FREE_HASH_NODE
(
pNode
);
FREE_HASH_NODE
(
p
HashObj
->
freeFp
,
p
Node
);
}
else
{
pNewNode
->
next
=
pNode
;
pe
->
num
++
;
...
...
@@ -310,7 +313,7 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, const vo
return
-
1
;
}
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
(
uint32_t
)
keyLen
);
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
(
uint32_t
)
keyLen
);
// need the resize process, write lock applied
if
(
HASH_NEED_RESIZE
(
pHashObj
))
{
...
...
@@ -523,7 +526,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) {
pe
->
num
--
;
atomic_sub_fetch_64
(
&
pHashObj
->
size
,
1
);
FREE_HASH_NODE
(
pNode
);
FREE_HASH_NODE
(
p
HashObj
->
freeFp
,
p
Node
);
}
}
else
{
prevNode
=
pNode
;
...
...
@@ -558,7 +561,7 @@ void taosHashClear(SHashObj *pHashObj) {
while
(
pNode
)
{
pNext
=
pNode
->
next
;
FREE_HASH_NODE
(
pNode
);
FREE_HASH_NODE
(
p
HashObj
->
freeFp
,
p
Node
);
pNode
=
pNext
;
}
...
...
@@ -769,7 +772,7 @@ static void *taosHashReleaseNode(SHashObj *pHashObj, void *p, int *slot) {
pe
->
num
--
;
atomic_sub_fetch_64
(
&
pHashObj
->
size
,
1
);
FREE_HASH_NODE
(
pOld
);
FREE_HASH_NODE
(
p
HashObj
->
freeFp
,
p
Old
);
}
}
else
{
// uError("pNode:%p data:%p is not there!!!", pNode, p);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录