sqlite and locking...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite and locking...

Fabien-5
Hi,

Now that sqlite is included in digikam kde3 svn, we have the ability to
 have a standard behavior with it. Maybe it's the right moment to
specify the options to prevent problems with locking on network file
systems...

Look the following :

1) SQLite lets you set a fixed locking style at compile-time by
defining SQLITE_FIXED_LOCKING_STYLE to a value from its
sqlite3LockingStyle enumeration...
http://svn.haxx.se/dev/archive-2007-03/0121.shtml

2) SQLite on NFS cache coherency :
http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html


I think we should enable SQLITE_ENABLE_LOCKING_STYLE and set
SQLITE_FIXED_LOCKING_STYLE to dotlockLockingStyle which is supported on
all platforms...


--
Fabien

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: sqlite and locking...

Fabien-5
Hi,

For people who want to test it, here's the patch (in attachment), for
file graphics/digikam/libs/sqlite3/sqlite3.c

I added some ifdef parts to disable afp blocks to be able to compile it
under linux (inspired by this patch :
<http://archive.netbsd.se/?ml=sqlite-users&a=2006-12&m=2872097>)

It would be great if those who had/have problems in the past using
digiKam on network storage or non-unix partitions could try it.

Thanks.


Fabien wrote:

> Now that sqlite is included in digikam kde3 svn, we have the ability to
>  have a standard behavior with it. Maybe it's the right moment to
> specify the options to prevent problems with locking on network file
> systems...
>
> Look the following :
>
> 1) SQLite lets you set a fixed locking style at compile-time by
> defining SQLITE_FIXED_LOCKING_STYLE to a value from its
> sqlite3LockingStyle enumeration...
> http://svn.haxx.se/dev/archive-2007-03/0121.shtml
>
> 2) SQLite on NFS cache coherency :
> http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html
>
>
> I think we should enable SQLITE_ENABLE_LOCKING_STYLE and set
> SQLITE_FIXED_LOCKING_STYLE to dotlockLockingStyle which is supported on
> all platforms...
--
Fabien

Index: sqlite3.c
===================================================================
--- sqlite3.c (revision 827113)
+++ sqlite3.c (working copy)
@@ -18750,8 +18750,11 @@
 */
 #if OS_UNIX              /* This file is used on unix only */
 
-/* #define SQLITE_ENABLE_LOCKING_STYLE 0 */
+/* We want to use a fixed locking style for digiKam : */
+#define SQLITE_ENABLE_LOCKING_STYLE     1
+#define SQLITE_FIXED_LOCKING_STYLE      dotlockLockingStyle
 
+
 /*
 ** These #defines should enable >2GB file support on Posix if the
 ** underlying operating system supports it.  If the OS lacks
@@ -20330,6 +20333,8 @@
 
 
 #ifdef SQLITE_ENABLE_LOCKING_STYLE
+
+#ifdef HAVE_FSCTL
 #pragma mark AFP Support
 
 /*
@@ -20644,7 +20649,9 @@
   return SQLITE_OK;
 }
 
+#endif /* HAVE_FSCTL */
 
+
 #pragma mark flock() style locking
 
 /*
@@ -20946,6 +20953,7 @@
 };
 
 #ifdef SQLITE_ENABLE_LOCKING_STYLE
+#ifdef HAVE_FSCTL
 /*
 ** This vector defines all the methods that can operate on an sqlite3_file
 ** for unix with AFP style file locking.
@@ -20965,6 +20973,7 @@
   unixSectorSize,
   unixDeviceCharacteristics
 };
+#endif /* HAVE_FSCTL */
 
 /*
 ** This vector defines all the methods that can operate on an sqlite3_file
@@ -21077,6 +21086,7 @@
   SET_THREADID(pNew);
     
   switch(lockingStyle) {
+#ifdef HAVE_FSCTL
     case afpLockingStyle: {
       /* afp locking uses the file path so it needs to be included in
       ** the afpLockingContext */
@@ -21096,6 +21106,7 @@
       srandomdev();
       break;
     }
+#endif /* HAVE_FSCTL */
     case flockLockingStyle:
       /* flock locking doesn't need additional lockingContext information */
       pNew->pMethod = &sqlite3FlockLockingUnixIoMethod;

_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel