Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Langhoff <martin@laptop.org>2012-09-20 15:48:42 (GMT)
committer Simon Schampijer <simon@laptop.org>2012-11-07 07:21:03 (GMT)
commit2a9dd052845774c3b78f61241717fc0c915a3d5e (patch)
tree7021ec959f4eccb0b18ea60fbac9318b2adf9f88
parent30c1c27090eba148cf1212ac8af18274778656c4 (diff)
Remove invalid/corrupt on-disk entries, SL #2317
When operating close to ENOSPC, we sometimes end up with incomplete or invalid on-disk entries. So we prune these during index rebuild. Signed-off-by: Martin Langhoff <martin@laptop.org> Tested-by: Samuel Greenfeld <greenfeld@laptop.org> Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r--src/carquinyol/datastore.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 1f098b4..33c658d 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -22,6 +22,7 @@ import logging
import uuid
import time
import os
+import shutil
import dbus
import dbus.service
@@ -181,6 +182,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)
+ shutil.rmtree(entry_path)
+ except Exception:
+ logging.exception('Error deleting corrupt entry %r', uid)
if not uids:
self._index_store.flush()