Oh yeah, of course. Indeed, good work Siegfried.
While reading the last few comments one possible fix came into my mind:
Let's maintain a (temporary) helper table called '_fix_cache' with (table_name 
VARCHAR, id INTEGER) and create a 'BEFORE DELETE' trigger on each cached table 
(interpretation, manifestation, mimetype, ...) which inserts the table name and 
the deleted id in _fix_cache once a row in the related table got deleted. All 
we now have to do is run a 'SELECT * FROM _fix_cache' after deleting the 
events. If some rows in manifestation/interpretation/... got deleted while 
deleting events we get back the the ids of the cached values which we then can 
delete from the caches.
I know that's not optimal, but looks like the only solution to me. This should 
not be a *big* performance issue, since the number of rows in the helper table 
should be very low. I'll hack on a prototype tomorrow, and see how it works.

-- 
You received this bug notification because you are a member of Zeitgeist
Framework Team, which is subscribed to Zeitgeist Framework.
https://bugs.launchpad.net/bugs/598666

Title:
  Invalid cache access (was: Error when trying to fetch items)

Status in Zeitgeist Framework:
  Triaged

Bug description:
  When i try to fetch all items in one query i get

  
  Error from Zeitgeist engine: org.freedesktop.DBus.Python.KeyError: Traceback 
(most recent call last):
    File "/usr/lib/pymodules/python2.6/dbus/service.py", line 702, in 
_message_cb
      retval = candidate_method(self, *args, **keywords)
    File "/usr/local/share/zeitgeist/_zeitgeist/engine/remote.py", line 254, in 
FindEvents
      event_templates, storage_state, num_events, result_type, sender))
    File "/usr/local/share/zeitgeist/_zeitgeist/engine/main.py", line 378, in 
find_events
      return self._find_events(1, *args)
    File "/usr/local/share/zeitgeist/_zeitgeist/engine/main.py", line 366, in 
_find_events
      return self.get_events(rows=result, sender=sender)
    File "/usr/local/share/zeitgeist/_zeitgeist/engine/main.py", line 188, in 
get_events
      events[event.id].append_subject(self._get_subject_from_row(row))
    File "/usr/local/share/zeitgeist/_zeitgeist/engine/main.py", line 160, in 
_get_subject_from_row
      getattr(self, "_" + field).value(row["subj_" + field]))
    File "/usr/local/share/zeitgeist/_zeitgeist/engine/sql.py", line 422, in 
value
      return self._inv_dict[id]
  KeyError: 138

  This looks serious

_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to