Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
78c3ec87
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,发现更多精彩内容 >>
提交
78c3ec87
编写于
12月 25, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225] refactor: 1. reduce hash node size. 2. function remained.
上级
5708590b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
36 addition
and
33 deletion
+36
-33
src/client/inc/tscLocalMerge.h
src/client/inc/tscLocalMerge.h
+0
-6
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+9
-8
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+7
-8
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+10
-1
src/util/inc/hash.h
src/util/inc/hash.h
+6
-6
src/util/src/hash.c
src/util/src/hash.c
+2
-2
src/util/src/tcache.c
src/util/src/tcache.c
+1
-1
src/vnode/src/vnodeMgmt.c
src/vnode/src/vnodeMgmt.c
+1
-1
未找到文件。
src/client/inc/tscLocalMerge.h
浏览文件 @
78c3ec87
...
...
@@ -38,12 +38,6 @@ typedef struct SLocalDataSource {
tFilePage
filePage
;
}
SLocalDataSource
;
enum
{
TSC_LOCALREDUCE_READY
=
0x0
,
TSC_LOCALREDUCE_IN_PROGRESS
=
0x1
,
TSC_LOCALREDUCE_TOBE_FREED
=
0x2
,
};
typedef
struct
SLocalReducer
{
SLocalDataSource
**
pLocalDataSrc
;
int32_t
numOfBuffer
;
...
...
src/client/inc/tsclient.h
浏览文件 @
78c3ec87
...
...
@@ -308,6 +308,7 @@ typedef struct STscObj {
SRpcCorEpSet
*
tscCorMgmtEpSet
;
void
*
pDnodeConn
;
pthread_mutex_t
mutex
;
int32_t
numOfObj
;
// number of sqlObj from this tscObj
}
STscObj
;
typedef
struct
SSubqueryState
{
...
...
@@ -478,14 +479,14 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
}
}
extern
SCacheObj
*
tscMetaCache
;
extern
int
tscObjRef
;
extern
void
*
tscTmr
;
extern
void
*
tscQhandle
;
extern
int
tscKeepConn
[]
;
extern
int
tscNumOfThreads
;
extern
int
tscRefId
;
extern
SCacheObj
*
tscMetaCache
;
extern
int
tscObjRef
;
extern
void
*
tscTmr
;
extern
void
*
tscQhandle
;
extern
int
tscKeepConn
[]
;
extern
int
tscRefId
;
extern
int
tscNumOfObj
;
// number of existed sqlObj in current process.
extern
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
);
...
...
src/client/src/tscSystem.c
浏览文件 @
78c3ec87
...
...
@@ -31,17 +31,16 @@
#include "tlocale.h"
// global, not configurable
SCacheObj
*
tscMetaCache
;
SCacheObj
*
tscMetaCache
;
// table meta cache
SHashObj
*
tscHashMap
;
// hash map to keep the global vgroup info
int
tscObjRef
=
-
1
;
void
*
tscTmr
;
void
*
tscQhandle
;
void
*
tscCheckDiskUsageTmr
;
void
*
tscTmr
;
void
*
tscQhandle
;
void
*
tscCheckDiskUsageTmr
;
int
tscRefId
=
-
1
;
int
tscNumOfThreads
;
int
tscNumOfObj
=
0
;
// number of sqlObj in current process.
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
//void tscUpdateEpSet(void *ahandle, SRpcEpSet *pEpSet);
void
tscCheckDiskUsage
(
void
*
UNUSED_PARAM
(
para
),
void
*
UNUSED_PARAM
(
param
))
{
taosGetDisk
();
...
...
@@ -114,7 +113,7 @@ void taos_init_imp(void) {
int
queueSize
=
tsMaxConnections
*
2
;
double
factor
=
(
tscEmbedded
==
0
)
?
2
.
0
:
4
.
0
;
tscNumOfThreads
=
(
int
)(
tsNumOfCores
*
tsNumOfThreadsPerCore
/
factor
);
int32_t
tscNumOfThreads
=
(
int
)(
tsNumOfCores
*
tsNumOfThreadsPerCore
/
factor
);
if
(
tscNumOfThreads
<
2
)
{
tscNumOfThreads
=
2
;
}
...
...
src/client/src/tscUtil.c
浏览文件 @
78c3ec87
...
...
@@ -458,9 +458,14 @@ void tscFreeRegisteredSqlObj(void *pSql) {
SSqlObj
*
p
=
*
(
SSqlObj
**
)
pSql
;
STscObj
*
pTscObj
=
p
->
pTscObj
;
assert
(
p
->
self
!=
0
);
assert
(
RID_VALID
(
p
->
self
));
tscFreeSqlObj
(
p
);
taosReleaseRef
(
tscRefId
,
pTscObj
->
rid
);
int32_t
num
=
atomic_sub_fetch_32
(
&
pTscObj
->
numOfObj
,
1
);
int32_t
total
=
atomic_sub_fetch_32
(
&
tscNumOfObj
,
1
);
tscDebug
(
"%p free SqlObj, total in tscObj:%d, total:%d"
,
pSql
,
num
,
total
);
}
void
tscFreeTableMetaHelper
(
void
*
pTableMeta
)
{
...
...
@@ -1905,6 +1910,10 @@ void tscResetForNextRetrieve(SSqlRes* pRes) {
void
registerSqlObj
(
SSqlObj
*
pSql
)
{
taosAcquireRef
(
tscRefId
,
pSql
->
pTscObj
->
rid
);
pSql
->
self
=
taosAddRef
(
tscObjRef
,
pSql
);
int32_t
num
=
atomic_add_fetch_32
(
&
pSql
->
pTscObj
->
numOfObj
,
1
);
int32_t
total
=
atomic_add_fetch_32
(
&
tscNumOfObj
,
1
);
tscDebug
(
"%p new SqlObj, total in tscObj:%d, total:%d"
,
pSql
,
num
,
total
);
}
SSqlObj
*
createSimpleSubObj
(
SSqlObj
*
pSql
,
void
(
*
fp
)(),
void
*
param
,
int32_t
cmd
)
{
...
...
src/util/inc/hash.h
浏览文件 @
78c3ec87
...
...
@@ -32,11 +32,11 @@ typedef void (*_hash_free_fn_t)(void *param);
typedef
struct
SHashNode
{
struct
SHashNode
*
next
;
uint32_t
hashVal
;
// the hash value of key
uint32_t
keyLen
;
// length of the key
size_t
dataLen
;
// length of data
int8_t
count
;
// reference count
int8_t
removed
;
// flag to indicate removed
uint32_t
hashVal
;
// the hash value of key
uint32_t
dataLen
;
// length of data
uint32_t
keyLen
;
// length of the key
int8_t
removed
;
// flag to indicate removed
int8_t
count
;
// reference count
char
data
[];
}
SHashNode
;
...
...
@@ -115,7 +115,7 @@ void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen);
* @param dsize
* @return
*/
void
*
taosHashGetC
B
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
(
*
fp
)(
void
*
),
void
*
d
,
size_t
dsize
);
void
*
taosHashGetC
lone
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
(
*
fp
)(
void
*
),
void
*
d
,
size_t
dsize
);
/**
* remove item with the specified key
...
...
src/util/src/hash.c
浏览文件 @
78c3ec87
...
...
@@ -271,10 +271,10 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, void *da
}
void
*
taosHashGet
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
)
{
return
taosHashGetC
B
(
pHashObj
,
key
,
keyLen
,
NULL
,
NULL
,
0
);
return
taosHashGetC
lone
(
pHashObj
,
key
,
keyLen
,
NULL
,
NULL
,
0
);
}
void
*
taosHashGetC
B
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
(
*
fp
)(
void
*
),
void
*
d
,
size_t
dsize
)
{
void
*
taosHashGetC
lone
(
SHashObj
*
pHashObj
,
const
void
*
key
,
size_t
keyLen
,
void
(
*
fp
)(
void
*
),
void
*
d
,
size_t
dsize
)
{
if
(
pHashObj
->
size
<=
0
||
keyLen
==
0
||
key
==
NULL
)
{
return
NULL
;
}
...
...
src/util/src/tcache.c
浏览文件 @
78c3ec87
...
...
@@ -278,7 +278,7 @@ void *taosCacheAcquireByKey(SCacheObj *pCacheObj, const void *key, size_t keyLen
}
SCacheDataNode
*
ptNode
=
NULL
;
taosHashGetC
B
(
pCacheObj
->
pHashTable
,
key
,
keyLen
,
incRefFn
,
&
ptNode
,
sizeof
(
void
*
));
taosHashGetC
lone
(
pCacheObj
->
pHashTable
,
key
,
keyLen
,
incRefFn
,
&
ptNode
,
sizeof
(
void
*
));
void
*
pData
=
(
ptNode
!=
NULL
)
?
ptNode
->
data
:
NULL
;
...
...
src/vnode/src/vnodeMgmt.c
浏览文件 @
78c3ec87
...
...
@@ -91,7 +91,7 @@ static void vnodeIncRef(void *ptNode) {
void
*
vnodeAcquire
(
int32_t
vgId
)
{
SVnodeObj
**
ppVnode
=
NULL
;
if
(
tsVnodesHash
!=
NULL
)
{
ppVnode
=
taosHashGetC
B
(
tsVnodesHash
,
&
vgId
,
sizeof
(
int32_t
),
vnodeIncRef
,
NULL
,
sizeof
(
void
*
));
ppVnode
=
taosHashGetC
lone
(
tsVnodesHash
,
&
vgId
,
sizeof
(
int32_t
),
vnodeIncRef
,
NULL
,
sizeof
(
void
*
));
}
if
(
ppVnode
==
NULL
||
*
ppVnode
==
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录