提交 34b0208f 编写于 作者: M Minglei Jin

refact: tsdbCache/cleanup, remove tsRowFromTsdbRow

上级 6e92950a
...@@ -46,11 +46,6 @@ void tsdbCloseCache(SLRUCache *pCache) { ...@@ -46,11 +46,6 @@ void tsdbCloseCache(SLRUCache *pCache) {
} }
} }
/* static void getTableCacheKeyS(tb_uid_t uid, const char *cacheType, char *key, int *len) { */
/* snprintf(key, 30, "%" PRIi64 "%s", uid, cacheType); */
/* *len = strlen(key); */
/* } */
static void getTableCacheKey(tb_uid_t uid, int cacheType, char *key, int *len) { static void getTableCacheKey(tb_uid_t uid, int cacheType, char *key, int *len) {
if (cacheType == 0) { // last_row if (cacheType == 0) { // last_row
*(uint64_t *)key = (uint64_t)uid; *(uint64_t *)key = (uint64_t)uid;
...@@ -649,44 +644,44 @@ _err: ...@@ -649,44 +644,44 @@ _err:
return code; return code;
} }
static int32_t tsRowFromTsdbRow(STSchema *pTSchema, TSDBROW *pRow, STSRow **ppRow) { /* static int32_t tsRowFromTsdbRow(STSchema *pTSchema, TSDBROW *pRow, STSRow **ppRow) { */
int32_t code = 0; /* int32_t code = 0; */
SColVal *pColVal = &(SColVal){0}; /* SColVal *pColVal = &(SColVal){0}; */
if (pRow->type == 0) { /* if (pRow->type == 0) { */
*ppRow = tdRowDup(pRow->pTSRow); /* *ppRow = tdRowDup(pRow->pTSRow); */
} else { /* } else { */
SArray *pArray = taosArrayInit(pTSchema->numOfCols, sizeof(SColVal)); /* SArray *pArray = taosArrayInit(pTSchema->numOfCols, sizeof(SColVal)); */
if (pArray == NULL) { /* if (pArray == NULL) { */
code = TSDB_CODE_OUT_OF_MEMORY; /* code = TSDB_CODE_OUT_OF_MEMORY; */
goto _exit; /* goto _exit; */
} /* } */
TSDBKEY key = TSDBROW_KEY(pRow); /* TSDBKEY key = TSDBROW_KEY(pRow); */
STColumn *pTColumn = &pTSchema->columns[0]; /* STColumn *pTColumn = &pTSchema->columns[0]; */
*pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.ts = key.ts}); /* *pColVal = COL_VAL_VALUE(pTColumn->colId, pTColumn->type, (SValue){.ts = key.ts}); */
if (taosArrayPush(pArray, pColVal) == NULL) { /* if (taosArrayPush(pArray, pColVal) == NULL) { */
code = TSDB_CODE_OUT_OF_MEMORY; /* code = TSDB_CODE_OUT_OF_MEMORY; */
goto _exit; /* goto _exit; */
} /* } */
for (int16_t iCol = 1; iCol < pTSchema->numOfCols; iCol++) { /* for (int16_t iCol = 1; iCol < pTSchema->numOfCols; iCol++) { */
tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); /* tsdbRowGetColVal(pRow, pTSchema, iCol, pColVal); */
if (taosArrayPush(pArray, pColVal) == NULL) { /* if (taosArrayPush(pArray, pColVal) == NULL) { */
code = TSDB_CODE_OUT_OF_MEMORY; /* code = TSDB_CODE_OUT_OF_MEMORY; */
goto _exit; /* goto _exit; */
} /* } */
} /* } */
code = tdSTSRowNew(pArray, pTSchema, ppRow); /* code = tdSTSRowNew(pArray, pTSchema, ppRow); */
if (code) goto _exit; /* if (code) goto _exit; */
} /* } */
_exit: /* _exit: */
return code; /* return code; */
} /* } */
static bool tsdbKeyDeleted(TSDBKEY *key, SArray *pSkyline, int64_t *iSkyline) { static bool tsdbKeyDeleted(TSDBKEY *key, SArray *pSkyline, int64_t *iSkyline) {
bool deleted = false; bool deleted = false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册