more
This commit is contained in:
parent
4eddef574c
commit
22b7b83251
|
@ -22,7 +22,26 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct STsdbMemTable STsdbMemTable;
|
typedef struct STbData {
|
||||||
|
tb_uid_t uid;
|
||||||
|
TSKEY keyMin;
|
||||||
|
TSKEY keyMax;
|
||||||
|
int64_t nrows;
|
||||||
|
SSkipList *pData;
|
||||||
|
} STbData;
|
||||||
|
|
||||||
|
typedef struct STsdbMemTable {
|
||||||
|
T_REF_DECLARE()
|
||||||
|
SRWLatch latch;
|
||||||
|
TSKEY keyMin;
|
||||||
|
TSKEY keyMax;
|
||||||
|
uint64_t nRow;
|
||||||
|
SMemAllocator *pMA;
|
||||||
|
// Container
|
||||||
|
SSkipList *pSlIdx; // SSkiplist<STbData>
|
||||||
|
SHashObj * pHashIdx;
|
||||||
|
} STsdbMemTable;
|
||||||
|
|
||||||
|
|
||||||
STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb);
|
STsdbMemTable *tsdbNewMemTable(STsdb *pTsdb);
|
||||||
void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable);
|
void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable);
|
||||||
|
|
|
@ -17,6 +17,30 @@
|
||||||
|
|
||||||
#define TSDB_MAX_SUBBLOCKS 8
|
#define TSDB_MAX_SUBBLOCKS 8
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
STable * pTable;
|
||||||
|
SSkipListIterator *pIter;
|
||||||
|
} SCommitIter;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SRtn rtn; // retention snapshot
|
||||||
|
SFSIter fsIter; // tsdb file iterator
|
||||||
|
int niters; // memory iterators
|
||||||
|
SCommitIter *iters;
|
||||||
|
bool isRFileSet; // read and commit FSET
|
||||||
|
SReadH readh;
|
||||||
|
SDFileSet wSet;
|
||||||
|
bool isDFileSame;
|
||||||
|
bool isLFileSame;
|
||||||
|
TSKEY minKey;
|
||||||
|
TSKEY maxKey;
|
||||||
|
SArray * aBlkIdx; // SBlockIdx array
|
||||||
|
STable * pTable;
|
||||||
|
SArray * aSupBlk; // Table super-block array
|
||||||
|
SArray * aSubBlk; // table sub-block array
|
||||||
|
SDataCols * pDataCols;
|
||||||
|
} SCommitH;
|
||||||
|
|
||||||
static void tsdbStartCommit(STsdb *pRepo);
|
static void tsdbStartCommit(STsdb *pRepo);
|
||||||
static void tsdbEndCommit(STsdb *pTsdb, int eno);
|
static void tsdbEndCommit(STsdb *pTsdb, int eno);
|
||||||
|
|
||||||
|
@ -89,26 +113,6 @@ static void tsdbEndCommit(STsdb *pTsdb, int eno) {
|
||||||
|
|
||||||
extern int32_t tsTsdbMetaCompactRatio;
|
extern int32_t tsTsdbMetaCompactRatio;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
SRtn rtn; // retention snapshot
|
|
||||||
SFSIter fsIter; // tsdb file iterator
|
|
||||||
int niters; // memory iterators
|
|
||||||
SCommitIter *iters;
|
|
||||||
bool isRFileSet; // read and commit FSET
|
|
||||||
SReadH readh;
|
|
||||||
SDFileSet wSet;
|
|
||||||
bool isDFileSame;
|
|
||||||
bool isLFileSame;
|
|
||||||
TSKEY minKey;
|
|
||||||
TSKEY maxKey;
|
|
||||||
SArray * aBlkIdx; // SBlockIdx array
|
|
||||||
STable * pTable;
|
|
||||||
SArray * aSupBlk; // Table super-block array
|
|
||||||
SArray * aSubBlk; // table sub-block array
|
|
||||||
SDataCols * pDataCols;
|
|
||||||
} SCommitH;
|
|
||||||
|
|
||||||
#define TSDB_COMMIT_REPO(ch) TSDB_READ_REPO(&(ch->readh))
|
#define TSDB_COMMIT_REPO(ch) TSDB_READ_REPO(&(ch->readh))
|
||||||
#define TSDB_COMMIT_REPO_ID(ch) REPO_ID(TSDB_READ_REPO(&(ch->readh)))
|
#define TSDB_COMMIT_REPO_ID(ch) REPO_ID(TSDB_READ_REPO(&(ch->readh)))
|
||||||
#define TSDB_COMMIT_WRITE_FSET(ch) (&((ch)->wSet))
|
#define TSDB_COMMIT_WRITE_FSET(ch) (&((ch)->wSet))
|
||||||
|
|
|
@ -15,30 +15,6 @@
|
||||||
|
|
||||||
#include "tsdbDef.h"
|
#include "tsdbDef.h"
|
||||||
|
|
||||||
typedef struct STbData {
|
|
||||||
tb_uid_t uid;
|
|
||||||
TSKEY keyMin;
|
|
||||||
TSKEY keyMax;
|
|
||||||
int64_t nrows;
|
|
||||||
SSkipList *pData;
|
|
||||||
} STbData;
|
|
||||||
|
|
||||||
struct STsdbMemTable {
|
|
||||||
T_REF_DECLARE()
|
|
||||||
SRWLatch latch;
|
|
||||||
TSKEY keyMin;
|
|
||||||
TSKEY keyMax;
|
|
||||||
uint64_t nRow;
|
|
||||||
SMemAllocator *pMA;
|
|
||||||
// Container
|
|
||||||
#if 1
|
|
||||||
SSkipList *pSlIdx; // SSkiplist<STbData>
|
|
||||||
SHashObj * pHashIdx;
|
|
||||||
#else
|
|
||||||
TD_SLIST(STbData) list;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitMsg *pMsg);
|
static int tsdbScanAndConvertSubmitMsg(STsdb *pTsdb, SSubmitMsg *pMsg);
|
||||||
static int tsdbMemTableInsertTbData(STsdb *pRepo, SSubmitBlk *pBlock, int32_t *pAffectedRows);
|
static int tsdbMemTableInsertTbData(STsdb *pRepo, SSubmitBlk *pBlock, int32_t *pAffectedRows);
|
||||||
static STbData *tsdbNewTbData(tb_uid_t uid);
|
static STbData *tsdbNewTbData(tb_uid_t uid);
|
||||||
|
|
Loading…
Reference in New Issue