rhmessaging commits: r1357 - in mgmt/mint: python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-26 11:30:24 -0500 (Mon, 26 Nov 2007)
New Revision: 1357
Added:
mgmt/mint/python/mint/schemaparser.py
Removed:
mgmt/mint/schemaparser.py
Log:
moving schemaparser.py to python/mint
Copied: mgmt/mint/python/mint/schemaparser.py (from rev 1355, mgmt/mint/schemaparser.py)
===================================================================
--- mgmt/mint/python/mint/schemaparser.py (rev 0)
+++ mgmt/mint/python/mint/schemaparser.py 2007-11-26 16:30:24 UTC (rev 1357)
@@ -0,0 +1,151 @@
+import mllib
+from sqlobject import *
+
+class SchemaParser:
+ """parses broker XML schema"""
+
+ def __init__(self):
+ self.options = dict()
+ self.parseConfigFile()
+ self.style = MixedCaseUnderscoreStyle()
+ self.pythonOutput = "from sqlobject import *\n"
+ self.pythonOutput += "from datetime import datetime\n"
+ self.additionalPythonOutput = ""
+ self.currentClass = ""
+ self.finalPythonOutput = "\nclassToSchemaNameMap = dict()\n"
+ self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
+ self.pythonOutput += "conn = connectionForURI(\"%s\")\n" % (self.options["dsn"])
+ self.pythonOutput += "sqlhub.processConnection = conn\n\n"
+ # mapping between xml schema types and database column types
+ # see xml/MintTypes.xml
+ self.dataTypesMap = dict()
+ self.dataTypesMap["objId"] = "ForeignKey"
+ self.dataTypesMap["uint8"] = self.dataTypesMap["hilo8"] = self.dataTypesMap["count8"] = "SmallIntCol"
+ self.dataTypesMap["uint16"] = self.dataTypesMap["hilo16"] = self.dataTypesMap["count16"] = "SmallIntCol"
+ self.dataTypesMap["uint32"] = self.dataTypesMap["hilo32"] = self.dataTypesMap["count32"] = "IntCol"
+ self.dataTypesMap["uint64"] = self.dataTypesMap["hilo64"] = self.dataTypesMap["count64"] = "BigIntCol"
+ self.dataTypesMap["bool"] = "BoolCol"
+ self.dataTypesMap["sstr"] = self.dataTypesMap["lstr"] = "StringCol"
+
+ def attrNameFromDbColumn(self, name, removeSuffix=""):
+ return self.style.dbColumnToPythonAttr(name.replace(removeSuffix, ""))
+
+ def generateAttrib(self, attribName, attribType, params=""):
+ if (params.find("default") < 0):
+ if (params == ""):
+ params = "default=None"
+ else:
+ params += ", default=None"
+ self.pythonOutput += " %s = %s(%s)\n" % (attribName, attribType, params)
+
+ def generateTimestampAttrib(self, col):
+ self.generateAttrib(col + "Time", "TimestampCol") #, "default=datetime.min")
+
+ def generateForeignKeyAttrib(self, name, reference):
+ params = "'%s', cascade='null'" % (reference)
+ self.generateAttrib(name, "ForeignKey", params)
+
+ def generateHiLoAttrib(self, name, type):
+ self.generateAttrib(name, type)
+ self.generateAttrib(name + "Low", type)
+ self.generateAttrib(name + "High", type)
+
+ def generateMultipleJoin(self, tableFrom, tableTo):
+ attrib = tableTo.lower() + "s"
+ self.additionalPythonOutput += "\n%s.sqlmeta.addJoin(MultipleJoin('%s', joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
+
+ def generateClassAttribs(self, schemaName, elements):
+ for elem in elements:
+ if (elem["@name"].endswith("Ref")):
+ reference = self.style.dbTableToPythonClass(elem["@name"]).replace("Ref", "")
+ attrib = reference[0].lower() + reference[1:]
+ self.generateForeignKeyAttrib(attrib, reference)
+ self.generateMultipleJoin(reference, self.currentClass)
+ elif (elem["@type"].startswith("hilo")):
+ self.generateHiLoAttrib(self.attrNameFromDbColumn(elem["@name"]), self.dataTypesMap[elem["@type"]])
+ else:
+ args = ""
+ if (elem["@type"] == "sstr"):
+ args += "length=1000"
+ elif (elem["@type"] == "lstr"):
+ args += "length=4000"
+ self.generateAttrib(self.attrNameFromDbColumn(elem["@name"]), self.dataTypesMap[elem["@type"]], args)
+
+ def startClass(self, schemaName, stats=False):
+ if (stats):
+ pythonName = self.style.dbTableToPythonClass(schemaName + "_stats")
+ colPythonName = self.style.dbColumnToPythonAttr(schemaName)
+ keyPythonName = self.style.dbTableToPythonClass(schemaName)
+ else:
+ pythonName = self.style.dbTableToPythonClass(schemaName)
+ statsPythonName = self.style.dbTableToPythonClass(schemaName + "_stats")
+ self.currentClass = pythonName
+ self.pythonOutput += "\nclass %s(SQLObject):\n" % (pythonName)
+ self.generateAttrib("idOriginal", "BigIntCol")
+ self.generateTimestampAttrib("rec")
+ if (stats):
+ self.generateForeignKeyAttrib(colPythonName, keyPythonName)
+ else:
+ self.generateTimestampAttrib("creation")
+ self.generateTimestampAttrib("deletion")
+ self.generateAttrib("managedBroker", "StringCol", "length=1000")
+ self.generateForeignKeyAttrib("stats", statsPythonName)
+ self.generateForeignKeyAttrib("statsPrev", statsPythonName)
+ self.finalPythonOutput += "classToSchemaNameMap['%s'] = '%s'\n" % (pythonName, schemaName)
+ self.finalPythonOutput += "schemaNameToClassMap['%s'] = %s\n" % (schemaName, pythonName)
+
+ def generateMethod(self, elem):
+ if (elem["@desc"] != None):
+ comment = ' """' + elem["@desc"] + '"""\n'
+ else:
+ comment = ""
+ formalArgs = ", "
+ actualArgs = " actualArgs = dict()\n"
+ for arg in elem.query["arg"]:
+ formalArgs += "%s, " % (arg["@name"])
+ actualArgs += " actualArgs[\"%s\"] = %s\n" % (arg["@name"], arg["@name"])
+ if (formalArgs != ", "):
+ formalArgs = formalArgs[:-2]
+ else:
+ formalArgs = ""
+ self.pythonOutput += "\n def %s(self, model, managedBrokerLabel, callbackMethod%s):\n" % (elem["@name"], formalArgs)
+ self.pythonOutput += comment
+ self.pythonOutput += actualArgs
+ self.pythonOutput += " methodId = model.registerCallback(callbackMethod)\n"
+ self.pythonOutput += " model.getConnectedBroker(managedBrokerLabel).method(methodId, self.idOriginal, \\\n"
+ self.pythonOutput += " classToSchemaNameMap[self.__class__.__name__], \"%s\", " % (elem["@name"])
+ self.pythonOutput += "args=actualArgs, packageName=\"qpid\")\n"
+
+ def endClass(self):
+ if (self.additionalPythonOutput != ""):
+ self.pythonOutput += self.additionalPythonOutput + "\n"
+ self.additionalPythonOutput = ""
+ if (self.pythonOutput.endswith("(SQLObject):\n")):
+ self.pythonOutput += " pass\n"
+ self.currentClass = ""
+
+ def parseConfigFile(self):
+ config = mllib.xml_parse("config.xml")
+ configOptions = config.query["config/configOption"]
+ for opt in configOptions:
+ self.options[opt["@name"]] = opt["@value"]
+
+ def generateCode(self):
+ outputFile = open(self.options["pythonOutput"], "w")
+ schema = mllib.xml_parse(self.options["schemaXML"])
+ classes = schema.query["schema/class"]
+ for cls in classes:
+ self.startClass(cls["@name"])
+ self.generateClassAttribs(cls["@name"], cls.query["configElement"])
+ for elem in cls.query["method"]:
+ self.generateMethod(elem)
+ self.endClass()
+ self.startClass(cls["@name"], stats=True)
+ self.generateClassAttribs(cls["@name"], cls.query["instElement"])
+ self.endClass()
+ outputFile.write(self.pythonOutput + self.finalPythonOutput)
+ outputFile.close()
+
+
+parser = SchemaParser()
+parser.generateCode()
Deleted: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-26 14:46:02 UTC (rev 1356)
+++ mgmt/mint/schemaparser.py 2007-11-26 16:30:24 UTC (rev 1357)
@@ -1,151 +0,0 @@
-import mllib
-from sqlobject import *
-
-class SchemaParser:
- """parses broker XML schema"""
-
- def __init__(self):
- self.options = dict()
- self.parseConfigFile()
- self.style = MixedCaseUnderscoreStyle()
- self.pythonOutput = "from sqlobject import *\n"
- self.pythonOutput += "from datetime import datetime\n"
- self.additionalPythonOutput = ""
- self.currentClass = ""
- self.finalPythonOutput = "\nclassToSchemaNameMap = dict()\n"
- self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
- self.pythonOutput += "conn = connectionForURI(\"%s\")\n" % (self.options["dsn"])
- self.pythonOutput += "sqlhub.processConnection = conn\n\n"
- # mapping between xml schema types and database column types
- # see xml/MintTypes.xml
- self.dataTypesMap = dict()
- self.dataTypesMap["objId"] = "ForeignKey"
- self.dataTypesMap["uint8"] = self.dataTypesMap["hilo8"] = self.dataTypesMap["count8"] = "SmallIntCol"
- self.dataTypesMap["uint16"] = self.dataTypesMap["hilo16"] = self.dataTypesMap["count16"] = "SmallIntCol"
- self.dataTypesMap["uint32"] = self.dataTypesMap["hilo32"] = self.dataTypesMap["count32"] = "IntCol"
- self.dataTypesMap["uint64"] = self.dataTypesMap["hilo64"] = self.dataTypesMap["count64"] = "BigIntCol"
- self.dataTypesMap["bool"] = "BoolCol"
- self.dataTypesMap["sstr"] = self.dataTypesMap["lstr"] = "StringCol"
-
- def attrNameFromDbColumn(self, name, removeSuffix=""):
- return self.style.dbColumnToPythonAttr(name.replace(removeSuffix, ""))
-
- def generateAttrib(self, attribName, attribType, params=""):
- if (params.find("default") < 0):
- if (params == ""):
- params = "default=None"
- else:
- params += ", default=None"
- self.pythonOutput += " %s = %s(%s)\n" % (attribName, attribType, params)
-
- def generateTimestampAttrib(self, col):
- self.generateAttrib(col + "Time", "TimestampCol") #, "default=datetime.min")
-
- def generateForeignKeyAttrib(self, name, reference):
- params = "'%s', cascade='null'" % (reference)
- self.generateAttrib(name, "ForeignKey", params)
-
- def generateHiLoAttrib(self, name, type):
- self.generateAttrib(name, type)
- self.generateAttrib(name + "Low", type)
- self.generateAttrib(name + "High", type)
-
- def generateMultipleJoin(self, tableFrom, tableTo):
- attrib = tableTo.lower() + "s"
- self.additionalPythonOutput += "\n%s.sqlmeta.addJoin(MultipleJoin('%s', joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
-
- def generateClassAttribs(self, schemaName, elements):
- for elem in elements:
- if (elem["@name"].endswith("Ref")):
- reference = self.style.dbTableToPythonClass(elem["@name"]).replace("Ref", "")
- attrib = reference[0].lower() + reference[1:]
- self.generateForeignKeyAttrib(attrib, reference)
- self.generateMultipleJoin(reference, self.currentClass)
- elif (elem["@type"].startswith("hilo")):
- self.generateHiLoAttrib(self.attrNameFromDbColumn(elem["@name"]), self.dataTypesMap[elem["@type"]])
- else:
- args = ""
- if (elem["@type"] == "sstr"):
- args += "length=1000"
- elif (elem["@type"] == "lstr"):
- args += "length=4000"
- self.generateAttrib(self.attrNameFromDbColumn(elem["@name"]), self.dataTypesMap[elem["@type"]], args)
-
- def startClass(self, schemaName, stats=False):
- if (stats):
- pythonName = self.style.dbTableToPythonClass(schemaName + "_stats")
- colPythonName = self.style.dbColumnToPythonAttr(schemaName)
- keyPythonName = self.style.dbTableToPythonClass(schemaName)
- else:
- pythonName = self.style.dbTableToPythonClass(schemaName)
- statsPythonName = self.style.dbTableToPythonClass(schemaName + "_stats")
- self.currentClass = pythonName
- self.pythonOutput += "\nclass %s(SQLObject):\n" % (pythonName)
- self.generateAttrib("idOriginal", "BigIntCol")
- self.generateTimestampAttrib("rec")
- if (stats):
- self.generateForeignKeyAttrib(colPythonName, keyPythonName)
- else:
- self.generateTimestampAttrib("creation")
- self.generateTimestampAttrib("deletion")
- self.generateAttrib("managedBroker", "StringCol", "length=1000")
- self.generateForeignKeyAttrib("stats", statsPythonName)
- self.generateForeignKeyAttrib("statsPrev", statsPythonName)
- self.finalPythonOutput += "classToSchemaNameMap['%s'] = '%s'\n" % (pythonName, schemaName)
- self.finalPythonOutput += "schemaNameToClassMap['%s'] = %s\n" % (schemaName, pythonName)
-
- def generateMethod(self, elem):
- if (elem["@desc"] != None):
- comment = ' """' + elem["@desc"] + '"""\n'
- else:
- comment = ""
- formalArgs = ", "
- actualArgs = " actualArgs = dict()\n"
- for arg in elem.query["arg"]:
- formalArgs += "%s, " % (arg["@name"])
- actualArgs += " actualArgs[\"%s\"] = %s\n" % (arg["@name"], arg["@name"])
- if (formalArgs != ", "):
- formalArgs = formalArgs[:-2]
- else:
- formalArgs = ""
- self.pythonOutput += "\n def %s(self, model, managedBrokerLabel, callbackMethod%s):\n" % (elem["@name"], formalArgs)
- self.pythonOutput += comment
- self.pythonOutput += actualArgs
- self.pythonOutput += " methodId = model.registerCallback(callbackMethod)\n"
- self.pythonOutput += " model.getConnectedBroker(managedBrokerLabel).method(methodId, self.idOriginal, \\\n"
- self.pythonOutput += " classToSchemaNameMap[self.__class__.__name__], \"%s\", " % (elem["@name"])
- self.pythonOutput += "args=actualArgs, packageName=\"qpid\")\n"
-
- def endClass(self):
- if (self.additionalPythonOutput != ""):
- self.pythonOutput += self.additionalPythonOutput + "\n"
- self.additionalPythonOutput = ""
- if (self.pythonOutput.endswith("(SQLObject):\n")):
- self.pythonOutput += " pass\n"
- self.currentClass = ""
-
- def parseConfigFile(self):
- config = mllib.xml_parse("config.xml")
- configOptions = config.query["config/configOption"]
- for opt in configOptions:
- self.options[opt["@name"]] = opt["@value"]
-
- def generateCode(self):
- outputFile = open(self.options["pythonOutput"], "w")
- schema = mllib.xml_parse(self.options["schemaXML"])
- classes = schema.query["schema/class"]
- for cls in classes:
- self.startClass(cls["@name"])
- self.generateClassAttribs(cls["@name"], cls.query["configElement"])
- for elem in cls.query["method"]:
- self.generateMethod(elem)
- self.endClass()
- self.startClass(cls["@name"], stats=True)
- self.generateClassAttribs(cls["@name"], cls.query["instElement"])
- self.endClass()
- outputFile.write(self.pythonOutput + self.finalPythonOutput)
- outputFile.close()
-
-
-parser = SchemaParser()
-parser.generateCode()
17 years, 1 month
rhmessaging commits: r1356 - mgmt/mint/xml.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-26 09:46:02 -0500 (Mon, 26 Nov 2007)
New Revision: 1356
Modified:
mgmt/mint/xml/MgmtSchema.xml
mgmt/mint/xml/MgmtTypes.xml
Log:
new mgmt schema and types, from specs
Modified: mgmt/mint/xml/MgmtSchema.xml
===================================================================
--- mgmt/mint/xml/MgmtSchema.xml 2007-11-23 16:35:38 UTC (rev 1355)
+++ mgmt/mint/xml/MgmtSchema.xml 2007-11-26 14:46:02 UTC (rev 1356)
@@ -44,7 +44,7 @@
System
===============================================================
-->
- <class name="system" schemaId="1">
+ <class name="system">
<configElement name="sysId" index="y" type="sstr" access="RC"/>
<!-- RT config/instrumentation TBD -->
@@ -56,7 +56,7 @@
Broker
===============================================================
-->
- <class name="broker" schemaId="2">
+ <class name="broker">
<configElement name="systemRef" type="objId" access="RC" index="y" desc="System ID"/>
<configElement name="port" type="uint16" access="RC" index="y" desc="TCP Port for AMQP Service"/>
<configElement name="workerThreads" type="uint16" access="RO" desc="Thread pool size"/>
@@ -72,6 +72,8 @@
desc="Name of cluster this server is a member of, zero-length for standalone server"/>
<configElement name="version" type="sstr" access="RO" desc="Running software version"/>
+
+
<method name="joinCluster">
<arg name="clusterName" dir="I" type="sstr"/>
</method>
@@ -90,8 +92,8 @@
Virtual Host
===============================================================
-->
- <class name="vhost" schemaId="3">
- <configElement name="brokerRef" type="objId" access="RC" index="y"/>
+ <class name="vhost">
+ <configElement name="brokerRef" type="objId" access="RC" index="y" parentRef="y"/>
<configElement name="name" type="sstr" access="RC" index="y"/>
</class>
@@ -100,8 +102,8 @@
Queue
===============================================================
-->
- <class name="queue" schemaId="4">
- <configElement name="vhostRef" type="objId" access="RC" index="y"/>
+ <class name="queue">
+ <configElement name="vhostRef" type="objId" access="RC" index="y" parentRef="y"/>
<configElement name="name" type="sstr" access="RC" index="y"/>
<configElement name="durable" type="bool" access="RC"/>
@@ -109,9 +111,25 @@
<configElement name="exclusive" type="bool" access="RC"/>
<configElement name="pageMemoryLimit" type="uint32" access="RO"/>
- <instElement name="diskPageSize" type="uint32"/>
- <instElement name="diskPages" type="uint32"/>
- <instElement name="diskAvailableSize" type="uint32"/>
+ <!-- Persistent Journal Support -->
+ <instElement name="journalLocation" type="sstr" desc="Logical directory on disk"/>
+ <instElement name="journalBaseFileName" type="sstr" desc="Base filename prefix for journal"/>
+ <instElement name="journalInitialFileCount" type="uint32" desc="Number of files initially allocated to this journal"/>
+ <instElement name="journalCurrentFileCount" type="uint32" desc="Number of files currently allocated to this journal"/>
+ <instElement name="journalDataFileSize" type="uint32" unit="byte" desc="Size of each journal data file"/>
+ <instElement name="journalFreeFileCount" type="hilo32" desc="Number of files free on this journal. Includes free files trapped in holes."/>
+ <instElement name="journalAvailableFileCount" type="hilo32" desc="Number of files available to be written. Excluding holes"/>
+ <instElement name="journalRecordDepth" type="hilo32" unit="record" desc="Number of enqueued records (durable messages)"/>
+ <instElement name="journalRecordEnqueues" type="count64" unit="record" desc="Total enqueued records on journal"/>
+ <instElement name="journalRecordDequeues" type="count64" unit="record" desc="Total dequeued records on journal"/>
+ <instElement name="journalWriteWaitFailures" type="count64" unit="record" desc="AIO Wait failures on write"/>
+ <instElement name="journalWriteBusyFailures" type="count64" unit="record" desc="AIO Busy failures on write"/>
+ <instElement name="journalReadRecordCount" type="count64" unit="record" desc="Records read from the journal"/>
+ <instElement name="journalReadBusyFailures" type="count64" unit="record" desc="AIO Busy failures on read"/>
+ <instElement name="journalWritePageCacheDepth" type="hilo32" unit="page" desc="Current depth of write-page-cache"/>
+ <instElement name="journalWritePageSize" type="uint32" unit="byte" desc="Page size in write-page-cache"/>
+ <instElement name="journalReadPageCacheDepth" type="hilo32" unit="page" desc="Current depth of read-page-cache"/>
+ <instElement name="journalReadPageSize" type="uint32" unit="byte" desc="Page size in read-page-cache"/>
<instElement name="msgTotalEnqueues" type="count64" unit="message" desc="Total messages enqueued"/>
<instElement name="msgTotalDequeues" type="count64" unit="message" desc="Total messages dequeued"/>
@@ -140,7 +158,7 @@
<instElement name="unackedMessages" type="hilo32" unit="message" desc="Messages consumed but not yet acked"/>
<method name="purge" desc="Discard all messages on queue"/>
- <method name="increaseDiskSize" desc="Increase number of disk pages allocated for this queue">
+ <method name="increaseJournalSize" desc="Increase number of disk pages allocated for this queue">
<arg name="pages" type="uint32" dir="I" desc="New total page allocation"/>
</method>
@@ -151,10 +169,10 @@
Exchange
===============================================================
-->
- <class name="exchange" schemaId="5">
- <configElement name="vhostRef" type="objId" access="RC" index="y"/>
- <configElement name="name" type="sstr" access="RC" index="y"/>
- <configElement name="type" type="sstr" access="RC"/>
+ <class name="exchange">
+ <configElement name="vhostRef" type="objId" access="RC" index="y" parentRef="y"/>
+ <configElement name="name" type="sstr" access="RC" index="y"/>
+ <configElement name="type" type="sstr" access="RC"/>
<instElement name="producers" type="hilo32" desc="Current producers on exchange"/>
<instElement name="bindings" type="hilo32" desc="Current bindings"/>
@@ -171,7 +189,7 @@
Binding
===============================================================
-->
- <class name="binding" schemaId="6">
+ <class name="binding">
<configElement name="queueRef" type="objId" access="RC" index="y"/>
<configElement name="exchangeRef" type="objId" access="RC" index="y"/>
<configElement name="bindingKey" type="sstr" access="RC"/>
@@ -185,8 +203,8 @@
Client
===============================================================
-->
- <class name="client" schemaId="7">
- <configElement name="vhostRef" type="objId" access="RC" index="y"/>
+ <class name="client">
+ <configElement name="vhostRef" type="objId" access="RC" index="y" parentRef="y"/>
<configElement name="ipAddr" type="uint32" access="RC" index="y"/>
<configElement name="port" type="uint16" access="RC" index="y"/>
@@ -205,9 +223,9 @@
Session
===============================================================
-->
- <class name="session" schemaId="8">
- <configElement name="vhostRef" type="objId" index="y"/>
- <configElement name="name" type="sstr" index="y"/>
+ <class name="session">
+ <configElement name="vhostRef" type="objId" access="RC" index="y" parentRef="y"/>
+ <configElement name="name" type="sstr" access="RC" index="y"/>
<configElement name="clientRef" type="sstr" access="RO"/>
<configElement name="detachedLifespan" type="uint32" access="RO"/>
@@ -226,9 +244,9 @@
Destination
===============================================================
-->
- <class name="destination" schemaId="9">
- <configElement name="sessionRef" type="objId" index="y"/>
- <configElement name="name" type="sstr" index="y"/>
+ <class name="destination">
+ <configElement name="sessionRef" type="objId" access="RC" index="y" parentRef="y"/>
+ <configElement name="name" type="sstr" access="RC" index="y"/>
<instElement name="flowMode" type="uint8"/>
<instElement name="maxMsgCredits" type="uint32"/>
@@ -248,9 +266,9 @@
Producer
===============================================================
-->
- <class name="producer" schemaId="10">
- <configElement name="destinationRef" type="objId" index="y"/>
- <configElement name="exchangeRef" type="objId" index="y"/>
+ <class name="producer">
+ <configElement name="destinationRef" access="RC" type="objId" index="y"/>
+ <configElement name="exchangeRef" access="RC" type="objId" index="y"/>
<instElement name="msgsProduced" type="count64"/>
<instElement name="bytesProduced" type="count64"/>
@@ -261,9 +279,9 @@
Consumer
===============================================================
-->
- <class name="consumer" schemaId="11">
- <configElement name="destinationRef" type="objId" index="y"/>
- <configElement name="queueRef" type="objId" index="y"/>
+ <class name="consumer">
+ <configElement name="destinationRef" access="RC" type="objId" index="y"/>
+ <configElement name="queueRef" access="RC" type="objId" index="y"/>
<instElement name="msgsConsumed" type="count64"/>
<instElement name="bytesConsumed" type="count64"/>
Modified: mgmt/mint/xml/MgmtTypes.xml
===================================================================
--- mgmt/mint/xml/MgmtTypes.xml 2007-11-23 16:35:38 UTC (rev 1355)
+++ mgmt/mint/xml/MgmtTypes.xml 2007-11-26 14:46:02 UTC (rev 1356)
@@ -19,24 +19,24 @@
under the License.
-->
-<type name="objId" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
-<type name="uint8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="direct"/>
-<type name="uint16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="direct"/>
-<type name="uint32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="direct"/>
-<type name="uint64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="direct"/>
-<type name="bool" base="U8" cpp="bool" encode="@.putOctet(#?1:0)" decode="# = @.getOctet()==1" accessor="direct"/>
-<type name="sstr" base="SSTR" cpp="std::string" encode="@.putShortString(#)" decode="@.getShortString(#)" accessor="direct"/>
-<type name="lstr" base="LSTR" cpp="std::string" encode="@.putLongString(#)" decode="@.getLongString(#)" accessor="direct"/>
+<type name="objId" base="U64" cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" accessor="direct" init="0"/>
+<type name="uint8" base="U8" cpp="uint8_t" encode="@.putOctet (#)" decode="# = @.getOctet ()" accessor="direct" init="0"/>
+<type name="uint16" base="U16" cpp="uint16_t" encode="@.putShort (#)" decode="# = @.getShort ()" accessor="direct" init="0"/>
+<type name="uint32" base="U32" cpp="uint32_t" encode="@.putLong (#)" decode="# = @.getLong ()" accessor="direct" init="0"/>
+<type name="uint64" base="U64" cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" accessor="direct" init="0"/>
+<type name="bool" base="U8" cpp="bool" encode="@.putOctet (#?1:0)" decode="# = @.getOctet ()==1" accessor="direct" init="0"/>
+<type name="sstr" base="SSTR" cpp="std::string" encode="@.putShortString (#)" decode="@.getShortString (#)" accessor="direct" init='""'/>
+<type name="lstr" base="LSTR" cpp="std::string" encode="@.putLongString (#)" decode="@.getLongString (#)" accessor="direct" init='""'/>
-<type name="hilo8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" style="wm" accessor="counter"/>
-<type name="hilo16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" style="wm" accessor="counter"/>
-<type name="hilo32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" style="wm" accessor="counter"/>
-<type name="hilo64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="wm" accessor="counter"/>
+<type name="hilo8" base="U8" cpp="uint8_t" encode="@.putOctet (#)" decode="# = @.getOctet ()" style="wm" accessor="counter" init="0"/>
+<type name="hilo16" base="U16" cpp="uint16_t" encode="@.putShort (#)" decode="# = @.getShort ()" style="wm" accessor="counter" init="0"/>
+<type name="hilo32" base="U32" cpp="uint32_t" encode="@.putLong (#)" decode="# = @.getLong ()" style="wm" accessor="counter" init="0"/>
+<type name="hilo64" base="U64" cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" style="wm" accessor="counter" init="0"/>
-<type name="count8" base="U8" cpp="uint8_t" encode="@.putOctet(#)" decode="# = @.getOctet()" accessor="counter"/>
-<type name="count16" base="U16" cpp="uint16_t" encode="@.putShort(#)" decode="# = @.getShort()" accessor="counter"/>
-<type name="count32" base="U32" cpp="uint32_t" encode="@.putLong(#)" decode="# = @.getLong()" accessor="counter"/>
-<type name="count64" base="U64" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="counter"/>
+<type name="count8" base="U8" cpp="uint8_t" encode="@.putOctet (#)" decode="# = @.getOctet ()" accessor="counter" init="0"/>
+<type name="count16" base="U16" cpp="uint16_t" encode="@.putShort (#)" decode="# = @.getShort ()" accessor="counter" init="0"/>
+<type name="count32" base="U32" cpp="uint32_t" encode="@.putLong (#)" decode="# = @.getLong ()" accessor="counter" init="0"/>
+<type name="count64" base="U64" cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" accessor="counter" init="0"/>
<!-- Some Proposed Syntax for User-Defined Types:
<enum name="enumeratedType" base="U8">
17 years, 1 month
rhmessaging commits: r1355 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2007-11-23 11:35:38 -0500 (Fri, 23 Nov 2007)
New Revision: 1355
Modified:
store/trunk/cpp/tests/MessageUtils.h
Log:
Updated in-line with recent changes to qpid trunk.
Modified: store/trunk/cpp/tests/MessageUtils.h
===================================================================
--- store/trunk/cpp/tests/MessageUtils.h 2007-11-21 21:20:12 UTC (rev 1354)
+++ store/trunk/cpp/tests/MessageUtils.h 2007-11-23 16:35:38 UTC (rev 1355)
@@ -36,8 +36,8 @@
{
Message::shared_ptr msg(new Message());
- AMQFrame method(0, MessageTransferBody(ProtocolVersion(), 0, exchange, 0, 0));
- AMQFrame header(0, AMQHeaderBody());
+ AMQFrame method(in_place<MessageTransferBody>(ProtocolVersion(), 0, exchange, 0, 0));
+ AMQFrame header(in_place<AMQHeaderBody>());
msg->getFrames().append(method);
msg->getFrames().append(header);
@@ -50,7 +50,7 @@
static void addContent(Message::shared_ptr msg, const string& data)
{
- AMQFrame content(0, AMQContentBody(data));
+ AMQFrame content(in_place<AMQContentBody>(data));
msg->getFrames().append(content);
}
};
17 years, 1 month
rhmessaging commits: r1354 - mgmt/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-21 16:20:12 -0500 (Wed, 21 Nov 2007)
New Revision: 1354
Modified:
mgmt/mint/schemaparser.py
Log:
make a few variable names more meaningful
Modified: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-21 21:08:58 UTC (rev 1353)
+++ mgmt/mint/schemaparser.py 2007-11-21 21:20:12 UTC (rev 1354)
@@ -10,10 +10,10 @@
self.style = MixedCaseUnderscoreStyle()
self.pythonOutput = "from sqlobject import *\n"
self.pythonOutput += "from datetime import datetime\n"
- self.additional = ""
+ self.additionalPythonOutput = ""
self.currentClass = ""
- self.final = "\nclassToSchemaNameMap = dict()\n"
- self.final += "schemaNameToClassMap = dict()\n"
+ self.finalPythonOutput = "\nclassToSchemaNameMap = dict()\n"
+ self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
self.pythonOutput += "conn = connectionForURI(\"%s\")\n" % (self.options["dsn"])
self.pythonOutput += "sqlhub.processConnection = conn\n\n"
# mapping between xml schema types and database column types
@@ -52,7 +52,7 @@
def generateMultipleJoin(self, tableFrom, tableTo):
attrib = tableTo.lower() + "s"
- self.additional += "\n%s.sqlmeta.addJoin(MultipleJoin('%s', joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
+ self.additionalPythonOutput += "\n%s.sqlmeta.addJoin(MultipleJoin('%s', joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
def generateClassAttribs(self, schemaName, elements):
for elem in elements:
@@ -91,8 +91,8 @@
self.generateAttrib("managedBroker", "StringCol", "length=1000")
self.generateForeignKeyAttrib("stats", statsPythonName)
self.generateForeignKeyAttrib("statsPrev", statsPythonName)
- self.final += "classToSchemaNameMap['%s'] = '%s'\n" % (pythonName, schemaName)
- self.final += "schemaNameToClassMap['%s'] = %s\n" % (schemaName, pythonName)
+ self.finalPythonOutput += "classToSchemaNameMap['%s'] = '%s'\n" % (pythonName, schemaName)
+ self.finalPythonOutput += "schemaNameToClassMap['%s'] = %s\n" % (schemaName, pythonName)
def generateMethod(self, elem):
if (elem["@desc"] != None):
@@ -117,9 +117,9 @@
self.pythonOutput += "args=actualArgs, packageName=\"qpid\")\n"
def endClass(self):
- if (self.additional != ""):
- self.pythonOutput += self.additional + "\n"
- self.additional = ""
+ if (self.additionalPythonOutput != ""):
+ self.pythonOutput += self.additionalPythonOutput + "\n"
+ self.additionalPythonOutput = ""
if (self.pythonOutput.endswith("(SQLObject):\n")):
self.pythonOutput += " pass\n"
self.currentClass = ""
@@ -143,7 +143,7 @@
self.startClass(cls["@name"], stats=True)
self.generateClassAttribs(cls["@name"], cls.query["instElement"])
self.endClass()
- outputFile.write(self.pythonOutput + self.final)
+ outputFile.write(self.pythonOutput + self.finalPythonOutput)
outputFile.close()
17 years, 1 month
rhmessaging commits: r1353 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-21 16:08:58 -0500 (Wed, 21 Nov 2007)
New Revision: 1353
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/widgets.py
Log:
In preparation for labeled axes in charts, adds a samples method to CuminStat.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2007-11-21 17:32:03 UTC (rev 1352)
+++ mgmt/cumin/python/cumin/charts.py 2007-11-21 21:08:58 UTC (rev 1353)
@@ -7,16 +7,20 @@
self.height = height
self.surface = ImageSurface(FORMAT_ARGB32, width + 60, height + 20)
self.max_value = 1
+ self.value_interval = 5
def set_max_value(self, value):
self.max_value = value
- def plot_values(self, values, interval=5, color=(0, 0, 0)):
+ def set_value_interval(self, interval):
+ self.value_interval = interval
+
+ def plot_values(self, values, color=(0, 0, 0)):
cr = Context(self.surface)
cr.set_line_width(2)
cr.set_source_rgb(*color)
- xs = range(self.width, 0 - interval, -interval)
+ xs = range(self.width, 0 - self.value_interval, -self.value_interval)
for x, value in zip(xs, values):
y = self.height - (value / float(self.max_value)) * self.height
@@ -33,17 +37,27 @@
cr.stroke()
- def plot_x_intervals(self, interval=40):
- cr = Context(self.surface)
- cr.set_line_width(0.2)
- cr.set_source_rgb(0.8, 0.8, 0.8)
+ def plot_x_axis(self, values, interval=40):
+ if values:
+ cr = Context(self.surface)
+ cr.set_line_width(0.2)
+ cr.set_source_rgb(0.8, 0.8, 0.8)
- for x in range(0, self.width, interval):
- cr.move_to(x, 0)
- cr.line_to(x, self.height)
+ zero = values[0]
+ xs = range(self.width, 0 - interval, -interval)
- cr.stroke()
+ for x in xs:
+ cr.move_to(x, 0)
+ cr.line_to(x, self.height + 10)
+ # XXX
+ #index = 120 - x // self.value_interval
+ #value = values[index] - zero
+ #print x, index, value
+ #cr.show_text(value.strftime("%S"))
+
+ cr.stroke()
+
def plot_y_axis(self):
cr = Context(self.surface)
@@ -55,5 +69,7 @@
cr.move_to(x, self.height)
cr.show_text("0")
+ cr.stroke()
+
def write(self, writer):
self.surface.write_to_png(writer)
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-21 17:32:03 UTC (rev 1352)
+++ mgmt/cumin/python/cumin/model.py 2007-11-21 21:08:58 UTC (rev 1353)
@@ -61,16 +61,17 @@
def value(self, object):
return nvl(getattr(object.stats, self.name), -1)
- def values(self, object, limit=None):
+ def samples(self, object, limit=None):
cls = self.cumin_class.mint_stats_class
stats = cls.select(orderBy="-id")[:limit]
- values = list()
+ samples = list()
for stat in stats:
+ time = getattr(stat, "recTime")
value = getattr(stat, self.name)
- values.append(value)
+ samples.append((time, value))
- return values
+ return samples
def rate(self, object):
if object.stats:
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-21 17:32:03 UTC (rev 1352)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-21 21:08:58 UTC (rev 1353)
@@ -176,9 +176,12 @@
cls = self.app.cmodel.get_class(object)
stats = [cls.get_stat(x) for x in self.stats.get(session)]
+ samples = stats[0].samples(object, 121)
+ times = [x[0] for x in samples]
+
values = dict()
for stat in stats:
- values[stat] = stat.values(object, 121)
+ values[stat] = [x[1] for x in stat.samples(object, 121)]
max_value = 0
for stat in stats:
@@ -187,7 +190,7 @@
max_value = max_value + (100 - max_value % 100)
chart.set_max_value(int(max_value))
- chart.plot_x_intervals()
+ chart.plot_x_axis(times)
chart.plot_y_axis()
colors = ((1,0,0), (0,0,1), (0,1,0))
17 years, 1 month
rhmessaging commits: r1352 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-21 12:32:03 -0500 (Wed, 21 Nov 2007)
New Revision: 1352
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/widgets.py
Log:
Restores charts. They now use the new model data.
In order to do this, refactored the stats ui metadata.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-11-21 16:08:04 UTC (rev 1351)
+++ mgmt/cumin/python/cumin/client.py 2007-11-21 17:32:03 UTC (rev 1352)
@@ -143,11 +143,11 @@
return "History"
def render_produced_chart_url(self, session, client):
- return "client.png?id=%i;m=msgsProduced;m=bytesProduced" \
+ return "client.png?id=%i;s=msgsProduced;s=bytesProduced" \
% client.id
def render_consumed_chart_url(self, session, client):
- return "client.png?id=%i;m=msgsConsumed;m=bytesConsumed" \
+ return "client.png?id=%i;s=msgsConsumed;s=bytesConsumed" \
% client.id
class ClientSessionSet(ItemSet):
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-11-21 16:08:04 UTC (rev 1351)
+++ mgmt/cumin/python/cumin/exchange.py 2007-11-21 17:32:03 UTC (rev 1352)
@@ -356,13 +356,13 @@
return "History"
def render_received_chart_url(self, session, queue):
- return "exchange.png?id=%i;m=msgReceives;m=byteReceives" % queue.id
+ return "exchange.png?id=%i;s=msgReceives;s=byteReceives" % queue.id
def render_dropped_chart_url(self, session, queue):
- return "exchange.png?id=%i;m=msgDrops;byteDrops" % queue.id
+ return "exchange.png?id=%i;s=msgDrops;s=byteDrops" % queue.id
def render_routed_chart_url(self, session, queue):
- return "exchange.png?id=%i;m=msgRoutes;m=byteRoutes" \
+ return "exchange.png?id=%i;s=msgRoutes;s=byteRoutes" \
% queue.id
class ExchangeProducerSet(ItemSet):
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-21 16:08:04 UTC (rev 1351)
+++ mgmt/cumin/python/cumin/model.py 2007-11-21 17:32:03 UTC (rev 1352)
@@ -8,7 +8,7 @@
def __init__(self):
self.classes = dict()
- self.queue = CuminQueue()
+ self.queue = CuminQueue(self)
self.add_class(self.queue)
def add_class(self, cls):
@@ -18,11 +18,15 @@
return self.classes[mint_object.__class__]
class CuminClass(object):
- def __init__(self, mint_class):
+ def __init__(self, model, mint_class):
+ self.model = model
self.mint_class = mint_class
+ self.mint_stats_class = None
self.stats = list()
+ self.model.add_class(self)
+
def add_stat(self, stat):
self.stats.append(stat)
@@ -40,18 +44,34 @@
stat.write_xml(object, writer)
class CuminStat(object):
- def __init__(self, name, unit, title=None, categories=()):
+ def __init__(self, cls, name, type):
+ self.model = cls.model
+ self.cumin_class = cls
self.name = name
- self.unit = unit
+ self.type = type
+ self.unit = None
self.title = None
- self.categories = categories
+ self.categories = ()
self.link_cb = None
self.highlow = False
+ self.cumin_class.add_stat(self)
+
def value(self, object):
return nvl(getattr(object.stats, self.name), -1)
+ def values(self, object, limit=None):
+ cls = self.cumin_class.mint_stats_class
+ stats = cls.select(orderBy="-id")[:limit]
+ values = list()
+
+ for stat in stats:
+ value = getattr(stat, self.name)
+ values.append(value)
+
+ return values
+
def rate(self, object):
if object.stats:
curr = getattr(object.stats, self.name)
@@ -75,186 +95,160 @@
self.rate(object) or 0))
class CuminQueue(CuminClass):
- def __init__(self):
- super(CuminQueue, self).__init__(mint.Queue)
+ def __init__(self, model):
+ super(CuminQueue, self).__init__(model, mint.Queue)
- stat = CuminStat("consumers", "int")
+ self.mint_stats_class = mint.QueueStats
+
+ stat = CuminStat(self, "consumers", "int")
stat.title = "Consumers"
stat.unit = "consumer"
stat.categories = ("general")
stat.highlow = True
- self.add_stat(stat)
- stat = CuminStat("bindings", "int")
+ stat = CuminStat(self, "bindings", "int")
stat.title = "Bindings"
stat.unit = "binding"
stat.categories = ("general")
stat.highlow = True
- self.add_stat(stat)
- stat = CuminStat("msgDepth", "int")
+ stat = CuminStat(self, "msgDepth", "int")
stat.title = "Message Depth"
stat.unit = "message"
stat.categories = ("message", "general")
stat.highlow = True
- self.add_stat(stat)
- stat = CuminStat("msgTotalEnqueues", "int")
+ stat = CuminStat(self, "msgTotalEnqueues", "int")
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "general")
- self.add_stat(stat)
- stat = CuminStat("msgTotalDequeues", "int")
+ stat = CuminStat(self, "msgTotalDequeues", "int")
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "general")
- self.add_stat(stat)
- stat = CuminStat("byteDepth", "int")
+ stat = CuminStat(self, "byteDepth", "int")
stat.title = "Byte Depth"
stat.unit = "byte"
stat.categories = ("byte", "general")
stat.highlow = True
- self.add_stat(stat)
- stat = CuminStat("byteTotalEnqueues", "int")
+ stat = CuminStat(self, "byteTotalEnqueues", "int")
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "general")
- self.add_stat(stat)
- stat = CuminStat("byteTotalDequeues", "int")
+ stat = CuminStat(self, "byteTotalDequeues", "int")
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "general")
- self.add_stat(stat)
- stat = CuminStat("unackedMessages", "int")
+ stat = CuminStat(self, "unackedMessages", "int")
stat.title = "Msgs. Unacked"
stat.unit = "message"
stat.categories = ("general")
- self.add_stat(stat)
# Disk
- #stat = CuminStat("diskPageSize", "int")
+ #stat = CuminStat(self, "diskPageSize", "int")
#stat.title = "Page size"
#stat.categories = ("disk")
- #self.add_stat(stat)
- stat = CuminStat("diskPages", "int")
+ stat = CuminStat(self, "diskPages", "int")
stat.title = "Disk Pages"
stat.unit = "page"
stat.categories = ("general")
- self.add_stat(stat)
- #stat = CuminStat("diskAvailableSize", "int")
+ #stat = CuminStat(self, "diskAvailableSize", "int")
#stat.title = "Available size"
#stat.categories = ("disk")
- #self.add_stat(stat)
# Transactional
- stat = CuminStat("msgTxnEnqueues", "int")
+ stat = CuminStat(self, "msgTxnEnqueues", "int")
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "transactional")
- self.add_stat(stat)
- stat = CuminStat("msgTxnDequeues", "int")
+ stat = CuminStat(self, "msgTxnDequeues", "int")
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "transactional")
- self.add_stat(stat)
- stat = CuminStat("byteTxnEnqueues", "int")
+ stat = CuminStat(self, "byteTxnEnqueues", "int")
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "transactional")
- self.add_stat(stat)
- stat = CuminStat("byteTxnDequeues", "int")
+ stat = CuminStat(self, "byteTxnDequeues", "int")
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "transactional")
- self.add_stat(stat)
- stat = CuminStat("enqueueTxnStarts", "int")
+ stat = CuminStat(self, "enqueueTxnStarts", "int")
stat.title = "Enq. Trans. Started"
stat.unit = "transaction"
stat.categories = ("transaction")
- self.add_stat(stat)
- stat = CuminStat("enqueueTxnCommits", "int")
+ stat = CuminStat(self, "enqueueTxnCommits", "int")
stat.title = "Enq. Trans. Committed"
stat.unit = "transaction"
stat.categories = ("transaction")
- self.add_stat(stat)
- stat = CuminStat("enqueueTxnRejects", "int")
+ stat = CuminStat(self, "enqueueTxnRejects", "int")
stat.title = "Enq. Trans. Rejected"
stat.unit = "transaction"
stat.categories = ("transaction")
- self.add_stat(stat)
- stat = CuminStat("enqueueTxnCount", "int")
+ stat = CuminStat(self, "enqueueTxnCount", "int")
stat.title = "Enq. Trans. Pending"
stat.unit = "transaction"
stat.categories = ("transaction")
stat.highlow = True
- self.add_stat(stat)
- stat = CuminStat("dequeueTxnStarts", "int")
+ stat = CuminStat(self, "dequeueTxnStarts", "int")
stat.title = "Deq. Trans. Started"
stat.unit = "transaction"
stat.categories = ("transaction")
- self.add_stat(stat)
- stat = CuminStat("dequeueTxnCommits", "int")
+ stat = CuminStat(self, "dequeueTxnCommits", "int")
stat.title = "Deq. Trans. Committed"
stat.unit = "transaction"
stat.categories = ("transaction")
- self.add_stat(stat)
- stat = CuminStat("dequeueTxnRejects", "int")
+ stat = CuminStat(self, "dequeueTxnRejects", "int")
stat.title = "Deq. Trans. Rejected"
stat.unit = "transaction"
stat.categories = ("transaction")
- self.add_stat(stat)
- stat = CuminStat("dequeueTxnCount", "int")
+ stat = CuminStat(self, "dequeueTxnCount", "int")
stat.title = "Deq. Trans. Pending"
stat.unit = "transaction"
stat.categories = ("transaction")
stat.highlow = True
- self.add_stat(stat)
# Persistent
- stat = CuminStat("msgPersistEnqueues", "int")
+ stat = CuminStat(self, "msgPersistEnqueues", "int")
stat.title = "Msgs. Enqueued"
stat.unit = "message"
stat.categories = ("message", "persistent")
- self.add_stat(stat)
- stat = CuminStat("msgPersistDequeues", "int")
+ stat = CuminStat(self, "msgPersistDequeues", "int")
stat.title = "Msgs. Dequeued"
stat.unit = "message"
stat.categories = ("message", "persistent")
- self.add_stat(stat)
- stat = CuminStat("bytePersistEnqueues", "int")
+ stat = CuminStat(self, "bytePersistEnqueues", "int")
stat.title = "Bytes Enqueued"
stat.unit = "byte"
stat.categories = ("byte", "persistent")
- self.add_stat(stat)
- stat = CuminStat("bytePersistDequeues", "int")
+ stat = CuminStat(self, "bytePersistDequeues", "int")
stat.title = "Bytes Dequeued"
stat.unit = "byte"
stat.categories = ("byte", "persistent")
- self.add_stat(stat)
def write_xml(self, queue, writer):
writer.write("<queue id=\"%i\">" % queue.id)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-11-21 16:08:04 UTC (rev 1351)
+++ mgmt/cumin/python/cumin/queue.py 2007-11-21 17:32:03 UTC (rev 1352)
@@ -474,13 +474,13 @@
return "History"
def render_depth_chart_url(self, session, queue):
- return "queue.png?id=%i;m=msgDepth;m=byteDepth" % queue.id
+ return "queue.png?id=%i;s=msgDepth;s=byteDepth" % queue.id
def render_consumers_chart_url(self, session, queue):
- return "queue.png?id=%i;m=consumers" % queue.id
+ return "queue.png?id=%i;s=consumers" % queue.id
def render_transactions_chart_url(self, session, queue):
- return "queue.png?id=%i;m=enqueueTxnCount;m=dequeueTxnCount" \
+ return "queue.png?id=%i;s=enqueueTxnCount;s=dequeueTxnCount" \
% queue.id
class QueueConsumerSet(ItemSet):
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-21 16:08:04 UTC (rev 1351)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-21 17:32:03 UTC (rev 1352)
@@ -158,8 +158,8 @@
self.iparam = Parameter(app, "param")
self.add_parameter(self.iparam)
- self.measurements = ListParameter(app, "m", self.iparam)
- self.add_parameter(self.measurements)
+ self.stats = ListParameter(app, "s", self.iparam)
+ self.add_parameter(self.stats)
def set_object_parameter(self, param):
self.__param = param
@@ -173,16 +173,16 @@
def do_render(self, session, object):
chart = LineChart(600, 120)
- measures = [object.get_measurement(x) \
- for x in self.measurements.get(session)]
+ cls = self.app.cmodel.get_class(object)
+ stats = [cls.get_stat(x) for x in self.stats.get(session)]
values = dict()
- for m in measures:
- values[m] = m.get_values(250)
+ for stat in stats:
+ values[stat] = stat.values(object, 121)
max_value = 0
- for m in measures:
- max_value = max(max(values[m]), max_value)
+ for stat in stats:
+ max_value = max(max(values[stat]), max_value)
max_value = max_value * 1.1
max_value = max_value + (100 - max_value % 100)
chart.set_max_value(int(max_value))
@@ -192,8 +192,8 @@
colors = ((1,0,0), (0,0,1), (0,1,0))
- for m, c in zip(measures, colors):
- chart.plot_values(values[m], color=c)
+ for stat, color in zip(stats, colors):
+ chart.plot_values(values[stat], color=color)
chart.plot_frame()
17 years, 1 month
rhmessaging commits: r1351 - mgmt/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-21 11:08:04 -0500 (Wed, 21 Nov 2007)
New Revision: 1351
Modified:
mgmt/mint/schemaparser.py
Log:
revert back to including connection settings in parser
Modified: mgmt/mint/schemaparser.py
===================================================================
--- mgmt/mint/schemaparser.py 2007-11-21 15:21:06 UTC (rev 1350)
+++ mgmt/mint/schemaparser.py 2007-11-21 16:08:04 UTC (rev 1351)
@@ -14,6 +14,8 @@
self.currentClass = ""
self.final = "\nclassToSchemaNameMap = dict()\n"
self.final += "schemaNameToClassMap = dict()\n"
+ self.pythonOutput += "conn = connectionForURI(\"%s\")\n" % (self.options["dsn"])
+ self.pythonOutput += "sqlhub.processConnection = conn\n\n"
# mapping between xml schema types and database column types
# see xml/MintTypes.xml
self.dataTypesMap = dict()
17 years, 1 month
rhmessaging commits: r1350 - in mgmt/cumin: resources and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-21 10:21:06 -0500 (Wed, 21 Nov 2007)
New Revision: 1350
Added:
mgmt/cumin/resources/mrg-36.png
Modified:
mgmt/cumin/python/cumin/page.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/resources/broker-20.png
mgmt/cumin/resources/broker-36.png
mgmt/cumin/resources/cluster-20.png
mgmt/cumin/resources/cluster-36.png
mgmt/cumin/resources/favicon.ico
Log:
Updates icons and styling.
Modified: mgmt/cumin/python/cumin/page.py
===================================================================
--- mgmt/cumin/python/cumin/page.py 2007-11-21 14:07:18 UTC (rev 1349)
+++ mgmt/cumin/python/cumin/page.py 2007-11-21 15:21:06 UTC (rev 1350)
@@ -141,7 +141,7 @@
return branch.marshal()
def get_title(self, session, model):
- return "Red Hat Messaging"
+ return "MRG Messaging"
def render_frames(self, session, object):
self.object.set(session, object)
@@ -176,7 +176,7 @@
return mode
def get_title(self, session, model):
- return "Red Hat Messaging"
+ return "Messaging"
class BrokerTab(BrokerBrowser):
def get_title(self, session, model):
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-11-21 14:07:18 UTC (rev 1349)
+++ mgmt/cumin/python/cumin/page.strings 2007-11-21 15:21:06 UTC (rev 1350)
@@ -51,7 +51,10 @@
#head {
padding: 0.4em 0.75em 0.2em 0.75em;
- background-color: #685b8a;
+ background-color: #f7f7f7;
+ border-bottom: 1px dotted #eee;
+ font-size: 0.9em;
+ /* background-color: #685b8a; */
/* background-color: #564979; */
}
@@ -66,7 +69,7 @@
ul#whonav {
float: right;
list-style: none;
- color: white;
+ color: #333;
margin: 0;
}
@@ -74,10 +77,6 @@
display: inline;
}
-ul#whonav li a {
- color: white;
-}
-
h1, h2 {
margin: 0;
}
@@ -122,15 +121,11 @@
content: " > ";
font-weight: bold;
font-size: 0.8em;
- color: #fff;
+ color: #999;
}
-ul#context li a {
- color: #ff9f00;
-}
-
ul#context li:last-child a {
- color: #fff;
+ color: #333;
}
ul.actions {
@@ -640,7 +635,8 @@
<li><a class="nav" href="">Log Out</a></li>
</ul>
- <a id="logo" href="{href}"><img src="resource?name=rhm-32x14.png"/></a>
+ <!-- <a id="logo" href="{href}"><img src="resource?name=rhm-32x14.png"/></a> -->
+ <a href="{href}">Home</a>
<ul id="context">{frames}</ul>
</div>
<div id="body">{mode}</div>
@@ -655,8 +651,7 @@
[MainView.html]
<div class="oblock">
<h1>
- <img src="resource?name=rhm-36.png"/>
- {title}
+ <img src="resource?name=mrg-36.png"/>{title}
</h1>
<ul class="TabSet tabs">{tabs}</ul>
Modified: mgmt/cumin/resources/broker-20.png
===================================================================
(Binary files differ)
Modified: mgmt/cumin/resources/broker-36.png
===================================================================
(Binary files differ)
Modified: mgmt/cumin/resources/cluster-20.png
===================================================================
(Binary files differ)
Modified: mgmt/cumin/resources/cluster-36.png
===================================================================
(Binary files differ)
Modified: mgmt/cumin/resources/favicon.ico
===================================================================
(Binary files differ)
Added: mgmt/cumin/resources/mrg-36.png
===================================================================
(Binary files differ)
Property changes on: mgmt/cumin/resources/mrg-36.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years, 1 month
rhmessaging commits: r1349 - in store/trunk/cpp: lib and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-11-21 09:07:18 -0500 (Wed, 21 Nov 2007)
New Revision: 1349
Modified:
store/trunk/cpp/docs/
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/tests/jrnl/
store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
Log:
Fix to correctly set the messageId after a resore based on the highest RID found in the journal.
Property changes on: store/trunk/cpp/docs
___________________________________________________________________
Name: svn:ignore
- Makefile.in
+ Makefile.in
Makefile
html
man
latex
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-11-21 04:11:54 UTC (rev 1348)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-11-21 14:07:18 UTC (rev 1349)
@@ -384,8 +384,10 @@
try
{
- jQueue->recover(prepared, key.id); // start recovery
+ u_int64_t highestRid = 0;
+ jQueue->recover(prepared, highestRid, key.id); // start recovery
recoverMessages(txn, registry, queue, prepared, messages);
+ messageIdSequence.reset(highestRid + 1);
jQueue->recover_complete(); // start journal.
} catch (const journal::jexception& e) {
THROW_STORE_EXCEPTION(std::string("Queue ") + queueName + ": recoverQueues() failed: " + e.what());
@@ -463,7 +465,6 @@
{
size_t preambleLength = sizeof(u_int32_t)/*header size*/;
- u_int64_t maxMessageId(1);
JournalImpl* jc = static_cast<JournalImpl*>(queue->getExternalQueueStore());
DataTokenImpl dtokp;
@@ -519,10 +520,6 @@
queue->recover(msg);
}
- if (dtokp.rid() > maxMessageId) {
- maxMessageId = dtokp.rid();
- }
-
dtokp.reset();
dtokp.set_wstate(DataTokenImpl::ENQ);
@@ -549,7 +546,6 @@
THROW_STORE_EXCEPTION(std::string("Queue ") + queue->getName() +
": recoverMessages() failed: " + e.what());
}
- messageIdSequence.reset(maxMessageId + 1);
}
RecoverableMessage::shared_ptr BdbMessageStore::getExternMessage(qpid::broker::RecoveryManager& recovery,
@@ -939,6 +935,7 @@
bool written = false;
unsigned aio_sleep_cnt = 0;
+ unsigned busy_sleep_cnt = 0;
while (!written)
{
JournalImpl* jc = static_cast<JournalImpl*>(queue->getExternalQueueStore());
@@ -962,13 +959,19 @@
if (dtokp.get()->wstate() >= DataTokenImpl::ENQ_SUBM)
written = true;
aio_sleep_cnt = 0;
+ busy_sleep_cnt = 0;
break;
case rhm::journal::RHM_IORES_AIO_WAIT:
if (++aio_sleep_cnt > MAX_AIO_SLEEPS)
- THROW_STORE_EXCEPTION("Timeout waiting for AIO");
+ THROW_STORE_EXCEPTION("Timeout waiting for AIO: RHM_IORES_AIO_WAIT");
usleep(AIO_SLEEP_TIME); // TODO move sleep to wait for IO in get events
jc->get_wr_events();
break;
+ case rhm::journal::RHM_IORES_BUSY:
+ if (++busy_sleep_cnt > MAX_AIO_SLEEPS)
+ THROW_STORE_EXCEPTION("Timeout waiting for mutex: RHM_IORES_BUSY");
+ usleep(AIO_SLEEP_TIME); // TODO add sleep time to get events call as option
+ break;
case rhm::journal::RHM_IORES_FULL:
// Temporary error msg till exception handler core problem solved...
std::cerr << "Error storing message -- Journal full on queue \"" << queue->getName() << "\"" << std::endl << std::flush;
@@ -1095,13 +1098,13 @@
break;
case rhm::journal::RHM_IORES_AIO_WAIT:
if (++aio_sleep_cnt > MAX_AIO_SLEEPS)
- THROW_STORE_EXCEPTION("Timeout waiting for AIO");
+ THROW_STORE_EXCEPTION("Timeout waiting for AIO: RHM_IORES_AIO_WAIT");
usleep(AIO_SLEEP_TIME); // TODO add sleep time to get events call as option
jc->get_wr_events();
break;
case rhm::journal::RHM_IORES_BUSY:
if (++busy_sleep_cnt > MAX_AIO_SLEEPS)
- THROW_STORE_EXCEPTION("Timeout waiting for AIO");
+ THROW_STORE_EXCEPTION("Timeout waiting for mutex: RHM_IORES_BUSY");
usleep(AIO_SLEEP_TIME); // TODO add sleep time to get events call as option
break;
default:
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2007-11-21 04:11:54 UTC (rev 1348)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2007-11-21 14:07:18 UTC (rev 1349)
@@ -71,8 +71,8 @@
void
JournalImpl::recover(std::deque<data_tok*>* rd_dtokl, const aio_cb rd_cb,
std::deque<data_tok*>* wr_dtokl, const aio_cb wr_cb,
- boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list, u_int64_t queue_id)
- throw (jexception)
+ boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list, u_int64_t& highest_rid,
+ u_int64_t queue_id) throw (jexception)
{
// Create list of prepared xids
std::vector<std::string> prep_xid_list;
@@ -81,7 +81,7 @@
prep_xid_list.push_back(i->xid);
}
- jcntl::recover(rd_dtokl, rd_cb, wr_dtokl, wr_cb, prep_xid_list);
+ jcntl::recover(rd_dtokl, rd_cb, wr_dtokl, wr_cb, prep_xid_list, highest_rid);
// Populate PreparedTransaction lists from _tmap
for (bdbstore::PreparedTransaction::list::iterator i = prep_tx_list.begin();
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2007-11-21 04:11:54 UTC (rev 1348)
+++ store/trunk/cpp/lib/JournalImpl.h 2007-11-21 14:07:18 UTC (rev 1349)
@@ -92,13 +92,13 @@
void recover(std::deque<journal::data_tok*>* rd_dtokl, const journal::aio_cb rd_cb,
std::deque<journal::data_tok*>* wr_dtokl, const journal::aio_cb wr_cb,
boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list,
- u_int64_t queue_id) throw (journal::jexception);
+ u_int64_t& highest_rid, u_int64_t queue_id) throw (journal::jexception);
void recover(boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list,
- u_int64_t queue_id) throw (journal::jexception)
+ u_int64_t& highest_rid, u_int64_t queue_id) throw (journal::jexception)
{
recover(&_aio_rd_cmpl_dtok_list, &aio_rd_callback, &_aio_wr_cmpl_dtok_list,
- &aio_wr_callback, prep_tx_list, queue_id);
+ &aio_wr_callback, prep_tx_list, highest_rid, queue_id);
}
// Temporary fn to read and save last msg read from journal so it can be assigned
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-11-21 04:11:54 UTC (rev 1348)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-11-21 14:07:18 UTC (rev 1349)
@@ -127,7 +127,8 @@
void
jcntl::recover(std::deque<data_tok*>* rdtoklp, const aio_cb rd_cb, std::deque<data_tok*>* wdtoklp,
- const aio_cb wr_cb, const std::vector<std::string>& prep_txn_list) throw (jexception)
+ const aio_cb wr_cb, const std::vector<std::string>& prep_txn_list, u_int64_t& highest_rid)
+ throw (jexception)
{
// Verify journal dir and journal files
_jdir.verify_dir();
@@ -135,6 +136,9 @@
_emap.clear();
_tmap.clear();
rcvr_janalyze(_rcvdat, prep_txn_list);
+ highest_rid = _rcvdat._h_rid;
+ if (_rcvdat._full)
+ throw jexception(jerrno::JERR_JCNTL_RECOVERJFULL, "jcntl", "recover_complete");
// Debug info, but may be useful to print with a flag
//_rcvdat.print();
@@ -174,7 +178,7 @@
jcntl::recover_complete() throw (jexception)
{
if (!_readonly_flag)
- throw jexception(jerrno::JERR_JCNTL_NOTRECOVERED, "jcntl", "recovered");
+ throw jexception(jerrno::JERR_JCNTL_NOTRECOVERED, "jcntl", "recover_complete");
for (u_int16_t i=0; i<JRNL_NUM_FILES; i++)
_datafh[i]->reset(&_rcvdat);
_wrfc.initialize(JRNL_NUM_FILES, (nlfh**)_datafh, &_rcvdat);
@@ -408,6 +412,12 @@
u_int16_t fid = rd._ffid;
std::ifstream ifs;
while (rcvr_get_next_record(fid, &ifs, rd));
+
+ // Check for journal full condition
+ u_int16_t next_wr_fid = (rd._lfid + 1) % JRNL_NUM_FILES;
+ if (rd._ffid == next_wr_fid && rd._enq_cnt_list[next_wr_fid])
+ rd._full = true;
+
std::vector<std::string> xid_list;
_tmap.xid_list(xid_list);
for (std::vector<std::string>::iterator itr = xid_list.begin(); itr != xid_list.end();
@@ -492,8 +502,9 @@
{
try
{
- _emap.get_remove_fid(dr.deq_rid());
- rd._enq_cnt_list[fid]--;
+ u_int16_t enq_fid = _emap.get_remove_fid(dr.deq_rid());
+//std::cout << enq_fid;
+ rd._enq_cnt_list[enq_fid]--;
}
catch (const jexception& e)
{
@@ -533,7 +544,7 @@
throw e;
}
if (itr->_enq_flag)
- rd._enq_cnt_list[fid]--;
+ rd._enq_cnt_list[itr->_fid]--;
}
free(xidp);
if (rd._h_rid < h._rid)
@@ -579,7 +590,7 @@
}
break;
case 0:
-//std::cout << " 0";
+//std::cout << " 0 ";
rd._lfid = fid;
rd._eo = ifsp->tellg();
return false;
@@ -668,8 +679,8 @@
;
}
}
+ intrusive_ptr_release(dtokp);
this_dtok_list.pop_front();
- intrusive_ptr_release(dtokp);
}
}
@@ -691,8 +702,8 @@
// cct call the recovery manager. / lazyload..
}
}
+ intrusive_ptr_release( dtokp);
this_dtok_list.pop_front();
- intrusive_ptr_release( dtokp);
}
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-21 04:11:54 UTC (rev 1348)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-21 14:07:18 UTC (rev 1349)
@@ -221,12 +221,13 @@
* AIO operations.
* \param wr_cb Function pointer to callback function for write operations. May be NULL.
* \param prep_txn_list
+ * \param highest_rid Returns the highest rid found in the journal during recover
*
* \exception TODO
*/
void recover(std::deque<data_tok*>* rdtoklp, const aio_cb rd_cb,
std::deque<data_tok*>* wdtoklp, const aio_cb wr_cb,
- const std::vector<std::string>& prep_txn_list) throw (jexception);
+ const std::vector<std::string>& prep_txn_list, u_int64_t& highest_rid) throw (jexception);
/**
* \brief Recover using internal default callbacks and data_tok lists.
@@ -235,10 +236,11 @@
*
* \exception TODO
*/
- void recover(const std::vector<std::string>& prep_txn_list) throw (jexception)
+ void recover(const std::vector<std::string>& prep_txn_list, u_int64_t& highest_rid)
+ throw (jexception)
{
recover(&_aio_rd_cmpl_dtok_list, &aio_rd_callback, &_aio_wr_cmpl_dtok_list,
- &aio_wr_callback, prep_txn_list);
+ &aio_wr_callback, prep_txn_list, highest_rid);
}
/**
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2007-11-21 04:11:54 UTC (rev 1348)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2007-11-21 14:07:18 UTC (rev 1349)
@@ -48,6 +48,7 @@
u_int16_t _lfid; ///< Last file id
size_t _eo; ///< End offset (first byte past last record)
u_int64_t _h_rid; ///< Highest rid found
+ bool _full; ///< Journal is full
std::vector<u_int32_t> _enq_cnt_list; ///< Number enqueued records found for each file
rcvdat():
@@ -57,6 +58,7 @@
_lfid(0),
_eo(0),
_h_rid(0),
+ _full(false),
_enq_cnt_list(JRNL_NUM_FILES, 0)
{}
@@ -68,6 +70,7 @@
_lfid=0;
_eo=0;
_h_rid=0;
+ _full = false;
for (unsigned f=0; f<_enq_cnt_list.size(); f++)
_enq_cnt_list[f] = 0;
}
@@ -84,6 +87,7 @@
std::cout << " End offset (_eo) = 0x" << std::hex << _eo << std::dec << " (" <<
(_eo/JRNL_DBLK_SIZE) << " dblks)" << std::endl;
std::cout << " Highest rid (_h_rid) = " << _h_rid << std::endl;
+ std::cout << " Journal full (_full) = " << (_full ? "TRUE" : "FALSE") << std::endl;
std::cout << " Enqueued records (txn & non-txn):" << std::endl;
for (unsigned i=0; i<_enq_cnt_list.size(); i++)
std::cout << " File " << i << ": " << _enq_cnt_list[i] << std::endl;
Property changes on: store/trunk/cpp/tests/jrnl
___________________________________________________________________
Name: svn:ignore
- .deps
.libs
Makefile
Makefile.in
jtest
unit_test_jerrno
unit_test_jexception
unit_test_jinf
+ .deps
.libs
Makefile
Makefile.in
jtest
unit_test_enq_map
unit_test_jerrno
unit_test_jexception
unit_test_jdir
unit_test_file_hdr
unit_test_jinf
unit_test_txn_map
Modified: store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-11-21 04:11:54 UTC (rev 1348)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-11-21 14:07:18 UTC (rev 1349)
@@ -81,6 +81,7 @@
try
{
vector<string> txn_list;
+ u_int64_t highest_rid;
char* test_name = "EmptyRecoverTest";
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
@@ -88,11 +89,11 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
jc.recover_complete();
}
}
@@ -135,6 +136,7 @@
JournalSystemTests::RecoverReadTest()
{
vector<string> txn_list;
+ u_int64_t highest_rid;
try
{
// Non-txn
@@ -147,7 +149,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
for (int m=0; m<NUM_MSGS; m++)
{
read_msg(&jc);
@@ -170,7 +172,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
for (int m=0; m<NUM_MSGS; m++)
{
read_msg(&jc);
@@ -192,6 +194,7 @@
JournalSystemTests::RecoveredReadTest()
{
vector<string> txn_list;
+ u_int64_t highest_rid;
try
{
// Non-txn
@@ -204,7 +207,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
for (int m=0; m<NUM_MSGS; m++)
{
read_msg(&jc);
@@ -235,7 +238,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
for (int m=0; m<NUM_MSGS; m++)
{
read_msg(&jc);
@@ -265,6 +268,7 @@
JournalSystemTests::RecoveredDequeueTest()
{
vector<string> txn_list;
+ u_int64_t highest_rid;
try
{
// Non-txn
@@ -277,7 +281,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
for (int m=0; m<NUM_MSGS; m++)
{
read_msg(&jc);
@@ -310,7 +314,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
for (int m=0; m<NUM_MSGS; m++)
{
read_msg(&jc);
@@ -342,6 +346,7 @@
JournalSystemTests::HeaderFlagsTest()
{
vector<string> txn_list;
+ u_int64_t highest_rid;
try
{
// Non-txn
@@ -364,7 +369,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
// Recover non-transient msgs
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
{
@@ -436,7 +441,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
// Recover non-transient msgs
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
{
@@ -497,6 +502,7 @@
JournalSystemTests::ComplexRecoveryTest1()
{
vector<string> txn_list;
+ u_int64_t highest_rid;
try
{
// Non-txn
@@ -523,7 +529,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
// Check that only last n readable (as before)
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
@@ -587,7 +593,7 @@
}
{
rhm::journal::jcntl jc(test_name, "jdata", test_name);
- jc.recover(txn_list);
+ jc.recover(txn_list, highest_rid);
// Check that only last n readable (as before)
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
17 years, 1 month
rhmessaging commits: r1348 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-11-20 23:11:54 -0500 (Tue, 20 Nov 2007)
New Revision: 1348
Added:
store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp
Modified:
store/trunk/cpp/lib/jrnl/txn_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.hpp
store/trunk/cpp/tests/jrnl/Makefile.am
Log:
Added another unit test, still needs work to complete, but works.
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2007-11-20 21:34:39 UTC (rev 1347)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2007-11-21 04:11:54 UTC (rev 1348)
@@ -117,6 +117,17 @@
return list;
}
+const bool
+txn_map::in_map(const std::string& xid)
+{
+ pthread_mutex_lock(&_mutex);
+ xmap_itr itr = _map.find(xid);
+ pthread_mutex_unlock(&_mutex);
+ if (itr == _map.end()) // not found in map
+ return false;
+ return true;
+}
+
const u_int32_t
txn_map::get_rid_count(const std::string& xid) throw (jexception)
{
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2007-11-20 21:34:39 UTC (rev 1347)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2007-11-21 04:11:54 UTC (rev 1348)
@@ -82,6 +82,7 @@
const bool insert_txn_data(const std::string& xid, const txn_data& td) throw (jexception);
const txn_data_list get_tdata_list(const std::string& xid) throw (jexception);
const txn_data_list get_remove_tdata_list(const std::string& xid) throw (jexception);
+ const bool in_map(const std::string& xid);
const u_int32_t get_rid_count(const std::string& xid) throw (jexception);
const bool is_txn_synced(const std::string& xid) throw (jexception);
const bool set_aio_compl(const std::string& xid, const u_int64_t rid) throw (jexception);
Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am 2007-11-20 21:34:39 UTC (rev 1347)
+++ store/trunk/cpp/tests/jrnl/Makefile.am 2007-11-21 04:11:54 UTC (rev 1348)
@@ -32,6 +32,7 @@
unit_test_jdir \
unit_test_file_hdr \
unit_test_enq_map \
+ unit_test_txn_map \
run-journal-tests
check_LTLIBRARIES = \
@@ -44,6 +45,7 @@
unit_test_jinf \
unit_test_jdir \
unit_test_enq_map \
+ unit_test_txn_map \
unit_test_file_hdr
unit_test_jexception_SOURCES = unit_test_jexception.cpp
@@ -64,6 +66,9 @@
unit_test_enq_map_SOURCES = unit_test_enq_map.cpp
unit_test_enq_map_LDFLAGS = -lboost_unit_test_framework -lbdbstore -lrt -L../../lib/.libs
+unit_test_txn_map_SOURCES = unit_test_txn_map.cpp
+unit_test_txn_map_LDFLAGS = -lboost_unit_test_framework -lbdbstore -lrt -L../../lib/.libs
+
JournalSystemTests_la_SOURCES = \
JournalSystemTests.cpp \
JournalSystemTests.hpp
Added: store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp 2007-11-21 04:11:54 UTC (rev 1348)
@@ -0,0 +1,126 @@
+/**
+* \file unit_test_txn_map.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* \author Kim van der Riet
+*
+* Copyright 2007 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#include <boost/test/results_reporter.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/test/unit_test_log.hpp>
+#include <iostream>
+#include <iomanip>
+#include <jrnl/txn_map.hpp>
+#include <sstream>
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+
+// Helper function declarations
+const std::string make_xid(u_int64_t rid);
+void check_td_equal(txn_data& td1, txn_data& td2);
+
+// Test functions of the form
+// void fn() {...}
+
+void test_constructor()
+{
+ const u_int64_t rid = 0x123456789abcdef0ULL;
+ const u_int64_t drid = 0xfedcba9876543210ULL;
+ const u_int16_t fid = 0xfedcU;
+ const bool enq_flag = true;
+ txn_data td(rid, drid, fid, enq_flag);
+ BOOST_CHECK_EQUAL(td._rid, rid);
+ BOOST_CHECK_EQUAL(td._drid, drid);
+ BOOST_CHECK_EQUAL(td._fid, fid);
+ BOOST_CHECK_EQUAL(td._enq_flag, enq_flag);
+ BOOST_CHECK_EQUAL(td._aio_compl, false);
+
+ txn_map t1;
+ BOOST_CHECK(t1.empty());
+ BOOST_CHECK_EQUAL(t1.size(), 0);
+}
+
+void test_insert_get()
+{
+ u_int16_t fid;
+ u_int64_t rid;
+ u_int16_t fid_start = 0x2000U;
+ u_int64_t rid_begin = 0xffffffff00000000ULL;
+ u_int64_t rid_end = 0xffffffff00000200ULL;
+
+ // insert with no dups
+ u_int64_t rid_incr_1 = 4ULL;
+ txn_map t2;
+ for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_1, fid++)
+ t2.insert_txn_data(make_xid(rid), txn_data(rid, ~rid, fid, false));
+ BOOST_CHECK(!t2.empty());
+ BOOST_CHECK_EQUAL(t2.size(), 128);
+
+ // get
+ u_int64_t rid_incr_2 = 6ULL;
+ for (u_int64_t rid = rid_begin; rid < rid_end; rid += rid_incr_2)
+ {
+ std::string xid = make_xid(rid);
+ BOOST_CHECK_EQUAL(t2.in_map(xid), (rid%rid_incr_1 ? false : true));
+ }
+}
+
+// Helper functions
+
+const std::string make_xid(u_int64_t rid)
+{
+ std::stringstream ss;
+ ss << "XID-" << std::setfill('0') << std::setw(16) << std::hex << rid;
+ ss << "-0123456789abcdef";
+ return ss.str();
+}
+
+void check_td_equal(txn_data& td1, txn_data& td2)
+{
+ BOOST_CHECK_EQUAL(td1._rid, td2._rid);
+ BOOST_CHECK_EQUAL(td1._drid, td2._drid);
+ BOOST_CHECK_EQUAL(td1._fid, td2._fid);
+ BOOST_CHECK_EQUAL(td1._enq_flag, td2._enq_flag);
+ BOOST_CHECK_EQUAL(td1._aio_compl, td2._aio_compl);
+}
+
+// Initialize test suite and include test functions
+
+test_suite* init_unit_test_suite(int, char**)
+{
+ std::cout << "--------" << std::endl << "unit_test_txn_map: ";
+ test_suite* ts = BOOST_TEST_SUITE("unit_test_txn_map");
+
+ results_reporter::set_level(SHORT_REPORT);
+ unit_test_log_t::instance().set_threshold_level(log_messages);
+
+ ts->add(BOOST_TEST_CASE(&test_constructor));
+ ts->add(BOOST_TEST_CASE(&test_insert_get));
+
+ return ts;
+}
17 years, 1 month