Fix a bug where accessPayload() was calling PagerWrite() on the wrong page handle. Ticket #2332. (CVS 3906)

FossilOrigin-Name: cf9eeba7be64ad29cddd320832db10c799fb6e8e
This commit is contained in:
danielk1977 2007-05-03 13:11:32 +00:00
parent f68d7d17a1
commit 44e6c8d3cf
5 changed files with 79 additions and 14 deletions

View File

@ -1,5 +1,5 @@
C Use\smemmove()\sinstead\sof\smemcpy()\swhen\smoving\sbetween\smemory\sregions\sthat\nmight\soverlap.\s\sTicket\s#2334.\s(CVS\s3905) C Fix\sa\sbug\swhere\saccessPayload()\swas\scalling\sPagerWrite()\son\sthe\swrong\spage\shandle.\sTicket\s#2332.\s(CVS\s3906)
D 2007-05-03T13:02:27 D 2007-05-03T13:11:32
F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62 F Makefile.in 8cab54f7c9f5af8f22fd97ddf1ecfd1e1860de62
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -59,7 +59,7 @@ F src/alter.c 2c79ec40f65e33deaf90ca493422c74586e481a3
F src/analyze.c 4bbf5ddf9680587c6d4917e02e378b6037be3651 F src/analyze.c 4bbf5ddf9680587c6d4917e02e378b6037be3651
F src/attach.c a16ada4a4654a0d126b8223ec9494ebb81bc5c3c F src/attach.c a16ada4a4654a0d126b8223ec9494ebb81bc5c3c
F src/auth.c 902f4722661c796b97f007d9606bd7529c02597f F src/auth.c 902f4722661c796b97f007d9606bd7529c02597f
F src/btree.c ae37926682a6e6da49dacad25a8da50b49abbc31 F src/btree.c 1f75491c8d5348998ce53decc6fde671d4cfd36d
F src/btree.h 2c187d60cf76d74c2b4767294d6b5fa267037ff0 F src/btree.h 2c187d60cf76d74c2b4767294d6b5fa267037ff0
F src/build.c 02e01ec7907c7d947ab3041fda0e81eaed05db42 F src/build.c 02e01ec7907c7d947ab3041fda0e81eaed05db42
F src/callback.c 6414ed32d55859d0f65067aa5b88d2da27b3af9e F src/callback.c 6414ed32d55859d0f65067aa5b88d2da27b3af9e
@ -242,7 +242,7 @@ F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638
F test/func.test 6727c7729472ae52b5acd86e802f89aa350ba50f F test/func.test 6727c7729472ae52b5acd86e802f89aa350ba50f
F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d F test/in.test 369cb2aa1eab02296b4ec470732fe8c131260b1d
F test/incrblob.test e86fbd7187109a322acb756df64802247ac05ae6 F test/incrblob.test cca13ec6c3a163c86821dd49a81bb5b519850e79
F test/incrvacuum.test 2173bc075c7b3b96ccf228d737dd4f5c29500dc4 F test/incrvacuum.test 2173bc075c7b3b96ccf228d737dd4f5c29500dc4
F test/incrvacuum_ioerr.test 0ebc382bcc2036ec58cf49cc5ffada45f75d907b F test/incrvacuum_ioerr.test 0ebc382bcc2036ec58cf49cc5ffada45f75d907b
F test/index.test e65df12bed94b2903ee89987115e1578687e9266 F test/index.test e65df12bed94b2903ee89987115e1578687e9266
@ -360,6 +360,7 @@ F test/tkt2192.test 480d0e017ddb01a46ee20809427370f343bb3c03
F test/tkt2213.test 8cf7c446e1fcd0627fffe7fc19046eb24ac7333b F test/tkt2213.test 8cf7c446e1fcd0627fffe7fc19046eb24ac7333b
F test/tkt2251.test 3f0549213386ed911715665a908ff2bb7a871002 F test/tkt2251.test 3f0549213386ed911715665a908ff2bb7a871002
F test/tkt2285.test c618085f0c13ec3347e607f83c34ada0721b4bfa F test/tkt2285.test c618085f0c13ec3347e607f83c34ada0721b4bfa
F test/tkt2332.test a7d678dc146ca7d2dae7bcc19f4659a389225b36
F test/trace.test 75ffc1b992c780d054748a656e3e7fd674f18567 F test/trace.test 75ffc1b992c780d054748a656e3e7fd674f18567
F test/trans.test 3fe1b9e03b523482eee2b869858c5c1eca7b218b F test/trans.test 3fe1b9e03b523482eee2b869858c5c1eca7b218b
F test/trigger1.test b361161cf20614024cc1e52ea0bdec250776b2ae F test/trigger1.test b361161cf20614024cc1e52ea0bdec250776b2ae
@ -472,7 +473,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P b84d597c902d60341607bc405440603868ac52c8 P 678d672b73cc7b7f563c15daee3831cb5bbd890e
R 12d14d4fb14068f61aa4421e14587d06 R 3fe50c067312d08e6c011ae37b9a3ab6
U drh U danielk1977
Z db885090be703cd83c0833d00fbb5cc8 Z 99cbb46fec6c9867e749c0e87c86be78

View File

@ -1 +1 @@
678d672b73cc7b7f563c15daee3831cb5bbd890e cf9eeba7be64ad29cddd320832db10c799fb6e8e

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give. ** May you share freely, never taking more than you give.
** **
************************************************************************* *************************************************************************
** $Id: btree.c,v 1.369 2007/05/03 11:43:33 danielk1977 Exp $ ** $Id: btree.c,v 1.370 2007/05/03 13:11:32 danielk1977 Exp $
** **
** This file implements a external (disk-based) database using BTrees. ** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to ** For a detailed discussion of BTrees, refer to
@ -3266,7 +3266,7 @@ static int accessPayload(
} }
if( eOp ){ if( eOp ){
/* A write operation. */ /* A write operation. */
rc = sqlite3PagerWrite(pPage->pDbPage); rc = sqlite3PagerWrite(pDbPage);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
sqlite3PagerUnref(pDbPage); sqlite3PagerUnref(pDbPage);
return rc; return rc;

View File

@ -9,7 +9,7 @@
# #
#*********************************************************************** #***********************************************************************
# #
# $Id: incrblob.test,v 1.3 2007/05/03 11:43:35 danielk1977 Exp $ # $Id: incrblob.test,v 1.4 2007/05/03 13:11:32 danielk1977 Exp $
# #
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@ -79,7 +79,12 @@ do_test incrblob-1.3.10 {
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# incrblob-2.*: Test seeking in an incremental blob can use ptrmap pages. # incrblob-2.*: Test that the following operations use ptrmap pages:
#
# * Reading near the end of a blob,
# * Writing near the end of a blob (TODO),
# * SELECT a column value that is located on an overflow page (TODO).
#
# #
proc nRead {db} { proc nRead {db} {
set bt [btree_from_db $db] set bt [btree_from_db $db]
@ -131,7 +136,7 @@ foreach AutoVacuumMode [list 0 1] {
nRead db nRead db
} [expr $AutoVacuumMode ? 4 : 30] } [expr $AutoVacuumMode ? 4 : 30]
do_test incrblob-2.3 { do_test incrblob-2.$AutoVacuumMode.3 {
string range [db one {SELECT v FROM blobs}] end-19 end string range [db one {SELECT v FROM blobs}] end-19 end
} $::fragment } $::fragment
} }

59
test/tkt2332.test Normal file
View File

@ -0,0 +1,59 @@
# 2007 May 3
#
# 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.
#
#***********************************************************************
#
# $Id: tkt2332.test,v 1.1 2007/05/03 13:11:32 danielk1977 Exp $
#
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_test tkt2332.1 {
execsql {
CREATE TABLE blobs (k INTEGER PRIMARY KEY, v BLOB);
PRAGMA cache_size = 100;
}
} {}
set ::iKey 1
foreach Len [list 10000 100000 1000000] {
do_test tkt2332.$Len.1 {
set val "[expr rand()][expr rand()][expr rand()][expr rand()][expr rand()]"
set ::blobstr [string range \
[string repeat $val [expr ($Len/[string length $val])+1]] 0 [expr $Len-1]
]
db eval { INSERT INTO blobs VALUES($::iKey, zeroblob($Len)) }
} {}
do_test tkt2332.$Len.2 {
execsql {
SELECT length(v) FROM blobs WHERE k = $::iKey;
}
} $Len
do_test tkt2332.$Len.3 {
set ::fd [db incrblob blobs v $::iKey]
puts -nonewline $::fd $::blobstr
close $::fd
} {}
do_test tkt2332.$Len.4 {
execsql { SELECT length(v) FROM blobs WHERE k = $::iKey; }
} $Len
do_test tkt2332.$Len.5 {
lindex [execsql {SELECT v FROM blobs WHERE k = $::iKey}] 0
} $::blobstr
incr ::iKey
}
finish_test