Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
67993761
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
67993761
编写于
2月 28, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
d3b18593
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
33 addition
and
42 deletion
+33
-42
include/util/tcache.h
include/util/tcache.h
+0
-1
include/util/tchecksum.h
include/util/tchecksum.h
+0
-1
include/util/tidpool.h
include/util/tidpool.h
+17
-7
include/util/tlog.h
include/util/tlog.h
+3
-3
include/util/tworker.h
include/util/tworker.h
+1
-0
source/libs/index/inc/indexInt.h
source/libs/index/inc/indexInt.h
+1
-0
source/util/src/tidpool.c
source/util/src/tidpool.c
+11
-30
未找到文件。
include/util/tcache.h
浏览文件 @
67993761
...
...
@@ -17,7 +17,6 @@
#define _TD_UTIL_CACHE_H_
#include "thash.h"
#include "tlockfree.h"
#ifdef __cplusplus
extern
"C"
{
...
...
include/util/tchecksum.h
浏览文件 @
67993761
...
...
@@ -17,7 +17,6 @@
#define _TD_UTIL_CHECKSUM_H_
#include "tcrc32c.h"
#include "tutil.h"
#ifdef __cplusplus
extern
"C"
{
...
...
include/util/tidpool.h
浏览文件 @
67993761
...
...
@@ -16,18 +16,28 @@
#ifndef _TD_UTIL_IDPOOL_H_
#define _TD_UTIL_IDPOOL_H_
#include "os.h"
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
struct
{
int32_t
maxId
;
int32_t
numOfFree
;
int32_t
freeSlot
;
bool
*
freeList
;
pthread_mutex_t
mutex
;
}
id_pool_t
;
void
*
taosInitIdPool
(
int32_t
maxId
);
int32_t
taosUpdateIdPool
(
void
*
handle
,
int32_t
maxId
);
int32_t
taosIdPoolMaxSize
(
void
*
handle
);
int32_t
taosAllocateId
(
void
*
handle
);
void
taosFreeId
(
void
*
handle
,
int32_t
id
);
void
taosIdPoolCleanUp
(
void
*
handle
);
int32_t
taosIdPoolNumOfUsed
(
void
*
handle
);
bool
taosIdPoolMarkStatus
(
void
*
handle
,
int32_t
id
);
int32_t
taosUpdateIdPool
(
id_pool_t
*
handle
,
int32_t
maxId
);
int32_t
taosIdPoolMaxSize
(
id_pool_t
*
handle
);
int32_t
taosAllocateId
(
id_pool_t
*
handle
);
void
taosFreeId
(
id_pool_t
*
handle
,
int32_t
id
);
void
taosIdPoolCleanUp
(
id_pool_t
*
handle
);
int32_t
taosIdPoolNumOfUsed
(
id_pool_t
*
handle
);
bool
taosIdPoolMarkStatus
(
id_pool_t
*
handle
,
int32_t
id
);
#ifdef __cplusplus
}
...
...
include/util/tlog.h
浏览文件 @
67993761
...
...
@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TD_UTIL_LOG_H
#define _TD_UTIL_LOG_H
#ifndef _TD_UTIL_LOG_H
_
#define _TD_UTIL_LOG_H
_
#include "os.h"
...
...
@@ -84,4 +84,4 @@ extern int8_t tscEmbeddedInUtil;
}
#endif
#endif
/*_TD_UTIL_LOG_H*/
#endif
/*_TD_UTIL_LOG_H
_
*/
include/util/tworker.h
浏览文件 @
67993761
...
...
@@ -15,6 +15,7 @@
#ifndef _TD_UTIL_WORKER_H_
#define _TD_UTIL_WORKER_H_
#include "tqueue.h"
#ifdef __cplusplus
...
...
source/libs/index/inc/indexInt.h
浏览文件 @
67993761
...
...
@@ -24,6 +24,7 @@
#include "tchecksum.h"
#include "thash.h"
#include "tlog.h"
#include "tutil.h"
#ifdef USE_LUCENE
#include <lucene++/Lucene_c.h>
...
...
source/util/src/tidpool.c
浏览文件 @
67993761
...
...
@@ -14,16 +14,9 @@
*/
#define _DEFAULT_SOURCE
#include "tidpool.h"
#include "tlog.h"
typedef
struct
{
int32_t
maxId
;
int32_t
numOfFree
;
int32_t
freeSlot
;
bool
*
freeList
;
pthread_mutex_t
mutex
;
}
id_pool_t
;
void
*
taosInitIdPool
(
int32_t
maxId
)
{
id_pool_t
*
pIdPool
=
calloc
(
1
,
sizeof
(
id_pool_t
));
if
(
pIdPool
==
NULL
)
return
NULL
;
...
...
@@ -45,11 +38,8 @@ void *taosInitIdPool(int32_t maxId) {
return
pIdPool
;
}
int32_t
taosAllocateId
(
void
*
handle
)
{
id_pool_t
*
pIdPool
=
handle
;
if
(
handle
==
NULL
)
{
return
-
1
;
}
int32_t
taosAllocateId
(
id_pool_t
*
pIdPool
)
{
if
(
pIdPool
==
NULL
)
return
-
1
;
int32_t
slot
=
-
1
;
pthread_mutex_lock
(
&
pIdPool
->
mutex
);
...
...
@@ -70,9 +60,8 @@ int32_t taosAllocateId(void *handle) {
return
slot
+
1
;
}
void
taosFreeId
(
void
*
handle
,
int32_t
id
)
{
id_pool_t
*
pIdPool
=
handle
;
if
(
handle
==
NULL
)
return
;
void
taosFreeId
(
id_pool_t
*
pIdPool
,
int32_t
id
)
{
if
(
pIdPool
==
NULL
)
return
;
pthread_mutex_lock
(
&
pIdPool
->
mutex
);
...
...
@@ -85,9 +74,7 @@ void taosFreeId(void *handle, int32_t id) {
pthread_mutex_unlock
(
&
pIdPool
->
mutex
);
}
void
taosIdPoolCleanUp
(
void
*
handle
)
{
id_pool_t
*
pIdPool
=
handle
;
void
taosIdPoolCleanUp
(
id_pool_t
*
pIdPool
)
{
if
(
pIdPool
==
NULL
)
return
;
uDebug
(
"pool:%p is cleaned"
,
pIdPool
);
...
...
@@ -101,9 +88,7 @@ void taosIdPoolCleanUp(void *handle) {
free
(
pIdPool
);
}
int32_t
taosIdPoolNumOfUsed
(
void
*
handle
)
{
id_pool_t
*
pIdPool
=
handle
;
int32_t
taosIdPoolNumOfUsed
(
id_pool_t
*
pIdPool
)
{
pthread_mutex_lock
(
&
pIdPool
->
mutex
);
int32_t
ret
=
pIdPool
->
maxId
-
pIdPool
->
numOfFree
;
pthread_mutex_unlock
(
&
pIdPool
->
mutex
);
...
...
@@ -111,9 +96,8 @@ int32_t taosIdPoolNumOfUsed(void *handle) {
return
ret
;
}
bool
taosIdPoolMarkStatus
(
void
*
handle
,
int32_t
id
)
{
bool
taosIdPoolMarkStatus
(
id_pool_t
*
pIdPool
,
int32_t
id
)
{
bool
ret
=
false
;
id_pool_t
*
pIdPool
=
handle
;
pthread_mutex_lock
(
&
pIdPool
->
mutex
);
int32_t
slot
=
(
id
-
1
)
%
pIdPool
->
maxId
;
...
...
@@ -129,8 +113,7 @@ bool taosIdPoolMarkStatus(void *handle, int32_t id) {
return
ret
;
}
int32_t
taosUpdateIdPool
(
id_pool_t
*
handle
,
int32_t
maxId
)
{
id_pool_t
*
pIdPool
=
(
id_pool_t
*
)
handle
;
int32_t
taosUpdateIdPool
(
id_pool_t
*
pIdPool
,
int32_t
maxId
)
{
if
(
maxId
<=
pIdPool
->
maxId
)
{
return
0
;
}
...
...
@@ -155,9 +138,7 @@ int32_t taosUpdateIdPool(id_pool_t *handle, int32_t maxId) {
return
0
;
}
int32_t
taosIdPoolMaxSize
(
void
*
handle
)
{
id_pool_t
*
pIdPool
=
(
id_pool_t
*
)
handle
;
int32_t
taosIdPoolMaxSize
(
id_pool_t
*
pIdPool
)
{
pthread_mutex_lock
(
&
pIdPool
->
mutex
);
int32_t
ret
=
pIdPool
->
maxId
;
pthread_mutex_unlock
(
&
pIdPool
->
mutex
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录