Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
13cfafaf
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看板
提交
13cfafaf
编写于
12月 10, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-10431 retrieve stable meta
上级
b6ed3056
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
173 addition
and
88 deletion
+173
-88
include/common/taosmsg.h
include/common/taosmsg.h
+20
-17
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/dnode/mgmt/impl/test/cluster/cluster.cpp
source/dnode/mgmt/impl/test/cluster/cluster.cpp
+3
-3
source/dnode/mgmt/impl/test/profile/profile.cpp
source/dnode/mgmt/impl/test/profile/profile.cpp
+14
-14
source/dnode/mgmt/impl/test/show/show.cpp
source/dnode/mgmt/impl/test/show/show.cpp
+7
-7
source/dnode/mgmt/impl/test/user/user.cpp
source/dnode/mgmt/impl/test/user/user.cpp
+4
-4
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+3
-4
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+1
-1
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+2
-2
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+2
-2
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+1
-1
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+3
-3
source/dnode/mnode/impl/src/mndStable.c
source/dnode/mnode/impl/src/mndStable.c
+105
-23
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+1
-1
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+2
-2
source/libs/parser/src/parserUtil.c
source/libs/parser/src/parserUtil.c
+1
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+2
-2
未找到文件。
include/common/taosmsg.h
浏览文件 @
13cfafaf
...
...
@@ -274,7 +274,7 @@ typedef struct {
typedef
struct
SSchema
{
int8_t
type
;
int
16
_t
colId
;
int
32
_t
colId
;
int32_t
bytes
;
char
name
[
TSDB_COL_NAME_LEN
];
}
SSchema
;
...
...
@@ -764,13 +764,17 @@ typedef struct {
}
SAuthVnodeMsg
;
typedef
struct
{
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
int16_t
createFlag
;
char
tags
[];
char
name
[
TSDB_TABLE_FNAME_LEN
];
}
SStableInfoMsg
;
typedef
struct
{
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
int8_t
createFlag
;
char
tags
[];
}
STableInfoMsg
;
typedef
struct
{
uint8_t
metaClone
;
// create local clone of the cached table meta
int8_t
metaClone
;
// create local clone of the cached table meta
int32_t
numOfVgroups
;
int32_t
numOfTables
;
int32_t
numOfUdfs
;
...
...
@@ -788,25 +792,24 @@ typedef struct {
}
SVgroupMsg
;
typedef
struct
{
int32_t
numOfVgroups
;
int32_t
numOfVgroups
;
SVgroupMsg
vgroups
[];
}
SVgroupsMsg
,
SVgroupsInfo
;
typedef
struct
STableMetaMsg
{
int32_t
contLen
;
typedef
struct
{
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
// table id
int8_t
numOfTags
;
char
stableFname
[
TSDB_TABLE_FNAME_LEN
];
int32_t
numOfTags
;
int32_t
numOfColumns
;
int8_t
precision
;
int8_t
tableType
;
int
16_t
numOfColumns
;
int
16
_t
sversion
;
int
16
_t
tversion
;
int32_t
t
id
;
int64_t
uid
;
int
8_t
update
;
int
32
_t
sversion
;
int
32
_t
tversion
;
uint64_t
tu
id
;
uint64_t
s
uid
;
SVgroupMsg
vgroup
;
char
sTableName
[
TSDB_TABLE_FNAME_LEN
];
int64_t
suid
;
SSchema
schema
[];
SSchema
pSchema
[];
}
STableMetaMsg
;
typedef
struct
SMultiTableMeta
{
...
...
include/util/taoserror.h
浏览文件 @
13cfafaf
...
...
@@ -183,6 +183,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0348) //"Mnode already exists")
#define TSDB_CODE_MND_MNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0349) //"Mnode not there")
// mnode-table
#define TSDB_CODE_MND_TABLE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360) //"Table already exists")
#define TSDB_CODE_MND_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0361) //"Table name too long")
#define TSDB_CODE_MND_INVALID_TABLE_NAME TAOS_DEF_ERROR_CODE(0, 0x0362) //"Table does not exist")
...
...
source/dnode/mgmt/impl/test/cluster/cluster.cpp
浏览文件 @
13cfafaf
...
...
@@ -93,21 +93,21 @@ TEST_F(DndTestCluster, ShowCluster) {
EXPECT_EQ
(
pMeta
->
suid
,
0
);
SSchema
*
pSchema
=
NULL
;
pSchema
=
&
pMeta
->
s
chema
[
0
];
pSchema
=
&
pMeta
->
pS
chema
[
0
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"id"
);
pSchema
=
&
pMeta
->
s
chema
[
1
];
pSchema
=
&
pMeta
->
pS
chema
[
1
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_CLUSTER_ID_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"name"
);
pSchema
=
&
pMeta
->
s
chema
[
2
];
pSchema
=
&
pMeta
->
pS
chema
[
2
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_TIMESTAMP
);
...
...
source/dnode/mgmt/impl/test/profile/profile.cpp
浏览文件 @
13cfafaf
...
...
@@ -152,49 +152,49 @@ TEST_F(DndTestProfile, SConnectMsg_03) {
EXPECT_EQ
(
pMeta
->
suid
,
0
);
SSchema
*
pSchema
=
NULL
;
pSchema
=
&
pMeta
->
s
chema
[
0
];
pSchema
=
&
pMeta
->
pS
chema
[
0
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"connId"
);
pSchema
=
&
pMeta
->
s
chema
[
1
];
pSchema
=
&
pMeta
->
pS
chema
[
1
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"user"
);
pSchema
=
&
pMeta
->
s
chema
[
2
];
pSchema
=
&
pMeta
->
pS
chema
[
2
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"program"
);
pSchema
=
&
pMeta
->
s
chema
[
3
];
pSchema
=
&
pMeta
->
pS
chema
[
3
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"pid"
);
pSchema
=
&
pMeta
->
s
chema
[
4
];
pSchema
=
&
pMeta
->
pS
chema
[
4
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"ip:port"
);
pSchema
=
&
pMeta
->
s
chema
[
5
];
pSchema
=
&
pMeta
->
pS
chema
[
5
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_TIMESTAMP
);
EXPECT_EQ
(
pSchema
->
bytes
,
8
);
EXPECT_STREQ
(
pSchema
->
name
,
"login_time"
);
pSchema
=
&
pMeta
->
s
chema
[
6
];
pSchema
=
&
pMeta
->
pS
chema
[
6
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_TIMESTAMP
);
...
...
@@ -493,28 +493,28 @@ TEST_F(DndTestProfile, SKillQueryMsg_03) {
EXPECT_EQ
(
pMeta
->
suid
,
0
);
SSchema
*
pSchema
=
NULL
;
pSchema
=
&
pMeta
->
s
chema
[
0
];
pSchema
=
&
pMeta
->
pS
chema
[
0
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"queryId"
);
pSchema
=
&
pMeta
->
s
chema
[
1
];
pSchema
=
&
pMeta
->
pS
chema
[
1
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"connId"
);
pSchema
=
&
pMeta
->
s
chema
[
2
];
pSchema
=
&
pMeta
->
pS
chema
[
2
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"user"
);
pSchema
=
&
pMeta
->
s
chema
[
3
];
pSchema
=
&
pMeta
->
pS
chema
[
3
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
...
...
@@ -680,21 +680,21 @@ TEST_F(DndTestProfile, SKillStreamMsg_03) {
EXPECT_EQ
(
pMeta
->
suid
,
0
);
SSchema
*
pSchema
=
NULL
;
pSchema
=
&
pMeta
->
s
chema
[
0
];
pSchema
=
&
pMeta
->
pS
chema
[
0
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"streamId"
);
pSchema
=
&
pMeta
->
s
chema
[
1
];
pSchema
=
&
pMeta
->
pS
chema
[
1
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"connId"
);
pSchema
=
&
pMeta
->
s
chema
[
2
];
pSchema
=
&
pMeta
->
pS
chema
[
2
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
...
...
source/dnode/mgmt/impl/test/show/show.cpp
浏览文件 @
13cfafaf
...
...
@@ -154,49 +154,49 @@ TEST_F(DndTestShow, SShowMsg_04) {
EXPECT_EQ
(
pMeta
->
suid
,
0
);
SSchema
*
pSchema
=
NULL
;
pSchema
=
&
pMeta
->
s
chema
[
0
];
pSchema
=
&
pMeta
->
pS
chema
[
0
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"connId"
);
pSchema
=
&
pMeta
->
s
chema
[
1
];
pSchema
=
&
pMeta
->
pS
chema
[
1
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"user"
);
pSchema
=
&
pMeta
->
s
chema
[
2
];
pSchema
=
&
pMeta
->
pS
chema
[
2
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"program"
);
pSchema
=
&
pMeta
->
s
chema
[
3
];
pSchema
=
&
pMeta
->
pS
chema
[
3
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_INT
);
EXPECT_EQ
(
pSchema
->
bytes
,
4
);
EXPECT_STREQ
(
pSchema
->
name
,
"pid"
);
pSchema
=
&
pMeta
->
s
chema
[
4
];
pSchema
=
&
pMeta
->
pS
chema
[
4
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_BINARY
);
EXPECT_EQ
(
pSchema
->
bytes
,
TSDB_IPv4ADDR_LEN
+
6
+
VARSTR_HEADER_SIZE
);
EXPECT_STREQ
(
pSchema
->
name
,
"ip:port"
);
pSchema
=
&
pMeta
->
s
chema
[
5
];
pSchema
=
&
pMeta
->
pS
chema
[
5
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_TIMESTAMP
);
EXPECT_EQ
(
pSchema
->
bytes
,
8
);
EXPECT_STREQ
(
pSchema
->
name
,
"login_time"
);
pSchema
=
&
pMeta
->
s
chema
[
6
];
pSchema
=
&
pMeta
->
pS
chema
[
6
];
pSchema
->
bytes
=
htons
(
pSchema
->
bytes
);
EXPECT_EQ
(
pSchema
->
colId
,
0
);
EXPECT_EQ
(
pSchema
->
type
,
TSDB_DATA_TYPE_TIMESTAMP
);
...
...
source/dnode/mgmt/impl/test/user/user.cpp
浏览文件 @
13cfafaf
...
...
@@ -93,28 +93,28 @@ TEST_F(DndTestUser, ShowUser) {
SSchema* pSchema = NULL;
pSchema = &pMeta->
s
chema[0];
pSchema = &pMeta->
pS
chema[0];
pSchema->bytes = htons(pSchema->bytes);
EXPECT_EQ(pSchema->colId, 0);
EXPECT_EQ(pSchema->type, TSDB_DATA_TYPE_BINARY);
EXPECT_EQ(pSchema->bytes, TSDB_USER_LEN + VARSTR_HEADER_SIZE);
EXPECT_STREQ(pSchema->name, "name");
pSchema = &pMeta->
s
chema[1];
pSchema = &pMeta->
pS
chema[1];
pSchema->bytes = htons(pSchema->bytes);
EXPECT_EQ(pSchema->colId, 0);
EXPECT_EQ(pSchema->type, TSDB_DATA_TYPE_BINARY);
EXPECT_EQ(pSchema->bytes, 10 + VARSTR_HEADER_SIZE);
EXPECT_STREQ(pSchema->name, "privilege");
pSchema = &pMeta->
s
chema[2];
pSchema = &pMeta->
pS
chema[2];
pSchema->bytes = htons(pSchema->bytes);
EXPECT_EQ(pSchema->colId, 0);
EXPECT_EQ(pSchema->type, TSDB_DATA_TYPE_TIMESTAMP);
EXPECT_EQ(pSchema->bytes, 8);
EXPECT_STREQ(pSchema->name, "create_time");
pSchema = &pMeta->
s
chema[3];
pSchema = &pMeta->
pS
chema[3];
pSchema->bytes = htons(pSchema->bytes);
EXPECT_EQ(pSchema->colId, 0);
EXPECT_EQ(pSchema->type, TSDB_DATA_TYPE_BINARY);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
13cfafaf
...
...
@@ -47,7 +47,6 @@ typedef struct SAcctObj SAcctObj;
typedef
struct
SUserObj
SUserObj
;
typedef
struct
SDbObj
SDbObj
;
typedef
struct
SVgObj
SVgObj
;
typedef
struct
STableObj
STableObj
;
typedef
struct
SFuncObj
SFuncObj
;
typedef
struct
SOperObj
SOperObj
;
...
...
@@ -249,10 +248,10 @@ typedef struct SStableObj {
int64_t
updateTime
;
uint64_t
uid
;
int32_t
version
;
int
16_t
numOfField
s
;
int
16
_t
numOfTags
;
int
32_t
numOfColumn
s
;
int
32
_t
numOfTags
;
SRWLatch
lock
;
SSchema
*
field
Schema
;
SSchema
*
column
Schema
;
SSchema
*
tagSchema
;
}
SStableObj
;
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
13cfafaf
...
...
@@ -138,7 +138,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
13cfafaf
...
...
@@ -659,7 +659,7 @@ static int32_t mndGetDbMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *pMe
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
(
TSDB_DB_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
13cfafaf
...
...
@@ -576,7 +576,7 @@ static int32_t mndProcessConfigDnodeRsp(SMnodeMsg *pMsg) { mInfo("cfg dnode rsp
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
@@ -654,7 +654,7 @@ static int32_t mndGetDnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
13cfafaf
...
...
@@ -51,7 +51,7 @@ int32_t mndInitFunc(SMnode *pMnode) {
mndAddShowMetaHandle
(
pMnode
,
TSDB_MGMT_TABLE_FUNCTION
,
mndGetFuncMeta
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_FUNCTION
,
mndRetrieveFuncs
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_FUNCTION
,
mndCancelGetNextFunc
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
}
...
...
@@ -375,7 +375,7 @@ static int32_t mndGetFuncMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *p
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
TSDB_FUNC_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
13cfafaf
...
...
@@ -363,7 +363,7 @@ static int32_t mndGetMnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
13cfafaf
...
...
@@ -467,7 +467,7 @@ static int32_t mndGetConnsMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
mndReleaseUser
(
pMnode
,
pUser
);
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
...
...
@@ -595,7 +595,7 @@ static int32_t mndGetQueryMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
mndReleaseUser
(
pMnode
,
pUser
);
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
...
...
@@ -811,7 +811,7 @@ static int32_t mndGetStreamMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
mndReleaseUser
(
pMnode
,
pUser
);
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
...
...
source/dnode/mnode/impl/src/mndStable.c
浏览文件 @
13cfafaf
...
...
@@ -21,6 +21,7 @@
#include "mndTrans.h"
#include "mndUser.h"
#include "mndDb.h"
#include "tname.h"
#define TSDB_STABLE_VER_NUM 1
#define TSDB_STABLE_RESERVE_SIZE 64
...
...
@@ -68,7 +69,7 @@ int32_t mndInitStable(SMnode *pMnode) {
void
mndCleanupStable
(
SMnode
*
pMnode
)
{}
static
SSdbRaw
*
mndStableActionEncode
(
SStableObj
*
pStable
)
{
int32_t
size
=
sizeof
(
SStableObj
)
+
(
pStable
->
numOf
Field
s
+
pStable
->
numOfTags
)
*
sizeof
(
SSchema
);
int32_t
size
=
sizeof
(
SStableObj
)
+
(
pStable
->
numOf
Column
s
+
pStable
->
numOfTags
)
*
sizeof
(
SSchema
);
SSdbRaw
*
pRaw
=
sdbAllocRaw
(
SDB_STABLE
,
TSDB_STABLE_VER_NUM
,
size
);
if
(
pRaw
==
NULL
)
return
NULL
;
...
...
@@ -78,14 +79,14 @@ static SSdbRaw *mndStableActionEncode(SStableObj *pStable) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStable
->
updateTime
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStable
->
uid
)
SDB_SET_INT64
(
pRaw
,
dataPos
,
pStable
->
version
)
SDB_SET_INT
16
(
pRaw
,
dataPos
,
pStable
->
numOfField
s
)
SDB_SET_INT
16
(
pRaw
,
dataPos
,
pStable
->
numOfTags
)
SDB_SET_INT
32
(
pRaw
,
dataPos
,
pStable
->
numOfColumn
s
)
SDB_SET_INT
32
(
pRaw
,
dataPos
,
pStable
->
numOfTags
)
for
(
int32_t
i
=
0
;
i
<
pStable
->
numOf
Field
s
;
++
i
)
{
SSchema
*
pSchema
=
&
pStable
->
field
Schema
[
i
];
for
(
int32_t
i
=
0
;
i
<
pStable
->
numOf
Column
s
;
++
i
)
{
SSchema
*
pSchema
=
&
pStable
->
column
Schema
[
i
];
SDB_SET_INT8
(
pRaw
,
dataPos
,
pSchema
->
type
);
SDB_SET_INT
16
(
pRaw
,
dataPos
,
pSchema
->
colId
);
SDB_SET_INT
16
(
pRaw
,
dataPos
,
pSchema
->
bytes
);
SDB_SET_INT
32
(
pRaw
,
dataPos
,
pSchema
->
colId
);
SDB_SET_INT
32
(
pRaw
,
dataPos
,
pSchema
->
bytes
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
);
}
...
...
@@ -124,16 +125,16 @@ static SSdbRow *mndStableActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
updateTime
)
SDB_GET_INT64
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
uid
)
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
version
)
SDB_GET_INT
16
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
numOfField
s
)
SDB_GET_INT
16
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
numOfTags
)
SDB_GET_INT
32
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
numOfColumn
s
)
SDB_GET_INT
32
(
pRaw
,
pRow
,
dataPos
,
&
pStable
->
numOfTags
)
pStable
->
fieldSchema
=
calloc
(
pStable
->
numOfField
s
,
sizeof
(
SSchema
));
pStable
->
columnSchema
=
calloc
(
pStable
->
numOfColumn
s
,
sizeof
(
SSchema
));
pStable
->
tagSchema
=
calloc
(
pStable
->
numOfTags
,
sizeof
(
SSchema
));
for
(
int32_t
i
=
0
;
i
<
pStable
->
numOf
Field
s
;
++
i
)
{
SSchema
*
pSchema
=
&
pStable
->
field
Schema
[
i
];
for
(
int32_t
i
=
0
;
i
<
pStable
->
numOf
Column
s
;
++
i
)
{
SSchema
*
pSchema
=
&
pStable
->
column
Schema
[
i
];
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
type
);
SDB_GET_INT
16
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
colId
);
SDB_GET_INT
32
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
colId
);
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
bytes
);
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
);
}
...
...
@@ -141,7 +142,7 @@ static SSdbRow *mndStableActionDecode(SSdbRaw *pRaw) {
for
(
int32_t
i
=
0
;
i
<
pStable
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
&
pStable
->
tagSchema
[
i
];
SDB_GET_INT8
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
type
);
SDB_GET_INT
16
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
colId
);
SDB_GET_INT
32
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
colId
);
SDB_GET_INT32
(
pRaw
,
pRow
,
dataPos
,
&
pSchema
->
bytes
);
SDB_GET_BINARY
(
pRaw
,
pRow
,
dataPos
,
pSchema
->
name
,
TSDB_COL_NAME_LEN
);
}
...
...
@@ -167,24 +168,34 @@ static int32_t mndStableActionUpdate(SSdb *pSdb, SStableObj *pOldStable, SStable
atomic_exchange_32
(
&
pOldStable
->
version
,
pNewStable
->
version
);
taosWLockLatch
(
&
pOldStable
->
lock
);
int
16
_t
numOfTags
=
pNewStable
->
numOfTags
;
int
32
_t
numOfTags
=
pNewStable
->
numOfTags
;
int32_t
tagSize
=
numOfTags
*
sizeof
(
SSchema
);
int
16_t
numOfFields
=
pNewStable
->
numOfField
s
;
int32_t
fieldSize
=
numOfField
s
*
sizeof
(
SSchema
);
int
32_t
numOfColumns
=
pNewStable
->
numOfColumn
s
;
int32_t
columnSize
=
numOfColumn
s
*
sizeof
(
SSchema
);
if
(
pOldStable
->
numOfTags
<
numOfTags
)
{
pOldStable
->
tagSchema
=
malloc
(
tagSize
);
}
if
(
pOldStable
->
numOf
Fields
<
numOfField
s
)
{
pOldStable
->
fieldSchema
=
malloc
(
field
Size
);
if
(
pOldStable
->
numOf
Columns
<
numOfColumn
s
)
{
pOldStable
->
columnSchema
=
malloc
(
column
Size
);
}
memcpy
(
pOldStable
->
tagSchema
,
pNewStable
->
tagSchema
,
tagSize
);
memcpy
(
pOldStable
->
fieldSchema
,
pNewStable
->
fieldSchema
,
field
Size
);
memcpy
(
pOldStable
->
columnSchema
,
pNewStable
->
columnSchema
,
column
Size
);
taosWUnLockLatch
(
&
pOldStable
->
lock
);
return
0
;
}
SStableObj
*
mndAcquireStb
(
SMnode
*
pMnode
,
char
*
stbName
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
return
sdbAcquire
(
pSdb
,
SDB_STABLE
,
stbName
);
}
void
mndReleaseStb
(
SMnode
*
pMnode
,
SStableObj
*
pStb
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
sdbRelease
(
pSdb
,
pStb
);
}
static
int32_t
mndProcessCreateStableMsg
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
static
int32_t
mndProcessCreateStableInRsp
(
SMnodeMsg
*
pMsg
)
{
return
0
;
}
...
...
@@ -197,7 +208,78 @@ 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
SDbObj
*
mndGetDbByStbName
(
SMnode
*
pMnode
,
char
*
stbName
)
{
SName
name
=
{
0
};
tNameFromString
(
&
name
,
stbName
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
char
db
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
db
);
return
mndAcquireDb
(
pMnode
,
db
);
}
static
int32_t
mndProcessStableMetaMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SStableInfoMsg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stable:%s, start to retrieve meta"
,
pInfo
->
name
);
SDbObj
*
pDb
=
mndGetDbByStbName
(
pMnode
,
pInfo
->
name
);
if
(
pDb
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_SELECTED
;
mError
(
"stable:%s, failed to retrieve meta since %s"
,
pInfo
->
name
,
terrstr
());
return
-
1
;
}
SStableObj
*
pStb
=
mndAcquireStb
(
pMnode
,
pInfo
->
name
);
if
(
pStb
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
terrno
=
TSDB_CODE_MND_INVALID_TABLE_NAME
;
mError
(
"stable:%s, failed to get meta since %s"
,
pInfo
->
name
,
terrstr
());
return
-
1
;
}
int32_t
contLen
=
sizeof
(
STableMetaMsg
)
+
(
pStb
->
numOfColumns
+
pStb
->
numOfTags
)
*
sizeof
(
SSchema
);
STableMetaMsg
*
pMeta
=
rpcMallocCont
(
contLen
);
if
(
pMeta
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
mError
(
"stable:%s, failed to get meta since %s"
,
pInfo
->
name
,
terrstr
());
return
-
1
;
}
memcpy
(
pMeta
->
stableFname
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
);
pMeta
->
numOfTags
=
htonl
(
pStb
->
numOfTags
);
pMeta
->
numOfColumns
=
htonl
(
pStb
->
numOfColumns
);
pMeta
->
precision
=
pDb
->
cfg
.
precision
;
pMeta
->
tableType
=
TSDB_SUPER_TABLE
;
pMeta
->
update
=
pDb
->
cfg
.
update
;
pMeta
->
sversion
=
htonl
(
pStb
->
version
);
pMeta
->
suid
=
htonl
(
pStb
->
uid
);
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfColumns
;
++
i
)
{
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
i
];
SSchema
*
pColumn
=
&
pStb
->
columnSchema
[
i
];
memcpy
(
pSchema
->
name
,
pColumn
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pColumn
->
type
;
pSchema
->
colId
=
htonl
(
pColumn
->
colId
);
pSchema
->
bytes
=
htonl
(
pColumn
->
bytes
);
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
&
pMeta
->
pSchema
[
i
+
pStb
->
numOfColumns
];
SSchema
*
pTag
=
&
pStb
->
tagSchema
[
i
];
memcpy
(
pSchema
->
name
,
pTag
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pTag
->
type
;
pSchema
->
colId
=
htons
(
pTag
->
colId
);
pSchema
->
bytes
=
htonl
(
pTag
->
bytes
);
}
pMsg
->
pCont
=
pMeta
;
pMsg
->
contLen
=
contLen
;
mDebug
(
"stable:%s, meta is retrieved, cols:%d tags:%d"
,
pInfo
->
name
,
pStb
->
numOfColumns
,
pStb
->
numOfTags
);
return
0
;
}
static
int32_t
mndGetNumOfStables
(
SMnode
*
pMnode
,
char
*
dbName
,
int32_t
*
pNumOfStables
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
@@ -235,7 +317,7 @@ static int32_t mndGetStableMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
}
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
@@ -323,7 +405,7 @@ static int32_t mndRetrieveStables(SMnodeMsg *pMsg, SShowObj *pShow, char *data,
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
pStable
->
numOf
Field
s
;
*
(
int16_t
*
)
pWrite
=
pStable
->
numOf
Column
s
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
13cfafaf
...
...
@@ -453,7 +453,7 @@ static int32_t mndGetUserMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *p
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
TSDB_USER_LEN
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
13cfafaf
...
...
@@ -201,7 +201,7 @@ static int32_t mndGetVgroupMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
}
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
...
...
@@ -307,7 +307,7 @@ static int32_t mndGetVnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
s
chema
;
SSchema
*
pSchema
=
pMeta
->
pS
chema
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_INT
;
...
...
source/libs/parser/src/parserUtil.c
浏览文件 @
13cfafaf
...
...
@@ -1480,7 +1480,7 @@ STableMeta* createSuperTableMeta(STableMetaMsg* pChild) {
pTableMeta
->
tversion
=
pChild
->
tversion
;
pTableMeta
->
sversion
=
pChild
->
sversion
;
memcpy
(
pTableMeta
->
schema
,
pChild
->
s
chema
,
sizeof
(
SSchema
)
*
total
);
memcpy
(
pTableMeta
->
schema
,
pChild
->
pS
chema
,
sizeof
(
SSchema
)
*
total
);
int32_t
num
=
pTableMeta
->
tableInfo
.
numOfColumns
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
...
...
source/libs/parser/src/sql.c
浏览文件 @
13cfafaf
...
...
@@ -2312,14 +2312,14 @@ static void yy_reduce(
break
;
case
26
:
/* cmd ::= SHOW dbPrefix STABLES */
{
setShowOptions
(
pInfo
,
TSDB_MGMT_TABLE_
METRIC
,
&
yymsp
[
-
1
].
minor
.
yy0
,
0
);
setShowOptions
(
pInfo
,
TSDB_MGMT_TABLE_
STABLE
,
&
yymsp
[
-
1
].
minor
.
yy0
,
0
);
}
break
;
case
27
:
/* cmd ::= SHOW dbPrefix STABLES LIKE ids */
{
SToken
token
;
tSetDbName
(
&
token
,
&
yymsp
[
-
3
].
minor
.
yy0
);
setShowOptions
(
pInfo
,
TSDB_MGMT_TABLE_
METRIC
,
&
token
,
&
yymsp
[
0
].
minor
.
yy0
);
setShowOptions
(
pInfo
,
TSDB_MGMT_TABLE_
STABLE
,
&
token
,
&
yymsp
[
0
].
minor
.
yy0
);
}
break
;
case
28
:
/* cmd ::= SHOW dbPrefix VGROUPS */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录