Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b6ed3056
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
b6ed3056
编写于
12月 10, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 update sdb for stable
上级
a27bf43f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
49 addition
and
27 deletion
+49
-27
include/common/taosmsg.h
include/common/taosmsg.h
+1
-1
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-1
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+1
-1
source/dnode/mnode/impl/src/mndStable.c
source/dnode/mnode/impl/src/mndStable.c
+42
-20
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-2
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+2
-2
未找到文件。
include/common/taosmsg.h
浏览文件 @
b6ed3056
...
...
@@ -159,7 +159,7 @@ typedef enum _mgmt_table {
TSDB_MGMT_TABLE_DNODE
,
TSDB_MGMT_TABLE_MNODE
,
TSDB_MGMT_TABLE_VGROUP
,
TSDB_MGMT_TABLE_
METRIC
,
TSDB_MGMT_TABLE_
STABLE
,
TSDB_MGMT_TABLE_MODULE
,
TSDB_MGMT_TABLE_QUERIES
,
TSDB_MGMT_TABLE_STREAMS
,
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
b6ed3056
...
...
@@ -251,9 +251,9 @@ typedef struct SStableObj {
int32_t
version
;
int16_t
numOfFields
;
int16_t
numOfTags
;
SRWLatch
lock
;
SSchema
*
fieldSchema
;
SSchema
*
tagSchema
;
char
pCont
[];
}
SStableObj
;
typedef
struct
SFuncObj
{
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
b6ed3056
...
...
@@ -270,7 +270,7 @@ char *mndShowStr(int32_t showType) {
return
"show mnodes"
;
case
TSDB_MGMT_TABLE_VGROUP
:
return
"show vgroups"
;
case
TSDB_MGMT_TABLE_
METRIC
:
case
TSDB_MGMT_TABLE_
STABLE
:
return
"show stables"
;
case
TSDB_MGMT_TABLE_MODULE
:
return
"show modules"
;
...
...
source/dnode/mnode/impl/src/mndStable.c
浏览文件 @
b6ed3056
...
...
@@ -33,6 +33,10 @@ static int32_t mndStableActionUpdate(SSdb *pSdb, SStableObj *pOldStable, SStabl
static
int32_t
mndProcessCreateStableMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterStableMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropStableMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateStableInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterStableInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropStableInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessStableMetaMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetStableMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndRetrieveStables
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextStable
(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
@@ -46,13 +50,17 @@ int32_t mndInitStable(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndStableActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndStableActionDelete
};
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_CREATE_DB
,
mndProcessCreateStableMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_ALTER_DB
,
mndProcessAlterStableMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_DROP_DB
,
mndProcessDropStableMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_CREATE_STABLE
,
mndProcessCreateStableMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_ALTER_STABLE
,
mndProcessAlterStableMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_DROP_STABLE
,
mndProcessDropStableMsg
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_CREATE_STABLE_IN_RSP
,
mndProcessCreateStableInRsp
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_ALTER_STABLE_IN_RSP
,
mndProcessAlterStableInRsp
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_DROP_STABLE_IN_RSP
,
mndProcessDropStableInRsp
);
mndSetMsgHandle
(
pMnode
,
TSDB_MSG_TYPE_TABLE_META
,
mndProcessStableMetaMsg
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_
DB
,
mndGetStableMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_
DB
,
mndRetrieveStables
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_
DB
,
mndCancelGetNextStable
);
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_
STABLE
,
mndGetStableMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_
STABLE
,
mndRetrieveStables
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_
STABLE
,
mndCancelGetNextStable
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -119,8 +127,8 @@ static SSdbRow *mndStableActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT16
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
numOfFields
)
SDB_GET_INT16
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
numOfTags
)
pStable
->
fieldSchema
=
(
SSchema
*
)
pStable
->
pCont
;
pStable
->
tagSchema
=
(
SSchema
*
)(
pStable
->
pCont
+
pStable
->
numOfFields
*
sizeof
(
SSchema
));
pStable
->
fieldSchema
=
calloc
(
pStable
->
numOfFields
,
sizeof
(
SSchema
))
;
pStable
->
tagSchema
=
calloc
(
pStable
->
numOfTags
,
sizeof
(
SSchema
));
for
(
int32_t
i
=
0
;
i
<
pStable
->
numOfFields
;
++
i
)
{
SSchema
*
pSchema
=
&
pStable
->
fieldSchema
[
i
];
...
...
@@ -155,28 +163,42 @@ static int32_t mndStableActionDelete(SSdb *pSdb, SStableObj *pStable) {
static
int32_t
mndStableActionUpdate
(
SSdb
*
pSdb
,
SStableObj
*
pOldStable
,
SStableObj
*
pNewStable
)
{
mTrace
(
"stable:%s, perform update action"
,
pOldStable
->
name
);
memcpy
(
pOldStable
->
name
,
pNewStable
->
name
,
TSDB_TABLE_NAME_LEN
);
pOldStable
->
createdTime
=
pNewStable
->
createdTime
;
pOldStable
->
updateTime
=
pNewStable
->
updateTime
;
pOldStable
->
uid
=
pNewStable
->
uid
;
pOldStable
->
version
=
pNewStable
->
version
;
pOldStable
->
numOfFields
=
pNewStable
->
numOfFields
;
pOldStable
->
numOfTags
=
pNewStable
->
numOfTags
;
pOldStable
->
createdTime
=
pNewStable
->
createdTime
;
memcpy
(
pOldStable
->
pCont
,
pNewStable
,
sizeof
(
SDbObj
));
// pStable->fieldSchema = pStable->pCont;
// pStable->tagSchema = pStable->pCont + pStable->numOfFields * sizeof(SSchema);
atomic_exchange_32
(
&
pOldStable
->
updateTime
,
pNewStable
->
updateTime
);
atomic_exchange_32
(
&
pOldStable
->
version
,
pNewStable
->
version
);
taosWLockLatch
(
&
pOldStable
->
lock
);
int16_t
numOfTags
=
pNewStable
->
numOfTags
;
int32_t
tagSize
=
numOfTags
*
sizeof
(
SSchema
);
int16_t
numOfFields
=
pNewStable
->
numOfFields
;
int32_t
fieldSize
=
numOfFields
*
sizeof
(
SSchema
);
if
(
pOldStable
->
numOfTags
<
numOfTags
)
{
pOldStable
->
tagSchema
=
malloc
(
tagSize
);
}
if
(
pOldStable
->
numOfFields
<
numOfFields
)
{
pOldStable
->
fieldSchema
=
malloc
(
fieldSize
);
}
memcpy
(
pOldStable
->
tagSchema
,
pNewStable
->
tagSchema
,
tagSize
);
memcpy
(
pOldStable
->
fieldSchema
,
pNewStable
->
fieldSchema
,
fieldSize
);
taosWUnLockLatch
(
&
pOldStable
->
lock
);
return
0
;
}
static
int32_t
mndProcessCreateStableMsg
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessCreateStableInRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessAlterStableMsg
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessAlterStableInRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessDropStableMsg
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessDropStableInRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessStableMetaMsg
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndGetNumOfStables
(
SMnode
*
pMnode
,
char
*
dbName
,
int32_t
*
pNumOfStables
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
b6ed3056
...
...
@@ -277,9 +277,9 @@ static int32_t mndRetrieveVgroups(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
}
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int8_t
*
)
pWrite
=
pVgroup
->
compact
;
*
(
int8_t
*
)
pWrite
=
pVgroup
->
compact
;
cols
++
;
sdbRelease
(
pSdb
,
pVgroup
);
numOfRows
++
;
}
...
...
source/libs/parser/inc/sql.y
浏览文件 @
b6ed3056
...
...
@@ -112,13 +112,13 @@ cmd ::= SHOW dbPrefix(X) TABLES LIKE ids(Y). {
}
cmd ::= SHOW dbPrefix(X) STABLES. {
setShowOptions(pInfo, TSDB_MGMT_TABLE_
METRIC
, &X, 0);
setShowOptions(pInfo, TSDB_MGMT_TABLE_
STABLE
, &X, 0);
}
cmd ::= SHOW dbPrefix(X) STABLES LIKE ids(Y). {
SToken token;
tSetDbName(&token, &X);
setShowOptions(pInfo, TSDB_MGMT_TABLE_
METRIC
, &token, &Y);
setShowOptions(pInfo, TSDB_MGMT_TABLE_
STABLE
, &token, &Y);
}
cmd ::= SHOW dbPrefix(X) VGROUPS. {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录