enh(query): improve the performance and add some todo
This commit is contained in:
parent
de0022b473
commit
658cb393a7
|
@ -129,6 +129,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, in
|
||||||
void* pData = NULL;
|
void* pData = NULL;
|
||||||
pGroupResInfo->pRows = taosArrayInit(10, POINTER_BYTES);
|
pGroupResInfo->pRows = taosArrayInit(10, POINTER_BYTES);
|
||||||
|
|
||||||
|
// todo avoid repeated malloc memory
|
||||||
size_t keyLen = 0;
|
size_t keyLen = 0;
|
||||||
int32_t iter = 0;
|
int32_t iter = 0;
|
||||||
while ((pData = tSimpleHashIterate(pHashmap, pData, &iter)) != NULL) {
|
while ((pData = tSimpleHashIterate(pHashmap, pData, &iter)) != NULL) {
|
||||||
|
|
|
@ -165,10 +165,7 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
||||||
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
colDataDestroy(out.columnData);
|
colInfoDataCleanup(out.columnData, out.numOfRows);
|
||||||
taosMemoryFreeClear(out.columnData);
|
|
||||||
out.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData));
|
|
||||||
|
|
||||||
cell = cell->pNext;
|
cell = cell->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ struct SDiskbasedBuf {
|
||||||
TdFilePtr pFile;
|
TdFilePtr pFile;
|
||||||
int32_t allocateId; // allocated page id
|
int32_t allocateId; // allocated page id
|
||||||
char* path; // file path
|
char* path; // file path
|
||||||
|
char* prefix; // file name prefix
|
||||||
int32_t pageSize; // current used page size
|
int32_t pageSize; // current used page size
|
||||||
int32_t inMemPages; // numOfPages that are allocated in memory
|
int32_t inMemPages; // numOfPages that are allocated in memory
|
||||||
SList* freePgList; // free page list
|
SList* freePgList; // free page list
|
||||||
|
@ -48,6 +49,12 @@ struct SDiskbasedBuf {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int32_t createDiskFile(SDiskbasedBuf* pBuf) {
|
static int32_t createDiskFile(SDiskbasedBuf* pBuf) {
|
||||||
|
if (pBuf->path[0] == '\0') { // prepare the file name when needed it
|
||||||
|
char path[PATH_MAX] = {0};
|
||||||
|
taosGetTmpfilePath(pBuf->prefix, "paged-buf", path);
|
||||||
|
pBuf->path = taosMemoryStrDup(path);
|
||||||
|
}
|
||||||
|
|
||||||
pBuf->pFile =
|
pBuf->pFile =
|
||||||
taosOpenFile(pBuf->path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC | TD_FILE_AUTO_DEL);
|
taosOpenFile(pBuf->path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC | TD_FILE_AUTO_DEL);
|
||||||
if (pBuf->pFile == NULL) {
|
if (pBuf->pFile == NULL) {
|
||||||
|
@ -356,10 +363,7 @@ int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMem
|
||||||
|
|
||||||
pPBuf->assistBuf = taosMemoryMalloc(pPBuf->pageSize + 2); // EXTRA BYTES
|
pPBuf->assistBuf = taosMemoryMalloc(pPBuf->pageSize + 2); // EXTRA BYTES
|
||||||
pPBuf->all = taosHashInit(10, fn, true, false);
|
pPBuf->all = taosHashInit(10, fn, true, false);
|
||||||
|
pPBuf->prefix = (char*) dir;
|
||||||
char path[PATH_MAX] = {0};
|
|
||||||
taosGetTmpfilePath(dir, "paged-buf", path);
|
|
||||||
pPBuf->path = strdup(path);
|
|
||||||
|
|
||||||
pPBuf->emptyDummyIdList = taosArrayInit(1, sizeof(int32_t));
|
pPBuf->emptyDummyIdList = taosArrayInit(1, sizeof(int32_t));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue