diff --git a/source/libs/index/inc/indexInt.h b/source/libs/index/inc/indexInt.h index 6e1256d857ee0d4accbf67912354e94d1e681df5..378af4c1d10821c123dc4fc16d017df6cd9f3b01 100644 --- a/source/libs/index/inc/indexInt.h +++ b/source/libs/index/inc/indexInt.h @@ -115,7 +115,7 @@ typedef struct TFileCacheKey { int32_t nColName; } ICacheKey; -int indexFlushCacheTFile(SIndex* sIdx, void*); +int indexFlushCacheToTFile(SIndex* sIdx, void*); int32_t indexSerialCacheKey(ICacheKey* key, char* buf); diff --git a/source/libs/index/inc/index_cache.h b/source/libs/index/inc/index_cache.h index 544849ff2fab8a1018617db04606e4d4df148502..9db913debfc06f3406aa4d9105709419e5314f1e 100644 --- a/source/libs/index/inc/index_cache.h +++ b/source/libs/index/inc/index_cache.h @@ -21,9 +21,8 @@ #include "tskiplist.h" // ----------------- key structure in skiplist --------------------- -/* A data row, the format is like below: - * content: |<--totalLen-->|<-- value len--->|<-- value -->|<--uid -->|<--version--->|<-- itermType -->| - * len : |<--int32_t -->|<--- int32_t --->|<--valuelen->|<--uint64_t->|<-- int32_t-->|<-- int8_t --->| +/* A data row, the format is like below + * content: |<---colVal---->|<-- version--->|<-- uid--->|<-- colType --->|<--operaType--->| */ #ifdef __cplusplus diff --git a/source/libs/index/src/index.c b/source/libs/index/src/index.c index 0bf30d6efabb84b3d060ff6639387b6d8db45c52..d0b8fa4290d14f3363e3b1046b003fdc071393d2 100644 --- a/source/libs/index/src/index.c +++ b/source/libs/index/src/index.c @@ -384,7 +384,6 @@ static void indexMergeSameKey(SArray* result, TFileValue* tv) { } } else { taosArrayPush(result, &tv); - // indexError("merge colVal: %s", tv->colVal); } } static void indexDestroyTempResult(SArray* result) { @@ -395,7 +394,7 @@ static void indexDestroyTempResult(SArray* result) { } taosArrayDestroy(result); } -int indexFlushCacheTFile(SIndex* sIdx, void* cache) { +int indexFlushCacheToTFile(SIndex* sIdx, void* cache) { if (sIdx == NULL) { return -1; } indexInfo("suid %" PRIu64 " merge cache into tindex", sIdx->suid); diff --git a/source/libs/index/src/index_cache.c b/source/libs/index/src/index_cache.c index 85e4c98276faf76977d88d6afeec7db373f4e89c..8bc3776ed9756771e119fb6b4b6c33ae6c800153 100644 --- a/source/libs/index/src/index_cache.c +++ b/source/libs/index/src/index_cache.c @@ -45,9 +45,7 @@ IndexCache* indexCacheCreate(SIndex* idx, uint64_t suid, const char* colName, in return NULL; }; cache->mem = indexInternalCacheCreate(type); - - cache->colName = calloc(1, strlen(colName) + 1); - memcpy(cache->colName, colName, strlen(colName)); + cache->colName = tstrdup(colName); cache->type = type; cache->index = idx; cache->version = 0; @@ -187,8 +185,8 @@ static void indexCacheMakeRoomForWrite(IndexCache* cache) { break; } else if (cache->imm != NULL) { // TODO: wake up by condition variable - // pthread_mutex_unlock(&cache->mtx); pthread_cond_wait(&cache->finished, &cache->mtx); + // pthread_mutex_unlock(&cache->mtx); // taosMsleep(50); // pthread_mutex_lock(&cache->mtx); } else { @@ -353,7 +351,7 @@ static MemTable* indexInternalCacheCreate(int8_t type) { static void doMergeWork(SSchedMsg* msg) { IndexCache* pCache = msg->ahandle; SIndex* sidx = (SIndex*)pCache->index; - indexFlushCacheTFile(sidx, pCache); + indexFlushCacheToTFile(sidx, pCache); } static bool indexCacheIteratorNext(Iterate* itera) { SSkipListIterator* iter = itera->iter; diff --git a/source/libs/index/src/index_fst_counting_writer.c b/source/libs/index/src/index_fst_counting_writer.c index 260c1708cb97a4dbf0cb845505188cdc77fcd506..0763aae85703ee5a4e2a4f88be9bdc6f985ee7a1 100644 --- a/source/libs/index/src/index_fst_counting_writer.c +++ b/source/libs/index/src/index_fst_counting_writer.c @@ -18,8 +18,6 @@ #include "tutil.h" static int writeCtxDoWrite(WriterCtx* ctx, uint8_t* buf, int len) { - // if (ctx->offset + len > ctx->limit) { return -1; } - if (ctx->type == TFile) { assert(len == tfWrite(ctx->file.fd, buf, len)); } else {