Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f893b656
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看板
提交
f893b656
编写于
3月 23, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reorganize physical plan code
上级
09f36860
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
9 deletion
+29
-9
source/common/src/tmsg.c
source/common/src/tmsg.c
+3
-1
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+3
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+23
-8
未找到文件。
source/common/src/tmsg.c
浏览文件 @
f893b656
...
...
@@ -287,6 +287,7 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
ver
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
dbFName
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
name
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pReq
->
ttl
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pReq
->
keep
);
...
...
@@ -360,6 +361,7 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
void
*
tDeserializeSVCreateTbReq
(
void
*
buf
,
SVCreateTbReq
*
pReq
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
(
pReq
->
ver
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
dbFName
));
buf
=
taosDecodeString
(
buf
,
&
(
pReq
->
name
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pReq
->
ttl
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pReq
->
keep
));
...
...
@@ -478,7 +480,7 @@ void *tDeserializeSVCreateTbBatchReq(void *buf, SVCreateTbBatchReq *pReq) {
buf
=
taosDecodeFixedU32
(
buf
,
&
nsize
);
pReq
->
pArray
=
taosArrayInit
(
nsize
,
sizeof
(
SVCreateTbReq
));
for
(
size_t
i
=
0
;
i
<
nsize
;
i
++
)
{
SVCreateTbReq
req
;
SVCreateTbReq
req
=
{
0
}
;
buf
=
tDeserializeSVCreateTbReq
(
buf
,
&
req
);
taosArrayPush
(
pReq
->
pArray
,
&
req
);
}
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
f893b656
...
...
@@ -271,9 +271,12 @@ static SDbObj *mndAcquireDbByStb(SMnode *pMnode, const char *stbName) {
static
void
*
mndBuildVCreateStbReq
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
,
int32_t
*
pContLen
)
{
SName
name
=
{
0
};
tNameFromString
(
&
name
,
pStb
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
tNameGetFullDbName
(
&
name
,
dbFName
);
SVCreateTbReq
req
=
{
0
};
req
.
ver
=
0
;
req
.
dbFName
=
dbFName
;
req
.
name
=
(
char
*
)
tNameGetTableName
(
&
name
);
req
.
ttl
=
0
;
req
.
keep
=
0
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
f893b656
...
...
@@ -1870,14 +1870,21 @@ static void toSchema(const SColumnDefNode* pCol, int32_t colId, SSchema* pSchema
}
static
void
destroyCreateTbReq
(
SVCreateTbReq
*
pReq
)
{
tfree
(
pReq
->
dbFName
);
tfree
(
pReq
->
name
);
tfree
(
pReq
->
ntbCfg
.
pSchema
);
}
static
int32_t
buildNormalTableBatchReq
(
const
char
*
pDbName
,
const
char
*
pTableName
,
const
SNodeList
*
pColumns
,
const
SVgroupInfo
*
pVgroupInfo
,
SVgroupTablesBatch
*
pBatch
)
{
static
int32_t
buildNormalTableBatchReq
(
int32_t
acctId
,
const
char
*
pDbName
,
const
char
*
pTableName
,
const
SNodeList
*
pColumns
,
const
SVgroupInfo
*
pVgroupInfo
,
SVgroupTablesBatch
*
pBatch
)
{
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SName
name
=
{
.
type
=
TSDB_DB_NAME_T
,
.
acctId
=
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
tNameGetFullDbName
(
&
name
,
dbFName
);
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TD_NORMAL_TABLE
;
req
.
dbFName
=
strdup
(
dbFName
);
req
.
name
=
strdup
(
pTableName
);
req
.
ntbCfg
.
nCols
=
LIST_LENGTH
(
pColumns
);
req
.
ntbCfg
.
pSchema
=
calloc
(
req
.
ntbCfg
.
nCols
,
sizeof
(
SSchema
));
...
...
@@ -1904,7 +1911,7 @@ static int32_t buildNormalTableBatchReq(
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
serializeVgroupTablesBatch
(
int32_t
acctId
,
SVgroupTablesBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
static
int32_t
serializeVgroupTablesBatch
(
SVgroupTablesBatch
*
pTbBatch
,
SArray
*
pBufArray
)
{
int
tlen
=
sizeof
(
SMsgHead
)
+
tSerializeSVCreateTbBatchReq
(
NULL
,
&
(
pTbBatch
->
req
));
void
*
buf
=
malloc
(
tlen
);
if
(
NULL
==
buf
)
{
...
...
@@ -1932,6 +1939,7 @@ static void destroyCreateTbReqBatch(SVgroupTablesBatch* pTbBatch) {
size_t
size
=
taosArrayGetSize
(
pTbBatch
->
req
.
pArray
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SVCreateTbReq
*
pTableReq
=
taosArrayGet
(
pTbBatch
->
req
.
pArray
,
i
);
tfree
(
pTableReq
->
dbFName
);
tfree
(
pTableReq
->
name
);
if
(
pTableReq
->
type
==
TSDB_NORMAL_TABLE
)
{
...
...
@@ -1973,9 +1981,9 @@ static int32_t buildCreateTableDataBlock(int32_t acctId, const SCreateTableStmt*
}
SVgroupTablesBatch
tbatch
=
{
0
};
int32_t
code
=
buildNormalTableBatchReq
(
pStmt
->
dbName
,
pStmt
->
tableName
,
pStmt
->
pCols
,
pInfo
,
&
tbatch
);
int32_t
code
=
buildNormalTableBatchReq
(
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pStmt
->
pCols
,
pInfo
,
&
tbatch
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
serializeVgroupTablesBatch
(
acctId
,
&
tbatch
,
*
pBufArray
);
code
=
serializeVgroupTablesBatch
(
&
tbatch
,
*
pBufArray
);
}
destroyCreateTbReqBatch
(
&
tbatch
);
...
...
@@ -2004,9 +2012,16 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) {
return
code
;
}
static
void
addCreateTbReqIntoVgroup
(
SHashObj
*
pVgroupHashmap
,
const
char
*
pDbName
,
const
char
*
pTableName
,
SKVRow
row
,
uint64_t
suid
,
SVgroupInfo
*
pVgInfo
)
{
static
void
addCreateTbReqIntoVgroup
(
int32_t
acctId
,
SHashObj
*
pVgroupHashmap
,
const
char
*
pDbName
,
const
char
*
pTableName
,
SKVRow
row
,
uint64_t
suid
,
SVgroupInfo
*
pVgInfo
)
{
char
dbFName
[
TSDB_DB_FNAME_LEN
]
=
{
0
};
SName
name
=
{
.
type
=
TSDB_DB_NAME_T
,
.
acctId
=
acctId
};
strcpy
(
name
.
dbname
,
pDbName
);
tNameGetFullDbName
(
&
name
,
dbFName
);
struct
SVCreateTbReq
req
=
{
0
};
req
.
type
=
TD_CHILD_TABLE
;
req
.
dbFName
=
strdup
(
dbFName
);
req
.
name
=
strdup
(
pTableName
);
req
.
ctbCfg
.
suid
=
suid
;
req
.
ctbCfg
.
pTag
=
row
;
...
...
@@ -2159,7 +2174,7 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla
code
=
getTableHashVgroup
(
pCxt
,
pStmt
->
dbName
,
pStmt
->
tableName
,
&
info
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
addCreateTbReqIntoVgroup
(
pVgroupHashmap
,
pStmt
->
dbName
,
pStmt
->
tableName
,
row
,
pSuperTableMeta
->
uid
,
&
info
);
addCreateTbReqIntoVgroup
(
p
Cxt
->
pParseCxt
->
acctId
,
p
VgroupHashmap
,
pStmt
->
dbName
,
pStmt
->
tableName
,
row
,
pSuperTableMeta
->
uid
,
&
info
);
}
tfree
(
pSuperTableMeta
);
...
...
@@ -2181,7 +2196,7 @@ static SArray* serializeVgroupsTablesBatch(int32_t acctId, SHashObj* pVgroupHash
break
;
}
serializeVgroupTablesBatch
(
acctId
,
pTbBatch
,
pBufArray
);
serializeVgroupTablesBatch
(
pTbBatch
,
pBufArray
);
destroyCreateTbReqBatch
(
pTbBatch
);
}
while
(
true
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录