mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
When copying a rollback mode database over a WAL database using the backup API, leave the destination database in WAL mode (instead of switching it to rollback mode). Fix for [af95b8c609].
FossilOrigin-Name: 35e6ac18e3d030095da57fff87a288939e9be93f
This commit is contained in:
18
manifest
18
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Remove\sa\sbranch\sthat\sis\salways\strue.
|
C When\scopying\sa\srollback\smode\sdatabase\sover\sa\sWAL\sdatabase\susing\sthe\sbackup\sAPI,\sleave\sthe\sdestination\sdatabase\sin\sWAL\smode\s(instead\sof\sswitching\sit\sto\srollback\smode).\sFix\sfor\s[af95b8c609].
|
||||||
D 2011-08-23T00:01:58.939
|
D 2011-08-23T11:47:06.849
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 8c930e7b493d59099ea1304bd0f2aed152eb3315
|
F Makefile.in 8c930e7b493d59099ea1304bd0f2aed152eb3315
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -121,10 +121,10 @@ F src/alter.c ac80a0f31189f8b4a524ebf661e47e84536ee7f5
|
|||||||
F src/analyze.c a425d62e8fa9ebcb4359ab84ff0c62c6563d2e2a
|
F src/analyze.c a425d62e8fa9ebcb4359ab84ff0c62c6563d2e2a
|
||||||
F src/attach.c 12c6957996908edc31c96d7c68d4942c2474405f
|
F src/attach.c 12c6957996908edc31c96d7c68d4942c2474405f
|
||||||
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
|
||||||
F src/backup.c 986c15232757f2873dff35ee3b35cbf935fc573c
|
F src/backup.c 4dfc39043a42cbe47f22b2da47065ae5377f44fd
|
||||||
F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
|
F src/bitvec.c af50f1c8c0ff54d6bdb7a80e2fceca5a93670bef
|
||||||
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
F src/btmutex.c 976f45a12e37293e32cae0281b15a21d48a8aaa7
|
||||||
F src/btree.c a30bdcc27eedc36a38a3a11e1ba83de9a6729f7e
|
F src/btree.c 97cf3ba4ff067e716753b33661035e50853aebba
|
||||||
F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce
|
F src/btree.h f5d775cd6cfc7ac32a2535b70e8d2af48ef5f2ce
|
||||||
F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3
|
F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3
|
||||||
F src/build.c 6c60478a1e23f7cdd30ae0251b46f9adbe0e98c2
|
F src/build.c 6c60478a1e23f7cdd30ae0251b46f9adbe0e98c2
|
||||||
@@ -891,7 +891,7 @@ F test/wal5.test 08e145a352b1223930c7f0a1de82a8747a99c322
|
|||||||
F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
|
F test/wal6.test 2e3bc767d9c2ce35c47106148d43fcbd072a93b3
|
||||||
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
|
F test/wal7.test 2ae8f427d240099cc4b2dfef63cff44e2a68a1bd
|
||||||
F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
|
F test/wal_common.tcl a98f17fba96206122eff624db0ab13ec377be4fe
|
||||||
F test/walbak.test 53be94bccbc3f592d22a5909588ccc81b319ce83
|
F test/walbak.test b9f68e39646375c2b877be906babcc15d38b4877
|
||||||
F test/walbig.test e882bc1d014afffbfa2b6ba36e0f07d30a633ad0
|
F test/walbig.test e882bc1d014afffbfa2b6ba36e0f07d30a633ad0
|
||||||
F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde
|
F test/walcksum.test f5447800a157c9e2234fbb8e80243f0813941bde
|
||||||
F test/walcrash.test 4fcb661faf71db91214156d52d43ee327f52bde1
|
F test/walcrash.test 4fcb661faf71db91214156d52d43ee327f52bde1
|
||||||
@@ -961,7 +961,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
|
|||||||
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
|
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
|
F tool/warnings.sh 2ebae31e1eb352696f3c2f7706a34c084b28c262
|
||||||
P 6c227cc85378fa6041703d6620031c0e0a2db55f
|
P a65681926d8acf779ad39be21b74537c21777783
|
||||||
R 097c99892539b0af0c0419cec17783c1
|
R 4fa828c7c042de4b81d2337ffc4e400a
|
||||||
U drh
|
U dan
|
||||||
Z ba0092ef44967f1382824e5e567024ca
|
Z 6839a6474a17b2a69c514b02de64259d
|
||||||
|
@@ -1 +1 @@
|
|||||||
a65681926d8acf779ad39be21b74537c21777783
|
35e6ac18e3d030095da57fff87a288939e9be93f
|
@@ -419,6 +419,15 @@ int sqlite3_backup_step(sqlite3_backup *p, int nPage){
|
|||||||
sqlite3ResetInternalSchema(p->pDestDb, -1);
|
sqlite3ResetInternalSchema(p->pDestDb, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( destMode==PAGER_JOURNALMODE_WAL ){
|
||||||
|
/* This call cannot fail. The success of the BtreeUpdateMeta()
|
||||||
|
** method above indicates that a write transaction has been opened
|
||||||
|
** and page 1 is already dirty. Therefore this always succeeds.
|
||||||
|
*/
|
||||||
|
TESTONLY(int rc2 =) sqlite3BtreeSetVersion(p->pDest, 2);
|
||||||
|
assert( rc2==SQLITE_OK );
|
||||||
|
}
|
||||||
|
|
||||||
/* Set nDestTruncate to the final number of pages in the destination
|
/* Set nDestTruncate to the final number of pages in the destination
|
||||||
** database. The complication here is that the destination page
|
** database. The complication here is that the destination page
|
||||||
** size may be different to the source page size.
|
** size may be different to the source page size.
|
||||||
|
@@ -8149,7 +8149,6 @@ int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
|
|||||||
BtShared *pBt = pBtree->pBt;
|
BtShared *pBt = pBtree->pBt;
|
||||||
int rc; /* Return code */
|
int rc; /* Return code */
|
||||||
|
|
||||||
assert( pBtree->inTrans==TRANS_NONE );
|
|
||||||
assert( iVersion==1 || iVersion==2 );
|
assert( iVersion==1 || iVersion==2 );
|
||||||
|
|
||||||
/* If setting the version fields to 1, do not automatically open the
|
/* If setting the version fields to 1, do not automatically open the
|
||||||
|
@@ -79,6 +79,9 @@ do_test walbak-1.6 {
|
|||||||
execsql { PRAGMA wal_checkpoint }
|
execsql { PRAGMA wal_checkpoint }
|
||||||
list [file size test.db] [file size test.db-wal]
|
list [file size test.db] [file size test.db-wal]
|
||||||
} [list [expr 3*1024] [wal_file_size 6 1024]]
|
} [list [expr 3*1024] [wal_file_size 6 1024]]
|
||||||
|
do_test walbak-1.6.1 {
|
||||||
|
hexio_read test.db 18 2
|
||||||
|
} {0202}
|
||||||
do_test walbak-1.7 {
|
do_test walbak-1.7 {
|
||||||
execsql {
|
execsql {
|
||||||
CREATE TABLE t2(a, b);
|
CREATE TABLE t2(a, b);
|
||||||
@@ -271,9 +274,84 @@ foreach {tn setup} {
|
|||||||
execsql { SELECT * FROM t1 }
|
execsql { SELECT * FROM t1 }
|
||||||
} {1 2 3 4 5 6 7 8}
|
} {1 2 3 4 5 6 7 8}
|
||||||
|
|
||||||
|
# Check that [db] is still in WAL mode.
|
||||||
|
do_test walbak-3.$tn.5 {
|
||||||
|
execsql { PRAGMA journal_mode }
|
||||||
|
} {wal}
|
||||||
|
do_test walbak-3.$tn.6 {
|
||||||
|
execsql { PRAGMA wal_checkpoint }
|
||||||
|
hexio_read test.db 18 2
|
||||||
|
} {0202}
|
||||||
|
|
||||||
|
# If it was not an in-memory database, check that [db2] is still in
|
||||||
|
# rollback mode.
|
||||||
|
if {[file exists test.db2]} {
|
||||||
|
do_test walbak-3.$tn.7 {
|
||||||
|
execsql { PRAGMA journal_mode } db2
|
||||||
|
} {wal}
|
||||||
|
do_test walbak-3.$tn.8 {
|
||||||
|
execsql { PRAGMA wal_checkpoint }
|
||||||
|
hexio_read test.db 18 2
|
||||||
|
} {0202}
|
||||||
|
}
|
||||||
|
|
||||||
db close
|
db close
|
||||||
db2 close
|
db2 close
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# Test that the following holds when a backup operation is run:
|
||||||
|
#
|
||||||
|
# Source | Destination inital | Destination final
|
||||||
|
# ---------------------------------------------------
|
||||||
|
# Rollback Rollback Rollback
|
||||||
|
# Rollback WAL WAL
|
||||||
|
# WAL Rollback WAL
|
||||||
|
# WAL WAL WAL
|
||||||
|
#
|
||||||
|
foreach {tn src dest dest_final} {
|
||||||
|
1 delete delete delete
|
||||||
|
2 delete wal wal
|
||||||
|
3 wal delete wal
|
||||||
|
4 wal wal wal
|
||||||
|
} {
|
||||||
|
catch { db close }
|
||||||
|
catch { db2 close }
|
||||||
|
forcedelete test.db test.db2
|
||||||
|
|
||||||
|
do_test walbak-4.$tn.1 {
|
||||||
|
sqlite3 db test.db
|
||||||
|
db eval "PRAGMA journal_mode = $src"
|
||||||
|
db eval {
|
||||||
|
CREATE TABLE t1(a, b);
|
||||||
|
INSERT INTO t1 VALUES('I', 'II');
|
||||||
|
INSERT INTO t1 VALUES('III', 'IV');
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite3 db2 test.db2
|
||||||
|
db2 eval "PRAGMA journal_mode = $dest"
|
||||||
|
db2 eval {
|
||||||
|
CREATE TABLE t2(x, y);
|
||||||
|
INSERT INTO t2 VALUES('1', '2');
|
||||||
|
INSERT INTO t2 VALUES('3', '4');
|
||||||
|
}
|
||||||
|
} {}
|
||||||
|
|
||||||
|
do_test walbak-4.$tn.2 { execsql { PRAGMA journal_mode } db } $src
|
||||||
|
do_test walbak-4.$tn.3 { execsql { PRAGMA journal_mode } db2 } $dest
|
||||||
|
|
||||||
|
do_test walbak-4.$tn.4 { db backup test.db2 } {}
|
||||||
|
do_test walbak-4.$tn.5 {
|
||||||
|
execsql { SELECT * FROM t1 } db2
|
||||||
|
} {I II III IV}
|
||||||
|
do_test walbak-4.$tn.5 { execsql { PRAGMA journal_mode } db2 } $dest_final
|
||||||
|
|
||||||
|
|
||||||
|
db2 close
|
||||||
|
do_test walbak-4.$tn.6 { file exists test.db2-wal } 0
|
||||||
|
sqlite3 db2 test.db2
|
||||||
|
do_test walbak-4.$tn.7 { execsql { PRAGMA journal_mode } db2 } $dest_final
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
Reference in New Issue
Block a user