mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Remove some branches in walTryBeginRead() that were
added by check-in [ce5d13c2de] but became unreachable with the addition of logic in check-in [18b26843] that enabled read-only clients to parse the WAL file into a heap-memory WAL-index, thus guaranteeing that the WAL-index header is always available. FossilOrigin-Name: 9c6b38b9a96c11bdf9db4ea025720a4f49dcb723fa2e2776edc8453bce85c7e3
This commit is contained in:
13
src/wal.c
13
src/wal.c
@@ -2418,6 +2418,9 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
|
||||
|
||||
assert( pWal->readLock<0 ); /* Not currently locked */
|
||||
|
||||
/* useWal may only be set for read/write connections */
|
||||
assert( (pWal->readOnly & WAL_SHM_RDONLY)==0 || useWal==0 );
|
||||
|
||||
/* Take steps to avoid spinning forever if there is a protocol error.
|
||||
**
|
||||
** Circumstances that cause a RETRY should only last for the briefest
|
||||
@@ -2484,9 +2487,9 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
|
||||
}
|
||||
|
||||
assert( pWal->nWiData>0 );
|
||||
assert( pWal->apWiData[0] || (pWal->readOnly & WAL_SHM_RDONLY) );
|
||||
pInfo = pWal->apWiData[0] ? walCkptInfo(pWal) : 0;
|
||||
if( !useWal && (pInfo==0 || pInfo->nBackfill==pWal->hdr.mxFrame)
|
||||
assert( pWal->apWiData[0]!=0 );
|
||||
pInfo = walCkptInfo(pWal);
|
||||
if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame
|
||||
#ifdef SQLITE_ENABLE_SNAPSHOT
|
||||
&& (pWal->pSnapshot==0 || pWal->hdr.mxFrame==0
|
||||
|| 0==memcmp(&pWal->hdr, pWal->pSnapshot, sizeof(WalIndexHdr)))
|
||||
@@ -2498,9 +2501,7 @@ static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
|
||||
rc = walLockShared(pWal, WAL_READ_LOCK(0));
|
||||
walShmBarrier(pWal);
|
||||
if( rc==SQLITE_OK ){
|
||||
if( pInfo
|
||||
&& memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr))
|
||||
){
|
||||
if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){
|
||||
/* It is not safe to allow the reader to continue here if frames
|
||||
** may have been appended to the log before READ_LOCK(0) was obtained.
|
||||
** When holding READ_LOCK(0), the reader ignores the entire log file,
|
||||
|
Reference in New Issue
Block a user