/ Check-in [15dd0169]
Login

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

Overview
Comment:Misc clean up. Wrapped a CE only variable in if-defs. Changed to only provide cache hint for CE builds (as this prevents CE from compressing the file.) Performance testing on XP and Vista showed caching hint had little effect when the DB size was much smaller than the O/S disk cache size, and provided only marginal benefit when the DB size was much larger than the cache. On Vista, overall system performance was hurt for very large DBs. Ticket #3387. (CVS 5753)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 15dd0169a4c5e2ff9e3894eec10799cb89d462e5
User & Date: shane 2008-09-30 04:20:08
Context
2008-09-30
09:31
Fix a recently introduced problem with deleting entries from index tables. (CVS 5754) check-in: 83c064ca user: danielk1977 tags: trunk
04:20
Misc clean up. Wrapped a CE only variable in if-defs. Changed to only provide cache hint for CE builds (as this prevents CE from compressing the file.) Performance testing on XP and Vista showed caching hint had little effect when the DB size was much smaller than the O/S disk cache size, and provided only marginal benefit when the DB size was much larger than the cache. On Vista, overall system performance was hurt for very large DBs. Ticket #3387. (CVS 5753) check-in: 15dd0169 user: shane tags: trunk
00:31
A few minor changes to test scripts so that they work on linux-amd64. (CVS 5752) check-in: 78d075ff user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   ******************************************************************************
    12     12   **
    13     13   ** This file contains code that is specific to windows.
    14     14   **
    15         -** $Id: os_win.c,v 1.133 2008/09/01 22:15:19 shane Exp $
           15  +** $Id: os_win.c,v 1.134 2008/09/30 04:20:08 shane Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   #if SQLITE_OS_WIN               /* This file is used for windows only */
    19     19   
    20     20   
    21     21   /*
    22     22   ** A Note About Memory Allocation:
................................................................................
   606    606   #define MX_CLOSE_ATTEMPT 3
   607    607   static int winClose(sqlite3_file *id){
   608    608     int rc, cnt = 0;
   609    609     winFile *pFile = (winFile*)id;
   610    610     OSTRACE2("CLOSE %d\n", pFile->h);
   611    611     do{
   612    612       rc = CloseHandle(pFile->h);
   613         -  }while( rc==0 && cnt++ < MX_CLOSE_ATTEMPT && (Sleep(100), 1) );
          613  +  }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (Sleep(100), 1) );
   614    614   #if SQLITE_OS_WINCE
   615    615   #define WINCE_DELETION_ATTEMPTS 3
   616    616     winceDestroyLock(pFile);
   617    617     if( pFile->zDeleteOnClose ){
   618    618       int cnt = 0;
   619    619       while(
   620    620              DeleteFileW(pFile->zDeleteOnClose)==0
................................................................................
  1173   1173     int *pOutFlags            /* Status return flags */
  1174   1174   ){
  1175   1175     HANDLE h;
  1176   1176     DWORD dwDesiredAccess;
  1177   1177     DWORD dwShareMode;
  1178   1178     DWORD dwCreationDisposition;
  1179   1179     DWORD dwFlagsAndAttributes = 0;
  1180         -  int isTemp;
         1180  +#if SQLITE_OS_WINCE
         1181  +  int isTemp = 0;
         1182  +#endif
  1181   1183     winFile *pFile = (winFile*)id;
  1182   1184     void *zConverted;                 /* Filename in OS encoding */
  1183   1185     const char *zUtf8Name = zName;    /* Filename in UTF-8 encoding */
  1184   1186     char zTmpname[MAX_PATH+1];        /* Buffer used to create temp filename */
  1185   1187   
  1186   1188     /* If the second argument to this function is NULL, generate a 
  1187   1189     ** temporary file name to use 
................................................................................
  1214   1216       dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
  1215   1217     }else{
  1216   1218       dwShareMode = 0;
  1217   1219     }
  1218   1220     if( flags & SQLITE_OPEN_DELETEONCLOSE ){
  1219   1221   #if SQLITE_OS_WINCE
  1220   1222       dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN;
         1223  +    isTemp = 1;
  1221   1224   #else
  1222   1225       dwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY
  1223   1226                                  | FILE_ATTRIBUTE_HIDDEN
  1224   1227                                  | FILE_FLAG_DELETE_ON_CLOSE;
  1225   1228   #endif
  1226         -    isTemp = 1;
  1227   1229     }else{
  1228   1230       dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
  1229         -    isTemp = 0;
  1230   1231     }
  1231   1232     /* Reports from the internet are that performance is always
  1232   1233     ** better if FILE_FLAG_RANDOM_ACCESS is used.  Ticket #2699. */
         1234  +#if SQLITE_OS_WINCE
  1233   1235     dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
         1236  +#endif
  1234   1237     if( isNT() ){
  1235   1238       h = CreateFileW((WCHAR*)zConverted,
  1236   1239          dwDesiredAccess,
  1237   1240          dwShareMode,
  1238   1241          NULL,
  1239   1242          dwCreationDisposition,
  1240   1243          dwFlagsAndAttributes,
................................................................................
  1304   1307   #define MX_DELETION_ATTEMPTS 5
  1305   1308   static int winDelete(
  1306   1309     sqlite3_vfs *pVfs,          /* Not used on win32 */
  1307   1310     const char *zFilename,      /* Name of file to delete */
  1308   1311     int syncDir                 /* Not used on win32 */
  1309   1312   ){
  1310   1313     int cnt = 0;
  1311         -  int rc;
         1314  +  DWORD rc;
  1312   1315     DWORD error;
  1313   1316     void *zConverted = convertUtf8Filename(zFilename);
  1314   1317     if( zConverted==0 ){
  1315   1318       return SQLITE_NOMEM;
  1316   1319     }
  1317   1320     SimulateIOError(return SQLITE_IOERR_DELETE);
  1318   1321     if( isNT() ){
  1319   1322       do{
  1320   1323         DeleteFileW(zConverted);
  1321   1324       }while(   (   ((rc = GetFileAttributesW(zConverted)) != INVALID_FILE_ATTRIBUTES)
  1322   1325                  || ((error = GetLastError()) == ERROR_ACCESS_DENIED))
  1323         -           && (cnt++ < MX_DELETION_ATTEMPTS)
         1326  +           && (++cnt < MX_DELETION_ATTEMPTS)
  1324   1327              && (Sleep(100), 1) );
  1325   1328     }else{
  1326   1329       do{
  1327   1330         DeleteFileA(zConverted);
  1328   1331       }while(   (   ((rc = GetFileAttributesA(zConverted)) != INVALID_FILE_ATTRIBUTES)
  1329   1332                  || ((error = GetLastError()) == ERROR_ACCESS_DENIED))
  1330         -           && (cnt++ < MX_DELETION_ATTEMPTS)
         1333  +           && (++cnt < MX_DELETION_ATTEMPTS)
  1331   1334              && (Sleep(100), 1) );
  1332   1335     }
  1333   1336     free(zConverted);
  1334   1337     OSTRACE2("DELETE \"%s\"\n", zFilename);
  1335         -  return (   (rc==INVALID_FILE_ATTRIBUTES) 
         1338  +  return (   (rc == INVALID_FILE_ATTRIBUTES) 
  1336   1339             && (error == ERROR_FILE_NOT_FOUND)) ? SQLITE_OK : SQLITE_IOERR_DELETE;
  1337   1340   }
  1338   1341   
  1339   1342   /*
  1340   1343   ** Check the existance and status of a file.
  1341   1344   */
  1342   1345   static int winAccess(