1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix the problems demonstrated in tkt35xx.test in a different way to (5936). (CVS 5938)

FossilOrigin-Name: ddf980a50127a9de35edeca5549f4b51e3f733e6
This commit is contained in:
danielk1977
2008-11-21 09:09:01 +00:00
parent 3e168ebec2
commit b247c21c15
5 changed files with 24 additions and 38 deletions

View File

@@ -1,5 +1,5 @@
C Add\sanother\stest\scase\sto\stkt35xx.test\sshowing\sthat\sa\sstatement\srollback\scan\salso\strigger\sthe\sproblem.\s(CVS\s5937)
D 2008-11-21T08:50:50
C Fix\sthe\sproblems\sdemonstrated\sin\stkt35xx.test\sin\sa\sdifferent\sway\sto\s(5936).\s(CVS\s5938)
D 2008-11-21T09:09:02
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -100,7 +100,7 @@ F src/attach.c 85c6a3d0daf11965b47604190d7cf5597dc88382
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 4300d311b17fb3c1476623fd895a8feac02a0b08
F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a
F src/btree.c 76c1b09263b6f028b4f84bd6d811e9d017448216
F src/btree.c 286ff124897ef55ede6d64c0916050c6e43489b3
F src/btree.h 179c3ea813780df78a289a8f5130db18e6d4616e
F src/btreeInt.h 8d21590c97b6a2c00cce1f78ed5dc5756e835108
F src/build.c a89e901ea24d8ec845286f9a1fbfd14572a7777e
@@ -139,7 +139,7 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c d12285d66df674c42f6f544a6f7c21bf1a954ee1
F src/os_unix.c 28cc4da7886c265c0a58f6975346b83180f03e5b
F src/os_win.c 3dff41670fb9798a869c636626bb7d6d8b6a45bb
F src/pager.c 8e2ebfd226351fd7856d6384187411471deafdc6
F src/pager.c e5d12e7adbab0dfcf11412f0492f4dfff9e1dc41
F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe
F src/pcache.c f3121a531745b20f5b824201eb63949a7e2959ac
@@ -581,7 +581,7 @@ F test/tkt3457.test e9ca2b90f0eb1fb8be73a30d29aacb2e3abedeb9
F test/tkt3461.test 5a63e8d8ee5ce00f076b1e2f82aba5480a0f14ed
F test/tkt3472.test e689a687631e59c7a47d9438148115fee23b16c3
F test/tkt3493.test 8472b3464e49a27ff7271308eec46154209e667b
F test/tkt35xx.test 0519cbf85a5531e30177bfb58ff94238a9972ef3
F test/tkt35xx.test 53bca895091e968126a858ee7da186f59f328994
F test/tokenize.test ce430a7aed48fc98301611429595883fdfcab5d7
F test/trace.test 951cd0f5f571e7f36bf7bfe04be70f90fb16fb00
F test/trans.test 2fd24cd7aa0b879d49a224cbd647d698f1e7ac5c
@@ -661,7 +661,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P faded96f36229ee85039276db693391d0f10648c
R 3f6a31e8be46dea16b333ede4095e47c
P 74c08b8dd9577d1997b4bc8147beed786150f22b
R d32b9fdcd366712fa9f1d8e691bead1e
U danielk1977
Z 06fd4a309d695ebc1047a668a58696a1
Z 008e0fa043edbf6a5b2344c70fdef398

View File

@@ -1 +1 @@
74c08b8dd9577d1997b4bc8147beed786150f22b
ddf980a50127a9de35edeca5549f4b51e3f733e6

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.539 2008/11/19 10:22:33 danielk1977 Exp $
** $Id: btree.c,v 1.540 2008/11/21 09:09:02 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -4304,9 +4304,12 @@ static int allocateBtreePage(
end_allocate_page:
releasePage(pTrunk);
releasePage(pPrevTrunk);
if( rc==SQLITE_OK && sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
releasePage(*ppPage);
return SQLITE_CORRUPT_BKPT;
if( rc==SQLITE_OK ){
if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
releasePage(*ppPage);
return SQLITE_CORRUPT_BKPT;
}
(*ppPage)->isInit = 0;
}
return rc;
}

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.507 2008/11/21 03:23:43 drh Exp $
** @(#) $Id: pager.c,v 1.508 2008/11/21 09:09:02 danielk1977 Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -1517,20 +1517,6 @@ static int pager_playback(Pager *pPager, int isHot){
assert( 0 );
end_playback:
/* There may be pages in cache that are dirty but which were not in
** the rollback journal. Such pages would have been taken out of the
** freelist (and hence marked as DontRollback). All such pages must
** be reinitialized.
*/
if( rc==SQLITE_OK && pPager->xReiniter ){
PgHdr *pDirty; /* List of page that are still dirty */
pDirty = sqlite3PcacheDirtyList(pPager->pPCache);
while( pDirty ){
pPager->xReiniter(pDirty);
sqlite3PcacheMakeClean(pDirty);
pDirty = pDirty->pDirty;
}
}
if( rc==SQLITE_OK ){
zMaster = pPager->pTmpSpace;
rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);

View File

@@ -14,7 +14,7 @@
# page cache which are not in the rollback journal are reinitialized
# in the btree layer.
#
# $Id: tkt35xx.test,v 1.2 2008/11/21 08:50:50 danielk1977 Exp $
# $Id: tkt35xx.test,v 1.3 2008/11/21 09:09:02 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -75,22 +75,20 @@ do_test tkt35xx-1.2.2 {
INSERT INTO t3(a, b) SELECT c, d FROM t4;
}
} {1 {PRIMARY KEY must be unique}}
do_test tkt35xx-1.2.3 {
# Show that the transaction has not been rolled back.
catchsql BEGIN
} {1 {cannot start a transaction within a transaction}}
# Before the bug was fixed, if SQLITE_DEBUG was defined an assert()
# would fail during the following INSERT statement. If SQLITE_DEBUG
# was not defined, then the statement would pass and the transaction
# would be committed. But, the "SELECT count(*)" in tkt35xx-1.2.6 would
# return 1, not 5. Data magically disappeared!
#
do_test tkt35xx-1.2.4 {
execsql { SELECT count(*) FROM t3 }
} {4}
do_test tkt35xx-1.2.5 {
# Before the bug was fixed, if SQLITE_DEBUG was defined an assert()
# would fail during the following INSERT statement. If SQLITE_DEBUG
# was not defined, then the statement would pass and the transaction
# would be committed. But, the "SELECT count(*)" in tkt35xx-1.2.6 would
# return 1, not 5. Data magically disappeared!
#
execsql {
INSERT INTO t3 VALUES(5, $big);
COMMIT;
@@ -99,7 +97,6 @@ do_test tkt35xx-1.2.5 {
do_test tkt35xx-1.2.6 {
execsql { SELECT count(*) FROM t3 }
} {5}
integrity_check tkt35xx-1.2.7
finish_test