From 125636e9a5f9c814f79b22ef43a1c1b5c764ae20 Mon Sep 17 00:00:00 2001 From: slguan Date: Sat, 13 Jul 2019 10:19:35 +0800 Subject: [PATCH] Modify the location of the cache count --- src/client/inc/tscSecondaryMerge.h | 1 + src/client/src/tscParseInsert.c | 1 - src/client/src/tscSQLParser.c | 3 ++- src/util/src/tcache.c | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client/inc/tscSecondaryMerge.h b/src/client/inc/tscSecondaryMerge.h index 09e23adcb1..2f47fe36d5 100644 --- a/src/client/inc/tscSecondaryMerge.h +++ b/src/client/inc/tscSecondaryMerge.h @@ -20,6 +20,7 @@ extern "C" { #endif +#include "taosmsg.h" #include "textbuffer.h" #include "tinterpolation.h" #include "tlosertree.h" diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index 1951b1249d..6de2d3bb87 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index e786e6b134..e153344cb4 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -3949,7 +3949,8 @@ int32_t parseCreateDBOptions(SCreateDBInfo* pCreateDbSql, SSqlCmd* pCmd) { if (pCreateDbSql->keep != NULL) { switch (pCreateDbSql->keep->nExpr) { - case 1:pMsg->daysToKeep = htonl(pCreateDbSql->keep->a[0].pVar.i64Key); + case 1: + pMsg->daysToKeep = htonl(pCreateDbSql->keep->a[0].pVar.i64Key); break; case 2: { pMsg->daysToKeep = htonl(pCreateDbSql->keep->a[0].pVar.i64Key); diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 4396d9fda9..ab887637cb 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -521,10 +521,12 @@ void *taosGetDataFromCache(void *handle, char *key) { pthread_rwlock_rdlock(&pObj->lock); SDataNode *ptNode = taosGetNodeFromHashTable(handle, key, keyLen); + if (ptNode != NULL) { + ptNode->refCount += 1; + } pthread_rwlock_unlock(&pObj->lock); if (ptNode != NULL) { - __sync_add_and_fetch_32(&ptNode->refCount, 1); __sync_add_and_fetch_32(&pObj->statistics.hitCount, 1); pTrace("key:%s is retrieved from cache,refcnt:%d", key, ptNode->refCount); -- GitLab