/ Check-in [c405f971]
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:Revise how OSTRACE reports logically boolean results in the Win32 VFS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c405f971cf03e29110019ff863cbfb026d97e1e6
User & Date: mistachkin 2014-05-28 03:23:55
Context
2014-05-28
10:00
Add an extra test to verify that the FTS notindexed option is working. check-in: c461c0fe user: dan tags: trunk
09:56
Moved to "mistake" because this commit contains a typo causing a test to fail. Was: Add an extra test to further verify that the FTS notindexed option is working properly. Leaf check-in: 7d445e59 user: dan tags: mistake
03:27
Revise locking retry semantics in Win32 VFS to abort early if the file handle is reported as invalid. check-in: d43e2e59 user: mistachkin tags: winLockHandle
03:23
Revise how OSTRACE reports logically boolean results in the Win32 VFS. check-in: c405f971 user: mistachkin tags: trunk
2014-05-27
20:19
Remove an incorrect assert() in the sorter. check-in: b8b66103 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_win.c.

  2821   2821                         SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
  2822   2822     }
  2823   2823   #endif
  2824   2824     if( res == 0 ){
  2825   2825       pFile->lastErrno = osGetLastError();
  2826   2826       /* No need to log a failure to lock */
  2827   2827     }
  2828         -  OSTRACE(("READ-LOCK file=%p, rc=%s\n", pFile->h, sqlite3ErrName(res)));
         2828  +  OSTRACE(("READ-LOCK file=%p, result=%d\n", pFile->h, res));
  2829   2829     return res;
  2830   2830   }
  2831   2831   
  2832   2832   /*
  2833   2833   ** Undo a readlock
  2834   2834   */
  2835   2835   static int winUnlockReadLock(winFile *pFile){
................................................................................
  2845   2845     }
  2846   2846   #endif
  2847   2847     if( res==0 && ((lastErrno = osGetLastError())!=ERROR_NOT_LOCKED) ){
  2848   2848       pFile->lastErrno = lastErrno;
  2849   2849       winLogError(SQLITE_IOERR_UNLOCK, pFile->lastErrno,
  2850   2850                   "winUnlockReadLock", pFile->zPath);
  2851   2851     }
  2852         -  OSTRACE(("READ-UNLOCK file=%p, rc=%s\n", pFile->h, sqlite3ErrName(res)));
         2852  +  OSTRACE(("READ-UNLOCK file=%p, result=%d\n", pFile->h, res));
  2853   2853     return res;
  2854   2854   }
  2855   2855   
  2856   2856   /*
  2857   2857   ** Lock the file with the lock specified by parameter locktype - one
  2858   2858   ** of the following:
  2859   2859   **
................................................................................
  2920   2920                                            PENDING_BYTE, 0, 1, 0))==0 ){
  2921   2921         /* Try 3 times to get the pending lock.  This is needed to work
  2922   2922         ** around problems caused by indexing and/or anti-virus software on
  2923   2923         ** Windows systems.
  2924   2924         ** If you are using this code as a model for alternative VFSes, do not
  2925   2925         ** copy this retry logic.  It is a hack intended for Windows only.
  2926   2926         */
  2927         -      OSTRACE(("LOCK-PENDING-FAIL file=%p, count=%d, rc=%s\n",
  2928         -               pFile->h, cnt, sqlite3ErrName(res)));
         2927  +      OSTRACE(("LOCK-PENDING-FAIL file=%p, count=%d, result=%d\n",
         2928  +               pFile->h, cnt, res));
  2929   2929         if( cnt ) sqlite3_win32_sleep(1);
  2930   2930       }
  2931   2931       gotPendingLock = res;
  2932   2932       if( !res ){
  2933   2933         lastErrno = osGetLastError();
  2934   2934       }
  2935   2935     }
................................................................................
  3006   3006   
  3007   3007   /*
  3008   3008   ** This routine checks if there is a RESERVED lock held on the specified
  3009   3009   ** file by this or any other process. If such a lock is held, return
  3010   3010   ** non-zero, otherwise zero.
  3011   3011   */
  3012   3012   static int winCheckReservedLock(sqlite3_file *id, int *pResOut){
  3013         -  int rc;
         3013  +  int res;
  3014   3014     winFile *pFile = (winFile*)id;
  3015   3015   
  3016   3016     SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );
  3017   3017     OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p\n", pFile->h, pResOut));
  3018   3018   
  3019   3019     assert( id!=0 );
  3020   3020     if( pFile->locktype>=RESERVED_LOCK ){
  3021         -    rc = 1;
  3022         -    OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (local)\n", pFile->h, rc));
         3021  +    res = 1;
         3022  +    OSTRACE(("TEST-WR-LOCK file=%p, result=%d (local)\n", pFile->h, res));
  3023   3023     }else{
  3024         -    rc = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS,RESERVED_BYTE, 0, 1, 0);
  3025         -    if( rc ){
         3024  +    res = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS,RESERVED_BYTE, 0, 1, 0);
         3025  +    if( res ){
  3026   3026         winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0);
  3027   3027       }
  3028         -    rc = !rc;
  3029         -    OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (remote)\n", pFile->h, rc));
         3028  +    res = !res;
         3029  +    OSTRACE(("TEST-WR-LOCK file=%p, result=%d (remote)\n", pFile->h, res));
  3030   3030     }
  3031         -  *pResOut = rc;
         3031  +  *pResOut = res;
  3032   3032     OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n",
  3033   3033              pFile->h, pResOut, *pResOut));
  3034   3034     return SQLITE_OK;
  3035   3035   }
  3036   3036   
  3037   3037   /*
  3038   3038   ** Lower the locking level on file descriptor id to locktype.  locktype