Add support and documentation for the fullfsync pragma. Also include

some other unrelated documentation updates. (CVS 3080)

FossilOrigin-Name: f2069d0bf3161591535e68b7389792e9cb7fe043
This commit is contained in:
drh 2006-02-11 01:25:50 +00:00
parent 78aecb7250
commit ac530b1ab4
15 changed files with 120 additions and 73 deletions

View File

@ -1,5 +1,5 @@
C Make\ssure\spointers\sare\salways\saligned\sto\s8-bytes\swhen\screating\sinternal\nIndex\sstructures.\s(CVS\s3079)
D 2006-02-10T18:08:09
C Add\ssupport\sand\sdocumentation\sfor\sthe\sfullfsync\spragma.\s\sAlso\sinclude\nsome\sother\sunrelated\sdocumentation\supdates.\s(CVS\s3080)
D 2006-02-11T01:25:51
F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -34,8 +34,8 @@ F src/alter.c 451b34fc4eb2475ca76a2e86b21e1030a9428091
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
F src/attach.c d73a3505de3fb9e373d0a158978116c4212031d0
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c 579594eff6b200ee6e653f4da192d33c50413d56
F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184
F src/btree.c 23bbfb4745e549ca224f6c933a6e9bc106d77f56
F src/btree.h 40055cfc09defd1146bc5b922399c035f969e56d
F src/build.c b46cd7d0e2daca775d9de0cba8abae1b1625caf4
F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
@ -55,14 +55,14 @@ F src/os.h 93035a0e3b9dd05cdd0aaef32ea28ca28e02fe78
F src/os_common.h 108cd719c96a2b714b64e02aeabbd40684274e6a
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c bd42a51385691dc4834c7e1eca614f7f7c2889da
F src/os_unix.c 88f3f422f4715b7008f50ac4b50d8fe670c8055f
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c c67a2c46d929cf54c8f80ec5e6079cf684a141a9
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c b5b380ea7a36f84e50c3adc1a414820a0eb3baa6
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/pager.c c438aa5fc248e0523e80591eeae33a3993c47278
F src/pager.h 425a9e52d5404158de016799715cbc2c3d685178
F src/parse.y 6d666d60a3bb51ceeb0d30b395455a24856849b7
F src/pragma.c 8e135979702f249dd5877402056df0a336ea5a12
F src/pragma.c 31d3e1b74cab2172807894e70c674d6a577501fd
F src/prepare.c cf0fc8ebaf94409955ecb09ffeb0099c9ef44693
F src/printf.c c7d6ad9efb71c466305297a448308f467b6e2b6e
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
@ -70,7 +70,7 @@ F src/select.c 7d069e875d0eec05129c7e8b9c99422d7c9c6321
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 738f55ed75fb36731e764bfdb40756ac43b90b08
F src/sqlite.h.in bc78a247fd9f294b30a4c03894f93fcb1e166410
F src/sqliteInt.h fe74eaa6aa953ace27c3db3272a470d279b6e3e5
F src/sqliteInt.h f61b60f243f1709c943c62cfb6d7a50209080e38
F src/table.c f64ec4fbfe333f8df925bc6ba494f55e05b0e75e
F src/tclsqlite.c d9c26374b52cd47233ae0620d0a858a59b601f89
F src/test1.c ca8cb34747c53479e0748c11d1a10cc07d582bb8
@ -116,7 +116,7 @@ F test/autovacuum.test 0dd22b0e1fe2013abe03e2ef5000bb3b9c1b6666
F test/autovacuum_crash.test 05a63b8805b20cfba7ace82856ce4ccdda075a31
F test/autovacuum_ioerr.test c46a76869cb6eddbbb40b419b2b6c4c001766b1f
F test/autovacuum_ioerr2.test 2f8a3fb31f833fd0ca86ad4ad98913c73e807572
F test/avtrans.test ad4b8fd625eab2ee9f0cfa29f8d8a4c43ba476b9
F test/avtrans.test b77740800de0d2cdcf394ef94d2d61225a1941d8
F test/between.test 16b1776c6323faadb097a52d673e8e3d8be7d070
F test/bigfile.test ebc9ce9216e08bead63734ab816d0f27858f3b80
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
@ -235,7 +235,7 @@ F test/shared_err.test 299a9180a6376b2089e8e0d469f383fe91bfa4ff
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
F test/sync.test 6c8dc6592cd8dd770c739d9b5a9a9976c7124de6
F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3
F test/table.test 6dc0dfa44dd429520e0e5a0c5e55025f730e9403
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
F test/tclsqlite.test 93c399414273d829f3fc5fc4a8349b484fe84d5b
@ -259,7 +259,7 @@ F test/tkt1567.test 18023cc3626a365f0118e17b66decedec93b1a6f
F test/tkt1644.test 80b6a2bb17885f3cf1cb886d97cdad13232bb869
F test/tkt1667.test c7faac5050b45d81d0b9f6294e4570b588106e19
F test/trace.test 75ffc1b992c780d054748a656e3e7fd674f18567
F test/trans.test b25eae982d156867eac338409905fd4ca589b7f8
F test/trans.test 6f96f824f8b7b53644b14562b6ccf0eaa1292160
F test/trigger1.test 0c1d44882dba5c92e4efee4dd133cc979f0b1860
F test/trigger2.test 33bf8ae9b788013be194efe5f66c04a202facbb4
F test/trigger3.test 9102fd3933db294dc654b5aee9edfe9e94f2b9e2
@ -308,7 +308,7 @@ F www/audit.tcl 90e09d580f79c7efec0c7d6f447b7ec5c2dce5c0
F www/autoinc.tcl b357f5ba954b046ee35392ce0f884a2fcfcdea06
F www/c_interface.tcl b51b08591554c16a0c3ef718364a508ac25abc7e
F www/capi3.tcl 7a7cc225fe02eb7ab861a6019b08baa0014409e1
F www/capi3ref.tcl 16195e218ebc5fc5ee3ca859f66b707ed8e9eea1
F www/capi3ref.tcl 0ce8b070cc22d460268d46c208999ffa96566939
F www/changes.tcl c36d331b25a3b193845c05a6fa3f914899634940
F www/common.tcl 14d121c28532ad20c3e349caa4db708b0b822083
F www/compile.tcl 276546d7eb445add5a867193bbd80f6919a6b084
@ -323,7 +323,7 @@ F www/direct1b.gif 32b48b764244817b6b591898dc52a04299a7b8a7
F www/docs.tcl 09eeac4e565789a67abc63f166a9ae7f3050454d
F www/download.tcl d56a1c30b1c3c18f62926a806179976eb133ce94
F www/dynload.tcl 02eb8273aa78cfa9070dd4501dca937fb22b466c
F www/faq.tcl ac2a8b0cc13d8697ebf90d1bce63c089c0149633
F www/faq.tcl ad5f388e1924c3fff4892b7f45ea58aa1d7a562a
F www/fileformat.tcl 900c95b9633abc3dcfc384d9ddd8eb4876793059
F www/formatchng.tcl f4f5f32205c0a70d07784f7bf9ce33ed34bfcbf3
F www/fullscanb.gif f7c94cb227f060511f8909e10f570157263e9a25
@ -340,7 +340,7 @@ F www/opcode.tcl 5bd68059416b223515a680d410a9f7cb6736485f
F www/optimizer.tcl d6812a10269bd0d7c488987aac0ad5036cace9dc
F www/optimizing.tcl f0b2538988d1bbad16cbfe63ec6e8f48c9eb04e5
F www/optoverview.tcl 815df406a38c9f69b27d37e8f7ede004c6d9f19e
F www/pragma.tcl 44f7b665ca598ad24724f35991653638a36a6e3f
F www/pragma.tcl 0e6316315d1e418bfc8c31b949a0243aa0f2e65d
F www/quickstart.tcl 2f3daf8038e82a102e1e8cc877aafa7a413f5f11
F www/shared.gif 265bae80c5b311c5a86e47662821076ffaf5c6ea
F www/sharedcache.tcl 3ebec81110e606af6fd65a3c4c19562cb173b29c
@ -352,7 +352,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 9e82b927490bc152f61c4ee3e95b6d08ea16c858
R b962ad9f5ff93d26be9a1cef5920b41c
P d20a33ac2a29a3410fa28078dd122d87d8fca4fe
R a0687c1a32871f5de67a2bea238c288d
U drh
Z d1ddeb33c5918242cb780500c7215c77
Z d6577bff89d0124a23b77557cce8c0c8

View File

@ -1 +1 @@
d20a33ac2a29a3410fa28078dd122d87d8fca4fe
f2069d0bf3161591535e68b7389792e9cb7fe043

View File

@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.313 2006/02/10 08:24:21 danielk1977 Exp $
** $Id: btree.c,v 1.314 2006/02/11 01:25:51 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
@ -1803,9 +1803,9 @@ int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){
** probability of damage to near zero but with a write performance reduction.
*/
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
int sqlite3BtreeSetSafetyLevel(Btree *p, int level){
int sqlite3BtreeSetSafetyLevel(Btree *p, int level, int fullSync){
BtShared *pBt = p->pBt;
sqlite3pager_set_safety_level(pBt->pPager, level);
sqlite3pager_set_safety_level(pBt->pPager, level, fullSync);
return SQLITE_OK;
}
#endif

View File

@ -13,7 +13,7 @@
** subsystem. See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.69 2006/01/07 13:21:04 danielk1977 Exp $
** @(#) $Id: btree.h,v 1.70 2006/02/11 01:25:51 drh Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_
@ -59,7 +59,7 @@ int sqlite3BtreeOpen(
int sqlite3BtreeClose(Btree*);
int sqlite3BtreeSetBusyHandler(Btree*,BusyHandler*);
int sqlite3BtreeSetCacheSize(Btree*,int);
int sqlite3BtreeSetSafetyLevel(Btree*,int);
int sqlite3BtreeSetSafetyLevel(Btree*,int,int);
int sqlite3BtreeSyncDisabled(Btree*);
int sqlite3BtreeSetPageSize(Btree*,int,int);
int sqlite3BtreeGetPageSize(Btree*);

View File

@ -981,6 +981,17 @@ int sqlite3_fullsync_count = 0;
# define fdatasync fsync
#endif
/*
** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not
** the F_FULLFSYNC macro is defined. F_FULLFSYNC is currently
** only available on Mac OS X. But that could change.
*/
#ifdef F_FULLFSYNC
# define HAVE_FULLFSYNC 1
#else
# define HAVE_FULLFSYNC 0
#endif
/*
** The fsync() system call does not work as advertised on many
@ -1012,7 +1023,7 @@ static int full_fsync(int fd, int fullSync, int dataOnly){
rc = SQLITE_OK;
#else
#ifdef F_FULLFSYNC
#if HAVE_FULLFSYNC
if( fullSync ){
rc = fcntl(fd, F_FULLFSYNC, 0);
}else{
@ -1057,10 +1068,16 @@ static int unixSync(OsFile *id, int dataOnly){
return SQLITE_IOERR;
}
if( pFile->dirfd>=0 ){
TRACE2("DIRSYNC %-3d\n", pFile->dirfd);
TRACE4("DIRSYNC %-3d (have_fullfsync=%d fullsync=%d)\n", pFile->dirfd,
HAVE_FULLFSYNC, pFile->fullSync);
#ifndef SQLITE_DISABLE_DIRSYNC
if( full_fsync(pFile->dirfd, pFile->fullSync, 0) ){
/* We have received multiple reports of fsync() returning
/* The directory sync is only attempted if full_fsync is
** turned off or unavailable. If a full_fsync occurred above,
** then the directory sync is superfluous.
*/
if( (!HAVE_FULLFSYNC || !pFile->fullSync) && full_fsync(pFile->dirfd,0,0) ){
/*
** We have received multiple reports of fsync() returning
** errors when applied to directories on certain file systems.
** A failed directory sync is not a big deal. So it seems
** better to ignore the error. Ticket #1657

View File

@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.257 2006/01/30 22:48:44 drh Exp $
** @(#) $Id: pager.c,v 1.258 2006/02/11 01:25:51 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@ -244,6 +244,7 @@ struct Pager {
u8 stmtAutoopen; /* Open stmt journal when main journal is opened*/
u8 noSync; /* Do not sync the journal if true */
u8 fullSync; /* Do extra syncs of the journal for robustness */
u8 full_fsync; /* Use F_FULLFSYNC when available */
u8 state; /* PAGER_UNLOCK, _SHARED, _RESERVED, etc. */
u8 errCode; /* One of several kinds of errors */
u8 tempFile; /* zFilename is a temporary file */
@ -1509,9 +1510,10 @@ void sqlite3pager_set_cachesize(Pager *pPager, int mxPage){
** and FULL=3.
*/
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
void sqlite3pager_set_safety_level(Pager *pPager, int level){
void sqlite3pager_set_safety_level(Pager *pPager, int level, int full_fsync){
pPager->noSync = level==1 || pPager->tempFile;
pPager->fullSync = level==3 && !pPager->tempFile;
pPager->full_fsync = full_fsync;
if( pPager->noSync ) pPager->needSync = 0;
}
#endif
@ -2204,7 +2206,7 @@ static int syncJournal(Pager *pPager){
if( rc ) return rc;
}
TRACE2("SYNC journal of %d\n", PAGERID(pPager));
rc = sqlite3OsSync(pPager->jfd, pPager->fullSync);
rc = sqlite3OsSync(pPager->jfd, pPager->full_fsync);
if( rc!=0 ) return rc;
pPager->journalStarted = 1;
}
@ -2832,8 +2834,8 @@ static int pager_open_journal(Pager *pPager){
if( rc!=SQLITE_OK ){
goto failed_to_open_journal;
}
sqlite3OsSetFullSync(pPager->jfd, pPager->fullSync);
sqlite3OsSetFullSync(pPager->fd, pPager->fullSync);
sqlite3OsSetFullSync(pPager->jfd, pPager->full_fsync);
sqlite3OsSetFullSync(pPager->fd, pPager->full_fsync);
sqlite3OsOpenDirectory(pPager->jfd, pPager->zDirectory);
pPager->journalOpen = 1;
pPager->journalStarted = 0;

View File

@ -13,7 +13,7 @@
** subsystem. The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
** @(#) $Id: pager.h,v 1.48 2005/12/19 14:18:11 danielk1977 Exp $
** @(#) $Id: pager.h,v 1.49 2006/02/11 01:25:51 drh Exp $
*/
#ifndef _PAGER_H_
@ -99,7 +99,7 @@ int sqlite3pager_stmt_rollback(Pager*);
void sqlite3pager_dont_rollback(void*);
void sqlite3pager_dont_write(Pager*, Pgno);
int *sqlite3pager_stats(Pager*);
void sqlite3pager_set_safety_level(Pager*,int);
void sqlite3pager_set_safety_level(Pager*,int,int);
const char *sqlite3pager_filename(Pager*);
const char *sqlite3pager_dirname(Pager*);
const char *sqlite3pager_journalname(Pager*);

View File

@ -11,7 +11,7 @@
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.117 2006/02/10 02:27:43 danielk1977 Exp $
** $Id: pragma.c,v 1.118 2006/02/11 01:25:51 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -152,6 +152,7 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
{ "count_changes", SQLITE_CountRows },
{ "empty_result_callbacks", SQLITE_NullCallback },
{ "legacy_file_format", SQLITE_LegacyFileFmt },
{ "fullfsync", SQLITE_FullFSync },
#ifndef SQLITE_OMIT_CHECK
{ "ignore_check_constraints", SQLITE_IgnoreChecks },
#endif
@ -180,10 +181,6 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
db->flags &= ~p->mask;
}
}
/* If one of these pragmas is executed, any prepared statements
** need to be recompiled.
*/
sqlite3VdbeAddOp(v, OP_Expire, 0, 0);
}
return 1;
}
@ -437,7 +434,6 @@ void sqlite3Pragma(
"Safety level may not be changed inside a transaction");
}else{
pDb->safety_level = getSafetyLevel(zRight)+1;
sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level);
}
}
}else
@ -947,6 +943,15 @@ void sqlite3Pragma(
** are only valid for a single execution.
*/
sqlite3VdbeAddOp(v, OP_Expire, 1, 0);
/*
** Reset the safety level, in case the fullfsync flag or synchronous
** setting changed.
*/
if( db->autoCommit ){
sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level,
(db->flags&SQLITE_FullFSync)!=0);
}
}
pragma_out:
sqliteFree(zLeft);

View File

@ -11,7 +11,7 @@
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.480 2006/02/10 07:07:16 danielk1977 Exp $
** @(#) $Id: sqliteInt.h,v 1.481 2006/02/11 01:25:51 drh Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
@ -544,6 +544,7 @@ struct sqlite3 {
#define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */
#define SQLITE_ReadUncommitted 0x00004000 /* For shared-cache mode */
#define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */
#define SQLITE_FullFSync 0x00010000 /* Use full fsync on the backend */
/*
** Possible values for the sqlite.magic field.

View File

@ -12,7 +12,7 @@
# file is a copy of "trans.test" modified to run under autovacuum mode.
# the point is to stress the autovacuum logic and try to get it to fail.
#
# $Id: avtrans.test,v 1.3 2006/01/23 21:37:32 drh Exp $
# $Id: avtrans.test,v 1.4 2006/02/11 01:25:51 drh Exp $
set testdir [file dirname $argv0]
@ -864,9 +864,9 @@ for {set i 2} {$i<=$limit} {incr i} {
set ::sig [signature]
set cnt [lindex $::sig 0]
if {$i%2==0} {
execsql {PRAGMA synchronous=FULL}
execsql {PRAGMA fullfsync=ON}
} else {
execsql {PRAGMA synchronous=NORMAL}
execsql {PRAGMA fullfsync=OFF}
}
set sqlite_sync_count 0
set sqlite_fullsync_count 0

View File

@ -13,7 +13,7 @@
# This file implements tests to verify that fsync is disabled when
# pragma synchronous=off even for multi-database commits.
#
# $Id: sync.test,v 1.4 2006/01/31 15:19:45 drh Exp $
# $Id: sync.test,v 1.5 2006/02/11 01:25:51 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -36,6 +36,7 @@ do_test sync-1.1 {
file delete -force test2.db
file delete -force test2.db-journal
execsql {
PRAGMA fullfsync=OFF;
CREATE TABLE t1(a,b);
ATTACH DATABASE 'test2.db' AS db2;
CREATE TABLE db2.t2(x,y);

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script is database locks.
#
# $Id: trans.test,v 1.28 2006/01/17 09:35:03 danielk1977 Exp $
# $Id: trans.test,v 1.29 2006/02/11 01:25:52 drh Exp $
set testdir [file dirname $argv0]
@ -859,9 +859,9 @@ for {set i 2} {$i<=$limit} {incr i} {
set ::sig [signature]
set cnt [lindex $::sig 0]
if {$i%2==0} {
execsql {PRAGMA synchronous=FULL}
execsql {PRAGMA fullfsync=ON}
} else {
execsql {PRAGMA synchronous=NORMAL}
execsql {PRAGMA fullfsync=OFF}
}
set sqlite_sync_count 0
set sqlite_fullsync_count 0

View File

@ -1,4 +1,4 @@
set rcsid {$Id: capi3ref.tcl,v 1.33 2006/02/10 13:14:21 danielk1977 Exp $}
set rcsid {$Id: capi3ref.tcl,v 1.34 2006/02/11 01:25:52 drh Exp $}
source common.tcl
header {C/C++ Interface For SQLite Version 3}
puts {
@ -1369,26 +1369,20 @@ api {} {
Sharing must be disabled prior to shutting down a thread or else
the thread will leak memory. Call this routine with an argument of
0 to turn of sharing. Or use the sqlite3_thread_cleanup() API.
0 to turn off sharing. Or use the sqlite3_thread_cleanup() API.
This routine must not be called when any database connections
are active in the current thread. Enabling or disabling shared
cache while there are active database connections will result
in memory corruption.
For any given database connection, SQLite requires that the
following routines always be called from the same thread:
When the shared cache is enabled, the
following routines must always be called from the same thread:
sqlite3_open(), sqlite3_prepare(), sqlite3_step(), sqlite3_reset(),
sqlite3_finalize(), and sqlite3_close(). On some operating systems
(ex: windows and linux 2.6) you can get away with calling these routines
from different threads as long as their executions never overlap in time
and the shared cache is disabled.
But when the shared cache is enabled, some information about the
database connection is stored in thread-specific storage so that it
will be available for sharing with other connections. Consequently,
the previously enumerated routines must always be called from the
same thread when shared cache is enabled, regardless of what operating
system is used.
sqlite3_finalize(), and sqlite3_close().
This is due to the fact that the shared cache makes use of
thread-specific storage so that it will be available for sharing
with other connections.
This routine returns SQLITE_OK if shared cache was
enabled or disabled successfully. An error code is returned

View File

@ -1,7 +1,7 @@
#
# Run this script to generated a faq.html output file
#
set rcsid {$Id: faq.tcl,v 1.34 2006/01/11 05:49:50 danielk1977 Exp $}
set rcsid {$Id: faq.tcl,v 1.35 2006/02/11 01:25:52 drh Exp $}
source common.tcl
header {SQLite Frequently Asked Questions</title>}
@ -197,21 +197,24 @@ faq {
to use the same <b>sqlite3</b> structure pointer in two
or more threads.</p>
<p>An <b>sqlite3</b> structure can only be used in the same thread
<p>Prior to version 3.3.1,
an <b>sqlite3</b> structure could only be used in the same thread
that called <a href="capi3ref#sqlite3_open">sqlite3_open</a> to create it.
You cannot open a
You could not open a
database in one thread then pass the handle off to another thread for
it to use. This is due to limitations (bugs?) in many common threading
it to use. This was due to limitations (bugs?) in many common threading
implementations such as on RedHat9. Specifically, an fcntl() lock
created by one thread cannot be removed or modified by a different
thread on the troublesome systems. And since SQLite uses fcntl()
locks heavily for concurrency control, serious problems arise if you
locks heavily for concurrency control, serious problems arose if you
start moving database connections across threads.</p>
<p>There may be ways to work around the fcntl() lock problems in Linux,
but they are complex and exceedingly difficult to test for correctness.
For that reason, SQLite currently takes the safe
approach and disallows the sharing of handles among threads.</p>
<p>The restriction on moving database connections across threads
was relaxed somewhat in version 3.3.1. With that and subsequent
versions, it is safe to move a connection handle across threads
as long as the connection is not holding any fcntl() locks. You
can safely assume that no locks are being held if no
transaction is pending and all statements have been finalized.</p>
<p>Under UNIX, you should not carry an open SQLite database across
a fork() system call into the child process. Problems will result

View File

@ -1,7 +1,7 @@
#
# Run this Tcl script to generate the pragma.html file.
#
set rcsid {$Id: pragma.tcl,v 1.16 2005/08/28 17:00:26 drh Exp $}
set rcsid {$Id: pragma.tcl,v 1.17 2006/02/11 01:25:52 drh Exp $}
source common.tcl
header {Pragma statements supported by SQLite}
@ -211,6 +211,16 @@ puts {
</p>
</li>
<a name="pragma_fullfsync"></a>
<li><p><b>PRAGMA fullfsync
<br>PRAGMA fullfsync = </b><i>0 | 1</i><b>;</b></p>
<p>Query or change the fullfsync flag. This flag affects
determines whether or not the F_FULLFSYNC syncing method is used
on systems that support it. The default value is off. As of this
writing (2006-02-10) only Mac OS X supports F_FULLFSYNC.
</p>
</li>
<a name="pragma_page_size"></a>
<li><p><b>PRAGMA page_size;
<br>PRAGMA page_size = </b><i>bytes</i><b>;</b></p>
@ -223,6 +233,20 @@ puts {
</p>
</li>
<a name="pragma_read_uncommitted"></a>
<li><p><b>PRAGMA read_uncommitted;
<br>PRAGMA read_uncommitted = </b><i>0 | 1</i><b>;</b></p>
<p>Query, set, or clear READ UNCOMMITTED isolation. The default isolation
level for SQLite is SERIALIZABLE. Any process or thread can select
READ UNCOMMITTED isolation, but SERIALIZABLE will still be used except
between connections that share a common page and schema cache.
Cache sharing is enabled using the
<a href="capi3ref.html#sqlite3_enable_shared_cache">
sqlite3_enable_shared_cache()</a> API and is only available between
connections running the same thread. Cache sharing is off by default.
</p>
</li>
<a name="pragma_short_column_names"></a>
<li><p><b>PRAGMA short_column_names;
<br>PRAGMA short_column_names = </b><i>0 | 1</i><b>;</b></p>