Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e9d1733e
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看板
提交
e9d1733e
编写于
8月 31, 2022
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix tbname
上级
c4dcc994
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
97 addition
and
55 deletion
+97
-55
include/common/tmsg.h
include/common/tmsg.h
+16
-0
source/client/src/tmq.c
source/client/src/tmq.c
+12
-1
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+0
-16
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+3
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+66
-38
未找到文件。
include/common/tmsg.h
浏览文件 @
e9d1733e
...
@@ -2626,6 +2626,22 @@ typedef struct {
...
@@ -2626,6 +2626,22 @@ typedef struct {
};
};
}
STqOffsetVal
;
}
STqOffsetVal
;
static
FORCE_INLINE
void
tqOffsetResetToData
(
STqOffsetVal
*
pOffsetVal
,
int64_t
uid
,
int64_t
ts
)
{
pOffsetVal
->
type
=
TMQ_OFFSET__SNAPSHOT_DATA
;
pOffsetVal
->
uid
=
uid
;
pOffsetVal
->
ts
=
ts
;
}
static
FORCE_INLINE
void
tqOffsetResetToMeta
(
STqOffsetVal
*
pOffsetVal
,
int64_t
uid
)
{
pOffsetVal
->
type
=
TMQ_OFFSET__SNAPSHOT_META
;
pOffsetVal
->
uid
=
uid
;
}
static
FORCE_INLINE
void
tqOffsetResetToLog
(
STqOffsetVal
*
pOffsetVal
,
int64_t
ver
)
{
pOffsetVal
->
type
=
TMQ_OFFSET__LOG
;
pOffsetVal
->
version
=
ver
;
}
int32_t
tEncodeSTqOffsetVal
(
SEncoder
*
pEncoder
,
const
STqOffsetVal
*
pOffsetVal
);
int32_t
tEncodeSTqOffsetVal
(
SEncoder
*
pEncoder
,
const
STqOffsetVal
*
pOffsetVal
);
int32_t
tDecodeSTqOffsetVal
(
SDecoder
*
pDecoder
,
STqOffsetVal
*
pOffsetVal
);
int32_t
tDecodeSTqOffsetVal
(
SDecoder
*
pDecoder
,
STqOffsetVal
*
pOffsetVal
);
int32_t
tFormatOffset
(
char
*
buf
,
int32_t
maxLen
,
const
STqOffsetVal
*
pVal
);
int32_t
tFormatOffset
(
char
*
buf
,
int32_t
maxLen
,
const
STqOffsetVal
*
pVal
);
...
...
source/client/src/tmq.c
浏览文件 @
e9d1733e
...
@@ -811,8 +811,19 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) {
...
@@ -811,8 +811,19 @@ int32_t tmq_subscription(tmq_t* tmq, tmq_list_t** topics) {
}
}
int32_t
tmq_unsubscribe
(
tmq_t
*
tmq
)
{
int32_t
tmq_unsubscribe
(
tmq_t
*
tmq
)
{
int32_t
rsp
;
int32_t
retryCnt
=
0
;
tmq_list_t
*
lst
=
tmq_list_new
();
tmq_list_t
*
lst
=
tmq_list_new
();
int32_t
rsp
=
tmq_subscribe
(
tmq
,
lst
);
while
(
1
)
{
rsp
=
tmq_subscribe
(
tmq
,
lst
);
if
(
rsp
!=
TSDB_CODE_MND_CONSUMER_NOT_READY
||
retryCnt
>
5
)
{
break
;
}
else
{
retryCnt
++
;
taosMsleep
(
500
);
}
}
tmq_list_destroy
(
lst
);
tmq_list_destroy
(
lst
);
return
rsp
;
return
rsp
;
}
}
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
e9d1733e
...
@@ -175,22 +175,6 @@ void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data);
...
@@ -175,22 +175,6 @@ void tqTableSink(SStreamTask* pTask, void* vnode, int64_t ver, void* data);
char
*
tqOffsetBuildFName
(
const
char
*
path
,
int32_t
ver
);
char
*
tqOffsetBuildFName
(
const
char
*
path
,
int32_t
ver
);
int32_t
tqOffsetRestoreFromFile
(
STqOffsetStore
*
pStore
,
const
char
*
fname
);
int32_t
tqOffsetRestoreFromFile
(
STqOffsetStore
*
pStore
,
const
char
*
fname
);
static
FORCE_INLINE
void
tqOffsetResetToData
(
STqOffsetVal
*
pOffsetVal
,
int64_t
uid
,
int64_t
ts
)
{
pOffsetVal
->
type
=
TMQ_OFFSET__SNAPSHOT_DATA
;
pOffsetVal
->
uid
=
uid
;
pOffsetVal
->
ts
=
ts
;
}
static
FORCE_INLINE
void
tqOffsetResetToMeta
(
STqOffsetVal
*
pOffsetVal
,
int64_t
uid
)
{
pOffsetVal
->
type
=
TMQ_OFFSET__SNAPSHOT_META
;
pOffsetVal
->
uid
=
uid
;
}
static
FORCE_INLINE
void
tqOffsetResetToLog
(
STqOffsetVal
*
pOffsetVal
,
int64_t
ver
)
{
pOffsetVal
->
type
=
TMQ_OFFSET__LOG
;
pOffsetVal
->
version
=
ver
;
}
// tqStream
// tqStream
int32_t
tqExpandTask
(
STQ
*
pTq
,
SStreamTask
*
pTask
);
int32_t
tqExpandTask
(
STQ
*
pTq
,
SStreamTask
*
pTask
);
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
e9d1733e
...
@@ -137,6 +137,9 @@ int64_t tqScan(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqMetaRsp*
...
@@ -137,6 +137,9 @@ int64_t tqScan(STQ* pTq, const STqHandle* pHandle, SMqDataRsp* pRsp, SMqMetaRsp*
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
pRsp
)
<
0
)
{
if
(
tqAddTbNameToRsp
(
pTq
,
uid
,
pRsp
)
<
0
)
{
continue
;
continue
;
}
}
}
else
{
char
*
tbName
=
strdup
(
qExtractTbnameFromTask
(
task
));
taosArrayPush
(
pRsp
->
blockTbName
,
&
tbName
);
}
}
}
}
if
(
pRsp
->
withSchema
)
{
if
(
pRsp
->
withSchema
)
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
e9d1733e
...
@@ -1276,48 +1276,29 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
...
@@ -1276,48 +1276,29 @@ static int32_t setBlockIntoRes(SStreamScanInfo* pInfo, const SSDataBlock* pBlock
return
0
;
return
0
;
}
}
static
SSDataBlock
*
doStreamScan
(
SOperatorInfo
*
pOperator
)
{
static
SSDataBlock
*
doQueueScan
(
SOperatorInfo
*
pOperator
)
{
// NOTE: this operator does never check if current status is done or not
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SStreamScanInfo
*
pInfo
=
pOperator
->
info
;
SStreamScanInfo
*
pInfo
=
pOperator
->
info
;
#if 0
qDebug
(
"stream scan called"
);
SStreamState* pState = pTaskInfo->streamInfo.pState;
if
(
pTaskInfo
->
streamInfo
.
prepareStatus
.
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
if (pState) {
SSDataBlock
*
pResult
=
doTableScan
(
pInfo
->
pTableScanOp
);
printf(">>>>>>>> stream write backend\n");
if
(
pResult
&&
pResult
->
info
.
rows
>
0
)
{
SWinKey key = {
qDebug
(
"stream scan tsdb return %d rows"
,
pResult
->
info
.
rows
);
.ts = 1,
return
pResult
;
.groupId = 2,
}
else
{
};
STableScanInfo
*
pTSInfo
=
pInfo
->
pTableScanOp
->
info
;
char tmp[100] = "abcdefg1";
tsdbReaderClose
(
pTSInfo
->
dataReader
);
if (streamStatePut(pState, &key, &tmp, strlen(tmp) + 1) < 0) {
pTSInfo
->
dataReader
=
NULL
;
ASSERT(0);
tqOffsetResetToLog
(
&
pTaskInfo
->
streamInfo
.
prepareStatus
,
pTaskInfo
->
streamInfo
.
snapshotVer
);
}
qDebug
(
"stream scan tsdb over, switch to wal ver %d"
,
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
);
if
(
tqSeekVer
(
pInfo
->
tqReader
,
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
)
<
0
)
{
key.ts = 2;
return
NULL
;
char tmp2[100] = "abcdefg2";
if (streamStatePut(pState, &key, &tmp2, strlen(tmp2) + 1) < 0) {
ASSERT(0);
}
key.groupId = 5;
key.ts = 1;
char tmp3[100] = "abcdefg3";
if (streamStatePut(pState, &key, &tmp3, strlen(tmp3) + 1) < 0) {
ASSERT(0);
}
}
ASSERT
(
pInfo
->
tqReader
->
pWalReader
->
curVersion
==
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
);
char* val2 = NULL;
int32_t sz;
if (streamStateGet(pState, &key, (void**)&val2, &sz) < 0) {
ASSERT(0);
}
}
printf("stream read %s %d\n", val2, sz);
streamFreeVal(val2);
}
}
#endif
qDebug
(
"stream scan called"
);
if
(
pTaskInfo
->
streamInfo
.
prepareStatus
.
type
==
TMQ_OFFSET__LOG
)
{
if
(
pTaskInfo
->
streamInfo
.
prepareStatus
.
type
==
TMQ_OFFSET__LOG
)
{
while
(
1
)
{
while
(
1
)
{
SFetchRet
ret
=
{
0
};
SFetchRet
ret
=
{
0
};
...
@@ -1357,7 +1338,52 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
...
@@ -1357,7 +1338,52 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
}
}
qDebug
(
"stream scan tsdb return null"
);
qDebug
(
"stream scan tsdb return null"
);
return
NULL
;
return
NULL
;
}
else
{
ASSERT
(
0
);
return
NULL
;
}
}
}
static
SSDataBlock
*
doStreamScan
(
SOperatorInfo
*
pOperator
)
{
// NOTE: this operator does never check if current status is done or not
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SStreamScanInfo
*
pInfo
=
pOperator
->
info
;
#if 0
SStreamState* pState = pTaskInfo->streamInfo.pState;
if (pState) {
printf(">>>>>>>> stream write backend\n");
SWinKey key = {
.ts = 1,
.groupId = 2,
};
char tmp[100] = "abcdefg1";
if (streamStatePut(pState, &key, &tmp, strlen(tmp) + 1) < 0) {
ASSERT(0);
}
key.ts = 2;
char tmp2[100] = "abcdefg2";
if (streamStatePut(pState, &key, &tmp2, strlen(tmp2) + 1) < 0) {
ASSERT(0);
}
key.groupId = 5;
key.ts = 1;
char tmp3[100] = "abcdefg3";
if (streamStatePut(pState, &key, &tmp3, strlen(tmp3) + 1) < 0) {
ASSERT(0);
}
char* val2 = NULL;
int32_t sz;
if (streamStateGet(pState, &key, (void**)&val2, &sz) < 0) {
ASSERT(0);
}
printf("stream read %s %d\n", val2, sz);
streamFreeVal(val2);
}
#endif
if
(
pTaskInfo
->
streamInfo
.
recoverStep
==
STREAM_RECOVER_STEP__PREPARE
)
{
if
(
pTaskInfo
->
streamInfo
.
recoverStep
==
STREAM_RECOVER_STEP__PREPARE
)
{
STableScanInfo
*
pTSInfo
=
pInfo
->
pTableScanOp
->
info
;
STableScanInfo
*
pTSInfo
=
pInfo
->
pTableScanOp
->
info
;
...
@@ -1810,6 +1836,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
...
@@ -1810,6 +1836,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pInfo
->
readHandle
=
*
pHandle
;
pInfo
->
readHandle
=
*
pHandle
;
pInfo
->
tableUid
=
pScanPhyNode
->
uid
;
pInfo
->
tableUid
=
pScanPhyNode
->
uid
;
pTaskInfo
->
streamInfo
.
snapshotVer
=
pHandle
->
version
;
// set the extract column id to streamHandle
// set the extract column id to streamHandle
tqReaderSetColIdList
(
pInfo
->
tqReader
,
pColIds
);
tqReaderSetColIdList
(
pInfo
->
tqReader
,
pColIds
);
...
@@ -1853,8 +1880,9 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
...
@@ -1853,8 +1880,9 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pRes
->
pDataBlock
);
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pRes
->
pDataBlock
);
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
doStreamScan
,
NULL
,
NULL
,
destroyStreamScanOperatorInfo
,
__optr_fn_t
nextFn
=
pTaskInfo
->
execModel
==
OPTR_EXEC_MODEL_STREAM
?
doStreamScan
:
doQueueScan
;
NULL
,
NULL
,
NULL
);
pOperator
->
fpSet
=
createOperatorFpSet
(
operatorDummyOpenFn
,
nextFn
,
NULL
,
NULL
,
destroyStreamScanOperatorInfo
,
NULL
,
NULL
,
NULL
);
return
pOperator
;
return
pOperator
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录