Add "PRAGMA synchronous=EXTRA" which syncs the directory containing the
rollback journal when the rollback journal is deleted in order to commit a transaction in DELETE mode. FossilOrigin-Name: af92401826f5cf49e62c278f344ab75252a18da2
This commit is contained in:
parent
1b32554b80
commit
6841b1cb3d
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Enhance\sthe\sinternal\ssqlite3VdbeAddOpList()\sinterface\sto\sautomatically\supdate\njump\sdestinations.\s\sUse\sthis\sfeature\sto\ssimplify\sthe\sAUTOINCREMENT\scode\ngenerator.
|
||||
D 2016-02-03T01:55:44.089
|
||||
C Add\s"PRAGMA\ssynchronous=EXTRA"\swhich\ssyncs\sthe\sdirectory\scontaining\sthe\nrollback\sjournal\swhen\sthe\srollback\sjournal\sis\sdeleted\sin\sorder\sto\scommit\sa\s\ntransaction\sin\sDELETE\smode.
|
||||
D 2016-02-03T19:20:15.585
|
||||
F Makefile.in 027c1603f255390c43a426671055a31c0a65fdb4
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 72b7858f02017611c3ac1ddc965251017fed0845
|
||||
@ -335,13 +335,13 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
|
||||
F src/os_unix.c 5bb20172d0c9a6afcfa829a88c406970593c848d
|
||||
F src/os_win.c ccf29ddded3e41e506b6bd98c1171aa0963b23f2
|
||||
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
|
||||
F src/pager.c 2916c66aee50f69d9ec56a7619b62d9c6a3bee61
|
||||
F src/pager.h 1c2a49143dfba9e69cc8159ef019f472ed8d260b
|
||||
F src/pager.c 3e189231fc662710964b54862450bc7f69f313c2
|
||||
F src/pager.h f3eb324a3ff2408b28bab7e81c1c55c13720f865
|
||||
F src/parse.y 426a91fbbbf7cdde3fd4b8798de7317a8782bec5
|
||||
F src/pcache.c 73895411fa6b7bd6f0091212feabbe833b358d23
|
||||
F src/pcache.h 4d0ccaad264d360981ec5e6a2b596d6e85242545
|
||||
F src/pcache1.c 72f644dc9e1468c72922eff5904048427b817051
|
||||
F src/pragma.c a973357ef2faded933725a6de2883133deb24029
|
||||
F src/pragma.c 3c4f3fadf05893e289f2adf3a20c671a842cadec
|
||||
F src/pragma.h 64c78a648751b9f4f297276c4eb7507b14b4628c
|
||||
F src/prepare.c db85f0451ba93ecb3c1e497c279abece5cb5aead
|
||||
F src/printf.c 98a5cef7fc84577ab8a3098cfa48ecfa5a70b9f8
|
||||
@ -353,7 +353,7 @@ F src/shell.c dcd7a83645ef2a58ee9c6d0ea4714d877d7835c4
|
||||
F src/sqlite.h.in cf22ad1d52dca2c9862d63833e581028119aab7e
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
|
||||
F src/sqliteInt.h ed6f75088781af7cbd0a6653c2fe16340faa0dd4
|
||||
F src/sqliteInt.h bf8c17fb55d7cd09b477111212b19d661b134989
|
||||
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
|
||||
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
|
||||
F src/table.c 51b46b2a62d1b3a959633d593b89bab5e2c9155e
|
||||
@ -943,7 +943,7 @@ F test/pcache.test c8acbedd3b6fd0f9a7ca887a83b11d24a007972b
|
||||
F test/pcache2.test af7f3deb1a819f77a6d0d81534e97d1cf62cd442
|
||||
F test/percentile.test 4243af26b8f3f4555abe166f723715a1f74c77ff
|
||||
F test/permutations.test 4ea119731c62d2f7d0aa86dd5b184cbb61ca411b
|
||||
F test/pragma.test a44253f911e7d50127d4a08f927f47c861a4c772
|
||||
F test/pragma.test 507ac7ef2ea5682241ea0ef041799ca70bb5e0bf
|
||||
F test/pragma2.test a9400a7289605280576098b97f5cde3f204075c0
|
||||
F test/pragma3.test 6f849ccffeee7e496d2f2b5e74152306c0b8757c
|
||||
F test/printf.test b3ff34e73d59124140eaf89f7672e21bc2ca5fcc
|
||||
@ -1423,7 +1423,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
|
||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||
F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b
|
||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||
P 063755c81574800e7db12a42e17d982a8c1e5181
|
||||
R 03bd7861865ae8f6fba63605b50d909b
|
||||
P ae8b9d2edf1b5aef6108e729754911db7682b6a3
|
||||
R 1a8761ef82294be8ac021b32cc3428ab
|
||||
U drh
|
||||
Z 0f50d7954b5cdd37df3317e2f95eccf8
|
||||
Z 47031796dc00696c427dc7b231b9f896
|
||||
|
@ -1 +1 @@
|
||||
ae8b9d2edf1b5aef6108e729754911db7682b6a3
|
||||
af92401826f5cf49e62c278f344ab75252a18da2
|
22
src/pager.c
22
src/pager.c
@ -637,6 +637,7 @@ struct Pager {
|
||||
u8 useJournal; /* Use a rollback journal on this file */
|
||||
u8 noSync; /* Do not sync the journal if true */
|
||||
u8 fullSync; /* Do extra syncs of the journal for robustness */
|
||||
u8 extraSync; /* sync directory after journal delete */
|
||||
u8 ckptSyncFlags; /* SYNC_NORMAL or SYNC_FULL for checkpoint */
|
||||
u8 walSyncFlags; /* SYNC_NORMAL or SYNC_FULL for wal writes */
|
||||
u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */
|
||||
@ -1997,8 +1998,7 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){
|
||||
);
|
||||
sqlite3OsClose(pPager->jfd);
|
||||
if( bDelete ){
|
||||
rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal,
|
||||
pPager->fullSync && SQLITE_EXTRA_DURABLE);
|
||||
rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, pPager->extraSync);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3504,9 +3504,15 @@ void sqlite3PagerSetFlags(
|
||||
unsigned pgFlags /* Various flags */
|
||||
){
|
||||
unsigned level = pgFlags & PAGER_SYNCHRONOUS_MASK;
|
||||
assert( level>=1 && level<=3 );
|
||||
pPager->noSync = (level==1 || pPager->tempFile) ?1:0;
|
||||
pPager->fullSync = (level==3 && !pPager->tempFile) ?1:0;
|
||||
if( pPager->tempFile ){
|
||||
pPager->noSync = 1;
|
||||
pPager->fullSync = 0;
|
||||
pPager->extraSync = 0;
|
||||
}else{
|
||||
pPager->noSync = level==PAGER_SYNCHRONOUS_OFF ?1:0;
|
||||
pPager->fullSync = level>=PAGER_SYNCHRONOUS_FULL ?1:0;
|
||||
pPager->extraSync = level==PAGER_SYNCHRONOUS_EXTRA ?1:0;
|
||||
}
|
||||
if( pPager->noSync ){
|
||||
pPager->syncFlags = 0;
|
||||
pPager->ckptSyncFlags = 0;
|
||||
@ -4811,11 +4817,17 @@ act_like_temp_file:
|
||||
pPager->noSync = pPager->tempFile;
|
||||
if( pPager->noSync ){
|
||||
assert( pPager->fullSync==0 );
|
||||
assert( pPager->extraSync==0 );
|
||||
assert( pPager->syncFlags==0 );
|
||||
assert( pPager->walSyncFlags==0 );
|
||||
assert( pPager->ckptSyncFlags==0 );
|
||||
}else{
|
||||
pPager->fullSync = 1;
|
||||
#ifdef SQLITE_EXTRA_DURABLE
|
||||
pPager->extraSync = 1;
|
||||
#else
|
||||
pPager->extraSync = 0;
|
||||
#endif
|
||||
pPager->syncFlags = SQLITE_SYNC_NORMAL;
|
||||
pPager->walSyncFlags = SQLITE_SYNC_NORMAL | WAL_SYNC_TRANSACTIONS;
|
||||
pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;
|
||||
|
11
src/pager.h
11
src/pager.h
@ -90,11 +90,12 @@ typedef struct PgHdr DbPage;
|
||||
#define PAGER_SYNCHRONOUS_OFF 0x01 /* PRAGMA synchronous=OFF */
|
||||
#define PAGER_SYNCHRONOUS_NORMAL 0x02 /* PRAGMA synchronous=NORMAL */
|
||||
#define PAGER_SYNCHRONOUS_FULL 0x03 /* PRAGMA synchronous=FULL */
|
||||
#define PAGER_SYNCHRONOUS_MASK 0x03 /* Mask for three values above */
|
||||
#define PAGER_FULLFSYNC 0x04 /* PRAGMA fullfsync=ON */
|
||||
#define PAGER_CKPT_FULLFSYNC 0x08 /* PRAGMA checkpoint_fullfsync=ON */
|
||||
#define PAGER_CACHESPILL 0x10 /* PRAGMA cache_spill=ON */
|
||||
#define PAGER_FLAGS_MASK 0x1c /* All above except SYNCHRONOUS */
|
||||
#define PAGER_SYNCHRONOUS_EXTRA 0x04 /* PRAGMA synchronous=EXTRA */
|
||||
#define PAGER_SYNCHRONOUS_MASK 0x07 /* Mask for four values above */
|
||||
#define PAGER_FULLFSYNC 0x08 /* PRAGMA fullfsync=ON */
|
||||
#define PAGER_CKPT_FULLFSYNC 0x10 /* PRAGMA checkpoint_fullfsync=ON */
|
||||
#define PAGER_CACHESPILL 0x20 /* PRAGMA cache_spill=ON */
|
||||
#define PAGER_FLAGS_MASK 0x38 /* All above except SYNCHRONOUS */
|
||||
|
||||
/*
|
||||
** The remainder of this file contains the declarations of the functions
|
||||
|
23
src/pragma.c
23
src/pragma.c
@ -32,8 +32,8 @@
|
||||
|
||||
/*
|
||||
** Interpret the given string as a safety level. Return 0 for OFF,
|
||||
** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or
|
||||
** unrecognized string argument. The FULL option is disallowed
|
||||
** 1 for ON or NORMAL, 2 for FULL, and 3 for EXTRA. Return 1 for an empty or
|
||||
** unrecognized string argument. The FULL and EXTRA option is disallowed
|
||||
** if the omitFull parameter it 1.
|
||||
**
|
||||
** Note that the values returned are one less that the values that
|
||||
@ -42,18 +42,21 @@
|
||||
** and older scripts may have used numbers 0 for OFF and 1 for ON.
|
||||
*/
|
||||
static u8 getSafetyLevel(const char *z, int omitFull, u8 dflt){
|
||||
/* 123456789 123456789 */
|
||||
static const char zText[] = "onoffalseyestruefull";
|
||||
static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
|
||||
static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
|
||||
static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 2};
|
||||
/* 123456789 123456789 123 */
|
||||
static const char zText[] = "onoffalseyestruextrafull";
|
||||
static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 15, 20};
|
||||
static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 5, 4};
|
||||
static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 3, 2};
|
||||
/* on no off false yes true extra full */
|
||||
int i, n;
|
||||
if( sqlite3Isdigit(*z) ){
|
||||
return (u8)sqlite3Atoi(z);
|
||||
}
|
||||
n = sqlite3Strlen30(z);
|
||||
for(i=0; i<ArraySize(iLength)-omitFull; i++){
|
||||
if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){
|
||||
for(i=0; i<ArraySize(iLength); i++){
|
||||
if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0
|
||||
&& (!omitFull || iValue[i]<=1)
|
||||
){
|
||||
return iValue[i];
|
||||
}
|
||||
}
|
||||
@ -972,7 +975,7 @@ void sqlite3Pragma(
|
||||
|
||||
/*
|
||||
** PRAGMA [schema.]synchronous
|
||||
** PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL
|
||||
** PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL|EXTRA
|
||||
**
|
||||
** Return or set the local value of the synchronous flag. Changing
|
||||
** the local value does not make changes to the disk file and the
|
||||
|
@ -1286,10 +1286,10 @@ struct sqlite3 {
|
||||
*/
|
||||
#define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */
|
||||
#define SQLITE_InternChanges 0x00000002 /* Uncommitted Hash table changes */
|
||||
#define SQLITE_FullFSync 0x00000004 /* Use full fsync on the backend */
|
||||
#define SQLITE_CkptFullFSync 0x00000008 /* Use full fsync for checkpoint */
|
||||
#define SQLITE_CacheSpill 0x00000010 /* OK to spill pager cache */
|
||||
#define SQLITE_FullColNames 0x00000020 /* Show full column names on SELECT */
|
||||
#define SQLITE_FullColNames 0x00000004 /* Show full column names on SELECT */
|
||||
#define SQLITE_FullFSync 0x00000008 /* Use full fsync on the backend */
|
||||
#define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */
|
||||
#define SQLITE_CacheSpill 0x00000020 /* OK to spill pager cache */
|
||||
#define SQLITE_ShortColNames 0x00000040 /* Show short columns names */
|
||||
#define SQLITE_CountRows 0x00000080 /* Count rows changed by INSERT, */
|
||||
/* DELETE, or UPDATE and return */
|
||||
|
@ -186,7 +186,15 @@ do_test pragma-1.10 {
|
||||
PRAGMA synchronous;
|
||||
}
|
||||
} {123 123 1}
|
||||
do_test pragma-1.11 {
|
||||
do_test pragma-1.11.1 {
|
||||
execsql {
|
||||
PRAGMA synchronous=EXTRA;
|
||||
PRAGMA cache_size;
|
||||
PRAGMA default_cache_size;
|
||||
PRAGMA synchronous;
|
||||
}
|
||||
} {123 123 3}
|
||||
do_test pragma-1.11.2 {
|
||||
execsql {
|
||||
PRAGMA synchronous=FULL;
|
||||
PRAGMA cache_size;
|
||||
@ -224,14 +232,20 @@ do_test pragma-1.14.1 {
|
||||
PRAGMA synchronous=4;
|
||||
PRAGMA synchronous;
|
||||
}
|
||||
} {0}
|
||||
} {4}
|
||||
do_test pragma-1.14.2 {
|
||||
execsql {
|
||||
PRAGMA synchronous=3;
|
||||
PRAGMA synchronous;
|
||||
}
|
||||
} {0}
|
||||
} {3}
|
||||
do_test pragma-1.14.3 {
|
||||
execsql {
|
||||
PRAGMA synchronous=8;
|
||||
PRAGMA synchronous;
|
||||
}
|
||||
} {0}
|
||||
do_test pragma-1.14.4 {
|
||||
execsql {
|
||||
PRAGMA synchronous=10;
|
||||
PRAGMA synchronous;
|
||||
|
Loading…
x
Reference in New Issue
Block a user