When operating close to ENOSPC, we sometimes end up with
incomplete or invalid on-disk entries. So we prune these
during index rebuild.
---
 src/carquinyol/datastore.py |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 6ede341..ee6bbb5 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -175,6 +175,13 @@ class DataStore(dbus.service.Object):
                     self._index_store.store(uid, props)
                 except Exception:
                     logging.exception('Error processing %r', uid)
+                    logging.warn('Will attempt to delete corrupt entry %r', 
uid)
+                    try:
+                        # self.delete(uid) only works on well-formed entries 
:-/
+                        entry_path = 
layoutmanager.get_instance().get_entry_path(uid)
+                        os.removedirs(entry_path)
+                    except Exception:
+                        logging.exception('Error deleting corrupt entry %r', 
uid)
 
         if not uids:
             self._index_store.flush()
-- 
1.7.10.4

_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to