1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix bug in the premutation testing that was causing many permutations from

begin skipped.  There are now 16 errors reported by the permutation test. (CVS 5610)

FossilOrigin-Name: 4ad096bda1fc5c7b66f71ff5b32a4085c9a40574
This commit is contained in:
drh
2008-08-25 17:23:29 +00:00
parent 502b74309a
commit 0a846f96ef
6 changed files with 77 additions and 68 deletions

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.478 2008/08/25 07:12:29 danielk1977 Exp $
** @(#) $Id: pager.c,v 1.479 2008/08/25 17:23:29 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -2495,29 +2495,27 @@ static int pagerStress(void *p, PgHdr *pPg){
static int hasHotJournal(Pager *pPager, int *pExists){
sqlite3_vfs *pVfs = pPager->pVfs;
int rc = SQLITE_OK;
int exists;
int locked;
assert( pPager!=0 );
assert( pPager->useJournal );
assert( pPager->fd->pMethods );
*pExists = 0;
if( pPager->useJournal && pPager->fd->pMethods ){
int exists;
int locked;
rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);
if( rc==SQLITE_OK && exists ){
rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
}
if( rc==SQLITE_OK && exists && !locked ){
int nPage;
rc = sqlite3PagerPagecount(pPager, &nPage);
if( rc==SQLITE_OK ){
if( nPage==0 ){
sqlite3OsDelete(pVfs, pPager->zJournal, 0);
}else{
*pExists = 1;
}
rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);
if( rc==SQLITE_OK && exists ){
rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
}
if( rc==SQLITE_OK && exists && !locked ){
int nPage;
rc = sqlite3PagerPagecount(pPager, &nPage);
if( rc==SQLITE_OK ){
if( nPage==0 ){
sqlite3OsDelete(pVfs, pPager->zJournal, 0);
}else{
*pExists = 1;
}
}
}
return rc;
}