]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix os_kv.c so that it uses SQLITE_FCNTL_SYNC and hence
authordrh <>
Fri, 16 Sep 2022 11:37:01 +0000 (11:37 +0000)
committerdrh <>
Fri, 16 Sep 2022 11:37:01 +0000 (11:37 +0000)
works even with PRAGMA synchronous=OFF.

FossilOrigin-Name: 21915af560b111aeeaee751790356151a5f063c2fc703dd4b35b22dc393409fb

manifest
manifest.uuid
src/os_kv.c

index da3fab544eb3175e8387d6c8737141bb9264ce87..57b3e2ecada4c1ba700306a48be1b2326d78b087 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Pull\sthe\ssrc/os_kv.c\spart\sof\s[13839759f8f4]\sinto\sthe\skv-vfs\sbranch.
-D 2022-09-16T01:08:06.279
+C Fix\sos_kv.c\sso\sthat\sit\suses\sSQLITE_FCNTL_SYNC\sand\shence\nworks\seven\swith\sPRAGMA\ssynchronous=OFF.
+D 2022-09-16T11:37:01.212
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -574,7 +574,7 @@ F src/notify.c 89a97dc854c3aa62ad5f384ef50c5a4a11d70fcc69f86de3e991573421130ed6
 F src/os.c 0eb831ba3575af5277e47f4edd14fdfc90025c67eb25ce5cda634518d308d4e9
 F src/os.h 1ff5ae51d339d0e30d8a9d814f4b8f8e448169304d83a7ed9db66a65732f3e63
 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
-F src/os_kv.c d4909b439043183f9b6aec65528a7433cee49d41cca95b9a3a4c8fb6bbedc0c2
+F src/os_kv.c 554a2c109f8810b743af2eed4ba732d18dfdbc4d073e3a9bd8b8e828215a9692
 F src/os_setup.h 0711dbc4678f3ac52d7fe736951b6384a0615387c4ba5135a4764e4e31f4b6a6
 F src/os_unix.c 0fa91925f0b8831fc0156a9c04d39d86f85baf9eef66c98712395e1715cb75cc
 F src/os_win.c e9454cb141908e8eef2102180bad353a36480612d5b736e4c2bd5777d9b25a34
@@ -2004,8 +2004,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 1c5aeee45564c14e7e2e7730f3f52106339ea3148fb5aa786fa767a35db46f51
-R 06fb792046d4c535864a12af9a1a5d61
-U stephan
-Z 125d6637967f22bfb5b9fb3681eda03b
+P e334449912d5176e355d02024a07ed867741f71c9d10ce6744ca800414bf3eeb
+R a55522768af3f3b5d07199ad1dd4c789
+U drh
+Z d50c7a05ab573e361ead585b4e643b32
 # Remove this line to create a well-formed Fossil manifest.
index 445b7e7e25119c1f289436ca0c6b192cbb96e303..c9139459b8c9d3defc6539ffebda95ff09463fd7 100644 (file)
@@ -1 +1 @@
-e334449912d5176e355d02024a07ed867741f71c9d10ce6744ca800414bf3eeb
\ No newline at end of file
+21915af560b111aeeaee751790356151a5f063c2fc703dd4b35b22dc393409fb
\ No newline at end of file
index 17d4c254e104cb88ce800eeb3e2f91b60b692554..b99f5574c7665affd32bc2a8ad0e642ddae3d93a 100644 (file)
@@ -71,7 +71,8 @@ static int kvvfsFileSizeJrnl(sqlite3_file*, sqlite3_int64 *pSize);
 static int kvvfsLock(sqlite3_file*, int);
 static int kvvfsUnlock(sqlite3_file*, int);
 static int kvvfsCheckReservedLock(sqlite3_file*, int *pResOut);
-static int kvvfsFileControl(sqlite3_file*, int op, void *pArg);
+static int kvvfsFileControlDb(sqlite3_file*, int op, void *pArg);
+static int kvvfsFileControlJrnl(sqlite3_file*, int op, void *pArg);
 static int kvvfsSectorSize(sqlite3_file*);
 static int kvvfsDeviceCharacteristics(sqlite3_file*);
 
@@ -123,7 +124,7 @@ static sqlite3_io_methods kvvfs_db_io_methods = {
   kvvfsLock,                      /* xLock */
   kvvfsUnlock,                    /* xUnlock */
   kvvfsCheckReservedLock,         /* xCheckReservedLock */
-  kvvfsFileControl,               /* xFileControl */
+  kvvfsFileControlDb,             /* xFileControl */
   kvvfsSectorSize,                /* xSectorSize */
   kvvfsDeviceCharacteristics,     /* xDeviceCharacteristics */
   0,                              /* xShmMap */
@@ -147,7 +148,7 @@ static sqlite3_io_methods kvvfs_jrnl_io_methods = {
   kvvfsLock,                      /* xLock */
   kvvfsUnlock,                    /* xUnlock */
   kvvfsCheckReservedLock,         /* xCheckReservedLock */
-  kvvfsFileControl,               /* xFileControl */
+  kvvfsFileControlJrnl,           /* xFileControl */
   kvvfsSectorSize,                /* xSectorSize */
   kvvfsDeviceCharacteristics,     /* xDeviceCharacteristics */
   0,                              /* xShmMap */
@@ -860,13 +861,7 @@ static int kvvfsSyncJrnl(sqlite3_file *pProtoFile, int flags){
   return i ? SQLITE_IOERR : SQLITE_OK;
 }
 static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){
-  KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
-  int rc = SQLITE_OK;
-  SQLITE_KV_LOG(("xSync('%s-db')\n", pFile->zClass));
-  if( pFile->szDb>0 && 0!=kvvfsWriteFileSize(pFile, pFile->szDb) ){
-    rc = SQLITE_IOERR;
-  }
-  return rc;
+  return SQLITE_OK;
 }
 
 /*
@@ -928,7 +923,21 @@ static int kvvfsCheckReservedLock(sqlite3_file *pProtoFile, int *pResOut){
 /*
 ** File control method. For custom operations on an kvvfs-file.
 */
-static int kvvfsFileControl(sqlite3_file *pProtoFile, int op, void *pArg){
+static int kvvfsFileControlJrnl(sqlite3_file *pProtoFile, int op, void *pArg){
+  SQLITE_KV_LOG(("xFileControl(%d) on journal\n", op));
+  return SQLITE_NOTFOUND;
+}
+static int kvvfsFileControlDb(sqlite3_file *pProtoFile, int op, void *pArg){
+  SQLITE_KV_LOG(("xFileControl(%d) on database\n", op));
+  if( op==SQLITE_FCNTL_SYNC ){
+    KVVfsFile *pFile = (KVVfsFile *)pProtoFile;
+    int rc = SQLITE_OK;
+    SQLITE_KV_LOG(("xSync('%s-db')\n", pFile->zClass));
+    if( pFile->szDb>0 && 0!=kvvfsWriteFileSize(pFile, pFile->szDb) ){
+      rc = SQLITE_IOERR;
+    }
+    return rc;
+  }
   return SQLITE_NOTFOUND;
 }