Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
94a3fa4f
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看板
提交
94a3fa4f
编写于
1月 30, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:htol(length) & set vgId,uid correct for auto create table in taosx
上级
d7e15881
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
38 addition
and
16 deletion
+38
-16
source/client/src/clientRawBlockWrite.c
source/client/src/clientRawBlockWrite.c
+27
-6
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+3
-0
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+6
-9
utils/test/c/tmq_taosx_ci.c
utils/test/c/tmq_taosx_ci.c
+2
-1
未找到文件。
source/client/src/clientRawBlockWrite.c
浏览文件 @
94a3fa4f
...
...
@@ -1515,7 +1515,7 @@ static int32_t tmqWriteRawDataImpl(TAOS* taos, void* data, int32_t dataLen) {
code
=
smlBuildOutput
(
pQuery
,
pVgHash
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"smlBuildOutput failed"
);
return
code
;
goto
end
;
}
launchQueryImpl
(
pRequest
,
pQuery
,
true
,
NULL
);
...
...
@@ -1538,6 +1538,7 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
SMqTaosxRspObj
rspObj
=
{
0
};
SDecoder
decoder
=
{
0
};
STableMeta
*
pTableMeta
=
NULL
;
SVCreateTbReq
*
pCreateReqDst
=
NULL
;
terrno
=
TSDB_CODE_SUCCESS
;
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
createRequest
(
*
(
int64_t
*
)
taos
,
TSDB_SQL_INSERT
,
0
);
...
...
@@ -1605,17 +1606,17 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
strcpy
(
pName
.
tname
,
tbName
);
// find schema data info
SVCreateTbReq
pCreateReq
=
{
0
};
for
(
int
j
=
0
;
j
<
rspObj
.
rsp
.
createTableNum
;
j
++
)
{
void
**
dataTmp
=
taosArrayGet
(
rspObj
.
rsp
.
createTableReq
,
j
);
int32_t
*
lenTmp
=
taosArrayGet
(
rspObj
.
rsp
.
createTableLen
,
j
);
SDecoder
decoderTmp
=
{
0
};
SVCreateTbReq
pCreateReq
=
{
0
};
tDecoderInit
(
&
decoderTmp
,
*
dataTmp
,
*
lenTmp
);
memset
(
&
pCreateReq
,
0
,
sizeof
(
SVCreateTbReq
));
if
(
tDecodeSVCreateTbReq
(
&
decoderTmp
,
&
pCreateReq
)
<
0
)
{
tDecoderClear
(
&
decoderTmp
);
uError
(
"WriteRaw: tDecodeSVCreateTbReq error"
);
code
=
TSDB_CODE_TMQ_INVALID_MSG
;
goto
end
;
}
...
...
@@ -1625,13 +1626,18 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
goto
end
;
}
if
(
strcmp
(
tbName
,
pCreateReq
.
name
)
==
0
)
{
strcpy
(
pName
.
tname
,
pCreateReq
.
ctb
.
stbName
);
cloneSVreateTbReq
(
&
pCreateReq
,
&
pCreateReqDst
);
tDecoderClear
(
&
decoderTmp
);
break
;
}
tDecoderClear
(
&
decoderTmp
);
}
if
(
pCreateReqDst
){
strcpy
(
pName
.
tname
,
pCreateReqDst
->
ctb
.
stbName
);
}
else
{
strcpy
(
pName
.
tname
,
tbName
);
}
code
=
catalogGetTableMeta
(
pCatalog
,
&
conn
,
&
pName
,
&
pTableMeta
);
if
(
code
==
TSDB_CODE_PAR_TABLE_NOT_EXIST
)
{
uError
(
"WriteRaw:catalogGetTableMeta table not exist. table name: %s"
,
tbName
);
...
...
@@ -1650,16 +1656,27 @@ static int32_t tmqWriteRawMetaDataImpl(TAOS* taos, void* data, int32_t dataLen)
goto
end
;
}
if
(
pCreateReqDst
){
pTableMeta
->
vgId
=
vg
.
vgId
;
pTableMeta
->
uid
=
pCreateReqDst
->
uid
;
}
void
*
hData
=
taosHashGet
(
pVgHash
,
&
vg
.
vgId
,
sizeof
(
vg
.
vgId
));
if
(
hData
==
NULL
)
{
taosHashPut
(
pVgHash
,
(
const
char
*
)
&
vg
.
vgId
,
sizeof
(
vg
.
vgId
),
(
char
*
)
&
vg
,
sizeof
(
vg
));
}
code
=
rawBlockBindData
(
pQuery
,
pTableMeta
,
pRetrieve
->
data
,
&
pCreateReq
,
NULL
,
0
);
code
=
rawBlockBindData
(
pQuery
,
pTableMeta
,
pRetrieve
->
data
,
pCreateReqDst
,
NULL
,
0
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"WriteRaw:rawBlockBindData failed"
);
goto
end
;
}
pCreateReqDst
=
NULL
;
}
code
=
smlBuildOutput
(
pQuery
,
pVgHash
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
uError
(
"smlBuildOutput failed"
);
goto
end
;
}
launchQueryImpl
(
pRequest
,
pQuery
,
true
,
NULL
);
...
...
@@ -1672,6 +1689,10 @@ end:
destroyRequest
(
pRequest
);
taosHashCleanup
(
pVgHash
);
taosMemoryFreeClear
(
pTableMeta
);
if
(
pCreateReqDst
)
{
tdDestroySVCreateTbReq
(
pCreateReqDst
);
taosMemoryFree
(
pCreateReqDst
);
}
return
code
;
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
94a3fa4f
...
...
@@ -683,6 +683,9 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg) {
.
ver
=
pHead
->
version
,
};
if
(
tqTaosxScanLog
(
pTq
,
pHandle
,
submit
,
&
taosxRsp
)
<
0
)
{
tqError
(
"tmq poll: tqTaosxScanLog error %"
PRId64
", in vgId:%d, subkey %s"
,
consumerId
,
TD_VID
(
pTq
->
pVnode
),
req
.
subKey
);
return
-
1
;
}
if
(
taosxRsp
.
blockNum
>
0
/* threshold */
)
{
tqOffsetResetToLog
(
&
taosxRsp
.
rspOffset
,
fetchVer
);
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
94a3fa4f
...
...
@@ -34,7 +34,7 @@ int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataRsp* pRsp, int32_t
return
0
;
}
static
int32_t
tqAddBlockSchemaToRsp
(
const
STqExecHandle
*
pExec
,
S
MqData
Rsp
*
pRsp
)
{
static
int32_t
tqAddBlockSchemaToRsp
(
const
STqExecHandle
*
pExec
,
S
Taosx
Rsp
*
pRsp
)
{
SSchemaWrapper
*
pSW
=
tCloneSSchemaWrapper
(
pExec
->
pExecReader
->
pSchemaWrapper
);
if
(
pSW
==
NULL
)
{
return
-
1
;
...
...
@@ -43,7 +43,7 @@ static int32_t tqAddBlockSchemaToRsp(const STqExecHandle* pExec, SMqDataRsp* pRs
return
0
;
}
static
int32_t
tqAddTbNameToRsp
(
const
STQ
*
pTq
,
int64_t
uid
,
S
MqData
Rsp
*
pRsp
,
int32_t
n
)
{
static
int32_t
tqAddTbNameToRsp
(
const
STQ
*
pTq
,
int64_t
uid
,
S
Taosx
Rsp
*
pRsp
,
int32_t
n
)
{
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pTq
->
pVnode
->
pMeta
,
0
);
// TODO add reference to gurantee success
...
...
@@ -153,7 +153,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
if
(
pRsp
->
withTbName
)
{
if
(
pOffset
->
type
==
TMQ_OFFSET__LOG
)
{
int64_t
uid
=
pExec
->
pExecReader
->
lastBlkUid
;
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
(
SMqDataRsp
*
)
pRsp
,
1
)
<
0
)
{
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
pRsp
,
1
)
<
0
)
{
continue
;
}
}
else
{
...
...
@@ -163,7 +163,7 @@ int32_t tqScanTaosx(STQ* pTq, const STqHandle* pHandle, STaosxRsp* pRsp, SMqMeta
}
if
(
pRsp
->
withSchema
)
{
if
(
pOffset
->
type
==
TMQ_OFFSET__LOG
)
{
tqAddBlockSchemaToRsp
(
pExec
,
(
SMqDataRsp
*
)
pRsp
);
tqAddBlockSchemaToRsp
(
pExec
,
pRsp
);
}
else
{
SSchemaWrapper
*
pSW
=
tCloneSSchemaWrapper
(
qExtractSchemaFromTask
(
task
));
taosArrayPush
(
pRsp
->
blockSchema
,
&
pSW
);
...
...
@@ -248,7 +248,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
if
(
pRsp
->
withTbName
)
{
/*int64_t uid = pExec->pExecReader->msgIter.uid;*/
int64_t
uid
=
pExec
->
pExecReader
->
lastBlkUid
;
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
pBlocks
))
<
0
)
{
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
pRsp
,
taosArrayGetSize
(
pBlocks
))
<
0
)
{
taosArrayDestroyEx
(
pBlocks
,
(
FDelete
)
blockDataFreeRes
);
taosArrayDestroyP
(
pSchemas
,
(
FDelete
)
tDeleteSSchemaWrapper
);
pBlocks
=
taosArrayInit
(
0
,
sizeof
(
SSDataBlock
));
...
...
@@ -311,7 +311,7 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
}
if
(
pRsp
->
withTbName
)
{
int64_t
uid
=
pExec
->
pExecReader
->
lastBlkUid
;
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
(
SMqDataRsp
*
)
pRsp
,
taosArrayGetSize
(
pBlocks
))
<
0
)
{
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
pRsp
,
taosArrayGetSize
(
pBlocks
))
<
0
)
{
taosArrayDestroyEx
(
pBlocks
,
(
FDelete
)
blockDataFreeRes
);
taosArrayDestroyP
(
pSchemas
,
(
FDelete
)
tDeleteSSchemaWrapper
);
pBlocks
=
taosArrayInit
(
0
,
sizeof
(
SSDataBlock
));
...
...
@@ -364,9 +364,6 @@ int32_t tqTaosxScanLog(STQ* pTq, STqHandle* pHandle, SPackedData submit, STaosxR
}
}
taosArrayDestroy
(
pBlocks
);
taosArrayDestroy
(
pSchemas
);
if
(
pRsp
->
blockNum
==
0
)
{
return
-
1
;
}
...
...
utils/test/c/tmq_taosx_ci.c
浏览文件 @
94a3fa4f
...
...
@@ -70,6 +70,7 @@ static void msg_process(TAOS_RES* msg) {
tmq_get_raw
(
msg
,
&
raw
);
printf
(
"write raw data type: %d
\n
"
,
raw
.
raw_type
);
int32_t
ret
=
tmq_write_raw
(
pConn
,
raw
);
ASSERT
(
ret
==
0
);
printf
(
"write raw data: %s
\n
"
,
tmq_err2str
(
ret
));
tmq_free_raw
(
raw
);
taos_close
(
pConn
);
...
...
@@ -361,7 +362,7 @@ int buildDatabase(TAOS* pConn, TAOS_RES* pRes){
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"insert into stt3 using stt tags(23,
\"
stt3
\"
, true) values(now + 1s, 1, 2, 'stt3') sttb3 using sttb tags(4,
\"
sttb3
\"
, true) values(now + 2s, 13, 22, 'sttb3') "
pRes
=
taos_query
(
pConn
,
"insert into stt
1 values(now + 2s, 3, 2, 'stt1') stt
3 using stt tags(23,
\"
stt3
\"
, true) values(now + 1s, 1, 2, 'stt3') sttb3 using sttb tags(4,
\"
sttb3
\"
, true) values(now + 2s, 13, 22, 'sttb3') "
"stt4 using stt tags(433,
\"
stt4
\"
, false) values(now + 3s, 21, 21, 'stt4') sttb4 using sttb tags(543,
\"
sttb4
\"
, true) values(now + 4s, 16, 25, 'sttb4')"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create child table stt1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录