[Sugar-devel] [PATCH 2/2] Remove invalid/corrupt on-disk entries #2317
Martin Langhoff
martin at laptop.org
Thu Sep 20 12:07:43 EDT 2012
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
More information about the Sugar-devel
mailing list