Merge pull request #19838 from taosdata/fix/outOfDisk
fix: fix return invalid err
This commit is contained in:
commit
c413e94192
|
@ -56,6 +56,9 @@ static int32_t createDiskFile(SDiskbasedBuf* pBuf) {
|
|||
char path[PATH_MAX] = {0};
|
||||
taosGetTmpfilePath(pBuf->prefix, "paged-buf", path);
|
||||
pBuf->path = taosMemoryStrDup(path);
|
||||
if (pBuf->path == NULL) {
|
||||
return TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
pBuf->pFile =
|
||||
|
@ -166,6 +169,7 @@ static char* doFlushBufPage(SDiskbasedBuf* pBuf, SPageInfo* pg) {
|
|||
t = doCompressData(payload, pBuf->pageSize, &size, pBuf);
|
||||
if (size < 0) {
|
||||
uError("failed to compress data when flushing data to disk, %s", pBuf->id);
|
||||
terrno = TSDB_CODE_INVALID_PARA;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -300,6 +304,7 @@ static SListNode* getEldestUnrefedPage(SDiskbasedBuf* pBuf) {
|
|||
static char* evictBufPage(SDiskbasedBuf* pBuf) {
|
||||
SListNode* pn = getEldestUnrefedPage(pBuf);
|
||||
if (pn == NULL) { // no available buffer pages now, return.
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -396,11 +401,12 @@ static char* doExtractPage(SDiskbasedBuf* pBuf) {
|
|||
if (NO_IN_MEM_AVAILABLE_PAGES(pBuf)) {
|
||||
availablePage = evictBufPage(pBuf);
|
||||
if (availablePage == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
uWarn("no available buf pages, current:%d, max:%d", listNEles(pBuf->lruList), pBuf->inMemPages)
|
||||
uWarn("no available buf pages, current:%d, max:%d, reason: %s, %s", listNEles(pBuf->lruList), pBuf->inMemPages,
|
||||
terrstr(), pBuf->id)
|
||||
}
|
||||
} else {
|
||||
availablePage = taosMemoryCalloc(1, getAllocPageSize(pBuf->pageSize)); // add extract bytes in case of zipped buffer increased.
|
||||
availablePage =
|
||||
taosMemoryCalloc(1, getAllocPageSize(pBuf->pageSize)); // add extract bytes in case of zipped buffer increased.
|
||||
if (availablePage == NULL) {
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
@ -548,9 +554,7 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) {
|
|||
|
||||
size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; }
|
||||
|
||||
SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) {
|
||||
return pBuf->pIdList;
|
||||
}
|
||||
SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) { return pBuf->pIdList; }
|
||||
|
||||
void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
|
||||
if (pBuf == NULL) {
|
||||
|
@ -625,9 +629,7 @@ SPageInfo* getLastPageInfo(SArray* pList) {
|
|||
return pPgInfo;
|
||||
}
|
||||
|
||||
int32_t getPageId(const SPageInfo* pPgInfo) {
|
||||
return pPgInfo->pageId;
|
||||
}
|
||||
int32_t getPageId(const SPageInfo* pPgInfo) { return pPgInfo->pageId; }
|
||||
|
||||
int32_t getBufPageSize(const SDiskbasedBuf* pBuf) { return pBuf->pageSize; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue