fix: repeat malloc sdb raw
This commit is contained in:
parent
6fccf849a1
commit
e9c213ff0f
|
@ -293,7 +293,7 @@ static int32_t mndProcessCreateFuncReq(SRpcMsg *pReq) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
mInfo("func:%s, start to create", createReq.name);
|
mInfo("func:%s, start to create, size:%d", createReq.name, createReq.codeLen);
|
||||||
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_FUNC) != 0) {
|
if (mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_FUNC) != 0) {
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,11 +228,12 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
||||||
int32_t readLen = 0;
|
int32_t readLen = 0;
|
||||||
int64_t ret = 0;
|
int64_t ret = 0;
|
||||||
char file[PATH_MAX] = {0};
|
char file[PATH_MAX] = {0};
|
||||||
|
int32_t bufLen = TSDB_MAX_MSG_SIZE;
|
||||||
|
|
||||||
snprintf(file, sizeof(file), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
|
snprintf(file, sizeof(file), "%s%ssdb.data", pSdb->currDir, TD_DIRSEP);
|
||||||
mInfo("start to read sdb file:%s", file);
|
mInfo("start to read sdb file:%s", file);
|
||||||
|
|
||||||
SSdbRaw *pRaw = taosMemoryMalloc(TSDB_MAX_MSG_SIZE + 100);
|
SSdbRaw *pRaw = taosMemoryMalloc(bufLen + 100);
|
||||||
if (pRaw == NULL) {
|
if (pRaw == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
mError("failed read sdb file since %s", terrstr());
|
mError("failed read sdb file since %s", terrstr());
|
||||||
|
@ -275,14 +276,15 @@ static int32_t sdbReadFileImp(SSdb *pSdb) {
|
||||||
}
|
}
|
||||||
|
|
||||||
readLen = pRaw->dataLen + sizeof(int32_t);
|
readLen = pRaw->dataLen + sizeof(int32_t);
|
||||||
if (readLen >= pRaw->dataLen) {
|
if (readLen >= bufLen) {
|
||||||
SSdbRaw *pNewRaw = taosMemoryMalloc(pRaw->dataLen + TSDB_MAX_MSG_SIZE);
|
bufLen = pRaw->dataLen * 2;
|
||||||
|
SSdbRaw *pNewRaw = taosMemoryMalloc(bufLen + 100);
|
||||||
if (pNewRaw == NULL) {
|
if (pNewRaw == NULL) {
|
||||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||||
mError("failed read sdb file since malloc new sdbRaw size:%d failed", pRaw->dataLen + TSDB_MAX_MSG_SIZE);
|
mError("failed read sdb file since malloc new sdbRaw size:%d failed", bufLen);
|
||||||
goto _OVER;
|
goto _OVER;
|
||||||
}
|
}
|
||||||
mInfo("malloc new sdbRaw size:%d, type:%d", pRaw->dataLen + TSDB_MAX_MSG_SIZE, pRaw->type);
|
mInfo("malloc new sdb raw size:%d, type:%d", bufLen, pRaw->type);
|
||||||
memcpy(pNewRaw, pRaw, sizeof(SSdbRaw));
|
memcpy(pNewRaw, pRaw, sizeof(SSdbRaw));
|
||||||
sdbFreeRaw(pRaw);
|
sdbFreeRaw(pRaw);
|
||||||
pRaw = pNewRaw;
|
pRaw = pNewRaw;
|
||||||
|
|
Loading…
Reference in New Issue