/ Check-in [f044c5f4]
Login

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

Overview
Comment:Fixed incorrect typecast for flock structure ptr in fcntl() call in sqlite3TestLockingStyle() Restored previous fullfsync behavior, try fsync() if fcntl(fd, F_FULLFSYNC, 0) returns an error. (CVS 3621)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f044c5f49f116ede8ab2d5ab43caa5ca9dd54ffe
User & Date: aswift 2007-01-31 23:37:08
Context
2007-02-01
01:40
Allow up to 64 tables in a join (the number of bits in a long long int). The old limit was 32 tables. (CVS 3622) check-in: 505dce8f user: drh tags: trunk
2007-01-31
23:37
Fixed incorrect typecast for flock structure ptr in fcntl() call in sqlite3TestLockingStyle() Restored previous fullfsync behavior, try fsync() if fcntl(fd, F_FULLFSYNC, 0) returns an error. (CVS 3621) check-in: f044c5f4 user: aswift tags: trunk
2007-01-29
17:58
Replace the randomHex() function with separate functions randomBlob() and hex(). (CVS 3620) check-in: f5ad74a9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

   561    561     struct flock lockInfo;
   562    562     
   563    563     lockInfo.l_len = 1;
   564    564     lockInfo.l_start = 0;
   565    565     lockInfo.l_whence = SEEK_SET;
   566    566     lockInfo.l_type = F_RDLCK;
   567    567     
   568         -  if (fcntl(fd, F_GETLK, (int) &lockInfo) != -1) {
          568  +  if (fcntl(fd, F_GETLK, &lockInfo) != -1) {
   569    569       return posixLockingStyle;
   570    570     } 
   571    571     
   572    572     /* testing for flock can give false positives.  So if if the above test
   573    573     ** fails, then we fall back to using dot-lock style locking.
   574    574     */  
   575    575     return dotlockLockingStyle;
................................................................................
  1156   1156   #ifdef SQLITE_NO_SYNC
  1157   1157     rc = SQLITE_OK;
  1158   1158   #else
  1159   1159   
  1160   1160   #if HAVE_FULLFSYNC
  1161   1161     if( fullSync ){
  1162   1162       rc = fcntl(fd, F_FULLFSYNC, 0);
  1163         -  }else
  1164         -#endif /* HAVE_FULLFSYNC */
         1163  +  }else{
         1164  +    rc = 1;
         1165  +  }
         1166  +  /* If the FULLFSYNC failed, fall back to attempting an fsync().
         1167  +   * It shouldn't be possible for fullfsync to fail on the local 
         1168  +   * file system (on OSX), so failure indicates that FULLFSYNC
         1169  +   * isn't supported for this file system. So, attempt an fsync 
         1170  +   * and (for now) ignore the overhead of a superfluous fcntl call.  
         1171  +   * It'd be better to detect fullfsync support once and avoid 
         1172  +   * the fcntl call every time sync is called.
         1173  +   */
         1174  +  if( rc ) rc = fsync(fd);
         1175  +
         1176  +#else 
  1165   1177     if( dataOnly ){
  1166   1178       rc = fdatasync(fd);
  1167   1179     }else{
  1168   1180       rc = fsync(fd);
  1169   1181     }
         1182  +#endif /* HAVE_FULLFSYNC */
  1170   1183   #endif /* defined(SQLITE_NO_SYNC) */
  1171   1184   
  1172   1185     return rc;
  1173   1186   }
  1174   1187   
  1175   1188   /*
  1176   1189   ** Make sure all writes to a particular file are committed to disk.