Object info checkpoint method in c extensions behaves differently than Python code

Bug #529555 reported by Marc Tardif
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Storm
Incomplete
Undecided
Unassigned

Bug Description

When using the Object info c extensions, the checkpoint method seems to behave differently whether the c extensions are being used than the pure Python code. This can be observed by deriving the Property class, then updating properties of the corresponding object on __get__ and finally calling checkpoint(). Afterwards, it seems that the properties are not really checkpointed so that the next flush operation actually updates all the properties modified prior to the checkpoint. Here is an example that demonstrates the problem:

class Cache(Property):

    def __get__(self, obj, cls=None):
        if obj is not None:
            obj.do_update()

        return Property.__get__(self, obj, cls)

class CacheType(object):

    ...

    def do_copy(self, other):
        obj_info = get_obj_info(self)
        cls = obj_info.cls_info.cls
        for attr, _descr in self._cache_items():
            if not _descr._other_name:
                _descr._detect_other_name(cls)
            value = getattr(other, _descr._other_name)
            # Avoid calling Cache.__set__
            Property.__set__(_descr, self, value)

        # Checkpoint the state of the remote object
        obj_info.checkpoint()

    def do_update(self):
        # Update object if remote is accessible
        if self.other is not None:
            self.cache_copy(self.other)

        self.timestamp = datetime.utcnow().replace(microsecond=0)

Revision history for this message
James Henstridge (jamesh) wrote :

Could you provide a self contained example? I don't have a good idea of what you're trying to do here, or why you're calling checkpoint().

The purpose of checkpoint() is to indicate that the value stored in the Variable instance matches that of the database. It isn't clear from the code snippet you've posted that this is the case

Looking at the code for the checkpoint methods, the cextensions versions look correct.

Changed in storm:
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.