diff options
author | drh <drh@noemail.net> | 2020-07-28 17:17:36 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-07-28 17:17:36 +0000 |
commit | e7f3edcd49d00380357ca2f55e93c0c7361792db (patch) | |
tree | 9467772be5f34a7390ca3c2a036139426820ec96 /src | |
parent | f31230af12ecec3f21e6527f1fb11791ceec7eab (diff) | |
download | sqlite-e7f3edcd49d00380357ca2f55e93c0c7361792db.tar.gz sqlite-e7f3edcd49d00380357ca2f55e93c0c7361792db.zip |
Add an sqlite3FaultSim() to make an OOM case more accessible and remove
the ALWAYS() on the conditional that is false when the OOM actually occurs.
FossilOrigin-Name: 2a251af84ff1f5ca281aa69c5410d6ae7aa5a85ef47149909a297525e1651e9d
Diffstat (limited to 'src')
-rw-r--r-- | src/wal.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -590,7 +590,9 @@ static SQLITE_NOINLINE int walIndexPageRealloc( ); assert( pWal->apWiData[iPage]!=0 || rc!=SQLITE_OK || pWal->writeLock==0 ); testcase( pWal->apWiData[iPage]==0 && rc==SQLITE_OK ); - if( (rc&0xff)==SQLITE_READONLY ){ + if( rc==SQLITE_OK ){ + if( iPage>0 && sqlite3FaultSim(600) ) rc = SQLITE_NOMEM; + }else if( (rc&0xff)==SQLITE_READONLY ){ pWal->readOnly |= WAL_SHM_RDONLY; if( rc==SQLITE_READONLY ){ rc = SQLITE_OK; @@ -1062,7 +1064,7 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){ /* Assuming the wal-index file was successfully mapped, populate the ** page number array and hash table entry. */ - if( ALWAYS(rc==SQLITE_OK) ){ + if( rc==SQLITE_OK ){ int iKey; /* Hash table key */ int idx; /* Value to write to hash-table slot */ int nCollide; /* Number of hash collisions */ |