Always enable exclusive access mode for TEMP databases. This cannot be
changed. The locking_mode pragma has not effect on the TEMP database. (CVS 3766) FossilOrigin-Name: 04d3b9098ed06d5be24253edde50ea61b4641df8
This commit is contained in:
parent
9bb8aecc35
commit
369339db34
18
manifest
18
manifest
@ -1,5 +1,5 @@
|
||||
C Coverage\simprovements\sfor\swhere.c.\s(CVS\s3765)
|
||||
D 2007-03-30T14:56:35
|
||||
C Always\senable\sexclusive\saccess\smode\sfor\sTEMP\sdatabases.\s\sThis\scannot\sbe\nchanged.\s\sThe\slocking_mode\spragma\shas\snot\seffect\son\sthe\sTEMP\sdatabase.\s(CVS\s3766)
|
||||
D 2007-03-30T16:01:55
|
||||
F Makefile.in 2f2c3bf69faf0ae7b8e8af4f94f1986849034530
|
||||
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
|
||||
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
|
||||
@ -86,7 +86,7 @@ F src/os_unix.c 4291be23eec73d1ec04010ae702364b781b5f773
|
||||
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
|
||||
F src/os_win.c c3a8403ea28bbb89d6507fa984c5919bd3fe7539
|
||||
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
|
||||
F src/pager.c 08e997b91657fd82dc19c1d06f965eeaaa2de7f5
|
||||
F src/pager.c ae0b1e1ae9b3f7fc725b6c92cf10f2a582006e44
|
||||
F src/pager.h e79a24cf200b8771366217f5bca414f5b7823f42
|
||||
F src/parse.y 207ab04273ae13aa4a729b96008d294d5f334ab3
|
||||
F src/pragma.c 8fd4f98822007a8d2c34e235ad3c35f1d77b3e51
|
||||
@ -200,9 +200,9 @@ F test/distinctagg.test 2b89d1c5220d966a30ba4b40430338669301188b
|
||||
F test/enc.test 7a03417a1051fe8bc6c7641cf4c8c3f7e0066d52
|
||||
F test/enc2.test 45710bacfa9df29720bc84c067dfdf8c8ddfb797
|
||||
F test/enc3.test 890508efff6677345e93bf2a8adb0489b30df030
|
||||
F test/exclusive.test 83871f52ab1015dc1bfbf86b96e2ece29094d129
|
||||
F test/exclusive.test 6748eb0539c4652d596971584c50200729e57dbe
|
||||
F test/exclusive2.test 187993598a83257f4a1126a40d89144c01965500
|
||||
F test/exclusive3.test f2d1d0ab2a83bb8326dea516e1c99b833f44d8f8
|
||||
F test/exclusive3.test 0e49c35b7e7cb8e7280b4ce3f0359d30b207d2ff
|
||||
F test/expr.test c78843f730ccbe973d0c2ad1c99978f936893131
|
||||
F test/fkey1.test 153004438d51e6769fb1ce165f6313972d6263ce
|
||||
F test/format4.test bf3bed3b13c63abfb3cfec232597a319a31d0bcc
|
||||
@ -447,7 +447,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
|
||||
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
|
||||
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
|
||||
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
|
||||
P 7e0aa964129612e2bad6fa45139d124f19cacd48
|
||||
R b56988b2a4f41fbf2d60eaa052f1ee98
|
||||
U danielk1977
|
||||
Z fce1180f998fc1408b89d9fcea97a6fe
|
||||
P df64894bacd8023cf3c5939f062c8463ff5cdc04
|
||||
R 46ff3e411333d7c07ca010df4bca596d
|
||||
U drh
|
||||
Z 515593da6a50233962143dfb23c8bb25
|
||||
|
@ -1 +1 @@
|
||||
df64894bacd8023cf3c5939f062c8463ff5cdc04
|
||||
04d3b9098ed06d5be24253edde50ea61b4641df8
|
33
src/pager.c
33
src/pager.c
@ -18,7 +18,7 @@
|
||||
** file simultaneously, or one process from reading the database while
|
||||
** another is writing.
|
||||
**
|
||||
** @(#) $Id: pager.c,v 1.308 2007/03/30 14:46:01 drh Exp $
|
||||
** @(#) $Id: pager.c,v 1.309 2007/03/30 16:01:55 drh Exp $
|
||||
*/
|
||||
#ifndef SQLITE_OMIT_DISKIO
|
||||
#include "sqliteInt.h"
|
||||
@ -85,21 +85,24 @@
|
||||
** PAGER_SYNCED The pager moves to this state from PAGER_EXCLUSIVE
|
||||
** after all dirty pages have been written to the
|
||||
** database file and the file has been synced to
|
||||
** disk. All that remains to do is to remove the
|
||||
** journal file and the transaction will be
|
||||
** committed.
|
||||
** disk. All that remains to do is to remove or
|
||||
** truncate the journal file and the transaction
|
||||
** will be committed.
|
||||
**
|
||||
** The page cache comes up in PAGER_UNLOCK. The first time a
|
||||
** sqlite3PagerGet() occurs, the state transitions to PAGER_SHARED.
|
||||
** After all pages have been released using sqlite_page_unref(),
|
||||
** the state transitions back to PAGER_UNLOCK. The first time
|
||||
** that sqlite3PagerWrite() is called, the state transitions to
|
||||
** PAGER_RESERVED. (Note that sqlite_page_write() can only be
|
||||
** PAGER_RESERVED. (Note that sqlite3PagerWrite() can only be
|
||||
** called on an outstanding page which means that the pager must
|
||||
** be in PAGER_SHARED before it transitions to PAGER_RESERVED.)
|
||||
** The transition to PAGER_EXCLUSIVE occurs when before any changes
|
||||
** are made to the database file. After an sqlite3PagerRollback()
|
||||
** or sqlite_pager_commit(), the state goes back to PAGER_SHARED.
|
||||
** PAGER_RESERVED means that there is an open rollback journal.
|
||||
** The transition to PAGER_EXCLUSIVE occurs before any changes
|
||||
** are made to the database file, though writes to the rollback
|
||||
** journal occurs with just PAGER_RESERVED. After an sqlite3PagerRollback()
|
||||
** or sqlite3PagerCommitPhaseTwo(), the state can go back to PAGER_SHARED,
|
||||
** or it can stay at PAGER_EXCLUSIVE if we are in exclusive access mode.
|
||||
*/
|
||||
#define PAGER_UNLOCK 0
|
||||
#define PAGER_SHARED 1 /* same as SHARED_LOCK */
|
||||
@ -1781,6 +1784,10 @@ int sqlite3PagerOpen(
|
||||
/* pPager->state = PAGER_UNLOCK; */
|
||||
/* pPager->errMask = 0; */
|
||||
pPager->tempFile = tempFile;
|
||||
assert( tempFile==PAGER_LOCKINGMODE_NORMAL
|
||||
|| tempFile==PAGER_LOCKINGMODE_EXCLUSIVE );
|
||||
assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 );
|
||||
pPager->exclusiveMode = tempFile;
|
||||
pPager->memDb = memDb;
|
||||
pPager->readOnly = readOnly;
|
||||
/* pPager->needSync = 0; */
|
||||
@ -3192,12 +3199,13 @@ int sqlite3PagerBegin(DbPage *pPg, int exFlag){
|
||||
*/
|
||||
assert( pPager->nRec==0 );
|
||||
assert( pPager->origDbSize==0 );
|
||||
assert( pPager->aInJournal==0 );
|
||||
sqlite3PagerPagecount(pPager);
|
||||
pPager->origDbSize = pPager->dbSize;
|
||||
pPager->aInJournal = sqliteMalloc( pPager->dbSize/8 + 1 );
|
||||
if( !pPager->aInJournal ){
|
||||
rc = SQLITE_NOMEM;
|
||||
}else{
|
||||
pPager->origDbSize = pPager->dbSize;
|
||||
rc = writeJournalHdr(pPager);
|
||||
}
|
||||
}
|
||||
@ -4173,7 +4181,12 @@ void *sqlite3PagerGetExtra(DbPage *pPg){
|
||||
** locking-mode.
|
||||
*/
|
||||
int sqlite3PagerLockingMode(Pager *pPager, int eMode){
|
||||
if( eMode>=0 ){
|
||||
assert( eMode==PAGER_LOCKINGMODE_QUERY
|
||||
|| eMode==PAGER_LOCKINGMODE_NORMAL
|
||||
|| eMode==PAGER_LOCKINGMODE_EXCLUSIVE );
|
||||
assert( PAGER_LOCKINGMODE_QUERY<0 );
|
||||
assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 );
|
||||
if( eMode>=0 && !pPager->tempFile ){
|
||||
pPager->exclusiveMode = eMode;
|
||||
}
|
||||
return (int)pPager->exclusiveMode;
|
||||
|
@ -12,7 +12,7 @@
|
||||
# of these tests is exclusive access mode (i.e. the thing activated by
|
||||
# "PRAGMA locking_mode = EXCLUSIVE").
|
||||
#
|
||||
# $Id: exclusive.test,v 1.3 2007/03/26 10:27:19 danielk1977 Exp $
|
||||
# $Id: exclusive.test,v 1.4 2007/03/30 16:01:55 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -36,8 +36,9 @@ do_test exclusive-1.0 {
|
||||
execsql {
|
||||
pragma locking_mode;
|
||||
pragma main.locking_mode;
|
||||
pragma temp.locking_mode;
|
||||
}
|
||||
} {normal normal}
|
||||
} {normal normal exclusive}
|
||||
do_test exclusive-1.1 {
|
||||
execsql {
|
||||
pragma locking_mode = exclusive;
|
||||
@ -47,8 +48,9 @@ do_test exclusive-1.2 {
|
||||
execsql {
|
||||
pragma locking_mode;
|
||||
pragma main.locking_mode;
|
||||
pragma temp.locking_mode;
|
||||
}
|
||||
} {exclusive exclusive}
|
||||
} {exclusive exclusive exclusive}
|
||||
do_test exclusive-1.3 {
|
||||
execsql {
|
||||
pragma locking_mode = normal;
|
||||
@ -58,8 +60,9 @@ do_test exclusive-1.4 {
|
||||
execsql {
|
||||
pragma locking_mode;
|
||||
pragma main.locking_mode;
|
||||
pragma temp.locking_mode;
|
||||
}
|
||||
} {normal normal}
|
||||
} {normal normal exclusive}
|
||||
do_test exclusive-1.5 {
|
||||
execsql {
|
||||
pragma locking_mode = invalid;
|
||||
@ -69,8 +72,9 @@ do_test exclusive-1.6 {
|
||||
execsql {
|
||||
pragma locking_mode;
|
||||
pragma main.locking_mode;
|
||||
pragma temp.locking_mode;
|
||||
}
|
||||
} {normal normal}
|
||||
} {normal normal exclusive}
|
||||
do_test exclusive-1.7 {
|
||||
execsql {
|
||||
pragma locking_mode = exclusive;
|
||||
@ -87,9 +91,10 @@ do_test exclusive-1.8 {
|
||||
}
|
||||
execsql {
|
||||
pragma main.locking_mode;
|
||||
pragma temp.locking_mode;
|
||||
pragma aux.locking_mode;
|
||||
}
|
||||
} {normal exclusive}
|
||||
} {normal exclusive exclusive}
|
||||
do_test exclusive-1.9 {
|
||||
execsql {
|
||||
pragma locking_mode;
|
||||
@ -121,21 +126,23 @@ do_test exclusive-1.12 {
|
||||
}
|
||||
execsql {
|
||||
pragma main.locking_mode;
|
||||
pragma temp.locking_mode;
|
||||
pragma aux.locking_mode;
|
||||
pragma aux2.locking_mode;
|
||||
}
|
||||
} {normal normal normal}
|
||||
} {normal exclusive normal normal}
|
||||
do_test exclusive-1.13 {
|
||||
execsql {
|
||||
ATTACH 'test4.db' as aux3;
|
||||
}
|
||||
execsql {
|
||||
pragma main.locking_mode;
|
||||
pragma temp.locking_mode;
|
||||
pragma aux.locking_mode;
|
||||
pragma aux2.locking_mode;
|
||||
pragma aux3.locking_mode;
|
||||
}
|
||||
} {normal normal normal normal}
|
||||
} {normal exclusive normal normal normal}
|
||||
|
||||
do_test exclusive-1.99 {
|
||||
execsql {
|
||||
@ -367,7 +374,14 @@ do_test exclusive-4.5 {
|
||||
# Tests exclusive-5.X - test that statement journals are truncated
|
||||
# instead of deleted when in exclusive access mode.
|
||||
#
|
||||
#set sqlite_os_trace 1
|
||||
|
||||
# Close and reopen the database so that the temp database is no
|
||||
# longer active.
|
||||
#
|
||||
db close
|
||||
sqlite db test.db
|
||||
|
||||
|
||||
do_test exclusive-5.0 {
|
||||
execsql {
|
||||
CREATE TABLE abc(a UNIQUE, b UNIQUE, c UNIQUE);
|
||||
@ -422,4 +436,3 @@ do_test exclusive-5.7 {
|
||||
} {1}
|
||||
|
||||
finish_test
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 2001 September 15
|
||||
# 2007 March 26
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
@ -9,10 +9,10 @@
|
||||
#
|
||||
#***********************************************************************
|
||||
#
|
||||
# This file runs the tests in the file ioerr.test with auto-vacuum enabled
|
||||
# databases.
|
||||
# This file runs the tests in the file ioerr.test with
|
||||
# exclusive access mode enabled.
|
||||
#
|
||||
# $Id: exclusive3.test,v 1.2 2007/03/27 16:19:52 danielk1977 Exp $
|
||||
# $Id: exclusive3.test,v 1.3 2007/03/30 16:01:55 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -57,4 +57,3 @@ rename really_finish_test2 finish_test
|
||||
rename do_test ""
|
||||
rename really_do_test do_test
|
||||
finish_test
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user