Simplify logic for syncing directories after creating or deleting a file in

the unix VFS.

FossilOrigin-Name: eb180b4f04d412dcd0af138e2dd7f62fbb5ac439
This commit is contained in:
drh 2015-11-26 10:37:05 +00:00
parent 5a2d970a1a
commit acb6b28d60
3 changed files with 14 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Small\ssimplification\sto\sthe\sxOpen\smethod\sin\sthe\sunix\sVFS.
D 2015-11-26T02:21:05.964
C Simplify\slogic\sfor\ssyncing\sdirectories\safter\screating\sor\sdeleting\sa\sfile\sin\nthe\sunix\sVFS.
D 2015-11-26T10:37:05.218
F Makefile.in d828db6afa6c1fa060d01e33e4674408df1942a1
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc e928e68168df69b353300ac87c10105206653a03
@ -323,7 +323,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8
F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
F src/os_common.h abdb9a191a367793268fe553d25bab894e986a0e
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c 9b3a586ea41129a0a09c13fe421b2d9464964330
F src/os_unix.c 8b35dc3b8b0a789052855cfc6eab6cd1d206fb81
F src/os_win.c 386fba30419e8458b13209781c2af5590eab2811
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c 18341e2b759b447cbc82fb9215d08d9c5864e92e
@ -1405,7 +1405,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 6c5621ce1b1a65913b088ed8be65f9b689260d2c
R 8d655a3f1e63bc6ba67ee6f8b2910653
P 96e7d638ecdabbf84a152036eb01d408d142839e
R d6c3f6ff43a112db1f417e3ad4527c02
U drh
Z 1746dd40560755829f1cb168fd739f6f
Z aa5e5077b0093450034838901b6e8de8

View File

@ -1 +1 @@
96e7d638ecdabbf84a152036eb01d408d142839e
eb180b4f04d412dcd0af138e2dd7f62fbb5ac439

View File

@ -3500,7 +3500,8 @@ static int openDirectory(const char *zFilename, int *pFd){
}
}
*pFd = fd;
return (fd>=0?SQLITE_OK:unixLogError(SQLITE_CANTOPEN_BKPT, "open", zDirname));
if( fd>=0 ) return SQLITE_OK;
return unixLogError(SQLITE_CANTOPEN_BKPT, "openDirectory", zDirname);
}
/*
@ -3553,10 +3554,11 @@ static int unixSync(sqlite3_file *id, int flags){
OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath,
HAVE_FULLFSYNC, isFullsync));
rc = osOpenDirectory(pFile->zPath, &dirfd);
if( rc==SQLITE_OK && dirfd>=0 ){
if( rc==SQLITE_OK ){
full_fsync(dirfd, 0, 0);
robust_close(pFile, dirfd, __LINE__);
}else if( rc==SQLITE_CANTOPEN ){
}else{
assert( rc==SQLITE_CANTOPEN );
rc = SQLITE_OK;
}
pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC;
@ -5903,7 +5905,8 @@ static int unixDelete(
rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, "fsync", zPath);
}
robust_close(0, fd, __LINE__);
}else if( rc==SQLITE_CANTOPEN ){
}else{
assert( rc==SQLITE_CANTOPEN );
rc = SQLITE_OK;
}
}