Fix further OOM handling cases in LSM.

FossilOrigin-Name: ca757c8665e27de884086b2aab2bd1db481e2d12f2afe136ec151bf5a0e65b91
This commit is contained in:
dan
2017-07-04 19:23:32 +00:00
parent 038af0bdc6
commit 431a53fde2
6 changed files with 21 additions and 16 deletions
+1 -1
View File
@@ -1093,7 +1093,7 @@ int lsmCheckpointSaveWorker(lsm_db *pDb, int bFlush){
memcpy(pShm->aSnap1, p, n);
lsmFree(pDb->pEnv, p);
assert( lsmFsIntegrityCheck(pDb) );
/* assert( lsmFsIntegrityCheck(pDb) ); */
return LSM_OK;
}
+2 -1
View File
@@ -377,6 +377,7 @@ int lsmLogBegin(lsm_db *pDb){
lsmStringInit(&pNew->buf, pDb->pEnv);
rc = lsmStringExtend(&pNew->buf, 2);
}
pDb->pLogWriter = pNew;
}else{
pNew = pDb->pLogWriter;
assert( (u8 *)(&pNew[1])==(u8 *)(&((&pNew->buf)[1])) );
@@ -468,7 +469,7 @@ int lsmLogBegin(lsm_db *pDb){
pNew->jump.iEnd = lastByteOnSector(pNew, pNew->jump.iEnd);
}
pDb->pLogWriter = pNew;
assert( pDb->pLogWriter==pNew );
return rc;
}
+4 -2
View File
@@ -226,7 +226,7 @@ int lsm_close(lsm_db *pDb){
lsmDbDatabaseRelease(pDb);
lsmLogClose(pDb);
lsmFsClose(pDb->pFS);
assert( pDb->mLock==0 );
/* assert( pDb->mLock==0 ); */
/* Invoke any destructors registered for the compression or
** compression factory callbacks. */
@@ -920,12 +920,14 @@ int lsm_commit(lsm_db *pDb, int iLevel){
if( iLevel<pDb->nTransOpen ){
if( iLevel==0 ){
int rc2;
/* Commit the transaction to disk. */
if( rc==LSM_OK ) rc = lsmLogCommit(pDb);
if( rc==LSM_OK && pDb->eSafety==LSM_SAFETY_FULL ){
rc = lsmFsSyncLog(pDb->pFS);
}
lsmFinishWriteTrans(pDb, (rc==LSM_OK));
rc2 = lsmFinishWriteTrans(pDb, (rc==LSM_OK));
if( rc==LSM_OK ) rc = rc2;
}
pDb->nTransOpen = iLevel;
}
+4 -2
View File
@@ -3874,7 +3874,7 @@ static int mergeWorkerData(
int rc = LSM_OK; /* Return code */
int nRem = nWrite; /* Number of bytes still to write */
while( nRem>0 ){
while( rc==LSM_OK && nRem>0 ){
Merge *pMerge = pMW->pLevel->pMerge;
int nCopy; /* Number of bytes to copy */
u8 *aData; /* Pointer to buffer of current output page */
@@ -5406,7 +5406,9 @@ int lsmSortedAutoWork(
lsmMCursorFreeCache(pDb);
lsmFreeSnapshot(pDb->pEnv, pDb->pClient);
pDb->pClient = 0;
rc = lsmCheckpointLoad(pDb, 0);
if( rc==LSM_OK ){
rc = lsmCheckpointLoad(pDb, 0);
}
if( rc==LSM_OK ){
rc = lsmCheckpointDeserialize(pDb, 0, pDb->aSnapshot, &pDb->pClient);
}