Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
89c8b768
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
89c8b768
编写于
4月 22, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact META 9
上级
159f3acd
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
72 addition
and
156 deletion
+72
-156
.gitignore
.gitignore
+1
-0
include/common/tmsg.h
include/common/tmsg.h
+27
-27
source/common/src/tmsg.c
source/common/src/tmsg.c
+6
-38
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+7
-7
source/dnode/vnode/src/inc/meta.h
source/dnode/vnode/src/inc/meta.h
+5
-10
source/dnode/vnode/src/meta/metaEntry.c
source/dnode/vnode/src/meta/metaEntry.c
+6
-45
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+3
-12
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+10
-10
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+7
-7
未找到文件。
.gitignore
浏览文件 @
89c8b768
...
...
@@ -107,3 +107,4 @@ TAGS
contrib/*
!contrib/CMakeLists.txt
!contrib/test
sql
\ No newline at end of file
include/common/tmsg.h
浏览文件 @
89c8b768
...
...
@@ -269,6 +269,12 @@ typedef struct SSchema {
#define SSCHMEA_BYTES(s) ((s)->bytes)
#define SSCHMEA_NAME(s) ((s)->name)
typedef
struct
{
int32_t
nCols
;
int32_t
sver
;
SSchema
*
pSchema
;
}
SSchemaWrapper
;
STSchema
*
tdGetSTSChemaFromSSChema
(
SSchema
**
pSchema
,
int32_t
nCols
);
typedef
struct
{
...
...
@@ -1501,11 +1507,8 @@ typedef struct SVCreateStbReq {
const
char
*
name
;
tb_uid_t
suid
;
int8_t
rollup
;
int16_t
nCols
;
int16_t
sver
;
SSchema
*
pSchema
;
int16_t
nTags
;
SSchema
*
pSchemaTg
;
SSchemaWrapper
schema
;
SSchemaWrapper
schemaTag
;
SRSmaParam
pRSmaParam
;
}
SVCreateStbReq
;
...
...
@@ -1532,9 +1535,7 @@ typedef struct SVCreateTbReq {
const
void
*
pTag
;
}
ctb
;
struct
{
int16_t
nCols
;
int16_t
sver
;
SSchema
*
pSchema
;
SSchemaWrapper
schema
;
}
ntb
;
};
}
SVCreateTbReq
;
...
...
@@ -2160,11 +2161,6 @@ int32_t tDecodeSMqOffset(SCoder* decoder, SMqOffset* pOffset);
int32_t
tEncodeSMqCMCommitOffsetReq
(
SCoder
*
encoder
,
const
SMqCMCommitOffsetReq
*
pReq
);
int32_t
tDecodeSMqCMCommitOffsetReq
(
SCoder
*
decoder
,
SMqCMCommitOffsetReq
*
pReq
);
typedef
struct
{
uint32_t
nCols
;
SSchema
*
pSchema
;
}
SSchemaWrapper
;
static
FORCE_INLINE
int32_t
taosEncodeSSchema
(
void
**
buf
,
const
SSchema
*
pSchema
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI8
(
buf
,
pSchema
->
type
);
...
...
@@ -2204,7 +2200,8 @@ static FORCE_INLINE int32_t tDecodeSSchema(SCoder* pDecoder, SSchema* pSchema) {
static
FORCE_INLINE
int32_t
taosEncodeSSchemaWrapper
(
void
**
buf
,
const
SSchemaWrapper
*
pSW
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedU32
(
buf
,
pSW
->
nCols
);
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
nCols
);
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
sver
);
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
tlen
+=
taosEncodeSSchema
(
buf
,
&
pSW
->
pSchema
[
i
]);
}
...
...
@@ -2212,7 +2209,8 @@ static FORCE_INLINE int32_t taosEncodeSSchemaWrapper(void** buf, const SSchemaWr
}
static
FORCE_INLINE
void
*
taosDecodeSSchemaWrapper
(
void
*
buf
,
SSchemaWrapper
*
pSW
)
{
buf
=
taosDecodeFixedU32
(
buf
,
&
pSW
->
nCols
);
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
nCols
);
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
sver
);
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
if
(
pSW
->
pSchema
==
NULL
)
{
return
NULL
;
...
...
@@ -2225,23 +2223,25 @@ static FORCE_INLINE void* taosDecodeSSchemaWrapper(void* buf, SSchemaWrapper* pS
}
static
FORCE_INLINE
int32_t
tEncodeSSchemaWrapper
(
SCoder
*
pEncoder
,
const
SSchemaWrapper
*
pSW
)
{
if
(
tEncodeU32
(
pEncoder
,
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
sver
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
if
(
tEncodeSSchema
(
pEncoder
,
&
pSW
->
pSchema
[
i
])
<
0
)
return
-
1
;
}
return
pEncoder
->
pos
;
return
0
;
}
static
FORCE_INLINE
int32_t
tDecodeSSchemaWrapper
(
SCoder
*
pDecoder
,
SSchemaWrapper
*
pSW
)
{
if
(
tDecodeU32
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
void
*
ptr
=
taosMemoryRealloc
(
pSW
->
pSchema
,
pSW
->
nCols
*
sizeof
(
SSchema
));
if
(
ptr
==
NULL
)
{
return
-
1
;
}
pSW
->
pSchema
=
(
SSchema
*
)
ptr
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
sver
)
<
0
)
return
-
1
;
pSW
->
pSchema
=
(
SSchema
*
)
TCODER_MALLOC
(
pDecoder
,
sizeof
(
SSchema
)
*
pSW
->
nCols
);
if
(
pSW
->
pSchema
==
NULL
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
if
(
tDecodeSSchema
(
pDecoder
,
&
pSW
->
pSchema
[
i
])
<
0
)
return
-
1
;
}
return
0
;
}
...
...
source/common/src/tmsg.c
浏览文件 @
89c8b768
...
...
@@ -3522,15 +3522,8 @@ int tEncodeSVCreateStbReq(SCoder *pCoder, const SVCreateStbReq *pReq) {
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pCoder
,
pReq
->
rollup
)
<
0
)
return
-
1
;
if
(
tEncodeI16v
(
pCoder
,
pReq
->
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI16v
(
pCoder
,
pReq
->
sver
)
<
0
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pReq
->
nCols
;
iCol
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pReq
->
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tEncodeI16v
(
pCoder
,
pReq
->
nTags
)
<
0
)
return
-
1
;
for
(
int
iTag
=
0
;
iTag
<
pReq
->
nTags
;
iTag
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pReq
->
pSchemaTg
+
iTag
)
<
0
)
return
-
1
;
}
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schemaTag
)
<
0
)
return
-
1
;
// if (pReq->rollup) {
// if (tEncodeSRSmaParam(pCoder, pReq->pRSmaParam) < 0) return -1;
// }
...
...
@@ -3545,22 +3538,8 @@ int tDecodeSVCreateStbReq(SCoder *pCoder, SVCreateStbReq *pReq) {
if
(
tDecodeCStr
(
pCoder
,
&
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
pCoder
,
&
pReq
->
rollup
)
<
0
)
return
-
1
;
if
(
tDecodeI16v
(
pCoder
,
&
pReq
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI16v
(
pCoder
,
&
pReq
->
sver
)
<
0
)
return
-
1
;
pReq
->
pSchema
=
(
SSchema
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
SSchema
)
*
pReq
->
nCols
);
if
(
pReq
->
pSchema
==
NULL
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pReq
->
nCols
;
iCol
++
)
{
if
(
tDecodeSSchema
(
pCoder
,
pReq
->
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tDecodeI16v
(
pCoder
,
&
pReq
->
nTags
)
<
0
)
return
-
1
;
pReq
->
pSchemaTg
=
(
SSchema
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
SSchema
)
*
pReq
->
nTags
);
if
(
pReq
->
pSchemaTg
==
NULL
)
return
-
1
;
pReq
->
pSchemaTg
=
(
SSchema
*
)
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pReq
->
nTags
);
for
(
int
iTag
=
0
;
iTag
<
pReq
->
nTags
;
iTag
++
)
{
if
(
tDecodeSSchema
(
pCoder
,
pReq
->
pSchemaTg
+
iTag
)
<
0
)
return
-
1
;
}
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schemaTag
)
<
0
)
return
-
1
;
// if (pReq->rollup) {
// if (tDecodeSRSmaParam(pCoder, pReq->pRSmaParam) < 0) return -1;
// }
...
...
@@ -3607,12 +3586,7 @@ int tEncodeSVCreateTbReq(SCoder *pCoder, const SVCreateTbReq *pReq) {
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pCoder
,
pReq
->
ctb
.
pTag
,
kvRowLen
(
pReq
->
ctb
.
pTag
))
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tEncodeI16v
(
pCoder
,
pReq
->
ntb
.
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI16v
(
pCoder
,
pReq
->
ntb
.
sver
)
<
0
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pReq
->
ntb
.
nCols
;
iCol
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pReq
->
ntb
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schema
)
<
0
)
return
-
1
;
}
else
{
ASSERT
(
0
);
}
...
...
@@ -3635,13 +3609,7 @@ int tDecodeSVCreateTbReq(SCoder *pCoder, SVCreateTbReq *pReq) {
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pCoder
,
&
pReq
->
ctb
.
pTag
,
NULL
)
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tDecodeI16v
(
pCoder
,
&
pReq
->
ntb
.
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI16v
(
pCoder
,
&
pReq
->
ntb
.
sver
)
<
0
)
return
-
1
;
pReq
->
ntb
.
pSchema
=
(
SSchema
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
SSchema
)
*
pReq
->
ntb
.
nCols
);
if
(
pReq
->
ntb
.
pSchema
==
NULL
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pReq
->
ntb
.
nCols
;
iCol
++
)
{
if
(
tDecodeSSchema
(
pCoder
,
pReq
->
ntb
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schema
)
<
0
)
return
-
1
;
}
else
{
ASSERT
(
0
);
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
89c8b768
...
...
@@ -407,15 +407,15 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
req
.
name
=
(
char
*
)
tNameGetTableName
(
&
name
);
req
.
suid
=
pStb
->
uid
;
req
.
rollup
=
pStb
->
aggregationMethod
>
-
1
?
1
:
0
;
req
.
nCols
=
pStb
->
numOfColumns
;
req
.
s
ver
=
0
;
// TODO
req
.
pSchema
=
pStb
->
pColumns
;
req
.
nTag
s
=
pStb
->
numOfTags
;
req
.
pSchemaTg
=
pStb
->
pTags
;
req
.
schema
.
nCols
=
pStb
->
numOfColumns
;
req
.
s
chema
.
sver
=
0
;
req
.
schema
.
pSchema
=
pStb
->
pColumns
;
req
.
schemaTag
.
nCol
s
=
pStb
->
numOfTags
;
req
.
schemaTag
.
pSchema
=
pStb
->
pTags
;
// TODO: remove here
for
(
int
iCol
=
0
;
iCol
<
req
.
nCols
;
iCol
++
)
{
req
.
pSchema
[
iCol
].
flags
=
SCHEMA_SMA_ON
;
for
(
int
iCol
=
0
;
iCol
<
req
.
schema
.
nCols
;
iCol
++
)
{
req
.
schema
.
pSchema
[
iCol
].
flags
=
SCHEMA_SMA_ON
;
}
if
(
req
.
rollup
)
{
...
...
source/dnode/vnode/src/inc/meta.h
浏览文件 @
89c8b768
...
...
@@ -140,11 +140,8 @@ struct SMetaEntry {
const
char
*
name
;
union
{
struct
{
int16_t
nCols
;
int16_t
sver
;
SSchema
*
pSchema
;
int16_t
nTags
;
SSchema
*
pSchemaTg
;
SSchemaWrapper
schema
;
SSchemaWrapper
schemaTag
;
}
stbEntry
;
struct
{
int64_t
ctime
;
...
...
@@ -155,9 +152,7 @@ struct SMetaEntry {
struct
{
int64_t
ctime
;
int32_t
ttlDays
;
int16_t
nCols
;
int16_t
sver
;
SSchema
*
pSchema
;
SSchemaWrapper
schema
;
}
ntbEntry
;
};
};
...
...
source/dnode/vnode/src/meta/metaEntry.c
浏览文件 @
89c8b768
...
...
@@ -23,16 +23,8 @@ int metaEncodeEntry(SCoder *pCoder, const SMetaEntry *pME) {
if
(
tEncodeCStr
(
pCoder
,
pME
->
name
)
<
0
)
return
-
1
;
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
tEncodeI16v
(
pCoder
,
pME
->
stbEntry
.
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI16v
(
pCoder
,
pME
->
stbEntry
.
sver
)
<
0
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pME
->
stbEntry
.
nCols
;
iCol
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pME
->
stbEntry
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tEncodeI16v
(
pCoder
,
pME
->
stbEntry
.
nTags
)
<
0
)
return
-
1
;
for
(
int
iTag
=
0
;
iTag
<
pME
->
stbEntry
.
nTags
;
iTag
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pME
->
stbEntry
.
pSchemaTg
+
iTag
)
<
0
)
return
-
1
;
}
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schema
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schemaTag
)
<
0
)
return
-
1
;
}
else
if
(
pME
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tEncodeI64
(
pCoder
,
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pME
->
ctbEntry
.
ttlDays
)
<
0
)
return
-
1
;
...
...
@@ -41,11 +33,7 @@ int metaEncodeEntry(SCoder *pCoder, const SMetaEntry *pME) {
}
else
if
(
pME
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tEncodeI64
(
pCoder
,
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tEncodeI16v
(
pCoder
,
pME
->
ntbEntry
.
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI16v
(
pCoder
,
pME
->
ntbEntry
.
sver
)
<
0
)
return
-
1
;
for
(
int
iCol
=
0
;
iCol
<
pME
->
ntbEntry
.
nCols
;
iCol
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pME
->
ntbEntry
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
ntbEntry
.
schema
)
<
0
)
return
-
1
;
}
else
{
ASSERT
(
0
);
}
...
...
@@ -62,26 +50,8 @@ int metaDecodeEntry(SCoder *pCoder, SMetaEntry *pME) {
if
(
tDecodeCStr
(
pCoder
,
&
pME
->
name
)
<
0
)
return
-
1
;
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
tDecodeI16v
(
pCoder
,
&
pME
->
stbEntry
.
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI16v
(
pCoder
,
&
pME
->
stbEntry
.
sver
)
<
0
)
return
-
1
;
pME
->
stbEntry
.
pSchema
=
(
SSchema
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
SSchema
)
*
pME
->
stbEntry
.
nCols
);
if
(
pME
->
stbEntry
.
pSchema
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int
iCol
=
0
;
iCol
<
pME
->
stbEntry
.
nCols
;
iCol
++
)
{
if
(
tDecodeSSchema
(
pCoder
,
pME
->
stbEntry
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tDecodeI16v
(
pCoder
,
&
pME
->
stbEntry
.
nTags
)
<
0
)
return
-
1
;
pME
->
stbEntry
.
pSchemaTg
=
(
SSchema
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
SSchema
)
*
pME
->
stbEntry
.
nTags
);
if
(
pME
->
stbEntry
.
pSchemaTg
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int
iTag
=
0
;
iTag
<
pME
->
stbEntry
.
nTags
;
iTag
++
)
{
if
(
tDecodeSSchema
(
pCoder
,
pME
->
stbEntry
.
pSchemaTg
+
iTag
)
<
0
)
return
-
1
;
}
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schema
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schemaTag
)
<
0
)
return
-
1
;
}
else
if
(
pME
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pME
->
ctbEntry
.
ttlDays
)
<
0
)
return
-
1
;
...
...
@@ -90,16 +60,7 @@ int metaDecodeEntry(SCoder *pCoder, SMetaEntry *pME) {
}
else
if
(
pME
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tDecodeI16v
(
pCoder
,
&
pME
->
ntbEntry
.
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI16v
(
pCoder
,
&
pME
->
ntbEntry
.
sver
)
<
0
)
return
-
1
;
pME
->
ntbEntry
.
pSchema
=
(
SSchema
*
)
TCODER_MALLOC
(
pCoder
,
sizeof
(
SSchema
)
*
pME
->
ntbEntry
.
nCols
);
if
(
pME
->
ntbEntry
.
pSchema
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
for
(
int
iCol
=
0
;
iCol
<
pME
->
ntbEntry
.
nCols
;
iCol
++
)
{
if
(
tEncodeSSchema
(
pCoder
,
pME
->
ntbEntry
.
pSchema
+
iCol
)
<
0
)
return
-
1
;
}
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pME
->
ntbEntry
.
schema
)
<
0
)
return
-
1
;
}
else
{
ASSERT
(
0
);
}
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
89c8b768
...
...
@@ -23,7 +23,6 @@ static int metaCreateChildTable(SMeta *pMeta, int64_t version, SMetaEntry *pME);
static
int
metaUpdateTtlIdx
(
SMeta
*
pMeta
,
int64_t
dtime
,
tb_uid_t
uid
);
int
metaCreateSTable
(
SMeta
*
pMeta
,
int64_t
version
,
SVCreateStbReq
*
pReq
)
{
SSkmDbKey
skmDbKey
=
{
0
};
SMetaEntry
me
=
{
0
};
int
kLen
=
0
;
int
vLen
=
0
;
...
...
@@ -42,14 +41,8 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
me
.
type
=
TSDB_SUPER_TABLE
;
me
.
uid
=
pReq
->
suid
;
me
.
name
=
pReq
->
name
;
me
.
stbEntry
.
nCols
=
pReq
->
nCols
;
me
.
stbEntry
.
sver
=
pReq
->
sver
;
me
.
stbEntry
.
pSchema
=
pReq
->
pSchema
;
me
.
stbEntry
.
nTags
=
pReq
->
nTags
;
me
.
stbEntry
.
pSchemaTg
=
pReq
->
pSchemaTg
;
skmDbKey
.
uid
=
pReq
->
suid
;
skmDbKey
.
sver
=
0
;
// (TODO)
me
.
stbEntry
.
schema
=
pReq
->
schema
;
me
.
stbEntry
.
schemaTag
=
pReq
->
schemaTag
;
// save to table.db
if
(
metaSaveToTbDb
(
pMeta
,
version
,
&
me
)
<
0
)
goto
_err
;
...
...
@@ -108,9 +101,7 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
}
else
{
me
.
ntbEntry
.
ctime
=
pReq
->
ctime
;
me
.
ntbEntry
.
ttlDays
=
pReq
->
ttl
;
me
.
ntbEntry
.
nCols
=
pReq
->
ntb
.
nCols
;
me
.
ntbEntry
.
sver
=
pReq
->
ntb
.
sver
;
me
.
ntbEntry
.
pSchema
=
pReq
->
ntb
.
pSchema
;
me
.
ntbEntry
.
schema
=
pReq
->
ntb
.
schema
;
}
// save table
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
89c8b768
...
...
@@ -65,35 +65,35 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
metaRsp
.
tuid
=
meReader1
.
me
.
uid
;
if
(
meReader1
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
strcpy
(
metaRsp
.
stbName
,
meReader1
.
me
.
name
);
metaRsp
.
numOfTags
=
meReader1
.
me
.
stbEntry
.
nTag
s
;
metaRsp
.
numOfColumns
=
meReader1
.
me
.
stbEntry
.
nCols
;
metaRsp
.
numOfTags
=
meReader1
.
me
.
stbEntry
.
schemaTag
.
nCol
s
;
metaRsp
.
numOfColumns
=
meReader1
.
me
.
stbEntry
.
schema
.
nCols
;
metaRsp
.
suid
=
meReader1
.
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
,
meReader1
.
me
.
stbEntry
.
pSchema
,
sizeof
(
SSchema
)
*
metaRsp
.
numOfColumns
);
memcpy
(
metaRsp
.
pSchemas
+
metaRsp
.
numOfColumns
,
meReader1
.
me
.
stbEntry
.
pSchemaTg
,
memcpy
(
metaRsp
.
pSchemas
,
meReader1
.
me
.
stbEntry
.
schema
.
pSchema
,
sizeof
(
SSchema
)
*
metaRsp
.
numOfColumns
);
memcpy
(
metaRsp
.
pSchemas
+
metaRsp
.
numOfColumns
,
meReader1
.
me
.
stbEntry
.
schemaTag
.
pSchema
,
sizeof
(
SSchema
)
*
metaRsp
.
numOfTags
);
}
else
if
(
meReader1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
strcpy
(
metaRsp
.
stbName
,
meReader2
.
me
.
name
);
metaRsp
.
numOfTags
=
meReader2
.
me
.
stbEntry
.
nTag
s
;
metaRsp
.
numOfColumns
=
meReader2
.
me
.
stbEntry
.
nCols
;
metaRsp
.
numOfTags
=
meReader2
.
me
.
stbEntry
.
schemaTag
.
nCol
s
;
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
.
pSchema
,
sizeof
(
SSchema
)
*
metaRsp
.
numOfColumns
);
memcpy
(
metaRsp
.
pSchemas
+
metaRsp
.
numOfColumns
,
meReader2
.
me
.
stbEntry
.
pSchemaTg
,
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
.
nCols
;
metaRsp
.
numOfColumns
=
meReader1
.
me
.
ntbEntry
.
schema
.
nCols
;
metaRsp
.
suid
=
0
;
metaRsp
.
pSchemas
=
meReader1
.
me
.
ntbEntry
.
pSchema
;
metaRsp
.
pSchemas
=
meReader1
.
me
.
ntbEntry
.
schema
.
pSchema
;
}
else
{
ASSERT
(
0
);
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
89c8b768
...
...
@@ -3158,7 +3158,7 @@ typedef struct SVgroupTablesBatch {
static
void
destroyCreateTbReq
(
SVCreateTbReq
*
pReq
)
{
taosMemoryFreeClear
(
pReq
->
name
);
taosMemoryFreeClear
(
pReq
->
ntb
.
pSchema
);
taosMemoryFreeClear
(
pReq
->
ntb
.
schema
.
pSchema
);
}
static
int32_t
buildSmaParam
(
STableOptions
*
pOptions
,
SVCreateTbReq
*
pReq
)
{
...
...
@@ -3196,17 +3196,17 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TD_NORMAL_TABLE
;
req
.
name
=
strdup
(
pStmt
->
tableName
);
req
.
ntb
.
nCols
=
LIST_LENGTH
(
pStmt
->
pCols
);
req
.
ntb
.
sver
=
0
;
req
.
ntb
.
pSchema
=
taosMemoryCalloc
(
req
.
ntb
.
nCols
,
sizeof
(
SSchema
));
if
(
NULL
==
req
.
name
||
NULL
==
req
.
ntb
.
pSchema
)
{
req
.
ntb
.
schema
.
nCols
=
LIST_LENGTH
(
pStmt
->
pCols
);
req
.
ntb
.
s
chema
.
s
ver
=
0
;
req
.
ntb
.
schema
.
pSchema
=
taosMemoryCalloc
(
req
.
ntb
.
schema
.
nCols
,
sizeof
(
SSchema
));
if
(
NULL
==
req
.
name
||
NULL
==
req
.
ntb
.
schema
.
pSchema
)
{
destroyCreateTbReq
(
&
req
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
SNode
*
pCol
;
col_id_t
index
=
0
;
FOREACH
(
pCol
,
pStmt
->
pCols
)
{
toSchema
((
SColumnDefNode
*
)
pCol
,
index
+
1
,
req
.
ntb
.
pSchema
+
index
);
toSchema
((
SColumnDefNode
*
)
pCol
,
index
+
1
,
req
.
ntb
.
schema
.
pSchema
+
index
);
++
index
;
}
if
(
TSDB_CODE_SUCCESS
!=
buildSmaParam
(
pStmt
->
pOptions
,
&
req
))
{
...
...
@@ -3264,7 +3264,7 @@ static void destroyCreateTbReqBatch(SVgroupTablesBatch* pTbBatch) {
taosMemoryFreeClear
(
pTableReq
->
name
);
if
(
pTableReq
->
type
==
TSDB_NORMAL_TABLE
)
{
taosMemoryFreeClear
(
pTableReq
->
ntb
.
pSchema
);
taosMemoryFreeClear
(
pTableReq
->
ntb
.
schema
.
pSchema
);
}
else
if
(
pTableReq
->
type
==
TSDB_CHILD_TABLE
)
{
taosMemoryFreeClear
(
pTableReq
->
ctb
.
pTag
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录