Add the compilation option SQLITE_DISABLE_DIRSYNC (CVS 2782)

FossilOrigin-Name: f1298bb103aad46c737741d89d33c4c2904aec68
This commit is contained in:
danielk1977 2005-11-25 10:38:22 +00:00
parent 26c5d79f60
commit d7c03f7485
5 changed files with 32 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C If\sSQLITE_DISABLE_LFS\sis\sdefined,\somit\sthe\sbigfile\stests.\s(CVS\s2781)
D 2005-11-25T09:01:24
C Add\sthe\scompilation\soption\sSQLITE_DISABLE_DIRSYNC\s(CVS\s2782)
D 2005-11-25T10:38:22
F Makefile.in 7bed51530f32af7fe1945261c388d80998b39a12
F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@ -54,7 +54,7 @@ F src/os.h c51f2747f7bd1840447e2c7d26db749604626814
F src/os_common.h d74a11728ad2444b6b695b94c28c06881f049e49
F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c 4847182df127270d80cf414c623a18719bbd178a
F src/os_unix.c 1c51efc1755b5413dc69c8500b78646babd8065d
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c fbccc85e7011174068c27d54256746321a1f0059
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
@ -71,7 +71,7 @@ F src/sqlite.h.in 8e648e1f386e4509f2f96c09ded7c07b0df0c9a2
F src/sqliteInt.h 4148c9778e350014c2e27b332d7a2ef7278fe62e
F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316
F src/tclsqlite.c 4f274fae3d4a1863451a553dd8e5015747a5d91d
F src/test1.c 7969c2b10460bbe2ef3e614898895ddc07654199
F src/test1.c 7a4e6f08ed6f7ce1e82949cb27954ab676f6e048
F src/test2.c d55861d8ba5a8b434544da366ba6efe206e1ec97
F src/test3.c f4e6a16a602091696619a1171bda25c0e3df49f7
F src/test4.c a8fd681e139e1c61f22a77d07fc3a99cb28fff3f
@ -213,7 +213,7 @@ F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
F test/subquery.test e6de53332c0301b3cfa34edc3f3cd5fa1e859efd
F test/subselect.test 2d13fb7f450db3595adcdd24079a0dd1d2d6abc2
F test/sync.test d769caaec48456119316775e35e0fdee2fa852d7
F test/sync.test 6e8b885cec5ccba2090e92c90f747a7142f53c88
F test/table.test ec0e6c2186bb8f6824f470caa118524dfd8fe057
F test/tableapi.test 6a66d58b37d46dc0f2b3c7d4bd2617d209399bd1
F test/tclsqlite.test 2da3e4b3a79b13c1511c9d0cd995e08f8362e782
@ -321,7 +321,7 @@ F www/tclsqlite.tcl ddcf912ea48695603c8ed7efb29f0812ef8d1b49
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 84aae3b0ae7381710ff0bc9881cbde3559bb580b
R 3c26b03566afee79bf61607e38a5eeaf
P f882a516da18f45dbb668078d0d8240d930e1180
R efc3e024b52f9af7ccb6b746b407bfb0
U danielk1977
Z 82b836f4c8ecd8efb2caccfdbd5754a8
Z f0fdd4548deb5458034b5fd4de95943a

View File

@ -1 +1 @@
f882a516da18f45dbb668078d0d8240d930e1180
f1298bb103aad46c737741d89d33c4c2904aec68

View File

@ -872,9 +872,11 @@ int sqlite3OsSync(OsFile *id, int dataOnly){
}
if( id->dirfd>=0 ){
TRACE2("DIRSYNC %-3d\n", id->dirfd);
#ifndef SQLITE_DISABLE_DIRSYNC
if( full_fsync(id->dirfd, id->fullSync, 0) ){
return SQLITE_IOERR;
}
#endif
close(id->dirfd); /* Only need to sync once, so close the directory */
id->dirfd = -1; /* when we are done. */
}
@ -890,6 +892,9 @@ int sqlite3OsSync(OsFile *id, int dataOnly){
** The F_FULLFSYNC option is not needed here.
*/
int sqlite3OsSyncDirectory(const char *zDirname){
#ifdef SQLITE_DISABLE_DIRSYNC
return SQLITE_OK;
#else
int fd;
int r;
SimulateIOError(SQLITE_IOERR);
@ -901,6 +906,7 @@ int sqlite3OsSyncDirectory(const char *zDirname){
r = fsync(fd);
close(fd);
return ((r==0)?SQLITE_OK:SQLITE_IOERR);
#endif
}
/*

View File

@ -13,7 +13,7 @@
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
** $Id: test1.c,v 1.164 2005/11/25 09:01:24 danielk1977 Exp $
** $Id: test1.c,v 1.165 2005/11/25 10:38:22 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
@ -2823,6 +2823,12 @@ static void set_options(Tcl_Interp *interp){
Tcl_SetVar2(interp, "sqlite_options","casesensitivelike","0",TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_DISABLE_DIRSYNC
Tcl_SetVar2(interp, "sqlite_options", "dirsync", "0", TCL_GLOBAL_ONLY);
#else
Tcl_SetVar2(interp, "sqlite_options", "dirsync", "1", TCL_GLOBAL_ONLY);
#endif
#ifdef SQLITE_DISABLE_LFS
Tcl_SetVar2(interp, "sqlite_options", "lfs", "0", TCL_GLOBAL_ONLY);
#else

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.1 2005/08/27 16:36:49 drh Exp $
# $Id: sync.test,v 1.2 2005/11/25 10:38:22 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -38,6 +38,9 @@ do_test sync-1.1 {
ATTACH DATABASE 'test2.db' AS db2;
CREATE TABLE db2.t2(x,y);
}
ifcapable !dirsync {
incr sqlite_sync_count 2
}
set sqlite_sync_count
} 8
do_test sync-1.2 {
@ -50,6 +53,9 @@ do_test sync-1.2 {
INSERT INTO t2 VALUES(3,4);
COMMIT;
}
ifcapable !dirsync {
incr sqlite_sync_count 3
}
set sqlite_sync_count
} 8
do_test sync-1.3 {
@ -62,6 +68,9 @@ do_test sync-1.3 {
INSERT INTO t2 VALUES(5,6);
COMMIT;
}
ifcapable !dirsync {
incr sqlite_sync_count 3
}
set sqlite_sync_count
} 10
do_test sync-1.4 {