Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
bbdcbcb7
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看板
提交
bbdcbcb7
编写于
7月 14, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:modify commit version to next validate version
上级
d2971230
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
38 addition
and
33 deletion
+38
-33
include/client/taos.h
include/client/taos.h
+9
-5
include/libs/executor/storageapi.h
include/libs/executor/storageapi.h
+1
-1
source/client/src/clientTmq.c
source/client/src/clientTmq.c
+6
-6
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+1
-1
source/dnode/vnode/src/tq/tqUtil.c
source/dnode/vnode/src/tq/tqUtil.c
+7
-7
source/dnode/vnode/src/vnd/vnodeInitApi.c
source/dnode/vnode/src/vnd/vnodeInitApi.c
+1
-1
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+4
-4
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+7
-6
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+2
-2
未找到文件。
include/client/taos.h
浏览文件 @
bbdcbcb7
...
@@ -287,11 +287,20 @@ DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
...
@@ -287,11 +287,20 @@ DLL_EXPORT TAOS_RES *tmq_consumer_poll(tmq_t *tmq, int64_t timeout);
DLL_EXPORT
int32_t
tmq_consumer_close
(
tmq_t
*
tmq
);
DLL_EXPORT
int32_t
tmq_consumer_close
(
tmq_t
*
tmq
);
DLL_EXPORT
int32_t
tmq_commit_sync
(
tmq_t
*
tmq
,
const
TAOS_RES
*
msg
);
DLL_EXPORT
int32_t
tmq_commit_sync
(
tmq_t
*
tmq
,
const
TAOS_RES
*
msg
);
DLL_EXPORT
void
tmq_commit_async
(
tmq_t
*
tmq
,
const
TAOS_RES
*
msg
,
tmq_commit_cb
*
cb
,
void
*
param
);
DLL_EXPORT
void
tmq_commit_async
(
tmq_t
*
tmq
,
const
TAOS_RES
*
msg
,
tmq_commit_cb
*
cb
,
void
*
param
);
DLL_EXPORT
int32_t
tmq_commit_offset_sync
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
,
int64_t
offset
);
DLL_EXPORT
void
tmq_commit_offset_async
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
,
int64_t
offset
,
tmq_commit_cb
*
cb
,
void
*
param
);
DLL_EXPORT
int32_t
tmq_get_topic_assignment
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
tmq_topic_assignment
**
assignment
,
DLL_EXPORT
int32_t
tmq_get_topic_assignment
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
tmq_topic_assignment
**
assignment
,
int32_t
*
numOfAssignment
);
int32_t
*
numOfAssignment
);
DLL_EXPORT
void
tmq_free_assignment
(
tmq_topic_assignment
*
pAssignment
);
DLL_EXPORT
void
tmq_free_assignment
(
tmq_topic_assignment
*
pAssignment
);
DLL_EXPORT
int32_t
tmq_offset_seek
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
,
int64_t
offset
);
DLL_EXPORT
int32_t
tmq_offset_seek
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
,
int64_t
offset
);
DLL_EXPORT
const
char
*
tmq_get_topic_name
(
TAOS_RES
*
res
);
DLL_EXPORT
const
char
*
tmq_get_db_name
(
TAOS_RES
*
res
);
DLL_EXPORT
int32_t
tmq_get_vgroup_id
(
TAOS_RES
*
res
);
DLL_EXPORT
int64_t
tmq_get_vgroup_offset
(
TAOS_RES
*
res
);
DLL_EXPORT
int64_t
tmq_position
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
);
DLL_EXPORT
int64_t
tmq_committed
(
tmq_t
*
tmq
,
const
char
*
pTopicName
,
int32_t
vgId
);
/* ----------------------TMQ CONFIGURATION INTERFACE---------------------- */
/* ----------------------TMQ CONFIGURATION INTERFACE---------------------- */
enum
tmq_conf_res_t
{
enum
tmq_conf_res_t
{
...
@@ -309,11 +318,6 @@ DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_comm
...
@@ -309,11 +318,6 @@ DLL_EXPORT void tmq_conf_set_auto_commit_cb(tmq_conf_t *conf, tmq_comm
/* -------------------------TMQ MSG HANDLE INTERFACE---------------------- */
/* -------------------------TMQ MSG HANDLE INTERFACE---------------------- */
DLL_EXPORT
const
char
*
tmq_get_topic_name
(
TAOS_RES
*
res
);
DLL_EXPORT
const
char
*
tmq_get_db_name
(
TAOS_RES
*
res
);
DLL_EXPORT
int32_t
tmq_get_vgroup_id
(
TAOS_RES
*
res
);
DLL_EXPORT
int64_t
tmq_get_vgroup_offset
(
TAOS_RES
*
res
);
/* ------------------------------ TAOSX -----------------------------------*/
/* ------------------------------ TAOSX -----------------------------------*/
// note: following apis are unstable
// note: following apis are unstable
enum
tmq_res_t
{
enum
tmq_res_t
{
...
...
include/libs/executor/storageapi.h
浏览文件 @
bbdcbcb7
...
@@ -228,7 +228,7 @@ typedef struct SStoreTqReader {
...
@@ -228,7 +228,7 @@ typedef struct SStoreTqReader {
}
SStoreTqReader
;
}
SStoreTqReader
;
typedef
struct
SStoreSnapshotFn
{
typedef
struct
SStoreSnapshotFn
{
int32_t
(
*
createSnaps
hot
)(
SSnapContext
*
ctx
,
int64_t
uid
);
int32_t
(
*
setForSnapS
hot
)(
SSnapContext
*
ctx
,
int64_t
uid
);
int32_t
(
*
destroySnapshot
)(
SSnapContext
*
ctx
);
int32_t
(
*
destroySnapshot
)(
SSnapContext
*
ctx
);
SMetaTableInfo
(
*
getMetaTableInfoFromSnapshot
)(
SSnapContext
*
ctx
);
SMetaTableInfo
(
*
getMetaTableInfoFromSnapshot
)(
SSnapContext
*
ctx
);
int32_t
(
*
getTableInfoFromSnapshot
)(
SSnapContext
*
ctx
,
void
**
pBuf
,
int32_t
*
contLen
,
int16_t
*
type
,
int64_t
*
uid
);
int32_t
(
*
getTableInfoFromSnapshot
)(
SSnapContext
*
ctx
,
void
**
pBuf
,
int32_t
*
contLen
,
int16_t
*
type
,
int64_t
*
uid
);
...
...
source/client/src/clientTmq.c
浏览文件 @
bbdcbcb7
...
@@ -1901,7 +1901,7 @@ static void updateVgInfo(SMqClientVg* pVg, STqOffsetVal* reqOffset, STqOffsetVal
...
@@ -1901,7 +1901,7 @@ static void updateVgInfo(SMqClientVg* pVg, STqOffsetVal* reqOffset, STqOffsetVal
// update the valid wal version range
// update the valid wal version range
pVg
->
offsetInfo
.
walVerBegin
=
sver
;
pVg
->
offsetInfo
.
walVerBegin
=
sver
;
pVg
->
offsetInfo
.
walVerEnd
=
ever
;
pVg
->
offsetInfo
.
walVerEnd
=
ever
+
1
;
// pVg->receivedInfoFromVnode = true;
// pVg->receivedInfoFromVnode = true;
}
}
...
@@ -2541,7 +2541,7 @@ static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) {
...
@@ -2541,7 +2541,7 @@ static int32_t tmqGetWalInfoCb(void* param, SDataBuf* pMsg, int32_t code) {
SMqRspHead
*
pHead
=
pMsg
->
pData
;
SMqRspHead
*
pHead
=
pMsg
->
pData
;
tmq_topic_assignment
assignment
=
{.
begin
=
pHead
->
walsver
,
tmq_topic_assignment
assignment
=
{.
begin
=
pHead
->
walsver
,
.
end
=
pHead
->
walever
,
.
end
=
pHead
->
walever
+
1
,
.
currentOffset
=
rsp
.
rspOffset
.
version
,
.
currentOffset
=
rsp
.
rspOffset
.
version
,
.
vgId
=
pParam
->
vgId
};
.
vgId
=
pParam
->
vgId
};
...
@@ -2600,7 +2600,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
...
@@ -2600,7 +2600,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
*
numOfAssignment
=
taosArrayGetSize
(
pTopic
->
vgs
);
*
numOfAssignment
=
taosArrayGetSize
(
pTopic
->
vgs
);
for
(
int32_t
j
=
0
;
j
<
(
*
numOfAssignment
);
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
(
*
numOfAssignment
);
++
j
)
{
SMqClientVg
*
pClientVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
SMqClientVg
*
pClientVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
int32_t
type
=
pClientVg
->
offsetInfo
.
current
Offset
.
type
;
int32_t
type
=
pClientVg
->
offsetInfo
.
seek
Offset
.
type
;
if
(
isInSnapshotMode
(
type
,
tmq
->
useSnapshot
))
{
if
(
isInSnapshotMode
(
type
,
tmq
->
useSnapshot
))
{
tscError
(
"consumer:0x%"
PRIx64
" offset type:%d not wal version, assignment not allowed"
,
tmq
->
consumerId
,
type
);
tscError
(
"consumer:0x%"
PRIx64
" offset type:%d not wal version, assignment not allowed"
,
tmq
->
consumerId
,
type
);
code
=
TSDB_CODE_TMQ_SNAPSHOT_ERROR
;
code
=
TSDB_CODE_TMQ_SNAPSHOT_ERROR
;
...
@@ -2620,7 +2620,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
...
@@ -2620,7 +2620,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
for
(
int32_t
j
=
0
;
j
<
(
*
numOfAssignment
);
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
(
*
numOfAssignment
);
++
j
)
{
SMqClientVg
*
pClientVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
SMqClientVg
*
pClientVg
=
taosArrayGet
(
pTopic
->
vgs
,
j
);
if
(
pClientVg
->
offsetInfo
.
current
Offset
.
type
!=
TMQ_OFFSET__LOG
)
{
if
(
pClientVg
->
offsetInfo
.
seek
Offset
.
type
!=
TMQ_OFFSET__LOG
)
{
needFetch
=
true
;
needFetch
=
true
;
break
;
break
;
}
}
...
@@ -2705,7 +2705,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
...
@@ -2705,7 +2705,7 @@ int32_t tmq_get_topic_assignment(tmq_t* tmq, const char* pTopicName, tmq_topic_a
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
char
offsetFormatBuf
[
TSDB_OFFSET_LEN
]
=
{
0
};
char
offsetFormatBuf
[
TSDB_OFFSET_LEN
]
=
{
0
};
tFormatOffset
(
offsetFormatBuf
,
tListLen
(
offsetFormatBuf
),
&
pClientVg
->
offsetInfo
.
current
Offset
);
tFormatOffset
(
offsetFormatBuf
,
tListLen
(
offsetFormatBuf
),
&
pClientVg
->
offsetInfo
.
seek
Offset
);
tscInfo
(
"consumer:0x%"
PRIx64
" %s retrieve wal info vgId:%d, epoch %d, req:%s, reqId:0x%"
PRIx64
,
tscInfo
(
"consumer:0x%"
PRIx64
" %s retrieve wal info vgId:%d, epoch %d, req:%s, reqId:0x%"
PRIx64
,
tmq
->
consumerId
,
pTopic
->
topicName
,
pClientVg
->
vgId
,
tmq
->
epoch
,
offsetFormatBuf
,
req
.
reqId
);
tmq
->
consumerId
,
pTopic
->
topicName
,
pClientVg
->
vgId
,
tmq
->
epoch
,
offsetFormatBuf
,
req
.
reqId
);
...
@@ -2825,7 +2825,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
...
@@ -2825,7 +2825,7 @@ int32_t tmq_offset_seek(tmq_t* tmq, const char* pTopicName, int32_t vgId, int64_
// update the offset, and then commit to vnode
// update the offset, and then commit to vnode
pOffsetInfo
->
currentOffset
.
type
=
TMQ_OFFSET__LOG
;
pOffsetInfo
->
currentOffset
.
type
=
TMQ_OFFSET__LOG
;
pOffsetInfo
->
currentOffset
.
version
=
offset
>=
1
?
offset
-
1
:
0
;
pOffsetInfo
->
currentOffset
.
version
=
offset
;
pOffsetInfo
->
seekOffset
=
pOffsetInfo
->
currentOffset
;
pOffsetInfo
->
seekOffset
=
pOffsetInfo
->
currentOffset
;
// pOffsetInfo->committedOffset.version = INT64_MIN;
// pOffsetInfo->committedOffset.version = INT64_MIN;
pVg
->
seekUpdated
=
true
;
pVg
->
seekUpdated
=
true
;
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
bbdcbcb7
...
@@ -196,7 +196,7 @@ int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
...
@@ -196,7 +196,7 @@ int32_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalCkHea
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
", (epoch %d) vgId:%d offset %"
PRId64
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
", (epoch %d) vgId:%d offset %"
PRId64
", no more log to return, reqId:0x%"
PRIx64
,
", no more log to return, reqId:0x%"
PRIx64
,
pHandle
->
consumerId
,
pHandle
->
epoch
,
vgId
,
offset
,
reqId
);
pHandle
->
consumerId
,
pHandle
->
epoch
,
vgId
,
offset
,
reqId
);
*
fetchOffset
=
offset
-
1
;
*
fetchOffset
=
offset
;
code
=
-
1
;
code
=
-
1
;
goto
END
;
goto
END
;
}
}
...
...
source/dnode/vnode/src/tq/tqUtil.c
浏览文件 @
bbdcbcb7
...
@@ -119,7 +119,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
...
@@ -119,7 +119,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
}
}
}
else
{
}
else
{
walRefFirstVer
(
pTq
->
pVnode
->
pWal
,
pHandle
->
pRef
);
walRefFirstVer
(
pTq
->
pVnode
->
pWal
,
pHandle
->
pRef
);
tqOffsetResetToLog
(
pOffsetVal
,
pHandle
->
pRef
->
refVer
-
1
);
tqOffsetResetToLog
(
pOffsetVal
,
pHandle
->
pRef
->
refVer
);
}
}
}
else
if
(
reqOffset
.
type
==
TMQ_OFFSET__RESET_LATEST
)
{
}
else
if
(
reqOffset
.
type
==
TMQ_OFFSET__RESET_LATEST
)
{
walRefLastVer
(
pTq
->
pVnode
->
pWal
,
pHandle
->
pRef
);
walRefLastVer
(
pTq
->
pVnode
->
pWal
,
pHandle
->
pRef
);
...
@@ -127,7 +127,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
...
@@ -127,7 +127,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
SMqDataRsp
dataRsp
=
{
0
};
SMqDataRsp
dataRsp
=
{
0
};
tqInitDataRsp
(
&
dataRsp
,
pRequest
);
tqInitDataRsp
(
&
dataRsp
,
pRequest
);
tqOffsetResetToLog
(
&
dataRsp
.
rspOffset
,
pHandle
->
pRef
->
refVer
);
tqOffsetResetToLog
(
&
dataRsp
.
rspOffset
,
pHandle
->
pRef
->
refVer
+
1
);
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
", subkey %s, vgId:%d, (latest) offset reset to %"
PRId64
,
consumerId
,
tqDebug
(
"tmq poll: consumer:0x%"
PRIx64
", subkey %s, vgId:%d, (latest) offset reset to %"
PRId64
,
consumerId
,
pHandle
->
subKey
,
vgId
,
dataRsp
.
rspOffset
.
version
);
pHandle
->
subKey
,
vgId
,
dataRsp
.
rspOffset
.
version
);
int32_t
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
&
dataRsp
,
TMQ_MSG_TYPE__POLL_RSP
,
vgId
);
int32_t
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
&
dataRsp
,
TMQ_MSG_TYPE__POLL_RSP
,
vgId
);
...
@@ -138,7 +138,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
...
@@ -138,7 +138,7 @@ static int32_t extractResetOffsetVal(STqOffsetVal* pOffsetVal, STQ* pTq, STqHand
}
else
{
}
else
{
STaosxRsp
taosxRsp
=
{
0
};
STaosxRsp
taosxRsp
=
{
0
};
tqInitTaosxRsp
(
&
taosxRsp
,
pRequest
);
tqInitTaosxRsp
(
&
taosxRsp
,
pRequest
);
tqOffsetResetToLog
(
&
taosxRsp
.
rspOffset
,
pHandle
->
pRef
->
refVer
);
tqOffsetResetToLog
(
&
taosxRsp
.
rspOffset
,
pHandle
->
pRef
->
refVer
+
1
);
int32_t
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
(
SMqDataRsp
*
)
&
taosxRsp
,
TMQ_MSG_TYPE__TAOSX_RSP
,
vgId
);
int32_t
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
(
SMqDataRsp
*
)
&
taosxRsp
,
TMQ_MSG_TYPE__TAOSX_RSP
,
vgId
);
tDeleteSTaosxRsp
(
&
taosxRsp
);
tDeleteSTaosxRsp
(
&
taosxRsp
);
...
@@ -246,7 +246,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
...
@@ -246,7 +246,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
if
(
offset
->
type
==
TMQ_OFFSET__LOG
)
{
if
(
offset
->
type
==
TMQ_OFFSET__LOG
)
{
walReaderVerifyOffset
(
pHandle
->
pWalReader
,
offset
);
walReaderVerifyOffset
(
pHandle
->
pWalReader
,
offset
);
int64_t
fetchVer
=
offset
->
version
+
1
;
int64_t
fetchVer
=
offset
->
version
;
pCkHead
=
taosMemoryMalloc
(
sizeof
(
SWalCkHead
)
+
2048
);
pCkHead
=
taosMemoryMalloc
(
sizeof
(
SWalCkHead
)
+
2048
);
if
(
pCkHead
==
NULL
)
{
if
(
pCkHead
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -279,14 +279,14 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
...
@@ -279,14 +279,14 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
// process meta
// process meta
if
(
pHead
->
msgType
!=
TDMT_VND_SUBMIT
)
{
if
(
pHead
->
msgType
!=
TDMT_VND_SUBMIT
)
{
if
(
totalRows
>
0
)
{
if
(
totalRows
>
0
)
{
tqOffsetResetToLog
(
&
taosxRsp
.
rspOffset
,
fetchVer
-
1
);
tqOffsetResetToLog
(
&
taosxRsp
.
rspOffset
,
fetchVer
);
setRequestVersion
(
&
taosxRsp
.
reqOffset
,
offset
->
version
);
setRequestVersion
(
&
taosxRsp
.
reqOffset
,
offset
->
version
);
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
(
SMqDataRsp
*
)
&
taosxRsp
,
TMQ_MSG_TYPE__TAOSX_RSP
,
vgId
);
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
(
SMqDataRsp
*
)
&
taosxRsp
,
TMQ_MSG_TYPE__TAOSX_RSP
,
vgId
);
goto
end
;
goto
end
;
}
}
tqDebug
(
"fetch meta msg, ver:%"
PRId64
", type:%s"
,
pHead
->
version
,
TMSG_INFO
(
pHead
->
msgType
));
tqDebug
(
"fetch meta msg, ver:%"
PRId64
", type:%s"
,
pHead
->
version
,
TMSG_INFO
(
pHead
->
msgType
));
tqOffsetResetToLog
(
&
metaRsp
.
rspOffset
,
fetchVer
);
tqOffsetResetToLog
(
&
metaRsp
.
rspOffset
,
fetchVer
+
1
);
metaRsp
.
resMsgType
=
pHead
->
msgType
;
metaRsp
.
resMsgType
=
pHead
->
msgType
;
metaRsp
.
metaRspLen
=
pHead
->
bodyLen
;
metaRsp
.
metaRspLen
=
pHead
->
bodyLen
;
metaRsp
.
metaRsp
=
pHead
->
body
;
metaRsp
.
metaRsp
=
pHead
->
body
;
...
@@ -309,7 +309,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
...
@@ -309,7 +309,7 @@ static int32_t extractDataAndRspForDbStbSubscribe(STQ* pTq, STqHandle* pHandle,
}
}
if
(
totalRows
>=
4096
||
taosxRsp
.
createTableNum
>
0
)
{
if
(
totalRows
>=
4096
||
taosxRsp
.
createTableNum
>
0
)
{
tqOffsetResetToLog
(
&
taosxRsp
.
rspOffset
,
fetchVer
);
tqOffsetResetToLog
(
&
taosxRsp
.
rspOffset
,
fetchVer
+
1
);
setRequestVersion
(
&
taosxRsp
.
reqOffset
,
offset
->
version
);
setRequestVersion
(
&
taosxRsp
.
reqOffset
,
offset
->
version
);
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
(
SMqDataRsp
*
)
&
taosxRsp
,
TMQ_MSG_TYPE__TAOSX_RSP
,
vgId
);
code
=
tqSendDataRsp
(
pHandle
,
pMsg
,
pRequest
,
(
SMqDataRsp
*
)
&
taosxRsp
,
TMQ_MSG_TYPE__TAOSX_RSP
,
vgId
);
goto
end
;
goto
end
;
...
...
source/dnode/vnode/src/vnd/vnodeInitApi.c
浏览文件 @
bbdcbcb7
...
@@ -237,7 +237,7 @@ void initCacheFn(SStoreCacheReader* pCache) {
...
@@ -237,7 +237,7 @@ void initCacheFn(SStoreCacheReader* pCache) {
}
}
void
initSnapshotFn
(
SStoreSnapshotFn
*
pSnapshot
)
{
void
initSnapshotFn
(
SStoreSnapshotFn
*
pSnapshot
)
{
pSnapshot
->
createSnaps
hot
=
setForSnapShot
;
pSnapshot
->
setForSnapS
hot
=
setForSnapShot
;
pSnapshot
->
destroySnapshot
=
destroySnapContext
;
pSnapshot
->
destroySnapshot
=
destroySnapContext
;
pSnapshot
->
getMetaTableInfoFromSnapshot
=
getMetaTableInfoFromSnapshot
;
pSnapshot
->
getMetaTableInfoFromSnapshot
=
getMetaTableInfoFromSnapshot
;
pSnapshot
->
getTableInfoFromSnapshot
=
getTableInfoFromSnapshot
;
pSnapshot
->
getTableInfoFromSnapshot
=
getTableInfoFromSnapshot
;
...
...
source/libs/executor/src/executor.c
浏览文件 @
bbdcbcb7
...
@@ -1112,8 +1112,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
...
@@ -1112,8 +1112,8 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
SStoreTqReader
*
pReaderAPI
=
&
pTaskInfo
->
storageAPI
.
tqReaderFn
;
SStoreTqReader
*
pReaderAPI
=
&
pTaskInfo
->
storageAPI
.
tqReaderFn
;
SWalReader
*
pWalReader
=
pReaderAPI
->
tqReaderGetWalReader
(
pInfo
->
tqReader
);
SWalReader
*
pWalReader
=
pReaderAPI
->
tqReaderGetWalReader
(
pInfo
->
tqReader
);
walReaderVerifyOffset
(
pWalReader
,
pOffset
);
walReaderVerifyOffset
(
pWalReader
,
pOffset
);
if
(
pReaderAPI
->
tqReaderSeek
(
pInfo
->
tqReader
,
pOffset
->
version
+
1
,
id
)
<
0
)
{
if
(
pReaderAPI
->
tqReaderSeek
(
pInfo
->
tqReader
,
pOffset
->
version
,
id
)
<
0
)
{
qError
(
"tqReaderSeek failed ver:%"
PRId64
", %s"
,
pOffset
->
version
+
1
,
id
);
qError
(
"tqReaderSeek failed ver:%"
PRId64
", %s"
,
pOffset
->
version
,
id
);
return
-
1
;
return
-
1
;
}
}
}
else
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
}
else
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
...
@@ -1202,7 +1202,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
...
@@ -1202,7 +1202,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
SOperatorInfo
*
p
=
extractOperatorInTree
(
pOperator
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
,
id
);
SOperatorInfo
*
p
=
extractOperatorInTree
(
pOperator
,
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
,
id
);
STableListInfo
*
pTableListInfo
=
((
SStreamRawScanInfo
*
)(
p
->
info
))
->
pTableListInfo
;
STableListInfo
*
pTableListInfo
=
((
SStreamRawScanInfo
*
)(
p
->
info
))
->
pTableListInfo
;
if
(
pAPI
->
snapshotFn
.
createSnaps
hot
(
sContext
,
pOffset
->
uid
)
!=
0
)
{
if
(
pAPI
->
snapshotFn
.
setForSnapS
hot
(
sContext
,
pOffset
->
uid
)
!=
0
)
{
qError
(
"setDataForSnapShot error. uid:%"
PRId64
" , %s"
,
pOffset
->
uid
,
id
);
qError
(
"setDataForSnapShot error. uid:%"
PRId64
" , %s"
,
pOffset
->
uid
,
id
);
terrno
=
TSDB_CODE_PAR_INTERNAL_ERROR
;
terrno
=
TSDB_CODE_PAR_INTERNAL_ERROR
;
return
-
1
;
return
-
1
;
...
@@ -1239,7 +1239,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
...
@@ -1239,7 +1239,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
}
else
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_META
)
{
}
else
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_META
)
{
SStreamRawScanInfo
*
pInfo
=
pOperator
->
info
;
SStreamRawScanInfo
*
pInfo
=
pOperator
->
info
;
SSnapContext
*
sContext
=
pInfo
->
sContext
;
SSnapContext
*
sContext
=
pInfo
->
sContext
;
if
(
pTaskInfo
->
storageAPI
.
snapshotFn
.
createSnaps
hot
(
sContext
,
pOffset
->
uid
)
!=
0
)
{
if
(
pTaskInfo
->
storageAPI
.
snapshotFn
.
setForSnapS
hot
(
sContext
,
pOffset
->
uid
)
!=
0
)
{
qError
(
"setForSnapShot error. uid:%"
PRIu64
" ,version:%"
PRId64
,
pOffset
->
uid
,
pOffset
->
version
);
qError
(
"setForSnapShot error. uid:%"
PRIu64
" ,version:%"
PRId64
,
pOffset
->
uid
,
pOffset
->
version
);
terrno
=
TSDB_CODE_PAR_INTERNAL_ERROR
;
terrno
=
TSDB_CODE_PAR_INTERNAL_ERROR
;
return
-
1
;
return
-
1
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
bbdcbcb7
...
@@ -1644,12 +1644,13 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
...
@@ -1644,12 +1644,13 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
pAPI
->
tsdReader
.
tsdReaderClose
(
pTSInfo
->
base
.
dataReader
);
pAPI
->
tsdReader
.
tsdReaderClose
(
pTSInfo
->
base
.
dataReader
);
pTSInfo
->
base
.
dataReader
=
NULL
;
pTSInfo
->
base
.
dataReader
=
NULL
;
qDebug
(
"queue scan tsdb over, switch to wal ver %"
PRId64
""
,
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
);
int64_t
validVer
=
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
;
if
(
pAPI
->
tqReaderFn
.
tqReaderSeek
(
pInfo
->
tqReader
,
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
,
pTaskInfo
->
id
.
str
)
<
0
)
{
qDebug
(
"queue scan tsdb over, switch to wal ver %"
PRId64
""
,
validVer
);
if
(
pAPI
->
tqReaderFn
.
tqReaderSeek
(
pInfo
->
tqReader
,
validVer
,
pTaskInfo
->
id
.
str
)
<
0
)
{
return
NULL
;
return
NULL
;
}
}
tqOffsetResetToLog
(
&
pTaskInfo
->
streamInfo
.
currentOffset
,
pTaskInfo
->
streamInfo
.
snapshot
Ver
);
tqOffsetResetToLog
(
&
pTaskInfo
->
streamInfo
.
currentOffset
,
valid
Ver
);
}
}
if
(
pTaskInfo
->
streamInfo
.
currentOffset
.
type
==
TMQ_OFFSET__LOG
)
{
if
(
pTaskInfo
->
streamInfo
.
currentOffset
.
type
==
TMQ_OFFSET__LOG
)
{
...
@@ -1660,8 +1661,8 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
...
@@ -1660,8 +1661,8 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
SSDataBlock
*
pRes
=
pAPI
->
tqReaderFn
.
tqGetResultBlock
(
pInfo
->
tqReader
);
SSDataBlock
*
pRes
=
pAPI
->
tqReaderFn
.
tqGetResultBlock
(
pInfo
->
tqReader
);
struct
SWalReader
*
pWalReader
=
pAPI
->
tqReaderFn
.
tqReaderGetWalReader
(
pInfo
->
tqReader
);
struct
SWalReader
*
pWalReader
=
pAPI
->
tqReaderFn
.
tqReaderGetWalReader
(
pInfo
->
tqReader
);
// curVersion move to next
, so currentOffset = curVersion - 1
// curVersion move to next
tqOffsetResetToLog
(
&
pTaskInfo
->
streamInfo
.
currentOffset
,
pWalReader
->
curVersion
-
1
);
tqOffsetResetToLog
(
&
pTaskInfo
->
streamInfo
.
currentOffset
,
pWalReader
->
curVersion
);
if
(
hasResult
)
{
if
(
hasResult
)
{
qDebug
(
"doQueueScan get data from log %"
PRId64
" rows, version:%"
PRId64
,
pRes
->
info
.
rows
,
qDebug
(
"doQueueScan get data from log %"
PRId64
" rows, version:%"
PRId64
,
pRes
->
info
.
rows
,
...
@@ -2182,7 +2183,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
...
@@ -2182,7 +2183,7 @@ static SSDataBlock* doRawScan(SOperatorInfo* pOperator) {
STqOffsetVal
offset
=
{
0
};
STqOffsetVal
offset
=
{
0
};
if
(
mtInfo
.
uid
==
0
)
{
// read snapshot done, change to get data from wal
if
(
mtInfo
.
uid
==
0
)
{
// read snapshot done, change to get data from wal
qDebug
(
"tmqsnap read snapshot done, change to get data from wal"
);
qDebug
(
"tmqsnap read snapshot done, change to get data from wal"
);
tqOffsetResetToLog
(
&
offset
,
pInfo
->
sContext
->
snapVersion
);
tqOffsetResetToLog
(
&
offset
,
pInfo
->
sContext
->
snapVersion
+
1
);
}
else
{
}
else
{
tqOffsetResetToData
(
&
offset
,
mtInfo
.
uid
,
INT64_MIN
);
tqOffsetResetToData
(
&
offset
,
mtInfo
.
uid
,
INT64_MIN
);
qDebug
(
"tmqsnap change get data uid:%"
PRId64
""
,
mtInfo
.
uid
);
qDebug
(
"tmqsnap change get data uid:%"
PRId64
""
,
mtInfo
.
uid
);
...
...
source/libs/wal/src/walRead.c
浏览文件 @
bbdcbcb7
...
@@ -135,8 +135,8 @@ void walReaderVerifyOffset(SWalReader *pWalReader, STqOffsetVal* pOffset){
...
@@ -135,8 +135,8 @@ void walReaderVerifyOffset(SWalReader *pWalReader, STqOffsetVal* pOffset){
int64_t
firstVer
=
walGetFirstVer
((
pWalReader
)
->
pWal
);
int64_t
firstVer
=
walGetFirstVer
((
pWalReader
)
->
pWal
);
taosThreadMutexUnlock
(
&
pWalReader
->
pWal
->
mutex
);
taosThreadMutexUnlock
(
&
pWalReader
->
pWal
->
mutex
);
if
(
pOffset
->
version
+
1
<
firstVer
){
if
(
pOffset
->
version
<
firstVer
){
pOffset
->
version
=
firstVer
-
1
;
pOffset
->
version
=
firstVer
;
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录