feat: check temp space availability

This commit is contained in:
slzhou 2024-02-28 14:31:31 +08:00
parent 67559afcae
commit 2fb0c1a00f
2 changed files with 13 additions and 4 deletions

View File

@ -4015,9 +4015,10 @@ int32_t startDurationForGroupTableMergeScan(SOperatorInfo* pOperator) {
pInfo->pSortHandle = tsortCreateSortHandle(pInfo->pSortInfo, SORT_BLOCK_TS_MERGE, pInfo->bufPageSize, numOfBufPage,
pInfo->pSortInputBlock, pTaskInfo->id.str, 0, 0, 0);
int32_t memSize = 512 * 1024 * 1024;
// int32_t rowBytes = blockDataGetRowSize(pInfo->pResBlock) + taosArrayGetSize(pInfo->pResBlock->pDataBlock) + sizeof(int32_t);
// int32_t pageSize = TMAX(memSize/numOfTable, rowBytes);
tsortSetSortByRowId(pInfo->pSortHandle, pInfo->bufPageSize, memSize);
code = tsortSetSortByRowId(pInfo->pSortHandle, pInfo->bufPageSize, memSize);
if (code != TSDB_CODE_SUCCESS) {
return code;
}
} else {
pInfo->pSortHandle = tsortCreateSortHandle(pInfo->pSortInfo, SORT_BLOCK_TS_MERGE, pInfo->bufPageSize, numOfBufPage,
pInfo->pSortInputBlock, pTaskInfo->id.str, 0, 0, 0);
@ -4210,7 +4211,10 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) {
} else {
if (pInfo->bNewFilesetEvent) {
stopDurationForGroupTableMergeScan(pOperator);
startDurationForGroupTableMergeScan(pOperator);
code = startDurationForGroupTableMergeScan(pOperator);
if (code != TSDB_CODE_SUCCESS) {
T_LONG_JMP(pTaskInfo->env, terrno);
}
} else {
// Data of this group are all dumped, let's try the next group
stopGroupTableMergeScan(pOperator);

View File

@ -1266,6 +1266,11 @@ int32_t tsortSetSortByRowId(SSortHandle* pHandle, int32_t extRowsPageSize, int32
SBlockOrderInfo* pOrder = taosArrayGet(pHandle->pSortInfo, 0);
pHandle->extRowsOrderInfo = *pOrder;
initRowIdSort(pHandle);
if (!osTempSpaceAvailable()) {
terrno = TSDB_CODE_NO_DISKSPACE;
qError("create sort mem file failed since %s, tempDir:%s", terrstr(), tsTempDir);
return terrno;
}
int32_t code = createSortMemFile(pHandle);
pHandle->bSortByRowId = true;
return code;