Skip to content
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

OGR: Repack in running session #17515

Closed
qgib opened this issue Oct 11, 2013 · 3 comments
Closed

OGR: Repack in running session #17515

qgib opened this issue Oct 11, 2013 · 3 comments
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

Comments

@qgib
Copy link
Contributor

qgib commented Oct 11, 2013

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


@qgib
Copy link
Contributor Author

qgib commented Dec 6, 2013

Author Name: Matthias Kuhn (@m-kuhn)


I suspect the following report is connected to this bug:

http://gis.stackexchange.com/questions/58101/how-to-avoid-creating-corrupt-shapefiles-during-editing

Looking at the OGR sourcecode, .shx files are rewritten as well, so the index should be ok I think.

If there is no objection, I am going to implement this.

@qgib
Copy link
Contributor Author

qgib commented Dec 6, 2013

Author Name: Matthias Kuhn (@m-kuhn)


Fixed in changeset "ba76c99037d84fb0fbc7d3eea7a3a6bcc5f69148".


  • status_id was changed from Open to Closed

@qgib
Copy link
Contributor Author

qgib commented Oct 17, 2014

Author Name: Giovanni Manghi (@gioman)


Hi Matthias,

would you mind have a look at

#19349

I don't know if the issue described there is related to ogr repack, but anyway seems pretty severe (even if not strictly a regression) as is causes a major interoperability issue.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant