refactor code
This commit is contained in:
parent
9920b43be5
commit
db474b2078
|
@ -108,8 +108,17 @@ void iterateValueDestroy(IterateValue* iv, bool destroy);
|
||||||
|
|
||||||
extern void* indexQhandle;
|
extern void* indexQhandle;
|
||||||
|
|
||||||
|
typedef struct TFileCacheKey {
|
||||||
|
uint64_t suid;
|
||||||
|
uint8_t colType;
|
||||||
|
char* colName;
|
||||||
|
int32_t nColName;
|
||||||
|
} ICacheKey;
|
||||||
|
|
||||||
int indexFlushCacheTFile(SIndex* sIdx, void*);
|
int indexFlushCacheTFile(SIndex* sIdx, void*);
|
||||||
|
|
||||||
|
int32_t indexSerialCacheKey(ICacheKey* key, char* buf);
|
||||||
|
|
||||||
#define indexFatal(...) \
|
#define indexFatal(...) \
|
||||||
do { \
|
do { \
|
||||||
if (sDebugFlag & DEBUG_FATAL) { taosPrintLog("index FATAL ", 255, __VA_ARGS__); } \
|
if (sDebugFlag & DEBUG_FATAL) { taosPrintLog("index FATAL ", 255, __VA_ARGS__); } \
|
||||||
|
|
|
@ -42,6 +42,7 @@ typedef struct IndexCache {
|
||||||
int32_t version;
|
int32_t version;
|
||||||
int32_t nTerm;
|
int32_t nTerm;
|
||||||
int8_t type;
|
int8_t type;
|
||||||
|
uint64_t suid;
|
||||||
|
|
||||||
pthread_mutex_t mtx;
|
pthread_mutex_t mtx;
|
||||||
} IndexCache;
|
} IndexCache;
|
||||||
|
@ -58,7 +59,7 @@ typedef struct CacheTerm {
|
||||||
} CacheTerm;
|
} CacheTerm;
|
||||||
//
|
//
|
||||||
|
|
||||||
IndexCache* indexCacheCreate(SIndex* idx, const char* colName, int8_t type);
|
IndexCache* indexCacheCreate(SIndex* idx, uint64_t suid, const char* colName, int8_t type);
|
||||||
|
|
||||||
void indexCacheDestroy(void* cache);
|
void indexCacheDestroy(void* cache);
|
||||||
|
|
||||||
|
|
|
@ -49,13 +49,6 @@ typedef struct TFileValue {
|
||||||
int32_t offset;
|
int32_t offset;
|
||||||
} TFileValue;
|
} TFileValue;
|
||||||
|
|
||||||
typedef struct TFileCacheKey {
|
|
||||||
uint64_t suid;
|
|
||||||
uint8_t colType;
|
|
||||||
char* colName;
|
|
||||||
int32_t nColName;
|
|
||||||
} TFileCacheKey;
|
|
||||||
|
|
||||||
// table cache
|
// table cache
|
||||||
// refactor to LRU cache later
|
// refactor to LRU cache later
|
||||||
typedef struct TFileCache {
|
typedef struct TFileCache {
|
||||||
|
@ -103,10 +96,10 @@ typedef struct TFileReaderOpt {
|
||||||
// tfile cache, manage tindex reader
|
// tfile cache, manage tindex reader
|
||||||
TFileCache* tfileCacheCreate(const char* path);
|
TFileCache* tfileCacheCreate(const char* path);
|
||||||
void tfileCacheDestroy(TFileCache* tcache);
|
void tfileCacheDestroy(TFileCache* tcache);
|
||||||
TFileReader* tfileCacheGet(TFileCache* tcache, TFileCacheKey* key);
|
TFileReader* tfileCacheGet(TFileCache* tcache, ICacheKey* key);
|
||||||
void tfileCachePut(TFileCache* tcache, TFileCacheKey* key, TFileReader* reader);
|
void tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader);
|
||||||
|
|
||||||
TFileReader* tfileGetReaderByCol(IndexTFile* tf, char* colName);
|
TFileReader* tfileGetReaderByCol(IndexTFile* tf, uint64_t suid, char* colName);
|
||||||
|
|
||||||
TFileReader* tfileReaderOpen(char* path, uint64_t suid, int32_t version, const char* colName);
|
TFileReader* tfileReaderOpen(char* path, uint64_t suid, int32_t version, const char* colName);
|
||||||
TFileReader* tfileReaderCreate(WriterCtx* ctx);
|
TFileReader* tfileReaderCreate(WriterCtx* ctx);
|
||||||
|
|
|
@ -34,7 +34,7 @@ extern "C" {
|
||||||
#define SERIALIZE_VAR_TO_BUF(buf, var, type) \
|
#define SERIALIZE_VAR_TO_BUF(buf, var, type) \
|
||||||
do { \
|
do { \
|
||||||
type c = var; \
|
type c = var; \
|
||||||
assert(sizeof(var) == sizeof(type)); \
|
assert(sizeof(type) == sizeof(c)); \
|
||||||
memcpy((void*)buf, (void*)&c, sizeof(c)); \
|
memcpy((void*)buf, (void*)&c, sizeof(c)); \
|
||||||
buf += sizeof(c); \
|
buf += sizeof(c); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "indexInt.h"
|
#include "indexInt.h"
|
||||||
#include "index_cache.h"
|
#include "index_cache.h"
|
||||||
#include "index_tfile.h"
|
#include "index_tfile.h"
|
||||||
|
#include "index_util.h"
|
||||||
#include "tdef.h"
|
#include "tdef.h"
|
||||||
#include "tsched.h"
|
#include "tsched.h"
|
||||||
|
|
||||||
|
@ -131,17 +132,27 @@ int indexPut(SIndex* index, SIndexMultiTerm* fVals, uint64_t uid) {
|
||||||
pthread_mutex_lock(&index->mtx);
|
pthread_mutex_lock(&index->mtx);
|
||||||
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
||||||
SIndexTerm* p = taosArrayGetP(fVals, i);
|
SIndexTerm* p = taosArrayGetP(fVals, i);
|
||||||
IndexCache** cache = taosHashGet(index->colObj, p->colName, p->nColName);
|
|
||||||
|
char buf[128] = {0};
|
||||||
|
ICacheKey key = {.suid = p->suid, .colName = p->colName};
|
||||||
|
int32_t sz = indexSerialCacheKey(&key, buf);
|
||||||
|
|
||||||
|
IndexCache** cache = taosHashGet(index->colObj, buf, sz);
|
||||||
if (cache == NULL) {
|
if (cache == NULL) {
|
||||||
IndexCache* pCache = indexCacheCreate(index, p->colName, p->colType);
|
IndexCache* pCache = indexCacheCreate(index, p->suid, p->colName, p->colType);
|
||||||
taosHashPut(index->colObj, p->colName, p->nColName, &pCache, sizeof(void*));
|
taosHashPut(index->colObj, buf, sz, &pCache, sizeof(void*));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&index->mtx);
|
pthread_mutex_unlock(&index->mtx);
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
for (int i = 0; i < taosArrayGetSize(fVals); i++) {
|
||||||
SIndexTerm* p = taosArrayGetP(fVals, i);
|
SIndexTerm* p = taosArrayGetP(fVals, i);
|
||||||
IndexCache** cache = taosHashGet(index->colObj, p->colName, p->nColName);
|
|
||||||
|
char buf[128] = {0};
|
||||||
|
ICacheKey key = {.suid = p->suid, .colName = p->colName};
|
||||||
|
int32_t sz = indexSerialCacheKey(&key, buf);
|
||||||
|
|
||||||
|
IndexCache** cache = taosHashGet(index->colObj, buf, sz);
|
||||||
assert(*cache != NULL);
|
assert(*cache != NULL);
|
||||||
int ret = indexCachePut(*cache, p, uid);
|
int ret = indexCachePut(*cache, p, uid);
|
||||||
if (ret != 0) { return ret; }
|
if (ret != 0) { return ret; }
|
||||||
|
@ -296,7 +307,12 @@ static int indexTermSearch(SIndex* sIdx, SIndexTermQuery* query, SArray** result
|
||||||
// Get col info
|
// Get col info
|
||||||
IndexCache* cache = NULL;
|
IndexCache* cache = NULL;
|
||||||
pthread_mutex_lock(&sIdx->mtx);
|
pthread_mutex_lock(&sIdx->mtx);
|
||||||
IndexCache** pCache = taosHashGet(sIdx->colObj, colName, nColName);
|
|
||||||
|
char buf[128] = {0};
|
||||||
|
ICacheKey key = {.suid = term->suid, .colName = term->colName};
|
||||||
|
int32_t sz = indexSerialCacheKey(&key, buf);
|
||||||
|
|
||||||
|
IndexCache** pCache = taosHashGet(sIdx->colObj, buf, sz);
|
||||||
if (pCache == NULL) {
|
if (pCache == NULL) {
|
||||||
pthread_mutex_unlock(&sIdx->mtx);
|
pthread_mutex_unlock(&sIdx->mtx);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -385,10 +401,12 @@ int indexFlushCacheTFile(SIndex* sIdx, void* cache) {
|
||||||
indexWarn("suid %" PRIu64 " merge cache into tindex", sIdx->suid);
|
indexWarn("suid %" PRIu64 " merge cache into tindex", sIdx->suid);
|
||||||
|
|
||||||
IndexCache* pCache = (IndexCache*)cache;
|
IndexCache* pCache = (IndexCache*)cache;
|
||||||
TFileReader* pReader = tfileGetReaderByCol(sIdx->tindex, pCache->colName);
|
TFileReader* pReader = tfileGetReaderByCol(sIdx->tindex, pCache->suid, pCache->colName);
|
||||||
|
if (pReader == NULL) { indexWarn("empty pReader found"); }
|
||||||
// handle flush
|
// handle flush
|
||||||
Iterate* cacheIter = indexCacheIteratorCreate(pCache);
|
Iterate* cacheIter = indexCacheIteratorCreate(pCache);
|
||||||
Iterate* tfileIter = tfileIteratorCreate(pReader);
|
Iterate* tfileIter = tfileIteratorCreate(pReader);
|
||||||
|
if (tfileIter == NULL) { indexWarn("empty tfile reader iterator"); }
|
||||||
|
|
||||||
SArray* result = taosArrayInit(1024, sizeof(void*));
|
SArray* result = taosArrayInit(1024, sizeof(void*));
|
||||||
|
|
||||||
|
@ -468,7 +486,7 @@ static int indexGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
|
||||||
int32_t version = CACHE_VERSION(cache);
|
int32_t version = CACHE_VERSION(cache);
|
||||||
uint8_t colType = cache->type;
|
uint8_t colType = cache->type;
|
||||||
|
|
||||||
TFileWriter* tw = tfileWriterOpen(sIdx->path, sIdx->suid, version, cache->colName, colType);
|
TFileWriter* tw = tfileWriterOpen(sIdx->path, cache->suid, version, cache->colName, colType);
|
||||||
if (tw == NULL) {
|
if (tw == NULL) {
|
||||||
indexError("failed to open file to write");
|
indexError("failed to open file to write");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -481,14 +499,13 @@ static int indexGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
|
||||||
}
|
}
|
||||||
tfileWriterClose(tw);
|
tfileWriterClose(tw);
|
||||||
|
|
||||||
TFileReader* reader = tfileReaderOpen(sIdx->path, sIdx->suid, version, cache->colName);
|
TFileReader* reader = tfileReaderOpen(sIdx->path, cache->suid, version, cache->colName);
|
||||||
|
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
TFileHeader* header = &reader->header;
|
TFileHeader* header = &reader->header;
|
||||||
TFileCacheKey key = {.suid = header->suid,
|
ICacheKey key = {
|
||||||
.colName = header->colName,
|
.suid = cache->suid, .colName = header->colName, .nColName = strlen(header->colName), .colType = header->colType};
|
||||||
.nColName = strlen(header->colName),
|
|
||||||
.colType = header->colType};
|
|
||||||
pthread_mutex_lock(&sIdx->mtx);
|
pthread_mutex_lock(&sIdx->mtx);
|
||||||
|
|
||||||
IndexTFile* ifile = (IndexTFile*)sIdx->tindex;
|
IndexTFile* ifile = (IndexTFile*)sIdx->tindex;
|
||||||
|
@ -499,3 +516,13 @@ static int indexGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
|
||||||
END:
|
END:
|
||||||
tfileWriterClose(tw);
|
tfileWriterClose(tw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t indexSerialCacheKey(ICacheKey* key, char* buf) {
|
||||||
|
char* p = buf;
|
||||||
|
SERIALIZE_MEM_TO_BUF(buf, key, suid);
|
||||||
|
SERIALIZE_VAR_TO_BUF(buf, '_', char);
|
||||||
|
// SERIALIZE_MEM_TO_BUF(buf, key, colType);
|
||||||
|
// SERIALIZE_VAR_TO_BUF(buf, '_', char);
|
||||||
|
SERIALIZE_STR_MEM_TO_BUF(buf, key, colName, key->nColName);
|
||||||
|
return buf - p;
|
||||||
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ static bool indexCacheIteratorNext(Iterate* itera);
|
||||||
|
|
||||||
static IterateValue* indexCacheIteratorGetValue(Iterate* iter);
|
static IterateValue* indexCacheIteratorGetValue(Iterate* iter);
|
||||||
|
|
||||||
IndexCache* indexCacheCreate(SIndex* idx, const char* colName, int8_t type) {
|
IndexCache* indexCacheCreate(SIndex* idx, uint64_t suid, const char* colName, int8_t type) {
|
||||||
IndexCache* cache = calloc(1, sizeof(IndexCache));
|
IndexCache* cache = calloc(1, sizeof(IndexCache));
|
||||||
if (cache == NULL) {
|
if (cache == NULL) {
|
||||||
indexError("failed to create index cache");
|
indexError("failed to create index cache");
|
||||||
|
@ -53,7 +53,7 @@ IndexCache* indexCacheCreate(SIndex* idx, const char* colName, int8_t type) {
|
||||||
cache->type = type;
|
cache->type = type;
|
||||||
cache->index = idx;
|
cache->index = idx;
|
||||||
cache->version = 0;
|
cache->version = 0;
|
||||||
|
cache->suid = suid;
|
||||||
pthread_mutex_init(&cache->mtx, NULL);
|
pthread_mutex_init(&cache->mtx, NULL);
|
||||||
indexCacheRef(cache);
|
indexCacheRef(cache);
|
||||||
return cache;
|
return cache;
|
||||||
|
|
|
@ -51,7 +51,6 @@ static void tfileDestroyFileName(void* elem);
|
||||||
static int tfileCompare(const void* a, const void* b);
|
static int tfileCompare(const void* a, const void* b);
|
||||||
static int tfileParseFileName(const char* filename, uint64_t* suid, int* colId, int* version);
|
static int tfileParseFileName(const char* filename, uint64_t* suid, int* colId, int* version);
|
||||||
static void tfileGenFileName(char* filename, uint64_t suid, int colId, int version);
|
static void tfileGenFileName(char* filename, uint64_t suid, int colId, int version);
|
||||||
static void tfileSerialCacheKey(TFileCacheKey* key, char* buf);
|
|
||||||
|
|
||||||
TFileCache* tfileCacheCreate(const char* path) {
|
TFileCache* tfileCacheCreate(const char* path) {
|
||||||
TFileCache* tcache = calloc(1, sizeof(TFileCache));
|
TFileCache* tcache = calloc(1, sizeof(TFileCache));
|
||||||
|
@ -83,15 +82,15 @@ TFileCache* tfileCacheCreate(const char* path) {
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
TFileReader* reader = tfileReaderCreate(wc);
|
TFileReader* reader = tfileReaderCreate(wc);
|
||||||
TFileHeader* header = &reader->header;
|
TFileHeader* header = &reader->header;
|
||||||
TFileCacheKey key = {.suid = header->suid,
|
ICacheKey key = {.suid = header->suid,
|
||||||
.colName = header->colName,
|
.colName = header->colName,
|
||||||
.nColName = strlen(header->colName),
|
.nColName = strlen(header->colName),
|
||||||
.colType = header->colType};
|
.colType = header->colType};
|
||||||
tfileSerialCacheKey(&key, buf);
|
|
||||||
|
|
||||||
|
int32_t sz = indexSerialCacheKey(&key, buf);
|
||||||
|
assert(sz < sizeof(buf));
|
||||||
|
taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
|
||||||
tfileReaderRef(reader);
|
tfileReaderRef(reader);
|
||||||
// indexTable
|
|
||||||
taosHashPut(tcache->tableCache, buf, strlen(buf), &reader, sizeof(void*));
|
|
||||||
}
|
}
|
||||||
taosArrayDestroyEx(files, tfileDestroyFileName);
|
taosArrayDestroyEx(files, tfileDestroyFileName);
|
||||||
return tcache;
|
return tcache;
|
||||||
|
@ -117,30 +116,30 @@ void tfileCacheDestroy(TFileCache* tcache) {
|
||||||
free(tcache);
|
free(tcache);
|
||||||
}
|
}
|
||||||
|
|
||||||
TFileReader* tfileCacheGet(TFileCache* tcache, TFileCacheKey* key) {
|
TFileReader* tfileCacheGet(TFileCache* tcache, ICacheKey* key) {
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
tfileSerialCacheKey(key, buf);
|
int32_t sz = indexSerialCacheKey(key, buf);
|
||||||
|
assert(sz < sizeof(buf));
|
||||||
TFileReader** reader = taosHashGet(tcache->tableCache, buf, strlen(buf));
|
TFileReader** reader = taosHashGet(tcache->tableCache, buf, sz);
|
||||||
if (reader == NULL) { return NULL; }
|
if (reader == NULL) { return NULL; }
|
||||||
tfileReaderRef(*reader);
|
tfileReaderRef(*reader);
|
||||||
|
|
||||||
return *reader;
|
return *reader;
|
||||||
}
|
}
|
||||||
void tfileCachePut(TFileCache* tcache, TFileCacheKey* key, TFileReader* reader) {
|
void tfileCachePut(TFileCache* tcache, ICacheKey* key, TFileReader* reader) {
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
tfileSerialCacheKey(key, buf);
|
int32_t sz = indexSerialCacheKey(key, buf);
|
||||||
// remove last version index reader
|
// remove last version index reader
|
||||||
TFileReader** p = taosHashGet(tcache->tableCache, buf, strlen(buf));
|
TFileReader** p = taosHashGet(tcache->tableCache, buf, sz);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
TFileReader* oldReader = *p;
|
TFileReader* oldReader = *p;
|
||||||
taosHashRemove(tcache->tableCache, buf, strlen(buf));
|
taosHashRemove(tcache->tableCache, buf, sz);
|
||||||
oldReader->remove = true;
|
oldReader->remove = true;
|
||||||
tfileReaderUnRef(oldReader);
|
tfileReaderUnRef(oldReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
taosHashPut(tcache->tableCache, buf, sz, &reader, sizeof(void*));
|
||||||
tfileReaderRef(reader);
|
tfileReaderRef(reader);
|
||||||
taosHashPut(tcache->tableCache, buf, strlen(buf), &reader, sizeof(void*));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TFileReader* tfileReaderCreate(WriterCtx* ctx) {
|
TFileReader* tfileReaderCreate(WriterCtx* ctx) {
|
||||||
|
@ -230,8 +229,6 @@ TFileReader* tfileReaderOpen(char* path, uint64_t suid, int32_t version, const c
|
||||||
|
|
||||||
TFileReader* reader = tfileReaderCreate(wc);
|
TFileReader* reader = tfileReaderCreate(wc);
|
||||||
return reader;
|
return reader;
|
||||||
|
|
||||||
// tfileSerialCacheKey(&key, buf);
|
|
||||||
}
|
}
|
||||||
TFileWriter* tfileWriterCreate(WriterCtx* ctx, TFileHeader* header) {
|
TFileWriter* tfileWriterCreate(WriterCtx* ctx, TFileHeader* header) {
|
||||||
// char pathBuf[128] = {0};
|
// char pathBuf[128] = {0};
|
||||||
|
@ -325,15 +322,19 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
|
||||||
tfileWriterClose(tw);
|
tfileWriterClose(tw);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// write fst
|
|
||||||
|
// write data
|
||||||
indexError("--------Begin----------------");
|
indexError("--------Begin----------------");
|
||||||
for (size_t i = 0; i < sz; i++) {
|
for (size_t i = 0; i < sz; i++) {
|
||||||
// TODO, fst batch write later
|
// TODO, fst batch write later
|
||||||
TFileValue* v = taosArrayGetP((SArray*)data, i);
|
TFileValue* v = taosArrayGetP((SArray*)data, i);
|
||||||
if (tfileWriteData(tw, v) == 0) {
|
if (tfileWriteData(tw, v) != 0) {
|
||||||
//
|
indexError("failed to write data: %s, offset: %d len: %d", v->colVal, v->offset,
|
||||||
|
(int)taosArrayGetSize(v->tableId));
|
||||||
|
} else {
|
||||||
|
indexInfo("success to write data: %s, offset: %d len: %d", v->colVal, v->offset,
|
||||||
|
(int)taosArrayGetSize(v->tableId));
|
||||||
}
|
}
|
||||||
indexError("data: %s, offset: %d len: %d", v->colVal, v->offset, (int)taosArrayGetSize(v->tableId));
|
|
||||||
}
|
}
|
||||||
indexError("--------End----------------");
|
indexError("--------End----------------");
|
||||||
fstBuilderFinish(tw->fb);
|
fstBuilderFinish(tw->fb);
|
||||||
|
@ -370,8 +371,7 @@ int indexTFileSearch(void* tfile, SIndexTermQuery* query, SArray* result) {
|
||||||
IndexTFile* pTfile = (IndexTFile*)tfile;
|
IndexTFile* pTfile = (IndexTFile*)tfile;
|
||||||
|
|
||||||
SIndexTerm* term = query->term;
|
SIndexTerm* term = query->term;
|
||||||
TFileCacheKey key = {
|
ICacheKey key = {.suid = term->suid, .colType = term->colType, .colName = term->colName, .nColName = term->nColName};
|
||||||
.suid = term->suid, .colType = term->colType, .colName = term->colName, .nColName = term->nColName};
|
|
||||||
TFileReader* reader = tfileCacheGet(pTfile->cache, &key);
|
TFileReader* reader = tfileCacheGet(pTfile->cache, &key);
|
||||||
if (reader == NULL) { return 0; }
|
if (reader == NULL) { return 0; }
|
||||||
|
|
||||||
|
@ -453,9 +453,9 @@ void tfileIteratorDestroy(Iterate* iter) {
|
||||||
free(iter);
|
free(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
TFileReader* tfileGetReaderByCol(IndexTFile* tf, char* colName) {
|
TFileReader* tfileGetReaderByCol(IndexTFile* tf, uint64_t suid, char* colName) {
|
||||||
if (tf == NULL) { return NULL; }
|
if (tf == NULL) { return NULL; }
|
||||||
TFileCacheKey key = {.suid = 0, .colType = TSDB_DATA_TYPE_BINARY, .colName = colName, .nColName = strlen(colName)};
|
ICacheKey key = {.suid = suid, .colType = TSDB_DATA_TYPE_BINARY, .colName = colName, .nColName = strlen(colName)};
|
||||||
return tfileCacheGet(tf->cache, &key);
|
return tfileCacheGet(tf->cache, &key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,10 +650,3 @@ static int tfileParseFileName(const char* filename, uint64_t* suid, int* colId,
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
static void tfileSerialCacheKey(TFileCacheKey* key, char* buf) {
|
|
||||||
// SERIALIZE_MEM_TO_BUF(buf, key, suid);
|
|
||||||
// SERIALIZE_VAR_TO_BUF(buf, '_', char);
|
|
||||||
// SERIALIZE_MEM_TO_BUF(buf, key, colType);
|
|
||||||
// SERIALIZE_VAR_TO_BUF(buf, '_', char);
|
|
||||||
SERIALIZE_STR_MEM_TO_BUF(buf, key, colName, key->nColName);
|
|
||||||
}
|
|
||||||
|
|
|
@ -477,7 +477,7 @@ class CacheObj {
|
||||||
public:
|
public:
|
||||||
CacheObj() {
|
CacheObj() {
|
||||||
// TODO
|
// TODO
|
||||||
cache = indexCacheCreate(NULL, "voltage", TSDB_DATA_TYPE_BINARY);
|
cache = indexCacheCreate(NULL, 0, "voltage", TSDB_DATA_TYPE_BINARY);
|
||||||
}
|
}
|
||||||
int Put(SIndexTerm* term, int16_t colId, int32_t version, uint64_t uid) {
|
int Put(SIndexTerm* term, int16_t colId, int32_t version, uint64_t uid) {
|
||||||
int ret = indexCachePut(cache, term, uid);
|
int ret = indexCachePut(cache, term, uid);
|
||||||
|
|
Loading…
Reference in New Issue