Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ff779672
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
ff779672
编写于
2月 08, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
minor changes
上级
3b5828c0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
19 deletion
+28
-19
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+28
-19
未找到文件。
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
ff779672
...
...
@@ -845,11 +845,11 @@ static int32_t mndProcessStbMetaReq(SMnodeMsg *pReq) {
}
int32_t
mndValidateStbInfo
(
SMnode
*
pMnode
,
SSTableMetaVersion
*
stbs
,
int32_t
num
,
void
**
rsp
,
int32_t
*
rspLen
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
bufSize
=
num
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
void
*
buf
=
malloc
(
bufSize
);
int32_t
len
=
0
;
int32_t
contLen
=
0
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
bufSize
=
num
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
void
*
buf
=
malloc
(
bufSize
);
int32_t
len
=
0
;
int32_t
contLen
=
0
;
STableMetaRsp
*
pRsp
=
NULL
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
...
...
@@ -859,7 +859,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
stb
->
tversion
=
ntohs
(
stb
->
tversion
);
if
((
contLen
+
sizeof
(
STableMetaRsp
))
>
bufSize
)
{
bufSize
=
contLen
+
(
num
-
i
)
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
bufSize
=
contLen
+
(
num
-
i
)
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
buf
=
realloc
(
buf
,
bufSize
);
}
...
...
@@ -868,9 +868,9 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
strcpy
(
pRsp
->
dbFName
,
stb
->
dbFName
);
strcpy
(
pRsp
->
tbName
,
stb
->
stbName
);
strcpy
(
pRsp
->
stbName
,
stb
->
stbName
);
mDebug
(
"start to retrieve meta, db:%s, stb:%s"
,
stb
->
dbFName
,
stb
->
stbName
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
stb
->
dbFName
);
if
(
pDb
==
NULL
)
{
pRsp
->
numOfColumns
=
-
1
;
...
...
@@ -882,7 +882,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
char
tbFName
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
snprintf
(
tbFName
,
sizeof
(
tbFName
),
"%s.%s"
,
stb
->
dbFName
,
stb
->
stbName
);
SStbObj
*
pStb
=
mndAcquireStb
(
pMnode
,
tbFName
);
if
(
pStb
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
...
...
@@ -892,7 +892,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
mWarn
(
"stb:%s, failed to get meta since %s"
,
tbFName
,
terrstr
());
continue
;
}
taosRLockLatch
(
&
pStb
->
lock
);
if
(
stb
->
suid
==
pStb
->
uid
&&
stb
->
sversion
==
pStb
->
version
)
{
...
...
@@ -901,17 +901,17 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
mndReleaseStb
(
pMnode
,
pStb
);
continue
;
}
int32_t
totalCols
=
pStb
->
numOfColumns
+
pStb
->
numOfTags
;
int32_t
len
=
totalCols
*
sizeof
(
SSchema
);
contLen
+=
sizeof
(
STableMetaRsp
)
+
len
;
if
(
contLen
>
bufSize
)
{
bufSize
=
contLen
+
(
num
-
i
-
1
)
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
bufSize
=
contLen
+
(
num
-
i
-
1
)
*
(
sizeof
(
STableMetaRsp
)
+
4
*
sizeof
(
SSchema
));
buf
=
realloc
(
buf
,
bufSize
);
}
pRsp
->
numOfTags
=
htonl
(
pStb
->
numOfTags
);
pRsp
->
numOfColumns
=
htonl
(
pStb
->
numOfColumns
);
pRsp
->
precision
=
pDb
->
cfg
.
precision
;
...
...
@@ -920,15 +920,25 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
pRsp
->
sversion
=
htonl
(
pStb
->
version
);
pRsp
->
suid
=
htobe64
(
pStb
->
uid
);
pRsp
->
tuid
=
htobe64
(
pStb
->
uid
);
for
(
int32_t
i
=
0
;
i
<
totalCol
s
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfColumn
s
;
++
i
)
{
SSchema
*
pSchema
=
&
pRsp
->
pSchema
[
i
];
SSchema
*
pSrcSchema
=
&
pStb
->
p
Schema
[
i
];
SSchema
*
pSrcSchema
=
&
pStb
->
p
Columns
[
i
];
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pSrcSchema
->
type
;
pSchema
->
colId
=
htonl
(
pSrcSchema
->
colId
);
pSchema
->
bytes
=
htonl
(
pSrcSchema
->
bytes
);
}
for
(
int32_t
i
=
0
;
i
<
pStb
->
numOfTags
;
++
i
)
{
SSchema
*
pSchema
=
&
pRsp
->
pSchema
[
i
+
pStb
->
numOfColumns
];
SSchema
*
pSrcSchema
=
&
pStb
->
pTags
[
i
];
memcpy
(
pSchema
->
name
,
pSrcSchema
->
name
,
TSDB_COL_NAME_LEN
);
pSchema
->
type
=
pSrcSchema
->
type
;
pSchema
->
colId
=
htonl
(
pSrcSchema
->
colId
);
pSchema
->
bytes
=
htonl
(
pSrcSchema
->
bytes
);
}
taosRUnLockLatch
(
&
pStb
->
lock
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseStb
(
pMnode
,
pStb
);
...
...
@@ -946,7 +956,6 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
return
0
;
}
static
int32_t
mndGetNumOfStbs
(
SMnode
*
pMnode
,
char
*
dbName
,
int32_t
*
pNumOfStbs
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录