提交 35f74ce2 编写于 作者: M Minglei Jin

cache/schema: not cache schema

上级 f95867d2
...@@ -326,20 +326,15 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow ...@@ -326,20 +326,15 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
int32_t code = 0; int32_t code = 0;
// 1, fetch schema // 1, fetch schema
STSchema *pTSchema = pTsdb->rCache.pTSchema; STSchema *pTSchema = NULL;
int32_t sver = TSDBROW_SVERSION(pRow); int32_t sver = TSDBROW_SVERSION(pRow);
if (!pTSchema || sver != pTSchema->version) {
if (pTSchema) {
taosMemoryFree(pTSchema);
}
code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema);
if (code != TSDB_CODE_SUCCESS) {
terrno = code;
return -1;
}
pTsdb->rCache.pTSchema = pTSchema; code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema);
if (code != TSDB_CODE_SUCCESS) {
terrno = code;
return -1;
} }
// 2, iterate col values into array // 2, iterate col values into array
SArray *aColVal = taosArrayInit(32, sizeof(SColVal)); SArray *aColVal = taosArrayInit(32, sizeof(SColVal));
...@@ -463,7 +458,7 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow ...@@ -463,7 +458,7 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
_exit: _exit:
taosArrayDestroy(aColVal); taosArrayDestroy(aColVal);
// taosMemoryFree(pTSchema); taosMemoryFree(pTSchema);
return code; return code;
} }
...@@ -908,15 +903,12 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR ...@@ -908,15 +903,12 @@ int32_t tsdbCacheGet(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArray, SCacheRowsR
int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey) { int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKEY eKey) {
int32_t code = 0; int32_t code = 0;
// fetch schema // fetch schema
STSchema *pTSchema = pTsdb->rCache.pTSchema; STSchema *pTSchema = NULL;
if (!pTSchema) { int sver = -1;
code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, -1, &pTSchema); code = metaGetTbTSchemaEx(pTsdb->pVnode->pMeta, suid, uid, sver, &pTSchema);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
terrno = code; terrno = code;
return -1; return -1;
}
pTsdb->rCache.pTSchema = pTSchema;
} }
// build keys & multi get from rocks // build keys & multi get from rocks
...@@ -983,7 +975,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE ...@@ -983,7 +975,7 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
taosThreadMutexUnlock(&pTsdb->rCache.rMutex); taosThreadMutexUnlock(&pTsdb->rCache.rMutex);
_exit: _exit:
// taosMemoryFree(pTSchema); taosMemoryFree(pTSchema);
return code; return code;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册