/ Check-in [658c3b0c]
Login

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

Overview
Comment:Avoid attempting to rename the *-oal file while it is still open.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ota-update
Files: files | file ages | folders
SHA1: 658c3b0c80b9fe7eaac5982573651dc649a4c53f
User & Date: dan 2015-04-16 10:55:58
Context
2015-04-16
14:33
Fix a mismatched printf() argument and format specifier. Add ota files to Makefile.in. check-in: 5db810a8 user: dan tags: ota-update
10:55
Avoid attempting to rename the *-oal file while it is still open. check-in: 658c3b0c user: dan tags: ota-update
2015-04-15
14:26
Merge all recent trunk enhancements and fixes into the ota-update branch. check-in: 9bd3e445 user: drh tags: ota-update
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/ota/sqlite3ota.c.

  2043   2043       ** In order to ensure that there are no database readers, an EXCLUSIVE
  2044   2044       ** lock is obtained here before the *-oal is moved to *-wal.
  2045   2045       */
  2046   2046       otaLockDatabase(p);
  2047   2047       if( p->rc==SQLITE_OK ){
  2048   2048         otaFileSuffix3(zBase, zWal);
  2049   2049         otaFileSuffix3(zBase, zOal);
  2050         -      rename(zOal, zWal);
  2051   2050   
  2052   2051         /* Re-open the databases. */
  2053   2052         otaObjIterFinalize(&p->objiter);
  2054   2053         sqlite3_close(p->dbMain);
  2055   2054         sqlite3_close(p->dbOta);
  2056         -      p->dbMain = 0;
  2057         -      p->dbOta = 0;
  2058         -      otaOpenDatabase(p);
  2059         -      otaSetupCheckpoint(p, 0);
         2055  +      p->rc = rename(zOal, zWal) ? SQLITE_IOERR : SQLITE_OK;
         2056  +      if( p->rc==SQLITE_OK ){
         2057  +        p->dbMain = 0;
         2058  +        p->dbOta = 0;
         2059  +        otaOpenDatabase(p);
         2060  +        otaSetupCheckpoint(p, 0);
         2061  +      }
  2060   2062       }
  2061   2063     }
  2062   2064   
  2063   2065     sqlite3_free(zWal);
  2064   2066     sqlite3_free(zOal);
  2065   2067   }
  2066   2068