<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">Le 11/01/2022 à 18:58, Greg Troxel a
écrit :<br>
</div>
<blockquote type="cite" cite="mid:rmiwnj6rw64.fsf@s1.lexort.com">
<pre class="moz-quote-pre" wrap="">
Jürgen E. Fischer <a class="moz-txt-link-rfc2396E" href="mailto:jef@norbit.de"><jef@norbit.de></a> writes:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">On Tue, 11. Jan 2022 at 09:10:57 -0500, <a class="moz-txt-link-abbreviated" href="mailto:pergler@gmail.com">pergler@gmail.com</a> wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">I've tried making the gpkg read-only, which hasn't crashed anything in brief
testing and generates no warnings. However, it feels risky, and clearly QGIS
or OGR aren't fully happy, since the temporary shm and wal files don't get
deleted on exit. So I'm hesitant to continue doing this for fear of a crash
when I'm actually doing something useful.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
We do the same with world_map.gpkg - see
<a class="moz-txt-link-freetext" href="https://github.com/qgis/QGIS/issues/35383">https://github.com/qgis/QGIS/issues/35383</a>.
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
I had seen that (NetBSD 9, pkgsrc, qgis 3.16.x) and wondered if it was a
packaging error I should look into. Now I understand. I have long
found it problematic that the wal/shm files exist and persist for long
periods, and that gpkd files I don't intend to change are modified at
the OS level.
It strikes me that the basic bug needs one of two things:
1) The geopackage driver should have a read-only access mode, and qgis
should start out that way, trying to change to read/write only when
the user hits the edit button on one of the layers. And, if the file
is read only, there should be a nice error like "can't make this layer
writable" and the toggle to write should fail.</pre>
</blockquote>
<p>The main issue I see is that it is unknown (and non documented
AFAICS in SQLite documentation) what happens if :</p>
<p>- reader A has opened the file with default journaling mode (for
read-only)</p>
<p>- reader B (other QGIS process for example, or possibly the same
QGIS process like a renderer thread) has opened the file with
default journaling mode (for read-only)</p>
<p>- let's say A wants to edit and we thus enable WAL to avoid
reader/writer blocks<br>
</p>
<p>- is B which has opened without WAL still in a safe state ? Does
it react properly to WAL having been enabled behind its back ?</p>
<p>The default enabling of WAL even in initial read-only access mode
is to avoid that potential issue.<br>
</p>
<p><br>
</p>
<p>There are currently way of disabling WAL (for advanced users) :</p>
<p>- setting the <span class="pl-s"><span class="pl-pds"></span>OGR_SQLITE_JOURNAL<span
class="pl-pds"> environment variable to JOURNAL</span></span></p>
<p><span class="pl-s"><span class="pl-pds">- or setting the QGIS
setting </span></span><span class="pl-s"><span class="pl-pds"><span
class="pl-s"><span class="pl-pds">"</span>qgis/walForSqlite"
to false<br>
</span></span></span></p>
<p>See
<a class="moz-txt-link-freetext" href="https://github.com/qgis/QGIS/blob/master/src/core/providers/ogr/qgsogrproviderutils.cpp#L1005">https://github.com/qgis/QGIS/blob/master/src/core/providers/ogr/qgsogrproviderutils.cpp#L1005</a><br>
</p>
<blockquote type="cite" cite="mid:rmiwnj6rw64.fsf@s1.lexort.com">
<pre class="moz-quote-pre" wrap="">
With this option, there perhaps needs to be some kind of lock outside
of sqlite, which can be multireader and single writer.
2) somehow, the geopackage layer could hide all this and logically open
the layer read/write, but refrain from writing to the filesystem.
Then, when there is an actual write, the db open-for-write can
happen. After the database is written, if no layers [are
editable]or[have unwrittend changes] for some period of time (5m?) the
database should be changed back to read only. This is sort of like 1
but at the gdal layer vs the qgis layer.
Because of this I'm starting to think about moving all my data into
postgis, and not use geopackages any more.
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/qgis-user">https://lists.osgeo.org/mailman/listinfo/qgis-user</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>