/ Check-in [08d0e879]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Merge the winAccess retry logic from the anti-antivirus branch into the trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 08d0e8799e1441ef063b1cdf9e4107071a0f81ca
User & Date: drh 2011-07-23 13:54:34
Context
2011-08-29
11:56
Back out [05c9832e5f6eb] since it was causing a performance regression with no obvious benefit. check-in: 639cc85a user: drh tags: trunk
2011-07-25
23:25
Enable the SQLITE_FCNTL_SIZE_HINT on unix even if SQLITE_FCNTL_CHUNK_SIZE has not been set. check-in: 05c9832e user: drh tags: trunk
2011-07-23
13:54
Merge the winAccess retry logic from the anti-antivirus branch into the trunk. check-in: 08d0e879 user: drh tags: trunk
13:11
In the multiplexor, close auxiliary files before deleting them when doing a truncate. check-in: 6fb7cfc2 user: drh tags: trunk
2011-07-22
21:25
Add retry logic for AV defense to winAccess(). Also allow OS tracing to be enabled by a compile-time option. Closed-Leaf check-in: a6b85c73 user: drh tags: av-defense
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_common.h.

    26     26   ** switch.  The following code should catch this problem at compile-time.
    27     27   */
    28     28   #ifdef MEMORY_DEBUG
    29     29   # error "The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead."
    30     30   #endif
    31     31   
    32     32   #ifdef SQLITE_DEBUG
    33         -int sqlite3OSTrace = 0;
    34         -#define OSTRACE(X)          if( sqlite3OSTrace ) sqlite3DebugPrintf X
           33  +# ifndef SQLITE_DEBUG_OS_TRACE
           34  +#   define SQLITE_DEBUG_OS_TRACE 0
           35  +# endif
           36  +  int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE;
           37  +# define OSTRACE(X)          if( sqlite3OSTrace ) sqlite3DebugPrintf X
    35     38   #else
    36         -#define OSTRACE(X)
           39  +# define OSTRACE(X)
    37     40   #endif
    38     41   
    39     42   /*
    40     43   ** Macros for performance tracing.  Normally turned off.  Only works
    41     44   ** on i486 hardware.
    42     45   */
    43     46   #ifdef SQLITE_PERFORMANCE_TRACE

Changes to src/os_win.c.

  2448   2448   
  2449   2449     SimulateIOError( return SQLITE_IOERR_ACCESS; );
  2450   2450     zConverted = convertUtf8Filename(zFilename);
  2451   2451     if( zConverted==0 ){
  2452   2452       return SQLITE_NOMEM;
  2453   2453     }
  2454   2454     if( isNT() ){
         2455  +    int cnt = 0;
  2455   2456       WIN32_FILE_ATTRIBUTE_DATA sAttrData;
  2456   2457       memset(&sAttrData, 0, sizeof(sAttrData));
  2457         -    if( GetFileAttributesExW((WCHAR*)zConverted,
         2458  +    while( (rc = GetFileAttributesExW((WCHAR*)zConverted,
  2458   2459                                GetFileExInfoStandard, 
  2459         -                             &sAttrData) ){
         2460  +                             &sAttrData)) && rc==0 && retryIoerr(&cnt) ){}
         2461  +    if( rc ){
  2460   2462         /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file
  2461   2463         ** as if it does not exist.
  2462   2464         */
  2463   2465         if(    flags==SQLITE_ACCESS_EXISTS
  2464   2466             && sAttrData.nFileSizeHigh==0 
  2465   2467             && sAttrData.nFileSizeLow==0 ){
  2466   2468           attr = INVALID_FILE_ATTRIBUTES;