Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Refinements to synchronous logic: (1) Use PAGER_SYNCHRONOUS_FULL rather than the corresponding magic number. (2) Honor SQLITE_NO_SYNC on xDelete calls with sync (3) Count xDelete syncs during testing (4) Fix #ifs on SQLITE_EXTRA_DURABLE so that directory syncs on journal unlink are off by default. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e3157cb5ad0d22758e766a95fb1463a7 |
User & Date: | drh 2016-02-04 09:48:12.199 |
Context
2016-02-04
| ||
10:28 | Escape control characters in JSON. Fix for ticket [ad2559db380abf8]. (check-in: 4f1b5229a3 user: drh tags: trunk) | |
09:48 | Refinements to synchronous logic: (1) Use PAGER_SYNCHRONOUS_FULL rather than the corresponding magic number. (2) Honor SQLITE_NO_SYNC on xDelete calls with sync (3) Count xDelete syncs during testing (4) Fix #ifs on SQLITE_EXTRA_DURABLE so that directory syncs on journal unlink are off by default. (check-in: e3157cb5ad user: drh tags: trunk) | |
2016-02-03
| ||
22:14 | In the VDBE loop, only check for OOM errors at jumps rather than after every opcode, for about a 0.5% performance increase. (check-in: 632071bac5 user: drh tags: trunk) | |
Changes
Changes to src/attach.c.
︙ | ︙ | |||
152 153 154 155 156 157 158 | } sqlite3BtreeEnter(aNew->pBt); pPager = sqlite3BtreePager(aNew->pBt); sqlite3PagerLockingMode(pPager, db->dfltLockMode); sqlite3BtreeSecureDelete(aNew->pBt, sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); #ifndef SQLITE_OMIT_PAGER_PRAGMAS | | > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | } sqlite3BtreeEnter(aNew->pBt); pPager = sqlite3BtreePager(aNew->pBt); sqlite3PagerLockingMode(pPager, db->dfltLockMode); sqlite3BtreeSecureDelete(aNew->pBt, sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); #ifndef SQLITE_OMIT_PAGER_PRAGMAS sqlite3BtreeSetPagerFlags(aNew->pBt, PAGER_SYNCHRONOUS_FULL | (db->flags & PAGER_FLAGS_MASK)); #endif sqlite3BtreeLeave(aNew->pBt); } aNew->safety_level = 3; aNew->zName = sqlite3DbStrDup(db, zName); if( rc==SQLITE_OK && aNew->zName==0 ){ rc = SQLITE_NOMEM; |
︙ | ︙ |
Changes to src/os_unix.c.
︙ | ︙ | |||
5883 5884 5885 5886 5887 5888 5889 | return rc; } #ifndef SQLITE_DISABLE_DIRSYNC if( (dirSync & 1)!=0 ){ int fd; rc = osOpenDirectory(zPath, &fd); if( rc==SQLITE_OK ){ | < < < | < < | 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 | return rc; } #ifndef SQLITE_DISABLE_DIRSYNC if( (dirSync & 1)!=0 ){ int fd; rc = osOpenDirectory(zPath, &fd); if( rc==SQLITE_OK ){ if( full_fsync(fd,0,0) ){ rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, "fsync", zPath); } robust_close(0, fd, __LINE__); }else{ assert( rc==SQLITE_CANTOPEN ); rc = SQLITE_OK; } |
︙ | ︙ | |||
6932 6933 6934 6935 6936 6937 6938 | MAXPATHLEN); }else{ strlcpy(&writeBuffer[PROXY_PATHINDEX], tempLockPath, MAXPATHLEN); } writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]); robust_ftruncate(conchFile->h, writeSize); rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0); | | | 6927 6928 6929 6930 6931 6932 6933 6934 6935 6936 6937 6938 6939 6940 6941 | MAXPATHLEN); }else{ strlcpy(&writeBuffer[PROXY_PATHINDEX], tempLockPath, MAXPATHLEN); } writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]); robust_ftruncate(conchFile->h, writeSize); rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0); full_fsync(conchFile->h,0,0); /* If we created a new conch file (not just updated the contents of a ** valid conch file), try to match the permissions of the database */ if( rc==SQLITE_OK && createConch ){ struct stat buf; int err = osFstat(pFile->h, &buf); if( err==0 ){ |
︙ | ︙ |
Changes to src/pager.c.
︙ | ︙ | |||
4819 4820 4821 4822 4823 4824 4825 | assert( pPager->fullSync==0 ); assert( pPager->extraSync==0 ); assert( pPager->syncFlags==0 ); assert( pPager->walSyncFlags==0 ); assert( pPager->ckptSyncFlags==0 ); }else{ pPager->fullSync = 1; | | | 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 | assert( pPager->fullSync==0 ); assert( pPager->extraSync==0 ); assert( pPager->syncFlags==0 ); assert( pPager->walSyncFlags==0 ); assert( pPager->ckptSyncFlags==0 ); }else{ pPager->fullSync = 1; #if 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; |
︙ | ︙ |
Changes to test/sync.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to verify that fsync is disabled when # pragma synchronous=off even for multi-database commits. # | < | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to verify that fsync is disabled when # pragma synchronous=off even for multi-database commits. # set testdir [file dirname $argv0] source $testdir/tester.tcl # # These tests are only applicable when pager pragma are # enabled. Also, since every test uses an ATTACHed database, they # are only run when ATTACH is enabled. # ifcapable !pager_pragmas||!attach { finish_test return } set sqlite_sync_count 0 proc cond_incr_sync_count {adj} { global sqlite_sync_count if {$::tcl_platform(platform) == "windows"} { incr sqlite_sync_count $adj } else { ifcapable !dirsync { incr sqlite_sync_count $adj } } } do_test sync-1.1 { |
︙ | ︙ | |||
60 61 62 63 64 65 66 | PRAGMA main.synchronous=on; PRAGMA db2.synchronous=on; BEGIN; INSERT INTO t1 VALUES(1,2); INSERT INTO t2 VALUES(3,4); COMMIT; } | | | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | PRAGMA main.synchronous=on; PRAGMA db2.synchronous=on; BEGIN; INSERT INTO t1 VALUES(1,2); INSERT INTO t2 VALUES(3,4); COMMIT; } cond_incr_sync_count 4 set sqlite_sync_count } 9 } do_test sync-1.3 { set sqlite_sync_count 0 execsql { PRAGMA main.synchronous=full; PRAGMA db2.synchronous=full; BEGIN; INSERT INTO t1 VALUES(3,4); INSERT INTO t2 VALUES(5,6); COMMIT; } cond_incr_sync_count 4 set sqlite_sync_count } 11 ifcapable pager_pragmas { do_test sync-1.4 { set sqlite_sync_count 0 execsql { PRAGMA main.synchronous=off; PRAGMA db2.synchronous=off; BEGIN; |
︙ | ︙ |