]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Deferring file descriptor closing to avoid trashing locks when directly manipulating...
authoraswift <aswift@noemail.net>
Fri, 22 Aug 2008 00:25:52 +0000 (00:25 +0000)
committeraswift <aswift@noemail.net>
Fri, 22 Aug 2008 00:25:52 +0000 (00:25 +0000)
FossilOrigin-Name: e28a2870b49509502529892ff8ddb9fcf3a27173

manifest
manifest.uuid
test/exclusive2.test

index c69609b71f50aaf701bf5defea736530bcaa95c7..00e122cb06b905d53c3448e8d7b610bd52cfe333 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Added\sSQLITE_IOERR_LOCK\sextended\serror\scode\sand\ssupport\sfor\sdetecting\sand\sreturning\serrors\sin\sthe\sos_unix\slock,\sunlock\sand\scheck\sreserved\slock\svariants,\salso\sadded\ssupport\sfor\spopulating\sand\sreturning\ssystem\serror\scodes\sso\sthat\sthey\scan\sbe\saccessed\svia\sxGetLastError,\sunfortunately\sxGetLastError\scan't\sseem\sto\saccess\sthe\sunixFile\sstructure\swhere\sthe\slastErrno\sis\srecorded.\s(CVS\s5586)
-D 2008-08-22T00:22:35
+C Deferring\sfile\sdescriptor\sclosing\sto\savoid\strashing\slocks\swhen\sdirectly\smanipulating\ssqlite\sdb\sfile\scontents\s(causes\serrors\son\sAFP\stesting)\s(CVS\s5587)
+D 2008-08-22T00:25:53
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 51b727303f84cf055e29514d8248e5eaf9701379
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -283,7 +283,7 @@ F test/enc2.test 6d91a5286f59add0cfcbb2d0da913b76f2242398
 F test/enc3.test 5c550d59ff31dccdba5d1a02ae11c7047d77c041
 F test/eval.test 020a21a236667bd4c56205d999c9992f1d944cac
 F test/exclusive.test 5390ddf1f90a6d055111c0ebe6311045dd3035e1
-F test/exclusive2.test d13bf66753dca46e61241d35d36ab7c868b0d313
+F test/exclusive2.test 7d2b1c0370f1e1dac4a728bd653f2dea5100fcf6
 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
 F test/expr.test a47d304a90c75def083cce3b1cd6c282842e6bbe
 F test/filectrl.test 524853082d5d7fb442599730ec3a0f3f84a3a936
@@ -622,7 +622,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 80d6a31cb3851704c09ac9d99fe4bc241df3c180
-R 7431cc71998a6f7b8eb2579a2fd9f22d
+P c1af14e2b6bf5af0aff3df3adbe8cb9aabe1c4a3
+R 020594f125bbbdb48c5aa062c24e5325
 U aswift
-Z 6c65e4f8868dab6fff3ca3acb52662f8
+Z 6df8c751714bfb1ec9bdc42c787ab3b8
index 8aadbed12179de5013ac3628455af4b4a840edf1..5eddc5cea0eac6ba024973811ad7c3766349207a 100644 (file)
@@ -1 +1 @@
-c1af14e2b6bf5af0aff3df3adbe8cb9aabe1c4a3
\ No newline at end of file
+e28a2870b49509502529892ff8ddb9fcf3a27173
\ No newline at end of file
index d0eeb19b3dc08f13ef5d673b86245ee0c6995d8f..a78f2a91cb64b9b28628ed9f08c66f2639360f5c 100644 (file)
@@ -10,7 +10,7 @@
 #***********************************************************************
 # This file implements regression tests for SQLite library.
 #
-# $Id: exclusive2.test,v 1.8 2007/08/12 20:07:59 drh Exp $
+# $Id: exclusive2.test,v 1.9 2008/08/22 00:25:53 aswift Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -25,9 +25,14 @@ ifcapable {!pager_pragmas} {
 #
 sqlite3_soft_heap_limit 0
 
-proc pagerChangeCounter {filename {new ""}} {
-  set fd [open $filename RDWR]
-  fconfigure $fd -translation binary -encoding binary
+proc pagerChangeCounter {filename new {fd ""}} {
+  if {$fd==""} {
+    set fd [open $filename RDWR]
+    fconfigure $fd -translation binary -encoding binary
+    set needClose 1
+  } else {
+    set needClose 0
+  }
   if {$new ne ""} {
     seek $fd 24
     set a [expr {($new&0xFF000000)>>24}]
@@ -46,7 +51,7 @@ proc pagerChangeCounter {filename {new ""}} {
   incr ret [expr ($c&0x000000FF)<<8]
   incr ret [expr ($d&0x000000FF)<<0]
 
-  close $fd
+  if {$needClose} {close $fd}
   return $ret
 }
 
@@ -207,16 +212,16 @@ do_test exclusive2-2.3 {
 } $::sig
 
 do_test exclusive2-2.4 {
-  set fd [open test.db RDWR]
-  seek $fd 1024
-  puts -nonewline $fd [string repeat [binary format c 0] 10000]
-  flush $fd
-  close $fd
+  set ::fd [open test.db RDWR]
+  fconfigure $::fd -translation binary
+  seek $::fd 1024
+  puts -nonewline $::fd [string repeat [binary format c 0] 10000]
+  flush $::fd
   t1sig
 } $::sig
 
 do_test exclusive2-2.5 {
-  pagerChangeCounter test.db 5
+  pagerChangeCounter test.db 5 $::fd
 } {5}
 do_test exclusive2-2.6 {
   t1sig
@@ -240,6 +245,7 @@ do_test exclusive2-2.8 {
 
 db close
 db2 close
+catch {close $::fd}
 file delete -force test.db
 file delete -force test.db-journal