[Sugar-devel] datastore results inconsistency

Tomeu Vizoso tomeu at sugarlabs.org
Sat Jun 27 06:57:41 EDT 2009


On Fri, Jun 26, 2009 at 18:57, Daniel Drake<dsd at laptop.org> wrote:
> Hi Tomeu,
>
> I found the issue with the journal showing a duplicated entry after
> hand-deleting a datastore entry.

Thanks for looking at this. As we discussed on IRC, things are a bit
more complex than I initially thought and we should rebuild all the
index when we find that the disk contents don't match the index.

Would be great if you could try these patches and see if the journal
is more resistant in these cases:

DS: http://shell.sugarlabs.org/~tomeu/rebuild_index_on_inconsistency.patch
Shell: http://shell.sugarlabs.org/~tomeu/remake_cache_on_inconsistency.patch

Thanks,

Tomeu

> It's an issue in the datastore, in the same function: DataStore.find()
>
> After your patch, we now weed out the entries that don't exist on-disk,
> but we still return "count" items (which is not adjusted accordingly)
>
> My suggested fix: decrement count in the loop if the file does not
> exist.
>
> for uid in uids:
>    if os.path.exists(layoutmanager.get_instance().get_entry_path(uid)):
>        metadata = self._metadata_store.retrieve(uid, properties)
>        entries.append(metadata)
> +   else:
> +       count = count - 1
>
> Daniel
>
>
>


More information about the Sugar-devel mailing list