You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by st...@apache.org on 2011/07/25 04:25:57 UTC

svn commit: r1150537 - /incubator/tashi/trunk/src/tashi/clustermanager/data/sql.py

Author: stroucki
Date: Mon Jul 25 04:25:56 2011
New Revision: 1150537

URL: http://svn.apache.org/viewvc?rev=1150537&view=rev
Log:
sql.py: get max id from database, not trusting local value

Modified:
    incubator/tashi/trunk/src/tashi/clustermanager/data/sql.py

Modified: incubator/tashi/trunk/src/tashi/clustermanager/data/sql.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/data/sql.py?rev=1150537&r1=1150536&r2=1150537&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/data/sql.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/data/sql.py Mon Jul 25 04:25:56 2011
@@ -71,8 +71,10 @@ class SQL(DataInterface):
 		
 	def getNewInstanceId(self):
 		self.instanceIdLock.acquire()
-		instanceId = self.maxInstanceId
+		cur = self.executeStatement("SELECT MAX(id) FROM instances")
+		self.maxInstanceId = cur.fetchone()[0]
 		self.maxInstanceId = self.maxInstanceId + 1
+		instanceId = self.maxInstanceId
 		self.instanceIdLock.release()
 		return instanceId