Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
1c57b5e7
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,发现更多精彩内容 >>
提交
1c57b5e7
编写于
12月 31, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
batch create table
上级
54af08bc
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
82 addition
and
23 deletion
+82
-23
include/common/tmsg.h
include/common/tmsg.h
+3
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+28
-1
source/dnode/vnode/impl/src/vnodeWrite.c
source/dnode/vnode/impl/src/vnodeWrite.c
+13
-4
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+38
-17
未找到文件。
include/common/tmsg.h
浏览文件 @
1c57b5e7
...
...
@@ -1285,8 +1285,10 @@ typedef struct {
int
tmsgSVCreateTbReqEncode
(
SMsgEncoder
*
pCoder
,
SVCreateTbReq
*
pReq
);
int
tmsgSVCreateTbReqDecode
(
SMsgDecoder
*
pCoder
,
SVCreateTbReq
*
pReq
);
int
tSerializeSVCreateTbReq
(
void
**
buf
,
const
SVCreateTbReq
*
pReq
);
int
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
);
void
*
tDeserializeSVCreateTbReq
(
void
*
buf
,
SVCreateTbReq
*
pReq
);
int
tSVCreateTbBatchReqSerialize
(
void
**
buf
,
SVCreateTbBatchReq
*
pReq
);
void
*
tSVCreateTbBatchReqDeserialize
(
void
*
buf
,
SVCreateTbBatchReq
*
pReq
);
typedef
struct
SVCreateTbRsp
{
}
SVCreateTbRsp
;
...
...
source/common/src/tmsg.c
浏览文件 @
1c57b5e7
...
...
@@ -98,7 +98,7 @@ int tmsgSVCreateTbReqDecode(SMsgDecoder *pCoder, SVCreateTbReq *pReq) {
return
0
;
}
int
tSerializeSVCreateTbReq
(
void
**
buf
,
const
SVCreateTbReq
*
pReq
)
{
int
tSerializeSVCreateTbReq
(
void
**
buf
,
SVCreateTbReq
*
pReq
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedU64
(
buf
,
pReq
->
ver
);
...
...
@@ -193,6 +193,33 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
return
buf
;
}
int
tSVCreateTbBatchReqSerialize
(
void
**
buf
,
SVCreateTbBatchReq
*
pReq
)
{
int
tlen
=
0
;
tlen
+=
taosEncodeFixedU64
(
buf
,
pReq
->
ver
);
tlen
+=
taosEncodeFixedU32
(
buf
,
taosArrayGetSize
(
pReq
->
pArray
));
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
pReq
->
pArray
);
i
++
)
{
SVCreateTbReq
*
pCreateTbReq
=
taosArrayGet
(
pReq
->
pArray
,
i
);
tlen
+=
tSerializeSVCreateTbReq
(
buf
,
pCreateTbReq
);
}
return
tlen
;
}
void
*
tSVCreateTbBatchReqDeserialize
(
void
*
buf
,
SVCreateTbBatchReq
*
pReq
)
{
uint32_t
nsize
=
0
;
buf
=
taosDecodeFixedU64
(
buf
,
&
pReq
->
ver
);
buf
=
taosDecodeFixedU32
(
buf
,
&
nsize
);
for
(
size_t
i
=
0
;
i
<
nsize
;
i
++
)
{
SVCreateTbReq
req
;
buf
=
tDeserializeSVCreateTbReq
(
buf
,
&
req
);
taosArrayPush
(
pReq
->
pArray
,
&
req
);
}
return
buf
;
}
/* ------------------------ STATIC METHODS ------------------------ */
static
int
tmsgStartEncode
(
SMsgEncoder
*
pME
)
{
struct
SMEListNode
*
pNode
=
(
struct
SMEListNode
*
)
malloc
(
sizeof
(
*
pNode
));
...
...
source/dnode/vnode/impl/src/vnodeWrite.c
浏览文件 @
1c57b5e7
...
...
@@ -27,7 +27,7 @@ int vnodeProcessNoWalWMsgs(SVnode *pVnode, SRpcMsg *pMsg) {
}
int
vnodeProcessWMsgs
(
SVnode
*
pVnode
,
SArray
*
pMsgs
)
{
SRpcMsg
*
pMsg
;
SRpcMsg
*
pMsg
;
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
pMsgs
);
i
++
)
{
pMsg
=
*
(
SRpcMsg
**
)
taosArrayGet
(
pMsgs
,
i
);
...
...
@@ -51,6 +51,7 @@ int vnodeProcessWMsgs(SVnode *pVnode, SArray *pMsgs) {
int
vnodeApplyWMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
SVCreateTbReq
vCreateTbReq
;
SVCreateTbBatchReq
vCreateTbBatchReq
;
void
*
ptr
=
vnodeMalloc
(
pVnode
,
pMsg
->
contLen
);
if
(
ptr
==
NULL
)
{
// TODO: handle error
...
...
@@ -68,7 +69,6 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
switch
(
pMsg
->
msgType
)
{
case
TDMT_VND_CREATE_STB
:
case
TDMT_VND_CREATE_TABLE
:
tDeserializeSVCreateTbReq
(
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
)),
&
vCreateTbReq
);
if
(
metaCreateTable
(
pVnode
->
pMeta
,
&
(
vCreateTbReq
))
<
0
)
{
// TODO: handle error
...
...
@@ -76,6 +76,15 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
// TODO: maybe need to clear the requst struct
break
;
case
TDMT_VND_CREATE_TABLE
:
tSVCreateTbBatchReqDeserialize
(
POINTER_SHIFT
(
pMsg
->
pCont
,
sizeof
(
SMsgHead
)),
&
vCreateTbBatchReq
);
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
vCreateTbBatchReq
.
pArray
);
i
++
)
{
SVCreateTbReq
*
pCreateTbReq
=
taosArrayGet
(
vCreateTbBatchReq
.
pArray
,
i
);
if
(
metaCreateTable
(
pVnode
->
pMeta
,
pCreateTbReq
)
<
0
)
{
// TODO: handle error
}
}
case
TDMT_VND_DROP_STB
:
case
TDMT_VND_DROP_TABLE
:
// if (metaDropTable(pVnode->pMeta, vReq.dtReq.uid) < 0) {
...
...
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
1c57b5e7
...
...
@@ -48,7 +48,7 @@ static int32_t setShowInfo(SShowInfo* pShowInfo, SParseBasicCtx* pCtx, void** ou
pEpSet
->
numOfEps
=
info
->
numOfEps
;
pEpSet
->
inUse
=
info
->
inUse
;
for
(
int32_t
i
=
0
;
i
<
pEpSet
->
numOfEps
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pEpSet
->
numOfEps
;
++
i
)
{
strncpy
(
pEpSet
->
fqdn
[
i
],
info
->
epAddr
[
i
].
fqdn
,
tListLen
(
pEpSet
->
fqdn
[
i
]));
pEpSet
->
port
[
i
]
=
info
->
epAddr
[
i
].
port
;
}
...
...
@@ -501,15 +501,15 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SMsgBuf* p
req
.
ctbCfg
.
suid
=
pSuperTableMeta
->
suid
;
req
.
ctbCfg
.
pTag
=
row
;
// pEpSet->inUse = info.inUse;
// pEpSet->numOfEps = info.numOfEps;
// for (int32_t i = 0; i < pEpSet->numOfEps; ++i) {
// pEpSet->port[i] = info.epAddr[i].port;
// tstrncpy(pEpSet->fqdn[i], info.epAddr[i].fqdn, tListLen(pEpSet->fqdn[i]));
// }
// ((SMsgHead*)(*pOutput))->vgId = htonl(info.vgId);
// ((SMsgHead*)(*pOutput))->contLen = htonl(serLen);
SVgroupTablesBatch
*
pTableBatch
=
taosHashGet
(
pVgroupHashmap
,
&
info
.
vgId
,
sizeof
(
info
.
vgId
));
// pEpSet->inUse = info.inUse;
// pEpSet->numOfEps = info.numOfEps;
// for (int32_t i = 0; i < pEpSet->numOfEps; ++i) {
// pEpSet->port[i] = info.epAddr[i].port;
// tstrncpy(pEpSet->fqdn[i], info.epAddr[i].fqdn, tListLen(pEpSet->fqdn[i]));
// }
// ((SMsgHead*)(*pOutput))->vgId = htonl(info.vgId);
// ((SMsgHead*)(*pOutput))->contLen = htonl(serLen);
SVgroupTablesBatch
*
pTableBatch
=
taosHashGet
(
pVgroupHashmap
,
&
info
.
vgId
,
sizeof
(
info
.
vgId
));
if
(
pTableBatch
==
NULL
)
{
SVgroupTablesBatch
tBatch
=
{
0
};
tBatch
.
info
=
info
;
...
...
@@ -525,7 +525,28 @@ int32_t doCheckForCreateCTable(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SMsgBuf* p
}
// TODO: serialize and
void
*
pBuf
=
NULL
;
SArray
*
pBufArray
=
taosArrayInit
(
taosHashGetSize
(
pVgroupHashmap
),
sizeof
(
void
*
));
SVgroupTablesBatch
**
ppTbBatch
=
NULL
;
do
{
ppTbBatch
=
taosHashIterate
(
pVgroupHashmap
,
ppTbBatch
);
if
(
ppTbBatch
==
NULL
)
break
;
SVgroupTablesBatch
*
pTbBatch
=
*
ppTbBatch
;
int
tlen
=
sizeof
(
SMsgHead
)
+
tSVCreateTbBatchReqSerialize
(
NULL
,
&
(
pTbBatch
->
req
));
void
*
buf
=
malloc
(
tlen
);
if
(
buf
==
NULL
)
{
// TODO: handle error
}
((
SMsgHead
*
)
buf
)
->
vgId
=
htonl
(
pTbBatch
->
info
.
vgId
);
((
SMsgHead
*
)
buf
)
->
contLen
=
htonl
(
tlen
);
void
*
pBuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
tSVCreateTbBatchReqSerialize
(
&
pBuf
,
&
(
pTbBatch
->
req
));
taosArrayPush
(
pBufArray
,
&
buf
);
}
while
(
true
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -634,7 +655,7 @@ int32_t qParserValidateDclSqlNode(SSqlInfo* pInfo, SParseBasicCtx* pCtx, SDclStm
case
TSDB_SQL_SHOW
:
{
SShowInfo
*
pShowInfo
=
&
pInfo
->
pMiscInfo
->
showOpt
;
code
=
setShowInfo
(
pShowInfo
,
pCtx
,
(
void
**
)
&
pDcl
->
pMsg
,
&
pDcl
->
msgLen
,
&
pDcl
->
epSet
,
&
pDcl
->
pExtension
,
pMsgBuf
);
pDcl
->
msgType
=
(
pShowInfo
->
showType
==
TSDB_MGMT_TABLE_TABLE
)
?
TDMT_VND_SHOW_TABLES
:
TDMT_MND_SHOW
;
pDcl
->
msgType
=
(
pShowInfo
->
showType
==
TSDB_MGMT_TABLE_TABLE
)
?
TDMT_VND_SHOW_TABLES
:
TDMT_MND_SHOW
;
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录