Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
be5940fe
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
be5940fe
编写于
12月 08, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-2367
上级
b21f78d3
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
30 addition
and
16 deletion
+30
-16
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+26
-12
src/plugins/http/src/httpContext.c
src/plugins/http/src/httpContext.c
+1
-1
src/plugins/http/src/httpSession.c
src/plugins/http/src/httpSession.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
+1
-1
未找到文件。
src/mnode/src/mnodeTable.c
浏览文件 @
be5940fe
...
...
@@ -397,13 +397,14 @@ static void mnodeAddTableIntoStable(SSTableObj *pStable, SCTableObj *pCtable) {
if
(
pStable
->
vgHash
==
NULL
)
{
pStable
->
vgHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_NO_LOCK
);
mDebug
(
"table:%s, create hash:%p"
,
pStable
->
info
.
tableId
,
pStable
->
vgHash
);
}
if
(
pStable
->
vgHash
!=
NULL
)
{
if
(
taosHashGet
(
pStable
->
vgHash
,
&
pCtable
->
vgId
,
sizeof
(
pCtable
->
vgId
))
==
NULL
)
{
taosHashPut
(
pStable
->
vgHash
,
&
pCtable
->
vgId
,
sizeof
(
pCtable
->
vgId
),
&
pCtable
->
vgId
,
sizeof
(
pCtable
->
vgId
));
mDebug
(
"table:%s, vgId:%d is put into stable
vgList
, sizeOfVgList:%d"
,
pStable
->
info
.
tableId
,
pCtable
->
vgId
,
(
int32_t
)
taosHashGetSize
(
pStable
->
vgHash
));
mDebug
(
"table:%s, vgId:%d is put into stable
hash:%p
, sizeOfVgList:%d"
,
pStable
->
info
.
tableId
,
pCtable
->
vgId
,
pStable
->
vgHash
,
taosHashGetSize
(
pStable
->
vgHash
));
}
}
}
...
...
@@ -416,13 +417,14 @@ static void mnodeRemoveTableFromStable(SSTableObj *pStable, SCTableObj *pCtable)
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
pCtable
->
vgId
);
if
(
pVgroup
==
NULL
)
{
taosHashRemove
(
pStable
->
vgHash
,
&
pCtable
->
vgId
,
sizeof
(
pCtable
->
vgId
));
mDebug
(
"table:%s, vgId:%d is remove from stable
vgList,
sizeOfVgList:%d"
,
pStable
->
info
.
tableId
,
pCtable
->
vgId
,
(
int32_t
)
taosHashGetSize
(
pStable
->
vgHash
));
mDebug
(
"table:%s, vgId:%d is remove from stable
hash:%p
sizeOfVgList:%d"
,
pStable
->
info
.
tableId
,
pCtable
->
vgId
,
pStable
->
vgHash
,
taosHashGetSize
(
pStable
->
vgHash
));
}
mnodeDecVgroupRef
(
pVgroup
);
}
static
void
mnodeDestroySuperTable
(
SSTableObj
*
pStable
)
{
mDebug
(
"table:%s, is destroyed, stable hash:%p"
,
pStable
->
info
.
tableId
,
pStable
->
vgHash
);
if
(
pStable
->
vgHash
!=
NULL
)
{
taosHashCleanup
(
pStable
->
vgHash
);
pStable
->
vgHash
=
NULL
;
...
...
@@ -464,6 +466,9 @@ static int32_t mnodeSuperTableActionUpdate(SSdbRow *pRow) {
SSTableObj
*
pNew
=
pRow
->
pObj
;
SSTableObj
*
pTable
=
mnodeGetSuperTable
(
pNew
->
info
.
tableId
);
if
(
pTable
!=
NULL
&&
pTable
!=
pNew
)
{
mDebug
(
"table:%s, will be updated, hash:%p sizeOfVgList:%d, new hash:%p sizeOfVgList:%d"
,
pTable
->
info
.
tableId
,
pTable
->
vgHash
,
taosHashGetSize
(
pTable
->
vgHash
),
pNew
->
vgHash
,
taosHashGetSize
(
pNew
->
vgHash
));
void
*
oldTableId
=
pTable
->
info
.
tableId
;
void
*
oldSchema
=
pTable
->
schema
;
void
*
oldVgHash
=
pTable
->
vgHash
;
...
...
@@ -479,6 +484,9 @@ static int32_t mnodeSuperTableActionUpdate(SSdbRow *pRow) {
free
(
pNew
);
free
(
oldTableId
);
free
(
oldSchema
);
mDebug
(
"table:%s, update finished, hash:%p sizeOfVgList:%d"
,
pTable
->
info
.
tableId
,
pTable
->
vgHash
,
taosHashGetSize
(
pTable
->
vgHash
));
}
mnodeDecTableRef
(
pTable
);
...
...
@@ -783,8 +791,8 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
if
(
pMsg
->
pTable
->
type
==
TSDB_SUPER_TABLE
)
{
SSTableObj
*
pSTable
=
(
SSTableObj
*
)
pMsg
->
pTable
;
mInfo
(
"msg:%p, app:%p table:%s, start to drop stable, uid:%"
PRIu64
", numOfChildTables:%d, sizeOfVgList:%d"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pDrop
->
tableId
,
pSTable
->
uid
,
pSTable
->
numOfTables
,
(
int32_t
)
taosHashGetSize
(
pSTable
->
vgHash
));
mInfo
(
"msg:%p, app:%p table:%s, start to drop stable, uid:%"
PRIu64
", numOfChildTables:%d, sizeOfVgList:%d"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pDrop
->
tableId
,
pSTable
->
uid
,
pSTable
->
numOfTables
,
taosHashGetSize
(
pSTable
->
vgHash
));
return
mnodeProcessDropSuperTableMsg
(
pMsg
);
}
else
{
SCTableObj
*
pCTable
=
(
SCTableObj
*
)
pMsg
->
pTable
;
...
...
@@ -925,7 +933,10 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
if
(
pMsg
==
NULL
)
return
TSDB_CODE_MND_APP_ERROR
;
SSTableObj
*
pStable
=
(
SSTableObj
*
)
pMsg
->
pTable
;
if
(
pStable
->
vgHash
!=
NULL
/*pStable->numOfTables != 0*/
)
{
mInfo
(
"msg:%p, app:%p stable:%s will be dropped, hash:%p sizeOfVgList:%d"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pStable
->
info
.
tableId
,
pStable
->
vgHash
,
taosHashGetSize
(
pStable
->
vgHash
));
if
(
pStable
->
vgHash
!=
NULL
/*pStable->numOfTables != 0*/
)
{
int32_t
*
pVgId
=
taosHashIterate
(
pStable
->
vgHash
,
NULL
);
while
(
pVgId
)
{
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
*
pVgId
);
...
...
@@ -938,8 +949,9 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
pDrop
->
uid
=
htobe64
(
pStable
->
uid
);
mnodeExtractTableName
(
pStable
->
info
.
tableId
,
pDrop
->
tableId
);
mInfo
(
"msg:%p, app:%p stable:%s, send drop stable msg to vgId:%d"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pStable
->
info
.
tableId
,
pVgroup
->
vgId
);
mInfo
(
"msg:%p, app:%p stable:%s, send drop stable msg to vgId:%d, hash:%p sizeOfVgList:%d"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pStable
->
info
.
tableId
,
pVgroup
->
vgId
,
pStable
->
vgHash
,
taosHashGetSize
(
pStable
->
vgHash
));
SRpcEpSet
epSet
=
mnodeGetEpSetFromVgroup
(
pVgroup
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pDrop
,
.
contLen
=
sizeof
(
SDropSTableMsg
),
.
msgType
=
TSDB_MSG_TYPE_MD_DROP_STABLE
};
dnodeSendMsgToDnode
(
&
epSet
,
&
rpcMsg
);
...
...
@@ -1482,8 +1494,8 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) {
pMsg
->
rpcRsp
.
rsp
=
pMeta
;
mDebug
(
"msg:%p, app:%p stable:%s, uid:%"
PRIu64
" table meta is retrieved
"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
p
Table
->
info
.
tableId
,
pTable
->
uid
);
mDebug
(
"msg:%p, app:%p stable:%s, uid:%"
PRIu64
" table meta is retrieved
, sizeOfVgList:%d numOfTables:%d"
,
pMsg
,
p
Msg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
pTable
->
uid
,
taosHashGetSize
(
pTable
->
vgHash
),
pTable
->
numOfTables
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1512,7 +1524,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
char
*
msg
=
(
char
*
)
pRsp
+
sizeof
(
SSTableVgroupRspMsg
);
for
(
int32_t
i
=
0
;
i
<
numOfTable
;
++
i
)
{
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SSTableVgroupMsg
)
+
(
TSDB_TABLE_FNAME_LEN
)
*
i
;
char
*
stableName
=
(
char
*
)
pInfo
+
sizeof
(
SSTableVgroupMsg
)
+
(
TSDB_TABLE_FNAME_LEN
)
*
i
;
SSTableObj
*
pTable
=
mnodeGetSuperTable
(
stableName
);
if
(
pTable
==
NULL
)
{
mError
(
"msg:%p, app:%p stable:%s, not exist while get stable vgroup info"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
stableName
);
...
...
@@ -1533,6 +1545,8 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
msg
+=
sizeof
(
SVgroupsMsg
);
}
else
{
SVgroupsMsg
*
pVgroupMsg
=
(
SVgroupsMsg
*
)
msg
;
mDebug
(
"msg:%p, app:%p stable:%s, hash:%p sizeOfVgList:%d will be returned"
,
pMsg
,
pMsg
->
rpcMsg
.
ahandle
,
pTable
->
info
.
tableId
,
pTable
->
vgHash
,
taosHashGetSize
(
pTable
->
vgHash
));
int32_t
*
pVgId
=
taosHashIterate
(
pTable
->
vgHash
,
NULL
);
int32_t
vgSize
=
0
;
...
...
src/plugins/http/src/httpContext.c
浏览文件 @
be5940fe
...
...
@@ -79,7 +79,7 @@ bool httpInitContexts() {
void
httpCleanupContexts
()
{
if
(
tsHttpServer
.
contextCache
!=
NULL
)
{
SCacheObj
*
cache
=
tsHttpServer
.
contextCache
;
httpInfo
(
"context cache is cleanuping, size:%
"
PRIzu
"
"
,
taosHashGetSize
(
cache
->
pHashTable
));
httpInfo
(
"context cache is cleanuping, size:%
d
"
,
taosHashGetSize
(
cache
->
pHashTable
));
taosCacheCleanup
(
tsHttpServer
.
contextCache
);
tsHttpServer
.
contextCache
=
NULL
;
}
...
...
src/plugins/http/src/httpSession.c
浏览文件 @
be5940fe
...
...
@@ -107,7 +107,7 @@ static void httpDestroySession(void *data) {
void
httpCleanUpSessions
()
{
if
(
tsHttpServer
.
sessionCache
!=
NULL
)
{
SCacheObj
*
cache
=
tsHttpServer
.
sessionCache
;
httpInfo
(
"session cache is cleanuping, size:%
"
PRIzu
"
"
,
taosHashGetSize
(
cache
->
pHashTable
));
httpInfo
(
"session cache is cleanuping, size:%
d
"
,
taosHashGetSize
(
cache
->
pHashTable
));
taosCacheCleanup
(
tsHttpServer
.
sessionCache
);
tsHttpServer
.
sessionCache
=
NULL
;
}
...
...
src/util/inc/hash.h
浏览文件 @
be5940fe
...
...
@@ -82,7 +82,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
* @param pHashObj
* @return
*/
size
_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
);
int32
_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
);
/**
* put element into hash table, if the element with the same key exists, update it
...
...
src/util/src/hash.c
浏览文件 @
be5940fe
...
...
@@ -189,7 +189,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
return
pHashObj
;
}
size_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
)
{
return
(
pHashObj
==
NULL
)
?
0
:
pHashObj
->
size
;
}
int32_t
taosHashGetSize
(
const
SHashObj
*
pHashObj
)
{
return
(
int32_t
)((
pHashObj
==
NULL
)
?
0
:
pHashObj
->
size
)
;
}
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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录