]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Enhance the Win32 VFS I/O retry logic.
authormistachkin <mistachkin@noemail.net>
Tue, 18 Feb 2014 05:18:36 +0000 (05:18 +0000)
committermistachkin <mistachkin@noemail.net>
Tue, 18 Feb 2014 05:18:36 +0000 (05:18 +0000)
FossilOrigin-Name: adba783c702b05f83e0bee3eb1bc9e40cdec3785

manifest
manifest.uuid
src/os_win.c

index 4606d876354df6eaebdbac1cd62454426cf8fc58..84d15c6531f2350eceef6283e6014d18919d3eac 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Add\sVdbeCoverage()\sand\sVdbeCoverageIf()\smacros\sfor\simproved\sVDBE\scoverage\ntesting.
-D 2014-02-18T03:07:12.342
+C Enhance\sthe\sWin32\sVFS\sI/O\sretry\slogic.
+D 2014-02-18T05:18:36.863
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -203,7 +203,7 @@ F src/os.c 1b147e4cf7cc39e618115c14a086aed44bc91ace
 F src/os.h 4a46270a64e9193af4a0aaa3bc2c66dc07c29b3f
 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04
 F src/os_unix.c 18f7f95dc6bcb9cf4d4a238d8e2de96611bc2ae5
-F src/os_win.c d4284f003445054a26689f1264b1b9bf7261bd1b
+F src/os_win.c 5c0f315a7cfb513b7151c87a0699a8ad0bc1acb2
 F src/pager.c 0ffa313a30ed6d061d9c6601b7b175cc50a1cab7
 F src/pager.h ffd5607f7b3e4590b415b007a4382f693334d428
 F src/parse.y cce844ccb80b5f969b04c25100c8d94338488efb
@@ -1151,7 +1151,10 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 915f6f1c7aab54583729e60bdc1565f25ecc6f74
-R d0043e1267f21a1ea521214d42169c3d
-U drh
-Z f5a439caf79133298419241dae122f4e
+P b92d31a97d5fe4606d9ae1393c7f3e052f46bf5a
+R 36c4c6416a0341396e2a781bd502abeb
+T *branch * winIoRetry
+T *sym-winIoRetry *
+T -sym-trunk *
+U mistachkin
+Z b9d60eef2d6576ef4d346ab00acfffd9
index 2e856727c06a8fbdc23f2ddee17e2d005ce50826..02a7c49e961d62d95e617b4196d7b60a969de044 100644 (file)
@@ -1 +1 @@
-b92d31a97d5fe4606d9ae1393c7f3e052f46bf5a
\ No newline at end of file
+adba783c702b05f83e0bee3eb1bc9e40cdec3785
\ No newline at end of file
index d393c0d016e9c6fa171ad995b71c6b43fe39e7ac..616616d0df976bca5663adc990ea3e80ff12df84 100644 (file)
@@ -1836,6 +1836,32 @@ static int winLogErrorAtLine(
 static int winIoerrRetry = SQLITE_WIN32_IOERR_RETRY;
 static int winIoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY;
 
+/*
+** The "winIoerrCanRetry1" macro is used to determine if a particular I/O
+** error code obtained via GetLastError() is eligible to be retried.  It
+** must accept the error code DWORD as its only argument and should return
+** non-zero if the error code is transient in nature and the operation
+** responsible for generating the original error might succeed upon being
+** retried.  The argument to this macro should be a variable.
+**
+** Additionally, a macro named "winIoerrCanRetry2" may be defined.  If it
+** is defined, it will be consulted only when the macro "winIoerrCanRetry1"
+** returns zero.  The "winIoerrCanRetry2" macro is completely optional and
+** may be used to include additional error codes in the set that should
+** result in the failing I/O operation being retried by the caller.  If
+** defined, the "winIoerrCanRetry2" macro must exhibit external semantics
+** identical to those of the "winIoerrCanRetry1" macro.
+*/
+#if !defined(winIoerrCanRetry1)
+#define winIoerrCanRetry1(a) (((a)==ERROR_ACCESS_DENIED)        || \
+                              ((a)==ERROR_SHARING_VIOLATION)    || \
+                              ((a)==ERROR_LOCK_VIOLATION)       || \
+                              ((a)==ERROR_DEV_NOT_EXIST)        || \
+                              ((a)==ERROR_NETNAME_DELETED)      || \
+                              ((a)==ERROR_SEM_TIMEOUT)          || \
+                              ((a)==ERROR_NETWORK_UNREACHABLE))
+#endif
+
 /*
 ** If a ReadFile() or WriteFile() error occurs, invoke this routine
 ** to see if it should be retried.  Return TRUE to retry.  Return FALSE
@@ -1849,13 +1875,18 @@ static int winRetryIoerr(int *pnRetry, DWORD *pError){
     }
     return 0;
   }
-  if( e==ERROR_ACCESS_DENIED ||
-      e==ERROR_LOCK_VIOLATION ||
-      e==ERROR_SHARING_VIOLATION ){
+  if( winIoerrCanRetry1(e) ){
     sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry));
     ++*pnRetry;
     return 1;
   }
+#if defined(winIoerrCanRetry2)
+  else if( winIoerrCanRetry2(e) ){
+    sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry));
+    ++*pnRetry;
+    return 1;
+  }
+#endif
   if( pError ){
     *pError = e;
   }