Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fe22f0f6
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
fe22f0f6
编写于
5月 26, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use two version in server and refact
上级
c47b7939
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
174 addition
and
195 deletion
+174
-195
include/common/tmsg.h
include/common/tmsg.h
+9
-23
source/common/src/tmsg.c
source/common/src/tmsg.c
+4
-4
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+5
-6
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+1
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+2
-2
source/dnode/vnode/src/meta/metaEntry.c
source/dnode/vnode/src/meta/metaEntry.c
+4
-4
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+19
-21
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+2
-2
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+4
-4
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+21
-22
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+96
-99
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+7
-7
未找到文件。
include/common/tmsg.h
浏览文件 @
fe22f0f6
...
@@ -300,9 +300,7 @@ typedef struct SSchema {
...
@@ -300,9 +300,7 @@ typedef struct SSchema {
typedef
struct
{
typedef
struct
{
int32_t
nCols
;
int32_t
nCols
;
int32_t
sver
;
int32_t
version
;
int32_t
tagVer
;
int32_t
colVer
;
SSchema
*
pSchema
;
SSchema
*
pSchema
;
}
SSchemaWrapper
;
}
SSchemaWrapper
;
...
@@ -310,9 +308,7 @@ static FORCE_INLINE SSchemaWrapper* tCloneSSchemaWrapper(const SSchemaWrapper* p
...
@@ -310,9 +308,7 @@ static FORCE_INLINE SSchemaWrapper* tCloneSSchemaWrapper(const SSchemaWrapper* p
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
));
SSchemaWrapper
*
pSW
=
(
SSchemaWrapper
*
)
taosMemoryMalloc
(
sizeof
(
SSchemaWrapper
));
if
(
pSW
==
NULL
)
return
pSW
;
if
(
pSW
==
NULL
)
return
pSW
;
pSW
->
nCols
=
pSchemaWrapper
->
nCols
;
pSW
->
nCols
=
pSchemaWrapper
->
nCols
;
pSW
->
sver
=
pSchemaWrapper
->
sver
;
pSW
->
version
=
pSchemaWrapper
->
version
;
pSW
->
tagVer
=
pSchemaWrapper
->
tagVer
;
pSW
->
colVer
=
pSchemaWrapper
->
colVer
;
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
if
(
pSW
->
pSchema
==
NULL
)
{
if
(
pSW
->
pSchema
==
NULL
)
{
taosMemoryFree
(
pSW
);
taosMemoryFree
(
pSW
);
...
@@ -367,9 +363,7 @@ static FORCE_INLINE int32_t tDecodeSSchema(SDecoder* pDecoder, SSchema* pSchema)
...
@@ -367,9 +363,7 @@ static FORCE_INLINE int32_t tDecodeSSchema(SDecoder* pDecoder, SSchema* pSchema)
static
FORCE_INLINE
int32_t
taosEncodeSSchemaWrapper
(
void
**
buf
,
const
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
int32_t
taosEncodeSSchemaWrapper
(
void
**
buf
,
const
SSchemaWrapper
*
pSW
)
{
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
nCols
);
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
nCols
);
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
sver
);
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
version
);
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
tagVer
);
tlen
+=
taosEncodeVariantI32
(
buf
,
pSW
->
colVer
);
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
tlen
+=
taosEncodeSSchema
(
buf
,
&
pSW
->
pSchema
[
i
]);
tlen
+=
taosEncodeSSchema
(
buf
,
&
pSW
->
pSchema
[
i
]);
}
}
...
@@ -378,9 +372,7 @@ static FORCE_INLINE int32_t taosEncodeSSchemaWrapper(void** buf, const SSchemaWr
...
@@ -378,9 +372,7 @@ static FORCE_INLINE int32_t taosEncodeSSchemaWrapper(void** buf, const SSchemaWr
static
FORCE_INLINE
void
*
taosDecodeSSchemaWrapper
(
const
void
*
buf
,
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
void
*
taosDecodeSSchemaWrapper
(
const
void
*
buf
,
SSchemaWrapper
*
pSW
)
{
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
nCols
);
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
nCols
);
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
sver
);
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
version
);
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
tagVer
);
buf
=
taosDecodeVariantI32
(
buf
,
&
pSW
->
colVer
);
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
if
(
pSW
->
pSchema
==
NULL
)
{
if
(
pSW
->
pSchema
==
NULL
)
{
return
NULL
;
return
NULL
;
...
@@ -394,9 +386,7 @@ static FORCE_INLINE void* taosDecodeSSchemaWrapper(const void* buf, SSchemaWrapp
...
@@ -394,9 +386,7 @@ static FORCE_INLINE void* taosDecodeSSchemaWrapper(const void* buf, SSchemaWrapp
static
FORCE_INLINE
int32_t
tEncodeSSchemaWrapper
(
SEncoder
*
pEncoder
,
const
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
int32_t
tEncodeSSchemaWrapper
(
SEncoder
*
pEncoder
,
const
SSchemaWrapper
*
pSW
)
{
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
sver
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
version
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
tagVer
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pEncoder
,
pSW
->
colVer
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
if
(
tEncodeSSchema
(
pEncoder
,
&
pSW
->
pSchema
[
i
])
<
0
)
return
-
1
;
if
(
tEncodeSSchema
(
pEncoder
,
&
pSW
->
pSchema
[
i
])
<
0
)
return
-
1
;
}
}
...
@@ -406,9 +396,7 @@ static FORCE_INLINE int32_t tEncodeSSchemaWrapper(SEncoder* pEncoder, const SSch
...
@@ -406,9 +396,7 @@ static FORCE_INLINE int32_t tEncodeSSchemaWrapper(SEncoder* pEncoder, const SSch
static
FORCE_INLINE
int32_t
tDecodeSSchemaWrapper
(
SDecoder
*
pDecoder
,
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
int32_t
tDecodeSSchemaWrapper
(
SDecoder
*
pDecoder
,
SSchemaWrapper
*
pSW
)
{
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
sver
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
tagVer
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
colVer
)
<
0
)
return
-
1
;
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
pSW
->
pSchema
=
(
SSchema
*
)
taosMemoryCalloc
(
pSW
->
nCols
,
sizeof
(
SSchema
));
if
(
pSW
->
pSchema
==
NULL
)
return
-
1
;
if
(
pSW
->
pSchema
==
NULL
)
return
-
1
;
...
@@ -421,9 +409,7 @@ static FORCE_INLINE int32_t tDecodeSSchemaWrapper(SDecoder* pDecoder, SSchemaWra
...
@@ -421,9 +409,7 @@ static FORCE_INLINE int32_t tDecodeSSchemaWrapper(SDecoder* pDecoder, SSchemaWra
static
FORCE_INLINE
int32_t
tDecodeSSchemaWrapperEx
(
SDecoder
*
pDecoder
,
SSchemaWrapper
*
pSW
)
{
static
FORCE_INLINE
int32_t
tDecodeSSchemaWrapperEx
(
SDecoder
*
pDecoder
,
SSchemaWrapper
*
pSW
)
{
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
nCols
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
sver
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
version
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
tagVer
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pDecoder
,
&
pSW
->
colVer
)
<
0
)
return
-
1
;
pSW
->
pSchema
=
(
SSchema
*
)
tDecoderMalloc
(
pDecoder
,
pSW
->
nCols
*
sizeof
(
SSchema
));
pSW
->
pSchema
=
(
SSchema
*
)
tDecoderMalloc
(
pDecoder
,
pSW
->
nCols
*
sizeof
(
SSchema
));
if
(
pSW
->
pSchema
==
NULL
)
return
-
1
;
if
(
pSW
->
pSchema
==
NULL
)
return
-
1
;
...
@@ -1713,7 +1699,7 @@ typedef struct SVCreateStbReq {
...
@@ -1713,7 +1699,7 @@ typedef struct SVCreateStbReq {
char
*
name
;
char
*
name
;
tb_uid_t
suid
;
tb_uid_t
suid
;
int8_t
rollup
;
int8_t
rollup
;
SSchemaWrapper
schema
;
SSchemaWrapper
schema
Row
;
SSchemaWrapper
schemaTag
;
SSchemaWrapper
schemaTag
;
SRSmaParam
pRSmaParam
;
SRSmaParam
pRSmaParam
;
}
SVCreateStbReq
;
}
SVCreateStbReq
;
...
@@ -1745,7 +1731,7 @@ typedef struct SVCreateTbReq {
...
@@ -1745,7 +1731,7 @@ typedef struct SVCreateTbReq {
uint8_t
*
pTag
;
uint8_t
*
pTag
;
}
ctb
;
}
ctb
;
struct
{
struct
{
SSchemaWrapper
schema
;
SSchemaWrapper
schema
Row
;
}
ntb
;
}
ntb
;
};
};
}
SVCreateTbReq
;
}
SVCreateTbReq
;
...
...
source/common/src/tmsg.c
浏览文件 @
fe22f0f6
...
@@ -3801,7 +3801,7 @@ int tEncodeSVCreateStbReq(SEncoder *pCoder, const SVCreateStbReq *pReq) {
...
@@ -3801,7 +3801,7 @@ int tEncodeSVCreateStbReq(SEncoder *pCoder, const SVCreateStbReq *pReq) {
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pCoder
,
pReq
->
rollup
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
pCoder
,
pReq
->
rollup
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
Row
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schemaTag
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schemaTag
)
<
0
)
return
-
1
;
if
(
pReq
->
rollup
)
{
if
(
pReq
->
rollup
)
{
if
(
tEncodeSRSmaParam
(
pCoder
,
&
pReq
->
pRSmaParam
)
<
0
)
return
-
1
;
if
(
tEncodeSRSmaParam
(
pCoder
,
&
pReq
->
pRSmaParam
)
<
0
)
return
-
1
;
...
@@ -3817,7 +3817,7 @@ int tDecodeSVCreateStbReq(SDecoder *pCoder, SVCreateStbReq *pReq) {
...
@@ -3817,7 +3817,7 @@ int tDecodeSVCreateStbReq(SDecoder *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
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schema
Row
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
pCoder
,
&
pReq
->
schemaTag
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapper
(
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
;
...
@@ -3866,7 +3866,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
...
@@ -3866,7 +3866,7 @@ int tEncodeSVCreateTbReq(SEncoder *pCoder, const SVCreateTbReq *pReq) {
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pCoder
,
pReq
->
ctb
.
pTag
,
kvRowLen
(
pReq
->
ctb
.
pTag
))
<
0
)
return
-
1
;
if
(
tEncodeBinary
(
pCoder
,
pReq
->
ctb
.
pTag
,
kvRowLen
(
pReq
->
ctb
.
pTag
))
<
0
)
return
-
1
;
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
pReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schema
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pReq
->
ntb
.
schema
Row
)
<
0
)
return
-
1
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
@@ -3892,7 +3892,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
...
@@ -3892,7 +3892,7 @@ int tDecodeSVCreateTbReq(SDecoder *pCoder, SVCreateTbReq *pReq) {
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pReq
->
ctb
.
suid
)
<
0
)
return
-
1
;
if
(
tDecodeBinary
(
pCoder
,
&
pReq
->
ctb
.
pTag
,
&
len
)
<
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
Row
)
<
0
)
return
-
1
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
fe22f0f6
...
@@ -388,13 +388,12 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
...
@@ -388,13 +388,12 @@ static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pSt
req
.
name
=
(
char
*
)
tNameGetTableName
(
&
name
);
req
.
name
=
(
char
*
)
tNameGetTableName
(
&
name
);
req
.
suid
=
pStb
->
uid
;
req
.
suid
=
pStb
->
uid
;
req
.
rollup
=
pStb
->
ast1Len
>
0
?
1
:
0
;
req
.
rollup
=
pStb
->
ast1Len
>
0
?
1
:
0
;
req
.
schema
.
nCols
=
pStb
->
numOfColumns
;
// todo
req
.
schema
.
sver
=
pStb
->
version
;
req
.
schemaRow
.
nCols
=
pStb
->
numOfColumns
;
req
.
schema
.
tagVer
=
pStb
->
tagVer
;
req
.
schemaRow
.
version
=
pStb
->
version
;
req
.
schema
.
colVer
=
pStb
->
colVer
;
req
.
schemaRow
.
pSchema
=
pStb
->
pColumns
;
req
.
schema
.
pSchema
=
pStb
->
pColumns
;
req
.
schemaTag
.
nCols
=
pStb
->
numOfTags
;
req
.
schemaTag
.
nCols
=
pStb
->
numOfTags
;
req
.
schemaTag
.
sver
=
1
;
req
.
schemaTag
.
version
=
pStb
->
tagVer
;
req
.
schemaTag
.
pSchema
=
pStb
->
pTags
;
req
.
schemaTag
.
pSchema
=
pStb
->
pTags
;
if
(
req
.
rollup
)
{
if
(
req
.
rollup
)
{
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
fe22f0f6
...
@@ -217,7 +217,7 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
...
@@ -217,7 +217,7 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
}
}
}
else
{
}
else
{
pTopic
->
schema
.
nCols
=
0
;
pTopic
->
schema
.
nCols
=
0
;
pTopic
->
schema
.
sver
=
0
;
pTopic
->
schema
.
version
=
0
;
pTopic
->
schema
.
pSchema
=
NULL
;
pTopic
->
schema
.
pSchema
=
NULL
;
}
}
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
fe22f0f6
...
@@ -182,7 +182,7 @@ struct SMetaEntry {
...
@@ -182,7 +182,7 @@ struct SMetaEntry {
char
*
name
;
char
*
name
;
union
{
union
{
struct
{
struct
{
SSchemaWrapper
schema
;
SSchemaWrapper
schema
Row
;
SSchemaWrapper
schemaTag
;
SSchemaWrapper
schemaTag
;
}
stbEntry
;
}
stbEntry
;
struct
{
struct
{
...
@@ -195,7 +195,7 @@ struct SMetaEntry {
...
@@ -195,7 +195,7 @@ struct SMetaEntry {
int64_t
ctime
;
int64_t
ctime
;
int32_t
ttlDays
;
int32_t
ttlDays
;
int32_t
ncid
;
// next column id
int32_t
ncid
;
// next column id
SSchemaWrapper
schema
;
SSchemaWrapper
schema
Row
;
}
ntbEntry
;
}
ntbEntry
;
struct
{
struct
{
STSma
*
tsma
;
STSma
*
tsma
;
...
...
source/dnode/vnode/src/meta/metaEntry.c
浏览文件 @
fe22f0f6
...
@@ -24,7 +24,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
...
@@ -24,7 +24,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
if
(
tEncodeCStr
(
pCoder
,
pME
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
pCoder
,
pME
->
name
)
<
0
)
return
-
1
;
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schema
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schema
Row
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schemaTag
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
stbEntry
.
schemaTag
)
<
0
)
return
-
1
;
}
else
if
(
pME
->
type
==
TSDB_CHILD_TABLE
)
{
}
else
if
(
pME
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tEncodeI64
(
pCoder
,
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
...
@@ -35,7 +35,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
...
@@ -35,7 +35,7 @@ int metaEncodeEntry(SEncoder *pCoder, const SMetaEntry *pME) {
if
(
tEncodeI64
(
pCoder
,
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
pCoder
,
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
pCoder
,
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pME
->
ntbEntry
.
ncid
)
<
0
)
return
-
1
;
if
(
tEncodeI32v
(
pCoder
,
pME
->
ntbEntry
.
ncid
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
ntbEntry
.
schema
)
<
0
)
return
-
1
;
if
(
tEncodeSSchemaWrapper
(
pCoder
,
&
pME
->
ntbEntry
.
schema
Row
)
<
0
)
return
-
1
;
}
else
if
(
pME
->
type
==
TSDB_TSMA_TABLE
)
{
}
else
if
(
pME
->
type
==
TSDB_TSMA_TABLE
)
{
if
(
tEncodeTSma
(
pCoder
,
pME
->
smaEntry
.
tsma
)
<
0
)
return
-
1
;
if
(
tEncodeTSma
(
pCoder
,
pME
->
smaEntry
.
tsma
)
<
0
)
return
-
1
;
}
else
{
}
else
{
...
@@ -56,7 +56,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
...
@@ -56,7 +56,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
if
(
tDecodeCStr
(
pCoder
,
&
pME
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStr
(
pCoder
,
&
pME
->
name
)
<
0
)
return
-
1
;
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
tDecodeSSchemaWrapperEx
(
pCoder
,
&
pME
->
stbEntry
.
schema
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapperEx
(
pCoder
,
&
pME
->
stbEntry
.
schema
Row
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapperEx
(
pCoder
,
&
pME
->
stbEntry
.
schemaTag
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapperEx
(
pCoder
,
&
pME
->
stbEntry
.
schemaTag
)
<
0
)
return
-
1
;
}
else
if
(
pME
->
type
==
TSDB_CHILD_TABLE
)
{
}
else
if
(
pME
->
type
==
TSDB_CHILD_TABLE
)
{
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ctbEntry
.
ctime
)
<
0
)
return
-
1
;
...
@@ -67,7 +67,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
...
@@ -67,7 +67,7 @@ int metaDecodeEntry(SDecoder *pCoder, SMetaEntry *pME) {
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
pCoder
,
&
pME
->
ntbEntry
.
ctime
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
pCoder
,
&
pME
->
ntbEntry
.
ttlDays
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pME
->
ntbEntry
.
ncid
)
<
0
)
return
-
1
;
if
(
tDecodeI32v
(
pCoder
,
&
pME
->
ntbEntry
.
ncid
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapperEx
(
pCoder
,
&
pME
->
ntbEntry
.
schema
)
<
0
)
return
-
1
;
if
(
tDecodeSSchemaWrapperEx
(
pCoder
,
&
pME
->
ntbEntry
.
schema
Row
)
<
0
)
return
-
1
;
}
else
if
(
pME
->
type
==
TSDB_TSMA_TABLE
)
{
}
else
if
(
pME
->
type
==
TSDB_TSMA_TABLE
)
{
pME
->
smaEntry
.
tsma
=
tDecoderMalloc
(
pCoder
,
sizeof
(
STSma
));
pME
->
smaEntry
.
tsma
=
tDecoderMalloc
(
pCoder
,
sizeof
(
STSma
));
if
(
!
pME
->
smaEntry
.
tsma
)
{
if
(
!
pME
->
smaEntry
.
tsma
)
{
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
fe22f0f6
...
@@ -56,7 +56,7 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
...
@@ -56,7 +56,7 @@ int metaCreateSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
me
.
type
=
TSDB_SUPER_TABLE
;
me
.
type
=
TSDB_SUPER_TABLE
;
me
.
uid
=
pReq
->
suid
;
me
.
uid
=
pReq
->
suid
;
me
.
name
=
pReq
->
name
;
me
.
name
=
pReq
->
name
;
me
.
stbEntry
.
schema
=
pReq
->
schema
;
me
.
stbEntry
.
schema
Row
=
pReq
->
schemaRow
;
me
.
stbEntry
.
schemaTag
=
pReq
->
schemaTag
;
me
.
stbEntry
.
schemaTag
=
pReq
->
schemaTag
;
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
...
@@ -182,15 +182,13 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
...
@@ -182,15 +182,13 @@ int metaAlterSTable(SMeta *pMeta, int64_t version, SVCreateStbReq *pReq) {
nStbEntry
.
type
=
TSDB_SUPER_TABLE
;
nStbEntry
.
type
=
TSDB_SUPER_TABLE
;
nStbEntry
.
uid
=
pReq
->
suid
;
nStbEntry
.
uid
=
pReq
->
suid
;
nStbEntry
.
name
=
pReq
->
name
;
nStbEntry
.
name
=
pReq
->
name
;
nStbEntry
.
stbEntry
.
schema
=
pReq
->
schema
;
nStbEntry
.
stbEntry
.
schema
Row
=
pReq
->
schemaRow
;
nStbEntry
.
stbEntry
.
schemaTag
=
pReq
->
schemaTag
;
nStbEntry
.
stbEntry
.
schemaTag
=
pReq
->
schemaTag
;
metaWLock
(
pMeta
);
metaWLock
(
pMeta
);
// compare two entry
// compare two entry
if
(
oStbEntry
.
stbEntry
.
schema
.
sver
!=
pReq
->
schema
.
sver
)
{
if
(
oStbEntry
.
stbEntry
.
schemaRow
.
version
!=
pReq
->
schemaRow
.
version
)
{
if
(
oStbEntry
.
stbEntry
.
schema
.
nCols
!=
pReq
->
schema
.
nCols
)
{
metaSaveToSkmDb
(
pMeta
,
&
nStbEntry
);
metaSaveToSkmDb
(
pMeta
,
&
nStbEntry
);
}
}
}
// if (oStbEntry.stbEntry.schemaTag.sver != pReq->schemaTag.sver) {
// if (oStbEntry.stbEntry.schemaTag.sver != pReq->schemaTag.sver) {
...
@@ -247,8 +245,8 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
...
@@ -247,8 +245,8 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
}
else
{
}
else
{
me
.
ntbEntry
.
ctime
=
pReq
->
ctime
;
me
.
ntbEntry
.
ctime
=
pReq
->
ctime
;
me
.
ntbEntry
.
ttlDays
=
pReq
->
ttl
;
me
.
ntbEntry
.
ttlDays
=
pReq
->
ttl
;
me
.
ntbEntry
.
schema
=
pReq
->
ntb
.
schema
;
me
.
ntbEntry
.
schema
Row
=
pReq
->
ntb
.
schemaRow
;
me
.
ntbEntry
.
ncid
=
me
.
ntbEntry
.
schema
.
pSchema
[
me
.
ntbEntry
.
schema
.
nCols
-
1
].
colId
+
1
;
me
.
ntbEntry
.
ncid
=
me
.
ntbEntry
.
schema
Row
.
pSchema
[
me
.
ntbEntry
.
schemaRow
.
nCols
-
1
].
colId
+
1
;
}
}
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
if
(
metaHandleEntry
(
pMeta
,
&
me
)
<
0
)
goto
_err
;
...
@@ -381,7 +379,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
...
@@ -381,7 +379,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
}
}
// search the column to add/drop/update
// search the column to add/drop/update
pSchema
=
&
entry
.
ntbEntry
.
schema
;
pSchema
=
&
entry
.
ntbEntry
.
schema
Row
;
int32_t
iCol
=
0
;
int32_t
iCol
=
0
;
for
(;;)
{
for
(;;)
{
pColumn
=
NULL
;
pColumn
=
NULL
;
...
@@ -402,16 +400,16 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
...
@@ -402,16 +400,16 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
terrno
=
TSDB_CODE_VND_COL_ALREADY_EXISTS
;
terrno
=
TSDB_CODE_VND_COL_ALREADY_EXISTS
;
goto
_err
;
goto
_err
;
}
}
pSchema
->
sver
++
;
pSchema
->
version
++
;
pSchema
->
nCols
++
;
pSchema
->
nCols
++
;
pNewSchema
=
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSchema
->
nCols
);
pNewSchema
=
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
pSchema
->
nCols
);
memcpy
(
pNewSchema
,
pSchema
->
pSchema
,
sizeof
(
SSchema
)
*
(
pSchema
->
nCols
-
1
));
memcpy
(
pNewSchema
,
pSchema
->
pSchema
,
sizeof
(
SSchema
)
*
(
pSchema
->
nCols
-
1
));
pSchema
->
pSchema
=
pNewSchema
;
pSchema
->
pSchema
=
pNewSchema
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
.
nCols
-
1
].
bytes
=
pAlterTbReq
->
bytes
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
Row
.
nCols
-
1
].
bytes
=
pAlterTbReq
->
bytes
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
.
nCols
-
1
].
type
=
pAlterTbReq
->
type
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
Row
.
nCols
-
1
].
type
=
pAlterTbReq
->
type
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
.
nCols
-
1
].
flags
=
pAlterTbReq
->
flags
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
Row
.
nCols
-
1
].
flags
=
pAlterTbReq
->
flags
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
.
nCols
-
1
].
colId
=
entry
.
ntbEntry
.
ncid
++
;
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
Row
.
nCols
-
1
].
colId
=
entry
.
ntbEntry
.
ncid
++
;
strcpy
(
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
.
nCols
-
1
].
name
,
pAlterTbReq
->
colName
);
strcpy
(
pSchema
->
pSchema
[
entry
.
ntbEntry
.
schema
Row
.
nCols
-
1
].
name
,
pAlterTbReq
->
colName
);
break
;
break
;
case
TSDB_ALTER_TABLE_DROP_COLUMN
:
case
TSDB_ALTER_TABLE_DROP_COLUMN
:
if
(
pColumn
==
NULL
)
{
if
(
pColumn
==
NULL
)
{
...
@@ -422,7 +420,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
...
@@ -422,7 +420,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
terrno
=
TSDB_CODE_VND_INVALID_TABLE_ACTION
;
terrno
=
TSDB_CODE_VND_INVALID_TABLE_ACTION
;
goto
_err
;
goto
_err
;
}
}
pSchema
->
sver
++
;
pSchema
->
version
++
;
tlen
=
(
pSchema
->
nCols
-
iCol
-
1
)
*
sizeof
(
SSchema
);
tlen
=
(
pSchema
->
nCols
-
iCol
-
1
)
*
sizeof
(
SSchema
);
if
(
tlen
)
{
if
(
tlen
)
{
memmove
(
pColumn
,
pColumn
+
1
,
tlen
);
memmove
(
pColumn
,
pColumn
+
1
,
tlen
);
...
@@ -438,7 +436,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
...
@@ -438,7 +436,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
terrno
=
TSDB_CODE_VND_INVALID_TABLE_ACTION
;
terrno
=
TSDB_CODE_VND_INVALID_TABLE_ACTION
;
goto
_err
;
goto
_err
;
}
}
pSchema
->
sver
++
;
pSchema
->
version
++
;
pColumn
->
bytes
=
pAlterTbReq
->
colModBytes
;
pColumn
->
bytes
=
pAlterTbReq
->
colModBytes
;
break
;
break
;
case
TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME
:
case
TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME
:
...
@@ -446,7 +444,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
...
@@ -446,7 +444,7 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
terrno
=
TSDB_CODE_VND_TABLE_COL_NOT_EXISTS
;
terrno
=
TSDB_CODE_VND_TABLE_COL_NOT_EXISTS
;
goto
_err
;
goto
_err
;
}
}
pSchema
->
sver
++
;
pSchema
->
version
++
;
strcpy
(
pColumn
->
name
,
pAlterTbReq
->
colNewName
);
strcpy
(
pColumn
->
name
,
pAlterTbReq
->
colNewName
);
break
;
break
;
}
}
...
@@ -813,15 +811,15 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
...
@@ -813,15 +811,15 @@ static int metaSaveToSkmDb(SMeta *pMeta, const SMetaEntry *pME) {
const
SSchemaWrapper
*
pSW
;
const
SSchemaWrapper
*
pSW
;
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
if
(
pME
->
type
==
TSDB_SUPER_TABLE
)
{
pSW
=
&
pME
->
stbEntry
.
schema
;
pSW
=
&
pME
->
stbEntry
.
schema
Row
;
}
else
if
(
pME
->
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
pME
->
type
==
TSDB_NORMAL_TABLE
)
{
pSW
=
&
pME
->
ntbEntry
.
schema
;
pSW
=
&
pME
->
ntbEntry
.
schema
Row
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
skmDbKey
.
uid
=
pME
->
uid
;
skmDbKey
.
uid
=
pME
->
uid
;
skmDbKey
.
sver
=
pSW
->
sver
;
skmDbKey
.
sver
=
pSW
->
version
;
// encode schema
// encode schema
int32_t
ret
=
0
;
int32_t
ret
=
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
fe22f0f6
...
@@ -324,10 +324,10 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo
...
@@ -324,10 +324,10 @@ int tsdbInsertTableData(STsdb *pTsdb, SSubmitMsgIter *pMsgIter, SSubmitBlk *pBlo
strcat
(
pRsp
->
tblFName
,
mr
.
me
.
name
);
strcat
(
pRsp
->
tblFName
,
mr
.
me
.
name
);
if
(
mr
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
if
(
mr
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
sverNew
=
mr
.
me
.
ntbEntry
.
schema
.
sver
;
sverNew
=
mr
.
me
.
ntbEntry
.
schema
Row
.
version
;
}
else
{
}
else
{
metaGetTableEntryByUid
(
&
mr
,
mr
.
me
.
ctbEntry
.
suid
);
metaGetTableEntryByUid
(
&
mr
,
mr
.
me
.
ctbEntry
.
suid
);
sverNew
=
mr
.
me
.
stbEntry
.
schema
.
sver
;
sverNew
=
mr
.
me
.
stbEntry
.
schema
Row
.
version
;
}
}
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
fe22f0f6
...
@@ -64,7 +64,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -64,7 +64,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
if
(
mer1
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
if
(
mer1
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
strcpy
(
metaRsp
.
stbName
,
mer1
.
me
.
name
);
strcpy
(
metaRsp
.
stbName
,
mer1
.
me
.
name
);
schema
=
mer1
.
me
.
stbEntry
.
schema
;
schema
=
mer1
.
me
.
stbEntry
.
schema
Row
;
schemaTag
=
mer1
.
me
.
stbEntry
.
schemaTag
;
schemaTag
=
mer1
.
me
.
stbEntry
.
schemaTag
;
metaRsp
.
suid
=
mer1
.
me
.
uid
;
metaRsp
.
suid
=
mer1
.
me
.
uid
;
}
else
if
(
mer1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
}
else
if
(
mer1
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
...
@@ -73,10 +73,10 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -73,10 +73,10 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
strcpy
(
metaRsp
.
stbName
,
mer2
.
me
.
name
);
strcpy
(
metaRsp
.
stbName
,
mer2
.
me
.
name
);
metaRsp
.
suid
=
mer2
.
me
.
uid
;
metaRsp
.
suid
=
mer2
.
me
.
uid
;
schema
=
mer2
.
me
.
stbEntry
.
schema
;
schema
=
mer2
.
me
.
stbEntry
.
schema
Row
;
schemaTag
=
mer2
.
me
.
stbEntry
.
schemaTag
;
schemaTag
=
mer2
.
me
.
stbEntry
.
schemaTag
;
}
else
if
(
mer1
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
}
else
if
(
mer1
.
me
.
type
==
TSDB_NORMAL_TABLE
)
{
schema
=
mer1
.
me
.
ntbEntry
.
schema
;
schema
=
mer1
.
me
.
ntbEntry
.
schema
Row
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
@@ -84,7 +84,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -84,7 +84,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
metaRsp
.
numOfTags
=
schemaTag
.
nCols
;
metaRsp
.
numOfTags
=
schemaTag
.
nCols
;
metaRsp
.
numOfColumns
=
schema
.
nCols
;
metaRsp
.
numOfColumns
=
schema
.
nCols
;
metaRsp
.
precision
=
pVnode
->
config
.
tsdbCfg
.
precision
;
metaRsp
.
precision
=
pVnode
->
config
.
tsdbCfg
.
precision
;
metaRsp
.
sversion
=
schema
.
sver
;
metaRsp
.
sversion
=
schema
.
version
;
metaRsp
.
pSchemas
=
(
SSchema
*
)
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
(
metaRsp
.
numOfColumns
+
metaRsp
.
numOfTags
));
metaRsp
.
pSchemas
=
(
SSchema
*
)
taosMemoryMalloc
(
sizeof
(
SSchema
)
*
(
metaRsp
.
numOfColumns
+
metaRsp
.
numOfTags
));
memcpy
(
metaRsp
.
pSchemas
,
schema
.
pSchema
,
sizeof
(
SSchema
)
*
schema
.
nCols
);
memcpy
(
metaRsp
.
pSchemas
,
schema
.
pSchema
,
sizeof
(
SSchema
)
*
schema
.
nCols
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
fe22f0f6
...
@@ -124,7 +124,7 @@ static void destroySysTableScannerOperatorInfo(void* param, int32_t numOfOutput)
...
@@ -124,7 +124,7 @@ static void destroySysTableScannerOperatorInfo(void* param, int32_t numOfOutput)
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
)
{
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
cost
.
totalCost
=
(
taosGetTimestampUs
()
-
pOperator
->
pTaskInfo
->
cost
.
start
*
1000
)
/
1000
.
0
;
pOperator
->
cost
.
totalCost
=
(
taosGetTimestampUs
()
-
pOperator
->
pTaskInfo
->
cost
.
start
*
1000
)
/
1000
.
0
;
if
(
pOperator
->
pTaskInfo
!=
NULL
)
{
if
(
pOperator
->
pTaskInfo
!=
NULL
)
{
setTaskStatus
(
pOperator
->
pTaskInfo
,
TASK_COMPLETED
);
setTaskStatus
(
pOperator
->
pTaskInfo
,
TASK_COMPLETED
);
}
}
...
@@ -2717,7 +2717,7 @@ static void* setAllSourcesCompleted(SOperatorInfo* pOperator, int64_t startTs) {
...
@@ -2717,7 +2717,7 @@ static void* setAllSourcesCompleted(SOperatorInfo* pOperator, int64_t startTs) {
SExchangeInfo
*
pExchangeInfo
=
pOperator
->
info
;
SExchangeInfo
*
pExchangeInfo
=
pOperator
->
info
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
int64_t
el
=
taosGetTimestampUs
()
-
startTs
;
int64_t
el
=
taosGetTimestampUs
()
-
startTs
;
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
SLoadRemoteDataInfo
*
pLoadInfo
=
&
pExchangeInfo
->
loadInfo
;
pLoadInfo
->
totalElapsed
+=
el
;
pLoadInfo
->
totalElapsed
+=
el
;
...
@@ -3023,13 +3023,13 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, const SNodeList* p
...
@@ -3023,13 +3023,13 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, const SNodeList* p
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
pOperator
->
name
=
"ExchangeOperator"
;
pOperator
->
name
=
"ExchangeOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
;
pOperator
->
blocking
=
false
;
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
numOfExprs
=
pBlock
->
info
.
numOfCols
;
pOperator
->
numOfExprs
=
pBlock
->
info
.
numOfCols
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
destroyExchangeOperatorInfo
,
NULL
,
NULL
,
NULL
);
destroyExchangeOperatorInfo
,
NULL
,
NULL
,
NULL
);
...
@@ -3465,7 +3465,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
...
@@ -3465,7 +3465,7 @@ static int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) {
initGroupedResultInfo
(
&
pAggInfo
->
groupResInfo
,
pAggInfo
->
aggSup
.
pResultRowHashTable
,
0
);
initGroupedResultInfo
(
&
pAggInfo
->
groupResInfo
,
pAggInfo
->
aggSup
.
pResultRowHashTable
,
0
);
OPTR_SET_OPENED
(
pOperator
);
OPTR_SET_OPENED
(
pOperator
);
pOperator
->
cost
.
openCost
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pOperator
->
cost
.
openCost
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -3490,10 +3490,10 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
...
@@ -3490,10 +3490,10 @@ static SSDataBlock* getAggregateResult(SOperatorInfo* pOperator) {
doSetOperatorCompleted
(
pOperator
);
doSetOperatorCompleted
(
pOperator
);
}
}
size_t
rows
=
blockDataGetNumOfRows
(
pInfo
->
pRes
);
//
pInfo->pRes : NULL;
size_t
rows
=
blockDataGetNumOfRows
(
pInfo
->
pRes
);
//
pInfo->pRes : NULL;
pOperator
->
resultInfo
.
totalRows
+=
rows
;
pOperator
->
resultInfo
.
totalRows
+=
rows
;
return
(
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
return
(
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
}
}
void
aggEncodeResultRow
(
SOperatorInfo
*
pOperator
,
SAggSupporter
*
pSup
,
SOptrBasicInfo
*
pInfo
,
char
**
result
,
void
aggEncodeResultRow
(
SOperatorInfo
*
pOperator
,
SAggSupporter
*
pSup
,
SOptrBasicInfo
*
pInfo
,
char
**
result
,
...
@@ -3778,10 +3778,10 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
...
@@ -3778,10 +3778,10 @@ static SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) {
pOperator
->
resultInfo
.
totalRows
+=
rows
;
pOperator
->
resultInfo
.
totalRows
+=
rows
;
if
(
pOperator
->
cost
.
openCost
==
0
)
{
if
(
pOperator
->
cost
.
openCost
==
0
)
{
pOperator
->
cost
.
openCost
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
pOperator
->
cost
.
openCost
=
(
taosGetTimestampUs
()
-
st
)
/
1000
.
0
;
}
}
return
(
rows
>
0
)
?
pInfo
->
pRes
:
NULL
;
return
(
rows
>
0
)
?
pInfo
->
pRes
:
NULL
;
}
}
static
void
doHandleRemainBlockForNewGroupImpl
(
SFillOperatorInfo
*
pInfo
,
SResultInfo
*
pResultInfo
,
bool
*
newgroup
,
static
void
doHandleRemainBlockForNewGroupImpl
(
SFillOperatorInfo
*
pInfo
,
SResultInfo
*
pResultInfo
,
bool
*
newgroup
,
...
@@ -4455,15 +4455,15 @@ void extractTableSchemaVersion(SReadHandle* pHandle, uint64_t uid, SExecTaskInfo
...
@@ -4455,15 +4455,15 @@ void extractTableSchemaVersion(SReadHandle* pHandle, uint64_t uid, SExecTaskInfo
pTaskInfo
->
schemaVer
.
tablename
=
strdup
(
mr
.
me
.
name
);
pTaskInfo
->
schemaVer
.
tablename
=
strdup
(
mr
.
me
.
name
);
if
(
mr
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
if
(
mr
.
me
.
type
==
TSDB_SUPER_TABLE
)
{
pTaskInfo
->
schemaVer
.
sversion
=
mr
.
me
.
stbEntry
.
schema
.
sver
;
pTaskInfo
->
schemaVer
.
sversion
=
mr
.
me
.
stbEntry
.
schema
Row
.
version
;
pTaskInfo
->
schemaVer
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
sver
;
pTaskInfo
->
schemaVer
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
}
else
if
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
}
else
if
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
tb_uid_t
suid
=
mr
.
me
.
ctbEntry
.
suid
;
tb_uid_t
suid
=
mr
.
me
.
ctbEntry
.
suid
;
metaGetTableEntryByUid
(
&
mr
,
suid
);
metaGetTableEntryByUid
(
&
mr
,
suid
);
pTaskInfo
->
schemaVer
.
sversion
=
mr
.
me
.
stbEntry
.
schema
.
sver
;
pTaskInfo
->
schemaVer
.
sversion
=
mr
.
me
.
stbEntry
.
schema
Row
.
version
;
pTaskInfo
->
schemaVer
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
sver
;
pTaskInfo
->
schemaVer
.
tversion
=
mr
.
me
.
stbEntry
.
schemaTag
.
version
;
}
else
{
}
else
{
pTaskInfo
->
schemaVer
.
sversion
=
mr
.
me
.
ntbEntry
.
schema
.
sver
;
pTaskInfo
->
schemaVer
.
sversion
=
mr
.
me
.
ntbEntry
.
schema
Row
.
version
;
}
}
metaReaderClear
(
&
mr
);
metaReaderClear
(
&
mr
);
...
@@ -4668,8 +4668,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4668,8 +4668,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyNode
->
pOutputDataBlockDesc
);
SSDataBlock
*
pResBlock
=
createResDataBlock
(
pPhyNode
->
pOutputDataBlockDesc
);
int32_t
tsSlotId
=
((
SColumnNode
*
)
pSessionNode
->
window
.
pTspk
)
->
slotId
;
int32_t
tsSlotId
=
((
SColumnNode
*
)
pSessionNode
->
window
.
pTspk
)
->
slotId
;
pOptr
=
pOptr
=
createStreamSessionAggOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
pSessionNode
->
gap
,
tsSlotId
,
&
as
,
createStreamSessionAggOperatorInfo
(
ops
[
0
],
pExprInfo
,
num
,
pResBlock
,
pSessionNode
->
gap
,
tsSlotId
,
&
as
,
pTaskInfo
);
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_PARTITION
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_PARTITION
==
type
)
{
SPartitionPhysiNode
*
pPartNode
=
(
SPartitionPhysiNode
*
)
pPhyNode
;
SPartitionPhysiNode
*
pPartNode
=
(
SPartitionPhysiNode
*
)
pPhyNode
;
...
@@ -5162,8 +5162,7 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
...
@@ -5162,8 +5162,7 @@ int32_t getOperatorExplainExecInfo(SOperatorInfo* operatorInfo, SExplainExecInfo
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
initCatchSupporter
(
SCatchSupporter
*
pCatchSup
,
size_t
rowSize
,
const
char
*
pKey
,
int32_t
initCatchSupporter
(
SCatchSupporter
*
pCatchSup
,
size_t
rowSize
,
const
char
*
pKey
,
const
char
*
pDir
)
{
const
char
*
pDir
)
{
pCatchSup
->
keySize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
);
pCatchSup
->
keySize
=
sizeof
(
int64_t
)
+
sizeof
(
int64_t
)
+
sizeof
(
TSKEY
);
pCatchSup
->
pKeyBuf
=
taosMemoryCalloc
(
1
,
pCatchSup
->
keySize
);
pCatchSup
->
pKeyBuf
=
taosMemoryCalloc
(
1
,
pCatchSup
->
keySize
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
_hash_fn_t
hashFn
=
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
fe22f0f6
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
fe22f0f6
...
@@ -3951,7 +3951,7 @@ typedef struct SVgroupCreateTableBatch {
...
@@ -3951,7 +3951,7 @@ typedef struct SVgroupCreateTableBatch {
static
void
destroyCreateTbReq
(
SVCreateTbReq
*
pReq
)
{
static
void
destroyCreateTbReq
(
SVCreateTbReq
*
pReq
)
{
taosMemoryFreeClear
(
pReq
->
name
);
taosMemoryFreeClear
(
pReq
->
name
);
taosMemoryFreeClear
(
pReq
->
ntb
.
schema
.
pSchema
);
taosMemoryFreeClear
(
pReq
->
ntb
.
schema
Row
.
pSchema
);
}
}
static
int32_t
buildNormalTableBatchReq
(
int32_t
acctId
,
const
SCreateTableStmt
*
pStmt
,
const
SVgroupInfo
*
pVgroupInfo
,
static
int32_t
buildNormalTableBatchReq
(
int32_t
acctId
,
const
SCreateTableStmt
*
pStmt
,
const
SVgroupInfo
*
pVgroupInfo
,
...
@@ -3964,10 +3964,10 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
...
@@ -3964,10 +3964,10 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
SVCreateTbReq
req
=
{
0
};
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TD_NORMAL_TABLE
;
req
.
type
=
TD_NORMAL_TABLE
;
req
.
name
=
strdup
(
pStmt
->
tableName
);
req
.
name
=
strdup
(
pStmt
->
tableName
);
req
.
ntb
.
schema
.
nCols
=
LIST_LENGTH
(
pStmt
->
pCols
);
req
.
ntb
.
schema
Row
.
nCols
=
LIST_LENGTH
(
pStmt
->
pCols
);
req
.
ntb
.
schema
.
sver
=
1
;
req
.
ntb
.
schema
Row
.
version
=
1
;
req
.
ntb
.
schema
.
pSchema
=
taosMemoryCalloc
(
req
.
ntb
.
schema
.
nCols
,
sizeof
(
SSchema
));
req
.
ntb
.
schema
Row
.
pSchema
=
taosMemoryCalloc
(
req
.
ntb
.
schemaRow
.
nCols
,
sizeof
(
SSchema
));
if
(
NULL
==
req
.
name
||
NULL
==
req
.
ntb
.
schema
.
pSchema
)
{
if
(
NULL
==
req
.
name
||
NULL
==
req
.
ntb
.
schema
Row
.
pSchema
)
{
destroyCreateTbReq
(
&
req
);
destroyCreateTbReq
(
&
req
);
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
...
@@ -3977,7 +3977,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
...
@@ -3977,7 +3977,7 @@ static int32_t buildNormalTableBatchReq(int32_t acctId, const SCreateTableStmt*
SNode
*
pCol
;
SNode
*
pCol
;
col_id_t
index
=
0
;
col_id_t
index
=
0
;
FOREACH
(
pCol
,
pStmt
->
pCols
)
{
FOREACH
(
pCol
,
pStmt
->
pCols
)
{
toSchema
((
SColumnDefNode
*
)
pCol
,
index
+
1
,
req
.
ntb
.
schema
.
pSchema
+
index
);
toSchema
((
SColumnDefNode
*
)
pCol
,
index
+
1
,
req
.
ntb
.
schema
Row
.
pSchema
+
index
);
++
index
;
++
index
;
}
}
pBatch
->
info
=
*
pVgroupInfo
;
pBatch
->
info
=
*
pVgroupInfo
;
...
@@ -4031,7 +4031,7 @@ static void destroyCreateTbReqBatch(SVgroupCreateTableBatch* pTbBatch) {
...
@@ -4031,7 +4031,7 @@ static void destroyCreateTbReqBatch(SVgroupCreateTableBatch* pTbBatch) {
taosMemoryFreeClear
(
pTableReq
->
name
);
taosMemoryFreeClear
(
pTableReq
->
name
);
if
(
pTableReq
->
type
==
TSDB_NORMAL_TABLE
)
{
if
(
pTableReq
->
type
==
TSDB_NORMAL_TABLE
)
{
taosMemoryFreeClear
(
pTableReq
->
ntb
.
schema
.
pSchema
);
taosMemoryFreeClear
(
pTableReq
->
ntb
.
schema
Row
.
pSchema
);
}
else
if
(
pTableReq
->
type
==
TSDB_CHILD_TABLE
)
{
}
else
if
(
pTableReq
->
type
==
TSDB_CHILD_TABLE
)
{
taosMemoryFreeClear
(
pTableReq
->
ctb
.
pTag
);
taosMemoryFreeClear
(
pTableReq
->
ctb
.
pTag
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录