提交 b17b4932 编写于 作者: H Haojun Liao

[td-11818]Refactor.

上级 4dbbf286
...@@ -39,73 +39,73 @@ typedef struct SFilePage { ...@@ -39,73 +39,73 @@ typedef struct SFilePage {
/** /**
* create disk-based result buffer * create disk-based result buffer
* @param pResultBuf * @param pBuf
* @param rowSize * @param rowSize
* @param pagesize * @param pagesize
* @param inMemPages * @param inMemPages
* @param handle * @param handle
* @return * @return
*/ */
int32_t createDiskbasedBuffer(SDiskbasedBuf** pResultBuf, int32_t pagesize, int32_t inMemBufSize, uint64_t qId, const char* dir); int32_t createDiskbasedBuffer(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMemBufSize, uint64_t qId, const char* dir);
/** /**
* *
* @param pResultBuf * @param pBuf
* @param groupId * @param groupId
* @param pageId * @param pageId
* @return * @return
*/ */
SFilePage* getNewDataBuf(SDiskbasedBuf* pResultBuf, int32_t groupId, int32_t* pageId); SFilePage* getNewDataBuf(SDiskbasedBuf* pBuf, int32_t groupId, int32_t* pageId);
/** /**
* *
* @param pResultBuf * @param pBuf
* @param groupId * @param groupId
* @return * @return
*/ */
SIDList getDataBufPagesIdList(SDiskbasedBuf* pResultBuf, int32_t groupId); SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf, int32_t groupId);
/** /**
* get the specified buffer page by id * get the specified buffer page by id
* @param pResultBuf * @param pBuf
* @param id * @param id
* @return * @return
*/ */
SFilePage* getBufPage(SDiskbasedBuf* pResultBuf, int32_t id); SFilePage* getBufPage(SDiskbasedBuf* pBuf, int32_t id);
/** /**
* release the referenced buf pages * release the referenced buf pages
* @param pResultBuf * @param pBuf
* @param page * @param page
*/ */
void releaseBufPage(SDiskbasedBuf* pResultBuf, void* page); void releaseBufPage(SDiskbasedBuf* pBuf, void* page);
/** /**
* *
* @param pResultBuf * @param pBuf
* @param pi * @param pi
*/ */
void releaseBufPageInfo(SDiskbasedBuf* pResultBuf, struct SPageInfo* pi); void releaseBufPageInfo(SDiskbasedBuf* pBuf, struct SPageInfo* pi);
/** /**
* get the total buffer size in the format of disk file * get the total buffer size in the format of disk file
* @param pResultBuf * @param pBuf
* @return * @return
*/ */
size_t getTotalBufSize(const SDiskbasedBuf* pResultBuf); size_t getTotalBufSize(const SDiskbasedBuf* pBuf);
/** /**
* get the number of groups in the result buffer * get the number of groups in the result buffer
* @param pResultBuf * @param pBuf
* @return * @return
*/ */
size_t getNumOfResultBufGroupId(const SDiskbasedBuf* pResultBuf); size_t getNumOfResultBufGroupId(const SDiskbasedBuf* pBuf);
/** /**
* destroy result buffer * destroy result buffer
* @param pResultBuf * @param pBuf
*/ */
void destroyResultBuf(SDiskbasedBuf* pResultBuf); void destroyResultBuf(SDiskbasedBuf* pBuf);
/** /**
* *
...@@ -123,24 +123,30 @@ int32_t getPageId(const SPageInfo* pPgInfo); ...@@ -123,24 +123,30 @@ int32_t getPageId(const SPageInfo* pPgInfo);
/** /**
* Return the buffer page size. * Return the buffer page size.
* @param pResultBuf * @param pBuf
* @return * @return
*/ */
int32_t getBufPageSize(const SDiskbasedBuf* pResultBuf); int32_t getBufPageSize(const SDiskbasedBuf* pBuf);
/** /**
* *
* @param pResultBuf * @param pBuf
* @return * @return
*/ */
bool isAllDataInMemBuf(const SDiskbasedBuf* pResultBuf); bool isAllDataInMemBuf(const SDiskbasedBuf* pBuf);
/** /**
* Set the buffer page is dirty, and needs to be flushed to disk when swap out. * Set the buffer page is dirty, and needs to be flushed to disk when swap out.
* @param pPageInfo * @param pPageInfo
* @param dirty * @param dirty
*/ */
void setBufPageDirty(SPageInfo* pPageInfo, bool dirty); void setBufPageDirty(SFilePage* pPageInfo, bool dirty);
/**
* Print the statistics when closing this buffer
* @param pBuf
*/
void printStatisBeforeClose(SDiskbasedBuf* pBuf);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -5729,6 +5729,8 @@ void addToDiskbasedBuf(SOrderOperatorInfo* pInfo, jmp_buf env) { ...@@ -5729,6 +5729,8 @@ void addToDiskbasedBuf(SOrderOperatorInfo* pInfo, jmp_buf env) {
assert(size <= getBufPageSize(pInfo->pSortInternalBuf)); assert(size <= getBufPageSize(pInfo->pSortInternalBuf));
blockDataToBuf(pPage->data, p); blockDataToBuf(pPage->data, p);
setBufPageDirty(pPage, true);
releaseBufPage(pInfo->pSortInternalBuf, pPage); releaseBufPage(pInfo->pSortInternalBuf, pPage);
blockDataDestroy(p); blockDataDestroy(p);
......
...@@ -293,6 +293,8 @@ TEST(testCase, external_sort_Test) { ...@@ -293,6 +293,8 @@ TEST(testCase, external_sort_Test) {
// } // }
} }
printStatisBeforeClose(((SOrderOperatorInfo*) pOperator->info)->pSortInternalBuf);
int64_t s2 = taosGetTimestampUs(); int64_t s2 = taosGetTimestampUs();
printf("total:%ld\n", s2 - s1); printf("total:%ld\n", s2 - s1);
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册