From 88171545f8e78fdb6e49110297634d5524df94f0 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Tue, 11 Aug 2020 03:58:41 +0000 Subject: [PATCH] TD-1081 change cache key --- src/mnode/src/mnodeShow.c | 6 ++++-- src/plugins/http/src/httpContext.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mnode/src/mnodeShow.c b/src/mnode/src/mnodeShow.c index aec946722f..8a84b66a33 100644 --- a/src/mnode/src/mnodeShow.c +++ b/src/mnode/src/mnodeShow.c @@ -377,7 +377,8 @@ static bool mnodeCheckShowFinished(SShowObj *pShow) { } static bool mnodeAccquireShowObj(SShowObj *pShow) { - SShowObj **ppShow = taosCacheAcquireByKey(tsMnodeShowCache, &pShow, sizeof(int64_t)); + uint64_t handleVal = (uint64_t)pShow; + SShowObj **ppShow = taosCacheAcquireByKey(tsMnodeShowCache, &handleVal, sizeof(int64_t)); if (ppShow) { mDebug("%p, show is accquired from cache, data:%p, index:%d", pShow, ppShow, pShow->index); return true; @@ -389,7 +390,8 @@ static bool mnodeAccquireShowObj(SShowObj *pShow) { static void* mnodePutShowObj(SShowObj *pShow) { if (tsMnodeShowCache != NULL) { pShow->index = atomic_add_fetch_32(&tsShowObjIndex, 1); - SShowObj **ppShow = taosCachePut(tsMnodeShowCache, &pShow, sizeof(int64_t), &pShow, sizeof(int64_t), 6000); + uint64_t handleVal = (uint64_t)pShow; + SShowObj **ppShow = taosCachePut(tsMnodeShowCache, &handleVal, sizeof(int64_t), &pShow, sizeof(int64_t), 6000); pShow->ppShow = (void**)ppShow; mDebug("%p, show is put into cache, data:%p index:%d", pShow, ppShow, pShow->index); return pShow; diff --git a/src/plugins/http/src/httpContext.c b/src/plugins/http/src/httpContext.c index 38b829e406..5ef3c9a66e 100644 --- a/src/plugins/http/src/httpContext.c +++ b/src/plugins/http/src/httpContext.c @@ -108,7 +108,8 @@ HttpContext *httpCreateContext(int32_t fd) { pContext->lastAccessTime = taosGetTimestampSec(); pContext->state = HTTP_CONTEXT_STATE_READY; - HttpContext **ppContext = taosCachePut(tsHttpServer.contextCache, &pContext, sizeof(int64_t), &pContext, sizeof(int64_t), 3000); + uint64_t handleVal = (uint64_t)pContext; + HttpContext **ppContext = taosCachePut(tsHttpServer.contextCache, &handleVal, sizeof(int64_t), &pContext, sizeof(int64_t), 3000); pContext->ppContext = ppContext; httpDebug("context:%p, fd:%d, is created, data:%p", pContext, fd, ppContext); @@ -119,7 +120,8 @@ HttpContext *httpCreateContext(int32_t fd) { } HttpContext *httpGetContext(void *ptr) { - HttpContext **ppContext = taosCacheAcquireByKey(tsHttpServer.contextCache, &ptr, sizeof(HttpContext *)); + uint64_t handleVal = (uint64_t)ptr; + HttpContext **ppContext = taosCacheAcquireByKey(tsHttpServer.contextCache, &handleVal, sizeof(HttpContext *)); if (ppContext) { HttpContext *pContext = *ppContext; -- GitLab