diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index e5f163a03badda95f955ebfd903e4002828f6d7d..2283f919bc40466bae2f7411aed27df81c0e4240 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -32,6 +32,11 @@ extern "C" { #define tsdbTrace(...) do { if (tsdbDebugFlag & DEBUG_TRACE) { taosPrintLog("TSDB ", DEBUG_TRACE, tsdbDebugFlag, __VA_ARGS__); }} while(0) // clang-format on +typedef struct TSDBKEY TSDBKEY; + +// tsdbMemTable2.c ============================================================================================== +typedef struct SMemTable SMemTable; + // tsdbMemTable ================ typedef struct STsdbRow STsdbRow; typedef struct STbData STbData; @@ -851,6 +856,11 @@ struct STsdbRow { STSRow row; }; +struct TSDBKEY { + int64_t version; + TSKEY ts; +}; + #endif #ifdef __cplusplus diff --git a/source/dnode/vnode/src/tsdb/tsdbMemTable2.c b/source/dnode/vnode/src/tsdb/tsdbMemTable2.c index 690e1baf73d6528adec419106d3907a213dadaea..f8304be783cd8fba3b4cbb2fe9fa1c2a0ae03761 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMemTable2.c +++ b/source/dnode/vnode/src/tsdb/tsdbMemTable2.c @@ -15,27 +15,45 @@ #include "tsdb.h" -typedef struct SMemTable SMemTable; -typedef struct SMemData SMemData; -typedef struct SMemSkipList SMemSkipList; -typedef struct SMemSkipListNode SMemSkipListNode; -typedef struct SMemSkipListCurosr SMemSkipListCurosr; +typedef struct SMemData SMemData; +// typedef struct SMemSkipList SMemSkipList; +// typedef struct SMemSkipListNode SMemSkipListNode; +// typedef struct SMemSkipListCurosr SMemSkipListCurosr; -#define SL_MAX_LEVEL 5 +struct SMemData { + tb_uid_t suid; + tb_uid_t uid; + TSDBKEY minKey; + TSDBKEY maxKey; + int64_t nRows; + SMemData *pHashNext; +}; struct SMemTable { - STsdb *pTsdb; - TSKEY minKey; - TSKEY maxKey; - int64_t minVer; - int64_t maxVer; - int64_t nRows; - int32_t nHash; - int32_t nBucket; - SMemData **pBuckets; - SMemSkipListCurosr *pSlc; + STsdb *pTsdb; + int32_t nRef; + TSDBKEY minKey; + TSDBKEY maxKey; + int64_t nRows; + SArray *pArray; }; +int32_t tsdbMemTableCreate(STsdb *pTsdb, SMemTable **ppMemTable) { + int32_t code = 0; + // TODO + return code; +} + +int32_t tsdbMemTableDestroy(SMemTable *pMemTable) { + int32_t code = 0; + // TODO + return code; +} + +#if 0 + +#define SL_MAX_LEVEL 5 + struct SMemSkipListNode { int8_t level; SMemSkipListNode *forwards[1]; // Windows does not allow 0 @@ -49,18 +67,6 @@ struct SMemSkipList { SMemSkipListNode pHead[1]; // Windows does not allow 0 }; -struct SMemData { - SMemData *pHashNext; - tb_uid_t suid; - tb_uid_t uid; - TSKEY minKey; - TSKEY maxKey; - int64_t minVer; - int64_t maxVer; - int64_t nRows; - SMemSkipList sl; -}; - struct SMemSkipListCurosr { SMemSkipList *pSl; SMemSkipListNode *pNodes[SL_MAX_LEVEL]; @@ -377,4 +383,5 @@ static SMemSkipListNode *tsdbMemSkipListNodeCreate(SVBufPool *pPool, SMemSkipLis } return pNode; -} \ No newline at end of file +} +#endif \ No newline at end of file