提交 ebf1a91f 编写于 作者: D dapan1121

enh: read/write from disk cache

上级 ae8caa82
...@@ -24,19 +24,11 @@ extern "C" { ...@@ -24,19 +24,11 @@ extern "C" {
#pragma pack(push, 1) #pragma pack(push, 1)
typedef struct SGcBlkBufBasic { typedef struct SGcBlkBufBasic {
uint32_t fileId;
int64_t blkId; int64_t blkId;
int64_t offset; int64_t offset;
int64_t bufSize; int64_t bufSize;
} SGcBlkBufBasic; } SGcBlkBufBasic;
typedef struct SGcBlkBufInfo {
SGcBlkBufBasic basic;
uint32_t fileId;
void* next;
void* pBuf;
SGcDownstreamCtx* pCtx;
SGroupCacheData* pGroup;
} SGcBlkBufInfo;
#pragma pack(pop) #pragma pack(pop)
typedef struct SGroupCacheFileFd { typedef struct SGroupCacheFileFd {
...@@ -44,25 +36,40 @@ typedef struct SGroupCacheFileFd { ...@@ -44,25 +36,40 @@ typedef struct SGroupCacheFileFd {
TdFilePtr fd; TdFilePtr fd;
} SGroupCacheFileFd; } SGroupCacheFileFd;
typedef struct SGcVgroupCtx { typedef struct SGcFileCacheCtx {
SArray* pTbList;
uint64_t lastUid;
int64_t fileSize; int64_t fileSize;
uint32_t fileId; uint32_t fileId;
SSHashObj* pCacheFile; SHashObj* pCacheFile;
int32_t baseNameLen; int32_t baseNameLen;
char baseFilename[PATH_MAX]; char baseFilename[PATH_MAX];
} SGcVgroupCtx; } SGcFileCacheCtx;
typedef struct SGcDownstreamCtx {
int32_t id;
SRWLatch grpLock;
int64_t fetchSessionId;
SArray* pNewGrpList; // SArray<SGcNewGroupInfo>
SSHashObj* pVgTbHash;
SHashObj* pGrpHash;
SRWLatch blkLock;
SSDataBlock* pBaseBlock;
SArray* pFreeBlock;
int64_t lastBlkUid;
SHashObj* pSessions;
SHashObj* pWaitSessions;
SGcFileCacheCtx fileCtx;
} SGcDownstreamCtx;
typedef struct SGroupSeqBlkList { typedef struct SGcVgroupCtx {
SRWLatch lock; SArray* pTbList;
SArray* pList; uint64_t lastBlkUid;
} SGroupSeqBlkList; SGcFileCacheCtx fileCtx;
} SGcVgroupCtx;
typedef struct SGroupBatchBlkList { typedef struct SGcBlkList {
SRWLatch lock; SRWLatch lock;
SArray* pList; SArray* pList;
} SGroupBatchBlkList; } SGcBlkList;
typedef struct SGroupCacheData { typedef struct SGroupCacheData {
TdThreadMutex mutex; TdThreadMutex mutex;
...@@ -72,10 +79,7 @@ typedef struct SGroupCacheData { ...@@ -72,10 +79,7 @@ typedef struct SGroupCacheData {
SGcVgroupCtx* pVgCtx; SGcVgroupCtx* pVgCtx;
int32_t downstreamIdx; int32_t downstreamIdx;
int32_t vgId; int32_t vgId;
union { SGcBlkList blkList;
SGroupSeqBlkList seqList;
SGroupBatchBlkList batchList;
};
uint32_t fileId; uint32_t fileId;
int64_t startOffset; int64_t startOffset;
} SGroupCacheData; } SGroupCacheData;
...@@ -103,24 +107,6 @@ typedef struct SGcNewGroupInfo { ...@@ -103,24 +107,6 @@ typedef struct SGcNewGroupInfo {
SOperatorParam* pParam; SOperatorParam* pParam;
} SGcNewGroupInfo; } SGcNewGroupInfo;
typedef struct SGcDownstreamCtx {
int32_t id;
SRWLatch grpLock;
int64_t fetchSessionId;
SArray* pNewGrpList; // SArray<SGcNewGroupInfo>
SSHashObj* pVgTbHash;
SHashObj* pGrpHash;
SRWLatch blkLock;
SSDataBlock* pBaseBlock;
SArray* pFreeBlock;
int64_t lastBlkUid;
SHashObj* pSessions;
SHashObj* pWaitSessions;
int32_t cacheFileFdNum;
SGroupCacheFileFd cacheFileFd;
char baseFilename[PATH_MAX];
} SGcDownstreamCtx;
typedef struct SGcSessionCtx { typedef struct SGcSessionCtx {
int32_t downstreamIdx; int32_t downstreamIdx;
SGcOperatorParam* pParam; SGcOperatorParam* pParam;
...@@ -131,6 +117,14 @@ typedef struct SGcSessionCtx { ...@@ -131,6 +117,14 @@ typedef struct SGcSessionCtx {
bool newFetch; bool newFetch;
} SGcSessionCtx; } SGcSessionCtx;
typedef struct SGcBlkBufInfo {
SGcBlkBufBasic basic;
void* next;
void* pBuf;
SGcDownstreamCtx* pCtx;
SGroupCacheData* pGroup;
} SGcBlkBufInfo;
typedef struct SGcExecInfo { typedef struct SGcExecInfo {
int32_t downstreamNum; int32_t downstreamNum;
int64_t* pDownstreamBlkNum; int64_t* pDownstreamBlkNum;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册