Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
94d96109
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
94d96109
编写于
12月 08, 2020
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
[TD-225]merge develop.
上级
445e2cf5
48ba8aeb
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
44 addition
and
100 deletion
+44
-100
src/balance/src/bnMain.c
src/balance/src/bnMain.c
+9
-1
src/util/src/tqueue.c
src/util/src/tqueue.c
+1
-1
src/vnode/inc/vnodeMain.h
src/vnode/inc/vnodeMain.h
+1
-0
src/vnode/inc/vnodeWorker.h
src/vnode/inc/vnodeWorker.h
+2
-2
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+10
-69
src/vnode/src/vnodeMgmt.c
src/vnode/src/vnodeMgmt.c
+1
-1
src/vnode/src/vnodeRead.c
src/vnode/src/vnodeRead.c
+1
-3
src/vnode/src/vnodeWorker.c
src/vnode/src/vnodeWorker.c
+19
-23
未找到文件。
src/balance/src/bnMain.c
浏览文件 @
94d96109
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "tref.h"
#include "tsync.h"
#include "tglobal.h"
#include "dnode.h"
...
...
@@ -28,7 +29,9 @@
#include "mnodeUser.h"
#include "mnodeVgroup.h"
static
SBnMgmt
tsBnMgmt
;;
extern
int64_t
tsDnodeRid
;
extern
int64_t
tsSdbRid
;
static
SBnMgmt
tsBnMgmt
;
static
void
bnMonitorDnodeModule
();
static
void
bnLock
()
{
...
...
@@ -529,6 +532,9 @@ void bnCheckStatus() {
void
*
pIter
=
NULL
;
SDnodeObj
*
pDnode
=
NULL
;
void
*
dnodeSdb
=
taosAcquireRef
(
tsSdbRid
,
tsDnodeRid
);
if
(
dnodeSdb
==
NULL
)
return
;
while
(
1
)
{
pIter
=
mnodeGetNextDnode
(
pIter
,
&
pDnode
);
if
(
pDnode
==
NULL
)
break
;
...
...
@@ -543,6 +549,8 @@ void bnCheckStatus() {
}
mnodeDecDnodeRef
(
pDnode
);
}
taosReleaseRef
(
tsSdbRid
,
tsDnodeRid
);
}
void
bnCheckModules
()
{
...
...
src/util/src/tqueue.c
浏览文件 @
94d96109
...
...
@@ -366,7 +366,7 @@ int taosReadQitemFromQset(taos_qset param, int *type, void **pitem, void **phand
queue
->
numOfItems
--
;
atomic_sub_fetch_32
(
&
qset
->
numOfItems
,
1
);
code
=
1
;
uTrace
(
"item:%p is read out from queue:%p, type:%d items:%d"
,
*
pitem
,
queue
,
*
type
,
queue
->
numOfItems
);
uTrace
(
"item:%p is read out from queue:%p, type:%d items:%d"
,
*
pitem
,
queue
,
pNode
->
type
,
queue
->
numOfItems
);
}
pthread_mutex_unlock
(
&
queue
->
mutex
);
...
...
src/vnode/inc/vnodeMain.h
浏览文件 @
94d96109
...
...
@@ -28,6 +28,7 @@ int32_t vnodeAlter(void *pVnode, SCreateVnodeMsg *pVnodeCfg);
int32_t
vnodeClose
(
int32_t
vgId
);
int32_t
vnodeReset
(
SVnodeObj
*
pVnode
);
void
vnodeCleanUp
(
SVnodeObj
*
pVnode
);
void
vnodeDestroy
(
SVnodeObj
*
pVnode
);
#ifdef __cplusplus
...
...
src/vnode/inc/vnodeWorker.h
浏览文件 @
94d96109
...
...
@@ -23,8 +23,8 @@ extern "C" {
int32_t
vnodeInitMWorker
();
void
vnodeCleanupMWorker
();
int32_t
vnode
OpenInMWorker
(
int32_t
vgId
,
void
*
rpcHandl
e
);
int32_t
vnode
CleanupInMWorker
(
int32_t
vgId
,
void
*
rpcHandl
e
);
int32_t
vnode
CleanupInMWorker
(
SVnodeObj
*
pVnod
e
);
int32_t
vnode
DestroyInMWorker
(
SVnodeObj
*
pVnod
e
);
#ifdef __cplusplus
}
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
94d96109
...
...
@@ -25,71 +25,12 @@
#include "vnodeStatus.h"
#include "vnodeSync.h"
#include "vnodeVersion.h"
#include "vnodeMgmt.h"
#include "vnodeWorker.h"
#include "vnodeMain.h"
#include "vnodeCancel.h"
static
SHashObj
*
tsVnodesHash
;
static
void
vnodeCleanUp
(
SVnodeObj
*
pVnode
);
static
int32_t
vnodeProcessTsdbStatus
(
void
*
arg
,
int32_t
status
,
int32_t
eno
);
static
uint32_t
vnodeGetFileInfo
(
int32_t
vgId
,
char
*
name
,
uint32_t
*
index
,
uint32_t
eindex
,
int64_t
*
size
,
uint64_t
*
fversion
);
static
int32_t
vnodeGetWalInfo
(
int32_t
vgId
,
char
*
fileName
,
int64_t
*
fileId
);
static
void
vnodeNotifyRole
(
int32_t
vgId
,
int8_t
role
);
static
void
vnodeCtrlFlow
(
int32_t
vgId
,
int32_t
level
);
static
int32_t
vnodeNotifyFileSynced
(
int32_t
vgId
,
uint64_t
fversion
);
static
void
vnodeConfirmForard
(
int32_t
vgId
,
void
*
wparam
,
int32_t
code
);
static
int32_t
vnodeWriteToCache
(
int32_t
vgId
,
void
*
wparam
,
int32_t
qtype
,
void
*
rparam
);
static
int32_t
vnodeGetVersion
(
int32_t
vgId
,
uint64_t
*
fver
,
uint64_t
*
wver
);
#ifndef _SYNC
int64_t
syncStart
(
const
SSyncInfo
*
info
)
{
return
NULL
;
}
int32_t
syncForwardToPeer
(
int64_t
rid
,
void
*
pHead
,
void
*
mhandle
,
int32_t
qtype
)
{
return
0
;
}
void
syncStop
(
int64_t
rid
)
{}
int32_t
syncReconfig
(
int64_t
rid
,
const
SSyncCfg
*
cfg
)
{
return
0
;
}
int32_t
syncGetNodesRole
(
int64_t
rid
,
SNodesRole
*
cfg
)
{
return
0
;
}
void
syncConfirmForward
(
int64_t
rid
,
uint64_t
version
,
int32_t
code
)
{}
#endif
char
*
vnodeStatus
[]
=
{
"init"
,
"ready"
,
"closing"
,
"updating"
,
"reset"
};
int32_t
vnodeInitResources
()
{
int32_t
code
=
syncInit
();
if
(
code
!=
0
)
return
code
;
vnodeInitWriteFp
();
vnodeInitReadFp
();
vnodeInitCWorker
();
tsVnodesHash
=
taosHashInit
(
TSDB_MIN_VNODES
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
true
,
HASH_ENTRY_LOCK
);
if
(
tsVnodesHash
==
NULL
)
{
vError
(
"failed to init vnode list"
);
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
}
if
(
tsdbInitCommitQueue
(
tsNumOfCommitThreads
)
<
0
)
{
vError
(
"failed to init vnode commit queue"
);
return
terrno
;
}
return
TSDB_CODE_SUCCESS
;
}
void
vnodeCleanupResources
()
{
vnodeCleanupCWorker
();
tsdbDestroyCommitQueue
();
if
(
tsVnodesHash
!=
NULL
)
{
vDebug
(
"vnode list is cleanup"
);
taosHashCleanup
(
tsVnodesHash
);
tsVnodesHash
=
NULL
;
}
syncCleanUp
();
}
static
int32_t
vnodeProcessTsdbStatus
(
void
*
arg
,
int32_t
status
,
int32_t
eno
);
int32_t
vnodeCreate
(
SCreateVnodeMsg
*
pVnodeCfg
)
{
int32_t
code
;
...
...
@@ -171,8 +112,10 @@ int32_t vnodeDrop(int32_t vgId) {
vInfo
(
"vgId:%d, vnode will be dropped, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
pVnode
->
refCount
,
pVnode
);
pVnode
->
dropped
=
1
;
// remove from hash, so new messages wont be consumed
vnodeRemoveFromHash
(
pVnode
);
vnodeRelease
(
pVnode
);
vnodeClean
Up
(
pVnode
);
vnodeClean
upInMWorker
(
pVnode
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -370,6 +313,7 @@ int32_t vnodeOpen(int32_t vgId) {
if
(
pVnode
->
sync
<=
0
)
{
vError
(
"vgId:%d, failed to open sync, replica:%d reason:%s"
,
pVnode
->
vgId
,
pVnode
->
syncCfg
.
replica
,
tstrerror
(
terrno
));
vnodeRemoveFromHash
(
pVnode
);
vnodeCleanUp
(
pVnode
);
return
terrno
;
}
...
...
@@ -383,6 +327,7 @@ int32_t vnodeClose(int32_t vgId) {
if
(
pVnode
==
NULL
)
return
0
;
vDebug
(
"vgId:%d, vnode will be closed, pVnode:%p"
,
pVnode
->
vgId
,
pVnode
);
vnodeRemoveFromHash
(
pVnode
);
vnodeRelease
(
pVnode
);
vnodeCleanUp
(
pVnode
);
...
...
@@ -459,11 +404,7 @@ void vnodeDestroy(SVnodeObj *pVnode) {
tsdbDecCommitRef
(
vgId
);
}
static
void
vnodeCleanUp
(
SVnodeObj
*
pVnode
)
{
// remove from hash, so new messages wont be consumed
vnodeRemoveFromHash
(
pVnode
);
void
vnodeCleanUp
(
SVnodeObj
*
pVnode
)
{
if
(
!
vnodeInInitStatus
(
pVnode
))
{
// it may be in updateing or reset state, then it shall wait
int32_t
i
=
0
;
...
...
src/vnode/src/vnodeMgmt.c
浏览文件 @
94d96109
...
...
@@ -114,7 +114,7 @@ void vnodeRelease(void *vparam) {
}
}
else
{
vDebug
(
"vgId:%d, vnode will be destroyed, refCount:%d pVnode:%p"
,
pVnode
->
vgId
,
refCount
,
pVnode
);
vnodeDestroy
(
pVnode
);
vnodeDestroy
InMWorker
(
pVnode
);
int32_t
count
=
taosHashGetSize
(
tsVnodesHash
);
vDebug
(
"vgId:%d, vnode is destroyed, vnodes:%d"
,
pVnode
->
vgId
,
count
);
}
...
...
src/vnode/src/vnodeRead.c
浏览文件 @
94d96109
...
...
@@ -14,7 +14,7 @@
*/
#define _DEFAULT_SOURCE
#define _NON_BLOCKING_RETRIEVE 0
#include "os.h"
#include "taosmsg.h"
#include "tqueue.h"
...
...
@@ -381,8 +381,6 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
memset
(
pRet
->
rsp
,
0
,
sizeof
(
SRetrieveTableRsp
));
freeHandle
=
true
;
}
else
{
// result is not ready, return immediately
assert
(
buildRes
==
true
);
// Only effects in the non-blocking model
if
(
!
tsHalfCoresForQuery
)
{
if
(
!
buildRes
)
{
...
...
src/vnode/src/vnodeWorker.c
浏览文件 @
94d96109
...
...
@@ -21,10 +21,11 @@
#include "tqueue.h"
#include "tglobal.h"
#include "vnodeWorker.h"
#include "vnodeMain.h"
typedef
enum
{
VNODE_WORKER_ACTION_C
REATE
,
VNODE_WORKER_ACTION_DE
LETE
VNODE_WORKER_ACTION_C
LEANUP
,
VNODE_WORKER_ACTION_DE
STROUY
}
EVMWorkerAction
;
typedef
struct
{
...
...
@@ -132,14 +133,11 @@ void vnodeCleanupMWorker() {
vnodeStopMWorker
();
}
static
int32_t
vnodeWriteIntoMWorker
(
int32_t
vgId
,
EVMWorkerAction
action
,
void
*
rpcHandle
)
{
static
int32_t
vnodeWriteIntoMWorker
(
SVnodeObj
*
pVnode
,
EVMWorkerAction
action
,
void
*
rpcHandle
)
{
SVMWorkerMsg
*
pMsg
=
taosAllocateQitem
(
sizeof
(
SVMWorkerMsg
));
if
(
pMsg
==
NULL
)
return
TSDB_CODE_VND_OUT_OF_MEMORY
;
SVnodeObj
*
pVnode
=
vnodeAcquire
(
vgId
);
if
(
pVnode
==
NULL
)
return
TSDB_CODE_VND_INVALID_VGROUP_ID
;
pMsg
->
vgId
=
vgId
;
pMsg
->
vgId
=
pVnode
->
vgId
;
pMsg
->
pVnode
=
pVnode
;
pMsg
->
rpcHandle
=
rpcHandle
;
pMsg
->
action
=
action
;
...
...
@@ -150,29 +148,27 @@ static int32_t vnodeWriteIntoMWorker(int32_t vgId, EVMWorkerAction action,void *
return
code
;
}
int32_t
vnode
OpenInMWorker
(
int32_t
vgId
,
void
*
rpcHandl
e
)
{
vTrace
(
"vgId:%d, will
open in vmworker"
,
vgId
);
return
vnodeWriteIntoMWorker
(
vgId
,
VNODE_WORKER_ACTION_CREATE
,
rpcHandle
);
int32_t
vnode
CleanupInMWorker
(
SVnodeObj
*
pVnod
e
)
{
vTrace
(
"vgId:%d, will
cleanup in vmworker"
,
pVnode
->
vgId
);
return
vnodeWriteIntoMWorker
(
pVnode
,
VNODE_WORKER_ACTION_CLEANUP
,
NULL
);
}
int32_t
vnode
CleanupInMWorker
(
int32_t
vgId
,
void
*
rpcHandl
e
)
{
vTrace
(
"vgId:%d, will
cleanup in vmworker"
,
vgId
);
return
vnodeWriteIntoMWorker
(
vgId
,
VNODE_WORKER_ACTION_DELETE
,
rpcHandle
);
int32_t
vnode
DestroyInMWorker
(
SVnodeObj
*
pVnod
e
)
{
vTrace
(
"vgId:%d, will
destroy in vmworker"
,
pVnode
->
vgId
);
return
vnodeWriteIntoMWorker
(
pVnode
,
VNODE_WORKER_ACTION_DESTROUY
,
NULL
);
}
static
void
vnodeFreeMWorkerMsg
(
SVMWorkerMsg
*
pMsg
)
{
vTrace
(
"vgId:%d, disposed in vmworker"
,
pMsg
->
vgId
);
vnodeRelease
(
pMsg
->
pVnode
);
taosFreeQitem
(
pMsg
);
}
static
void
vnodeSendVMWorkerRpcRsp
(
SVMWorkerMsg
*
pMsg
)
{
SRpcMsg
rpcRsp
=
{
.
handle
=
pMsg
->
rpcHandle
,
.
code
=
pMsg
->
code
,
}
;
if
(
pMsg
->
rpcHandle
!=
NULL
)
{
SRpcMsg
rpcRsp
=
{.
handle
=
pMsg
->
rpcHandle
,
.
code
=
pMsg
->
code
};
rpcSendResponse
(
&
rpcRsp
);
}
rpcSendResponse
(
&
rpcRsp
);
vnodeFreeMWorkerMsg
(
pMsg
);
}
...
...
@@ -180,11 +176,11 @@ static void vnodeProcessMWorkerMsg(SVMWorkerMsg *pMsg) {
pMsg
->
code
=
0
;
switch
(
pMsg
->
action
)
{
case
VNODE_WORKER_ACTION_C
REATE
:
pMsg
->
code
=
vnodeOpen
(
pMsg
->
vgId
);
case
VNODE_WORKER_ACTION_C
LEANUP
:
vnodeCleanUp
(
pMsg
->
pVnode
);
break
;
case
VNODE_WORKER_ACTION_DE
LETE
:
pMsg
->
code
=
vnodeDrop
(
pMsg
->
vgId
);
case
VNODE_WORKER_ACTION_DE
STROUY
:
vnodeDestroy
(
pMsg
->
pVnode
);
break
;
default:
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录