diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-22 17:30:59 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-07-22 17:30:59 (GMT) |
commit | ab19f19116433362051e988a9e5709018f5c4ad0 (patch) | |
tree | 6037b7a121768e08446e0fbb6e5496408b75b820 | |
parent | f0bffbf7a8357b6c38ebe09d1b81d7faadca588c (diff) |
fix #2381
the new implementation of xapianindex violated the contract with backingstore here based on what the old index layer did. There is a test now covering this case and the issue is fixed
-rwxr-xr-x | bin/datastore-service | 2 | ||||
-rw-r--r-- | src/olpc/datastore/backingstore.py | 2 | ||||
-rw-r--r-- | src/olpc/datastore/datastore.py | 15 | ||||
-rw-r--r-- | tests/mountpoints.txt | 6 |
4 files changed, 20 insertions, 5 deletions
diff --git a/bin/datastore-service b/bin/datastore-service index 2019793..c84e314 100755 --- a/bin/datastore-service +++ b/bin/datastore-service @@ -74,7 +74,7 @@ def main(): try: while True: context.iteration(False) - time.sleep(0.025) + time.sleep(0.0025) except KeyboardInterrupt: ds.stop() diff --git a/src/olpc/datastore/backingstore.py b/src/olpc/datastore/backingstore.py index f317983..13ec2ee 100644 --- a/src/olpc/datastore/backingstore.py +++ b/src/olpc/datastore/backingstore.py @@ -488,7 +488,7 @@ class InplaceFileBackingStore(FileBackingStore): def get(self, uid, env=None, allowMissing=False): content = self.indexmanager.get(uid) if not content: raise KeyError(uid) - return content.get_property('filename') + return content def update(self, uid, props, filelike=None): # the file would have already been changed inplace diff --git a/src/olpc/datastore/datastore.py b/src/olpc/datastore/datastore.py index d026fce..111548c 100644 --- a/src/olpc/datastore/datastore.py +++ b/src/olpc/datastore/datastore.py @@ -335,11 +335,20 @@ class DataStore(dbus.service.Object): def get(self, uid): mp = self._resolveMountpoint() - c = mp.get(uid) + c = None + try: + c = mp.get(uid) + if c: return c + except KeyError: + pass + if not c: for mp in self.mountpoints.itervalues(): - c = mp.get(uid) - if c: break + try: + c = mp.get(uid) + if c: break + except KeyError: + continue return c #@utils.sanitize_dbus diff --git a/tests/mountpoints.txt b/tests/mountpoints.txt index b89d5cb..2146c71 100644 --- a/tests/mountpoints.txt +++ b/tests/mountpoints.txt @@ -133,5 +133,11 @@ Check for the new value in the descriptor >>> assert mp.descriptor()['title'] == 'Fake USB again' +Verify that we can get the properties of objects on the inplace +stores. + +>>> uid = result[0]['uid'] +>>> assert ds.get_properties(uid)['title'] == "doc4" + >>> ds.stop(); del ds |