From: Steve Baker Date: Thu, 20 Jun 2013 22:18:37 +0000 (+1200) Subject: Do not refresh timestamp from database on read. X-Git-Tag: 2014.1~451 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=90203b89d582b1e8ff673ba1a555683307678fb9;p=openstack-build%2Fheat-build.git Do not refresh timestamp from database on read. Doing a database refresh on timestamp read is causing errors such as: heat.openstack.common.rpc.amqp InvalidRequestError: Could not refresh instance '' This has only been seen using postgres, possibly because the problem is being masked on mysql due to the driver's lack of concurrency. The database refresh seems to be unnecessary, as there appears to be no logic which depends on timestamps being accurate (nor is there any timestamp comparison logic at all) Fixes bug: #1193132 Change-Id: I22c3c4546a0f44b76a95e473b68b6fbb2e423b90 --- diff --git a/heat/engine/timestamp.py b/heat/engine/timestamp.py index c318cbef..5ec39fb2 100644 --- a/heat/engine/timestamp.py +++ b/heat/engine/timestamp.py @@ -18,7 +18,7 @@ from heat.common import exception class Timestamp(object): ''' - A descriptor for fetching an up-to-date timestamp from the database. + A descriptor for writing a timestamp to the database. ''' def __init__(self, db_fetch, attribute): @@ -32,13 +32,12 @@ class Timestamp(object): def __get__(self, obj, obj_class): ''' - Get the latest data from the database for the given object and class. + Get timestamp for the given object and class. ''' if obj is None or obj.id is None: return None o = self.db_fetch(obj.context, obj.id) - o.refresh(attrs=[self.attribute]) return getattr(o, self.attribute) def __set__(self, obj, timestamp):