Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e620e2e8
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看板
提交
e620e2e8
编写于
5月 17, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-4209]<fix>: add the uid check for super table metadata that is already cached in local buffer.
上级
d070bcd7
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
29 addition
and
29 deletion
+29
-29
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+1
-1
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+4
-2
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+1
-0
src/client/src/tscServer.c
src/client/src/tscServer.c
+13
-15
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+10
-11
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
e620e2e8
...
...
@@ -298,7 +298,7 @@ STableMeta* createSuperTableMeta(STableMetaMsg* pChild);
uint32_t
tscGetTableMetaSize
(
STableMeta
*
pTableMeta
);
CChildTableMeta
*
tscCreateChildMeta
(
STableMeta
*
pTableMeta
);
uint32_t
tscGetTableMetaMaxSize
();
int32_t
tscCreateTableMetaFrom
CChild
Meta
(
STableMeta
*
pChild
,
const
char
*
name
,
void
*
buf
);
int32_t
tscCreateTableMetaFrom
STable
Meta
(
STableMeta
*
pChild
,
const
char
*
name
,
void
*
buf
);
STableMeta
*
tscTableMetaDup
(
STableMeta
*
pTableMeta
);
...
...
src/client/inc/tsclient.h
浏览文件 @
e620e2e8
...
...
@@ -67,14 +67,16 @@ typedef struct CChildTableMeta {
int32_t
vgId
;
STableId
id
;
uint8_t
tableType
;
char
sTableName
[
TSDB_TABLE_FNAME_LEN
];
//super table name, not full name
char
sTableName
[
TSDB_TABLE_FNAME_LEN
];
// TODO: refactor super table name, not full name
uint64_t
suid
;
// super table id
}
CChildTableMeta
;
typedef
struct
STableMeta
{
int32_t
vgId
;
STableId
id
;
uint8_t
tableType
;
char
sTableName
[
TSDB_TABLE_FNAME_LEN
];
char
sTableName
[
TSDB_TABLE_FNAME_LEN
];
// super table name
uint64_t
suid
;
// super table id
int16_t
sversion
;
int16_t
tversion
;
STableComInfo
tableInfo
;
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
e620e2e8
...
...
@@ -94,6 +94,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg) {
pTableMeta
->
tableType
=
pTableMetaMsg
->
tableType
;
pTableMeta
->
vgId
=
pTableMetaMsg
->
vgroup
.
vgId
;
pTableMeta
->
suid
=
pTableMetaMsg
->
suid
;
pTableMeta
->
tableInfo
=
(
STableComInfo
)
{
.
numOfTags
=
pTableMetaMsg
->
numOfTags
,
...
...
src/client/src/tscServer.c
浏览文件 @
e620e2e8
...
...
@@ -1920,13 +1920,13 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int
tscProcessTableMetaRsp
(
SSqlObj
*
pSql
)
{
STableMetaMsg
*
pMetaMsg
=
(
STableMetaMsg
*
)
pSql
->
res
.
pRsp
;
pMetaMsg
->
tid
=
htonl
(
pMetaMsg
->
tid
);
pMetaMsg
->
sversion
=
htons
(
pMetaMsg
->
sversion
);
pMetaMsg
->
tversion
=
htons
(
pMetaMsg
->
tversion
);
pMetaMsg
->
tid
=
htonl
(
pMetaMsg
->
tid
);
pMetaMsg
->
sversion
=
htons
(
pMetaMsg
->
sversion
);
pMetaMsg
->
tversion
=
htons
(
pMetaMsg
->
tversion
);
pMetaMsg
->
vgroup
.
vgId
=
htonl
(
pMetaMsg
->
vgroup
.
vgId
);
pMetaMsg
->
uid
=
htobe64
(
pMetaMsg
->
uid
);
pMetaMsg
->
contLen
=
htons
(
pMetaMsg
->
contLen
);
pMetaMsg
->
uid
=
htobe64
(
pMetaMsg
->
uid
);
pMetaMsg
->
suid
=
htobe64
(
pMetaMsg
->
s
uid
);
pMetaMsg
->
contLen
=
htons
(
pMetaMsg
->
contLen
);
pMetaMsg
->
numOfColumns
=
htons
(
pMetaMsg
->
numOfColumns
);
if
((
pMetaMsg
->
tableType
!=
TSDB_SUPER_TABLE
)
&&
...
...
@@ -2537,19 +2537,16 @@ int32_t tscGetTableMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) {
pTableMetaInfo
->
pTableMeta
=
calloc
(
1
,
size
);
pTableMetaInfo
->
tableMetaSize
=
size
;
}
else
if
(
pTableMetaInfo
->
tableMetaSize
<
size
)
{
char
*
tmp
=
realloc
(
pTableMetaInfo
->
pTableMeta
,
size
);
if
(
tmp
==
NULL
)
{
char
*
tmp
=
realloc
(
pTableMetaInfo
->
pTableMeta
,
size
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
pTableMetaInfo
->
pTableMeta
=
(
STableMeta
*
)
tmp
;
memset
(
pTableMetaInfo
->
pTableMeta
,
0
,
size
);
pTableMetaInfo
->
tableMetaSize
=
size
;
}
else
{
//uint32_t s = tscGetTableMetaSize(pTableMetaInfo->pTableMeta);
memset
(
pTableMetaInfo
->
pTableMeta
,
0
,
size
);
pTableMetaInfo
->
tableMetaSize
=
size
;
}
memset
(
pTableMetaInfo
->
pTableMeta
,
0
,
size
);
pTableMetaInfo
->
tableMetaSize
=
size
;
pTableMetaInfo
->
pTableMeta
->
tableType
=
-
1
;
pTableMetaInfo
->
pTableMeta
->
tableInfo
.
numOfColumns
=
-
1
;
...
...
@@ -2565,8 +2562,9 @@ int32_t tscGetTableMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) {
STableMeta
*
pMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
pMeta
->
id
.
uid
>
0
)
{
// in case of child table, here only get the
if
(
pMeta
->
tableType
==
TSDB_CHILD_TABLE
)
{
int32_t
code
=
tscCreateTableMetaFrom
CChild
Meta
(
pTableMetaInfo
->
pTableMeta
,
name
,
buf
);
int32_t
code
=
tscCreateTableMetaFrom
STable
Meta
(
pTableMetaInfo
->
pTableMeta
,
name
,
buf
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
getTableMetaFromMnode
(
pSql
,
pTableMetaInfo
);
}
...
...
src/client/src/tscUtil.c
浏览文件 @
e620e2e8
...
...
@@ -2941,22 +2941,25 @@ CChildTableMeta* tscCreateChildMeta(STableMeta* pTableMeta) {
assert
(
pTableMeta
!=
NULL
);
CChildTableMeta
*
cMeta
=
calloc
(
1
,
sizeof
(
CChildTableMeta
));
cMeta
->
tableType
=
TSDB_CHILD_TABLE
;
cMeta
->
vgId
=
pTableMeta
->
vgId
;
cMeta
->
id
=
pTableMeta
->
id
;
cMeta
->
vgId
=
pTableMeta
->
vgId
;
cMeta
->
id
=
pTableMeta
->
id
;
cMeta
->
suid
=
pTableMeta
->
suid
;
tstrncpy
(
cMeta
->
sTableName
,
pTableMeta
->
sTableName
,
TSDB_TABLE_FNAME_LEN
);
return
cMeta
;
}
int32_t
tscCreateTableMetaFrom
CChild
Meta
(
STableMeta
*
pChild
,
const
char
*
name
,
void
*
buf
)
{
int32_t
tscCreateTableMetaFrom
STable
Meta
(
STableMeta
*
pChild
,
const
char
*
name
,
void
*
buf
)
{
assert
(
pChild
!=
NULL
&&
buf
!=
NULL
);
// uint32_t size = tscGetTableMetaMaxSize();
STableMeta
*
p
=
buf
;
//calloc(1, size);
STableMeta
*
p
=
buf
;
taosHashGetClone
(
tscTableMetaInfo
,
pChild
->
sTableName
,
strnlen
(
pChild
->
sTableName
,
TSDB_TABLE_FNAME_LEN
),
NULL
,
p
,
-
1
);
if
(
p
->
id
.
uid
>
0
)
{
// tableMeta exists, build child table meta and return
// tableMeta exists, build child table meta according to the super table meta
// the uid need to be checked in addition to the general name of the super table.
if
(
p
->
id
.
uid
>
0
&&
pChild
->
suid
==
p
->
id
.
uid
)
{
pChild
->
sversion
=
p
->
sversion
;
pChild
->
tversion
=
p
->
tversion
;
...
...
@@ -2964,13 +2967,9 @@ int32_t tscCreateTableMetaFromCChildMeta(STableMeta* pChild, const char* name, v
int32_t
total
=
pChild
->
tableInfo
.
numOfColumns
+
pChild
->
tableInfo
.
numOfTags
;
memcpy
(
pChild
->
schema
,
p
->
schema
,
sizeof
(
SSchema
)
*
total
);
// tfree(p);
return
TSDB_CODE_SUCCESS
;
}
else
{
// super table has been removed, current tableMeta is also expired. remove it here
taosHashRemove
(
tscTableMetaInfo
,
name
,
strnlen
(
name
,
TSDB_TABLE_FNAME_LEN
));
// tfree(p);
return
-
1
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录