提交 d5435926 编写于 作者: K kailixu

chore: more code

上级 14b438ec
......@@ -68,7 +68,7 @@ struct SMetaCache {
} STbGroupResCache;
struct STbFilterCache {
SHashObj* pTkLogStb;
SHashObj* pStb;
} STbFilterCache;
};
......@@ -172,9 +172,8 @@ int32_t metaCacheOpen(SMeta* pMeta) {
taosHashSetFreeFp(pCache->STbGroupResCache.pTableEntry, freeCacheEntryFp);
taosThreadMutexInit(&pCache->STbGroupResCache.lock, NULL);
pCache->STbFilterCache.pTkLogStb =
taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
if (pCache->STbFilterCache.pTkLogStb == NULL) {
pCache->STbFilterCache.pStb = taosHashInit(0, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
if (pCache->STbFilterCache.pStb == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err2;
}
......@@ -204,7 +203,7 @@ void metaCacheClose(SMeta* pMeta) {
taosThreadMutexDestroy(&pMeta->pCache->STbGroupResCache.lock);
taosHashCleanup(pMeta->pCache->STbGroupResCache.pTableEntry);
taosHashCleanup(pMeta->pCache->STbFilterCache.pTkLogStb);
taosHashCleanup(pMeta->pCache->STbFilterCache.pStb);
taosMemoryFree(pMeta->pCache);
pMeta->pCache = NULL;
......@@ -897,7 +896,7 @@ int32_t metaTbGroupCacheClear(SMeta* pMeta, uint64_t suid) {
bool metaTbInFilterCache(void* pVnode, tb_uid_t suid, int8_t type) {
SMeta* pMeta = ((SVnode*)pVnode)->pMeta;
if (type == 0 && taosHashGet(pMeta->pCache->STbFilterCache.pTkLogStb, &suid, sizeof(suid))) {
if (type == 0 && taosHashGet(pMeta->pCache->STbFilterCache.pStb, &suid, sizeof(suid))) {
return true;
}
......@@ -908,7 +907,7 @@ int32_t metaPutTbToFilterCache(void* pVnode, tb_uid_t suid, int8_t type) {
SMeta* pMeta = ((SVnode*)pVnode)->pMeta;
if (type == 0) {
return taosHashPut(pMeta->pCache->STbFilterCache.pTkLogStb, &suid, sizeof(suid), NULL, 0);
return taosHashPut(pMeta->pCache->STbFilterCache.pStb, &suid, sizeof(suid), NULL, 0);
}
return 0;
......@@ -917,7 +916,7 @@ int32_t metaPutTbToFilterCache(void* pVnode, tb_uid_t suid, int8_t type) {
int32_t metaSizeOfTbFilterCache(void* pVnode, int8_t type) {
SMeta* pMeta = ((SVnode*)pVnode)->pMeta;
if (type == 0) {
return taosHashGetSize(pMeta->pCache->STbFilterCache.pTkLogStb);
return taosHashGetSize(pMeta->pCache->STbFilterCache.pStb);
}
return 0;
}
\ No newline at end of file
......@@ -580,8 +580,7 @@ static const char *tkLogStb[TK_LOG_STB_NUM] = {"cluster_info",
// exclude stbs of taoskeeper log
static int32_t vnodeGetTimeSeriesBlackList(SVnode *pVnode) {
char *dbName = strchr(pVnode->config.dbname, '.');
++dbName;
if (!dbName || 0 != strncmp(dbName, "log", TSDB_DB_NAME_LEN)) {
if (!dbName || 0 != strncmp(++dbName, "log", TSDB_DB_NAME_LEN)) {
return 0;
}
int32_t tbSize = metaSizeOfTbFilterCache(pVnode, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册