• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #3562

20 Dec 2024 09:57AM UTC coverage: 26.655% (-32.2%) from 58.812%
#3562

push

travis-ci

web-flow
Merge pull request #29229 from taosdata/enh/TS-5749-3.0

enh: seperate tsdb async tasks to different thread pools

21498 of 109421 branches covered (19.65%)

Branch coverage included in aggregate %.

66 of 96 new or added lines in 7 files covered. (68.75%)

39441 existing lines in 157 files now uncovered.

35007 of 102566 relevant lines covered (34.13%)

53922.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.88
/source/dnode/vnode/src/tq/tqStreamTask.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
#include "tq.h"
17
#include "vnd.h"
18

19
#define MAX_REPEAT_SCAN_THRESHOLD 3
20
#define SCAN_WAL_IDLE_DURATION    500    // idle for 500ms to do next wal scan
21

22
typedef struct SBuildScanWalMsgParam {
23
  int64_t metaId;
24
  int32_t numOfTasks;
25
} SBuildScanWalMsgParam;
26

27
static int32_t doScanWalForAllTasks(SStreamMeta* pStreamMeta);
28
static int32_t setWalReaderStartOffset(SStreamTask* pTask, int32_t vgId);
29
static bool    handleFillhistoryScanComplete(SStreamTask* pTask, int64_t ver);
30
static bool    taskReadyForDataFromWal(SStreamTask* pTask);
31
static int32_t doPutDataIntoInputQ(SStreamTask* pTask, int64_t maxVer, int32_t* numOfItems, bool* pSucc);
32
static int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDuration);
33
static int32_t doScanWalAsync(STQ* pTq, bool ckPause);
34

35
// extract data blocks(submit/delete) from WAL, and add them into the input queue for all the sources tasks.
UNCOV
36
int32_t tqScanWal(STQ* pTq) {
×
UNCOV
37
  SStreamMeta* pMeta = pTq->pStreamMeta;
×
UNCOV
38
  int32_t      vgId = pMeta->vgId;
×
UNCOV
39
  int64_t      st = taosGetTimestampMs();
×
UNCOV
40
  int32_t      numOfTasks = 0;
×
41

UNCOV
42
  tqDebug("vgId:%d continue to check if data in wal are available, scanCounter:%d", vgId, pMeta->scanInfo.scanCounter);
×
43

44
  // check all tasks
UNCOV
45
  int32_t code = doScanWalForAllTasks(pMeta);
×
UNCOV
46
  if (code) {
×
47
    tqError("vgId:%d failed to start all tasks, try next time, code:%s", vgId, tstrerror(code));
×
48
    return code;
×
49
  }
50

UNCOV
51
  streamMetaWLock(pMeta);
×
UNCOV
52
  int32_t times = (--pMeta->scanInfo.scanCounter);
×
UNCOV
53
  if (times < 0) {
×
54
    tqError("vgId:%d invalid scan counter:%d, reset to 0", vgId, times);
×
55
    times = 0;
×
56
  }
57

UNCOV
58
  numOfTasks = taosArrayGetSize(pMeta->pTaskList);
×
UNCOV
59
  streamMetaWUnLock(pMeta);
×
60

UNCOV
61
  int64_t el = (taosGetTimestampMs() - st);
×
UNCOV
62
  tqDebug("vgId:%d scan wal for stream tasks completed, elapsed time:%" PRId64 " ms", vgId, el);
×
63

UNCOV
64
  if (times > 0) {
×
UNCOV
65
    tqDebug("vgId:%d scan wal for stream tasks for %d times in %dms", vgId, times, SCAN_WAL_IDLE_DURATION);
×
UNCOV
66
    code = tqScanWalInFuture(pTq, numOfTasks, SCAN_WAL_IDLE_DURATION);
×
UNCOV
67
    if (code) {
×
68
      tqError("vgId:%d sched scan wal in %dms failed, ignore this failure", vgId, SCAN_WAL_IDLE_DURATION);
×
69
    }
70
  }
71

UNCOV
72
  return code;
×
73
}
74

UNCOV
75
static void doStartScanWal(void* param, void* tmrId) {
×
UNCOV
76
  int32_t vgId = 0;
×
UNCOV
77
  STQ*    pTq = NULL;
×
UNCOV
78
  int32_t code = 0;
×
79

UNCOV
80
  SBuildScanWalMsgParam* pParam = (SBuildScanWalMsgParam*)param;
×
81

UNCOV
82
  SStreamMeta* pMeta = taosAcquireRef(streamMetaRefPool, pParam->metaId);
×
UNCOV
83
  if (pMeta == NULL) {
×
UNCOV
84
    tqError("metaRid:%" PRId64 " not valid now, stream meta has been freed", pParam->metaId);
×
UNCOV
85
    taosMemoryFree(pParam);
×
UNCOV
86
    return;
×
87
  }
88

UNCOV
89
  vgId = pMeta->vgId;
×
UNCOV
90
  pTq = pMeta->ahandle;
×
91

UNCOV
92
  tqDebug("vgId:%d create msg to start wal scan, numOfTasks:%d, vnd restored:%d", vgId, pParam->numOfTasks,
×
93
          pTq->pVnode->restored);
94

UNCOV
95
  code = streamTaskSchedTask(&pTq->pVnode->msgCb, vgId, 0, 0, STREAM_EXEC_T_EXTRACT_WAL_DATA);
×
UNCOV
96
  if (code) {
×
UNCOV
97
    tqError("vgId:%d failed sched task to scan wal, code:%s", vgId, tstrerror(code));
×
98
  }
99

UNCOV
100
  code = taosReleaseRef(streamMetaRefPool, pParam->metaId);
×
UNCOV
101
  if (code) {
×
102
    tqError("vgId:%d failed to release ref for streamMeta, rid:%" PRId64 " code:%s", vgId, pParam->metaId,
×
103
            tstrerror(code));
104
  }
105

UNCOV
106
  taosMemoryFree(pParam);
×
107
}
108

UNCOV
109
int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDuration) {
×
UNCOV
110
  SStreamMeta*           pMeta = pTq->pStreamMeta;
×
UNCOV
111
  int32_t                code = 0;
×
UNCOV
112
  int32_t                vgId = TD_VID(pTq->pVnode);
×
UNCOV
113
  tmr_h                  pTimer = NULL;
×
UNCOV
114
  SBuildScanWalMsgParam* pParam = NULL;
×
115

UNCOV
116
  pParam = taosMemoryMalloc(sizeof(SBuildScanWalMsgParam));
×
UNCOV
117
  if (pParam == NULL) {
×
118
    return terrno;
×
119
  }
120

UNCOV
121
  pParam->metaId = pMeta->rid;
×
UNCOV
122
  pParam->numOfTasks = numOfTasks;
×
123

UNCOV
124
  code = streamTimerGetInstance(&pTimer);
×
UNCOV
125
  if (code) {
×
126
    tqError("vgId:%d failed to get tmr ctrl during sched scan wal", vgId);
×
127
    taosMemoryFree(pParam);
×
128
  } else {
UNCOV
129
    streamTmrStart(doStartScanWal, idleDuration, pParam, pTimer, &pMeta->scanInfo.scanTimer, vgId, "scan-wal-fut");
×
130
  }
131

UNCOV
132
  return code;
×
133
}
134

UNCOV
135
int32_t tqScanWalAsync(STQ* pTq, bool ckPause) {
×
UNCOV
136
  SStreamMeta* pMeta = pTq->pStreamMeta;
×
UNCOV
137
  bool         alreadyRestored = pTq->pVnode->restored;
×
UNCOV
138
  int32_t      code = 0;
×
139

140
  // do not launch the stream tasks, if it is a follower or not restored vnode.
UNCOV
141
  if (!(vnodeIsRoleLeader(pTq->pVnode) && alreadyRestored)) {
×
UNCOV
142
    return TSDB_CODE_SUCCESS;
×
143
  }
144

UNCOV
145
  streamMetaWLock(pMeta);
×
UNCOV
146
  code = doScanWalAsync(pTq, ckPause);
×
UNCOV
147
  streamMetaWUnLock(pMeta);
×
UNCOV
148
  return code;
×
149
}
150

151
int32_t tqStopStreamTasksAsync(STQ* pTq) {
824✔
152
  SStreamMeta* pMeta = pTq->pStreamMeta;
824✔
153
  int32_t      vgId = pMeta->vgId;
824✔
154
  return streamTaskSchedTask(&pTq->pVnode->msgCb, vgId, 0, 0, STREAM_EXEC_T_STOP_ALL_TASKS);
824✔
155
}
156

UNCOV
157
int32_t setWalReaderStartOffset(SStreamTask* pTask, int32_t vgId) {
×
158
  // seek the stored version and extract data from WAL
UNCOV
159
  int64_t firstVer = walReaderGetValidFirstVer(pTask->exec.pWalReader);
×
UNCOV
160
  if (pTask->chkInfo.nextProcessVer < firstVer) {
×
UNCOV
161
    tqWarn("vgId:%d s-task:%s ver:%" PRId64 " earlier than the first ver of wal range %" PRId64 ", forward to %" PRId64,
×
162
           vgId, pTask->id.idStr, pTask->chkInfo.nextProcessVer, firstVer, firstVer);
163

UNCOV
164
    pTask->chkInfo.nextProcessVer = firstVer;
×
165

166
    // todo need retry if failed
UNCOV
167
    int32_t code = walReaderSeekVer(pTask->exec.pWalReader, pTask->chkInfo.nextProcessVer);
×
UNCOV
168
    if (code != TSDB_CODE_SUCCESS) {
×
169
      return code;
×
170
    }
171

172
    // append the data for the stream
UNCOV
173
    tqDebug("vgId:%d s-task:%s wal reader seek to ver:%" PRId64, vgId, pTask->id.idStr, pTask->chkInfo.nextProcessVer);
×
174
  } else {
UNCOV
175
    int64_t currentVer = walReaderGetCurrentVer(pTask->exec.pWalReader);
×
UNCOV
176
    if (currentVer == -1) {  // we only seek the read for the first time
×
UNCOV
177
      int32_t code = walReaderSeekVer(pTask->exec.pWalReader, pTask->chkInfo.nextProcessVer);
×
UNCOV
178
      if (code != TSDB_CODE_SUCCESS) {  // no data in wal, quit
×
179
        return code;
×
180
      }
181

182
      // append the data for the stream
UNCOV
183
      tqDebug("vgId:%d s-task:%s wal reader initial seek to ver:%" PRId64, vgId, pTask->id.idStr,
×
184
              pTask->chkInfo.nextProcessVer);
185
    }
186
  }
187

UNCOV
188
  int64_t skipToVer = walReaderGetSkipToVersion(pTask->exec.pWalReader);
×
UNCOV
189
  if (skipToVer != 0 && skipToVer > pTask->chkInfo.nextProcessVer) {
×
UNCOV
190
    int32_t code = walReaderSeekVer(pTask->exec.pWalReader, skipToVer);
×
UNCOV
191
    if (code != TSDB_CODE_SUCCESS) {  // no data in wal, quit
×
192
      return code;
×
193
    }
194

UNCOV
195
    tqDebug("vgId:%d s-task:%s wal reader jump to ver:%" PRId64, vgId, pTask->id.idStr, skipToVer);
×
196
  }
197

UNCOV
198
  return TSDB_CODE_SUCCESS;
×
199
}
200

201
// todo handle memory error
UNCOV
202
bool handleFillhistoryScanComplete(SStreamTask* pTask, int64_t ver) {
×
UNCOV
203
  const char* id = pTask->id.idStr;
×
UNCOV
204
  int64_t     maxVer = pTask->step2Range.maxVer;
×
205

UNCOV
206
  if ((pTask->info.fillHistory == 1) && ver > maxVer) {
×
UNCOV
207
    if (!pTask->status.appendTranstateBlock) {
×
UNCOV
208
      qWarn("s-task:%s fill-history scan WAL, nextProcessVer:%" PRId64 " out of the maximum ver:%" PRId64
×
209
            ", not scan wal anymore, add transfer-state block into inputQ",
210
            id, ver, maxVer);
211

UNCOV
212
      double el = (taosGetTimestampMs() - pTask->execInfo.step2Start) / 1000.0;
×
UNCOV
213
      qDebug("s-task:%s scan-history from WAL stage(step 2) ended, range:%" PRId64 "-%" PRId64 ", elapsed time:%.2fs",
×
214
             id, pTask->step2Range.minVer, maxVer, el);
UNCOV
215
      int32_t code = streamTaskPutTranstateIntoInputQ(pTask);
×
UNCOV
216
      if (code) {
×
217
        qError("s-task:%s failed to put trans-state into inputQ", id);
×
218
      }
219

UNCOV
220
      return true;
×
221
    } else {
222
      qWarn("s-task:%s fill-history scan WAL, nextProcessVer:%" PRId64 " out of the ver range:%" PRId64 "-%" PRId64
×
223
            ", not scan wal",
224
            id, ver, pTask->step2Range.minVer, maxVer);
225
    }
226
  }
227

UNCOV
228
  return false;
×
229
}
230

UNCOV
231
bool taskReadyForDataFromWal(SStreamTask* pTask) {
×
232
  // non-source or fill-history tasks don't need to response the WAL scan action.
UNCOV
233
  SSTaskBasicInfo* pInfo = &pTask->info;
×
UNCOV
234
  if ((pInfo->taskLevel != TASK_LEVEL__SOURCE) || (pTask->status.downstreamReady == 0)) {
×
UNCOV
235
    return false;
×
236
  }
237

UNCOV
238
  if (pInfo->taskLevel == TASK_LEVEL__SOURCE && pInfo->trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) {
×
UNCOV
239
    return false;
×
240
  }
241

242
  // not in ready state, do not handle the data from wal
UNCOV
243
  SStreamTaskState pState = streamTaskGetStatus(pTask);
×
UNCOV
244
  if (pState.state != TASK_STATUS__READY) {
×
UNCOV
245
    tqTrace("s-task:%s not ready for submit block in wal, status:%s", pTask->id.idStr, pState.name);
×
UNCOV
246
    return false;
×
247
  }
248

249
  // fill-history task has entered into the last phase, no need to anything
UNCOV
250
  if ((pInfo->fillHistory == 1) && pTask->status.appendTranstateBlock) {
×
251
    // the maximum version of data in the WAL has reached already, the step2 is done
UNCOV
252
    tqDebug("s-task:%s fill-history reach the maximum ver:%" PRId64 ", not scan wal anymore", pTask->id.idStr,
×
253
            pTask->dataRange.range.maxVer);
UNCOV
254
    return false;
×
255
  }
256

257
  // check if input queue is full or not
UNCOV
258
  if (streamQueueIsFull(pTask->inputq.queue)) {
×
UNCOV
259
    tqTrace("s-task:%s input queue is full, do nothing", pTask->id.idStr);
×
UNCOV
260
    return false;
×
261
  }
262

263
  // the input queue of downstream task is full, so the output is blocked, stopped for a while
UNCOV
264
  if (pTask->inputq.status == TASK_INPUT_STATUS__BLOCKED) {
×
265
    tqDebug("s-task:%s inputQ is blocked, do nothing", pTask->id.idStr);
×
266
    return false;
×
267
  }
268

UNCOV
269
  return true;
×
270
}
271

UNCOV
272
int32_t doPutDataIntoInputQ(SStreamTask* pTask, int64_t maxVer, int32_t* numOfItems, bool* pSucc) {
×
UNCOV
273
  const char* id = pTask->id.idStr;
×
UNCOV
274
  int32_t     numOfNewItems = 0;
×
UNCOV
275
  int32_t     code = 0;
×
UNCOV
276
  *pSucc = false;
×
277

UNCOV
278
  while (1) {
×
UNCOV
279
    if ((pTask->info.fillHistory == 1) && pTask->status.appendTranstateBlock) {
×
280
      *numOfItems += numOfNewItems;
×
281
      return numOfNewItems > 0;
×
282
    }
283

UNCOV
284
    SStreamQueueItem* pItem = NULL;
×
UNCOV
285
    code = extractMsgFromWal(pTask->exec.pWalReader, (void**)&pItem, maxVer, id);
×
UNCOV
286
    if (code != TSDB_CODE_SUCCESS || pItem == NULL) {  // failed, continue
×
UNCOV
287
      int64_t currentVer = walReaderGetCurrentVer(pTask->exec.pWalReader);
×
UNCOV
288
      bool    itemInFillhistory = handleFillhistoryScanComplete(pTask, currentVer);
×
UNCOV
289
      if (itemInFillhistory) {
×
UNCOV
290
        numOfNewItems += 1;
×
291
      }
UNCOV
292
      break;
×
293
    }
294

UNCOV
295
    if (pItem != NULL) {
×
UNCOV
296
      code = streamTaskPutDataIntoInputQ(pTask, pItem);
×
UNCOV
297
      if (code == TSDB_CODE_SUCCESS) {
×
UNCOV
298
        numOfNewItems += 1;
×
UNCOV
299
        int64_t ver = walReaderGetCurrentVer(pTask->exec.pWalReader);
×
UNCOV
300
        pTask->chkInfo.nextProcessVer = ver;
×
UNCOV
301
        tqDebug("s-task:%s set ver:%" PRId64 " for reader after extract data from WAL", id, ver);
×
302

UNCOV
303
        bool itemInFillhistory = handleFillhistoryScanComplete(pTask, ver);
×
UNCOV
304
        if (itemInFillhistory) {
×
UNCOV
305
          break;
×
306
        }
307
      } else {
UNCOV
308
        if (code == TSDB_CODE_OUT_OF_MEMORY) {
×
309
          tqError("s-task:%s failed to put data into inputQ, since out of memory", id);
×
310
        } else {
UNCOV
311
          tqTrace("s-task:%s append input queue failed, code:inputQ is full, ver:%" PRId64, id,
×
312
                  pTask->chkInfo.nextProcessVer);
UNCOV
313
          code = walReaderSeekVer(pTask->exec.pWalReader, pTask->chkInfo.nextProcessVer);
×
UNCOV
314
          if (code) {
×
315
            tqError("s-task:%s failed to seek ver to:%" PRId64 " in wal", id, pTask->chkInfo.nextProcessVer);
×
316
          }
317

UNCOV
318
          code = 0;  // reset the error code
×
319
        }
320

UNCOV
321
        break;
×
322
      }
323
    }
324
  }
325

UNCOV
326
  *numOfItems += numOfNewItems;
×
UNCOV
327
  *pSucc = (numOfNewItems > 0);
×
UNCOV
328
  return code;
×
329
}
330

UNCOV
331
int32_t doScanWalForAllTasks(SStreamMeta* pStreamMeta) {
×
UNCOV
332
  int32_t vgId = pStreamMeta->vgId;
×
UNCOV
333
  int32_t numOfTasks = taosArrayGetSize(pStreamMeta->pTaskList);
×
UNCOV
334
  if (numOfTasks == 0) {
×
UNCOV
335
    return TSDB_CODE_SUCCESS;
×
336
  }
337

338
  // clone the task list, to avoid the task update during scan wal files
UNCOV
339
  SArray* pTaskList = NULL;
×
UNCOV
340
  streamMetaWLock(pStreamMeta);
×
UNCOV
341
  pTaskList = taosArrayDup(pStreamMeta->pTaskList, NULL);
×
UNCOV
342
  streamMetaWUnLock(pStreamMeta);
×
UNCOV
343
  if (pTaskList == NULL) {
×
344
    tqError("vgId:%d failed to create task list dup, code:%s", vgId, tstrerror(terrno));
×
345
    return terrno;
×
346
  }
347

UNCOV
348
  tqDebug("vgId:%d start to check wal to extract new submit block for %d tasks", vgId, numOfTasks);
×
349

350
  // update the new task number
UNCOV
351
  numOfTasks = taosArrayGetSize(pTaskList);
×
352

UNCOV
353
  for (int32_t i = 0; i < numOfTasks; ++i) {
×
UNCOV
354
    STaskId* pTaskId = taosArrayGet(pTaskList, i);
×
UNCOV
355
    if (pTaskId == NULL) {
×
UNCOV
356
      continue;
×
357
    }
358

UNCOV
359
    SStreamTask* pTask = NULL;
×
UNCOV
360
    int32_t      code = streamMetaAcquireTask(pStreamMeta, pTaskId->streamId, pTaskId->taskId, &pTask);
×
UNCOV
361
    if (pTask == NULL || code != 0) {
×
UNCOV
362
      continue;
×
363
    }
364

UNCOV
365
    if (!taskReadyForDataFromWal(pTask)) {
×
UNCOV
366
      streamMetaReleaseTask(pStreamMeta, pTask);
×
UNCOV
367
      continue;
×
368
    }
369

370
    // seek the stored version and extract data from WAL
UNCOV
371
    code = setWalReaderStartOffset(pTask, vgId);
×
UNCOV
372
    if (code != TSDB_CODE_SUCCESS) {
×
373
      streamMetaReleaseTask(pStreamMeta, pTask);
×
374
      continue;
×
375
    }
376

UNCOV
377
    int32_t numOfItems = streamQueueGetNumOfItems(pTask->inputq.queue);
×
UNCOV
378
    int64_t maxVer = (pTask->info.fillHistory == 1) ? pTask->step2Range.maxVer : INT64_MAX;
×
379

UNCOV
380
    streamMutexLock(&pTask->lock);
×
381

UNCOV
382
    SStreamTaskState state = streamTaskGetStatus(pTask);
×
UNCOV
383
    if (state.state != TASK_STATUS__READY) {
×
UNCOV
384
      tqDebug("s-task:%s not ready for submit block from wal, status:%s", pTask->id.idStr, state.name);
×
UNCOV
385
      streamMutexUnlock(&pTask->lock);
×
UNCOV
386
      streamMetaReleaseTask(pStreamMeta, pTask);
×
UNCOV
387
      continue;
×
388
    }
389

UNCOV
390
    bool hasNewData = false;
×
UNCOV
391
    code = doPutDataIntoInputQ(pTask, maxVer, &numOfItems, &hasNewData);
×
UNCOV
392
    streamMutexUnlock(&pTask->lock);
×
393

UNCOV
394
    if ((numOfItems > 0) || hasNewData) {
×
UNCOV
395
      code = streamTrySchedExec(pTask);
×
UNCOV
396
      if (code != TSDB_CODE_SUCCESS) {
×
397
        streamMetaReleaseTask(pStreamMeta, pTask);
×
398
        taosArrayDestroy(pTaskList);
×
399
        return code;
×
400
      }
401
    }
402

UNCOV
403
    streamMetaReleaseTask(pStreamMeta, pTask);
×
404
  }
405

UNCOV
406
  taosArrayDestroy(pTaskList);
×
UNCOV
407
  return TSDB_CODE_SUCCESS;
×
408
}
409

UNCOV
410
int32_t doScanWalAsync(STQ* pTq, bool ckPause) {
×
UNCOV
411
  SStreamMeta* pMeta = pTq->pStreamMeta;
×
UNCOV
412
  bool         alreadyRestored = pTq->pVnode->restored;
×
UNCOV
413
  int32_t      vgId = pMeta->vgId;
×
UNCOV
414
  int32_t      numOfTasks = taosArrayGetSize(pMeta->pTaskList);
×
415

UNCOV
416
  if (numOfTasks == 0) {
×
UNCOV
417
    tqDebug("vgId:%d no stream tasks existed to run", vgId);
×
UNCOV
418
    return 0;
×
419
  }
420

UNCOV
421
  if (pMeta->startInfo.startAllTasks) {
×
UNCOV
422
    tqTrace("vgId:%d in restart procedure, not scan wal", vgId);
×
UNCOV
423
    return 0;
×
424
  }
425

UNCOV
426
  pMeta->scanInfo.scanCounter += 1;
×
UNCOV
427
  if (pMeta->scanInfo.scanCounter > MAX_REPEAT_SCAN_THRESHOLD) {
×
UNCOV
428
    pMeta->scanInfo.scanCounter = MAX_REPEAT_SCAN_THRESHOLD;
×
429
  }
430

UNCOV
431
  if (pMeta->scanInfo.scanCounter > 1) {
×
UNCOV
432
    tqDebug("vgId:%d wal read task has been launched, remain scan times:%d", vgId, pMeta->scanInfo.scanCounter);
×
UNCOV
433
    return 0;
×
434
  }
435

UNCOV
436
  int32_t numOfPauseTasks = pMeta->numOfPausedTasks;
×
UNCOV
437
  if (ckPause && numOfTasks == numOfPauseTasks) {
×
UNCOV
438
    tqDebug("vgId:%d ignore all submit, all streams had been paused, reset the walScanCounter", vgId);
×
439

440
    // reset the counter value, since we do not launch the scan wal operation.
UNCOV
441
    pMeta->scanInfo.scanCounter = 0;
×
UNCOV
442
    return 0;
×
443
  }
444

UNCOV
445
  tqDebug("vgId:%d create msg to start wal scan to launch stream tasks, numOfTasks:%d, vnd restored:%d", vgId,
×
446
          numOfTasks, alreadyRestored);
447

UNCOV
448
  return streamTaskSchedTask(&pTq->pVnode->msgCb, vgId, 0, 0, STREAM_EXEC_T_EXTRACT_WAL_DATA);
×
449
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc