update tindex reader
This commit is contained in:
parent
556788b634
commit
28c358c339
|
@ -66,6 +66,7 @@ typedef struct TFileWriter {
|
||||||
uint32_t offset;
|
uint32_t offset;
|
||||||
} TFileWriter;
|
} TFileWriter;
|
||||||
|
|
||||||
|
// multi reader and single write
|
||||||
typedef struct TFileReader {
|
typedef struct TFileReader {
|
||||||
T_REF_DECLARE()
|
T_REF_DECLARE()
|
||||||
Fst* fst;
|
Fst* fst;
|
||||||
|
|
|
@ -134,8 +134,15 @@ TFileReader* tfileCacheGet(TFileCache* tcache, TFileCacheKey* key) {
|
||||||
void tfileCachePut(TFileCache* tcache, TFileCacheKey* key, TFileReader* reader) {
|
void tfileCachePut(TFileCache* tcache, TFileCacheKey* key, TFileReader* reader) {
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
tfileSerialCacheKey(key, buf);
|
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*));
|
taosHashPut(tcache->tableCache, buf, strlen(buf), &reader, sizeof(void*));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue