Comment 8 for bug 462245

Revision history for this message
Manuel de la Peña (mandel) wrote : Re: [Bug 462245] Re: Conflict error updating records

Hello,

The reason for this bug to occur is actually quite simple and I believe
is Desktopcouch fault and has no relation what so ever with CouchDb. Let
me explain my statement:

The delete method in the Desktopcouch library is the following:

def delete_record(self, record_id):
        """Delete record with given id"""
        record = self.with_reconnects(self.db.__getitem__, record_id)
        record.setdefault('application_annotations', {}).setdefault(
            'Ubuntu One',
{}).setdefault('private_application_annotations', {})[
            'deleted'] = True
        self.with_reconnects(self.db.__setitem__, record_id, record)

as you can see in the method the document is actually not deleted from
the database but marked as deleted instead. When you executed the given
test code you are trying to update your document with the same id and an
old rev. This is actually a feature used in the server side. I believe
this behavior is easy to solve in two different ways:

1. Ensure that you do not reuse your ids.
2. Add extra logic to the desktopcouch lib to solve the issue.

The bug has been triaged, but if it gets reopened I'm more than happy to
become the owner and provide a solution :D

Kr,

Manuel

"""Delete record with given id"""
357
        153.1.1
record = self.with_reconnects(self.db.__getitem__, record_id)
358
           2
record.setdefault('application_annotations', {}).setdefault(
359

'Ubuntu One', {}).setdefault('private_application_annotations', {})[
360

'deleted'] = True
361
        153.1.1
self.with_reconnects(self.db.__setitem__, record_id, record)

On Wed, 2010-06-30 at 19:05 +0000, Omer Akram wrote:
> gwibber is also infected by this bug. so is it something the app should
> deal with or it can be fixed in desktopcouch?
>