Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d59c5809
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看板
提交
d59c5809
编写于
7月 04, 2021
作者:
J
Jun Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make taosHashGetSize thread-safe and rename function
上级
45289aef
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
13 deletion
+30
-13
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+1
-1
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+1
-1
src/client/src/tscServer.c
src/client/src/tscServer.c
+2
-2
src/tsdb/src/tsdbFS.c
src/tsdb/src/tsdbFS.c
+1
-1
src/util/inc/hash.h
src/util/inc/hash.h
+1
-1
src/util/src/hash.c
src/util/src/hash.c
+24
-7
未找到文件。
src/client/src/tscLocal.c
浏览文件 @
d59c5809
...
...
@@ -920,7 +920,7 @@ int tscProcessLocalCmd(SSqlObj *pSql) {
}
else
if
(
pCmd
->
command
==
TSDB_SQL_SHOW_CREATE_DATABASE
)
{
pRes
->
code
=
tscProcessShowCreateDatabase
(
pSql
);
}
else
if
(
pCmd
->
command
==
TSDB_SQL_RESET_CACHE
)
{
taosHash
Empty
(
tscTableMetaInfo
);
taosHash
Clear
(
tscTableMetaInfo
);
pRes
->
code
=
TSDB_CODE_SUCCESS
;
}
else
if
(
pCmd
->
command
==
TSDB_SQL_SERV_VERSION
)
{
pRes
->
code
=
tscProcessServerVer
(
pSql
);
...
...
src/client/src/tscPrepare.c
浏览文件 @
d59c5809
...
...
@@ -1159,7 +1159,7 @@ static void insertBatchClean(STscStmt* pStmt) {
pCmd
->
insertParam
.
pDataBlocks
=
tscDestroyBlockArrayList
(
pCmd
->
insertParam
.
pDataBlocks
);
pCmd
->
insertParam
.
numOfTables
=
0
;
taosHash
Empty
(
pCmd
->
insertParam
.
pTableBlockHashList
);
taosHash
Clear
(
pCmd
->
insertParam
.
pTableBlockHashList
);
tscFreeSqlResult
(
pSql
);
tscFreeSubobj
(
pSql
);
tfree
(
pSql
->
pSubs
);
...
...
src/client/src/tscServer.c
浏览文件 @
d59c5809
...
...
@@ -2309,7 +2309,7 @@ int tscProcessDropDbRsp(SSqlObj *pSql) {
//TODO LOCK DB WHEN MODIFY IT
//pSql->pTscObj->db[0] = 0;
taosHash
Empty
(
tscTableMetaInfo
);
taosHash
Clear
(
tscTableMetaInfo
);
return
0
;
}
...
...
@@ -2340,7 +2340,7 @@ int tscProcessAlterTableMsgRsp(SSqlObj *pSql) {
tfree
(
pTableMetaInfo
->
pTableMeta
);
if
(
isSuperTable
)
{
// if it is a super table, iterate the hashTable and remove all the childTableMeta
taosHash
Empty
(
tscTableMetaInfo
);
taosHash
Clear
(
tscTableMetaInfo
);
}
return
0
;
...
...
src/tsdb/src/tsdbFS.c
浏览文件 @
d59c5809
...
...
@@ -771,7 +771,7 @@ int tsdbLoadMetaCache(STsdbRepo *pRepo, bool recoverMeta) {
int64_t
maxBufSize
=
0
;
SMFInfo
minfo
;
taosHash
Empty
(
pfs
->
metaCache
);
taosHash
Clear
(
pfs
->
metaCache
);
// No meta file, just return
if
(
pfs
->
cstatus
->
pmf
==
NULL
)
return
0
;
...
...
src/util/inc/hash.h
浏览文件 @
d59c5809
...
...
@@ -140,7 +140,7 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
int32_t
taosHashCondTraverse
(
SHashObj
*
pHashObj
,
bool
(
*
fp
)(
void
*
,
void
*
),
void
*
param
);
void
taosHash
Empty
(
SHashObj
*
pHashObj
);
void
taosHash
Clear
(
SHashObj
*
pHashObj
);
/**
* clean up hash table
...
...
src/util/src/hash.c
浏览文件 @
d59c5809
...
...
@@ -144,6 +144,14 @@ static FORCE_INLINE SHashNode *doUpdateHashNode(SHashObj *pHashObj, SHashEntry*
*/
static
void
pushfrontNodeInEntryList
(
SHashEntry
*
pEntry
,
SHashNode
*
pNode
);
/**
* Check whether the hash table is empty or not.
*
* @param pHashObj the hash table object
* @return if the hash table is empty or not
*/
static
FORCE_INLINE
bool
taosHashTableEmpty
(
const
SHashObj
*
pHashObj
);
/**
* Get the next element in hash table for iterator
* @param pIter
...
...
@@ -195,7 +203,16 @@ void taosHashSetEqualFp(SHashObj *pHashObj, _equal_fn_t fp) {
}
}
int32_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
)
{
return
(
int32_t
)((
pHashObj
==
NULL
)
?
0
:
pHashObj
->
size
);
}
int32_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
)
{
if
(
!
pHashObj
)
{
return
0
;
}
return
(
int32_t
)
atomic_load_64
(
&
pHashObj
->
size
);
}
static
FORCE_INLINE
bool
taosHashTableEmpty
(
const
SHashObj
*
pHashObj
)
{
return
taosHashGetSize
(
pHashObj
)
==
0
;
}
int32_t
taosHashPut
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
*
data
,
size_t
size
)
{
uint32_t
hashVal
=
(
*
pHashObj
->
hashFp
)(
key
,
(
uint32_t
)
keyLen
);
...
...
@@ -281,7 +298,7 @@ void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen) {
}
void
*
taosHashGetClone
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
(
*
fp
)(
void
*
),
void
*
d
,
size_t
dsize
)
{
if
(
pHashObj
->
size
<=
0
||
keyLen
==
0
||
key
==
NULL
)
{
if
(
taosHashTableEmpty
(
pHashObj
)
||
keyLen
==
0
||
key
==
NULL
)
{
return
NULL
;
}
...
...
@@ -338,7 +355,7 @@ int32_t taosHashRemove(SHashObj *pHashObj, const void *key, size_t keyLen) {
}
int32_t
taosHashRemoveWithData
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
*
data
,
size_t
dsize
)
{
if
(
pHashObj
==
NULL
||
pHashObj
->
size
<=
0
)
{
if
(
pHashObj
==
NULL
||
taosHashTableEmpty
(
pHashObj
)
)
{
return
-
1
;
}
...
...
@@ -405,7 +422,7 @@ int32_t taosHashRemoveWithData(SHashObj *pHashObj, const void *key, size_t keyLe
}
int32_t
taosHashCondTraverse
(
SHashObj
*
pHashObj
,
bool
(
*
fp
)(
void
*
,
void
*
),
void
*
param
)
{
if
(
pHashObj
==
NULL
||
pHashObj
->
size
==
0
)
{
if
(
pHashObj
==
NULL
||
taosHashTableEmpty
(
pHashObj
)
)
{
return
0
;
}
...
...
@@ -478,7 +495,7 @@ int32_t taosHashCondTraverse(SHashObj *pHashObj, bool (*fp)(void *, void *), voi
return
0
;
}
void
taosHash
Empty
(
SHashObj
*
pHashObj
)
{
void
taosHash
Clear
(
SHashObj
*
pHashObj
)
{
if
(
pHashObj
==
NULL
)
{
return
;
}
...
...
@@ -517,7 +534,7 @@ void taosHashCleanup(SHashObj *pHashObj) {
return
;
}
taosHash
Empty
(
pHashObj
);
taosHash
Clear
(
pHashObj
);
tfree
(
pHashObj
->
hashList
);
// destroy mem block
...
...
@@ -535,7 +552,7 @@ void taosHashCleanup(SHashObj *pHashObj) {
// for profile only
int32_t
taosHashGetMaxOverflowLinkLength
(
const
SHashObj
*
pHashObj
)
{
if
(
pHashObj
==
NULL
||
pHashObj
->
size
==
0
)
{
if
(
pHashObj
==
NULL
||
taosHashTableEmpty
(
pHashObj
)
)
{
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录