提交 cc67b631 编写于 作者: H Haojun Liao

refactor: do some internal refactor.

上级 9f168024
......@@ -29,18 +29,21 @@ int tqStreamTasksScanWal(STQ* pTq) {
while (1) {
int32_t scan = pMeta->walScan;
tqDebug("vgId:%d continue check if data in wal are available, scan:%d", vgId, scan);
ASSERT(scan >= 1);
// check all restore tasks
bool allFull = true;
streamTaskReplayWal(pTq->pStreamMeta, pTq->pOffsetStore, &allFull);
bool shouldIdle = true;
streamTaskReplayWal(pTq->pStreamMeta, pTq->pOffsetStore, &shouldIdle);
int32_t times = 0;
if (allFull) {
if (shouldIdle) {
taosWLockLatch(&pMeta->lock);
pMeta->walScan -= 1;
times = pMeta->walScan;
ASSERT(pMeta->walScan >= 0);
if (pMeta->walScan <= 0) {
taosWUnLockLatch(&pMeta->lock);
break;
......@@ -49,6 +52,7 @@ int tqStreamTasksScanWal(STQ* pTq) {
taosWUnLockLatch(&pMeta->lock);
tqDebug("vgId:%d scan wal for stream tasks for %d times", vgId, times);
} else {
tqDebug("vgId:%d no idle, scan wal for stream tasks for %d times", vgId, pMeta->walScan);
ASSERT(pMeta->walScan >= 1);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册