提交 9c737612 编写于 作者: H Haojun Liao

[td-225] update the error code when system related error happens.

上级 c9860ac5
......@@ -149,7 +149,7 @@ int16_t tExtMemBufferPut(tExtMemBuffer *pMemBuffer, void *data, int32_t numOfRow
* @param pMemBuffer
* @return
*/
bool tExtMemBufferFlush(tExtMemBuffer *pMemBuffer);
int32_t tExtMemBufferFlush(tExtMemBuffer *pMemBuffer);
/**
*
......
......@@ -245,30 +245,29 @@ static void tExtMemBufferClearFlushoutInfo(tExtMemBuffer *pMemBuffer) {
memset(pFileMeta->flushoutData.pFlushoutInfo, 0, sizeof(tFlushoutInfo) * pFileMeta->flushoutData.nAllocSize);
}
bool tExtMemBufferFlush(tExtMemBuffer *pMemBuffer) {
int32_t tExtMemBufferFlush(tExtMemBuffer *pMemBuffer) {
int32_t ret = 0;
if (pMemBuffer->numOfTotalElems == 0) {
return true;
return ret;
}
if (pMemBuffer->file == NULL) {
if ((pMemBuffer->file = fopen(pMemBuffer->path, "wb+")) == NULL) {
return false;
ret = TAOS_SYSTEM_ERROR(errno);
return ret;
}
}
/* all data has been flushed to disk, ignore flush operation */
if (pMemBuffer->numOfElemsInBuffer == 0) {
return true;
return ret;
}
bool ret = true;
tFilePagesItem *first = pMemBuffer->pHead;
while (first != NULL) {
size_t retVal = fwrite((char *)&(first->item), pMemBuffer->pageSize, 1, pMemBuffer->file);
if (retVal <= 0) { // failed to write to buffer, may be not enough space
ret = false;
ret = TAOS_SYSTEM_ERROR(errno);
}
pMemBuffer->fileMeta.numOfElemsInFile += first->item.num;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册