未验证 提交 f00ddf5c 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2507 from taosdata/hotfix/change_ref_type

change ref-count type
...@@ -6009,7 +6009,7 @@ void qDestroyQueryInfo(qinfo_t qHandle, void (*fp)(void*), void* param) { ...@@ -6009,7 +6009,7 @@ void qDestroyQueryInfo(qinfo_t qHandle, void (*fp)(void*), void* param) {
return; return;
} }
int16_t ref = T_REF_DEC(pQInfo); int32_t ref = T_REF_DEC(pQInfo);
qDebug("QInfo:%p dec refCount, value:%d", pQInfo, ref); qDebug("QInfo:%p dec refCount, value:%d", pQInfo, ref);
if (ref == 0) { if (ref == 0) {
......
...@@ -550,13 +550,13 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) { ...@@ -550,13 +550,13 @@ int tsdbUnlockRepoMeta(STsdbRepo *pRepo) {
} }
void tsdbRefTable(STable *pTable) { void tsdbRefTable(STable *pTable) {
int16_t ref = T_REF_INC(pTable); int32_t ref = T_REF_INC(pTable);
UNUSED(ref); UNUSED(ref);
// tsdbDebug("ref table %"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref); // tsdbDebug("ref table %"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref);
} }
void tsdbUnRefTable(STable *pTable) { void tsdbUnRefTable(STable *pTable) {
int16_t ref = T_REF_DEC(pTable); int32_t ref = T_REF_DEC(pTable);
tsdbDebug("unref table uid:%"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref); tsdbDebug("unref table uid:%"PRIu64", tid:%d, refCount:%d", TABLE_UID(pTable), TABLE_TID(pTable), ref);
if (ref == 0) { if (ref == 0) {
...@@ -1252,4 +1252,4 @@ static int tsdbRmTableFromMeta(STsdbRepo *pRepo, STable *pTable) { ...@@ -1252,4 +1252,4 @@ static int tsdbRmTableFromMeta(STsdbRepo *pRepo, STable *pTable) {
} }
return 0; return 0;
} }
\ No newline at end of file
...@@ -22,7 +22,7 @@ typedef void (*_ref_fn_t)(const void* pObj); ...@@ -22,7 +22,7 @@ typedef void (*_ref_fn_t)(const void* pObj);
#define T_REF_DECLARE() \ #define T_REF_DECLARE() \
struct { \ struct { \
int16_t val; \ int32_t val; \
} _ref; } _ref;
#define T_REF_REGISTER_FUNC(s, e) \ #define T_REF_REGISTER_FUNC(s, e) \
...@@ -31,7 +31,7 @@ typedef void (*_ref_fn_t)(const void* pObj); ...@@ -31,7 +31,7 @@ typedef void (*_ref_fn_t)(const void* pObj);
_ref_fn_t end; \ _ref_fn_t end; \
} _ref_func = {.begin = (s), .end = (e)}; } _ref_func = {.begin = (s), .end = (e)};
#define T_REF_INC(x) (atomic_add_fetch_16(&((x)->_ref.val), 1)) #define T_REF_INC(x) (atomic_add_fetch_32(&((x)->_ref.val), 1))
#define T_REF_INC_WITH_CB(x, p) \ #define T_REF_INC_WITH_CB(x, p) \
do { \ do { \
...@@ -41,11 +41,11 @@ typedef void (*_ref_fn_t)(const void* pObj); ...@@ -41,11 +41,11 @@ typedef void (*_ref_fn_t)(const void* pObj);
} \ } \
} while (0) } while (0)
#define T_REF_DEC(x) (atomic_sub_fetch_16(&((x)->_ref.val), 1)) #define T_REF_DEC(x) (atomic_sub_fetch_32(&((x)->_ref.val), 1))
#define T_REF_DEC_WITH_CB(x, p) \ #define T_REF_DEC_WITH_CB(x, p) \
do { \ do { \
int32_t v = atomic_sub_fetch_16(&((x)->_ref.val), 1); \ int32_t v = atomic_sub_fetch_32(&((x)->_ref.val), 1); \
if (v == 0 && (p)->_ref_func.end != NULL) { \ if (v == 0 && (p)->_ref_func.end != NULL) { \
(p)->_ref_func.end((x)); \ (p)->_ref_func.end((x)); \
} \ } \
......
...@@ -415,7 +415,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) { ...@@ -415,7 +415,7 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
} }
*data = NULL; *data = NULL;
int16_t ref = T_REF_DEC(pNode); int32_t ref = T_REF_DEC(pNode);
uDebug("%p data released, refcnt:%d", pNode, ref); uDebug("%p data released, refcnt:%d", pNode, ref);
if (_remove) { if (_remove) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册