Author: justi9
Date: 2008-11-25 11:32:43 -0500 (Tue, 25 Nov 2008)
New Revision: 2878
Modified:
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/cache.py
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/python/mint/schemaparser.py
mgmt/trunk/mint/python/mint/sql.py
mgmt/trunk/mint/python/mint/update.py
mgmt/trunk/mint/sql/schema.sql
Log:
Make object id unique constraint include the broker, since objectids
from qmf are not themselves unique across brokers.
Make id caching a per broker thing.
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-11-25 15:07:55 UTC (rev 2877)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-11-25 16:32:43 UTC (rev 2878)
@@ -380,7 +380,7 @@
self.lock()
try:
self.managedBrokers[str(broker.getBrokerId())] = (broker, 0)
-
+ broker.idCache = MintCache()
finally:
self.unlock()
Modified: mgmt/trunk/mint/python/mint/cache.py
===================================================================
--- mgmt/trunk/mint/python/mint/cache.py 2008-11-25 15:07:55 UTC (rev 2877)
+++ mgmt/trunk/mint/python/mint/cache.py 2008-11-25 16:32:43 UTC (rev 2878)
@@ -1,12 +1,7 @@
from threading import RLock
class MintCache(object):
- staticInstance = None
-
def __init__(self):
- assert MintCache.staticInstance is None
- MintCache.staticInstance = self
-
self.__cache = dict()
self.__pending = dict()
self.__dirty = False
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2008-11-25 15:07:55 UTC (rev 2877)
+++ mgmt/trunk/mint/python/mint/schema.py 2008-11-25 16:32:43 UTC (rev 2878)
@@ -14,13 +14,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('SlotStats', cascade='null', default=None)
statsPrev = ForeignKey('SlotStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -135,13 +135,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('JobStats', cascade='null', default=None)
statsPrev = ForeignKey('JobStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -247,13 +247,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('SchedulerStats', cascade='null', default=None)
statsPrev = ForeignKey('SchedulerStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -300,13 +300,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('SubmitterStats', cascade='null', default=None)
statsPrev = ForeignKey('SubmitterStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -336,13 +336,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('NegotiatorStats', cascade='null',
default=None)
statsPrev = ForeignKey('NegotiatorStats', cascade='null',
default=None)
classInfos = dict() # brokerId => classInfo
@@ -404,13 +404,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('CollectorStats', cascade='null', default=None)
statsPrev = ForeignKey('CollectorStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -438,13 +438,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('MasterStats', cascade='null', default=None)
statsPrev = ForeignKey('MasterStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -500,13 +500,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('AclStats', cascade='null', default=None)
statsPrev = ForeignKey('AclStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -541,13 +541,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('ClusterStats', cascade='null', default=None)
statsPrev = ForeignKey('ClusterStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -588,13 +588,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('StoreStats', cascade='null', default=None)
statsPrev = ForeignKey('StoreStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -636,13 +636,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('JournalStats', cascade='null', default=None)
statsPrev = ForeignKey('JournalStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -712,13 +712,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('SystemStats', cascade='null', default=None)
statsPrev = ForeignKey('SystemStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -746,13 +746,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('BrokerStats', cascade='null', default=None)
statsPrev = ForeignKey('BrokerStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -828,13 +828,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('AgentStats', cascade='null', default=None)
statsPrev = ForeignKey('AgentStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -862,13 +862,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('VhostStats', cascade='null', default=None)
statsPrev = ForeignKey('VhostStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -893,13 +893,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('QueueStats', cascade='null', default=None)
statsPrev = ForeignKey('QueueStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -963,13 +963,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('ExchangeStats', cascade='null', default=None)
statsPrev = ForeignKey('ExchangeStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -1008,13 +1008,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('BindingStats', cascade='null', default=None)
statsPrev = ForeignKey('BindingStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -1042,13 +1042,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('ClientConnectionStats', cascade='null',
default=None)
statsPrev = ForeignKey('ClientConnectionStats', cascade='null',
default=None)
classInfos = dict() # brokerId => classInfo
@@ -1087,13 +1087,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('LinkStats', cascade='null', default=None)
statsPrev = ForeignKey('LinkStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -1153,13 +1153,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('BridgeStats', cascade='null', default=None)
statsPrev = ForeignKey('BridgeStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -1198,13 +1198,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('SessionStats', cascade='null', default=None)
statsPrev = ForeignKey('SessionStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
@@ -1262,13 +1262,13 @@
lazyUpdate = True
recTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
sourceScopeId = BigIntCol(default=None)
sourceObjectId = BigIntCol(default=None)
- source_ids_unique = DatabaseIndex(sourceScopeId, sourceObjectId, unique=True)
+ source_ids_unique = DatabaseIndex(managedBroker, sourceScopeId, sourceObjectId,
unique=True)
qmfClassKey = StringCol(length=1000, default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
- managedBroker = StringCol(length=1000, default=None)
statsCurr = ForeignKey('SysimageStats', cascade='null', default=None)
statsPrev = ForeignKey('SysimageStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-11-25 15:07:55 UTC (rev 2877)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-11-25 16:32:43 UTC (rev 2878)
@@ -92,7 +92,7 @@
self.pythonOutput += " lazyUpdate = %s\n\n" % (lazyUpdate)
def generateSourceIdsIndex(self, className):
- self.pythonOutput += " source_ids_unique = DatabaseIndex(sourceScopeId,
sourceObjectId, unique=True)\n"
+ self.pythonOutput += " source_ids_unique = DatabaseIndex(managedBroker,
sourceScopeId, sourceObjectId, unique=True)\n"
def generateClassAttribs(self, schemaName, elements):
if (schemaName == "JournalStats"):
@@ -143,13 +143,13 @@
self.generateForeignKeyAttrib(colPythonName[0].lower() + colPythonName[1:],
keyPythonName)
self.generateMultipleJoin(origPythonName, pythonName, "stats")
else:
+ self.generateAttrib("managedBroker", "StringCol",
"length=1000")
self.generateAttrib("sourceScopeId", "BigIntCol")
self.generateAttrib("sourceObjectId", "BigIntCol")
self.generateSourceIdsIndex(pythonName)
self.generateAttrib("qmfClassKey", "StringCol",
"length=1000")
self.generateTimestampAttrib("creation")
self.generateTimestampAttrib("deletion")
- self.generateAttrib("managedBroker", "StringCol",
"length=1000")
self.generateForeignKeyAttrib("statsCurr", statsPythonName)
self.generateForeignKeyAttrib("statsPrev", statsPythonName)
self.finalPythonOutput += "classToSchemaNameMap['%s'] =
'%s'\n" % (pythonName, schemaName)
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2008-11-25 15:07:55 UTC (rev 2877)
+++ mgmt/trunk/mint/python/mint/sql.py 2008-11-25 16:32:43 UTC (rev 2878)
@@ -72,6 +72,7 @@
select id from %s
where source_scope_id = %%(sourceScopeId)s
and source_object_id = %%(sourceObjectId)s
+ and managed_broker = %%(managedBroker)s
""" % table
class SqlSetStatsRefs(SqlOperation):
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-11-25 15:07:55 UTC (rev 2877)
+++ mgmt/trunk/mint/python/mint/update.py 2008-11-25 16:32:43 UTC (rev 2878)
@@ -65,15 +65,24 @@
if profile:
start = clock()
+
conn.commit()
- self.model.cache.commit()
+
+ for broker, id in self.model.managedBrokers.values():
+ broker.idCache.commit()
+
profile.commitTime += clock() - start
else:
conn.commit()
- self.model.cache.commit()
+
+ for broker, id in self.model.managedBrokers.values():
+ broker.idCache.commit()
except:
conn.rollback()
- self.model.cache.rollback()
+
+ for broker, id in self.model.managedBrokers.values():
+ broker.idCache.rollback()
+
log.exception("Update failed")
def stop(self):
@@ -142,7 +151,7 @@
foreignKey = name + "_id"
- id = self.model.cache.get(oid)
+ id = self.broker.idCache.get(oid)
if id is None:
raise ReferenceException(oid)
@@ -203,7 +212,7 @@
# 2. Object is in mint's db, but id is not yet cached
# 3. Object is in mint's db, and id is cached
- id = self.model.cache.get(oid)
+ id = self.broker.idCache.get(oid)
if id is None:
# Case 1 or 2
@@ -238,7 +247,7 @@
assert cursor.rowcount == 1
- self.model.cache.set(oid, id)
+ self.broker.idCache.set(oid, id)
else:
# Case 3
@@ -265,16 +274,12 @@
brokerId = str(self.broker.getBrokerId())
if brokerId in self.model.managedBrokers:
- broker, dbObjId = self.model.managedBrokers[brokerId]
+ broker, dbId = self.model.managedBrokers[brokerId]
- #print "broker, dbObjId", broker, dbObjId
-
- if dbObjId == 0:
+ if dbId == 0:
op = SqlGetBrokerRegistration()
op.execute(cursor, {"url": self.broker.getFullUrl()})
- #print op.text % {"url": self.broker.getFullUrl()}
-
rec = cursor.fetchone()
if rec:
@@ -283,12 +288,8 @@
op = SqlAttachBroker()
op.execute(cursor, {"id": id, "registrationId": rid})
- #print op.text % {"id": id, "registrationId": rid}
-
self.model.managedBrokers[brokerId] = (broker, id)
-
-
class StatisticUpdate(ModelUpdate):
def process(self, conn):
try:
@@ -300,7 +301,7 @@
statsCls = getattr(mint, "%sStats" % cls.__name__)
oid = self.object.getObjectId()
- id = self.model.cache.get(oid)
+ id = self.broker.idCache.get(oid)
if id is None:
# Just drop it; we'll get more stats later
Modified: mgmt/trunk/mint/sql/schema.sql
===================================================================
--- mgmt/trunk/mint/sql/schema.sql 2008-11-25 15:07:55 UTC (rev 2877)
+++ mgmt/trunk/mint/sql/schema.sql 2008-11-25 16:32:43 UTC (rev 2878)
@@ -65,12 +65,12 @@
CREATE TABLE acl (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
broker_id INT,
@@ -79,7 +79,7 @@
transfer_acl BOOL,
last_acl_load TIMESTAMP
);
-CREATE UNIQUE INDEX acl_source_ids_unique ON acl (source_scope_id, source_object_id);
+CREATE UNIQUE INDEX acl_source_ids_unique ON acl (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE acl_stats (
id SERIAL PRIMARY KEY,
@@ -91,12 +91,12 @@
CREATE TABLE agent (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
client_connection_id INT,
@@ -106,7 +106,7 @@
broker_bank BIGINT,
agent_bank BIGINT
);
-CREATE UNIQUE INDEX agent_source_ids_unique ON agent (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX agent_source_ids_unique ON agent (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE agent_stats (
id SERIAL PRIMARY KEY,
@@ -117,12 +117,12 @@
CREATE TABLE binding (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
exchange_id INT,
@@ -131,7 +131,7 @@
arguments BYTEA,
origin VARCHAR(1000)
);
-CREATE UNIQUE INDEX binding_source_ids_unique ON binding (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX binding_source_ids_unique ON binding (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE binding_stats (
id SERIAL PRIMARY KEY,
@@ -143,12 +143,12 @@
CREATE TABLE bridge (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
link_id INT,
@@ -163,7 +163,7 @@
excludes VARCHAR(1000),
dynamic BOOL
);
-CREATE UNIQUE INDEX bridge_source_ids_unique ON bridge (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX bridge_source_ids_unique ON bridge (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE bridge_stats (
id SERIAL PRIMARY KEY,
@@ -174,12 +174,12 @@
CREATE TABLE broker (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
system_id INT,
@@ -193,7 +193,7 @@
data_dir VARCHAR(1000),
registration_id INT
);
-CREATE UNIQUE INDEX broker_source_ids_unique ON broker (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX broker_source_ids_unique ON broker (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE broker_stats (
id SERIAL PRIMARY KEY,
@@ -204,12 +204,12 @@
CREATE TABLE client_connection (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
@@ -219,7 +219,7 @@
federation_link BOOL,
auth_identity VARCHAR(1000)
);
-CREATE UNIQUE INDEX client_connection_source_ids_unique ON client_connection
(source_scope_id, source_object_id);
+CREATE UNIQUE INDEX client_connection_source_ids_unique ON client_connection
(managed_broker, source_scope_id, source_object_id);
CREATE TABLE client_connection_stats (
id SERIAL PRIMARY KEY,
@@ -235,12 +235,12 @@
CREATE TABLE cluster (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
broker_id INT,
@@ -251,7 +251,7 @@
status VARCHAR(1000),
members VARCHAR(4000)
);
-CREATE UNIQUE INDEX cluster_source_ids_unique ON cluster (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX cluster_source_ids_unique ON cluster (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE cluster_stats (
id SERIAL PRIMARY KEY,
@@ -262,12 +262,12 @@
CREATE TABLE collector (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
pool VARCHAR(1000),
@@ -277,7 +277,7 @@
name VARCHAR(1000),
public_network_ip_addr VARCHAR(1000)
);
-CREATE UNIQUE INDEX collector_source_ids_unique ON collector (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX collector_source_ids_unique ON collector (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE collector_stats (
id SERIAL PRIMARY KEY,
@@ -288,12 +288,12 @@
CREATE TABLE exchange (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
@@ -302,7 +302,7 @@
durable BOOL,
arguments BYTEA
);
-CREATE UNIQUE INDEX exchange_source_ids_unique ON exchange (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX exchange_source_ids_unique ON exchange (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE exchange_stats (
id SERIAL PRIMARY KEY,
@@ -325,12 +325,12 @@
CREATE TABLE job (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
scheduler_id INT,
@@ -362,7 +362,7 @@
dag_man_job_id BIGINT,
ad BYTEA
);
-CREATE UNIQUE INDEX job_source_ids_unique ON job (source_scope_id, source_object_id);
+CREATE UNIQUE INDEX job_source_ids_unique ON job (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE job_stats (
id SERIAL PRIMARY KEY,
@@ -373,12 +373,12 @@
CREATE TABLE journal (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
queue_id INT,
@@ -393,7 +393,7 @@
data_file_size BIGINT,
current_file_count BIGINT
);
-CREATE UNIQUE INDEX journal_source_ids_unique ON journal (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX journal_source_ids_unique ON journal (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE journal_stats (
id SERIAL PRIMARY KEY,
@@ -432,12 +432,12 @@
CREATE TABLE link (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
@@ -446,7 +446,7 @@
transport VARCHAR(1000),
durable BOOL
);
-CREATE UNIQUE INDEX link_source_ids_unique ON link (source_scope_id, source_object_id);
+CREATE UNIQUE INDEX link_source_ids_unique ON link (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE link_stats (
id SERIAL PRIMARY KEY,
@@ -459,12 +459,12 @@
CREATE TABLE master (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
pool VARCHAR(1000),
@@ -478,7 +478,7 @@
condor_version VARCHAR(1000),
daemon_start_time TIMESTAMP
);
-CREATE UNIQUE INDEX master_source_ids_unique ON master (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX master_source_ids_unique ON master (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE master_stats (
id SERIAL PRIMARY KEY,
@@ -495,12 +495,12 @@
CREATE TABLE negotiator (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
pool VARCHAR(1000),
@@ -512,7 +512,7 @@
condor_version VARCHAR(1000),
daemon_start_time TIMESTAMP
);
-CREATE UNIQUE INDEX negotiator_source_ids_unique ON negotiator (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX negotiator_source_ids_unique ON negotiator (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE negotiator_stats (
id SERIAL PRIMARY KEY,
@@ -534,12 +534,12 @@
CREATE TABLE queue (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
@@ -549,7 +549,7 @@
exclusive BOOL,
arguments BYTEA
);
-CREATE UNIQUE INDEX queue_source_ids_unique ON queue (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX queue_source_ids_unique ON queue (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE queue_stats (
id SERIAL PRIMARY KEY,
@@ -587,12 +587,12 @@
CREATE TABLE scheduler (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
pool VARCHAR(1000),
@@ -607,7 +607,7 @@
condor_version VARCHAR(1000),
daemon_start_time TIMESTAMP
);
-CREATE UNIQUE INDEX scheduler_source_ids_unique ON scheduler (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX scheduler_source_ids_unique ON scheduler (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE scheduler_stats (
id SERIAL PRIMARY KEY,
@@ -630,12 +630,12 @@
CREATE TABLE session (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
@@ -646,7 +646,7 @@
attached BOOL,
expire_time TIMESTAMP
);
-CREATE UNIQUE INDEX session_source_ids_unique ON session (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX session_source_ids_unique ON session (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE session_stats (
id SERIAL PRIMARY KEY,
@@ -662,12 +662,12 @@
CREATE TABLE slot (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
pool VARCHAR(1000),
@@ -724,7 +724,7 @@
condor_version VARCHAR(1000),
daemon_start_time TIMESTAMP
);
-CREATE UNIQUE INDEX slot_source_ids_unique ON slot (source_scope_id, source_object_id);
+CREATE UNIQUE INDEX slot_source_ids_unique ON slot (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE slot_stats (
id SERIAL PRIMARY KEY,
@@ -773,12 +773,12 @@
CREATE TABLE store (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
broker_id INT,
@@ -793,7 +793,7 @@
tpl_data_file_size BIGINT,
tpl_current_file_count BIGINT
);
-CREATE UNIQUE INDEX store_source_ids_unique ON store (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX store_source_ids_unique ON store (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE store_stats (
id SERIAL PRIMARY KEY,
@@ -813,12 +813,12 @@
CREATE TABLE submitter (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
scheduler_id INT,
@@ -827,7 +827,7 @@
name VARCHAR(1000),
schedd_name VARCHAR(1000)
);
-CREATE UNIQUE INDEX submitter_source_ids_unique ON submitter (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX submitter_source_ids_unique ON submitter (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE submitter_stats (
id SERIAL PRIMARY KEY,
@@ -841,12 +841,12 @@
CREATE TABLE sysimage (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
uuid BYTEA,
@@ -858,7 +858,7 @@
mem_total BIGINT,
swap_total BIGINT
);
-CREATE UNIQUE INDEX sysimage_source_ids_unique ON sysimage (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX sysimage_source_ids_unique ON sysimage (managed_broker,
source_scope_id, source_object_id);
CREATE TABLE sysimage_stats (
id SERIAL PRIMARY KEY,
@@ -876,12 +876,12 @@
CREATE TABLE system (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
system_id BYTEA,
@@ -891,7 +891,7 @@
version VARCHAR(1000),
machine VARCHAR(1000)
);
-CREATE UNIQUE INDEX system_source_ids_unique ON system (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX system_source_ids_unique ON system (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE system_stats (
id SERIAL PRIMARY KEY,
@@ -902,19 +902,19 @@
CREATE TABLE vhost (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
source_scope_id BIGINT,
source_object_id BIGINT,
qmf_class_key VARCHAR(1000),
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
- managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
broker_id INT,
name VARCHAR(1000),
federation_tag VARCHAR(1000)
);
-CREATE UNIQUE INDEX vhost_source_ids_unique ON vhost (source_scope_id,
source_object_id);
+CREATE UNIQUE INDEX vhost_source_ids_unique ON vhost (managed_broker, source_scope_id,
source_object_id);
CREATE TABLE vhost_stats (
id SERIAL PRIMARY KEY,