SQLite

Check-in [d43e2e59b5]
Login

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

Overview
Comment:Revise locking retry semantics in Win32 VFS to abort early if the file handle is reported as invalid.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | winLockHandle
Files: files | file ages | folders
SHA1: d43e2e59b5647655595fd953febf2beefa480006
User & Date: mistachkin 2014-05-28 03:27:42.937
Context
2014-05-30
16:42
Add tests for the invalid file handle detection logic in the winLock() function. (check-in: ed5a9eb4f3 user: mistachkin tags: winLockHandle)
2014-05-28
03:27
Revise locking retry semantics in Win32 VFS to abort early if the file handle is reported as invalid. (check-in: d43e2e59b5 user: mistachkin tags: winLockHandle)
03:23
Revise how OSTRACE reports logically boolean results in the Win32 VFS. (check-in: c405f971cf user: mistachkin tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_win.c.
2920
2921
2922
2923
2924
2925
2926

2927
2928







2929
2930
2931
2932
2933
2934
2935
                                         PENDING_BYTE, 0, 1, 0))==0 ){
      /* Try 3 times to get the pending lock.  This is needed to work
      ** around problems caused by indexing and/or anti-virus software on
      ** Windows systems.
      ** If you are using this code as a model for alternative VFSes, do not
      ** copy this retry logic.  It is a hack intended for Windows only.
      */

      OSTRACE(("LOCK-PENDING-FAIL file=%p, count=%d, result=%d\n",
               pFile->h, cnt, res));







      if( cnt ) sqlite3_win32_sleep(1);
    }
    gotPendingLock = res;
    if( !res ){
      lastErrno = osGetLastError();
    }
  }







>


>
>
>
>
>
>
>







2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
                                         PENDING_BYTE, 0, 1, 0))==0 ){
      /* Try 3 times to get the pending lock.  This is needed to work
      ** around problems caused by indexing and/or anti-virus software on
      ** Windows systems.
      ** If you are using this code as a model for alternative VFSes, do not
      ** copy this retry logic.  It is a hack intended for Windows only.
      */
      lastErrno = osGetLastError();
      OSTRACE(("LOCK-PENDING-FAIL file=%p, count=%d, result=%d\n",
               pFile->h, cnt, res));
      if( lastErrno==ERROR_INVALID_HANDLE ){
        pFile->lastErrno = lastErrno;
        rc = SQLITE_IOERR_LOCK;
        OSTRACE(("LOCK-FAIL file=%p, count=%d, rc=%s\n",
                 pFile->h, cnt, sqlite3ErrName(rc)));
        return rc;
      }
      if( cnt ) sqlite3_win32_sleep(1);
    }
    gotPendingLock = res;
    if( !res ){
      lastErrno = osGetLastError();
    }
  }