Merge pull request #19506 from taosdata/fix/TD-21663
fix: repeat malloc sdb raw
This commit is contained in:
commit
71df37a88b
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,6 +369,7 @@ int32_t mndSyncPropose(SMnode *pMnode, SSdbRaw *pRaw, int32_t transId) {
|
||||||
if (pMgmt->transId != 0) {
|
if (pMgmt->transId != 0) {
|
||||||
mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId);
|
mError("trans:%d, can't be proposed since trans:%d already waiting for confirm", transId, pMgmt->transId);
|
||||||
taosThreadMutexUnlock(&pMgmt->lock);
|
taosThreadMutexUnlock(&pMgmt->lock);
|
||||||
|
rpcFreeCont(req.pCont);
|
||||||
terrno = TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED;
|
terrno = TSDB_CODE_MND_LAST_TRANS_NOT_FINISHED;
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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