Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9392c03b
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看板
提交
9392c03b
编写于
5月 06, 2023
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(stream): add some logs.
上级
13f3ca42
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
56 deletion
+36
-56
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+3
-3
source/dnode/vnode/src/sma/smaTimeRange.c
source/dnode/vnode/src/sma/smaTimeRange.c
+1
-1
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+1
-1
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+31
-51
未找到文件。
source/dnode/vnode/src/inc/tq.h
浏览文件 @
9392c03b
...
...
@@ -167,9 +167,9 @@ int32_t tqOffsetDelete(STqOffsetStore* pStore, const char* subscribeKey)
int32_t
tqOffsetCommitFile
(
STqOffsetStore
*
pStore
);
// tqSink
int32_t
tqBuildDeleteReq
(
SVnode
*
pVnode
,
const
char
*
stbFullName
,
const
SSDataBlock
*
pDataBlock
,
SBatchDeleteReq
*
deleteReq
);
void
tqSinkToTablePipeline
2
(
SStreamTask
*
pTask
,
void
*
vnode
,
int64_t
ver
,
void
*
data
);
int32_t
tqBuildDeleteReq
(
const
char
*
stbFullName
,
const
SSDataBlock
*
pDataBlock
,
SBatchDeleteReq
*
deleteReq
,
const
char
*
pIdStr
);
void
tqSinkToTablePipeline
(
SStreamTask
*
pTask
,
void
*
vnode
,
int64_t
ver
,
void
*
data
);
// tqOffset
char
*
tqOffsetBuildFName
(
const
char
*
path
,
int32_t
fVer
);
...
...
source/dnode/vnode/src/sma/smaTimeRange.c
浏览文件 @
9392c03b
...
...
@@ -250,7 +250,7 @@ int32_t smaBlockToSubmit(SVnode *pVnode, const SArray *pBlocks, const STSchema *
if
(
pDataBlock
->
info
.
type
==
STREAM_DELETE_RESULT
)
{
pDeleteReq
->
suid
=
suid
;
pDeleteReq
->
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
));
tqBuildDeleteReq
(
pVnode
,
stbFullName
,
pDataBlock
,
pDeleteReq
);
tqBuildDeleteReq
(
stbFullName
,
pDataBlock
,
pDeleteReq
,
""
);
continue
;
}
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
9392c03b
...
...
@@ -637,7 +637,7 @@ int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int64_t ver) {
pTask
->
smaSink
.
smaSink
=
smaHandleRes
;
}
else
if
(
pTask
->
outputType
==
TASK_OUTPUT__TABLE
)
{
pTask
->
tbSink
.
vnode
=
pTq
->
pVnode
;
pTask
->
tbSink
.
tbSinkFunc
=
tqSinkToTablePipeline
2
;
pTask
->
tbSink
.
tbSinkFunc
=
tqSinkToTablePipeline
;
int32_t
ver1
=
1
;
SMetaInfo
info
=
{
0
};
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
9392c03b
...
...
@@ -17,23 +17,24 @@
#include "tmsg.h"
#include "tq.h"
int32_t
tqBuildDeleteReq
(
SVnode
*
pVnode
,
const
char
*
stbFullName
,
const
SSDataBlock
*
pDataBlock
,
SBatchDeleteReq
*
deleteReq
)
{
int32_t
tot
Row
=
pDataBlock
->
info
.
rows
;
int32_t
tqBuildDeleteReq
(
const
char
*
stbFullName
,
const
SSDataBlock
*
pDataBlock
,
SBatchDeleteReq
*
deleteReq
,
const
char
*
pIdStr
)
{
int32_t
tot
alRows
=
pDataBlock
->
info
.
rows
;
SColumnInfoData
*
pStartTsCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
START_TS_COLUMN_INDEX
);
SColumnInfoData
*
pEndTsCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
END_TS_COLUMN_INDEX
);
SColumnInfoData
*
pGidCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
GROUPID_COLUMN_INDEX
);
SColumnInfoData
*
pTbNameCol
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
TABLE_NAME_COLUMN_INDEX
);
tqDebug
(
"s
tream delete msg: row %d"
,
totRow
);
tqDebug
(
"s
-task:%s build %d rows delete msg for table:%s"
,
pIdStr
,
totalRows
,
stbFullName
);
for
(
int32_t
row
=
0
;
row
<
tot
Row
;
row
++
)
{
int64_t
s
tartTs
=
*
(
int64_t
*
)
colDataGetData
(
pStartTsCol
,
row
);
int64_t
e
ndTs
=
*
(
int64_t
*
)
colDataGetData
(
pEndTsCol
,
row
);
for
(
int32_t
row
=
0
;
row
<
tot
alRows
;
row
++
)
{
int64_t
s
key
=
*
(
int64_t
*
)
colDataGetData
(
pStartTsCol
,
row
);
int64_t
e
key
=
*
(
int64_t
*
)
colDataGetData
(
pEndTsCol
,
row
);
int64_t
groupId
=
*
(
int64_t
*
)
colDataGetData
(
pGidCol
,
row
);
char
*
name
;
void
*
varTbName
=
NULL
;
if
(
!
colDataIsNull
(
pTbNameCol
,
tot
Row
,
row
,
NULL
))
{
if
(
!
colDataIsNull
(
pTbNameCol
,
tot
alRows
,
row
,
NULL
))
{
varTbName
=
colDataGetVarData
(
pTbNameCol
,
row
);
}
...
...
@@ -43,31 +44,17 @@ int32_t tqBuildDeleteReq(SVnode* pVnode, const char* stbFullName, const SSDataBl
}
else
{
name
=
buildCtbNameByGroupId
(
stbFullName
,
groupId
);
}
tqDebug
(
"stream delete msg: vgId:%d, groupId :%"
PRId64
", name: %s, start ts:%"
PRId64
"end ts:%"
PRId64
,
pVnode
->
config
.
vgId
,
groupId
,
name
,
startTs
,
endTs
);
#if 0
SMetaReader mr = {0};
metaReaderInit(&mr, pVnode->pMeta, 0);
if (metaGetTableEntryByName(&mr, name) < 0) {
metaReaderClear(&mr);
tqDebug("stream delete msg, skip vgId:%d since no table: %s", pVnode->config.vgId, name);
taosMemoryFree(name);
continue;
}
int64_t uid = mr.me.uid;
metaReaderClear(&mr);
taosMemoryFree(name);
#endif
SSingleDeleteReq
req
=
{
.
startTs
=
startTs
,
.
endTs
=
endTs
,
};
tqDebug
(
"s-task:%s build delete msg groupId:%"
PRId64
", name:%s, skey:%"
PRId64
" ekey:%"
PRId64
,
pIdStr
,
groupId
,
name
,
skey
,
ekey
);
SSingleDeleteReq
req
=
{
.
startTs
=
skey
,
.
endTs
=
ekey
};
strncpy
(
req
.
tbname
,
name
,
TSDB_TABLE_NAME_LEN
-
1
);
taosMemoryFree
(
name
);
/*tqDebug("stream delete msg, active: vgId:%d, ts:%" PRId64 " name:%s", pVnode->config.vgId, ts, name);*/
taosArrayPush
(
deleteReq
->
deleteReqs
,
&
req
);
}
return
0
;
}
...
...
@@ -108,12 +95,7 @@ int32_t tqPutReqToQueue(SVnode* pVnode, SVCreateTbBatchReq* pReqs) {
int32_t
tlen
=
0
;
encodeCreateChildTableForRPC
(
pReqs
,
TD_VID
(
pVnode
),
&
buf
,
&
tlen
);
SRpcMsg
msg
=
{
.
msgType
=
TDMT_VND_CREATE_TABLE
,
.
pCont
=
buf
,
.
contLen
=
tlen
,
};
SRpcMsg
msg
=
{
.
msgType
=
TDMT_VND_CREATE_TABLE
,
.
pCont
=
buf
,
.
contLen
=
tlen
};
if
(
tmsgPutToQueue
(
&
pVnode
->
msgCb
,
WRITE_QUEUE
,
&
msg
)
!=
0
)
{
tqError
(
"failed to put into write-queue since %s"
,
terrstr
());
}
...
...
@@ -121,13 +103,12 @@ int32_t tqPutReqToQueue(SVnode* pVnode, SVCreateTbBatchReq* pReqs) {
return
TSDB_CODE_SUCCESS
;
}
void
tqSinkToTablePipeline
2
(
SStreamTask
*
pTask
,
void
*
vnode
,
int64_t
ver
,
void
*
data
)
{
void
tqSinkToTablePipeline
(
SStreamTask
*
pTask
,
void
*
vnode
,
int64_t
ver
,
void
*
data
)
{
const
SArray
*
pBlocks
=
(
const
SArray
*
)
data
;
SVnode
*
pVnode
=
(
SVnode
*
)
vnode
;
int64_t
suid
=
pTask
->
tbSink
.
stbUid
;
char
*
stbFullName
=
pTask
->
tbSink
.
stbFullName
;
STSchema
*
pTSchema
=
pTask
->
tbSink
.
pTSchema
;
/*SSchemaWrapper* pSchemaWrapper = pTask->tbSink.pSchemaWrapper;*/
int32_t
blockSz
=
taosArrayGetSize
(
pBlocks
);
...
...
@@ -141,11 +122,11 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
for
(
int32_t
i
=
0
;
i
<
blockSz
;
i
++
)
{
SSDataBlock
*
pDataBlock
=
taosArrayGet
(
pBlocks
,
i
);
int32_t
rows
=
pDataBlock
->
info
.
rows
;
if
(
pDataBlock
->
info
.
type
==
STREAM_DELETE_RESULT
)
{
SBatchDeleteReq
deleteReq
=
{
0
};
deleteReq
.
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
));
deleteReq
.
suid
=
suid
;
tqBuildDeleteReq
(
pVnode
,
stbFullName
,
pDataBlock
,
&
deleteReq
);
SBatchDeleteReq
deleteReq
=
{.
suid
=
suid
,
.
deleteReqs
=
taosArrayInit
(
0
,
sizeof
(
SSingleDeleteReq
))};
tqBuildDeleteReq
(
stbFullName
,
pDataBlock
,
&
deleteReq
,
pTask
->
id
.
idStr
);
if
(
taosArrayGetSize
(
deleteReq
.
deleteReqs
)
==
0
)
{
taosArrayDestroy
(
deleteReq
.
deleteReqs
);
continue
;
...
...
@@ -154,10 +135,10 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
int32_t
len
;
int32_t
code
;
tEncodeSize
(
tEncodeSBatchDeleteReq
,
&
deleteReq
,
len
,
code
);
if
(
code
<
0
)
{
//
ASSERT
(
0
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"s-task:%s failed to encode delete request"
,
pTask
->
id
.
idStr
);
}
SEncoder
encoder
;
void
*
serializedDeleteReq
=
rpcMallocCont
(
len
+
sizeof
(
SMsgHead
));
void
*
abuf
=
POINTER_SHIFT
(
serializedDeleteReq
,
sizeof
(
SMsgHead
));
...
...
@@ -168,11 +149,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
((
SMsgHead
*
)
serializedDeleteReq
)
->
vgId
=
pVnode
->
config
.
vgId
;
SRpcMsg
msg
=
{
.
msgType
=
TDMT_VND_BATCH_DEL
,
.
pCont
=
serializedDeleteReq
,
.
contLen
=
len
+
sizeof
(
SMsgHead
),
};
SRpcMsg
msg
=
{
.
msgType
=
TDMT_VND_BATCH_DEL
,
.
pCont
=
serializedDeleteReq
,
.
contLen
=
len
+
sizeof
(
SMsgHead
)
};
if
(
tmsgPutToQueue
(
&
pVnode
->
msgCb
,
WRITE_QUEUE
,
&
msg
)
!=
0
)
{
tqDebug
(
"failed to put delete req into write-queue since %s"
,
terrstr
());
}
...
...
@@ -182,6 +159,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
if
(
NULL
==
reqs
.
pArray
)
{
goto
_end
;
}
for
(
int32_t
rowId
=
0
;
rowId
<
rows
;
rowId
++
)
{
SVCreateTbReq
createTbReq
=
{
0
};
SVCreateTbReq
*
pCreateTbReq
=
&
createTbReq
;
...
...
@@ -204,11 +182,13 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
tdDestroySVCreateTbReq
(
pCreateTbReq
);
goto
_end
;
}
STagVal
tagVal
=
{
.
cid
=
pTSchema
->
numOfCols
+
1
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
id
.
groupId
,
};
taosArrayPush
(
tagArray
,
&
tagVal
);
// set tag name
...
...
@@ -271,7 +251,7 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
crTblArray
=
NULL
;
}
else
{
SSubmitTbData
tbData
=
{
0
};
tqDebug
(
"tq sink pipe
2
, convert block1 %d, rows: %d"
,
i
,
rows
);
tqDebug
(
"tq sink pipe, convert block1 %d, rows: %d"
,
i
,
rows
);
if
(
!
(
tbData
.
aRowP
=
taosArrayInit
(
rows
,
sizeof
(
SRow
*
))))
{
goto
_end
;
...
...
@@ -405,8 +385,8 @@ void tqSinkToTablePipeline2(SStreamTask* pTask, void* vnode, int64_t ver, void*
}
else
{
void
*
colData
=
colDataGetData
(
pColData
,
j
);
if
(
IS_STR_DATA_TYPE
(
pCol
->
type
))
{
SValue
sv
=
(
SValue
){.
nData
=
varDataLen
(
colData
),
.
pData
=
varDataVal
(
colData
)};
// address copy, no value
// address copy, no value
SValue
sv
=
(
SValue
){.
nData
=
varDataLen
(
colData
),
.
pData
=
varDataVal
(
colData
)};
SColVal
cv
=
COL_VAL_VALUE
(
pCol
->
colId
,
pCol
->
type
,
sv
);
taosArrayPush
(
pVals
,
&
cv
);
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录