Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d96cdff8
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看板
提交
d96cdff8
编写于
1月 28, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:add logic for auto create table while inserting data for taosx
上级
fe8a4631
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
65 addition
and
41 deletion
+65
-41
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+2
-2
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+56
-33
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+5
-4
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+2
-2
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
d96cdff8
...
@@ -266,8 +266,8 @@ int32_t tqReaderSetSubmitReq2(STqReader *pReader, void *msgStr, int32_t msgLen,
...
@@ -266,8 +266,8 @@ int32_t tqReaderSetSubmitReq2(STqReader *pReader, void *msgStr, int32_t msgLen,
// int32_t tqReaderSetDataMsg(STqReader *pReader, const SSubmitReq *pMsg, int64_t ver);
// int32_t tqReaderSetDataMsg(STqReader *pReader, const SSubmitReq *pMsg, int64_t ver);
bool
tqNextDataBlock2
(
STqReader
*
pReader
);
bool
tqNextDataBlock2
(
STqReader
*
pReader
);
bool
tqNextDataBlockFilterOut2
(
STqReader
*
pReader
,
SHashObj
*
filterOutUids
);
bool
tqNextDataBlockFilterOut2
(
STqReader
*
pReader
,
SHashObj
*
filterOutUids
);
int32_t
tqRetrieveDataBlock2
(
SSDataBlock
*
pBlock
,
STqReader
*
pReader
);
int32_t
tqRetrieveDataBlock2
(
SSDataBlock
*
pBlock
,
STqReader
*
pReader
,
SSubmitTbData
**
pSubmitTbDataRet
);
int32_t
tqRetrieveTaosxBlock2
(
STqReader
*
pReader
,
SArray
*
blocks
,
SArray
*
schemas
);
int32_t
tqRetrieveTaosxBlock2
(
STqReader
*
pReader
,
SArray
*
blocks
,
SArray
*
schemas
,
SSubmitTbData
**
pSubmitTbDataRet
);
// int32_t tqRetrieveDataBlock(SSDataBlock *pBlock, STqReader *pReader);
// int32_t tqRetrieveDataBlock(SSDataBlock *pBlock, STqReader *pReader);
// int32_t tqRetrieveTaosxBlock(STqReader *pReader, SArray *blocks, SArray *schemas);
// int32_t tqRetrieveTaosxBlock(STqReader *pReader, SArray *blocks, SArray *schemas);
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
d96cdff8
...
@@ -241,7 +241,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
...
@@ -241,7 +241,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
taosArrayClear
(
pBlocks
);
taosArrayClear
(
pBlocks
);
taosArrayClear
(
pSchemas
);
taosArrayClear
(
pSchemas
);
if
(
tqRetrieveTaosxBlock2
(
pReader
,
pBlocks
,
pSchemas
)
<
0
)
{
SSubmitTbData
*
pSubmitTbDataRet
=
NULL
;
if
(
tqRetrieveTaosxBlock2
(
pReader
,
pBlocks
,
pSchemas
,
&
pSubmitTbDataRet
)
<
0
)
{
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
}
}
if
(
pRsp
->
withTbName
)
{
if
(
pRsp
->
withTbName
)
{
...
@@ -255,23 +256,33 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
...
@@ -255,23 +256,33 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
continue
;
continue
;
}
}
}
}
if
(
pHandle
->
fetchMeta
)
{
if
(
pHandle
->
fetchMeta
&&
pSubmitTbDataRet
->
pCreateTbReq
!=
NULL
)
{
#if 0
SSubmitBlk* pBlk = pReader->pBlock;
int64_t uid = pExec->pExecReader->lastBlkUid;
int32_t schemaLen = htonl(pBlk->schemaLen);
if (schemaLen > 0) {
if
(
pRsp
->
createTableNum
==
0
)
{
if
(
pRsp
->
createTableNum
==
0
)
{
pRsp
->
createTableLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
pRsp
->
createTableLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
pRsp
->
createTableReq
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pRsp
->
createTableReq
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
}
}
void* createReq = taosMemoryCalloc(1, schemaLen);
memcpy(createReq, pBlk->data, schemaLen);
int32_t
code
=
TSDB_CODE_SUCCESS
;
taosArrayPush(pRsp->createTableLen, &schemaLen);
uint32_t
len
=
0
;
tEncodeSize
(
tEncodeSVCreateTbReq
,
pSubmitTbDataRet
->
pCreateTbReq
,
len
,
code
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
continue
;
}
void
*
createReq
=
taosMemoryCalloc
(
1
,
len
);
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
createReq
,
len
);
code
=
tEncodeSVCreateTbReq
(
&
encoder
,
pSubmitTbDataRet
->
pCreateTbReq
);
if
(
code
<
0
)
{
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
createReq
);
continue
;
}
taosArrayPush
(
pRsp
->
createTableLen
,
&
len
);
taosArrayPush
(
pRsp
->
createTableReq
,
&
createReq
);
taosArrayPush
(
pRsp
->
createTableReq
,
&
createReq
);
pRsp
->
createTableNum
++
;
pRsp
->
createTableNum
++
;
}
#endif
tEncoderClear
(
&
encoder
);
}
}
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pBlocks
);
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pBlocks
);
i
++
)
{
SSDataBlock
*
pBlock
=
taosArrayGet
(
pBlocks
,
i
);
SSDataBlock
*
pBlock
=
taosArrayGet
(
pBlocks
,
i
);
...
@@ -294,7 +305,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
...
@@ -294,7 +305,8 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
/*}*/
/*}*/
taosArrayClear
(
pBlocks
);
taosArrayClear
(
pBlocks
);
taosArrayClear
(
pSchemas
);
taosArrayClear
(
pSchemas
);
if
(
tqRetrieveTaosxBlock2
(
pReader
,
pBlocks
,
pSchemas
)
<
0
)
{
SSubmitTbData
*
pSubmitTbDataRet
=
NULL
;
if
(
tqRetrieveTaosxBlock2
(
pReader
,
pBlocks
,
pSchemas
,
&
pSubmitTbDataRet
)
<
0
)
{
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
}
}
if
(
pRsp
->
withTbName
)
{
if
(
pRsp
->
withTbName
)
{
...
@@ -307,22 +319,33 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
...
@@ -307,22 +319,33 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
continue
;
continue
;
}
}
}
}
if
(
pHandle
->
fetchMeta
)
{
if
(
pHandle
->
fetchMeta
&&
pSubmitTbDataRet
->
pCreateTbReq
!=
NULL
)
{
#if 0
SSubmitBlk* pBlk = pReader->pBlock;
int32_t schemaLen = htonl(pBlk->schemaLen);
if (schemaLen > 0) {
if
(
pRsp
->
createTableNum
==
0
)
{
if
(
pRsp
->
createTableNum
==
0
)
{
pRsp
->
createTableLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
pRsp
->
createTableLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
pRsp
->
createTableReq
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pRsp
->
createTableReq
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
}
}
void* createReq = taosMemoryCalloc(1, schemaLen);
memcpy(createReq, pBlk->data, schemaLen);
int32_t
code
=
TSDB_CODE_SUCCESS
;
taosArrayPush(pRsp->createTableLen, &schemaLen);
uint32_t
len
=
0
;
tEncodeSize
(
tEncodeSVCreateTbReq
,
pSubmitTbDataRet
->
pCreateTbReq
,
len
,
code
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
continue
;
}
void
*
createReq
=
taosMemoryCalloc
(
1
,
len
);
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
createReq
,
len
);
code
=
tEncodeSVCreateTbReq
(
&
encoder
,
pSubmitTbDataRet
->
pCreateTbReq
);
if
(
code
<
0
)
{
tEncoderClear
(
&
encoder
);
taosMemoryFree
(
createReq
);
continue
;
}
taosArrayPush
(
pRsp
->
createTableLen
,
&
len
);
taosArrayPush
(
pRsp
->
createTableReq
,
&
createReq
);
taosArrayPush
(
pRsp
->
createTableReq
,
&
createReq
);
pRsp
->
createTableNum
++
;
pRsp
->
createTableNum
++
;
}
#endif
tEncoderClear
(
&
encoder
);
}
}
/*tqAddBlockDataToRsp(&block, (SMqDataRsp*)pRsp, taosArrayGetSize(block.pDataBlock),*/
/*tqAddBlockDataToRsp(&block, (SMqDataRsp*)pRsp, taosArrayGetSize(block.pDataBlock),*/
/*pTq->pVnode->config.tsdbCfg.precision);*/
/*pTq->pVnode->config.tsdbCfg.precision);*/
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
d96cdff8
...
@@ -332,7 +332,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
...
@@ -332,7 +332,7 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
while
(
tqNextDataBlock2
(
pReader
))
{
while
(
tqNextDataBlock2
(
pReader
))
{
// TODO mem free
// TODO mem free
memset
(
&
ret
->
data
,
0
,
sizeof
(
SSDataBlock
));
memset
(
&
ret
->
data
,
0
,
sizeof
(
SSDataBlock
));
int32_t
code
=
tqRetrieveDataBlock2
(
&
ret
->
data
,
pReader
);
int32_t
code
=
tqRetrieveDataBlock2
(
&
ret
->
data
,
pReader
,
NULL
);
if
(
code
!=
0
||
ret
->
data
.
info
.
rows
==
0
)
{
if
(
code
!=
0
||
ret
->
data
.
info
.
rows
==
0
)
{
continue
;
continue
;
}
}
...
@@ -550,7 +550,7 @@ int32_t tqScanSubmitSplit(SArray* pBlocks, SArray* schemas, STqReader* pReader)
...
@@ -550,7 +550,7 @@ int32_t tqScanSubmitSplit(SArray* pBlocks, SArray* schemas, STqReader* pReader)
}
}
#endif
#endif
int32_t
tqRetrieveDataBlock2
(
SSDataBlock
*
pBlock
,
STqReader
*
pReader
)
{
int32_t
tqRetrieveDataBlock2
(
SSDataBlock
*
pBlock
,
STqReader
*
pReader
,
SSubmitTbData
**
pSubmitTbDataRet
)
{
int32_t
blockSz
=
taosArrayGetSize
(
pReader
->
submit
.
aSubmitTbData
);
int32_t
blockSz
=
taosArrayGetSize
(
pReader
->
submit
.
aSubmitTbData
);
ASSERT
(
pReader
->
nextBlk
<
blockSz
);
ASSERT
(
pReader
->
nextBlk
<
blockSz
);
...
@@ -559,6 +559,7 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader) {
...
@@ -559,6 +559,7 @@ int32_t tqRetrieveDataBlock2(SSDataBlock* pBlock, STqReader* pReader) {
SSubmitTbData
*
pSubmitTbData
=
taosArrayGet
(
pReader
->
submit
.
aSubmitTbData
,
pReader
->
nextBlk
);
SSubmitTbData
*
pSubmitTbData
=
taosArrayGet
(
pReader
->
submit
.
aSubmitTbData
,
pReader
->
nextBlk
);
pReader
->
nextBlk
++
;
pReader
->
nextBlk
++
;
if
(
pSubmitTbDataRet
)
*
pSubmitTbDataRet
=
pSubmitTbData
;
int32_t
sversion
=
pSubmitTbData
->
sver
;
int32_t
sversion
=
pSubmitTbData
->
sver
;
int64_t
suid
=
pSubmitTbData
->
suid
;
int64_t
suid
=
pSubmitTbData
->
suid
;
int64_t
uid
=
pSubmitTbData
->
uid
;
int64_t
uid
=
pSubmitTbData
->
uid
;
...
@@ -1006,9 +1007,9 @@ FAIL:
...
@@ -1006,9 +1007,9 @@ FAIL:
}
}
#endif
#endif
int32_t
tqRetrieveTaosxBlock2
(
STqReader
*
pReader
,
SArray
*
blocks
,
SArray
*
schemas
)
{
int32_t
tqRetrieveTaosxBlock2
(
STqReader
*
pReader
,
SArray
*
blocks
,
SArray
*
schemas
,
SSubmitTbData
**
pSubmitTbDataRet
)
{
SSDataBlock
block
=
{
0
};
SSDataBlock
block
=
{
0
};
if
(
tqRetrieveDataBlock2
(
&
block
,
pReader
)
==
0
)
{
if
(
tqRetrieveDataBlock2
(
&
block
,
pReader
,
pSubmitTbDataRet
)
==
0
)
{
taosArrayPush
(
blocks
,
&
block
);
taosArrayPush
(
blocks
,
&
block
);
SSchemaWrapper
*
pSW
=
tCloneSSchemaWrapper
(
pReader
->
pSchemaWrapper
);
SSchemaWrapper
*
pSW
=
tCloneSSchemaWrapper
(
pReader
->
pSchemaWrapper
);
taosArrayPush
(
schemas
,
&
pSW
);
taosArrayPush
(
schemas
,
&
pSW
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
d96cdff8
...
@@ -1532,7 +1532,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
...
@@ -1532,7 +1532,7 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
while
(
tqNextDataBlock2
(
pInfo
->
tqReader
))
{
while
(
tqNextDataBlock2
(
pInfo
->
tqReader
))
{
SSDataBlock
block
=
{
0
};
SSDataBlock
block
=
{
0
};
int32_t
code
=
tqRetrieveDataBlock2
(
&
block
,
pInfo
->
tqReader
);
int32_t
code
=
tqRetrieveDataBlock2
(
&
block
,
pInfo
->
tqReader
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
block
.
info
.
rows
==
0
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
||
block
.
info
.
rows
==
0
)
{
continue
;
continue
;
...
@@ -1941,7 +1941,7 @@ FETCH_NEXT_BLOCK:
...
@@ -1941,7 +1941,7 @@ FETCH_NEXT_BLOCK:
while
(
tqNextDataBlock2
(
pInfo
->
tqReader
))
{
while
(
tqNextDataBlock2
(
pInfo
->
tqReader
))
{
SSDataBlock
block
=
{
0
};
SSDataBlock
block
=
{
0
};
int32_t
code
=
tqRetrieveDataBlock2
(
&
block
,
pInfo
->
tqReader
);
int32_t
code
=
tqRetrieveDataBlock2
(
&
block
,
pInfo
->
tqReader
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
block
.
info
.
rows
==
0
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
||
block
.
info
.
rows
==
0
)
{
continue
;
continue
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录