Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-12-14 10:19:13 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-12-14 10:19:13 (GMT)
commit652bf5efb9ecfbeb0e7641d92f451fc25330c2be (patch)
tree0c8be913251a0396920c1aa4748b567774b99742
parentb48a26fa1a50837ddb331a479d4e3dd41dda30ae (diff)
parent8d9ca2fd52878bd95475c385fe74925733c68af9 (diff)
Merge branch 'master' of git+ssh://dev.laptop.org/git/projects/datastore
-rw-r--r--secore/indexerconnection.py2
-rw-r--r--src/olpc/datastore/backingstore.py14
-rw-r--r--src/olpc/datastore/xapianindex.py7
3 files changed, 17 insertions, 6 deletions
diff --git a/secore/indexerconnection.py b/secore/indexerconnection.py
index be82319..84ea9a1 100644
--- a/secore/indexerconnection.py
+++ b/secore/indexerconnection.py
@@ -82,6 +82,8 @@ class IndexerConnection(object):
return
fd = open(config_file)
config_str = fd.read()
+ if not config_str:
+ return
fd.close()
(self._field_actions, mappings, self._next_docid) = _cPickle.loads(config_str)
diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py
index 12dc582..c8e90aa 100644
--- a/src/olpc/datastore/backingstore.py
+++ b/src/olpc/datastore/backingstore.py
@@ -22,6 +22,8 @@ import threading
import errno
import shutil
import urllib
+import traceback
+import sys
import dbus
import xapian
@@ -267,11 +269,13 @@ class FileBackingStore(BackingStore):
if 'uri' not in desc: desc['uri'] = self.uri
if 'title' not in desc: desc['title'] = self.uri
-
- fp = open(fn, 'w')
- pickle.dump(desc, fp)
- fp.close()
-
+ try:
+ fp = open(fn, 'w')
+ pickle.dump(desc, fp)
+ fp.close()
+ except Exception:
+ logging.error('Unable to write descriptor:\n' + \
+ ''.join(traceback.format_exception(*sys.exc_info())))
@staticmethod
def parse(uri):
diff --git a/src/olpc/datastore/xapianindex.py b/src/olpc/datastore/xapianindex.py
index d071eba..a859aa9 100644
--- a/src/olpc/datastore/xapianindex.py
+++ b/src/olpc/datastore/xapianindex.py
@@ -22,6 +22,7 @@ import time
import thread
import threading
import warnings
+import traceback
import secore
import xapian as _xapian # we need to modify the QueryParser
@@ -165,7 +166,11 @@ class IndexManager(object):
self.deltact += 1
if force or self.deltact > FLUSH_THRESHOLD:
with self._write_lock:
- self.write_index.flush()
+ try:
+ self.write_index.flush()
+ except Exception:
+ logging.error('Index flush failed:\n' + \
+ ''.join(traceback.format_exception(*sys.exc_info())))
#self.read_index.reopen()
self.deltact = 0
else: