Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
5f86564a
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,发现更多精彩内容 >>
提交
5f86564a
编写于
5月 13, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[149] fix bug while replace sdb
上级
a23b0b0c
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
3 addition
and
237 deletion
+3
-237
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+0
-1
src/inc/vnode.h
src/inc/vnode.h
+0
-1
src/rpc/src/rpcUdp.c
src/rpc/src/rpcUdp.c
+0
-1
src/util/inc/thash.h
src/util/inc/thash.h
+0
-41
src/util/src/thash.c
src/util/src/thash.c
+0
-192
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+3
-1
未找到文件。
src/dnode/src/dnodeMgmt.c
浏览文件 @
5f86564a
...
...
@@ -173,7 +173,6 @@ static int32_t dnodeOpenVnodes() {
int32_t
numOfVnodes
;
int32_t
status
;
vnodeInit
();
status
=
dnodeGetVnodeList
(
vnodeList
,
&
numOfVnodes
);
if
(
status
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/inc/vnode.h
浏览文件 @
5f86564a
...
...
@@ -35,7 +35,6 @@ typedef struct {
void
*
qhandle
;
//used by query and retrieve msg
}
SRspRet
;
void
vnodeInit
();
int32_t
vnodeCreate
(
SMDCreateVnodeMsg
*
pVnodeCfg
);
int32_t
vnodeDrop
(
int32_t
vgId
);
int32_t
vnodeOpen
(
int32_t
vgId
,
char
*
rootDir
);
...
...
src/rpc/src/rpcUdp.c
浏览文件 @
5f86564a
...
...
@@ -18,7 +18,6 @@
#include "tsystem.h"
#include "ttimer.h"
#include "tutil.h"
#include "thash.h"
#include "rpcLog.h"
#include "rpcHaship.h"
#include "rpcUdp.h"
...
...
src/util/inc/thash.h
已删除
100644 → 0
浏览文件 @
a23b0b0c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_THASH_H
#define TDENGINE_THASH_H
#ifdef __cplusplus
extern
"C"
{
#endif
void
*
taosOpenHash
(
int
maxSessions
,
int
(
*
fp
)(
void
*
,
uint64_t
));
void
taosCloseHash
(
void
*
handle
);
int
taosAddHash
(
void
*
handle
,
uint64_t
,
uint32_t
id
);
void
taosDeleteHash
(
void
*
handle
,
uint64_t
);
int32_t
taosGetIdFromHash
(
void
*
handle
,
uint64_t
);
int
taosHashLong
(
void
*
,
uint64_t
ip
);
uint64_t
taosHashUInt64
(
uint64_t
handle
);
#ifdef __cplusplus
}
#endif
#endif // TDENGINE_THASH_H
src/util/src/thash.c
已删除
100644 → 0
浏览文件 @
a23b0b0c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "os.h"
#include "tmempool.h"
typedef
struct
_long_hash_t
{
unsigned
int
id
;
struct
_long_hash_t
*
prev
;
struct
_long_hash_t
*
next
;
uint64_t
cont
;
}
SLongHash
;
typedef
struct
{
SLongHash
**
longHashList
;
mpool_h
longHashMemPool
;
int
(
*
hashFp
)(
void
*
,
uint64_t
);
int
maxSessions
;
pthread_mutex_t
mutex
;
}
SHashObj
;
uint64_t
taosHashUInt64
(
uint64_t
handle
)
{
uint64_t
hash
=
handle
>>
16
;
hash
+=
handle
&
0xFFFF
;
return
hash
;
}
int
taosHashLong
(
void
*
handle
,
uint64_t
ip
)
{
SHashObj
*
pObj
=
(
SHashObj
*
)
handle
;
int
hash
=
0
;
hash
=
(
int
)(
ip
>>
16
);
hash
+=
(
int
)(
ip
&
0xFFFF
);
hash
=
hash
%
pObj
->
maxSessions
;
return
hash
;
}
int
taosAddHash
(
void
*
handle
,
uint64_t
cont
,
unsigned
int
id
)
{
int
hash
;
SLongHash
*
pNode
;
SHashObj
*
pObj
;
pObj
=
(
SHashObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
maxSessions
==
0
)
return
-
1
;
pthread_mutex_lock
(
&
pObj
->
mutex
);
hash
=
(
*
pObj
->
hashFp
)(
pObj
,
cont
);
pNode
=
(
SLongHash
*
)
taosMemPoolMalloc
(
pObj
->
longHashMemPool
);
pNode
->
cont
=
cont
;
pNode
->
id
=
id
;
pNode
->
prev
=
0
;
pNode
->
next
=
pObj
->
longHashList
[
hash
];
if
(
pObj
->
longHashList
[
hash
]
!=
0
)
(
pObj
->
longHashList
[
hash
])
->
prev
=
pNode
;
pObj
->
longHashList
[
hash
]
=
pNode
;
pthread_mutex_unlock
(
&
pObj
->
mutex
);
return
0
;
}
void
taosDeleteHash
(
void
*
handle
,
uint64_t
cont
)
{
int
hash
;
SLongHash
*
pNode
;
SHashObj
*
pObj
;
pObj
=
(
SHashObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
maxSessions
==
0
)
return
;
hash
=
(
*
pObj
->
hashFp
)(
pObj
,
cont
);
pthread_mutex_lock
(
&
pObj
->
mutex
);
pNode
=
pObj
->
longHashList
[
hash
];
while
(
pNode
)
{
if
(
pNode
->
cont
==
cont
)
break
;
pNode
=
pNode
->
next
;
}
if
(
pNode
)
{
if
(
pNode
->
prev
)
{
pNode
->
prev
->
next
=
pNode
->
next
;
}
else
{
pObj
->
longHashList
[
hash
]
=
pNode
->
next
;
}
if
(
pNode
->
next
)
{
pNode
->
next
->
prev
=
pNode
->
prev
;
}
taosMemPoolFree
(
pObj
->
longHashMemPool
,
(
char
*
)
pNode
);
}
pthread_mutex_unlock
(
&
pObj
->
mutex
);
}
int32_t
taosGetIdFromHash
(
void
*
handle
,
uint64_t
cont
)
{
int
hash
;
SLongHash
*
pNode
;
SHashObj
*
pObj
;
pObj
=
(
SHashObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
maxSessions
==
0
)
return
-
1
;
hash
=
(
*
pObj
->
hashFp
)(
pObj
,
cont
);
pthread_mutex_lock
(
&
pObj
->
mutex
);
pNode
=
pObj
->
longHashList
[
hash
];
while
(
pNode
)
{
if
(
pNode
->
cont
==
cont
)
{
break
;
}
pNode
=
pNode
->
next
;
}
pthread_mutex_unlock
(
&
pObj
->
mutex
);
if
(
pNode
)
return
(
int32_t
)
pNode
->
id
;
return
-
1
;
}
void
*
taosOpenHash
(
int
maxSessions
,
int
(
*
fp
)(
void
*
,
uint64_t
))
{
SLongHash
**
longHashList
;
mpool_h
longHashMemPool
;
SHashObj
*
pObj
;
longHashMemPool
=
taosMemPoolInit
(
maxSessions
,
sizeof
(
SLongHash
));
if
(
longHashMemPool
==
0
)
return
NULL
;
longHashList
=
calloc
(
sizeof
(
SLongHash
*
),
(
size_t
)
maxSessions
);
if
(
longHashList
==
0
)
{
taosMemPoolCleanUp
(
longHashMemPool
);
return
NULL
;
}
pObj
=
malloc
(
sizeof
(
SHashObj
));
if
(
pObj
==
NULL
)
{
taosMemPoolCleanUp
(
longHashMemPool
);
free
(
longHashList
);
return
NULL
;
}
pObj
->
maxSessions
=
maxSessions
;
pObj
->
longHashMemPool
=
longHashMemPool
;
pObj
->
longHashList
=
longHashList
;
pObj
->
hashFp
=
fp
;
pthread_mutex_init
(
&
pObj
->
mutex
,
NULL
);
return
pObj
;
}
void
taosCloseHash
(
void
*
handle
)
{
SHashObj
*
pObj
;
pObj
=
(
SHashObj
*
)
handle
;
if
(
pObj
==
NULL
||
pObj
->
maxSessions
==
0
)
return
;
pthread_mutex_lock
(
&
pObj
->
mutex
);
if
(
pObj
->
longHashMemPool
)
taosMemPoolCleanUp
(
pObj
->
longHashMemPool
);
if
(
pObj
->
longHashList
)
free
(
pObj
->
longHashList
);
pthread_mutex_unlock
(
&
pObj
->
mutex
);
pthread_mutex_destroy
(
&
pObj
->
mutex
);
memset
(
pObj
,
0
,
sizeof
(
SHashObj
));
free
(
pObj
);
}
src/vnode/src/vnodeMain.c
浏览文件 @
5f86564a
...
...
@@ -54,7 +54,7 @@ int syncGetNodesRole(tsync_h shandle, SNodesRole * cfg) { return 0; }
void
syncConfirmForward
(
tsync_h
shandle
,
uint64_t
version
,
int32_t
code
)
{}
#endif
void
vnodeInit
()
{
static
void
vnodeInit
()
{
vnodeInitWriteFp
();
vnodeInitReadFp
();
...
...
@@ -299,6 +299,8 @@ void vnodeRelease(void *pVnodeRaw) {
}
void
*
vnodeGetVnode
(
int32_t
vgId
)
{
if
(
tsDnodeVnodesHash
==
NULL
)
return
NULL
;
SVnodeObj
**
ppVnode
=
(
SVnodeObj
**
)
taosHashGet
(
tsDnodeVnodesHash
,
(
const
char
*
)
&
vgId
,
sizeof
(
int32_t
));
if
(
ppVnode
==
NULL
||
*
ppVnode
==
NULL
)
{
terrno
=
TSDB_CODE_INVALID_VGROUP_ID
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录