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

taosdata / TDengine / #3597

05 Feb 2025 01:41AM UTC coverage: 63.546% (-0.02%) from 63.562%
#3597

push

travis-ci

web-flow
Merge pull request #29639 from taosdata/feat/3.0/TS-5795

Enh(tsdb):print fid while data file corrupted.

141230 of 285630 branches covered (49.45%)

Branch coverage included in aggregate %.

2 of 4 new or added lines in 1 file covered. (50.0%)

398 existing lines in 102 files now uncovered.

220015 of 282846 relevant lines covered (77.79%)

18937864.43 hits per line

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

75.05
/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
  int8_t  restored;
26
  SMsgCb  msgCb;
27
} SBuildScanWalMsgParam;
28

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

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

44
  tqDebug("vgId:%d continue to check if data in wal are available, scanCounter:%d", vgId, pMeta->scanInfo.scanCounter);
66,620✔
45

46
  // check all tasks
47
  int32_t code = doScanWalForAllTasks(pMeta);
66,621✔
48
  if (code) {
66,622!
49
    tqError("vgId:%d failed to start all tasks, try next time, code:%s", vgId, tstrerror(code));
×
50
    return code;
×
51
  }
52

53
  streamMetaWLock(pMeta);
66,622✔
54
  int32_t times = (--pMeta->scanInfo.scanCounter);
66,619✔
55
  if (times < 0) {
66,619!
56
    tqError("vgId:%d invalid scan counter:%d, reset to 0", vgId, times);
×
57
    times = 0;
×
58
  }
59

60
  numOfTasks = taosArrayGetSize(pMeta->pTaskList);
66,619✔
61
  streamMetaWUnLock(pMeta);
66,616✔
62

63
  int64_t el = (taosGetTimestampMs() - st);
66,613✔
64
  tqDebug("vgId:%d scan wal for stream tasks completed, elapsed time:%" PRId64 " ms", vgId, el);
66,613✔
65

66
  if (times > 0) {
66,613✔
67
    tqDebug("vgId:%d scan wal for stream tasks for %d times in %dms", vgId, times, SCAN_WAL_IDLE_DURATION);
22,822✔
68
    code = tqScanWalInFuture(pTq, numOfTasks, SCAN_WAL_IDLE_DURATION);
22,822✔
69
    if (code) {
22,827!
70
      tqError("vgId:%d sched scan wal in %dms failed, ignore this failure", vgId, SCAN_WAL_IDLE_DURATION);
×
71
    }
72
  }
73

74
  return code;
66,615✔
75
}
76

77
static void doStartScanWal(void* param, void* tmrId) {
22,827✔
78
  int32_t vgId = 0;
22,827✔
79
  int32_t code = 0;
22,827✔
80

81
  SBuildScanWalMsgParam* pParam = (SBuildScanWalMsgParam*)param;
22,827✔
82

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

90
  if (pMeta->closeFlag) {
22,632✔
91
    code = taosReleaseRef(streamMetaRefPool, pParam->metaId);
8✔
92
    if (code == TSDB_CODE_SUCCESS) {
8!
93
      tqDebug("vgId:%d jump out of scan wal timer since closed", vgId);
8✔
94
    } else {
95
      tqError("vgId:%d failed to release ref for streamMeta, rid:%" PRId64 " code:%s", vgId, pParam->metaId,
×
96
              tstrerror(code));
97
    }
98

99
    taosMemoryFree(pParam);
8!
100
    return;
8✔
101
  }
102

103
  vgId = pMeta->vgId;
22,624✔
104

105
  tqDebug("vgId:%d create msg to start wal scan, numOfTasks:%d, vnd restored:%d", vgId, pParam->numOfTasks,
22,624✔
106
          pParam->restored);
107
#if 0
108
  // wait for the vnode is freed, and invalid read may occur.
109
  taosMsleep(10000);
110
#endif
111

112
  code = streamTaskSchedTask(&pParam->msgCb, vgId, 0, 0, STREAM_EXEC_T_EXTRACT_WAL_DATA);
22,624✔
113
  if (code) {
22,624✔
114
    tqError("vgId:%d failed sched task to scan wal, code:%s", vgId, tstrerror(code));
542!
115
  }
116

117
  code = taosReleaseRef(streamMetaRefPool, pParam->metaId);
22,624✔
118
  if (code) {
22,624!
119
    tqError("vgId:%d failed to release ref for streamMeta, rid:%" PRId64 " code:%s", vgId, pParam->metaId,
×
120
            tstrerror(code));
121
  }
122

123
  taosMemoryFree(pParam);
22,624!
124
}
125

126
int32_t tqScanWalInFuture(STQ* pTq, int32_t numOfTasks, int32_t idleDuration) {
22,817✔
127
  SStreamMeta*           pMeta = pTq->pStreamMeta;
22,817✔
128
  int32_t                code = 0;
22,817✔
129
  int32_t                vgId = TD_VID(pTq->pVnode);
22,817✔
130
  tmr_h                  pTimer = NULL;
22,817✔
131
  SBuildScanWalMsgParam* pParam = NULL;
22,817✔
132

133
  pParam = taosMemoryMalloc(sizeof(SBuildScanWalMsgParam));
22,817!
134
  if (pParam == NULL) {
22,820!
135
    return terrno;
×
136
  }
137

138
  pParam->metaId = pMeta->rid;
22,820✔
139
  pParam->numOfTasks = numOfTasks;
22,820✔
140
  pParam->restored = pTq->pVnode->restored;
22,820✔
141
  pParam->msgCb = pTq->pVnode->msgCb;
22,820✔
142

143
  code = streamTimerGetInstance(&pTimer);
22,820✔
144
  if (code) {
22,818!
145
    tqError("vgId:%d failed to get tmr ctrl during sched scan wal", vgId);
×
146
    taosMemoryFree(pParam);
×
147
  } else {
148
    streamTmrStart(doStartScanWal, idleDuration, pParam, pTimer, &pMeta->scanInfo.scanTimer, vgId, "scan-wal-fut");
22,818✔
149
  }
150

151
  return code;
22,827✔
152
}
153

154
int32_t tqScanWalAsync(STQ* pTq, bool ckPause) {
501,011✔
155
  SStreamMeta* pMeta = pTq->pStreamMeta;
501,011✔
156
  bool         alreadyRestored = pTq->pVnode->restored;
501,011✔
157
  int32_t      code = 0;
501,011✔
158

159
  // do not launch the stream tasks, if it is a follower or not restored vnode.
160
  if (!(vnodeIsRoleLeader(pTq->pVnode) && alreadyRestored)) {
501,011✔
161
    return TSDB_CODE_SUCCESS;
23,913✔
162
  }
163

164
  streamMetaWLock(pMeta);
477,189✔
165
  code = doScanWalAsync(pTq, ckPause);
477,181✔
166
  streamMetaWUnLock(pMeta);
477,173✔
167
  return code;
477,172✔
168
}
169

170
int32_t tqStopStreamTasksAsync(STQ* pTq) {
4,723✔
171
  SStreamMeta* pMeta = pTq->pStreamMeta;
4,723✔
172
  int32_t      vgId = pMeta->vgId;
4,723✔
173
  return streamTaskSchedTask(&pTq->pVnode->msgCb, vgId, 0, 0, STREAM_EXEC_T_STOP_ALL_TASKS);
4,723✔
174
}
175

176
int32_t setWalReaderStartOffset(SStreamTask* pTask, int32_t vgId) {
72,483✔
177
  // seek the stored version and extract data from WAL
178
  int64_t firstVer = walReaderGetValidFirstVer(pTask->exec.pWalReader);
72,483✔
179
  if (pTask->chkInfo.nextProcessVer < firstVer) {
72,475✔
180
    tqWarn("vgId:%d s-task:%s ver:%" PRId64 " earlier than the first ver of wal range %" PRId64 ", forward to %" PRId64,
4!
181
           vgId, pTask->id.idStr, pTask->chkInfo.nextProcessVer, firstVer, firstVer);
182

183
    pTask->chkInfo.nextProcessVer = firstVer;
4✔
184

185
    // todo need retry if failed
186
    int32_t code = walReaderSeekVer(pTask->exec.pWalReader, pTask->chkInfo.nextProcessVer);
4✔
187
    if (code != TSDB_CODE_SUCCESS) {
4!
188
      return code;
×
189
    }
190

191
    // append the data for the stream
192
    tqDebug("vgId:%d s-task:%s wal reader seek to ver:%" PRId64, vgId, pTask->id.idStr, pTask->chkInfo.nextProcessVer);
4!
193
  } else {
194
    int64_t currentVer = walReaderGetCurrentVer(pTask->exec.pWalReader);
72,471✔
195
    if (currentVer == -1) {  // we only seek the read for the first time
72,463✔
196
      int32_t code = walReaderSeekVer(pTask->exec.pWalReader, pTask->chkInfo.nextProcessVer);
4,700✔
197
      if (code != TSDB_CODE_SUCCESS) {  // no data in wal, quit
4,698!
198
        return code;
×
199
      }
200

201
      // append the data for the stream
202
      tqDebug("vgId:%d s-task:%s wal reader initial seek to ver:%" PRId64, vgId, pTask->id.idStr,
4,698✔
203
              pTask->chkInfo.nextProcessVer);
204
    }
205
  }
206

207
  int64_t skipToVer = walReaderGetSkipToVersion(pTask->exec.pWalReader);
72,465✔
208
  if (skipToVer != 0 && skipToVer > pTask->chkInfo.nextProcessVer) {
72,462✔
209
    int32_t code = walReaderSeekVer(pTask->exec.pWalReader, skipToVer);
451✔
210
    if (code != TSDB_CODE_SUCCESS) {  // no data in wal, quit
451!
211
      return code;
×
212
    }
213

214
    tqDebug("vgId:%d s-task:%s wal reader jump to ver:%" PRId64, vgId, pTask->id.idStr, skipToVer);
451✔
215
  }
216

217
  return TSDB_CODE_SUCCESS;
72,446✔
218
}
219

220
// todo handle memory error
221
bool handleFillhistoryScanComplete(SStreamTask* pTask, int64_t ver) {
221,376✔
222
  const char* id = pTask->id.idStr;
221,376✔
223
  int64_t     maxVer = pTask->step2Range.maxVer;
221,376✔
224

225
  if ((pTask->info.fillHistory == 1) && ver > maxVer) {
221,376✔
226
    if (!pTask->status.appendTranstateBlock) {
722!
227
      qWarn("s-task:%s fill-history scan WAL, nextProcessVer:%" PRId64 " out of the maximum ver:%" PRId64
722!
228
            ", not scan wal anymore, add transfer-state block into inputQ",
229
            id, ver, maxVer);
230

231
      double el = (taosGetTimestampMs() - pTask->execInfo.step2Start) / 1000.0;
722✔
232
      qDebug("s-task:%s scan-history from WAL stage(step 2) ended, range:%" PRId64 "-%" PRId64 ", elapsed time:%.2fs",
722✔
233
             id, pTask->step2Range.minVer, maxVer, el);
234
      int32_t code = streamTaskPutTranstateIntoInputQ(pTask);
722✔
235
      if (code) {
722!
236
        qError("s-task:%s failed to put trans-state into inputQ", id);
×
237
      }
238

239
      return true;
722✔
240
    } else {
241
      qWarn("s-task:%s fill-history scan WAL, nextProcessVer:%" PRId64 " out of the ver range:%" PRId64 "-%" PRId64
×
242
            ", not scan wal",
243
            id, ver, pTask->step2Range.minVer, maxVer);
244
    }
245
  }
246

247
  return false;
220,651✔
248
}
249

250
bool taskReadyForDataFromWal(SStreamTask* pTask) {
255,965✔
251
  // non-source or fill-history tasks don't need to response the WAL scan action.
252
  SSTaskBasicInfo* pInfo = &pTask->info;
255,965✔
253
  if ((pInfo->taskLevel != TASK_LEVEL__SOURCE) || (pTask->status.downstreamReady == 0)) {
255,965✔
254
    return false;
133,238✔
255
  }
256

257
  if (pInfo->taskLevel == TASK_LEVEL__SOURCE && pInfo->trigger == STREAM_TRIGGER_FORCE_WINDOW_CLOSE) {
122,727✔
258
    return false;
12,320✔
259
  }
260

261
  // not in ready state, do not handle the data from wal
262
  SStreamTaskState pState = streamTaskGetStatus(pTask);
110,407✔
263
  if (pState.state != TASK_STATUS__READY) {
110,399✔
264
    tqTrace("s-task:%s not ready for submit block in wal, status:%s", pTask->id.idStr, pState.name);
32,853✔
265
    return false;
32,854✔
266
  }
267

268
  // fill-history task has entered into the last phase, no need to anything
269
  if ((pInfo->fillHistory == 1) && pTask->status.appendTranstateBlock) {
77,546✔
270
    // the maximum version of data in the WAL has reached already, the step2 is done
271
    tqDebug("s-task:%s fill-history reach the maximum ver:%" PRId64 ", not scan wal anymore", pTask->id.idStr,
5,065✔
272
            pTask->dataRange.range.maxVer);
273
    return false;
5,065✔
274
  }
275

276
  // check if input queue is full or not
277
  if (streamQueueIsFull(pTask->inputq.queue)) {
72,481✔
278
    tqTrace("s-task:%s input queue is full, do nothing", pTask->id.idStr);
6!
UNCOV
279
    return false;
×
280
  }
281

282
  // the input queue of downstream task is full, so the output is blocked, stopped for a while
283
  if (pTask->inputq.status == TASK_INPUT_STATUS__BLOCKED) {
72,486!
284
    tqDebug("s-task:%s inputQ is blocked, do nothing", pTask->id.idStr);
×
285
    return false;
×
286
  }
287

288
  return true;
72,486✔
289
}
290

291
int32_t doPutDataIntoInputQ(SStreamTask* pTask, int64_t maxVer, int32_t* numOfItems, bool* pSucc) {
72,460✔
292
  const char* id = pTask->id.idStr;
72,460✔
293
  int32_t     numOfNewItems = 0;
72,460✔
294
  int32_t     code = 0;
72,460✔
295
  *pSucc = false;
72,460✔
296

297
  while (1) {
148,967✔
298
    if ((pTask->info.fillHistory == 1) && pTask->status.appendTranstateBlock) {
221,427!
299
      *numOfItems += numOfNewItems;
×
300
      return numOfNewItems > 0;
×
301
    }
302

303
    SStreamQueueItem* pItem = NULL;
221,427✔
304
    code = extractMsgFromWal(pTask->exec.pWalReader, (void**)&pItem, maxVer, id);
221,427✔
305
    if (code != TSDB_CODE_SUCCESS || pItem == NULL) {  // failed, continue
221,361✔
306
      int64_t currentVer = walReaderGetCurrentVer(pTask->exec.pWalReader);
72,262✔
307
      bool    itemInFillhistory = handleFillhistoryScanComplete(pTask, currentVer);
72,273✔
308
      if (itemInFillhistory) {
72,265✔
309
        numOfNewItems += 1;
581✔
310
      }
311
      break;
72,265✔
312
    }
313

314
    if (pItem != NULL) {
149,099!
315
      code = streamTaskPutDataIntoInputQ(pTask, pItem);
149,099✔
316
      if (code == TSDB_CODE_SUCCESS) {
149,113!
317
        numOfNewItems += 1;
149,113✔
318
        int64_t ver = walReaderGetCurrentVer(pTask->exec.pWalReader);
149,113✔
319
        pTask->chkInfo.nextProcessVer = ver;
149,109✔
320
        tqDebug("s-task:%s set ver:%" PRId64 " for reader after extract data from WAL", id, ver);
149,109✔
321

322
        bool itemInFillhistory = handleFillhistoryScanComplete(pTask, ver);
149,109✔
323
        if (itemInFillhistory) {
149,108✔
324
          break;
141✔
325
        }
326
      } else {
UNCOV
327
        if (code == TSDB_CODE_OUT_OF_MEMORY) {
×
328
          tqError("s-task:%s failed to put data into inputQ, since out of memory", id);
×
329
        } else {
UNCOV
330
          tqTrace("s-task:%s append input queue failed, code:inputQ is full, ver:%" PRId64, id,
×
331
                  pTask->chkInfo.nextProcessVer);
UNCOV
332
          code = walReaderSeekVer(pTask->exec.pWalReader, pTask->chkInfo.nextProcessVer);
×
UNCOV
333
          if (code) {
×
334
            tqError("s-task:%s failed to seek ver to:%" PRId64 " in wal", id, pTask->chkInfo.nextProcessVer);
×
335
          }
336

UNCOV
337
          code = 0;  // reset the error code
×
338
        }
339

UNCOV
340
        break;
×
341
      }
342
    }
343
  }
344

345
  *numOfItems += numOfNewItems;
72,406✔
346
  *pSucc = (numOfNewItems > 0);
72,406✔
347
  return code;
72,406✔
348
}
349

350
int32_t doScanWalForAllTasks(SStreamMeta* pStreamMeta) {
66,612✔
351
  int32_t vgId = pStreamMeta->vgId;
66,612✔
352
  SArray* pTaskList = NULL;
66,612✔
353
  int32_t numOfTasks = taosArrayGetSize(pStreamMeta->pTaskList);
66,612✔
354
  if (numOfTasks == 0) {
66,619✔
355
    return TSDB_CODE_SUCCESS;
587✔
356
  }
357

358
  // clone the task list, to avoid the task update during scan wal files
359
  streamMetaWLock(pStreamMeta);
66,032✔
360
  pTaskList = taosArrayDup(pStreamMeta->pTaskList, NULL);
66,031✔
361
  streamMetaWUnLock(pStreamMeta);
66,037✔
362
  if (pTaskList == NULL) {
66,026!
363
    tqError("vgId:%d failed to create task list dup, code:%s", vgId, tstrerror(terrno));
×
364
    return terrno;
×
365
  }
366

367
  tqDebug("vgId:%d start to check wal to extract new submit block for %d tasks", vgId, numOfTasks);
66,026✔
368

369
  // update the new task number
370
  numOfTasks = taosArrayGetSize(pTaskList);
66,026✔
371

372
  for (int32_t i = 0; i < numOfTasks; ++i) {
322,517✔
373
    STaskId* pTaskId = taosArrayGet(pTaskList, i);
256,447✔
374
    if (pTaskId == NULL) {
256,427!
375
      continue;
184,018✔
376
    }
377

378
    SStreamTask* pTask = NULL;
256,427✔
379
    int32_t      code = streamMetaAcquireTask(pStreamMeta, pTaskId->streamId, pTaskId->taskId, &pTask);
256,427✔
380
    if (pTask == NULL || code != 0) {
256,463!
381
      continue;
482✔
382
    }
383

384
    if (!taskReadyForDataFromWal(pTask)) {
255,981✔
385
      streamMetaReleaseTask(pStreamMeta, pTask);
183,473✔
386
      continue;
183,514✔
387
    }
388

389
    // seek the stored version and extract data from WAL
390
    code = setWalReaderStartOffset(pTask, vgId);
72,481✔
391
    if (code != TSDB_CODE_SUCCESS) {
72,446!
392
      streamMetaReleaseTask(pStreamMeta, pTask);
×
393
      continue;
×
394
    }
395

396
    int32_t numOfItems = streamQueueGetNumOfItems(pTask->inputq.queue);
72,446✔
397
    int64_t maxVer = (pTask->info.fillHistory == 1) ? pTask->step2Range.maxVer : INT64_MAX;
72,486✔
398

399
    streamMutexLock(&pTask->lock);
72,486✔
400

401
    SStreamTaskState state = streamTaskGetStatus(pTask);
72,486✔
402
    if (state.state != TASK_STATUS__READY) {
72,483✔
403
      tqDebug("s-task:%s not ready for submit block from wal, status:%s", pTask->id.idStr, state.name);
21✔
404
      streamMutexUnlock(&pTask->lock);
21✔
405
      streamMetaReleaseTask(pStreamMeta, pTask);
21✔
406
      continue;
22✔
407
    }
408

409
    bool hasNewData = false;
72,462✔
410
    code = doPutDataIntoInputQ(pTask, maxVer, &numOfItems, &hasNewData);
72,462✔
411
    streamMutexUnlock(&pTask->lock);
72,397✔
412

413
    if ((numOfItems > 0) || hasNewData) {
72,470!
414
      code = streamTrySchedExec(pTask);
24,884✔
415
      if (code != TSDB_CODE_SUCCESS) {
24,884!
416
        streamMetaReleaseTask(pStreamMeta, pTask);
×
417
        taosArrayDestroy(pTaskList);
×
418
        return code;
×
419
      }
420
    }
421

422
    streamMetaReleaseTask(pStreamMeta, pTask);
72,470✔
423
  }
424

425
  taosArrayDestroy(pTaskList);
66,070✔
426
  return TSDB_CODE_SUCCESS;
66,035✔
427
}
428

429
int32_t doScanWalAsync(STQ* pTq, bool ckPause) {
477,089✔
430
  SStreamMeta* pMeta = pTq->pStreamMeta;
477,089✔
431
  bool         alreadyRestored = pTq->pVnode->restored;
477,089✔
432
  int32_t      vgId = pMeta->vgId;
477,089✔
433
  int32_t      numOfTasks = taosArrayGetSize(pMeta->pTaskList);
477,089✔
434

435
  if (numOfTasks == 0) {
477,131✔
436
    tqDebug("vgId:%d no stream tasks existed to run", vgId);
7!
437
    return 0;
18✔
438
  }
439

440
  if (pMeta->startInfo.startAllTasks) {
477,124✔
441
    tqTrace("vgId:%d in restart procedure, not scan wal", vgId);
9,613✔
442
    return 0;
9,613✔
443
  }
444

445
  pMeta->scanInfo.scanCounter += 1;
467,511✔
446
  if (pMeta->scanInfo.scanCounter > MAX_REPEAT_SCAN_THRESHOLD) {
467,511✔
447
    pMeta->scanInfo.scanCounter = MAX_REPEAT_SCAN_THRESHOLD;
398,568✔
448
  }
449

450
  if (pMeta->scanInfo.scanCounter > 1) {
467,511✔
451
    tqDebug("vgId:%d wal read task has been launched, remain scan times:%d", vgId, pMeta->scanInfo.scanCounter);
422,333✔
452
    return 0;
422,346✔
453
  }
454

455
  int32_t numOfPauseTasks = pMeta->numOfPausedTasks;
45,178✔
456
  if (ckPause && numOfTasks == numOfPauseTasks) {
45,178✔
457
    tqDebug("vgId:%d ignore all submit, all streams had been paused, reset the walScanCounter", vgId);
127✔
458

459
    // reset the counter value, since we do not launch the scan wal operation.
460
    pMeta->scanInfo.scanCounter = 0;
127✔
461
    return 0;
127✔
462
  }
463

464
  tqDebug("vgId:%d create msg to start wal scan to launch stream tasks, numOfTasks:%d, vnd restored:%d", vgId,
45,051✔
465
          numOfTasks, alreadyRestored);
466

467
  return streamTaskSchedTask(&pTq->pVnode->msgCb, vgId, 0, 0, STREAM_EXEC_T_EXTRACT_WAL_DATA);
45,054✔
468
}
469

470
void streamMetaFreeTQDuringScanWalError(STQ* pTq) {
×
471
  SBuildScanWalMsgParam* p = taosMemoryCalloc(1, sizeof(SBuildScanWalMsgParam));
×
472
  p->metaId = pTq->pStreamMeta->rid;
×
473
  p->numOfTasks = 0;
×
474

475
  doStartScanWal(p, 0);
×
476
}
×
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