-C Improvements\sto\sthe\sway\sPRAGMA\sintegrity_check\sworks.\s\sMore\slikely\sto\soutput\nuserful\sinformation\swhen\sgiven\sa\scorrupt\sdatabase.\s(CVS\s1132)
-D 2003-12-16T03:44:48
+C Make\ssure\sthe\spagers\sin-memory\scache\sstates\sin\ssync\swith\sthe\sdisk\sfile.\nTicket\s#529.\s(CVS\s1133)
+D 2003-12-17T23:57:35
F Makefile.in 5cb273b7d0e945d47ee8b9ad1c2a04ce79927d2d
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c 226d32db1f36f8932b318b1757c8623be6e4244f
F src/os.h 729395fefcca4b81ae056aa9ff67b72bb40dd9e0
-F src/pager.c 62702dff51d50694d039bc210f31990d1fbba2dd
+F src/pager.c ca24fced1ca4c2b8ea519d5fe8ec69a2d846276f
F src/pager.h 5da62c83443f26b1792cfd72c96c422f91aadd31
F src/parse.y c65aa6c5508763806ac9734b0589b93480ec7e7a
F src/pragma.c deec7342741e371f3042adaee53fcc324c5dd1d4
F test/memleak.test a18e6810cae96d2f6f5136920267adbefc8e1e90
F test/minmax.test 6d9b6d6ee34f42e2a58dffece1f76d35f446b3af
F test/misc1.test 0b98d493b0cf55cb5f53e1f3df8107c166eecb5a
-F test/misc2.test b5813a4add0c4ee6575dc0066ea7b37f033499c0
+F test/misc2.test 10c2ce26407d37411b96273e552d5095393732be
+F test/misc3.test 24b3b3fb96e52c129c70b5ad73c10237a2f3b859
F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test c14d0f4739f21e929b8115b72bf0c765b6bb1721
F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
-P 653a7dd97ed95e66bd2973169735ee73ee348576
-R 435a13e877cf1f013db1660aef5f3d2f
+P b92c31d6c138f9462730cecfe14f7dde19778e79
+R 5dac2c4103dd7d1b8becf54797b0f5a6
U drh
-Z b27d1bd5a7237f952a32b8adb3b13abd
+Z 3514ff5b1ce26349633380e9a1db39b1
-b92c31d6c138f9462730cecfe14f7dde19778e79
\ No newline at end of file
+da00efb13fe8ccf1c27e4e1193df6b53de9463f4
\ No newline at end of file
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.90 2003/09/06 01:10:47 drh Exp $
+** @(#) $Id: pager.c,v 1.91 2003/12/17 23:57:35 drh Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
sqliteOsSeek(&pPager->fd, (pgRec.pgno-1)*(off_t)SQLITE_PAGE_SIZE);
rc = sqliteOsWrite(&pPager->fd, pgRec.aData, SQLITE_PAGE_SIZE);
if( pPg ){
- if( pPg->nRef==0 ||
- memcmp(PGHDR_TO_DATA(pPg), pgRec.aData, SQLITE_PAGE_SIZE)==0
- ){
- /* Do not update the data on this page if the page is in use
- ** and the page has never been modified. This avoids resetting
- ** the "extra" data. That in turn avoids invalidating BTree cursors
- ** in trees that have never been modified. The end result is that
- ** you can have a SELECT going on in one table and ROLLBACK changes
- ** to a different table and the SELECT is unaffected by the ROLLBACK.
- */
- memcpy(PGHDR_TO_DATA(pPg), pgRec.aData, SQLITE_PAGE_SIZE);
- memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra);
- }
+ /* No page should ever be rolled back that is in use, except for page
+ ** 1 which is held in use in order to keep the lock on the database
+ ** active.
+ */
+ assert( pPg->nRef==0 || pPg->pgno==1 );
+ memcpy(PGHDR_TO_DATA(pPg), pgRec.aData, SQLITE_PAGE_SIZE);
+ memset(PGHDR_TO_EXTRA(pPg), 0, pPager->nExtra);
pPg->dirty = 0;
pPg->needSync = 0;
}
# This file implements tests for miscellanous features that were
# left out of other test files.
#
-# $Id: misc2.test,v 1.10 2003/12/10 01:31:21 drh Exp $
+# $Id: misc2.test,v 1.11 2003/12/17 23:57:36 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
SELECT count(*) FROM x;
}
} [expr 5*5*5*5]
+
+finish_test
--- /dev/null
+# 2003 December 17
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+# This file implements tests for miscellanous features that were
+# left out of other test files.
+#
+# $Id: misc3.test,v 1.1 2003/12/17 23:57:36 drh Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+# Ticket #529. Make sure an ABORT does not damage the in-memory cache
+# that will be used by subsequent statements in the same transaction.
+#
+do_test misc3-1.1 {
+ execsql {
+ CREATE TABLE t1(a UNIQUE,b);
+ INSERT INTO t1
+ VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
+ UPDATE t1 SET b=b||b;
+ UPDATE t1 SET b=b||b;
+ UPDATE t1 SET b=b||b;
+ UPDATE t1 SET b=b||b;
+ UPDATE t1 SET b=b||b;
+ INSERT INTO t1 VALUES(2,'x');
+ UPDATE t1 SET b=substr(b,1,500);
+ BEGIN;
+ }
+ catchsql {UPDATE t1 SET a=CASE a WHEN 2 THEN 1 ELSE a END, b='y';}
+ execsql {
+ CREATE TABLE t2(x,y);
+ COMMIT;
+ PRAGMA integrity_check;
+ }
+} ok
+do_test misc3-1.2 {
+ execsql {
+ DROP TABLE t1;
+ DROP TABLE t2;
+ VACUUM;
+ CREATE TABLE t1(a UNIQUE,b);
+ INSERT INTO t1
+ VALUES(1,'a23456789_b23456789_c23456789_d23456789_e23456789_');
+ INSERT INTO t1 SELECT a+1, b||b FROM t1;
+ INSERT INTO t1 SELECT a+2, b||b FROM t1;
+ INSERT INTO t1 SELECT a+4, b FROM t1;
+ INSERT INTO t1 SELECT a+8, b FROM t1;
+ INSERT INTO t1 SELECT a+16, b FROM t1;
+ INSERT INTO t1 SELECT a+32, b FROM t1;
+ INSERT INTO t1 SELECT a+64, b FROM t1;
+
+ BEGIN;
+ }
+ catchsql {UPDATE t1 SET a=CASE a WHEN 128 THEN 127 ELSE a END, b='';}
+ execsql {
+ INSERT INTO t1 VALUES(200,'hello out there');
+ COMMIT;
+ PRAGMA integrity_check;
+ }
+} ok
+
+finish_test