Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b28c0ad9
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看板
提交
b28c0ad9
编写于
2月 21, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:remove useless logic in tmq
上级
6052018e
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
26 addition
and
48 deletion
+26
-48
examples/c/tmq.c
examples/c/tmq.c
+1
-1
include/libs/wal/wal.h
include/libs/wal/wal.h
+1
-1
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+7
-8
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+0
-9
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+0
-1
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+2
-11
source/libs/wal/src/walRef.c
source/libs/wal/src/walRef.c
+15
-17
未找到文件。
examples/c/tmq.c
浏览文件 @
b28c0ad9
...
...
@@ -61,7 +61,7 @@ static int32_t init_env() {
printf
(
"create database
\n
"
);
pRes
=
taos_query
(
pConn
,
"drop topic topicname"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"error in drop t
mqdb
, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"error in drop t
opicname
, reason:%s
\n
"
,
taos_errstr
(
pRes
));
}
taos_free_result
(
pRes
);
...
...
include/libs/wal/wal.h
浏览文件 @
b28c0ad9
...
...
@@ -126,7 +126,7 @@ typedef struct SWal {
typedef
struct
{
int64_t
refId
;
int64_t
refVer
;
int64_t
refFile
;
//
int64_t refFile;
SWal
*
pWal
;
}
SWalRef
;
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
b28c0ad9
...
...
@@ -297,11 +297,8 @@ void tqCloseReader(STqReader* pReader) {
int32_t
tqSeekVer
(
STqReader
*
pReader
,
int64_t
ver
)
{
if
(
walReadSeekVer
(
pReader
->
pWalReader
,
ver
)
<
0
)
{
ASSERT
(
pReader
->
pWalReader
->
curInvalid
);
ASSERT
(
pReader
->
pWalReader
->
curVersion
==
ver
);
return
-
1
;
}
ASSERT
(
pReader
->
pWalReader
->
curVersion
==
ver
);
return
0
;
}
...
...
@@ -362,11 +359,13 @@ int32_t tqNextBlock(STqReader* pReader, SFetchRet* ret) {
int32_t
tqReaderSetDataMsg
(
STqReader
*
pReader
,
const
SSubmitReq
*
pMsg
,
int64_t
ver
)
{
pReader
->
pMsg
=
pMsg
;
if
(
tInitSubmitMsgIter
(
pMsg
,
&
pReader
->
msgIter
)
<
0
)
return
-
1
;
while
(
true
)
{
if
(
tGetSubmitMsgNext
(
&
pReader
->
msgIter
,
&
pReader
->
pBlock
)
<
0
)
return
-
1
;
if
(
pReader
->
pBlock
==
NULL
)
break
;
}
// if (tInitSubmitMsgIter(pMsg, &pReader->msgIter) < 0) return -1;
// while (true) {
// if (tGetSubmitMsgNext(&pReader->msgIter, &pReader->pBlock) < 0) return -1;
// tqDebug("submitnext vgId:%d, block:%p, dataLen:%d, len:%d, uid:%"PRId64, pReader->pWalReader->pWal->cfg.vgId, pReader->pBlock, pReader->msgIter.dataLen,
// pReader->msgIter.len, pReader->msgIter.uid);
// if (pReader->pBlock == NULL) break;
// }
if
(
tInitSubmitMsgIter
(
pMsg
,
&
pReader
->
msgIter
)
<
0
)
return
-
1
;
pReader
->
ver
=
ver
;
...
...
source/libs/executor/src/executor.c
浏览文件 @
b28c0ad9
...
...
@@ -1049,18 +1049,9 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT
STableScanInfo
*
pTSInfo
=
pInfo
->
pTableScanOp
->
info
;
tsdbReaderClose
(
pTSInfo
->
base
.
dataReader
);
pTSInfo
->
base
.
dataReader
=
NULL
;
#if 0
if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) &&
pInfo->tqReader->pWalReader->curVersion != pOffset->version) {
qError("prepare scan ver %" PRId64 " actual ver %" PRId64 ", last %" PRId64, pOffset->version,
pInfo->tqReader->pWalReader->curVersion, pTaskInfo->streamInfo.lastStatus.version);
ASSERT(0);
}
#endif
if
(
tqSeekVer
(
pInfo
->
tqReader
,
pOffset
->
version
+
1
)
<
0
)
{
return
-
1
;
}
ASSERT
(
pInfo
->
tqReader
->
pWalReader
->
curVersion
==
pOffset
->
version
+
1
);
}
else
if
(
pOffset
->
type
==
TMQ_OFFSET__SNAPSHOT_DATA
)
{
/*pInfo->blockType = STREAM_INPUT__TABLE_SCAN;*/
int64_t
uid
=
pOffset
->
uid
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
b28c0ad9
...
...
@@ -1618,7 +1618,6 @@ static SSDataBlock* doQueueScan(SOperatorInfo* pOperator) {
tqOffsetResetToLog
(
&
pTaskInfo
->
streamInfo
.
lastStatus
,
pTaskInfo
->
streamInfo
.
snapshotVer
);
return
NULL
;
}
ASSERT
(
pInfo
->
tqReader
->
pWalReader
->
curVersion
==
pTaskInfo
->
streamInfo
.
snapshotVer
+
1
);
}
else
{
return
NULL
;
}
...
...
source/libs/wal/src/walRead.c
浏览文件 @
b28c0ad9
...
...
@@ -96,8 +96,7 @@ int32_t walNextValidMsg(SWalReader *pReader) {
if
(
walSkipFetchBodyNew
(
pReader
)
<
0
)
{
return
-
1
;
}
fetchVer
++
;
ASSERT
(
fetchVer
==
pReader
->
curVersion
);
fetchVer
=
pReader
->
curVersion
;
}
}
pReader
->
curStopped
=
1
;
...
...
@@ -144,7 +143,7 @@ static int64_t walReadSeekFilePos(SWalReader *pReader, int64_t fileFirstVer, int
}
static
int32_t
walReadChangeFile
(
SWalReader
*
pReader
,
int64_t
fileFirstVer
)
{
char
fnameStr
[
WAL_FILE_LEN
];
char
fnameStr
[
WAL_FILE_LEN
]
=
{
0
}
;
taosCloseFile
(
&
pReader
->
pIdxFile
);
taosCloseFile
(
&
pReader
->
pLogFile
);
...
...
@@ -300,14 +299,6 @@ static int32_t walFetchBodyNew(SWalReader *pRead) {
return
-
1
;
}
if
(
pReadHead
->
version
!=
ver
)
{
wError
(
"vgId:%d, wal fetch body error:%"
PRId64
", read request index:%"
PRId64
,
pRead
->
pWal
->
cfg
.
vgId
,
pRead
->
pHead
->
head
.
version
,
ver
);
pRead
->
curInvalid
=
1
;
terrno
=
TSDB_CODE_WAL_FILE_CORRUPTED
;
return
-
1
;
}
if
(
walValidBodyCksum
(
pRead
->
pHead
)
!=
0
)
{
wError
(
"vgId:%d, wal fetch body error:%"
PRId64
", since body checksum not passed"
,
pRead
->
pWal
->
cfg
.
vgId
,
ver
);
pRead
->
curInvalid
=
1
;
...
...
source/libs/wal/src/walRef.c
浏览文件 @
b28c0ad9
...
...
@@ -26,7 +26,7 @@ SWalRef *walOpenRef(SWal *pWal) {
}
pRef
->
refId
=
tGenIdPI64
();
pRef
->
refVer
=
-
1
;
pRef
->
refFile
=
-
1
;
//
pRef->refFile = -1;
pRef
->
pWal
=
pWal
;
taosHashPut
(
pWal
->
pRefHash
,
&
pRef
->
refId
,
sizeof
(
int64_t
),
&
pRef
,
sizeof
(
void
*
));
return
pRef
;
...
...
@@ -58,11 +58,11 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) {
pRef
->
refVer
=
ver
;
// bsearch in fileSet
SWalFileInfo
tmpInfo
;
tmpInfo
.
firstVer
=
ver
;
SWalFileInfo
*
pRet
=
taosArraySearch
(
pWal
->
fileInfoSet
,
&
tmpInfo
,
compareWalFileInfo
,
TD_LE
);
ASSERT
(
pRet
!=
NULL
);
pRef
->
refFile
=
pRet
->
firstVer
;
//
SWalFileInfo tmpInfo;
//
tmpInfo.firstVer = ver;
//
SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE);
//
ASSERT(pRet != NULL);
//
pRef->refFile = pRet->firstVer;
taosThreadMutexUnlock
(
&
pWal
->
mutex
);
}
...
...
@@ -73,7 +73,7 @@ int32_t walRefVer(SWalRef *pRef, int64_t ver) {
#if 1
void
walUnrefVer
(
SWalRef
*
pRef
)
{
pRef
->
refId
=
-
1
;
pRef
->
refFile
=
-
1
;
//
pRef->refFile = -1;
}
#endif
...
...
@@ -85,20 +85,18 @@ SWalRef *walRefFirstVer(SWal *pWal, SWalRef *pRef) {
}
}
taosThreadMutexLock
(
&
pWal
->
mutex
);
int64_t
ver
=
walGetFirstVer
(
pWal
);
wDebug
(
"vgId:%d, wal ref version %"
PRId64
" for first"
,
pWal
->
cfg
.
vgId
,
ver
);
pRef
->
refVer
=
ver
;
// bsearch in fileSet
SWalFileInfo
tmpInfo
;
tmpInfo
.
firstVer
=
ver
;
SWalFileInfo
*
pRet
=
taosArraySearch
(
pWal
->
fileInfoSet
,
&
tmpInfo
,
compareWalFileInfo
,
TD_LE
);
ASSERT
(
pRet
!=
NULL
);
pRef
->
refFile
=
pRet
->
firstVer
;
//
SWalFileInfo tmpInfo;
//
tmpInfo.firstVer = ver;
//
SWalFileInfo *pRet = taosArraySearch(pWal->fileInfoSet, &tmpInfo, compareWalFileInfo, TD_LE);
//
ASSERT(pRet != NULL);
//
pRef->refFile = pRet->firstVer;
taosThreadMutexUnlock
(
&
pWal
->
mutex
);
wDebug
(
"vgId:%d, wal ref version %"
PRId64
" for first"
,
pWal
->
cfg
.
vgId
,
ver
);
return
pRef
;
}
...
...
@@ -119,7 +117,7 @@ SWalRef *walRefCommittedVer(SWal *pWal) {
tmpInfo
.
firstVer
=
ver
;
SWalFileInfo
*
pRet
=
taosArraySearch
(
pWal
->
fileInfoSet
,
&
tmpInfo
,
compareWalFileInfo
,
TD_LE
);
ASSERT
(
pRet
!=
NULL
);
pRef
->
refFile
=
pRet
->
firstVer
;
//
pRef->refFile = pRet->firstVer;
taosThreadMutexUnlock
(
&
pWal
->
mutex
);
return
pRef
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录