Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a15551d6
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
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看板
提交
a15551d6
编写于
1月 16, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
ca10ef44
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
54 addition
and
51 deletion
+54
-51
include/common/tmsg.h
include/common/tmsg.h
+1
-1
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+3
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+50
-50
未找到文件。
include/common/tmsg.h
浏览文件 @
a15551d6
...
...
@@ -1332,7 +1332,7 @@ typedef struct {
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
int
8_t
ignoreNotExists
;
int
64_t
suid
;
}
SVDropTbReq
;
typedef
struct
{
...
...
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
a15551d6
...
...
@@ -422,6 +422,9 @@ static int32_t dndOpenVnodes(SDnode *pDnode) {
int32_t
threadNum
=
pDnode
->
env
.
numOfCores
;
int32_t
vnodesPerThread
=
numOfVnodes
/
threadNum
+
1
;
#if 1
vnodesPerThread
=
1
;
#endif
SVnodeThread
*
threads
=
calloc
(
threadNum
,
sizeof
(
SVnodeThread
));
for
(
int32_t
t
=
0
;
t
<
threadNum
;
++
t
)
{
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
a15551d6
...
...
@@ -31,16 +31,16 @@ static SSdbRaw *mndStbActionEncode(SStbObj *pStb);
static
SSdbRow
*
mndStbActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndStbActionInsert
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOld
Stb
,
SStbObj
*
pNewStb
);
static
int32_t
mndProces
SMCreateStbReq
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProces
SMAlterStbReq
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProces
SMDropStbReq
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcess
CreateStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcess
AlterStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcess
DropStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessStbMeta
Msg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetStbMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveStb
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOld
,
SStbObj
*
pNew
);
static
int32_t
mndProces
sMCreateStbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProces
sMAlterStbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProces
sMDropStbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcess
VCreateStbRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcess
VAlterStbRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcess
VDropStbRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessStbMeta
Req
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetStbMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveStb
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextStb
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitStb
(
SMnode
*
pMnode
)
{
...
...
@@ -52,13 +52,13 @@ int32_t mndInitStb(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndStbActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndStbActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_STB
,
mndProces
S
MCreateStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_STB
,
mndProces
S
MAlterStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_STB
,
mndProces
S
MDropStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_CREATE_STB_RSP
,
mndProcess
CreateStbIn
Rsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_STB_RSP
,
mndProcess
AlterStbIn
Rsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_DROP_STB_RSP
,
mndProcess
DropStbIn
Rsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STB_META
,
mndProcessStbMeta
Msg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_STB
,
mndProces
s
MCreateStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_STB
,
mndProces
s
MAlterStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_STB
,
mndProces
s
MDropStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_CREATE_STB_RSP
,
mndProcess
VCreateStb
Rsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_STB_RSP
,
mndProcess
VAlterStb
Rsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_DROP_STB_RSP
,
mndProcess
VDropStb
Rsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STB_META
,
mndProcessStbMeta
Req
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_STB
,
mndGetStbMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_STB
,
mndRetrieveStb
);
...
...
@@ -177,27 +177,27 @@ static int32_t mndStbActionDelete(SSdb *pSdb, SStbObj *pStb) {
return
0
;
}
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOld
Stb
,
SStbObj
*
pNewStb
)
{
mTrace
(
"stb:%s, perform update action, old row:%p new row:%p"
,
pOld
Stb
->
name
,
pOldStb
,
pNewStb
);
atomic_exchange_32
(
&
pOld
Stb
->
updateTime
,
pNewStb
->
updateTime
);
atomic_exchange_32
(
&
pOld
Stb
->
version
,
pNewStb
->
version
);
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOld
,
SStbObj
*
pNew
)
{
mTrace
(
"stb:%s, perform update action, old row:%p new row:%p"
,
pOld
->
name
,
pOld
,
pNew
);
atomic_exchange_32
(
&
pOld
->
updateTime
,
pNew
->
updateTime
);
atomic_exchange_32
(
&
pOld
->
version
,
pNew
->
version
);
taosWLockLatch
(
&
pOld
Stb
->
lock
);
pOld
Stb
->
numOfColumns
=
pNewStb
->
numOfColumns
;
pOld
Stb
->
numOfTags
=
pNewStb
->
numOfTags
;
int32_t
totalCols
=
pNew
Stb
->
numOfTags
+
pNewStb
->
numOfColumns
;
taosWLockLatch
(
&
pOld
->
lock
);
pOld
->
numOfColumns
=
pNew
->
numOfColumns
;
pOld
->
numOfTags
=
pNew
->
numOfTags
;
int32_t
totalCols
=
pNew
->
numOfTags
+
pNew
->
numOfColumns
;
int32_t
totalSize
=
totalCols
*
sizeof
(
SSchema
);
if
(
pOld
Stb
->
numOfTags
+
pOldStb
->
numOfColumns
<
totalCols
)
{
if
(
pOld
->
numOfTags
+
pOld
->
numOfColumns
<
totalCols
)
{
void
*
pSchema
=
malloc
(
totalSize
);
if
(
pSchema
!=
NULL
)
{
free
(
pOld
Stb
->
pSchema
);
pOld
Stb
->
pSchema
=
pSchema
;
free
(
pOld
->
pSchema
);
pOld
->
pSchema
=
pSchema
;
}
}
memcpy
(
pOld
Stb
->
pSchema
,
pNewStb
->
pSchema
,
totalSize
);
taosWUnLockLatch
(
&
pOld
Stb
->
lock
);
memcpy
(
pOld
->
pSchema
,
pNew
->
pSchema
,
totalSize
);
taosWUnLockLatch
(
&
pOld
->
lock
);
return
0
;
}
...
...
@@ -215,7 +215,7 @@ void mndReleaseStb(SMnode *pMnode, SStbObj *pStb) {
sdbRelease
(
pSdb
,
pStb
);
}
static
SDbObj
*
mndAcquireDbByStb
(
SMnode
*
pMnode
,
char
*
stbName
)
{
static
SDbObj
*
mndAcquireDbByStb
(
SMnode
*
pMnode
,
c
onst
c
har
*
stbName
)
{
SName
name
=
{
0
};
tNameFromString
(
&
name
,
stbName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
...
...
@@ -225,17 +225,17 @@ static SDbObj *mndAcquireDbByStb(SMnode *pMnode, char *stbName) {
return
mndAcquireDb
(
pMnode
,
db
);
}
static
void
*
mndBuildCreateStb
Msg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
,
in
t
*
pContLen
)
{
static
void
*
mndBuildCreateStb
Req
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
,
int32_
t
*
pContLen
)
{
SVCreateTbReq
req
;
void
*
buf
;
int
bsize
;
int
32_t
bsize
;
SMsgHead
*
pMsgHead
;
req
.
ver
=
0
;
SName
name
=
{
0
};
tNameFromString
(
&
name
,
pStb
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
tNameFromString
(
&
name
,
pStb
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
req
.
name
=
(
char
*
)
tNameGetTableName
(
&
name
);
req
.
name
=
(
char
*
)
tNameGetTableName
(
&
name
);
req
.
ttl
=
0
;
req
.
keep
=
0
;
req
.
type
=
TD_SUPER_TABLE
;
...
...
@@ -264,7 +264,7 @@ static void *mndBuildCreateStbMsg(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb
return
buf
;
}
static
SVDropTbReq
*
mndBuildDropStb
Msg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
)
{
static
SVDropTbReq
*
mndBuildDropStb
Req
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
)
{
int32_t
contLen
=
sizeof
(
SVDropTbReq
);
SVDropTbReq
*
pDrop
=
calloc
(
1
,
contLen
);
...
...
@@ -356,14 +356,14 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SVgObj
*
pVgroup
=
NULL
;
void
*
pIter
=
NULL
;
int
contLen
;
int
32_t
contLen
;
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_VGROUP
,
pIter
,
(
void
**
)
&
pVgroup
);
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
!=
pDb
->
uid
)
continue
;
void
*
pMsg
=
mndBuildCreateStb
Msg
(
pMnode
,
pVgroup
,
pStb
,
&
contLen
);
void
*
pMsg
=
mndBuildCreateStb
Req
(
pMnode
,
pVgroup
,
pStb
,
&
contLen
);
if
(
pMsg
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
...
...
@@ -398,7 +398,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
!=
pDb
->
uid
)
continue
;
SVDropTbReq
*
pMsg
=
mndBuildDropStb
Msg
(
pMnode
,
pVgroup
,
pStb
);
SVDropTbReq
*
pMsg
=
mndBuildDropStb
Req
(
pMnode
,
pVgroup
,
pStb
);
if
(
pMsg
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
...
...
@@ -494,8 +494,8 @@ CREATE_STB_OVER:
return
code
;
}
static
int32_t
mndProces
S
MCreateStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
static
int32_t
mndProces
s
MCreateStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMCreateStbReq
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to create"
,
pCreate
->
name
);
...
...
@@ -548,7 +548,7 @@ static int32_t mndProcesSMCreateStbReq(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndProcess
CreateStbIn
Rsp
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcess
VCreateStb
Rsp
(
SMnodeMsg
*
pMsg
)
{
mndTransProcessRsp
(
pMsg
);
return
0
;
}
...
...
@@ -578,10 +578,10 @@ static int32_t mndCheckAlterStbMsg(SMAlterStbReq *pAlter) {
return
0
;
}
static
int32_t
mndUpdateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SStbObj
*
pOld
Stb
,
SStbObj
*
pNewStb
)
{
return
0
;
}
static
int32_t
mndUpdateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SStbObj
*
pOld
,
SStbObj
*
pNew
)
{
return
0
;
}
static
int32_t
mndProces
S
MAlterStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
static
int32_t
mndProces
s
MAlterStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMAlterStbReq
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to alter"
,
pAlter
->
name
);
...
...
@@ -612,7 +612,7 @@ static int32_t mndProcesSMAlterStbReq(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndProcess
AlterStbIn
Rsp
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcess
VAlterStb
Rsp
(
SMnodeMsg
*
pMsg
)
{
mndTransProcessRsp
(
pMsg
);
return
0
;
}
...
...
@@ -694,8 +694,8 @@ DROP_STB_OVER:
return
0
;
}
static
int32_t
mndProces
S
MDropStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
static
int32_t
mndProces
s
MDropStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMDropStbReq
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to drop"
,
pDrop
->
name
);
...
...
@@ -724,12 +724,12 @@ static int32_t mndProcesSMDropStbReq(SMnodeMsg *pMsg) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
static
int32_t
mndProcess
DropStbIn
Rsp
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcess
VDropStb
Rsp
(
SMnodeMsg
*
pMsg
)
{
mndTransProcessRsp
(
pMsg
);
return
0
;
}
static
int32_t
mndProcessStbMeta
Msg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessStbMeta
Req
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
STableInfoReq
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录