1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Fix the pager so that correct rollbacks occur when synchronous is turned off.

This check-in also included unrelated documentation updates. (CVS 866)

FossilOrigin-Name: 3ef0ad8a4f2696a58aff9d812f90038c2c63f3fc
This commit is contained in:
drh
2003-02-15 23:09:17 +00:00
parent 32c4a833e0
commit 4303feedd3
9 changed files with 99 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
C Update\sthe\sdocumentation\sfor\sthe\snew\sjournal\sformat\sto\sbe\sintroduced\sin\nversion\s2.8.0.\s(CVS\s1729) C Fix\sthe\spager\sso\sthat\scorrect\srollbacks\soccur\swhen\ssynchronous\sis\sturned\soff.\r\nThis\scheck-in\salso\sincluded\sunrelated\sdocumentation\supdates.\s(CVS\s866)
D 2003-02-13T02:54:04 D 2003-02-15T23:09:17
F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64 F Makefile.in 6606854b1512f185b8e8c779b8d7fc2750463d64
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906 F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@@ -33,7 +33,7 @@ F src/main.c f88dfe09ed79588899cb4013836dd940f73a17fa
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565 F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
F src/os.c ed27e178e0c4b71f2807da81b8851f0fadc50778 F src/os.c ed27e178e0c4b71f2807da81b8851f0fadc50778
F src/os.h afa3e096213bad86845f8bdca81a9e917505e401 F src/os.h afa3e096213bad86845f8bdca81a9e917505e401
F src/pager.c a64f69216ebef0e6ce90e65700674b7c64f6b16e F src/pager.c bffccf853a20032d89b592572309ea8a15a7f3ed
F src/pager.h e5b8e301a732007766dc04880c764d7ee1aa34dd F src/pager.h e5b8e301a732007766dc04880c764d7ee1aa34dd
F src/parse.y cdaed5009423d851708848bd279147c268e6022e F src/parse.y cdaed5009423d851708848bd279147c268e6022e
F src/printf.c f8fd911a8738f9b2eb07aca2870473d34707055d F src/printf.c f8fd911a8738f9b2eb07aca2870473d34707055d
@@ -90,7 +90,7 @@ F test/misuse.test a3aa2b18a97e4c409a1fcaff5151a4dd804a0162
F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0 F test/notnull.test 7a08117a71e74b0321aaa937dbeb41a09d6eb1d0
F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd F test/null.test 5c2b57307e4b6178aae825eb65ddbee01e76b0fd
F test/pager.test d3a2e2f00999f97e056822a39d5ee2fad18bf12c F test/pager.test d3a2e2f00999f97e056822a39d5ee2fad18bf12c
F test/pragma.test 0ca0773e2559ec9715f72d90695554dc3368e8f2 F test/pragma.test d45d130f532bfe86ebd5ba74862d88b36ded8998
F test/printf.test a29b8afa24edb4411adfe473b12ac32c84098fce F test/printf.test a29b8afa24edb4411adfe473b12ac32c84098fce
F test/quick.test b372c8dad4fa1554747e90683fc72e59c0c98502 F test/quick.test b372c8dad4fa1554747e90683fc72e59c0c98502
F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d F test/quote.test 08f23385c685d3dc7914ec760d492cacea7f6e3d
@@ -108,13 +108,13 @@ F test/tableapi.test 3c80421a889e1d106df16e5800fa787f0d2914a6
F test/tclsqlite.test f650195b8124aca24bee175393a1ed2e5a544a38 F test/tclsqlite.test f650195b8124aca24bee175393a1ed2e5a544a38
F test/temptable.test 03b7bdb7d6ce2c658ad20c94b037652c6cad34e0 F test/temptable.test 03b7bdb7d6ce2c658ad20c94b037652c6cad34e0
F test/tester.tcl 6f603d90881bd835ea27c568a7fecaa57dce91cc F test/tester.tcl 6f603d90881bd835ea27c568a7fecaa57dce91cc
F test/trans.test 0d3584f8d50646ff22776ac0a28521a410a673d6 F test/trans.test 75e7a171b5d2d94ee56766459113e2ad0e5f809d
F test/trigger1.test ec1da76e1a9f618deb96e505f459dcf8a23f2247 F test/trigger1.test ec1da76e1a9f618deb96e505f459dcf8a23f2247
F test/trigger2.test 592daa956dc62b19930fe673405e389a80c5764e F test/trigger2.test ab4c743bb96cee96ab5a17c5edfd57a9134329d6
F test/trigger3.test 870afef7997a5b86bf3ea893ce0c2e85d6356c72 F test/trigger3.test 870afef7997a5b86bf3ea893ce0c2e85d6356c72
F test/trigger4.test 9a5c1406344d743020c2753ae8d6dfe6eb75f818 F test/trigger4.test 9a5c1406344d743020c2753ae8d6dfe6eb75f818
F test/unique.test 22a46df72a3e0a3fd1a2d39e96fb59f18448dd5f F test/unique.test 22a46df72a3e0a3fd1a2d39e96fb59f18448dd5f
F test/update.test e7b224f4ed652b3d6defdd6174ebc2ccd894307a F test/update.test 198360dfa14e65354dbcc66d5b98d8070780e42b
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
F test/version.test 605fd0d7e7d571370c32b12dbf395b58953de246 F test/version.test 605fd0d7e7d571370c32b12dbf395b58953de246
F test/view.test c64fa39ea57f3c2066c854290f032ad13b23b83d F test/view.test c64fa39ea57f3c2066c854290f032ad13b23b83d
@@ -144,18 +144,18 @@ F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
F www/faq.tcl 06276ff6c3e369374bb83034cc9d4a7d3a2a34a1 F www/faq.tcl 06276ff6c3e369374bb83034cc9d4a7d3a2a34a1
F www/fileformat.tcl d9b586416c0d099b82e02e469d532c9372f98f3f F www/fileformat.tcl d9b586416c0d099b82e02e469d532c9372f98f3f
F www/formatchng.tcl cbaf0f410096c71f86a7537cf9249fa04b9a659c F www/formatchng.tcl cbaf0f410096c71f86a7537cf9249fa04b9a659c
F www/index.tcl b5265ca54a5124ec40bffb7c7943e072e074d61a F www/index.tcl b155eba45136d19e7aa6ba979d4093180c335cf7
F www/lang.tcl 9bd9380dceba83d11fe268e0142c05ee06c757db F www/lang.tcl 9bd9380dceba83d11fe268e0142c05ee06c757db
F www/mingw.tcl f1c7c0a7f53387dd9bb4f8c7e8571b7561510ebc F www/mingw.tcl f1c7c0a7f53387dd9bb4f8c7e8571b7561510ebc
F www/nulls.tcl 29497dac2bc5b437aa7e2e94577dad4d8933ed26 F www/nulls.tcl 29497dac2bc5b437aa7e2e94577dad4d8933ed26
F www/omitted.tcl 118062f40a203fcb88b8d68ef1d7c0073ac191ec F www/omitted.tcl 118062f40a203fcb88b8d68ef1d7c0073ac191ec
F www/opcode.tcl 33c5f2061a05c5d227c72b84c080b3bf74c74f8b F www/opcode.tcl 33c5f2061a05c5d227c72b84c080b3bf74c74f8b
F www/quickstart.tcl 368d7ef130274307accceb2e21c9fc70bbb0ba65 F www/quickstart.tcl 4e97bef825e6a4153c43afb9f97235fc4da278ab
F www/speed.tcl 4d463e2aea41f688ed320a937f93ff885be918c3 F www/speed.tcl 4d463e2aea41f688ed320a937f93ff885be918c3
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098 F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331 F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218 F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P e05a7a552f694158ee449d8682f5c137f1c2f2ac P dc53d92141c931fb133149355c3a1ea64030e676
R 496fbf0dd37f4b8503d955d31fa52734 R 571b9c5813a6dfc27b61cc9c2ebc6b12
U drh U drh
Z bec57f8a48da6d4cfdb9d6259114717b Z b201cdfd990195584437ce2ba1bc7248

View File

@@ -1 +1 @@
dc53d92141c931fb133149355c3a1ea64030e676 3ef0ad8a4f2696a58aff9d812f90038c2c63f3fc

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.76 2003/02/13 01:58:21 drh Exp $ ** @(#) $Id: pager.c,v 1.77 2003/02/15 23:09:17 drh 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"
@@ -1511,7 +1511,7 @@ static int pager_open_journal(Pager *pPager){
if( journal_format==JOURNAL_FORMAT_3 ){ if( journal_format==JOURNAL_FORMAT_3 ){
rc = sqliteOsWrite(&pPager->jfd, aJournalMagic3, sizeof(aJournalMagic3)); rc = sqliteOsWrite(&pPager->jfd, aJournalMagic3, sizeof(aJournalMagic3));
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
rc = write32bits(&pPager->jfd, pPager->tempFile ? 0xffffffff : 0); rc = write32bits(&pPager->jfd, pPager->noSync ? 0xffffffff : 0);
} }
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
pPager->cksumInit = (u32)sqliteRandomInteger(); pPager->cksumInit = (u32)sqliteRandomInteger();

View File

@@ -12,7 +12,7 @@
# #
# This file implements tests for the PRAGMA command. # This file implements tests for the PRAGMA command.
# #
# $Id: pragma.test,v 1.3 2003/01/18 20:11:07 drh Exp $ # $Id: pragma.test,v 1.4 2003/02/15 23:09:17 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -116,21 +116,68 @@ do_test pragma-1.10 {
PRAGMA default_synchronous; PRAGMA default_synchronous;
} }
} {123 123 0 0} } {123 123 0 0}
do_test pragma-1.11 { do_test pragma-1.11 {
execsql {
PRAGMA synchronous=NORMAL;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {123 123 1 0}
do_test pragma-1.12 {
execsql {
PRAGMA synchronous=FULL;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {123 123 2 0}
do_test pragma-1.13 {
db close
set ::DB [sqlite db test.db]
execsql {
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {123 123 0 0}
do_test pragma-1.14 {
execsql {
PRAGMA default_synchronous=FULL;
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {123 123 2 2}
do_test pragma-1.15 {
db close
set ::DB [sqlite db test.db]
execsql {
PRAGMA cache_size;
PRAGMA default_cache_size;
PRAGMA synchronous;
PRAGMA default_synchronous;
}
} {123 123 2 2}
do_test pragma-2.1 {
execsql { execsql {
PRAGMA show_datatypes=on; PRAGMA show_datatypes=on;
PRAGMA empty_result_callbacks=off; PRAGMA empty_result_callbacks=off;
} }
sqlite_datatypes $::DB {SELECT * FROM sqlite_master} sqlite_datatypes $::DB {SELECT * FROM sqlite_master}
} {} } {}
do_test pragma-1.12 { do_test pragma-2.2 {
execsql { execsql {
PRAGMA empty_result_callbacks=on; PRAGMA empty_result_callbacks=on;
} }
sqlite_datatypes $::DB {SELECT * FROM sqlite_master} sqlite_datatypes $::DB {SELECT * FROM sqlite_master}
} {text text text integer text} } {text text text integer text}
do_test pragma-1.13 { do_test pragma-2.3 {
execsql { execsql {
CREATE TABLE t1( CREATE TABLE t1(
a INTEGER, a INTEGER,
@@ -144,38 +191,38 @@ do_test pragma-1.13 {
} }
sqlite_datatypes $::DB {SELECT * FROM t1} sqlite_datatypes $::DB {SELECT * FROM t1}
} {INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)} } {INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)}
do_test pragma-1.14 { do_test pragma-2.4 {
sqlite_datatypes $::DB { sqlite_datatypes $::DB {
SELECT 1, 'hello', NULL SELECT 1, 'hello', NULL
} }
} {NUMERIC TEXT TEXT} } {NUMERIC TEXT TEXT}
do_test pragma-1.15 { do_test pragma-2.5 {
sqlite_datatypes $::DB { sqlite_datatypes $::DB {
SELECT 1+2 AS X, 'hello' || 5 AS Y, NULL AS Z SELECT 1+2 AS X, 'hello' || 5 AS Y, NULL AS Z
} }
} {NUMERIC TEXT TEXT} } {NUMERIC TEXT TEXT}
do_test pragma-1.16 { do_test pragma-2.6 {
execsql { execsql {
CREATE VIEW v1 AS SELECT a+b, b||c, * FROM t1; CREATE VIEW v1 AS SELECT a+b, b||c, * FROM t1;
} }
sqlite_datatypes $::DB {SELECT * FROM v1} sqlite_datatypes $::DB {SELECT * FROM v1}
} {NUMERIC TEXT INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)} } {NUMERIC TEXT INTEGER TEXT WHATEVER CLOB BLOB VARCHAR(123) nVaRcHaR(432)}
do_test pragma-1.17 { do_test pragma-2.7 {
sqlite_datatypes $::DB { sqlite_datatypes $::DB {
SELECT d,e FROM t1 UNION SELECT a,c FROM t1 SELECT d,e FROM t1 UNION SELECT a,c FROM t1
} }
} {INTEGER WHATEVER} } {INTEGER WHATEVER}
do_test pragma-1.18 { do_test pragma-2.8 {
sqlite_datatypes $::DB { sqlite_datatypes $::DB {
SELECT d,e FROM t1 EXCEPT SELECT c,e FROM t1 SELECT d,e FROM t1 EXCEPT SELECT c,e FROM t1
} }
} {WHATEVER BLOB} } {WHATEVER BLOB}
do_test pragma-1.19 { do_test pragma-2.9 {
sqlite_datatypes $::DB { sqlite_datatypes $::DB {
SELECT d,e FROM t1 INTERSECT SELECT c,e FROM t1 SELECT d,e FROM t1 INTERSECT SELECT c,e FROM t1
} }
} {WHATEVER BLOB} } {WHATEVER BLOB}
do_test pragma-1.20 { do_test pragma-2.10 {
sqlite_datatypes $::DB { sqlite_datatypes $::DB {
SELECT d,e FROM t1 INTERSECT SELECT c,e FROM v1 SELECT d,e FROM t1 INTERSECT SELECT c,e FROM v1
} }

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this script is database locks. # focus of this script is database locks.
# #
# $Id: trans.test,v 1.17 2003/02/11 14:55:42 drh Exp $ # $Id: trans.test,v 1.18 2003/02/15 23:09:17 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
@@ -811,7 +811,11 @@ integrity_check trans-8.3
# #
do_test trans-9.1 { do_test trans-9.1 {
execsql { execsql {
PRAGMA cache_size=10; PRAGMA default_cache_size=10;
}
db close
sqlite db test.db
execsql {
BEGIN; BEGIN;
CREATE TABLE t3(x TEXT); CREATE TABLE t3(x TEXT);
INSERT INTO t3 VALUES(randstr(10,400)); INSERT INTO t3 VALUES(randstr(10,400));
@@ -858,6 +862,11 @@ for {set i 2} {$i<=$limit} {incr i} {
set ::sig [signature] set ::sig [signature]
set cnt [lindex $::sig 0] set cnt [lindex $::sig 0]
set ::journal_format [expr {($i%3)+1}] set ::journal_format [expr {($i%3)+1}]
if {$i%2==0} {
execsql {PRAGMA synchronous=FULL}
} else {
execsql {PRAGMA synchronous=NORMAL}
}
do_test trans-9.$i.1-$cnt { do_test trans-9.$i.1-$cnt {
execsql { execsql {
BEGIN; BEGIN;

View File

@@ -480,6 +480,7 @@ do_test trigger2-6.1h {
SELECT * from tbl; SELECT * from tbl;
} }
} {} } {}
execsql {DELETE FROM tbl}
# Handling of ON CONFLICT by UPDATE statements inside triggers # Handling of ON CONFLICT by UPDATE statements inside triggers
@@ -517,15 +518,18 @@ do_test trigger2-6.2e {
SELECT * from tbl; SELECT * from tbl;
} }
} {4 2 10 6 3 4} } {4 2 10 6 3 4}
do_test trigger2-6.2f { do_test trigger2-6.2f.1 {
execsql { execsql {
UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4; UPDATE OR REPLACE tbl SET a = 1 WHERE a = 4;
SELECT * from tbl; SELECT * from tbl;
} }
} {1 3 10} } {1 3 10}
execsql { do_test trigger2-6.2f.2 {
execsql {
INSERT INTO tbl VALUES (2, 3, 4); INSERT INTO tbl VALUES (2, 3, 4);
} SELECT * FROM tbl;
}
} {1 3 10 2 3 4}
do_test trigger2-6.2g { do_test trigger2-6.2g {
catchsql { catchsql {
UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1; UPDATE OR ROLLBACK tbl SET a = 4 WHERE a = 1;

View File

@@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The # This file implements regression tests for SQLite library. The
# focus of this file is testing the UPDATE statement. # focus of this file is testing the UPDATE statement.
# #
# $Id: update.test,v 1.11 2003/01/29 18:46:54 drh Exp $ # $Id: update.test,v 1.12 2003/02/15 23:09:17 drh Exp $
set testdir [file dirname $argv0] set testdir [file dirname $argv0]
source $testdir/tester.tcl source $testdir/tester.tcl
@@ -217,6 +217,7 @@ do_test update-5.6.5 {
# Repeat the previous sequence of tests with a different index. # Repeat the previous sequence of tests with a different index.
# #
execsql {PRAGMA synchronous=FULL}
do_test update-6.0 { do_test update-6.0 {
execsql {DROP INDEX idx1} execsql {DROP INDEX idx1}
execsql {CREATE INDEX idx1 ON test1(f2)} execsql {CREATE INDEX idx1 ON test1(f2)}

View File

@@ -1,7 +1,7 @@
# #
# Run this TCL script to generate HTML for the index.html file. # Run this TCL script to generate HTML for the index.html file.
# #
set rcsid {$Id: index.tcl,v 1.72 2003/01/18 22:01:07 drh Exp $} set rcsid {$Id: index.tcl,v 1.73 2003/02/15 23:09:17 drh Exp $}
puts {<html> puts {<html>
<head><title>SQLite: An Embeddable SQL Database Engine</title></head> <head><title>SQLite: An Embeddable SQL Database Engine</title></head>
@@ -57,9 +57,8 @@ puts {<h2>Features</h2>
different byte orders.</li> different byte orders.</li>
<li>Supports databases up to 2 terabytes (2^41 bytes) in size.</li> <li>Supports databases up to 2 terabytes (2^41 bytes) in size.</li>
<li>Small memory footprint: less than 25K lines of C code.</li> <li>Small memory footprint: less than 25K lines of C code.</li>
<li><a href="speed.html">10x faster</a> than PostgreSQL and <li><a href="speed.html">Two times faster</a> than PostgreSQL and
<a href="speed.html">2x faster</a> than MySQL for many common MySQL for many common operations.</li>
operations.</li>
<li>Very simple <li>Very simple
<a href="c_interface.html">C/C++ interface</a> requires the use of only <a href="c_interface.html">C/C++ interface</a> requires the use of only
three functions and one opaque structure.</li> three functions and one opaque structure.</li>

View File

@@ -1,7 +1,7 @@
# #
# Run this TCL script to generate HTML for the quickstart.html file. # Run this TCL script to generate HTML for the quickstart.html file.
# #
set rcsid {$Id: quickstart.tcl,v 1.3 2003/01/21 23:06:58 drh Exp $} set rcsid {$Id: quickstart.tcl,v 1.4 2003/02/15 23:09:17 drh Exp $}
puts {<html> puts {<html>
<head><title>SQLite In 5 Minutes Or Less</title></head> <head><title>SQLite In 5 Minutes Or Less</title></head>
@@ -67,7 +67,7 @@ the first argument and the second argument is one or more SQL statements
to execute against the database. The function calls to pay attention to execute against the database. The function calls to pay attention
to here are the call to <b>sqlite_open()</b> on line 22 which opens to here are the call to <b>sqlite_open()</b> on line 22 which opens
the database, <b>sqlite_exec()</b> on line 27 that executes SQL the database, <b>sqlite_exec()</b> on line 27 that executes SQL
command against the database, and <b>sqlite_close()</b> on line 31 commands against the database, and <b>sqlite_close()</b> on line 31
that closes the database connection.</p> that closes the database connection.</p>
<blockquote><pre> <blockquote><pre>