/ Check-in [64914980]
Login

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

Overview
Comment:Change the name of SQLITE_FCNTL_SYNC to SQLITE_FCNTL_SYNC_OMITTED and only send it when PRAGMA synchronous=OFF. Add better documentation to explain what that file-control opcode is used for.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 64914980855dbbf19512642836ca962a507b3ddb
User & Date: drh 2011-01-25 16:20:16
Context
2011-01-25
16:48
Make sure the return code from doing an xSync is correctly initialized so that a valid return code is produced regardless of the path taken through the logic. check-in: f12b5d76 user: drh tags: trunk
16:20
Change the name of SQLITE_FCNTL_SYNC to SQLITE_FCNTL_SYNC_OMITTED and only send it when PRAGMA synchronous=OFF. Add better documentation to explain what that file-control opcode is used for. check-in: 64914980 user: drh tags: trunk
13:43
Fix a couple of typos in comments. No changes to actual code. check-in: 9167fdb3 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pager.c.

  5620   5620   ** or pages with the Pager.noSync flag set.
  5621   5621   **
  5622   5622   ** If successful, or if called on a pager for which it is a no-op, this
  5623   5623   ** function returns SQLITE_OK. Otherwise, an IO error code is returned.
  5624   5624   */
  5625   5625   int sqlite3PagerSync(Pager *pPager){
  5626   5626     int rc;                              /* Return code */
  5627         -  if( pPager->noSync ){
  5628         -    rc = SQLITE_OK;
  5629         -  }else{
         5627  +  if( !pPager->noSync ){
  5630   5628       assert( !MEMDB );
  5631   5629       rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);
  5632         -  }
  5633         -  if( isOpen(pPager->fd) ){
         5630  +  }else if( isOpen(pPager->fd) ){
  5634   5631       assert( !MEMDB );
  5635         -    sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, (void *)&rc);
         5632  +    sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC_OMITTED, (void *)&rc);
         5633  +  }else{
         5634  +    rc = SQLITE_OK;
  5636   5635     }
  5637   5636     return rc;
  5638   5637   }
  5639   5638   
  5640   5639   /*
  5641   5640   ** This function may only be called while a write-transaction is active in
  5642   5641   ** rollback. If the connection is in WAL mode, this call is a no-op. 

Changes to src/sqlite.h.in.

   712    712   ** improve performance on some systems.
   713    713   **
   714    714   ** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
   715    715   ** to the [sqlite3_file] object associated with a particular database
   716    716   ** connection.  See the [sqlite3_file_control()] documentation for
   717    717   ** additional information.
   718    718   **
   719         -** The [SQLITE_FCNTL_SYNC] opcode is used internally. SQLite calls
   720         -** the file-control method with this opcode immediately after the database
   721         -** file is synced, or if the database is running in synchronous=off mode
   722         -** immediately after it would have been synced otherwise. This makes it
   723         -** easier to write special VFS modules that depend on the xSync call.
          719  +** ^(The [SQLITE_FCNTL_SYNC_OMITTED] opcode is generated internally by
          720  +** SQLite and sent to all VFSes in place of a call to the xSync method
          721  +** when the database connection has [PRAGMA synchronous] set to OFF.)^
          722  +** Some specialized VFSes need this signal in order to operate correctly
          723  +** when [PRAGMA synchronous | PRAGMA synchronous=OFF] is set, but most 
          724  +** VFSes do not need this signal and should silently ignore this opcode.
          725  +** Applications should not call [sqlite3_file_control()] with this
          726  +** opcode as doing so may disrupt the operation of the specilized VFSes
          727  +** that do require it.  
   724    728   */
   725    729   #define SQLITE_FCNTL_LOCKSTATE        1
   726    730   #define SQLITE_GET_LOCKPROXYFILE      2
   727    731   #define SQLITE_SET_LOCKPROXYFILE      3
   728    732   #define SQLITE_LAST_ERRNO             4
   729    733   #define SQLITE_FCNTL_SIZE_HINT        5
   730    734   #define SQLITE_FCNTL_CHUNK_SIZE       6
   731    735   #define SQLITE_FCNTL_FILE_POINTER     7
   732         -#define SQLITE_FCNTL_SYNC             8
          736  +#define SQLITE_FCNTL_SYNC_OMITTED     8
   733    737   
   734    738   
   735    739   /*
   736    740   ** CAPI3REF: Mutex Handle
   737    741   **
   738    742   ** The mutex module within SQLite defines [sqlite3_mutex] to be an
   739    743   ** abstract type for a mutex object.  The SQLite core never looks