From: danielk1977 Date: Fri, 17 Jul 2009 17:25:43 +0000 (+0000) Subject: Fix a subtle problem that can occur when a transaction is automatically rolled back... X-Git-Tag: cvs-to-fossil-cutover~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e4948175342fb22d0366f8bcfabcdc5a1f06a8d6;p=thirdparty%2Fsqlite.git Fix a subtle problem that can occur when a transaction is automatically rolled back, and afterwards a VM that had opened a statement transaction within the abandoned transaction is finalized. Fixes an assert() that was failing in rtree3.test. (CVS 6903) FossilOrigin-Name: 910df46e0f570cbffa9ff9b50d75632c091838b6 --- diff --git a/manifest b/manifest index 0a2e6ae8dd..d2cfd0224e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Return\sa\smeaningful\serror\smessage\sif\sa\skeyword\sis\sused\sas\san\srtree\stable\scolumn\sname.\sTicket\s#3970.\s(CVS\s6902) -D 2009-07-17T16:54:48 +C Fix\sa\ssubtle\sproblem\sthat\scan\soccur\swhen\sa\stransaction\sis\sautomatically\srolled\sback,\sand\safterwards\sa\sVM\sthat\shad\sopened\sa\sstatement\stransaction\swithin\sthe\sabandoned\stransaction\sis\sfinalized.\sFixes\san\sassert()\sthat\swas\sfailing\sin\srtree3.test.\s(CVS\s6903) +D 2009-07-17T17:25:43 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in df9359da7a726ccb67a45db905c5447d5c00c6ef F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -208,7 +208,7 @@ F src/vdbe.c b6fadd91f509fbcb9108f1d1a5e0985735fb315d F src/vdbe.h 35a648bc3279a120da24f34d9a25213ec15daf8a F src/vdbeInt.h 831c254a6eef237ef4664c8381a0137586567007 F src/vdbeapi.c 0ab8ada7260b32031ca97f338caecf0812460624 -F src/vdbeaux.c 5c2ad56759d606f7fcdca7ced0390c9ea8bb5f7f +F src/vdbeaux.c 017bd2774528220c0c7b85342ad6b114011dfb53 F src/vdbeblob.c a3f3e0e877fc64ea50165eec2855f5ada4477611 F src/vdbemem.c 1618f685d19b4bcc96e40b3c478487bafd2ae246 F src/vtab.c 00902f289521041712fb0293d0bf8688c7af8e48 @@ -740,7 +740,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl 672f81d693a03f80f5ae60bfefacd8a349e76746 -P 0219a543367638013ccd06295eeb9efc822e2dd1 -R 644e39d982aefb64851bf1bd3db73970 +P 046efe46b50fbe928f39a0cda1b1006d486ce9f5 +R 2588d6865f8cccb869a8209132f8a3f3 U danielk1977 -Z f3240366dc68a67dbf0f884ca2a0a471 +Z 916dca7de1282056a17c7f9207c4274c diff --git a/manifest.uuid b/manifest.uuid index b82c0e9a58..7956bf8125 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -046efe46b50fbe928f39a0cda1b1006d486ce9f5 \ No newline at end of file +910df46e0f570cbffa9ff9b50d75632c091838b6 \ No newline at end of file diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 5d9e9506b4..cdafff85d3 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -14,7 +14,7 @@ ** to version 2.8.7, all this code was combined into the vdbe.c source file. ** But that file was getting too big so this subroutines were split out. ** -** $Id: vdbeaux.c,v 1.475 2009/07/15 16:30:50 drh Exp $ +** $Id: vdbeaux.c,v 1.476 2009/07/17 17:25:43 danielk1977 Exp $ */ #include "sqliteInt.h" #include "vdbeInt.h" @@ -1614,7 +1614,12 @@ int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){ sqlite3 *const db = p->db; int rc = SQLITE_OK; - if( p->iStatement ){ + /* If p->iStatement is greater than zero, then this Vdbe opened a + ** statement transaction that should be closed here. The only exception + ** is that an IO error may have occured, causing an emergency rollback. + ** In this case (db->nStatement==0), and there is nothing to do. + */ + if( db->nStatement && p->iStatement ){ int i; const int iSavepoint = p->iStatement-1;