/ Check-in [f1b2b5f9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a problem causing the return code of an xSync call to be ignored in wal.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | experimental
Files: files | file ages | folders
SHA1: f1b2b5f9c3a5561ea6108283ae08404106c3f8bc
User & Date: dan 2010-08-09 07:51:41
Context
2010-08-09
14:47
Change to tcl test infrastructure so that --malloctrace=1 works when sizeof(int)!=sizeof(void*). check-in: c3e771b3 user: dan tags: experimental
07:51
Fix a problem causing the return code of an xSync call to be ignored in wal.c. check-in: f1b2b5f9 user: dan tags: experimental
07:07
In WAL mode, ignore any error returned by an xFileControl(FCNTL_SIZE_HINT) call. This matches the behaviour in rollback mode. check-in: 158a3097 user: dan tags: experimental
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/wal.c.

  1563   1563         }
  1564   1564       }
  1565   1565     }
  1566   1566   
  1567   1567     if( pInfo->nBackfill<mxSafeFrame
  1568   1568      && (rc = walLockExclusive(pWal, WAL_READ_LOCK(0), 1))==SQLITE_OK
  1569   1569     ){
  1570         -    i64 nReq;                     /* File size hint passed to VFS */
  1571   1570       i64 nSize;                    /* Current size of database file */
  1572   1571       u32 nBackfill = pInfo->nBackfill;
  1573   1572   
  1574   1573       /* Sync the WAL to disk */
  1575   1574       if( sync_flags ){
  1576   1575         rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
  1577   1576       }
  1578   1577   
  1579   1578       /* If the database file may grow as a result of this checkpoint, hint
  1580   1579       ** about the eventual size of the db file to the VFS layer. 
  1581   1580       */
  1582         -    nReq = ((i64)mxPage * szPage);
  1583         -    rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
  1584         -    if( rc==SQLITE_OK && nSize<nReq ){
  1585         -      sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
         1581  +    if( rc==SQLITE_OK ){
         1582  +      i64 nReq = ((i64)mxPage * szPage);
         1583  +      rc = sqlite3OsFileSize(pWal->pDbFd, &nSize);
         1584  +      if( rc==SQLITE_OK && nSize<nReq ){
         1585  +        sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq);
         1586  +      }
  1586   1587       }
  1587   1588   
  1588   1589       /* Iterate through the contents of the WAL, copying data to the db file. */
  1589   1590       while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){
  1590   1591         i64 iOffset;
  1591   1592         assert( walFramePgno(pWal, iFrame)==iDbpage );
  1592   1593         if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ) continue;