/ 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 Unified Diffs Show Whitespace Changes Patch

Changes to ext/ota/sqlite3ota.c.

2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055


2056
2057
2058
2059
2060
2061

2062
2063
2064
2065
2066
2067
2068
    ** In order to ensure that there are no database readers, an EXCLUSIVE
    ** lock is obtained here before the *-oal is moved to *-wal.
    */
    otaLockDatabase(p);
    if( p->rc==SQLITE_OK ){
      otaFileSuffix3(zBase, zWal);
      otaFileSuffix3(zBase, zOal);
      rename(zOal, zWal);

      /* Re-open the databases. */
      otaObjIterFinalize(&p->objiter);
      sqlite3_close(p->dbMain);
      sqlite3_close(p->dbOta);


      p->dbMain = 0;
      p->dbOta = 0;
      otaOpenDatabase(p);
      otaSetupCheckpoint(p, 0);
    }
  }


  sqlite3_free(zWal);
  sqlite3_free(zOal);
}

/*
** The SELECT statement iterating through the keys for the current object







<





>
>






>







2043
2044
2045
2046
2047
2048
2049

2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
    ** In order to ensure that there are no database readers, an EXCLUSIVE
    ** lock is obtained here before the *-oal is moved to *-wal.
    */
    otaLockDatabase(p);
    if( p->rc==SQLITE_OK ){
      otaFileSuffix3(zBase, zWal);
      otaFileSuffix3(zBase, zOal);


      /* Re-open the databases. */
      otaObjIterFinalize(&p->objiter);
      sqlite3_close(p->dbMain);
      sqlite3_close(p->dbOta);
      p->rc = rename(zOal, zWal) ? SQLITE_IOERR : SQLITE_OK;
      if( p->rc==SQLITE_OK ){
        p->dbMain = 0;
        p->dbOta = 0;
        otaOpenDatabase(p);
        otaSetupCheckpoint(p, 0);
      }
    }
  }

  sqlite3_free(zWal);
  sqlite3_free(zOal);
}

/*
** The SELECT statement iterating through the keys for the current object