Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
07720702
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看板
提交
07720702
编写于
4月 24, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more refact meta
上级
ad9fd5ec
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
45 addition
and
54 deletion
+45
-54
source/common/src/tmsg.c
source/common/src/tmsg.c
+5
-3
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+1
-0
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+38
-49
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+1
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+0
-2
未找到文件。
source/common/src/tmsg.c
浏览文件 @
07720702
...
@@ -3568,8 +3568,8 @@ int tDecodeSVCreateStbReq(SCoder *pCoder, SVCreateStbReq *pReq) {
...
@@ -3568,8 +3568,8 @@ int tDecodeSVCreateStbReq(SCoder *pCoder, SVCreateStbReq *pReq) {
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pCoder
,
&
pReq
->
rollup
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pCoder
,
&
pReq
->
rollup
)
<
0
)
return
-
1
;
if
(
t
En
codeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
)
<
0
)
return
-
1
;
if
(
t
De
codeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
)
<
0
)
return
-
1
;
if
(
t
En
codeSSchemaWrapper
(
pCoder
,
&
pReq
->
schemaTag
)
<
0
)
return
-
1
;
if
(
t
De
codeSSchemaWrapper
(
pCoder
,
&
pReq
->
schemaTag
)
<
0
)
return
-
1
;
// if (pReq->rollup) {
// if (pReq->rollup) {
// if (tDecodeSRSmaParam(pCoder, pReq->pRSmaParam) < 0) return -1;
// if (tDecodeSRSmaParam(pCoder, pReq->pRSmaParam) < 0) return -1;
// }
// }
...
@@ -3626,6 +3626,8 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
...
@@ -3626,6 +3626,8 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
}
}
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
int
tDecodeSVCreateTbReq
(
SCoder
*
pCoder
,
SVCreateTbReq
*
pReq
)
{
uint64_t
len
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
pCoder
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
uid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
uid
)
<
0
)
return
-
1
;
...
@@ -3637,7 +3639,7 @@ int tDecodeSVCreateTbReq(SCoder *pCoder, SVCreateTbReq *pReq) {
...
@@ -3637,7 +3639,7 @@ int tDecodeSVCreateTbReq(SCoder *pCoder, SVCreateTbReq *pReq) {
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
pReq
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pCoder
,
&
pReq
->
ctb
.
pTag
,
NULL
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pCoder
,
&
pReq
->
ctb
.
pTag
,
&
len
)
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schema
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schema
)
<
0
)
return
-
1
;
}
else
{
}
else
{
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
07720702
...
@@ -83,6 +83,7 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
...
@@ -83,6 +83,7 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
}
}
// build SMetaEntry
// build SMetaEntry
me
.
version
=
version
;
me
.
type
=
pReq
->
type
;
me
.
type
=
pReq
->
type
;
me
.
uid
=
pReq
->
uid
;
me
.
uid
=
pReq
->
uid
;
me
.
name
=
pReq
->
name
;
me
.
name
=
pReq
->
name
;
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
07720702
...
@@ -24,13 +24,15 @@ void vnodeQueryClose(SVnode *pVnode) { qWorkerDestroy((void **)&pVnode->pQuery);
...
@@ -24,13 +24,15 @@ void vnodeQueryClose(SVnode *pVnode) { qWorkerDestroy((void **)&pVnode->pQuery);
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
STableInfoReq
infoReq
=
{
0
};
STableInfoReq
infoReq
=
{
0
};
STableMetaRsp
metaRsp
=
{
0
};
STableMetaRsp
metaRsp
=
{
0
};
SMetaEntryReader
me
Reade
r1
=
{
0
};
SMetaEntryReader
mer1
=
{
0
};
SMetaEntryReader
me
Reade
r2
=
{
0
};
SMetaEntryReader
mer2
=
{
0
};
char
tableFName
[
TSDB_TABLE_FNAME_LEN
];
char
tableFName
[
TSDB_TABLE_FNAME_LEN
];
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
int32_t
code
=
0
;
int32_t
code
=
0
;
int32_t
rspLen
=
0
;
int32_t
rspLen
=
0
;
void
*
pRsp
=
NULL
;
void
*
pRsp
=
NULL
;
SSchemaWrapper
schema
=
{
0
};
SSchemaWrapper
schemaTag
=
{
0
};
// decode req
// decode req
if
(
tDeserializeSTableInfoReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
infoReq
)
!=
0
)
{
if
(
tDeserializeSTableInfoReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
infoReq
)
!=
0
)
{
...
@@ -38,9 +40,10 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -38,9 +40,10 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
goto
_exit
;
goto
_exit
;
}
}
metaRsp
.
dbId
=
pVnode
->
config
.
dbId
;
strcpy
(
metaRsp
.
tbName
,
infoReq
.
tbName
);
strcpy
(
metaRsp
.
tbName
,
infoReq
.
tbName
);
memcpy
(
metaRsp
.
dbFName
,
infoReq
.
dbFName
,
sizeof
(
metaRsp
.
dbFName
));
memcpy
(
metaRsp
.
dbFName
,
infoReq
.
dbFName
,
sizeof
(
metaRsp
.
dbFName
));
metaRsp
.
dbId
=
pVnode
->
config
.
dbId
;
sprintf
(
tableFName
,
"%s.%s"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
sprintf
(
tableFName
,
"%s.%s"
,
infoReq
.
dbFName
,
infoReq
.
tbName
);
code
=
vnodeValidateTableHash
(
pVnode
,
tableFName
);
code
=
vnodeValidateTableHash
(
pVnode
,
tableFName
);
if
(
code
)
{
if
(
code
)
{
...
@@ -48,56 +51,44 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -48,56 +51,44 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
}
}
// query meta
// query meta
metaEntryReaderInit
(
&
me
Reade
r1
);
metaEntryReaderInit
(
&
mer1
);
if
(
metaGetTableEntryByName
(
pVnode
->
pMeta
,
&
me
Reade
r1
,
infoReq
.
tbName
)
<
0
)
{
if
(
metaGetTableEntryByName
(
pVnode
->
pMeta
,
&
mer1
,
infoReq
.
tbName
)
<
0
)
{
goto
_exit
;
goto
_exit
;
}
}
if
(
meReader1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
metaRsp
.
tableType
=
mer1
.
me
.
type
;
metaEntryReaderInit
(
&
meReader2
);
if
(
metaGetTableEntryByUid
(
pVnode
->
pMeta
,
&
meReader2
,
meReader1
.
me
.
ctbEntry
.
suid
)
<
0
)
goto
_exit
;
}
// fill response
metaRsp
.
tableType
=
meReader1
.
me
.
type
;
metaRsp
.
vgId
=
TD_VID
(
pVnode
);
metaRsp
.
vgId
=
TD_VID
(
pVnode
);
metaRsp
.
tuid
=
meReader1
.
me
.
uid
;
metaRsp
.
tuid
=
mer1
.
me
.
uid
;
if
(
meReader1
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
strcpy
(
metaRsp
.
stbName
,
meReader1
.
me
.
name
);
if
(
mer1
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
metaRsp
.
numOfTags
=
meReader1
.
me
.
stbEntry
.
schemaTag
.
nCols
;
schema
=
mer1
.
me
.
stbEntry
.
schema
;
metaRsp
.
numOfColumns
=
meReader1
.
me
.
stbEntry
.
schema
.
nCols
;
schemaTag
=
mer1
.
me
.
stbEntry
.
schemaTag
;
metaRsp
.
suid
=
meReader1
.
me
.
uid
;
metaRsp
.
suid
=
mer1
.
me
.
uid
;
metaRsp
.
pSchemas
=
taosMemoryMalloc
((
metaRsp
.
numOfTags
+
metaRsp
.
numOfColumns
)
*
sizeof
(
SSchema
));
}
else
if
(
mer1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
if
(
metaRsp
.
pSchemas
==
NULL
)
{
metaEntryReaderInit
(
&
mer2
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
if
(
metaGetTableEntryByUid
(
pVnode
->
pMeta
,
&
mer2
,
mer1
.
me
.
ctbEntry
.
suid
)
<
0
)
goto
_exit
;
goto
_exit
;
}
metaRsp
.
suid
=
mer2
.
me
.
uid
;
memcpy
(
metaRsp
.
pSchemas
,
meReader1
.
me
.
stbEntry
.
schema
.
pSchema
,
sizeof
(
SSchema
)
*
metaRsp
.
numOfColumns
);
schema
=
mer2
.
me
.
stbEntry
.
schema
;
memcpy
(
metaRsp
.
pSchemas
+
metaRsp
.
numOfColumns
,
meReader1
.
me
.
stbEntry
.
schemaTag
.
pSchema
,
schemaTag
=
mer2
.
me
.
stbEntry
.
schemaTag
;
sizeof
(
SSchema
)
*
metaRsp
.
numOfTags
);
}
else
if
(
mer1
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
meReader1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
schema
=
mer1
.
me
.
ntbEntry
.
schema
;
strcpy
(
metaRsp
.
stbName
,
meReader2
.
me
.
name
);
metaRsp
.
numOfTags
=
meReader2
.
me
.
stbEntry
.
schemaTag
.
nCols
;
metaRsp
.
numOfColumns
=
meReader2
.
me
.
stbEntry
.
schema
.
nCols
;
metaRsp
.
suid
=
meReader2
.
me
.
uid
;
metaRsp
.
pSchemas
=
taosMemoryMalloc
((
metaRsp
.
numOfTags
+
metaRsp
.
numOfColumns
)
*
sizeof
(
SSchema
));
if
(
metaRsp
.
pSchemas
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
}
memcpy
(
metaRsp
.
pSchemas
,
meReader2
.
me
.
stbEntry
.
schema
.
pSchema
,
sizeof
(
SSchema
)
*
metaRsp
.
numOfColumns
);
memcpy
(
metaRsp
.
pSchemas
+
metaRsp
.
numOfColumns
,
meReader2
.
me
.
stbEntry
.
schemaTag
.
pSchema
,
sizeof
(
SSchema
)
*
metaRsp
.
numOfTags
);
}
else
if
(
meReader1
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
metaRsp
.
numOfTags
=
0
;
metaRsp
.
numOfColumns
=
meReader1
.
me
.
ntbEntry
.
schema
.
nCols
;
metaRsp
.
suid
=
0
;
metaRsp
.
pSchemas
=
meReader1
.
me
.
ntbEntry
.
schema
.
pSchema
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
metaRsp
.
numOfTags
=
schemaTag
.
nCols
;
metaRsp
.
numOfColumns
=
schema
.
nCols
;
metaRsp
.
precision
=
pVnode
->
config
.
tsdbCfg
.
precision
;
metaRsp
.
sversion
=
schema
.
sver
;
metaRsp
.
pSchemas
=
(
SSchema
*
)
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
(
metaRsp
.
numOfColumns
+
metaRsp
.
numOfTags
));
memcpy
(
metaRsp
.
pSchemas
,
schema
.
pSchema
,
sizeof
(
SSchema
)
*
schema
.
nCols
);
if
(
schemaTag
.
nCols
)
{
memcpy
(
metaRsp
.
pSchemas
+
schema
.
nCols
,
schemaTag
.
pSchema
,
sizeof
(
SSchema
)
*
schemaTag
.
nCols
);
}
// encode and send response
// encode and send response
rspLen
=
tSerializeSTableMetaRsp
(
NULL
,
0
,
&
metaRsp
);
rspLen
=
tSerializeSTableMetaRsp
(
NULL
,
0
,
&
metaRsp
);
if
(
rspLen
<
0
)
{
if
(
rspLen
<
0
)
{
...
@@ -121,11 +112,9 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -121,11 +112,9 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
tmsgSendRsp
(
&
rpcMsg
);
tmsgSendRsp
(
&
rpcMsg
);
_exit:
_exit:
if
(
meReader1
.
me
.
type
==
TSDB_SUPER_TABLE
||
meReader1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
taosMemoryFree
(
metaRsp
.
pSchemas
);
taosMemoryFree
(
metaRsp
.
pSchemas
);
}
metaEntryReaderClear
(
&
mer2
);
metaEntryReaderClear
(
&
meReader2
);
metaEntryReaderClear
(
&
mer1
);
metaEntryReaderClear
(
&
meReader1
);
return
code
;
return
code
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
07720702
...
@@ -309,6 +309,7 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
...
@@ -309,6 +309,7 @@ static int vnodeProcessCreateTbReq(SVnode *pVnode, int64_t version, void *pReq,
tEncodeSVCreateTbBatchRsp
(
&
coder
,
&
rsp
);
tEncodeSVCreateTbBatchRsp
(
&
coder
,
&
rsp
);
_exit:
_exit:
taosArrayClear
(
rsp
.
pArray
);
tCoderClear
(
&
coder
);
tCoderClear
(
&
coder
);
return
rcode
;
return
rcode
;
}
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
07720702
...
@@ -3351,7 +3351,6 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, c
...
@@ -3351,7 +3351,6 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, c
req
.
ctb
.
pTag
=
row
;
req
.
ctb
.
pTag
=
row
;
SVgroupTablesBatch
*
pTableBatch
=
taosHashGet
(
pVgroupHashmap
,
&
pVgInfo
->
vgId
,
sizeof
(
pVgInfo
->
vgId
));
SVgroupTablesBatch
*
pTableBatch
=
taosHashGet
(
pVgroupHashmap
,
&
pVgInfo
->
vgId
,
sizeof
(
pVgInfo
->
vgId
));
#if 0
if
(
pTableBatch
==
NULL
)
{
if
(
pTableBatch
==
NULL
)
{
SVgroupTablesBatch
tBatch
=
{
0
};
SVgroupTablesBatch
tBatch
=
{
0
};
tBatch
.
info
=
*
pVgInfo
;
tBatch
.
info
=
*
pVgInfo
;
...
@@ -3364,7 +3363,6 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, c
...
@@ -3364,7 +3363,6 @@ static void addCreateTbReqIntoVgroup(int32_t acctId, SHashObj* pVgroupHashmap, c
}
else
{
// add to the correct vgroup
}
else
{
// add to the correct vgroup
taosArrayPush
(
pTableBatch
->
req
.
pArray
,
&
req
);
taosArrayPush
(
pTableBatch
->
req
.
pArray
,
&
req
);
}
}
#endif
}
}
static
int32_t
addValToKVRow
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
const
SSchema
*
pSchema
,
static
int32_t
addValToKVRow
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
const
SSchema
*
pSchema
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录