-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete duplicate geometries: Incorrect result when the output is generated in the same geopackage containing the source layer. #60023
Comments
I confirm |
I can also confirm the issue running QGIS LTR 3.34.14 and QGIS 3.40.2 (both with GDAL/OGR 3.9.2) and QGIS 3.41.0-Master (with GDAL/OGR 3.11.0-dev) on Windows 10 from OSGeo4W. Neither the processing log nor the Log Messages panel report any error, thus the users cannot be aware that the issue occurred and they are misled to think the output layer has been correctly created with all the non duplicated feature, which is not the case. The issue also occurs using a layer containing randomly generated duplicated points (1M features): it look likes it occurs if the layer contains a large number of features, while it doesn't for a limited number of features. The issue didn't occur running QGIS 3.22.0 (with GDAL/OGR 3.4.0) and previous versions. The issue doesn't occur if the The issue also doesn't occur the subsequent times the processing algorithm is executed shortly afterwards the first incorrect run (only if the input layer is opened in QGIS): on the first run the .gpkg-shm and .gpkg-wal files are created only when the algorithm execution reaches the 99%, while the second and subsequent runs the .gpkg-shm and .gpkg-wal files are created right at the start of the algorithm's execution. @rouault, I guess the PRs #47098 (implemented since QGIS 3.22.6 and 3.24.0) and OSGeo/gdal#5207 (implemented since GDAL/OGR 3.4.2 and 3.5.0) may have triggered such issue. |
It would be interesting to get a trace of the sqlite calls to figure out if this is a sqlite bug or a qgis/gdal bug. sqlite should be safe to use without WAL. Are there perhaps operations on the same file in two threads, if that's not allowed? |
@gdt, how to get a useful trace of the sqlite calls? Anyway, the issue occurs on Windows 10 also running the algorithm using the It's interesting to note that it looks like the issue doesn't occur when running other algorithms even with the same layer, e.g. running the "Delete duplicates by attribute". |
I don't really know; perhaps there is debug code already or perhaps it needs to be written. I would naively expect that the dedup code might be beginning a transaction on the source layer, reading all the features, and ending that read transaction. And also beginning a transaction on the destination layer, inserting results, and ending that transaction. But maybe it isn't using transactions, and maybe it's more complicated. This is the sort of thing I was suggesting to try to understand. sqlite3 does document that the default mode is "serialized", which should be ok if there are two threads accessing the same geopackage: https://www.sqlite.org/threadsafe.html Of course, it would be good to check if qgis/gdal/sqlite3 is really operating in this mode. I would be highly surprised if not, but still checking things you can check is good strategy. |
What is the bug or the crash?
Hi everyone,
I have a geopackage layer where all the geometries are duplicated (344,918 geometries).
The "Delete duplicate geometries" algorithm behaves strangely depending on the output:
Steps to reproduce the issue
Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Plugins Python attivi
Cxf_in
9.2
FreehandRasterGeoreferencer
0.8.3
GroupStats
2.2.7
LAStools
2.1.1
latlontools
3.6.20
lizmap
3.14.3
multi_filter
1.0
profile-manager
0.31
project_report
1.2
qfieldsync
v4.9.1
QPackage
1.5
QuickOSM
2.2.3
raster_tracer
0.3.3
redLayer
2.2
SelectByRelationship
0.3.3
ViewshedAnalysis
1.9
db_manager
0.1.20
processing
2.12.99
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: