aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2015-12-08 14:37:16 +0000
committerdrh <drh@noemail.net>2015-12-08 14:37:16 +0000
commit86151e8905a6767e3c5173dba111ead43ec865ca (patch)
tree1946995d581b8f3ebd22c823620507cb3b3d62cd /src/os_unix.c
parent92a82771498c19c39abaa3754ff0d307ad7da9dd (diff)
downloadsqlite-86151e8905a6767e3c5173dba111ead43ec865ca.tar.gz
sqlite-86151e8905a6767e3c5173dba111ead43ec865ca.zip
Avoid unnecessary work inside of verifyDbFile() in the unix VFS.
FossilOrigin-Name: f3c0579e931799088e9a83757e25bae229120697
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 791ba5d8d..25f769fa5 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1315,6 +1315,10 @@ static int fileHasMoved(unixFile *pFile){
static void verifyDbFile(unixFile *pFile){
struct stat buf;
int rc;
+
+ /* These verifications occurs for the main database only */
+ if( pFile->ctrlFlags & UNIXFILE_NOLOCK ) return;
+
rc = osFstat(pFile->h, &buf);
if( rc!=0 ){
sqlite3_log(SQLITE_WARNING, "cannot fstat db file %s", pFile->zPath);
@@ -5761,9 +5765,6 @@ static int unixOpen(
p->openFlags = openFlags;
}
#endif
-
- noLock = eType!=SQLITE_OPEN_MAIN_DB;
-
#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
if( fstatfs(fd, &fsInfo) == -1 ){
@@ -5782,6 +5783,7 @@ static int unixOpen(
/* Set up appropriate ctrlFlags */
if( isDelete ) ctrlFlags |= UNIXFILE_DELETE;
if( isReadonly ) ctrlFlags |= UNIXFILE_RDONLY;
+ noLock = eType!=SQLITE_OPEN_MAIN_DB;
if( noLock ) ctrlFlags |= UNIXFILE_NOLOCK;
if( syncDir ) ctrlFlags |= UNIXFILE_DIRSYNC;
if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;