-C A\sfew\smore\swarning\sfixes.\s(CVS\s1750)
-D 2004-06-28T01:16:46
+C Fix\ssome\sproblems\swith\smulti-file\stransaction\srollback.\s(CVS\s1751)
+D 2004-06-28T04:52:30
F Makefile.in cb7a9889c38723f72b2506c4236ff30a05ff172b
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/os_unix.h 00c1f82b526ab2fb7ee5ddd555ea4ed68363c93a
F src/os_win.c 84549f6cc815237533c5d0eb3697352b03478d96
F src/os_win.h babd4e912967c6b09088cfe38a45e8005a07ba44
-F src/pager.c 1156c264f314142fd73eedf5ad27e42b279227b0
+F src/pager.c c1d5212e7cac86bc1a29d01a30d9dbbdb545dfd8
F src/pager.h fe818866f6d1adcffeed88705e8df7e588cbaf13
F src/parse.y e19e066e726a31d7b2d3e6475bdf55f7e339f8a3
F src/pragma.c 2ca5ef7e27916f191a3b1201ad576ef6f8a8d72d
F test/collate5.test 1dd5f0f508c46667f9d4606c7950c414b0bdc0d5
F test/collate6.test 2a45768914f04c1447a69d1358bbede376552675
F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87
-F test/crash.test 886d531d4057fe1bf3fae57166127a1ac82c39cb
+F test/crash.test 3ea432ce624369c04ba1a23a5288115e40f5daa2
F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
F test/date.test aed5030482ebc02bd8d386c6c86a29f694ab068d
F test/delete.test 4f0c86e2bebdc822d179c80697b1ceabe6bbcd07
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/version3.tcl 563ba3ac02f64da27ab17f3edbe8e56bfd0293fb
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
-P fae7c6e004aa4752fd3db09a42bfdb900861b3c0
-R a3cbd2e575e2da580062b00616263b99
+P 81e4994045697470bcfd692a794731c8291a8a30
+R 720c8ecc08d420175dd5d527a0298db7
U danielk1977
-Z 263ce207f2792f2dd2bd1a2e796f4361
+Z 4b192e4a8c202247fb9d2a51a2cec3ca
-81e4994045697470bcfd692a794731c8291a8a30
\ No newline at end of file
+06e8e30b249c10512a225d6c7a5fcb5c666595e6
\ No newline at end of file
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.146 2004/06/28 01:16:46 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.147 2004/06/28 04:52:30 danielk1977 Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
rc = sqlite3OsRead(pJrnl, aMagic, 8);
if( rc!=SQLITE_OK || memcmp(aMagic, aJournalMagic, 8) ) return rc;
- rc = sqlite3OsSeek(pJrnl, szJ-12-len);
+ rc = sqlite3OsSeek(pJrnl, szJ-16-len);
if( rc!=SQLITE_OK ) return rc;
- *pzMaster = (char *)sqliteMalloc(len);
+ *pzMaster = (char *)sqliteMalloc(len+1);
if( !*pzMaster ){
return SQLITE_NOMEM;
}
/* See if the checksum matches the master journal name */
for(i=0; i<len; i++){
- cksum -= *pzMaster[i];
+ cksum -= (*pzMaster)[i];
}
- if( !cksum ){
+ if( cksum ){
+ /* If the checksum doesn't add up, then one or more of the disk sectors
+ ** containing the master journal filename is corrupted. This means
+ ** definitely roll back, so just return SQLITE_OK and report a (nul)
+ ** master-journal filename.
+ */
sqliteFree(*pzMaster);
*pzMaster = 0;
}
+ (*pzMaster)[len] = '\0';
return SQLITE_OK;
}
** is running this routine also. Not that it makes too much difference.
*/
memset(&master, 0, sizeof(master));
- rc = sqlite3OsOpenExclusive(zMaster, &master, 0);
+ rc = sqlite3OsOpenReadOnly(zMaster, &master);
if( rc!=SQLITE_OK ) goto delmaster_out;
master_open = 1;
rc = sqlite3OsFileSize(&master, &nMasterJournal);
pager_reload_cache(pPager);
end_playback:
+ if( rc==SQLITE_OK ){
+ rc = pager_unwritelock(pPager);
+ }
if( zMaster ){
/* If there was a master journal and this routine will return true,
** see if it is possible to delete the master journal. If errors
}
sqliteFree(zMaster);
}
- if( rc==SQLITE_OK ){
- rc = pager_unwritelock(pPager);
- }
/* The Pager.sectorSize variable may have been updated while rolling
** back a journal created by a process with a different PAGER_SECTOR_SIZE
# The special crash-test module with its os_test.c backend only works
# on Unix.
#
-# $Id: crash.test,v 1.6 2004/06/26 19:35:30 drh Exp $
+# $Id: crash.test,v 1.7 2004/06/28 04:52:31 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
-set repeats 100
-# set repeats 10
+# set repeats 100
+set repeats 10
# This proc execs a seperate process that crashes midway through executing
# the SQL script $sql on database test.db.
expr [file size test2.db] / 1024
} {559}
-for {set i 1} {$i < $repeats} {incr i} {
+for {set i 1} {$i<$repeats} {incr i} {
set sig [signature]
set sig2 [signature2]
do_test crash-4.1.$i.1 {
- crashsql [expr $i%5 + 1] test.db-journal "
+ set c [crashsql $i test.db-journal "
ATTACH 'test2.db' AS aux;
BEGIN;
SELECT random() FROM abc LIMIT $i;
INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
DELETE FROM abc2 WHERE random()%10!=0;
COMMIT;
- "
+ "]
+ set c
} {1 {child process exited abnormally}}
do_test crash-4.1.$i.2 {
signature
signature2
} $sig2
}
-for {set i 1} {$i < $repeats} {incr i} {
+set i 0
+while {[incr i]} {
set sig [signature]
set sig2 [signature2]
+ set ::fin 0
do_test crash-4.2.$i.1 {
- crashsql [expr $i%5 + 1] test2.db-journal "
+ set c [crashsql $i test2.db-journal "
ATTACH 'test2.db' AS aux;
BEGIN;
SELECT random() FROM abc LIMIT $i;
INSERT INTO abc2 VALUES(randstr(10,10), 0, 0);
DELETE FROM abc2 WHERE random()%10!=0;
COMMIT;
- "
+ "]
+ if { $c == {0 {}} } {
+ set ::fin 1
+ set c {1 {child process exited abnormally}}
+ }
+ set c
} {1 {child process exited abnormally}}
+ if { $::fin } break
do_test crash-4.2.$i.2 {
signature
} $sig