OGR: Repack in running session #17515
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Data Provider
Related to specific vector, raster or mesh data providers
High Priority
Milestone
Author Name: Matthias Kuhn (@m-kuhn)
Original Redmine Issue: 8822
Affected QGIS version: 2.0.1
Redmine category:data_provider/ogr
OGR does not delete features in shapefiles immediately. Instead, it marks and skips features when they are being deleted, until the REPACK command is issued which then really deletes them. This command also assigns new feature ids to the features.
Currently REPACK is called, whenever a spatial index is created on a shapefile. When a feature is being deleted, createSpatialIndex() is called in order to issue REPACK.
This can happen at any time the layer is opened and can lead to undesiered effects. E.g. open an attribute table of a layer, delete features with low feature ids and save the edits. The attribute table will show ERROR instead of the attribute values, because the feature ids have silently changed.
I would propose to ONLY call REPACK, when closing a layer. Attention has to be paid if indexes need to be rebuilt or if OGR does this automatically.
Related issue(s): #16483 (relates), #17110 (relates), #19349 (relates), #19592 (relates), #19680 (relates), #20195 (relates)
Redmine related issue(s): 7540, 8317, 11007, 11296, 11398, 11989
The text was updated successfully, but these errors were encountered: