Add the SQLITE_FCNTL_SYNC file-control.
FossilOrigin-Name: b3f2f465c310a2cfef8731a0dae3453593b68de9
This commit is contained in:
parent
9f4beedb6f
commit
354bfe0363
22
manifest
22
manifest
@ -1,5 +1,5 @@
|
||||
C If\sa\srollback\sis\sattempted\sin\sjournal_mode=off\smode,\sforce\sSQLite\sto\sdiscard\sthe\scontents\sof\sthe\spager\scache\sbefore\sprocessing\sany\ssubsequent\squeries.
|
||||
D 2011-01-11T16:09:55
|
||||
C Add\sthe\sSQLITE_FCNTL_SYNC\sfile-control.
|
||||
D 2011-01-11T17:39:38
|
||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||
F Makefile.in de6498556d536ae60bb8bb10e8c1ba011448658c
|
||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||
@ -162,7 +162,7 @@ F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
|
||||
F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
|
||||
F src/os_unix.c aeaf65d261219ad96c021cfd0672509d83c005e4
|
||||
F src/os_win.c 2f90f7bdec714fad51cd31b4ecad3cc1b4bb5aad
|
||||
F src/pager.c a3d1b55d4572c229170ddb1589232ae7251f8d28
|
||||
F src/pager.c ceceb5e20d8772cd6a1e3d6eb030fbcb1c052f61
|
||||
F src/pager.h 0ea59db2a33bc6c2c02cae34de33367e1effdf76
|
||||
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
||||
F src/pcache.c 09d38c44ab275db581f7a2f6ff8b9bc7f8c0faaa
|
||||
@ -176,7 +176,7 @@ F src/resolve.c 1c0f32b64f8e3f555fe1f732f9d6f501a7f05706
|
||||
F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697
|
||||
F src/select.c 8a7ba246b0b4bb45df7fbc52681728a0e3deaaa7
|
||||
F src/shell.c 83c6f0cc5a79a081c7b9ddfe4f557b47e0bad976
|
||||
F src/sqlite.h.in f48408b86c0713bc074b16c83543868688b0e18d
|
||||
F src/sqlite.h.in 584410ebff31c8d1ca7cac5ddc9f0fa00e9b21c8
|
||||
F src/sqlite3ext.h c90bd5507099f62043832d73f6425d8d5c5da754
|
||||
F src/sqliteInt.h 3ef5fc89a4c9755a08a68de107493785a284e27c
|
||||
F src/sqliteLimit.h a17dcd3fb775d63b64a43a55c54cb282f9726f44
|
||||
@ -509,7 +509,7 @@ F test/journal2.test 50a3604768494d4a337f194f0a9480e7c57dcb72
|
||||
F test/journal3.test ff175219be1b02d2f7e54297ad7e491b7533edb6
|
||||
F test/jrnlmode.test e3fe6c4a2c3213d285650dc8e33aab7eaaa5ce53
|
||||
F test/jrnlmode2.test a19e28de1a6ec898067e46a122f1b71c9323bf00
|
||||
F test/jrnlmode3.test cfcdb12b90e640a23b92785a002d96c0624c8710
|
||||
F test/jrnlmode3.test c6522b276ba315fd1416198de6fc1da9e72409fb
|
||||
F test/keyword1.test a2400977a2e4fde43bf33754c2929fda34dbca05
|
||||
F test/lastinsert.test 474d519c68cb79d07ecae56a763aa7f322c72f51
|
||||
F test/laststmtchanges.test ae613f53819206b3222771828d024154d51db200
|
||||
@ -576,8 +576,8 @@ F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a
|
||||
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
|
||||
F test/null.test a8b09b8ed87852742343b33441a9240022108993
|
||||
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
|
||||
F test/pager1.test e066fb2e2dc1ac1cd9ef2b44a28ae3cc79a9150f
|
||||
F test/pager2.test 0fbb6b6dc40ce1fecfe758c555a748ad2e9beaa3
|
||||
F test/pager1.test 7006a8b5dd3df1fe0d51d7da014333d7dc099778
|
||||
F test/pager2.test 745b911dde3d1f24ae0870bd433dfa83d7c658c1
|
||||
F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
|
||||
F test/pagerfault.test 9de4d3e0c59970b4c6cb8dac511fa242f335d8a7
|
||||
F test/pagerfault2.test 1f79ea40d1133b2683a2f811b00f2399f7ec2401
|
||||
@ -604,7 +604,7 @@ F test/rollback.test 1a83118ea6db4e7d8c10eaa63871b5e90502ffdc
|
||||
F test/rowhash.test 0bc1d31415e4575d10cacf31e1a66b5cc0f8be81
|
||||
F test/rowid.test e58e0acef38b527ed1b0b70d3ada588f804af287
|
||||
F test/rtree.test 0c8d9dd458d6824e59683c19ab2ffa9ef946f798
|
||||
F test/savepoint.test d3dd00e0137fc4b4659bde378a4d8f2cd07238a3
|
||||
F test/savepoint.test a1bef7ace82cc7922975fa96b06176e9bd5114cf
|
||||
F test/savepoint2.test 9b8543940572a2f01a18298c3135ad0c9f4f67d7
|
||||
F test/savepoint3.test e328085853b14898d78ceea00dfe7db18bb6a9ec
|
||||
F test/savepoint4.test c8f8159ade6d2acd9128be61e1230f1c1edc6cc0
|
||||
@ -895,7 +895,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||
P 3513bf6ee090d9be97f60e12a4b39f4361ee17b7
|
||||
R dfc530d225d0c020fd7d8a2cd613ee21
|
||||
P ece7efce2733b4fdd71db385abebbde464ac8f30
|
||||
R 8f29fed661ee1ba7528f6d53e5a1b035
|
||||
U dan
|
||||
Z 8c19b076e4fa90af7411920026738949
|
||||
Z 8ca27a923058f8ea50b31a1627ccbb6c
|
||||
|
@ -1 +1 @@
|
||||
ece7efce2733b4fdd71db385abebbde464ac8f30
|
||||
b3f2f465c310a2cfef8731a0dae3453593b68de9
|
11
src/pager.c
11
src/pager.c
@ -2749,10 +2749,10 @@ end_playback:
|
||||
rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
|
||||
testcase( rc!=SQLITE_OK );
|
||||
}
|
||||
if( rc==SQLITE_OK && !pPager->noSync
|
||||
if( rc==SQLITE_OK
|
||||
&& (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN)
|
||||
){
|
||||
rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);
|
||||
rc = sqlite3PagerSync(pPager);
|
||||
}
|
||||
if( rc==SQLITE_OK ){
|
||||
rc = pager_end_transaction(pPager, zMaster[0]!='\0');
|
||||
@ -5596,6 +5596,9 @@ int sqlite3PagerSync(Pager *pPager){
|
||||
}else{
|
||||
rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);
|
||||
}
|
||||
if( isOpen(pPager->fd) ){
|
||||
sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, (void *)&rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -5813,8 +5816,8 @@ int sqlite3PagerCommitPhaseOne(
|
||||
}
|
||||
|
||||
/* Finally, sync the database file. */
|
||||
if( !pPager->noSync && !noSync ){
|
||||
rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);
|
||||
if( !noSync ){
|
||||
rc = sqlite3PagerSync(pPager);
|
||||
}
|
||||
IOTRACE(("DBSYNC %p\n", pPager))
|
||||
}
|
||||
|
@ -715,6 +715,12 @@ struct sqlite3_io_methods {
|
||||
** to the [sqlite3_file] object associated with a particular database
|
||||
** connection. See the [sqlite3_file_control()] documentation for
|
||||
** additional information.
|
||||
**
|
||||
** The [SQLITE_FCNTL_SYNC] opcode is used internally. SQLite calls
|
||||
** the file-control method with this opcode immediately after the database
|
||||
** file is synced, or if the database is running in synchronous=off mode
|
||||
** immediately after it would have been synced otherwise. This makes it
|
||||
** easier to write special VFS modules that depend on the xSync call.
|
||||
*/
|
||||
#define SQLITE_FCNTL_LOCKSTATE 1
|
||||
#define SQLITE_GET_LOCKPROXYFILE 2
|
||||
@ -723,6 +729,7 @@ struct sqlite3_io_methods {
|
||||
#define SQLITE_FCNTL_SIZE_HINT 5
|
||||
#define SQLITE_FCNTL_CHUNK_SIZE 6
|
||||
#define SQLITE_FCNTL_FILE_POINTER 7
|
||||
#define SQLITE_FCNTL_SYNC 8
|
||||
|
||||
|
||||
/*
|
||||
|
@ -45,7 +45,7 @@ do_test jrnlmode3-1.2 {
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1 2}
|
||||
} {1}
|
||||
|
||||
db close
|
||||
file delete -force test.db test.db-journal
|
||||
@ -67,7 +67,7 @@ do_test jrnlmode3-2.2 {
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1 2}
|
||||
} {1}
|
||||
|
||||
# Test cases to verify that we can move from any journal_mode
|
||||
# to any other, as long as we are not in a transaction. Verify
|
||||
@ -112,15 +112,14 @@ foreach fromjmode $all_journal_modes {
|
||||
db eval "PRAGMA journal_mode=$tojmode"
|
||||
} $fromjmode
|
||||
|
||||
# Rollback the transaction. Verify that the rollback occurred
|
||||
# if journal_mode!=OFF.
|
||||
# Rollback the transaction.
|
||||
#
|
||||
do_test jrnlmode3-3.$cnt.4 {
|
||||
db eval {
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} [expr {$fromjmode=="off"?$cnt:""}]
|
||||
} {}
|
||||
|
||||
# Now change the journal mode again. This time the new mode
|
||||
# should take.
|
||||
@ -143,7 +142,7 @@ foreach fromjmode $all_journal_modes {
|
||||
db eval {
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} [expr {$tojmode=="off"?"1":""}]
|
||||
} {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1614,7 +1614,7 @@ do_catchsql_test pager1-14.1.2 {
|
||||
} {0 {}}
|
||||
do_execsql_test pager1-14.1.3 {
|
||||
SELECT * FROM t1;
|
||||
} {1 2 3 4}
|
||||
} {1 2}
|
||||
do_catchsql_test pager1-14.1.4 {
|
||||
BEGIN;
|
||||
INSERT INTO t1(rowid, a, b) SELECT a+3, b, b FROM t1;
|
||||
@ -1623,7 +1623,7 @@ do_catchsql_test pager1-14.1.4 {
|
||||
do_execsql_test pager1-14.1.5 {
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
} {1 2 3 4 2 2 4 4}
|
||||
} {1 2 2 2}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# Test opening and closing the pager sub-system with different values
|
||||
|
@ -133,7 +133,7 @@ do_test pager2-2.1 {
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {off 1 2}
|
||||
} {off}
|
||||
do_test pager2-2.2 {
|
||||
faultsim_delete_and_reopen
|
||||
execsql {
|
||||
|
@ -905,7 +905,7 @@ if {[wal_is_wal_mode]==0} {
|
||||
ROLLBACK;
|
||||
SELECT * FROM t1;
|
||||
}
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16}
|
||||
} {1 2 3 4 5 6 7 8 9 10 11 12}
|
||||
}
|
||||
|
||||
db close
|
||||
|
Loading…
Reference in New Issue
Block a user