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

H
Hongze Cheng 已提交
16
#include "tsdbMerge.h"
H
Hongze Cheng 已提交
17

H
Hongze Cheng 已提交
18
typedef struct {
H
Hongze Cheng 已提交
19 20
  STsdb         *tsdb;
  TFileSetArray *fsetArr;
H
Hongze Cheng 已提交
21

H
Hongze Cheng 已提交
22 23 24 25 26 27 28
  int32_t sttTrigger;
  int32_t maxRow;
  int32_t minRow;
  int32_t szPage;
  int8_t  cmprAlg;
  int64_t compactVersion;
  int64_t cid;
H
Hongze Cheng 已提交
29

H
Hongze Cheng 已提交
30
  // context
H
Hongze Cheng 已提交
31
  struct {
H
Hongze Cheng 已提交
32
    bool       opened;
H
Hongze Cheng 已提交
33
    int64_t    now;
H
Hongze Cheng 已提交
34
    STFileSet *fset;
H
Hongze Cheng 已提交
35 36
    bool       toData;
    int32_t    level;
H
Hongze Cheng 已提交
37
    SSttLvl   *lvl;
H
Hongze Cheng 已提交
38
    TABLEID    tbid[1];
H
Hongze Cheng 已提交
39
  } ctx[1];
H
Hongze Cheng 已提交
40

H
Hongze Cheng 已提交
41 42
  TFileOpArray fopArr[1];

H
Hongze Cheng 已提交
43
  // reader
H
Hongze Cheng 已提交
44
  TSttFileReaderArray sttReaderArr[1];
H
Hongze Cheng 已提交
45
  // iter
H
Hongze Cheng 已提交
46 47 48 49
  TTsdbIterArray dataIterArr[1];
  SIterMerger   *dataIterMerger;
  TTsdbIterArray tombIterArr[1];
  SIterMerger   *tombIterMerger;
H
Hongze Cheng 已提交
50
  // writer
H
Hongze Cheng 已提交
51
  SFSetWriter *writer;
H
Hongze Cheng 已提交
52 53
} SMerger;

H
Hongze Cheng 已提交
54
static int32_t tsdbMergerOpen(SMerger *merger) {
H
Hongze Cheng 已提交
55
  merger->ctx->now = taosGetTimestampSec();
H
Hongze Cheng 已提交
56 57 58 59 60
  merger->maxRow = merger->tsdb->pVnode->config.tsdbCfg.maxRows;
  merger->minRow = merger->tsdb->pVnode->config.tsdbCfg.minRows;
  merger->szPage = merger->tsdb->pVnode->config.tsdbPageSize;
  merger->cmprAlg = merger->tsdb->pVnode->config.tsdbCfg.compression;
  merger->compactVersion = INT64_MAX;
H
Hongze Cheng 已提交
61
  merger->cid = tsdbFSAllocEid(merger->tsdb->pFS);
H
Hongze Cheng 已提交
62
  merger->ctx->opened = true;
H
Hongze Cheng 已提交
63
  return 0;
H
Hongze Cheng 已提交
64 65
}

H
Hongze Cheng 已提交
66
static int32_t tsdbMergerClose(SMerger *merger) {
H
Hongze Cheng 已提交
67 68 69
  int32_t code = 0;
  int32_t lino = 0;
  SVnode *pVnode = merger->tsdb->pVnode;
H
Hongze Cheng 已提交
70 71

  // edit file system
H
Hongze Cheng 已提交
72
  code = tsdbFSEditBegin(merger->tsdb->pFS, merger->fopArr, TSDB_FEDIT_MERGE);
H
Hongze Cheng 已提交
73 74
  TSDB_CHECK_CODE(code, lino, _exit);

H
Hongze Cheng 已提交
75
  taosThreadRwlockWrlock(&merger->tsdb->rwLock);
H
Hongze Cheng 已提交
76
  code = tsdbFSEditCommit(merger->tsdb->pFS);
H
Hongze Cheng 已提交
77 78 79 80 81
  if (code) {
    taosThreadRwlockUnlock(&merger->tsdb->rwLock);
    TSDB_CHECK_CODE(code, lino, _exit);
  }
  taosThreadRwlockUnlock(&merger->tsdb->rwLock);
H
Hongze Cheng 已提交
82

H
Hongze Cheng 已提交
83
  ASSERT(merger->writer == NULL);
H
Hongze Cheng 已提交
84
  ASSERT(merger->dataIterMerger == NULL);
H
Hongze Cheng 已提交
85
  ASSERT(merger->tombIterMerger == NULL);
H
Hongze Cheng 已提交
86
  ASSERT(TARRAY2_SIZE(merger->dataIterArr) == 0);
H
Hongze Cheng 已提交
87
  ASSERT(TARRAY2_SIZE(merger->tombIterArr) == 0);
H
Hongze Cheng 已提交
88 89
  ASSERT(TARRAY2_SIZE(merger->sttReaderArr) == 0);

H
Hongze Cheng 已提交
90
  // clear the merge
H
Hongze Cheng 已提交
91
  TARRAY2_DESTROY(merger->tombIterArr, NULL);
H
Hongze Cheng 已提交
92 93 94
  TARRAY2_DESTROY(merger->dataIterArr, NULL);
  TARRAY2_DESTROY(merger->sttReaderArr, NULL);
  TARRAY2_DESTROY(merger->fopArr, NULL);
H
Hongze Cheng 已提交
95 96 97

_exit:
  if (code) {
H
Hongze Cheng 已提交
98
    TSDB_ERROR_LOG(TD_VID(pVnode), lino, code);
H
Hongze Cheng 已提交
99
  }
H
Hongze Cheng 已提交
100
  return code;
H
Hongze Cheng 已提交
101
}
H
Hongze Cheng 已提交
102

H
Hongze Cheng 已提交
103 104 105
static int32_t tsdbMergeFileSetBeginOpenReader(SMerger *merger) {
  int32_t code = 0;
  int32_t lino = 0;
H
Hongze Cheng 已提交
106

H
Hongze Cheng 已提交
107 108
  merger->ctx->toData = true;
  merger->ctx->level = 0;
H
Hongze Cheng 已提交
109 110 111 112 113 114 115 116

  for (int32_t i = 0;; ++i) {
    if (i >= TARRAY2_SIZE(merger->ctx->fset->lvlArr)) {
      merger->ctx->lvl = NULL;
      break;
    }

    merger->ctx->lvl = TARRAY2_GET(merger->ctx->fset->lvlArr, i);
117 118
    if (merger->ctx->lvl->level != merger->ctx->level ||
        TARRAY2_SIZE(merger->ctx->lvl->fobjArr) + 1 < merger->sttTrigger) {
H
Hongze Cheng 已提交
119 120
      merger->ctx->toData = false;
      merger->ctx->lvl = NULL;
H
Hongze Cheng 已提交
121
      break;
H
Hongze Cheng 已提交
122
    }
H
Hongze Cheng 已提交
123

124
    merger->ctx->level++;
H
Hongze Cheng 已提交
125

126 127 128 129 130 131
    STFileObj *fobj;
    int32_t    numFile = 0;
    TARRAY2_FOREACH(merger->ctx->lvl->fobjArr, fobj) {
      if (numFile == merger->sttTrigger) {
        break;
      }
H
Hongze Cheng 已提交
132

H
Hongze Cheng 已提交
133 134 135
      STFileOp op = {
          .optype = TSDB_FOP_REMOVE,
          .fid = merger->ctx->fset->fid,
136
          .of = fobj->f[0],
H
Hongze Cheng 已提交
137 138 139 140
      };
      code = TARRAY2_APPEND(merger->fopArr, op);
      TSDB_CHECK_CODE(code, lino, _exit);

H
Hongze Cheng 已提交
141
      SSttFileReader      *reader;
142
      SSttFileReaderConfig config = {
H
Hongze Cheng 已提交
143
          .tsdb = merger->tsdb,
H
Hongze Cheng 已提交
144
          .szPage = merger->szPage,
145 146 147 148
          .file[0] = fobj->f[0],
      };

      code = tsdbSttFileReaderOpen(fobj->fname, &config, &reader);
H
Hongze Cheng 已提交
149
      TSDB_CHECK_CODE(code, lino, _exit);
H
Hongze Cheng 已提交
150

H
Hongze Cheng 已提交
151
      code = TARRAY2_APPEND(merger->sttReaderArr, reader);
H
Hongze Cheng 已提交
152
      TSDB_CHECK_CODE(code, lino, _exit);
H
Hongze Cheng 已提交
153 154
    }
  }
H
Hongze Cheng 已提交
155

H
Hongze Cheng 已提交
156 157
_exit:
  if (code) {
H
Hongze Cheng 已提交
158
    TSDB_ERROR_LOG(TD_VID(merger->tsdb->pVnode), lino, code);
H
Hongze Cheng 已提交
159 160 161 162 163 164 165 166 167 168 169
  }
  return code;
}

static int32_t tsdbMergeFileSetBeginOpenIter(SMerger *merger) {
  int32_t code = 0;
  int32_t lino = 0;
  int32_t vid = TD_VID(merger->tsdb->pVnode);

  SSttFileReader *sttReader;
  TARRAY2_FOREACH(merger->sttReaderArr, sttReader) {
170 171
    STsdbIter      *iter;
    STsdbIterConfig config = {0};
H
Hongze Cheng 已提交
172

173 174 175 176 177
    // data iter
    config.type = TSDB_ITER_TYPE_STT;
    config.sttReader = sttReader;

    code = tsdbIterOpen(&config, &iter);
H
Hongze Cheng 已提交
178 179
    TSDB_CHECK_CODE(code, lino, _exit);

180 181
    code = TARRAY2_APPEND(merger->dataIterArr, iter);
    TSDB_CHECK_CODE(code, lino, _exit);
H
Hongze Cheng 已提交
182

183 184 185
    // tomb iter
    config.type = TSDB_ITER_TYPE_STT_TOMB;
    config.sttReader = sttReader;
H
Hongze Cheng 已提交
186

187 188
    code = tsdbIterOpen(&config, &iter);
    TSDB_CHECK_CODE(code, lino, _exit);
H
Hongze Cheng 已提交
189

190 191
    code = TARRAY2_APPEND(merger->tombIterArr, iter);
    TSDB_CHECK_CODE(code, lino, _exit);
H
Hongze Cheng 已提交
192
  }
H
Hongze Cheng 已提交
193

H
Hongze Cheng 已提交
194 195 196 197
  code = tsdbIterMergerOpen(merger->dataIterArr, &merger->dataIterMerger, false);
  TSDB_CHECK_CODE(code, lino, _exit);

  code = tsdbIterMergerOpen(merger->tombIterArr, &merger->tombIterMerger, true);
H
Hongze Cheng 已提交
198 199 200 201 202 203 204 205 206 207 208 209 210 211
  TSDB_CHECK_CODE(code, lino, _exit);

_exit:
  if (code) {
    TSDB_ERROR_LOG(vid, lino, code);
  }
  return code;
}

static int32_t tsdbMergeFileSetBeginOpenWriter(SMerger *merger) {
  int32_t code = 0;
  int32_t lino = 0;
  int32_t vid = TD_VID(merger->tsdb->pVnode);

212 213 214 215
  SDiskID did;
  int32_t level = tsdbFidLevel(merger->ctx->fset->fid, &merger->tsdb->keepCfg, merger->ctx->now);
  if (tfsAllocDisk(merger->tsdb->pVnode->pTfs, level, &did) < 0) {
    code = TSDB_CODE_FS_NO_VALID_DISK;
H
Hongze Cheng 已提交
216
    TSDB_CHECK_CODE(code, lino, _exit);
217
  }
H
Hongze Cheng 已提交
218
  tfsMkdirRecurAt(merger->tsdb->pVnode->pTfs, merger->tsdb->path, did);
H
Hongze Cheng 已提交
219 220 221 222 223 224 225 226 227 228 229 230 231
  SFSetWriterConfig config = {
      .tsdb = merger->tsdb,
      .toSttOnly = true,
      .compactVersion = merger->compactVersion,
      .minRow = merger->minRow,
      .maxRow = merger->maxRow,
      .szPage = merger->szPage,
      .cmprAlg = merger->cmprAlg,
      .fid = merger->ctx->fset->fid,
      .cid = merger->cid,
      .did = did,
      .level = merger->ctx->level,
  };
H
Hongze Cheng 已提交
232

H
Hongze Cheng 已提交
233
  if (merger->ctx->toData) {
H
Hongze Cheng 已提交
234
    config.toSttOnly = false;
H
Hongze Cheng 已提交
235

H
Hongze Cheng 已提交
236 237 238 239
    for (int32_t ftype = 0; ftype < TSDB_FTYPE_MAX; ++ftype) {
      if (merger->ctx->fset->farr[ftype]) {
        config.files[ftype].exist = true;
        config.files[ftype].file = merger->ctx->fset->farr[ftype]->f[0];
H
Hongze Cheng 已提交
240
      } else {
H
Hongze Cheng 已提交
241
        config.files[ftype].exist = false;
H
Hongze Cheng 已提交
242 243
      }
    }
H
Hongze Cheng 已提交
244
  }
H
Hongze Cheng 已提交
245

H
Hongze Cheng 已提交
246 247 248
  code = tsdbFSetWriterOpen(&config, &merger->writer);
  TSDB_CHECK_CODE(code, lino, _exit);

H
Hongze Cheng 已提交
249 250
_exit:
  if (code) {
H
Hongze Cheng 已提交
251
    TSDB_ERROR_LOG(vid, lino, code);
H
Hongze Cheng 已提交
252 253 254
  }
  return code;
}
H
Hongze Cheng 已提交
255 256

static int32_t tsdbMergeFileSetBegin(SMerger *merger) {
H
Hongze Cheng 已提交
257 258 259
  int32_t code = 0;
  int32_t lino = 0;

H
Hongze Cheng 已提交
260
  ASSERT(TARRAY2_SIZE(merger->sttReaderArr) == 0);
H
Hongze Cheng 已提交
261 262
  ASSERT(TARRAY2_SIZE(merger->dataIterArr) == 0);
  ASSERT(merger->dataIterMerger == NULL);
H
Hongze Cheng 已提交
263
  ASSERT(merger->writer == NULL);
H
Hongze Cheng 已提交
264

H
Hongze Cheng 已提交
265 266 267
  merger->ctx->tbid->suid = 0;
  merger->ctx->tbid->uid = 0;

H
Hongze Cheng 已提交
268 269
  // open reader
  code = tsdbMergeFileSetBeginOpenReader(merger);
H
Hongze Cheng 已提交
270 271
  TSDB_CHECK_CODE(code, lino, _exit);

H
Hongze Cheng 已提交
272 273 274 275 276 277 278 279 280 281
  // open iterator
  code = tsdbMergeFileSetBeginOpenIter(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

  // open writer
  code = tsdbMergeFileSetBeginOpenWriter(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

_exit:
  if (code) {
H
Hongze Cheng 已提交
282
    TSDB_ERROR_LOG(TD_VID(merger->tsdb->pVnode), lino, code);
H
Hongze Cheng 已提交
283
  }
H
Hongze Cheng 已提交
284 285 286 287
  return code;
}

static int32_t tsdbMergeFileSetEndCloseWriter(SMerger *merger) {
H
Hongze Cheng 已提交
288
  return tsdbFSetWriterClose(&merger->writer, 0, merger->fopArr);
H
Hongze Cheng 已提交
289
}
H
Hongze Cheng 已提交
290 291

static int32_t tsdbMergeFileSetEndCloseIter(SMerger *merger) {
H
Hongze Cheng 已提交
292 293 294 295
  tsdbIterMergerClose(&merger->tombIterMerger);
  TARRAY2_CLEAR(merger->tombIterArr, tsdbIterClose);
  tsdbIterMergerClose(&merger->dataIterMerger);
  TARRAY2_CLEAR(merger->dataIterArr, tsdbIterClose);
H
Hongze Cheng 已提交
296 297 298 299
  return 0;
}

static int32_t tsdbMergeFileSetEndCloseReader(SMerger *merger) {
H
Hongze Cheng 已提交
300
  TARRAY2_CLEAR(merger->sttReaderArr, tsdbSttFileReaderClose);
H
Hongze Cheng 已提交
301 302 303 304
  return 0;
}

static int32_t tsdbMergeFileSetEnd(SMerger *merger) {
H
Hongze Cheng 已提交
305 306 307
  int32_t code = 0;
  int32_t lino = 0;

H
Hongze Cheng 已提交
308 309 310 311 312 313 314 315 316 317 318
  code = tsdbMergeFileSetEndCloseWriter(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

  code = tsdbMergeFileSetEndCloseIter(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

  code = tsdbMergeFileSetEndCloseReader(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

_exit:
  if (code) {
H
Hongze Cheng 已提交
319
    TSDB_ERROR_LOG(TD_VID(merger->tsdb->pVnode), lino, code);
H
Hongze Cheng 已提交
320
  }
H
Hongze Cheng 已提交
321 322
  return code;
}
H
Hongze Cheng 已提交
323

H
Hongze Cheng 已提交
324 325 326
static int32_t tsdbMergeFileSet(SMerger *merger, STFileSet *fset) {
  int32_t code = 0;
  int32_t lino = 0;
H
Hongze Cheng 已提交
327

H
Hongze Cheng 已提交
328
  merger->ctx->fset = fset;
H
Hongze Cheng 已提交
329 330 331
  code = tsdbMergeFileSetBegin(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

H
Hongze Cheng 已提交
332 333 334 335 336 337 338
  // data
  SMetaInfo info;
  SRowInfo *row;
  merger->ctx->tbid->suid = 0;
  merger->ctx->tbid->uid = 0;
  while ((row = tsdbIterMergerGetData(merger->dataIterMerger)) != NULL) {
    if (row->uid != merger->ctx->tbid->uid) {
H
fix bug  
Hongze Cheng 已提交
339 340 341
      merger->ctx->tbid->uid = row->uid;
      merger->ctx->tbid->suid = row->suid;

H
Hongze Cheng 已提交
342
      if (metaGetInfo(merger->tsdb->pVnode->pMeta, row->uid, &info, NULL) != 0) {
H
fix bug  
Hongze Cheng 已提交
343
        code = tsdbIterMergerSkipTableData(merger->dataIterMerger, merger->ctx->tbid);
H
Hongze Cheng 已提交
344 345 346 347 348 349
        TSDB_CHECK_CODE(code, lino, _exit);
        continue;
      }
    }

    code = tsdbFSetWriteRow(merger->writer, row);
H
Hongze Cheng 已提交
350
    TSDB_CHECK_CODE(code, lino, _exit);
H
Hongze Cheng 已提交
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374

    code = tsdbIterMergerNext(merger->dataIterMerger);
    TSDB_CHECK_CODE(code, lino, _exit);
  }

  // tomb
  STombRecord *record;
  merger->ctx->tbid->suid = 0;
  merger->ctx->tbid->uid = 0;
  while ((record = tsdbIterMergerGetTombRecord(merger->tombIterMerger)) != NULL) {
    if (record->uid != merger->ctx->tbid->uid) {
      merger->ctx->tbid->uid = record->uid;
      merger->ctx->tbid->suid = record->suid;

      if (metaGetInfo(merger->tsdb->pVnode->pMeta, record->uid, &info, NULL) != 0) {
        code = tsdbIterMergerSkipTableData(merger->tombIterMerger, merger->ctx->tbid);
        TSDB_CHECK_CODE(code, lino, _exit);
        continue;
      }
    }
    code = tsdbFSetWriteTombRecord(merger->writer, record);
    TSDB_CHECK_CODE(code, lino, _exit);

    code = tsdbIterMergerNext(merger->tombIterMerger);
H
Hongze Cheng 已提交
375 376
    TSDB_CHECK_CODE(code, lino, _exit);
  }
H
Hongze Cheng 已提交
377 378 379 380

  code = tsdbMergeFileSetEnd(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

H
Hongze Cheng 已提交
381 382
_exit:
  if (code) {
H
Hongze Cheng 已提交
383
    tsdbError("vgId:%d %s failed at line %d since %s", TD_VID(merger->tsdb->pVnode), __func__, lino, tstrerror(code));
H
Hongze Cheng 已提交
384
  } else {
H
Hongze Cheng 已提交
385
    tsdbDebug("vgId:%d %s done, fid:%d", TD_VID(merger->tsdb->pVnode), __func__, fset->fid);
H
Hongze Cheng 已提交
386
  }
H
Hongze Cheng 已提交
387
  return code;
H
Hongze Cheng 已提交
388 389
}

H
Hongze Cheng 已提交
390
static int32_t tsdbDoMerge(SMerger *merger) {
H
Hongze Cheng 已提交
391
  int32_t code = 0;
H
Hongze Cheng 已提交
392
  int32_t lino = 0;
H
Hongze Cheng 已提交
393

H
Hongze Cheng 已提交
394 395
  STFileSet *fset;
  TARRAY2_FOREACH(merger->fsetArr, fset) {
396 397 398
    if (TARRAY2_SIZE(fset->lvlArr) == 0) continue;

    SSttLvl *lvl = TARRAY2_FIRST(fset->lvlArr);
H
Hongze Cheng 已提交
399

400
    if (lvl->level != 0 || TARRAY2_SIZE(lvl->fobjArr) < merger->sttTrigger) continue;
H
Hongze Cheng 已提交
401

H
Hongze Cheng 已提交
402 403 404 405 406
    if (!merger->ctx->opened) {
      code = tsdbMergerOpen(merger);
      TSDB_CHECK_CODE(code, lino, _exit);
    }

H
Hongze Cheng 已提交
407 408
    code = tsdbMergeFileSet(merger, fset);
    TSDB_CHECK_CODE(code, lino, _exit);
H
Hongze Cheng 已提交
409 410
  }

H
Hongze Cheng 已提交
411 412
  if (merger->ctx->opened) {
    code = tsdbMergerClose(merger);
H
Hongze Cheng 已提交
413 414
    TSDB_CHECK_CODE(code, lino, _exit);
  }
H
Hongze Cheng 已提交
415

H
Hongze Cheng 已提交
416 417
_exit:
  if (code) {
H
Hongze Cheng 已提交
418
    TSDB_ERROR_LOG(TD_VID(merger->tsdb->pVnode), lino, code);
H
Hongze Cheng 已提交
419
  } else {
H
Hongze Cheng 已提交
420
    tsdbDebug("vgId:%d %s done", TD_VID(merger->tsdb->pVnode), __func__);
H
Hongze Cheng 已提交
421 422 423 424
  }
  return code;
}

H
Hongze Cheng 已提交
425
int32_t tsdbMerge(void *arg) {
H
Hongze Cheng 已提交
426 427
  int32_t code = 0;
  int32_t lino = 0;
H
Hongze Cheng 已提交
428
  STsdb  *tsdb = (STsdb *)arg;
H
Hongze Cheng 已提交
429 430 431 432 433 434

  SMerger merger[1] = {{
      .tsdb = tsdb,
      .sttTrigger = tsdb->pVnode->config.sttTrigger,
  }};

H
Hongze Cheng 已提交
435 436
  ASSERT(merger->sttTrigger > 1);

H
Hongze Cheng 已提交
437
  code = tsdbFSCreateCopySnapshot(tsdb->pFS, &merger->fsetArr);
H
Hongze Cheng 已提交
438 439 440 441 442
  TSDB_CHECK_CODE(code, lino, _exit);

  code = tsdbDoMerge(merger);
  TSDB_CHECK_CODE(code, lino, _exit);

H
Hongze Cheng 已提交
443
  tsdbFSDestroyCopySnapshot(&merger->fsetArr);
H
Hongze Cheng 已提交
444

H
Hongze Cheng 已提交
445 446
_exit:
  if (code) {
H
Hongze Cheng 已提交
447
    TSDB_ERROR_LOG(TD_VID(tsdb->pVnode), lino, code);
H
Hongze Cheng 已提交
448
  } else if (merger->ctx->opened) {
H
Hongze Cheng 已提交
449
    tsdbDebug("vgId:%d %s done", TD_VID(tsdb->pVnode), __func__);
H
Hongze Cheng 已提交
450
  }
H
Hongze Cheng 已提交
451
  return code;
H
Hongze Cheng 已提交
452
}