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

taosdata / TDengine / #3532

20 Nov 2024 07:11AM UTC coverage: 60.78% (+0.6%) from 60.213%
#3532

push

travis-ci

web-flow
Merge pull request #28823 from taosdata/fix/3.0/TD-32587

fix:[TD-32587]fix stmt segmentation fault

119943 of 252352 branches covered (47.53%)

Branch coverage included in aggregate %.

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

463 existing lines in 99 files now uncovered.

200682 of 275165 relevant lines covered (72.93%)

15642683.31 hits per line

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

69.37
/source/util/src/tref.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
#define _DEFAULT_SOURCE
17
#include "tref.h"
18
#include "taoserror.h"
19
#include "tlog.h"
20
#include "tutil.h"
21

22
#define TSDB_REF_OBJECTS        100
23
#define TSDB_REF_STATE_EMPTY    0
24
#define TSDB_REF_STATE_ACTIVE   1
25
#define TSDB_REF_STATE_DELETED  2
26
#define TSDB_REF_ITER_THRESHOLD 100
27

28
typedef struct SRefNode {
29
  struct SRefNode *prev;     // previous node
30
  struct SRefNode *next;     // next node
31
  void            *p;        // pointer to resource protected,
32
  int64_t          rid;      // reference ID
33
  int32_t          count;    // number of references
34
  int32_t          removed;  // 1: removed
35
} SRefNode;
36

37
typedef struct {
38
  SRefNode **nodeList;  // array of SRefNode linked list
39
  int32_t    state;     // 0: empty, 1: active;  2: deleted
40
  int32_t    rsetId;    // refSet ID, global unique
41
  int64_t    rid;       // increase by one for each new reference
42
  int32_t    max;       // mod
43
  int32_t    count;     // total number of SRefNodes in this set
44
  int64_t   *lockedBy;
45
  void (*fp)(void *);
46
} SRefSet;
47

48
static SRefSet       tsRefSetList[TSDB_REF_OBJECTS];
49
static TdThreadOnce  tsRefModuleInit = PTHREAD_ONCE_INIT;
50
static TdThreadMutex tsRefMutex;
51
static int32_t       tsRefSetNum = 0;
52
static int32_t       tsNextId = 0;
53

54
static void    taosInitRefModule(void);
55
static void    taosLockList(int64_t *lockedBy);
56
static void    taosUnlockList(int64_t *lockedBy);
57
static void    taosIncRsetCount(SRefSet *pSet);
58
static void    taosDecRsetCount(SRefSet *pSet);
59
static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int32_t *isReleased);
60

61
int32_t taosOpenRef(int32_t max, RefFp fp) {
131,602✔
62
  SRefNode **nodeList;
63
  SRefSet   *pSet;
64
  int64_t   *lockedBy;
65
  int32_t    i, rsetId;
66

67
  (void)taosThreadOnce(&tsRefModuleInit, taosInitRefModule);
131,602✔
68

69
  nodeList = taosMemoryCalloc(sizeof(SRefNode *), (size_t)max);
131,602✔
70
  if (nodeList == NULL) {
131,602!
71
    return terrno;
×
72
  }
73

74
  lockedBy = taosMemoryCalloc(sizeof(int64_t), (size_t)max);
131,602✔
75
  if (lockedBy == NULL) {
131,602!
76
    taosMemoryFree(nodeList);
×
77
    return terrno;
×
78
  }
79

80
  (void)taosThreadMutexLock(&tsRefMutex);
131,602✔
81

82
  for (i = 0; i < TSDB_REF_OBJECTS; ++i) {
131,602!
83
    tsNextId = (tsNextId + 1) % TSDB_REF_OBJECTS;
131,602✔
84
    if (tsNextId == 0) tsNextId = 1;  // dont use 0 as rsetId
131,602!
85
    if (tsRefSetList[tsNextId].state == TSDB_REF_STATE_EMPTY) break;
131,602!
86
  }
87

88
  if (i < TSDB_REF_OBJECTS) {
131,602!
89
    rsetId = tsNextId;
131,602✔
90
    pSet = tsRefSetList + rsetId;
131,602✔
91
    pSet->max = max;
131,602✔
92
    pSet->nodeList = nodeList;
131,602✔
93
    pSet->lockedBy = lockedBy;
131,602✔
94
    pSet->fp = fp;
131,602✔
95
    pSet->rid = 1;
131,602✔
96
    pSet->rsetId = rsetId;
131,602✔
97
    pSet->state = TSDB_REF_STATE_ACTIVE;
131,602✔
98
    taosIncRsetCount(pSet);
131,602✔
99

100
    tsRefSetNum++;
131,602✔
101
    uTrace("rsetId:%d is opened, max:%d, fp:%p refSetNum:%d", rsetId, max, fp, tsRefSetNum);
131,602✔
102
  } else {
103
    rsetId = TSDB_CODE_REF_FULL;
×
104
    taosMemoryFree(nodeList);
×
105
    taosMemoryFree(lockedBy);
×
106
    uTrace("run out of Ref ID, maximum:%d refSetNum:%d", TSDB_REF_OBJECTS, tsRefSetNum);
×
107
  }
108

109
  (void)taosThreadMutexUnlock(&tsRefMutex);
131,602✔
110

111
  return rsetId;
131,602✔
112
}
113

114
void taosCloseRef(int32_t rsetId) {
114,885✔
115
  SRefSet *pSet;
116
  int32_t  deleted = 0;
114,885✔
117

118
  if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) {
114,885!
119
    uTrace("rsetId:%d is invalid, out of range", rsetId);
×
120
    return;
×
121
  }
122

123
  pSet = tsRefSetList + rsetId;
114,885✔
124

125
  (void)taosThreadMutexLock(&tsRefMutex);
114,885✔
126

127
  if (pSet->state == TSDB_REF_STATE_ACTIVE) {
114,885✔
128
    pSet->state = TSDB_REF_STATE_DELETED;
110,908✔
129
    deleted = 1;
110,908✔
130
    uTrace("rsetId:%d is closed, count:%d", rsetId, pSet->count);
110,908✔
131
  } else {
132
    uTrace("rsetId:%d is already closed, count:%d", rsetId, pSet->count);
3,977✔
133
  }
134

135
  (void)taosThreadMutexUnlock(&tsRefMutex);
114,885✔
136

137
  if (deleted) taosDecRsetCount(pSet);
114,885✔
138
}
139

140
int64_t taosAddRef(int32_t rsetId, void *p) {
34,897,820✔
141
  int32_t   hash;
142
  SRefNode *pNode;
143
  SRefSet  *pSet;
144
  int64_t   rid = 0;
34,897,820✔
145

146
  if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) {
34,897,820!
147
    uTrace("rsetId:%d p:%p failed to add, rsetId not valid", rsetId, p);
×
148
    return terrno = TSDB_CODE_REF_INVALID_ID;
×
149
  }
150

151
  pSet = tsRefSetList + rsetId;
34,943,020✔
152
  taosIncRsetCount(pSet);
34,943,020✔
153
  if (pSet->state != TSDB_REF_STATE_ACTIVE) {
35,014,073!
154
    taosDecRsetCount(pSet);
×
155
    uTrace("rsetId:%d p:%p failed to add, not active", rsetId, p);
×
156
    return terrno = TSDB_CODE_REF_ID_REMOVED;
×
157
  }
158

159
  pNode = taosMemoryCalloc(sizeof(SRefNode), 1);
35,014,073✔
160
  if (pNode == NULL) {
34,977,444!
161
    taosDecRsetCount(pSet);
×
162
    uError("rsetId:%d p:%p failed to add, out of memory", rsetId, p);
×
163
    return terrno;
×
164
  }
165

166
  rid = atomic_add_fetch_64(&pSet->rid, 1);
34,977,444✔
167
  hash = rid % pSet->max;
35,038,435✔
168
  taosLockList(pSet->lockedBy + hash);
35,038,435✔
169

170
  pNode->p = p;
35,026,492✔
171
  pNode->rid = rid;
35,026,492✔
172
  pNode->count = 1;
35,026,492✔
173

174
  pNode->prev = NULL;
35,026,492✔
175
  pNode->next = pSet->nodeList[hash];
35,026,492✔
176
  if (pSet->nodeList[hash]) pSet->nodeList[hash]->prev = pNode;
35,026,492✔
177
  pSet->nodeList[hash] = pNode;
35,026,492✔
178

179
  uTrace("rsetId:%d p:%p rid:%" PRId64 " is added, count:%d, remain count:%d", rsetId, p, rid, pSet->count,
35,026,492✔
180
         pNode->count);
181

182
  taosUnlockList(pSet->lockedBy + hash);
35,026,500✔
183

184
  return rid;
34,980,946✔
185
}
186

187
int32_t taosRemoveRef(int32_t rsetId, int64_t rid) { return taosDecRefCount(rsetId, rid, 1, NULL); }
34,935,775✔
188

189
// if rid is 0, return the first p in hash list, otherwise, return the next after current rid
190
void *taosAcquireRef(int32_t rsetId, int64_t rid) {
433,339,507✔
191
  int32_t   hash;
192
  SRefNode *pNode;
193
  SRefSet  *pSet;
194
  int32_t   iter = 0;
433,339,507✔
195
  void     *p = NULL;
433,339,507✔
196

197
  if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) {
433,339,507!
198
    // uTrace("rsetId:%d rid:%" PRId64 " failed to acquire, rsetId not valid", rsetId, rid);
199
    terrno = TSDB_CODE_REF_INVALID_ID;
×
200
    return NULL;
×
201
  }
202

203
  if (rid <= 0) {
434,142,494✔
204
    uTrace("rsetId:%d rid:%" PRId64 " failed to acquire, rid not valid", rsetId, rid);
1,091,461✔
205
    terrno = TSDB_CODE_REF_NOT_EXIST;
1,091,461✔
206
    return NULL;
1,091,461✔
207
  }
208

209
  pSet = tsRefSetList + rsetId;
433,051,033✔
210
  taosIncRsetCount(pSet);
433,051,033✔
211
  if (pSet->state != TSDB_REF_STATE_ACTIVE) {
434,822,478!
212
    uTrace("rsetId:%d rid:%" PRId64 " failed to acquire, not active", rsetId, rid);
×
213
    taosDecRsetCount(pSet);
×
214
    terrno = TSDB_CODE_REF_ID_REMOVED;
×
215
    return NULL;
×
216
  }
217

218
  hash = rid % pSet->max;
434,822,478✔
219
  taosLockList(pSet->lockedBy + hash);
434,822,478✔
220

221
  pNode = pSet->nodeList[hash];
435,453,681✔
222

223
  while (pNode) {
436,480,321✔
224
    if (pNode->rid == rid) {
418,422,326✔
225
      break;
417,395,686✔
226
    }
227
    iter++;
1,026,640✔
228
    pNode = pNode->next;
1,026,640✔
229
  }
230

231
  if (iter >= TSDB_REF_ITER_THRESHOLD) {
435,453,681!
232
    uWarn("rsetId:%d rid:%" PRId64 " iter:%d", rsetId, rid, iter);
×
233
  }
234

235
  if (pNode) {
435,616,079✔
236
    if (pNode->removed == 0) {
417,242,377✔
237
      pNode->count++;
416,448,374✔
238
      p = pNode->p;
416,448,374✔
239
      uTrace("rsetId:%d p:%p rid:%" PRId64 " is acquired, remain count:%d", rsetId, pNode->p, rid, pNode->count);
416,448,374✔
240
    } else {
241
      terrno = TSDB_CODE_REF_NOT_EXIST;
794,003✔
242
      uTrace("rsetId:%d p:%p rid:%" PRId64 " is already removed, failed to acquire", rsetId, pNode->p, rid);
840,667✔
243
    }
244
  } else {
245
    terrno = TSDB_CODE_REF_NOT_EXIST;
18,373,702✔
246
    uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to acquire", rsetId, rid);
18,355,249✔
247
  }
248

249
  taosUnlockList(pSet->lockedBy + hash);
435,644,854✔
250

251
  taosDecRsetCount(pSet);
433,975,985✔
252

253
  return p;
434,720,447✔
254
}
255

256
int32_t taosReleaseRef(int32_t rsetId, int64_t rid) { return taosDecRefCount(rsetId, rid, 0, NULL); }
414,780,985✔
257
int32_t taosReleaseRefEx(int32_t rsetId, int64_t rid, int32_t *isReleased) {
10,436,767✔
258
  return taosDecRefCount(rsetId, rid, 0, isReleased);
10,436,767✔
259
}
260

261
// if rid is 0, return the first p in hash list, otherwise, return the next after current rid
262
void *taosIterateRef(int32_t rsetId, int64_t rid) {
1,158,077✔
263
  SRefNode *pNode = NULL;
1,158,077✔
264
  SRefSet  *pSet;
265

266
  if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) {
1,158,077!
267
    uTrace("rsetId:%d rid:%" PRId64 " failed to iterate, rsetId not valid", rsetId, rid);
×
268
    terrno = TSDB_CODE_REF_INVALID_ID;
×
269
    return NULL;
×
270
  }
271

272
  if (rid < 0) {
1,158,077!
273
    uTrace("rsetId:%d rid:%" PRId64 " failed to iterate, rid not valid", rsetId, rid);
×
274
    terrno = TSDB_CODE_REF_NOT_EXIST;
×
275
    return NULL;
×
276
  }
277

278
  void *newP = NULL;
1,158,077✔
279
  pSet = tsRefSetList + rsetId;
1,158,077✔
280
  taosIncRsetCount(pSet);
1,158,077✔
281
  if (pSet->state != TSDB_REF_STATE_ACTIVE) {
1,158,077!
282
    uTrace("rsetId:%d rid:%" PRId64 " failed to iterate, rset not active", rsetId, rid);
×
283
    terrno = TSDB_CODE_REF_ID_REMOVED;
×
284
    taosDecRsetCount(pSet);
×
285
    return NULL;
×
286
  }
287

288
  do {
289
    newP = NULL;
1,158,077✔
290
    int32_t hash = 0;
1,158,077✔
291
    int32_t iter = 0;
1,158,077✔
292
    if (rid > 0) {
1,158,077✔
293
      hash = rid % pSet->max;
1,040,677✔
294
      taosLockList(pSet->lockedBy + hash);
1,040,677✔
295

296
      pNode = pSet->nodeList[hash];
1,040,677✔
297
      while (pNode) {
1,955,804!
298
        if (pNode->rid == rid) break;
1,955,804✔
299
        pNode = pNode->next;
915,127✔
300
        iter++;
915,127✔
301
      }
302

303
      if (iter >= TSDB_REF_ITER_THRESHOLD) {
1,040,677!
304
        uWarn("rsetId:%d rid:%" PRId64 " iter:%d", rsetId, rid, iter);
×
305
      }
306

307
      if (pNode == NULL) {
1,040,677!
308
        uError("rsetId:%d rid:%" PRId64 " not there, quit", rsetId, rid);
×
309
        terrno = TSDB_CODE_REF_NOT_EXIST;
×
310
        taosUnlockList(pSet->lockedBy + hash);
×
311
        taosDecRsetCount(pSet);
×
312
        return NULL;
×
313
      }
314

315
      // rid is there
316
      pNode = pNode->next;
1,040,677✔
317
      // check first place
318
      while (pNode) {
1,040,677✔
319
        if (!pNode->removed) break;
499,764!
320
        pNode = pNode->next;
×
321
      }
322
      if (pNode == NULL) {
1,040,677✔
323
        taosUnlockList(pSet->lockedBy + hash);
540,913✔
324
        hash++;
540,913✔
325
      }
326
    }
327

328
    if (pNode == NULL) {
1,158,077✔
329
      for (; hash < pSet->max; ++hash) {
10,105,232✔
330
        taosLockList(pSet->lockedBy + hash);
9,987,832✔
331
        pNode = pSet->nodeList[hash];
9,987,832✔
332
        if (pNode) {
9,987,832✔
333
          // check first place
334
          while (pNode) {
540,913!
335
            if (!pNode->removed) break;
540,913!
336
            pNode = pNode->next;
×
337
          }
338
          if (pNode) break;
540,913!
339
        }
340
        taosUnlockList(pSet->lockedBy + hash);
9,446,919✔
341
      }
342
    }
343

344
    if (pNode) {
1,158,077✔
345
      pNode->count++;  // acquire it
1,040,677✔
346
      newP = pNode->p;
1,040,677✔
347
      taosUnlockList(pSet->lockedBy + hash);
1,040,677✔
348
      uTrace("rsetId:%d p:%p rid:%" PRId64 " is returned", rsetId, newP, rid);
1,040,677✔
349
    } else {
350
      uTrace("rsetId:%d the list is over", rsetId);
117,400✔
351
    }
352

353
    if (rid > 0) taosReleaseRef(rsetId, rid);  // release the current one
1,158,077✔
354
    if (pNode) rid = pNode->rid;
1,158,077✔
355
  } while (newP && pNode->removed);
1,158,077!
356

357
  taosDecRsetCount(pSet);
1,158,077✔
358

359
  return newP;
1,158,077✔
360
}
361

362
int32_t taosListRef() {
×
363
  SRefSet  *pSet;
364
  SRefNode *pNode;
365
  int32_t   num = 0;
×
366

367
  (void)taosThreadMutexLock(&tsRefMutex);
×
368

369
  for (int32_t i = 0; i < TSDB_REF_OBJECTS; ++i) {
×
370
    pSet = tsRefSetList + i;
×
371

372
    if (pSet->state == TSDB_REF_STATE_EMPTY) continue;
×
373

374
    uInfo("rsetId:%d state:%d count:%d", i, pSet->state, pSet->count);
×
375

376
    for (int32_t j = 0; j < pSet->max; ++j) {
×
377
      pNode = pSet->nodeList[j];
×
378

379
      while (pNode) {
×
380
        uInfo("rsetId:%d p:%p rid:%" PRId64 "count:%d", i, pNode->p, pNode->rid, pNode->count);
×
381
        pNode = pNode->next;
×
382
        num++;
×
383
      }
384
    }
385
  }
386

387
  (void)taosThreadMutexUnlock(&tsRefMutex);
×
388

389
  return num;
×
390
}
391

392
static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int32_t *isReleased) {
458,342,452✔
393
  int32_t   hash;
394
  SRefSet  *pSet;
395
  SRefNode *pNode;
396
  int32_t   iter = 0;
458,342,452✔
397
  int32_t   released = 0;
458,342,452✔
398
  int32_t   code = 0;
458,342,452✔
399

400
  if (rsetId < 0 || rsetId >= TSDB_REF_OBJECTS) {
458,342,452!
401
    uTrace("rsetId:%d rid:%" PRId64 " failed to remove, rsetId not valid", rsetId, rid);
×
402
    return terrno = TSDB_CODE_REF_INVALID_ID;
×
403
  }
404

405
  if (rid <= 0) {
458,929,436✔
406
    uTrace("rsetId:%d rid:%" PRId64 " failed to remove, rid not valid", rsetId, rid);
9,462,719✔
407
    return terrno = TSDB_CODE_REF_NOT_EXIST;
9,462,719✔
408
  }
409

410
  pSet = tsRefSetList + rsetId;
449,466,717✔
411
  if (pSet->state == TSDB_REF_STATE_EMPTY) {
449,466,717✔
412
    uTrace("rsetId:%d rid:%" PRId64 " failed to remove, cleaned", rsetId, rid);
107,389✔
413
    return terrno = TSDB_CODE_REF_ID_REMOVED;
107,389✔
414
  }
415

416
  hash = rid % pSet->max;
449,359,328✔
417
  taosLockList(pSet->lockedBy + hash);
449,359,328✔
418

419
  pNode = pSet->nodeList[hash];
451,890,064✔
420
  while (pNode) {
453,831,560!
421
    if (pNode->rid == rid) break;
454,076,662✔
422

423
    pNode = pNode->next;
1,941,496✔
424
    iter++;
1,941,496✔
425
  }
426

427
  if (iter >= TSDB_REF_ITER_THRESHOLD) {
451,890,064!
428
    uWarn("rsetId:%d rid:%" PRId64 " iter:%d", rsetId, rid, iter);
×
429
  }
430

431
  if (pNode) {
451,924,988✔
432
    pNode->count--;
451,923,236✔
433
    if (remove) pNode->removed = 1;
451,923,236✔
434

435
    if (pNode->count <= 0) {
451,923,236✔
436
      if (pNode->prev) {
34,910,856✔
437
        pNode->prev->next = pNode->next;
725✔
438
      } else {
439
        pSet->nodeList[hash] = pNode->next;
34,910,131✔
440
      }
441

442
      if (pNode->next) {
34,910,856✔
443
        pNode->next->prev = pNode->prev;
38,757✔
444
      }
445
      released = 1;
34,910,856✔
446
    } else {
447
      uTrace("rsetId:%d p:%p rid:%" PRId64 " is released, remain count %d", rsetId, pNode->p, rid, pNode->count);
417,012,380✔
448
    }
449
  } else {
450
    uTrace("rsetId:%d rid:%" PRId64 " is not there, failed to release/remove", rsetId, rid);
1,752✔
451
    terrno = TSDB_CODE_REF_NOT_EXIST;
1,752✔
452
    code = terrno;
1,750✔
453
  }
454

455
  taosUnlockList(pSet->lockedBy + hash);
451,925,024✔
456

457
  if (released) {
450,996,215✔
458
    uTrace("rsetId:%d p:%p rid:%" PRId64 " is removed, count:%d, free mem: %p", rsetId, pNode->p, rid, pSet->count,
34,886,149✔
459
           pNode);
460
    (*pSet->fp)(pNode->p);
34,886,150✔
461
    taosMemoryFree(pNode);
34,913,041✔
462

463
    taosDecRsetCount(pSet);
34,917,939✔
464
  }
465

466
  if (isReleased) {
451,042,668✔
467
    *isReleased = released;
10,458,452✔
468
  }
469

470
  return code;
451,042,668✔
471
}
472

473
static void taosLockList(int64_t *lockedBy) {
922,045,688✔
474
  int64_t tid = taosGetSelfPthreadId();
922,045,688✔
475
  int32_t i = 0;
918,342,790✔
476
  while (atomic_val_compare_exchange_64(lockedBy, 0, tid) != 0) {
1,321,818,201✔
477
    if (++i % 100 == 0) {
403,475,923✔
478
      (void)sched_yield();
3,942,397✔
479
    }
480
  }
481
}
930,425,927✔
482

483
static void taosUnlockList(int64_t *lockedBy) {
922,452,451✔
484
  int64_t tid = taosGetSelfPthreadId();
922,452,451✔
485
  (void)atomic_val_compare_exchange_64(lockedBy, tid, 0);
918,373,449✔
486
}
926,271,790✔
487

488
static void taosInitRefModule(void) { (void)taosThreadMutexInit(&tsRefMutex, NULL); }
9,011✔
489

490
static void taosIncRsetCount(SRefSet *pSet) {
467,759,803✔
491
  (void)atomic_add_fetch_32(&pSet->count, 1);
467,759,803✔
492
  // uTrace("rsetId:%d inc count:%d", pSet->rsetId, count);
493
}
470,883,069✔
494

495
static void taosDecRsetCount(SRefSet *pSet) {
469,073,797✔
496
  int32_t count = atomic_sub_fetch_32(&pSet->count, 1);
469,073,797✔
497
  // uTrace("rsetId:%d dec count:%d", pSet->rsetId, count);
498

499
  if (count > 0) return;
470,908,948!
500

UNCOV
501
  (void)taosThreadMutexLock(&tsRefMutex);
×
502

503
  if (pSet->state != TSDB_REF_STATE_EMPTY) {
105,288!
504
    pSet->state = TSDB_REF_STATE_EMPTY;
105,288✔
505
    pSet->max = 0;
105,288✔
506
    pSet->fp = NULL;
105,288✔
507

508
    taosMemoryFreeClear(pSet->nodeList);
105,288!
509
    taosMemoryFreeClear(pSet->lockedBy);
105,288!
510

511
    tsRefSetNum--;
105,288✔
512
    uTrace("rsetId:%d is cleaned, refSetNum:%d count:%d", pSet->rsetId, tsRefSetNum, pSet->count);
105,288✔
513
  }
514

515
  (void)taosThreadMutexUnlock(&tsRefMutex);
105,288✔
516
}
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