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

When in PAGER_RESERVED state, don't write to the main file when rolling

back a statement transaction. (CVS 1560)

FossilOrigin-Name: adb2bd61436927d37b23bae857089d62e12397af
This commit is contained in:
danielk1977
2004-06-10 04:32:16 +00:00
parent 466be56bcf
commit a3f3a5f3d2
5 changed files with 24 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
C Change\sthe\scollation\ssequence\sinterface\sto\sallow\scollation\ssequences\sthat\nuse\sUTF-16\sin\snon-native\sbyte\sorder\sto\sbe\sregistered.\s(CVS\s1559) C When\sin\sPAGER_RESERVED\sstate,\sdon't\swrite\sto\sthe\smain\sfile\swhen\srolling\nback\sa\sstatement\stransaction.\s(CVS\s1560)
D 2004-06-10T02:16:02 D 2004-06-10T04:32:17
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -47,7 +47,7 @@ F src/os_unix.c 1d6f3d1a87d4aa0e4490bcc47b3f0ff9b2e37e7a
F src/os_unix.h 1cd6133cf66dea704b8646b70b2dfdcbdd9b3738 F src/os_unix.h 1cd6133cf66dea704b8646b70b2dfdcbdd9b3738
F src/os_win.c 6b8f9fcc683bb888e07fc485372803baa68faadb F src/os_win.c 6b8f9fcc683bb888e07fc485372803baa68faadb
F src/os_win.h 004eec47b1780fcaf07420ddc2072294b698d48c F src/os_win.h 004eec47b1780fcaf07420ddc2072294b698d48c
F src/pager.c 88a7160c749435c03a4154996cd851196c0a87c2 F src/pager.c 778379c031daa20d134a934d5753c19b606c10db
F src/pager.h ca8f293e1d623a7c628a1c5e0c6cf43d5bbb80bf F src/pager.h ca8f293e1d623a7c628a1c5e0c6cf43d5bbb80bf
F src/parse.y 097438674976355a10cf177bd97326c548820b86 F src/parse.y 097438674976355a10cf177bd97326c548820b86
F src/pragma.c 6ab13748a415bf8e8f2dd79e5f713fbe72dfd3f4 F src/pragma.c 6ab13748a415bf8e8f2dd79e5f713fbe72dfd3f4
@@ -74,7 +74,7 @@ F src/vdbe.c 90e0e6bdbdf9b77c66f2500374b5784d30c323fa
F src/vdbe.h 46f74444a213129bc4b5ce40124dd8ed613b0cde F src/vdbe.h 46f74444a213129bc4b5ce40124dd8ed613b0cde
F src/vdbeInt.h d41605853332bdbd600d7ecd60e1f54bbaea174e F src/vdbeInt.h d41605853332bdbd600d7ecd60e1f54bbaea174e
F src/vdbeapi.c 4ac95766b0515538037a7aec172ed26142f97cf9 F src/vdbeapi.c 4ac95766b0515538037a7aec172ed26142f97cf9
F src/vdbeaux.c 6f5b26a6b4d9c9f0f99a9f75dce9460e5a90542e F src/vdbeaux.c 73764dadcdbf79aa2d948f863eae07b18589e663
F src/vdbemem.c 5b2fab8b5a830e5204413b808c4a2d8335189f21 F src/vdbemem.c 5b2fab8b5a830e5204413b808c4a2d8335189f21
F src/where.c 32578882a245f8ac3303c5cea4664cd51fc73891 F src/where.c 32578882a245f8ac3303c5cea4664cd51fc73891
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242 F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
@@ -158,7 +158,7 @@ F test/threadtest2.c d94ca4114fd1504f7e0ae724bcd83d4b40931d86
F test/trans.test 4a26c6fa3639202c334521954c17d8abe8a1c8e8 F test/trans.test 4a26c6fa3639202c334521954c17d8abe8a1c8e8
F test/trigger1.test 99b7cd9a568ac60aa04bbc3b9db9575ffa97709a F test/trigger1.test 99b7cd9a568ac60aa04bbc3b9db9575ffa97709a
F test/trigger2.test 0767ab30cb5a2c8402c8524f3d566b410b6f5263 F test/trigger2.test 0767ab30cb5a2c8402c8524f3d566b410b6f5263
F test/trigger3.test 895301736db4f0f111815f43502d9bdb150cc722 F test/trigger3.test 70931be83fa3f563f7a5ca9e88b86f476af73948
F test/trigger4.test 542afce45774e8f8e1130b96b8675f414d6e4bd8 F test/trigger4.test 542afce45774e8f8e1130b96b8675f414d6e4bd8
F test/types.test 6c49e574970866558365a025b44c9fd8a162ef0d F test/types.test 6c49e574970866558365a025b44c9fd8a162ef0d
F test/types2.test 5d725fcb68dbd032c6d4950d568d75fa33872687 F test/types2.test 5d725fcb68dbd032c6d4950d568d75fa33872687
@@ -218,7 +218,7 @@ F www/support.tcl 1801397edd271cc39a2aadd54e701184b5181248
F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075 F www/tclsqlite.tcl 19191cf2a1010eaeff74c51d83fd5f5a4d899075
F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4 F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
P 28c3cc088018833f507535b8d227232776cff204 P b8aaa3a29e0ddef357ab1b3b0b9f87ed390f2f36
R f9fbe975e7140b57b35e8b9f5b97fbe5 R ad810f31dbb79cebb57b3882d1073a25
U danielk1977 U danielk1977
Z 419742ffbc029c96384373534fdaa6dc Z 5213c6eb04cd03f6a07cc2df587564de

View File

@@ -1 +1 @@
b8aaa3a29e0ddef357ab1b3b0b9f87ed390f2f36 adb2bd61436927d37b23bae857089d62e12397af

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while ** file simultaneously, or one process from reading the database while
** another is writing. ** another is writing.
** **
** @(#) $Id: pager.c,v 1.120 2004/06/10 02:16:02 danielk1977 Exp $ ** @(#) $Id: pager.c,v 1.121 2004/06/10 04:32:17 danielk1977 Exp $
*/ */
#include "os.h" /* Must be first to enable large file support */ #include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -517,13 +517,22 @@ static int pager_playback_one_page(Pager *pPager, OsFile *jfd, int useCksum){
} }
} }
/* Playback the page. Update the in-memory copy of the page assert( pPager->state==PAGER_RESERVED || pPager->state==PAGER_EXCLUSIVE );
** at the same time, if there is one.
/* If the pager is in RESERVED state, then there must be a copy of this
** page in the pager cache. In this case just update the pager cache,
** not the database file.
**
** If in EXCLUSIVE state, then we update the pager cache if it exists
** and the main file. The page is then marked not dirty.
*/ */
pPg = pager_lookup(pPager, pgno); pPg = pager_lookup(pPager, pgno);
assert( pPager->state==PAGER_EXCLUSIVE || pPg );
TRACE2("PLAYBACK page %d\n", pgno); TRACE2("PLAYBACK page %d\n", pgno);
sqlite3OsSeek(&pPager->fd, (pgno-1)*(off_t)SQLITE_PAGE_SIZE); if( pPager->state==PAGER_EXCLUSIVE ){
rc = sqlite3OsWrite(&pPager->fd, aData, SQLITE_PAGE_SIZE); sqlite3OsSeek(&pPager->fd, (pgno-1)*(off_t)SQLITE_PAGE_SIZE);
rc = sqlite3OsWrite(&pPager->fd, aData, SQLITE_PAGE_SIZE);
}
if( pPg ){ if( pPg ){
/* No page should ever be rolled back that is in use, except for page /* 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 ** 1 which is held in use in order to keep the lock on the database

View File

@@ -1162,6 +1162,7 @@ int sqlite3VdbeReset(Vdbe *p, char **pzErrMsg){
db->autoCommit = 1; db->autoCommit = 1;
} }
} }
p->autoCommitOn = 0;
/* If xFunc is not NULL, then it is one of sqlite3BtreeRollback, /* If xFunc is not NULL, then it is one of sqlite3BtreeRollback,
** sqlite3BtreeRollbackStmt or sqlite3BtreeCommitStmt. Call it once on ** sqlite3BtreeRollbackStmt or sqlite3BtreeCommitStmt. Call it once on

View File

@@ -13,12 +13,6 @@
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
set sqlite_os_trace 1
execsql {
PRAGMA vdbe_listing=on;
PRAGMA sql_trace=on;
PRAGMA vdbe_trace=on;
}
# Test that we can cause ROLLBACK, FAIL and ABORT correctly # Test that we can cause ROLLBACK, FAIL and ABORT correctly
# catchsql { DROP TABLE tbl; } # catchsql { DROP TABLE tbl; }
@@ -52,7 +46,6 @@ do_test trigger3-1.2 {
do_test trigger3-1.3 { do_test trigger3-1.3 {
execsql {SELECT * FROM tbl} execsql {SELECT * FROM tbl}
} {} } {}
exit
# FAIL # FAIL
do_test trigger3-2.1 { do_test trigger3-2.1 {