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

Reinitialize page 1 of the database file following a ROLLBACK TO of a

transactional SAVEPOINT on an initially empty database. (CVS 6103)

FossilOrigin-Name: 3e9efb763875b20c856d748c19e449080a3ae97c
This commit is contained in:
drh
2009-01-02 21:08:09 +00:00
parent 49b9d33892
commit 9f0bbf9cae
6 changed files with 65 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
C Fix\scompiler\swarnings\sin\spager.c\s(CVS\s6102)
D 2009-01-02T18:10:42
C Reinitialize\spage\s1\sof\sthe\sdatabase\sfile\sfollowing\sa\sROLLBACK\sTO\sof\sa\ntransactional\sSAVEPOINT\son\san\sinitially\sempty\sdatabase.\s(CVS\s6103)
D 2009-01-02T21:08:09
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 05461a9b5803d5ad10c79f989801e9fd2cc3e592
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -103,7 +103,7 @@ F src/attach.c 1c35f95da3c62d19de75b44cfefd12c81c1791b3
F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627
F src/bitvec.c 4300d311b17fb3c1476623fd895a8feac02a0b08
F src/btmutex.c 63c5cc4ad5715690767ffcb741e185d7bc35ec1a
F src/btree.c 2a89b28a87a821cf27b04820161cf3cc2dd99725
F src/btree.c b0cf3e7273ba20fe280fc7c889f972419562076d
F src/btree.h 4f141cf748d2ee7c6d7fc175f64f87a45cd44113
F src/btreeInt.h 8fea5cd7021cb8848fc2183a3e909469659daa0a
F src/build.c 6eb9d20e99db8da8c7c6e7316096a6ff3d9acab9
@@ -142,7 +142,7 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5
F src/os_unix.c e6eacc7ec735ded605fefcbaf250058baa8feb12
F src/os_win.c 496e3ceb499aedc63622a89ef76f7af2dd902709
F src/pager.c 22f2896d2a539ca7285eab0fb667d1bdeea66ffa
F src/pager.c 151cc07325103ac217cd483e2aa67cb128aae1eb
F src/pager.h 75396879910768a0af03a4af8413e798d84c096f
F src/parse.y 4d0e33a702dc3ea7b69d8ae1914b3fbd32e46057
F src/pcache.c 16dc8da6e6ba6250f8dfd9ee46036db1cbceedc6
@@ -198,7 +198,7 @@ F src/update.c 8c4925f9ca664effc8a1faaad67449d2074567b1
F src/utf.c 1da9c832dba0fa8f865b5b902d93f420a1ee4245
F src/util.c ea62608f66f33a7e8322de83024ae37c415c0c7f
F src/vacuum.c 383d6297bddc011ab04a9eed110db6eaf523e8e9
F src/vdbe.c aa4674ce5de9bb928c03692ae8a680263937fe81
F src/vdbe.c 687e481528acc92a42959accafa8e41dfa46f95d
F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6
F src/vdbeInt.h e6e80a99ce634983b7cc2498843b4d2e5540900a
F src/vdbeapi.c 85c33cfbfa56249cbe627831610afafba754477d
@@ -497,6 +497,7 @@ F test/savepoint.test 08803877993d11cfbe3bbbaf811822e068a2dd8b
F test/savepoint2.test 18f6c75d5c133b93838019df8988b8cdf379d3de
F test/savepoint3.test 1a0b1c0f59c6ae4402bfbca7cec29d4b1b272ff0
F test/savepoint4.test fd8850063e3c40565545f5c291e7f79a30591670
F test/savepoint5.test 0735db177e0ebbaedc39812c8d065075d563c4fd
F test/schema.test a8b000723375fd42c68d310091bdbd744fde647c
F test/schema2.test 35e1c9696443d6694c8980c411497c2b5190d32e
F test/select1.test d0a4cad954fd41c030ec16ffbd2d08a4c0548742
@@ -690,7 +691,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P f047758de9b499866aa4ddf16011498b12a7b963
R bc499a9b609b8aa680130c2bc94cb8ac
P 78dd7909da15a9b2cbcdb9cbe86798cfc24f3230
R 43c17ab6466f886c67eb16e151d17eac
U drh
Z d740db87b2b43b18f6a418266f6c36a4
Z 7692693fe330733d99a3256112d00dbb

View File

@@ -1 +1 @@
78dd7909da15a9b2cbcdb9cbe86798cfc24f3230
3e9efb763875b20c856d748c19e449080a3ae97c

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.554 2009/01/02 18:10:42 drh Exp $
** $Id: btree.c,v 1.555 2009/01/02 21:08:09 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -2805,6 +2805,9 @@ int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
sqlite3BtreeEnter(p);
pBt->db = p->db;
rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint);
if( rc==SQLITE_OK ){
rc = newDatabase(pBt);
}
sqlite3BtreeLeave(p);
}
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.526 2009/01/02 18:10:42 drh Exp $
** @(#) $Id: pager.c,v 1.527 2009/01/02 21:08:09 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -246,9 +246,8 @@ struct Pager {
char dbFileVers[16]; /* Changes whenever database file changes */
i64 journalSizeLimit; /* Size limit for persistent journal files */
PCache *pPCache; /* Pointer to page cache object */
PagerSavepoint *aSavepoint;
int nSavepoint;
PagerSavepoint *aSavepoint; /* Array of active savepoints */
int nSavepoint; /* Number of elements in aSavepoint[] */
};
/*

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.807 2008/12/29 10:39:54 danielk1977 Exp $
** $Id: vdbe.c,v 1.808 2009/01/02 21:08:09 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -2471,7 +2471,7 @@ case OP_Savepoint: {
goto abort_due_to_error;
}
}
if( p1==SAVEPOINT_ROLLBACK && db->flags&SQLITE_InternChanges ){
if( p1==SAVEPOINT_ROLLBACK && (db->flags&SQLITE_InternChanges)!=0 ){
sqlite3ExpirePreparedStatements(db);
sqlite3ResetInternalSchema(db, 0);
}

46
test/savepoint5.test Normal file
View File

@@ -0,0 +1,46 @@
# 2009 January 2
#
# 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.
#
#***********************************************************************
#
# Verify that a SAVEPOINT on a new, empty database followed by a
# ROLLBACK TO that savepoint starts over again with another new
# empty database.
#
# $Id: savepoint5.test,v 1.1 2009/01/02 21:08:09 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
do_test savepoint5-1.1 {
db eval {
SAVEPOINT sp1;
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
SELECT count(*) FROM sqlite_master;
SELECT * FROM t1;
}
} {1 1}
do_test savepoint5-1.2 {
db eval {
ROLLBACK TO sp1;
SELECT count(*) FROM sqlite_master;
}
} {0}
do_test savepoint5-1.3 {
db eval {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1);
SELECT count(*) FROM sqlite_master;
SELECT * FROM t1;
}
} {1 1}
finish_test