提交 28c358c3 编写于 作者: dengyihao's avatar dengyihao

update tindex reader

上级 556788b6
......@@ -66,6 +66,7 @@ typedef struct TFileWriter {
uint32_t offset;
} TFileWriter;
// multi reader and single write
typedef struct TFileReader {
T_REF_DECLARE()
Fst* fst;
......
......@@ -134,8 +134,15 @@ TFileReader* tfileCacheGet(TFileCache* tcache, TFileCacheKey* key) {
void tfileCachePut(TFileCache* tcache, TFileCacheKey* key, TFileReader* reader) {
char buf[128] = {0};
tfileSerialCacheKey(key, buf);
tfileReadRef(reader);
// remove last version index reader
TFileReader** p = taosHashGet(tcache->tableCache, buf, strlen(buf));
if (*p != NULL) {
TFileReader* oldReader = *p;
taosHashRemove(tcache->tableCache, buf, strlen(buf));
tfileReadUnRef(oldReader);
}
tfileReadRef(reader);
taosHashPut(tcache->tableCache, buf, strlen(buf), &reader, sizeof(void*));
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册