[PEAK] Re: Trellis-fork

Sergey Schetinin maluke at gmail.com
Fri Jul 3 16:57:11 EDT 2009

I guess there's more :)

Remember the `merge_into_data` method from 20 mins ago? There's a way
to do the inverse of that. Instead of building a new data we can
update our snapshot with the data outside! That is we can at some
point in our transaction check if some other transaction has committed
and merge the resulting snapshot into ours!

def merge_from_data(self, data):
    # first, make sure the read values are still valid
    if data is not self.snapshot:
        for key, value in self.reads.iteritems():
            if data[key] != value:
                roll back affected rules
    self.snapshot = data

That resolves any conflicts with the other txn even before we
ourselves get to commit! And these resolutions don't even need to be

So imagine 100 txns running in parallel (on a 100-core machine and no
GIL =), one of them commits and the other ones can get themselves up
to date with that commit without any blocking at all. Isn't that cool?

Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter

More information about the PEAK mailing list