Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Rattenking
TDengine
提交
2f011a42
T
TDengine
项目概览
Rattenking
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2f011a42
编写于
5月 02, 2020
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tables only store the uid of the super table instead of the name
上级
482b5865
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
11 deletion
+28
-11
src/mnode/inc/mgmtDef.h
src/mnode/inc/mgmtDef.h
+3
-3
src/mnode/src/mgmtTable.c
src/mnode/src/mgmtTable.c
+25
-8
未找到文件。
src/mnode/inc/mgmtDef.h
浏览文件 @
2f011a42
...
...
@@ -32,8 +32,8 @@ struct SMnodeObj;
typedef
struct
SDnodeObj
{
int32_t
dnodeId
;
uint16_t
dnodePort
;
char
dnodeFqdn
[
TSDB_FQDN_LEN
];
char
dnodeEp
[
TSDB_FQDN_LEN
];
char
dnodeFqdn
[
TSDB_FQDN_LEN
+
1
];
char
dnodeEp
[
TSDB_FQDN_LEN
+
1
];
int64_t
createdTime
;
uint32_t
lastAccess
;
int32_t
openVnodes
;
...
...
@@ -96,7 +96,7 @@ typedef struct {
int32_t
numOfColumns
;
//used by normal table
int32_t
sid
;
int32_t
vgId
;
char
superTableId
[
TSDB_TABLE_ID_LEN
+
1
]
;
uint64_t
suid
;
int32_t
sqlLen
;
int8_t
reserved
[
1
];
int8_t
updateEnd
[
1
];
...
...
src/mnode/src/mgmtTable.c
浏览文件 @
2f011a42
...
...
@@ -47,6 +47,7 @@ static int32_t tsChildTableUpdateSize;
static
int32_t
tsSuperTableUpdateSize
;
static
void
*
mgmtGetChildTable
(
char
*
tableId
);
static
void
*
mgmtGetSuperTable
(
char
*
tableId
);
static
void
*
mgmtGetSuperTableByUid
(
uint64_t
uid
);
static
void
mgmtDropAllChildTablesInStable
(
SSuperTableObj
*
pStable
);
static
void
mgmtAddTableIntoStable
(
SSuperTableObj
*
pStable
,
SChildTableObj
*
pCtable
);
static
void
mgmtRemoveTableFromStable
(
SSuperTableObj
*
pStable
,
SChildTableObj
*
pCtable
);
...
...
@@ -118,7 +119,7 @@ static int32_t mgmtChildTableActionInsert(SSdbOper *pOper) {
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
// add ref
pTable
->
superTable
=
mgmtGetSuperTable
(
pTable
->
superTableI
d
);
pTable
->
superTable
=
mgmtGetSuperTable
ByUid
(
pTable
->
sui
d
);
mgmtAddTableIntoStable
(
pTable
->
superTable
,
pTable
);
grantAdd
(
TSDB_GRANT_TIMESERIES
,
pTable
->
superTable
->
numOfColumns
-
1
);
pAcct
->
acctInfo
.
numOfTimeSeries
+=
(
pTable
->
superTable
->
numOfColumns
-
1
);
...
...
@@ -308,9 +309,9 @@ static int32_t mgmtChildTableActionRestored() {
}
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
SSuperTableObj
*
pSuperTable
=
mgmtGetSuperTable
(
pTable
->
superTableI
d
);
SSuperTableObj
*
pSuperTable
=
mgmtGetSuperTable
ByUid
(
pTable
->
sui
d
);
if
(
pSuperTable
==
NULL
)
{
mError
(
"ctable:%s, stable:%
s not exist"
,
pTable
->
info
.
tableId
,
pTable
->
superTableI
d
);
mError
(
"ctable:%s, stable:%
"
PRIu64
" not exist"
,
pTable
->
info
.
tableId
,
pTable
->
sui
d
);
pTable
->
vgId
=
0
;
SSdbOper
desc
=
{
0
};
desc
.
type
=
SDB_OPER_LOCAL
;
...
...
@@ -560,6 +561,22 @@ static void *mgmtGetSuperTable(char *tableId) {
return
sdbGetRow
(
tsSuperTableSdb
,
tableId
);
}
static
void
*
mgmtGetSuperTableByUid
(
uint64_t
uid
)
{
SSuperTableObj
*
pStable
=
NULL
;
void
*
pNode
=
NULL
;
while
(
1
)
{
pNode
=
mgmtGetNextSuperTable
(
pNode
,
&
pStable
);
if
(
pStable
==
NULL
)
break
;
if
(
pStable
->
uid
==
uid
)
{
return
pStable
;
}
mgmtDecTableRef
(
pStable
);
}
return
NULL
;
}
void
*
mgmtGetTable
(
char
*
tableId
)
{
void
*
pTable
=
mgmtGetSuperTable
(
tableId
);
if
(
pTable
!=
NULL
)
{
...
...
@@ -1358,10 +1375,10 @@ static SChildTableObj* mgmtDoCreateChildTable(SCMCreateTableMsg *pCreate, SVgObj
}
mgmtDecTableRef
(
pSuperTable
);
strcpy
(
pTable
->
superTableId
,
pSuperTable
->
info
.
tableId
)
;
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
40
)
+
((((
uint64_t
)
pTable
->
sid
)
&
((
1ul
<<
24
)
-
1ul
))
<<
16
)
+
(
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
));
pTable
->
superTable
=
pSuperTable
;
pTable
->
suid
=
pSuperTable
->
uid
;
pTable
->
uid
=
(((
uint64_t
)
pTable
->
vgId
)
<<
40
)
+
((((
uint64_t
)
pTable
->
sid
)
&
((
1ul
<<
24
)
-
1ul
))
<<
16
)
+
(
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
));
pTable
->
superTable
=
pSuperTable
;
}
else
{
pTable
->
uid
=
(((
uint64_t
)
pTable
->
createdTime
)
<<
16
)
+
(
sdbGetVersion
()
&
((
1ul
<<
16
)
-
1ul
));
pTable
->
sversion
=
0
;
...
...
@@ -2073,7 +2090,7 @@ static int32_t mgmtRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows,
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
if
(
pTable
->
info
.
type
==
TSDB_CHILD_TABLE
)
{
mgmtExtractTableName
(
pTable
->
superTableId
,
pWrite
);
mgmtExtractTableName
(
pTable
->
superTable
->
info
.
table
Id
,
pWrite
);
}
cols
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录