rhmessaging commits: r1397 - in mgmt: cumin/python/cumin and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-29 12:20:49 -0500 (Thu, 29 Nov 2007)
New Revision: 1397
Modified:
mgmt/cumin/bin/cumin-test
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/demo.py
mgmt/cumin/python/cumin/model.py
mgmt/mint/python/mint/__init__.py
Log:
Updates demo data to use the new mint model objects.
Modified: mgmt/cumin/bin/cumin-test
===================================================================
--- mgmt/cumin/bin/cumin-test 2007-11-29 17:20:24 UTC (rev 1396)
+++ mgmt/cumin/bin/cumin-test 2007-11-29 17:20:49 UTC (rev 1397)
@@ -66,18 +66,13 @@
from cumin.demo import *
from cumin.model import *
-def do_main(port, broker, bench_hits, debug=True, demodata=True):
+def do_main(port, broker, bench_hits, debug=True):
model = DummyModel()
app = Cumin(model)
if broker:
app.add_managed_broker(broker)
- if demodata:
- data = DemoData(model)
- data.load()
- data.start_updates()
-
if debug or bench_hits:
app.enable_debug()
@@ -94,7 +89,6 @@
in_profile = "profile" in args
in_debug = "no-debug" not in args
in_bench = "bench" in args and int(args.get("bench", None) or 1000) or 0
- in_demodata = "no-demo-data" not in args
if in_profile:
from profile import Profile
@@ -104,7 +98,7 @@
try:
statement = "do_main(%i, %i, %r, %r)" % \
- (in_port, in_bench, in_debug, in_demodata)
+ (in_port, in_bench, in_debug)
prof.run(statement)
@@ -127,7 +121,7 @@
stats.strip_dirs()
else:
try:
- do_main(in_port, in_broker, in_bench, in_debug, in_demodata)
+ do_main(in_port, in_broker, in_bench, in_debug)
except KeyboardInterrupt:
pass
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-11-29 17:20:24 UTC (rev 1396)
+++ mgmt/cumin/python/cumin/__init__.py 2007-11-29 17:20:49 UTC (rev 1397)
@@ -61,11 +61,6 @@
class CuminServer(WebServer):
def __init__(self, port=9090):
model = DummyModel()
-
- data = DemoData(model)
- data.load()
- data.start_updates()
-
app = Cumin(model)
super(CuminServer, self).__init__(app, port)
Modified: mgmt/cumin/python/cumin/demo.py
===================================================================
--- mgmt/cumin/python/cumin/demo.py 2007-11-29 17:20:24 UTC (rev 1396)
+++ mgmt/cumin/python/cumin/demo.py 2007-11-29 17:20:49 UTC (rev 1397)
@@ -2,165 +2,65 @@
from threading import Thread
from random import sample, random, randint
-from model import *
+#from model import *
+from mint import *
def fmt(str_, int_):
return "%s%02i" % (str_, int_)
class DemoData(object):
- def __init__(self, model, mult=5):
- self.model = model
+ def __init__(self, mult=5):
self.mult = mult
def load(self):
- # XXX need some locking in here
-
- gtypes = dict()
groups = dict()
- for name in ("Geography", "Department"):
- sgtype = BrokerGroupType(self.model)
- sgtype.name = name
- gtypes[name] = sgtype
-
- for name in ("West Coast", "East Coast"):
- group = BrokerGroup(self.model)
+ for name in ("West Coast", "East Coast", "Marketing", "Sales"):
+ group = BrokerGroup()
group.name = name
- group.set_type(gtypes["Geography"])
groups[name] = group
- for name in ("Marketing", "Sales"):
- group = BrokerGroup(self.model)
- group.name = name
- group.set_type(gtypes["Department"])
- groups[name] = group
-
profiles = list()
for name in ("4S Xserve", "2S ProLiant"):
- profile = BrokerProfile(self.model)
+ profile = BrokerProfile()
profile.name = name
profiles.append(profile)
- self.load_props(profile)
+ #self.load_props(profile)
- # vhost templates
- for name in ("test", "devel"):
- vhost = VirtualHost(self.model)
- vhost.name = name
-
- self.load_vhost(vhost)
-
clusters = list()
for cluster_count in range(3):
- cluster = BrokerCluster(self.model)
+ cluster = BrokerCluster()
cluster.name = fmt("cluster", cluster_count)
clusters.append(cluster)
- vhost = VirtualHost(self.model)
- vhost.name = "default"
- vhost.set_broker_cluster(cluster)
-
- for name in ("test", "devel"):
- vhost = VirtualHost(self.model)
- vhost.name = name
- vhost.set_broker_cluster(cluster)
-
- self.load_vhost(vhost)
-
- for broker_count in range(12):
- broker = Broker(self.model)
- broker.name = fmt("broker", broker_count)
-
- self.load_props(broker)
-
- index = broker_count % 4
- if index < 3:
- broker.set_broker_cluster(clusters[index])
-
- index = broker_count % 3
- if index < 2:
- broker.set_broker_profile(profiles[index])
-
- if broker_count % 2:
- groups["East Coast"].add_broker(broker)
- else:
- groups["West Coast"].add_broker(broker)
-
- if broker_count % 4 < 2:
- groups["Marketing"].add_broker(broker)
- else:
- groups["Sales"].add_broker(broker)
-
- vhost = VirtualHost(self.model)
- vhost.name = "default"
- vhost.set_broker(broker)
- broker.default_virtual_host = vhost
-
- for name in ("test", "devel"):
- vhost = VirtualHost(self.model)
- vhost.name = name
- vhost.set_broker(broker)
-
- for vhost in broker.virtual_host_items():
- self.load_vhost(vhost)
-
def load_props(self, obj):
- prop = ConfigProperty(self.model)
+ prop = ConfigProperty()
prop.name = "max_threads"
prop.value = 1000
prop.broker_value = 1000
prop.type = "integer"
obj.add_config_property(prop)
- prop = ConfigProperty(self.model)
+ prop = ConfigProperty()
prop.name = "max_memory"
prop.value = 1000000
prop.broker_value = 2000000
prop.type = "integer"
obj.add_config_property(prop)
- prop = ConfigProperty(self.model)
+ prop = ConfigProperty()
prop.name = "ssl_enabled"
prop.value = True
prop.broker_value = True
prop.type = "boolean"
obj.add_config_property(prop)
- def load_vhost(self, vhost):
- for name in ("amq.direct", "amq.fanout",
- "amq.topic", "amq.match"):
- exchange = Exchange(self.model)
- exchange.name = name
- vhost.add_exchange(exchange)
-
- for producer_count in range(self.mult):
- producer = Producer(self.model)
- producer.name = fmt("producer", producer_count)
- exchange.add_producer(producer)
-
- for queue_count in range(self.mult):
- queue = Queue(self.model)
- queue.name = fmt("queue", queue_count)
- vhost.add_queue(queue)
-
- for consumer_count in range(self.mult):
- consumer = Consumer(self.model)
- consumer.name = fmt("consumer", consumer_count)
- queue.add_consumer(consumer)
-
- for num in range(100, 100 + self.mult * 10, 10):
- client = Client(self.model)
- client.address = "192.168.0.%i:16565" % num
- vhost.add_client(client)
-
- for session_count in range(self.mult):
- session = Session(self.model)
- session.name = fmt("session", session_count)
- client.add_session(session)
-
def start_updates(self):
+ raise Exception()
+
thread = UpdateThread(self.model)
thread.start()
@@ -239,15 +139,21 @@
if __name__ == "__main__":
import sys
-
- model = DummyModel()
- data = DemoData(model)
+ try:
+ connuri = sys.argv[1]
+ conn = connectionForURI(connuri)
+ sqlhub.processConnection = conn
+ except IndexError:
+ print "Usage: demo.py DATABASE-URI"
+ sys.exit(1)
+
+ data = DemoData()
data.load()
- sys.stdout.write("<?xml version=\"1.0\"?><model>")
+ #sys.stdout.write("<?xml version=\"1.0\"?><model>")
- for broker in model.get_brokers():
- broker.write_xml(sys.stdout)
+ #for broker in model.get_brokers():
+ # broker.write_xml(sys.stdout)
- sys.stdout.write("</model>")
+ #sys.stdout.write("</model>")
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-29 17:20:24 UTC (rev 1396)
+++ mgmt/cumin/python/cumin/model.py 2007-11-29 17:20:49 UTC (rev 1397)
@@ -523,12 +523,6 @@
for measure in self.measurements:
measure.write_xml(writer)
-class BrokerCluster(DummyModelObject):
- def __init__(self, model):
- super(BrokerCluster, self).__init__(model, model.broker_cluster)
-
- self.name = None
-
class Broker(DummyModelObject):
def __init__(self, model):
super(Broker, self).__init__(model, model.broker)
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-29 17:20:24 UTC (rev 1396)
+++ mgmt/mint/python/mint/__init__.py 2007-11-29 17:20:49 UTC (rev 1397)
@@ -16,30 +16,30 @@
pass
class BrokerRegistration(SQLObject):
- name = StringCol(length=1000)
- host = StringCol(length=1000)
- port = SmallIntCol()
+ name = StringCol(length=1000, default=None)
+ host = StringCol(length=1000, default=None)
+ port = SmallIntCol(default=None)
broker = ForeignKey("Broker", cascade="null", default=None)
class BrokerGroup(SQLObject):
- name = StringCol(length=1000)
+ name = StringCol(length=1000, default=None)
BrokerGroup.sqlmeta.addJoin(MultipleJoin("Broker", joinMethodName="brokers"))
class BrokerCluster(SQLObject):
- name = StringCol(length=1000)
+ name = StringCol(length=1000, default=None)
BrokerCluster.sqlmeta.addJoin(MultipleJoin("Broker", joinMethodName="brokers"))
class BrokerProfile(SQLObject):
- name = StringCol(length=1000)
+ name = StringCol(length=1000, default=None)
BrokerProfile.sqlmeta.addJoin(MultipleJoin("Broker", joinMethodName="brokers"))
class ConfigProperty(SQLObject):
- name = StringCol(length=1000)
- value = StringCol(length=1000)
- type = StringCol(length=1)
+ name = StringCol(length=1000, default=None)
+ value = StringCol(length=1000, default=None)
+ type = StringCol(length=1, default="s")
class OriginalIdDict:
def __init__(self):
17 years, 1 month
rhmessaging commits: r1396 - mgmt/mint/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-29 12:20:24 -0500 (Thu, 29 Nov 2007)
New Revision: 1396
Removed:
mgmt/mint/bin/parse
Log:
Removes a script that we no longer use.
Deleted: mgmt/mint/bin/parse
===================================================================
--- mgmt/mint/bin/parse 2007-11-29 16:57:57 UTC (rev 1395)
+++ mgmt/mint/bin/parse 2007-11-29 17:20:24 UTC (rev 1396)
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-# generate Python
-echo "Generating Python code..."
-python -c "
-from schemaparser import *
-parser = SchemaParser()
-parser.generateCode()
-"
-
-# generate SQL
-echo "Generating SQL code..."
-
-SQLOUTPUT=schema.sql
-
-PYTHONPATH=. sqlobject-admin sql -m schema > $SQLOUTPUT
-RESULT=`grep "circular reference" $SQLOUTPUT | wc -l`
-if [[ $RESULT -gt 0 ]]; then
- mv $SQLOUTPUT $SQLOUTPUT.1
- tail -n+3 $SQLOUTPUT.1 > $SQLOUTPUT
- rm $SQLOUTPUT.1
-fi
-
-echo "Done."
17 years, 1 month
rhmessaging commits: r1395 - store/trunk/cpp.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-29 11:57:57 -0500 (Thu, 29 Nov 2007)
New Revision: 1395
Modified:
store/trunk/cpp/mrg.spec
Log:
rename top level packages
Modified: store/trunk/cpp/mrg.spec
===================================================================
--- store/trunk/cpp/mrg.spec 2007-11-29 16:57:16 UTC (rev 1394)
+++ store/trunk/cpp/mrg.spec 2007-11-29 16:57:57 UTC (rev 1395)
@@ -7,9 +7,9 @@
URL: http://redhat.com/mrg
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-Requires: rhm
-Requires: rhrt
-Requires: rhg
+Requires: mrg-messaging
+Requires: mrg-realtime
+Requires: mrg-grid
%description
This is the top-level package that includes all the MRG components: Messaging,
17 years, 1 month
rhmessaging commits: r1394 - store/trunk/cpp.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-29 11:57:16 -0500 (Thu, 29 Nov 2007)
New Revision: 1394
Added:
store/trunk/cpp/mrg-grid.spec
store/trunk/cpp/mrg-messaging.spec
Removed:
store/trunk/cpp/rhg.spec
Log:
rename top level packages
Added: store/trunk/cpp/mrg-grid.spec
===================================================================
--- store/trunk/cpp/mrg-grid.spec (rev 0)
+++ store/trunk/cpp/mrg-grid.spec 2007-11-29 16:57:16 UTC (rev 1394)
@@ -0,0 +1,32 @@
+Summary: MRG - Grid component
+Name: mrg-grid
+Version: 1.0
+Release: 1%{?dist}
+License: LGPL
+Group: System Environment/Libraries
+URL: http://redhat.com/mrg
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: condor
+
+%description
+This is the top-level package that includes the MRG Grid component.
+
+%install
+rm -rf %{buildroot}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%prep
+
+%build
+
+%files
+%defattr(-,root,root,-)
+
+
+%changelog
+* Wed Nov 28 2007 Nuno Santos <nsantos(a)redhat.com> - 1.0-1
+- Initial build.
+
Added: store/trunk/cpp/mrg-messaging.spec
===================================================================
--- store/trunk/cpp/mrg-messaging.spec (rev 0)
+++ store/trunk/cpp/mrg-messaging.spec 2007-11-29 16:57:16 UTC (rev 1394)
@@ -0,0 +1,36 @@
+Summary: MRG - Messaging component
+Name: mrg-messaging
+Version: 1.0
+Release: 1%{?dist}
+License: LGPL
+Group: System Environment/Libraries
+URL: http://redhat.com/mrg
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: rhm
+Requires: rhm-docs
+Requires: python-qpid
+Requires: qpid-java-client
+
+
+%description
+This is the top-level package that includes the MRG Grid component.
+
+%install
+rm -rf %{buildroot}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%prep
+
+%build
+
+%files
+%defattr(-,root,root,-)
+
+
+%changelog
+* Wed Nov 28 2007 Nuno Santos <nsantos(a)redhat.com> - 1.0-1
+- Initial build.
+
Deleted: store/trunk/cpp/rhg.spec
===================================================================
--- store/trunk/cpp/rhg.spec 2007-11-29 16:44:35 UTC (rev 1393)
+++ store/trunk/cpp/rhg.spec 2007-11-29 16:57:16 UTC (rev 1394)
@@ -1,32 +0,0 @@
-Summary: MRG - Grid component
-Name: rhg
-Version: 1.0
-Release: 1%{?dist}
-License: LGPL
-Group: System Environment/Libraries
-URL: http://redhat.com/mrg
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-Requires: condor
-
-%description
-This is the top-level package that includes the MRG Grid component.
-
-%install
-rm -rf %{buildroot}
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%prep
-
-%build
-
-%files
-%defattr(-,root,root,-)
-
-
-%changelog
-* Wed Nov 28 2007 Nuno Santos <nsantos(a)redhat.com> - 1.0-1
-- Initial build.
-
17 years, 1 month
rhmessaging commits: r1393 - mgmt/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-29 11:44:35 -0500 (Thu, 29 Nov 2007)
New Revision: 1393
Added:
mgmt/bin/devel-reload-database
Log:
Adds a script to drop and reload the schema.
Added: mgmt/bin/devel-reload-database
===================================================================
--- mgmt/bin/devel-reload-database (rev 0)
+++ mgmt/bin/devel-reload-database 2007-11-29 16:44:35 UTC (rev 1393)
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+if [ -z "$1" ]; then
+ echo "Usage: devel-reload-database DATABASE-NAME"
+ exit 1
+fi
+
+psql -d "$1" -c "drop schema public cascade; create schema public"
+psql -d "$1" -f "$DEVEL_HOME"/mint/python/mint/schema.sql
Property changes on: mgmt/bin/devel-reload-database
___________________________________________________________________
Name: svn:executable
+ *
17 years, 1 month
rhmessaging commits: r1392 - mgmt/misc.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-29 10:06:17 -0500 (Thu, 29 Nov 2007)
New Revision: 1392
Removed:
mgmt/misc/chart.py
mgmt/misc/mint-test.py
Log:
Deletes some code we no longer want.
Deleted: mgmt/misc/chart.py
===================================================================
--- mgmt/misc/chart.py 2007-11-29 14:58:41 UTC (rev 1391)
+++ mgmt/misc/chart.py 2007-11-29 15:06:17 UTC (rev 1392)
@@ -1,39 +0,0 @@
-from cairo import *
-from random import random
-
-width, height = (600, 150)
-
-surface = ImageSurface(FORMAT_ARGB32, width, height)
-
-ctx = Context(surface)
-
-ctx.set_line_width(2)
-ctx.set_source_rgb(1, 0, 0)
-
-y = 0
-
-for x in range(0, width, 10):
- change = 2 + (random() * 3)
-
- if random() > 0.40:
- if y < height - change:
- y += change
-
- else:
- if y > change:
- y -= change
-
- ctx.line_to(x, y)
-
-ctx.stroke()
-
-ctx.set_line_width(0.8)
-ctx.set_source_rgb(0.8, 0.8, 0.8)
-
-for x in range(0, width, 50):
- ctx.move_to(x, 0)
- ctx.line_to(x, height)
-
-ctx.stroke()
-
-surface.write_to_png("chart.png")
Deleted: mgmt/misc/mint-test.py
===================================================================
--- mgmt/misc/mint-test.py 2007-11-29 14:58:41 UTC (rev 1391)
+++ mgmt/misc/mint-test.py 2007-11-29 15:06:17 UTC (rev 1392)
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-from qpid.management import ManagedBroker
-from schema import *
-from time import sleep
-from datetime import *
-from sqlobject import *
-
-conn_uri = "postgresql://jross@localhost/mint"
-conn = connectionForURI(conn_uri)
-sqlhub.processConnection = conn
-
-broker_address = "dhcp83-108.boston.redhat.com:10001"
-
-def getQueueByName(name, create=False):
- try:
- queues = Queue.selectBy(name=name)[:1]
- queue = queues[0]
- except IndexError:
- if (create): queue = Queue()
- return queue
-
-def configCallback(broker, oid, list, timestamps):
- print "broker=" + broker
- if oid == 4:
- print list
- d = dict(list)
- queue = getQueueByName(d["name"], True)
- queue.set(**d)
- recOn = datetime.fromtimestamp(timestamps[0]/1000000000)
- createdOn = datetime.fromtimestamp(timestamps[1]/1000000000)
- queue.set(recTime=recOn,creationTime=createdOn)
- print queue.id
- print " -> " + d["name"]
- return queue
-
-def instCallback(broker, oid, list, timestamps):
- print "broker=" + broker
- if oid == 4:
- print list
- d = dict(list)
- queue = getQueueByName(d.pop("name"))
- d["mgmtQueue"] = queue.id
- recOn = datetime.fromtimestamp(timestamps[0]/1000000000)
- queueStats = MgmtQueueStats()
- queueStats.set(recTime=recOn)
- queueStats.set(**d)
- if (timestamps[2] != 0):
- deletedOn = datetime.fromtimestamp(timestamps[2]/1000000000)
- queue.set(deletionTime=deletedOn)
- print queue.id
- return queueStats
-
-
-host, port = broker_address.split(":")
-target1 = ManagedBroker(host=host, port=int(port))
-target1.configListener(broker_address, configCallback)
-target1.instrumentationListener(broker_address, instCallback)
-
-target1.start ()
-
-while 1:
- sleep (1)
17 years, 1 month
rhmessaging commits: r1391 - in mgmt: mint and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-29 09:58:41 -0500 (Thu, 29 Nov 2007)
New Revision: 1391
Modified:
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/measurement.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/parameters.py
mgmt/mint/Makefile
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schema.sql
Log:
Introduces management-side-only schema types such as BrokerGroup.
Makes all mint classes, management side or generated accessible via
the mint module.
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/cumin/python/cumin/__init__.py 2007-11-29 14:58:41 UTC (rev 1391)
@@ -7,7 +7,6 @@
from wooly.devel import DevelPage
from wooly.parameters import IntegerParameter
from mint import *
-from mint.schema import *
from sqlobject.main import *
from model import DummyModel, CuminModel
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/cumin/python/cumin/broker.py 2007-11-29 14:58:41 UTC (rev 1391)
@@ -1,4 +1,4 @@
-import mint.schema as mint
+import mint
from wooly import *
from wooly.widgets import *
from random import random
Modified: mgmt/cumin/python/cumin/measurement.py
===================================================================
--- mgmt/cumin/python/cumin/measurement.py 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/cumin/python/cumin/measurement.py 2007-11-29 14:58:41 UTC (rev 1391)
@@ -1,6 +1,6 @@
from wooly import *
from wooly.widgets import *
-from mint.schema import *
+from mint import *
from widgets import *
from parameters import *
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/cumin/python/cumin/model.py 2007-11-29 14:58:41 UTC (rev 1391)
@@ -1,4 +1,4 @@
-import mint.schema as mint
+import mint
from wooly import *
from wooly.model import *
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/cumin/python/cumin/parameters.py 2007-11-29 14:58:41 UTC (rev 1391)
@@ -1,5 +1,5 @@
from wooly import *
-from mint.schema import *
+from mint import *
class BrokerClusterParameter(Parameter):
def do_unmarshal(self, string):
Modified: mgmt/mint/Makefile
===================================================================
--- mgmt/mint/Makefile 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/mint/Makefile 2007-11-29 14:58:41 UTC (rev 1391)
@@ -16,4 +16,4 @@
python python/mint/schemaparser.py ${MINT_XML_SCHEMA} python/mint/schema.py ${dsn}
schema-sql: python/mint/schema.py
- sqlobject-admin sql -m mint.schema -c ${dsn} | sed -e '1,2d' > python/mint/schema.sql
+ sqlobject-admin sql -m mint -m mint.schema -c ${dsn} | sed -e '1,2d' > python/mint/schema.sql
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/mint/python/mint/__init__.py 2007-11-29 14:58:41 UTC (rev 1391)
@@ -2,8 +2,45 @@
from datetime import *
from sqlobject import *
-import schema
+from mint import schema
+this_mod = __import__(__name__)
+
+for item in dir(schema):
+ cls = getattr(schema, item)
+
+ try:
+ if issubclass(cls, SQLObject) and cls is not SQLObject:
+ setattr(this_mod, item, cls)
+ except TypeError:
+ pass
+
+class BrokerRegistration(SQLObject):
+ name = StringCol(length=1000)
+ host = StringCol(length=1000)
+ port = SmallIntCol()
+ broker = ForeignKey("Broker", cascade="null", default=None)
+
+class BrokerGroup(SQLObject):
+ name = StringCol(length=1000)
+
+BrokerGroup.sqlmeta.addJoin(MultipleJoin("Broker", joinMethodName="brokers"))
+
+class BrokerCluster(SQLObject):
+ name = StringCol(length=1000)
+
+BrokerCluster.sqlmeta.addJoin(MultipleJoin("Broker", joinMethodName="brokers"))
+
+class BrokerProfile(SQLObject):
+ name = StringCol(length=1000)
+
+BrokerProfile.sqlmeta.addJoin(MultipleJoin("Broker", joinMethodName="brokers"))
+
+class ConfigProperty(SQLObject):
+ name = StringCol(length=1000)
+ value = StringCol(length=1000)
+ type = StringCol(length=1)
+
class OriginalIdDict:
def __init__(self):
self.idMap = dict()
@@ -86,7 +123,7 @@
# needs special handling until schema is sendind info about systems
d.pop("systemRef")
# d["system"] = connectedBroker.getByOriginalId(System, 0)
- d["system"] = schema.System.selectBy(idOriginal=0)[:1][0]
+ d["system"] = System.selectBy(idOriginal=0)[:1][0]
connectedBroker.objs.set(0, d["system"])
else:
parentKey = self.findParentKey(d)
Modified: mgmt/mint/python/mint/schema.sql
===================================================================
--- mgmt/mint/python/mint/schema.sql 2007-11-29 14:57:02 UTC (rev 1390)
+++ mgmt/mint/python/mint/schema.sql 2007-11-29 14:58:41 UTC (rev 1391)
@@ -1,3 +1,33 @@
+CREATE TABLE broker_cluster (
+ id SERIAL PRIMARY KEY,
+ name VARCHAR(1000)
+);
+
+CREATE TABLE broker_group (
+ id SERIAL PRIMARY KEY,
+ name VARCHAR(1000)
+);
+
+CREATE TABLE broker_profile (
+ id SERIAL PRIMARY KEY,
+ name VARCHAR(1000)
+);
+
+CREATE TABLE broker_registration (
+ id SERIAL PRIMARY KEY,
+ name VARCHAR(1000),
+ host VARCHAR(1000),
+ port SMALLINT,
+ broker_id INT
+);
+
+CREATE TABLE config_property (
+ id SERIAL PRIMARY KEY,
+ name VARCHAR(1000),
+ value VARCHAR(1000),
+ type VARCHAR(1)
+);
+
CREATE TABLE binding (
id SERIAL PRIMARY KEY,
id_original BIGINT,
@@ -337,6 +367,8 @@
vhost_id INT
);
+ALTER TABLE broker_registration ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker (id) ON DELETE SET NULL;
+
ALTER TABLE binding ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
ALTER TABLE binding ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
17 years, 1 month
rhmessaging commits: r1390 - mgmt/bin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-29 09:57:02 -0500 (Thu, 29 Nov 2007)
New Revision: 1390
Modified:
mgmt/bin/quirk
Log:
Minor fixes.
Modified: mgmt/bin/quirk
===================================================================
--- mgmt/bin/quirk 2007-11-29 14:51:02 UTC (rev 1389)
+++ mgmt/bin/quirk 2007-11-29 14:57:02 UTC (rev 1390)
@@ -1,8 +1,6 @@
#!/usr/bin/env python
import sys, qpid
-from qpid.client import Client
-from qpid.content import Content
class Exchange(object):
def __init__(self, session, name):
@@ -15,19 +13,21 @@
self.name = name
class Subscription(object):
- def __init__(self, session, queue, name):
+ def __init__(self, session, name, queue):
self.session = session
+ self.name = name
self.queue = queue
- self.name = name
# XXX what all does this do? it seems to declare things
# XXX what is the destination arg for?
+
# XXX from reading the spec, "destination" seems less
# appropriate than "subscription name" (which is what the spec
# ch. 25 docs say it is)
- session.csession.message_subscribe(queue="test", destination=self.name)
+ session.csession.message_subscribe(queue="test",
+ destination=self.name)
session.csession.message_flow(self.name, 0, 0xFFFFFFFF)
session.csession.message_flow(self.name, 1, 0xFFFFFFFF)
@@ -41,7 +41,7 @@
class Message(object):
def __init__(self, body=""):
- self.content = Content(body)
+ self.content = qpid.content.Content(body)
self.content["content_type"] = "text/plain"
def set_routing_key(self, key):
@@ -69,7 +69,7 @@
def declare(self, object):
if object.__class__ is Queue:
- #XXX blows up without queue=
+ # XXX blows up without queue=
self.csession.queue_declare(queue=object.name)
elif object.__class__ is Exchange:
self.csession.exchange_declare(exchange=object.name)
@@ -95,9 +95,11 @@
self.csession.message_transfer(destination="",
content=message.content)
+ else:
+ raise Exception()
def direct_with_explicit_exchange(host, port):
- client = Client(host, port)
+ client = qpid.client.Client(host, port)
client.start({"LOGIN": "guest", "PASSWORD": "guest"})
session = Session(client, client.session())
@@ -106,7 +108,7 @@
try:
q = Queue(session, "test")
e = Exchange(session, "amq.direct")
- s = Subscription(session, q, "s")
+ s = Subscription(session, "s", q)
session.declare(q)
session.bind(q, e)
@@ -116,7 +118,7 @@
m = Message("Test message " + str(i))
- # XXX make this an arg publish, instead?
+ # XXX make this an arg to publish, instead?
m.set_routing_key(q.name)
session.publish(m, e)
@@ -133,7 +135,7 @@
session.close()
def direct_with_implicit_exchange(host, port):
- client = Client(host, port)
+ client = qpid.client.Client(host, port)
client.start({"LOGIN": "guest", "PASSWORD": "guest"})
# Now, simpler, using the default exchange:
@@ -143,7 +145,7 @@
try:
q = Queue(session, "test")
- s = Subscription(session, q, "s")
+ s = Subscription(session, "s", q)
session.declare(q)
17 years, 1 month
rhmessaging commits: r1389 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-11-29 09:51:02 -0500 (Thu, 29 Nov 2007)
New Revision: 1389
Modified:
store/trunk/cpp/lib/jrnl/deq_rec.cpp
store/trunk/cpp/lib/jrnl/deq_rec.hpp
store/trunk/cpp/lib/jrnl/enq_rec.cpp
store/trunk/cpp/lib/jrnl/enq_rec.hpp
store/trunk/cpp/lib/jrnl/file_hdr.cpp
store/trunk/cpp/lib/jrnl/file_hdr.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/jerrno.cpp
store/trunk/cpp/lib/jrnl/jerrno.hpp
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/lib/jrnl/jinf.hpp
store/trunk/cpp/lib/jrnl/pmgr.cpp
store/trunk/cpp/lib/jrnl/pmgr.hpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/txn_rec.cpp
store/trunk/cpp/lib/jrnl/txn_rec.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/lib/jrnl/wrfc.cpp
store/trunk/cpp/lib/jrnl/wrfc.hpp
store/trunk/cpp/tests/jrnl/unit_test_file_hdr.cpp
store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp
Log:
BZ401151: Replaced system of relying on RIDs for recovery to the use of an odd/even flag in the headers to detect the correct starting point for recovery and the overwrite boundary. Also fixed bug in reading already dequeued records (via skip) which did not check for eof condition
Modified: store/trunk/cpp/lib/jrnl/deq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/deq_rec.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/deq_rec.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -44,15 +44,15 @@
{
deq_rec::deq_rec():
- _deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, 0, 0, 0, 0),
+ _deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, 0, 0, 0, false),
_xidp(NULL),
_buff(NULL),
_deq_tail(_deq_hdr._hdr)
{}
deq_rec::deq_rec(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen):
- _deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, 0, rid, drid, xidlen),
+ const size_t xidlen, const bool owi):
+ _deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, rid, drid, xidlen, owi),
_xidp(xidp),
_buff(NULL),
_deq_tail(_deq_hdr._hdr)
@@ -74,9 +74,10 @@
void
deq_rec::reset(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen)
+ const size_t xidlen, const bool owi)
{
_deq_hdr._hdr._rid = rid;
+ _deq_hdr.set_owi(owi);
_deq_hdr._deq_rid = drid;
_deq_hdr._xidsize = xidlen;
_deq_tail._rid = rid;
Modified: store/trunk/cpp/lib/jrnl/deq_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/deq_rec.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/deq_rec.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -65,14 +65,14 @@
deq_rec();
// constructor used for write operations, where xid already exists
deq_rec(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen);
+ const size_t xidlen, const bool owi);
virtual ~deq_rec();
// Prepare instance for use in reading data from journal
void reset();
// Prepare instance for use in writing data to journal
void reset(const u_int64_t rid, const u_int64_t drid, const void* const xidp,
- const size_t xidlen);
+ const size_t xidlen, const bool owi);
const u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks)
throw (jexception);
const u_int32_t decode(hdr& h, void* rptr, u_int32_t rec_offs_dblks,
Modified: store/trunk/cpp/lib/jrnl/enq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/enq_rec.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -46,7 +46,7 @@
// Constructor used for read operations, where buf contains preallocated space to receive data.
enq_rec::enq_rec():
jrec(), // superclass
- _enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, 0, 0, 0),
+ _enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, 0, 0, 0, false, false),
_xidp(NULL),
_data(NULL),
_buff(NULL),
@@ -55,9 +55,9 @@
// Constructor used for transactional write operations, where dbuf contains data to be written.
enq_rec::enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, bool transient):
+ const void* const xidp, const size_t xidlen, const bool owi, const bool transient):
jrec(), // superclass
- _enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, rid, xidlen, dlen, transient),
+ _enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, rid, xidlen, dlen, owi, transient),
_xidp(xidp),
_data(dbuf),
_buff(NULL),
@@ -73,6 +73,7 @@
enq_rec::reset()
{
_enq_hdr._hdr._rid = 0;
+ _enq_hdr.set_owi(false);
_enq_hdr.set_transient(false);
_enq_hdr._xidsize = 0;
_enq_hdr._dsize = 0;
@@ -86,9 +87,11 @@
// be written.
void
enq_rec::reset(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, const bool transient, const bool external)
+ const void* const xidp, const size_t xidlen, const bool owi, const bool transient,
+ const bool external)
{
_enq_hdr._hdr._rid = rid;
+ _enq_hdr.set_owi(owi);
_enq_hdr.set_transient(transient);
_enq_hdr.set_external(external);
_enq_hdr._xidsize = xidlen;
Modified: store/trunk/cpp/lib/jrnl/enq_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/enq_rec.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -71,7 +71,7 @@
* \brief Constructor used for write operations, where mbuf contains data to be written.
*/
enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, bool transient);
+ const void* const xidp, const size_t xidlen, const bool owi, const bool transient);
/**
* \brief Destructor
@@ -82,7 +82,7 @@
void reset();
// Prepare instance for use in writing data to journal
void reset(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const void* const xidp, const size_t xidlen, const bool transient,
+ const void* const xidp, const size_t xidlen, const bool owi, const bool transient,
const bool external);
const u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks)
Modified: store/trunk/cpp/lib/jrnl/file_hdr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/file_hdr.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -52,7 +52,7 @@
_rid(0)
{}
-hdr::hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag, const u_int64_t rid):
+hdr::hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid, const bool owi):
_magic(magic),
_version(version),
#if defined(JRNL_BIG_ENDIAN)
@@ -60,7 +60,7 @@
#else
_eflag(RHM_LENDIAN_FLAG),
#endif
- _uflag(uflag),
+ _uflag(owi ? HDR_OVERWRITE_INDICATOR_MASK : 0),
_rid(rid)
{}
@@ -84,7 +84,18 @@
_rid = 0;
}
+void
+hdr::set_owi(const bool owi)
+{
+ if (owi)
+ _uflag |= HDR_OVERWRITE_INDICATOR_MASK;
+ else
+ _uflag &= (~HDR_OVERWRITE_INDICATOR_MASK);
+}
+const u_int16_t hdr::HDR_OVERWRITE_INDICATOR_MASK = 0x1;
+
+
// ***** struct rec_tail *****
rec_tail::rec_tail():
@@ -132,10 +143,10 @@
#endif
{}
-file_hdr::file_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
- const u_int64_t rid, const u_int32_t fid, const size_t fro, const bool settime)
+file_hdr::file_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const u_int32_t fid, const size_t fro, const bool owi, const bool settime)
throw (jexception):
- _hdr(magic, version, uflag, rid),
+ _hdr(magic, version, rid, owi),
_fid(fid),
_res(0),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
@@ -165,6 +176,15 @@
}
void
+file_hdr::set_owi(const bool owi)
+{
+ if (owi)
+ _hdr._uflag |= hdr::HDR_OVERWRITE_INDICATOR_MASK;
+ else
+ _hdr._uflag &= (~hdr::HDR_OVERWRITE_INDICATOR_MASK);
+}
+
+void
file_hdr::set_time() throw (jexception)
{
// TODO: Standardize on a method for getting time that does not requrie a context switch.
@@ -208,8 +228,8 @@
{}
enq_hdr::enq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
- const size_t xidsize, const size_t dsize, const bool transient):
- _hdr(magic, version, transient ? ENQ_HDR_TRANSIENT_MASK : 0, rid),
+ const size_t xidsize, const size_t dsize, const bool owi, const bool transient):
+ _hdr(magic, version, rid, owi),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
@@ -224,9 +244,20 @@
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
, _filler1(0)
#endif
-{}
+{
+ set_transient(transient);
+}
void
+enq_hdr::set_owi(const bool owi)
+{
+ if (owi)
+ _hdr._uflag |= hdr::HDR_OVERWRITE_INDICATOR_MASK;
+ else
+ _hdr._uflag &= (~hdr::HDR_OVERWRITE_INDICATOR_MASK);
+}
+
+void
enq_hdr::set_transient(const bool transient)
{
if (transient)
@@ -244,8 +275,8 @@
_hdr._uflag &= (~ENQ_HDR_EXTERNAL_MASK);
}
-const u_int16_t enq_hdr::ENQ_HDR_TRANSIENT_MASK = 0x1;
-const u_int16_t enq_hdr::ENQ_HDR_EXTERNAL_MASK = 0x2;
+const u_int16_t enq_hdr::ENQ_HDR_TRANSIENT_MASK = 0x10;
+const u_int16_t enq_hdr::ENQ_HDR_EXTERNAL_MASK = 0x20;
// ***** struct deq_hdr *****
@@ -262,9 +293,9 @@
#endif
{}
-deq_hdr::deq_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
- const u_int64_t rid, const u_int64_t deq_rid, const size_t xidsize):
- _hdr(magic, version, uflag, rid),
+deq_hdr::deq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const u_int64_t deq_rid, const size_t xidsize, const bool owi):
+ _hdr(magic, version, rid, owi),
_deq_rid(deq_rid),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
@@ -275,7 +306,16 @@
#endif
{}
+void
+deq_hdr::set_owi(const bool owi)
+{
+ if (owi)
+ _hdr._uflag |= hdr::HDR_OVERWRITE_INDICATOR_MASK;
+ else
+ _hdr._uflag &= (~hdr::HDR_OVERWRITE_INDICATOR_MASK);
+}
+
// ***** struct txn_hdr *****
@@ -290,9 +330,9 @@
#endif
{}
-txn_hdr::txn_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
- const u_int64_t rid, const size_t xidsize):
- _hdr(magic, version, uflag, rid),
+txn_hdr::txn_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const size_t xidsize, const bool owi):
+ _hdr(magic, version, rid, owi),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
@@ -302,5 +342,14 @@
#endif
{}
+void
+txn_hdr::set_owi(const bool owi)
+{
+ if (owi)
+ _hdr._uflag |= hdr::HDR_OVERWRITE_INDICATOR_MASK;
+ else
+ _hdr._uflag &= (~hdr::HDR_OVERWRITE_INDICATOR_MASK);
+}
+
} // namespace journal
} // namespace rhm
Modified: store/trunk/cpp/lib/jrnl/file_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/file_hdr.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -82,6 +82,9 @@
u_int8_t _eflag; ///< Flag for determining endianness
u_int16_t _uflag; ///< User-defined flags
u_int64_t _rid; ///< Record ID (rotating 64-bit counter)
+
+ // Global flags
+ static const u_int16_t HDR_OVERWRITE_INDICATOR_MASK;
// Convenience constructors and methods
/**
@@ -92,8 +95,7 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
- const u_int64_t rid);
+ hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid, const bool owi);
/**
* \brief Convenience copy method.
@@ -105,6 +107,9 @@
*/
void reset();
+ inline const bool get_owi() const { return _uflag & HDR_OVERWRITE_INDICATOR_MASK; }
+ void set_owi(const bool owi);
+
/**
* \brief Returns the size of the header in bytes.
*/
@@ -232,10 +237,13 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- file_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
- const u_int64_t rid, const u_int32_t fid, const size_t fro,
- const bool settime = false) throw (jexception);
+ file_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const u_int32_t fid, const size_t fro, const bool owi, const bool settime = false)
+ throw (jexception);
+ inline const bool get_owi() const { return _hdr._uflag & hdr::HDR_OVERWRITE_INDICATOR_MASK; }
+ void set_owi(const bool owi);
+
/**
* \brief Gets the current time from the system clock and sets the timestamp in the struct.
*/
@@ -313,8 +321,11 @@
* \brief Convenience constructor which initializes values during construction.
*/
enq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
- const size_t xidsize, const size_t dsize, const bool transient = false);
-
+ const size_t xidsize, const size_t dsize, const bool owi,
+ const bool transient = false);
+
+ inline const bool get_owi() const { return _hdr._uflag & hdr::HDR_OVERWRITE_INDICATOR_MASK; }
+ void set_owi(const bool owi);
inline const bool is_transient() const { return _hdr._uflag & ENQ_HDR_TRANSIENT_MASK; }
void set_transient(const bool transient);
inline const bool is_external() const { return _hdr._uflag & ENQ_HDR_EXTERNAL_MASK; }
@@ -381,9 +392,12 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- deq_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
- const u_int64_t rid, const u_int64_t deq_rid, const size_t xidsize);
+ deq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const u_int64_t deq_rid, const size_t xidsize, const bool owi);
+ inline const bool get_owi() const { return _hdr._uflag & hdr::HDR_OVERWRITE_INDICATOR_MASK; }
+ void set_owi(const bool owi);
+
/**
* \brief Returns the size of the header in bytes.
*/
@@ -441,9 +455,12 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- txn_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
- const u_int64_t rid, const size_t xidsize);
+ txn_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const size_t xidsize, const bool owi);
+ inline const bool get_owi() const { return _hdr._uflag & hdr::HDR_OVERWRITE_INDICATOR_MASK; }
+ void set_owi(const bool owi);
+
/**
* \brief Returns the size of the header in bytes.
*/
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -456,6 +456,7 @@
try
{
rd._ffid = ji.get_start_file();
+ rd._owi = ji.get_initial_owi();
rd._empty = false;
}
catch (const jexception& e)
@@ -504,7 +505,7 @@
{
case RHM_JDAT_ENQ_MAGIC:
{
- if (!check_rid(fid, h, rd, read_pos))
+ if (!check_owi(fid, h, rd, read_pos))
return false;
enq_rec er;
while (!done)
@@ -533,7 +534,7 @@
break;
case RHM_JDAT_DEQ_MAGIC:
{
- if (!check_rid(fid, h, rd, read_pos))
+ if (!check_owi(fid, h, rd, read_pos))
return false;
deq_rec dr;
while (!done)
@@ -576,7 +577,7 @@
break;
case RHM_JDAT_TXA_MAGIC:
{
- if (!check_rid(fid, h, rd, read_pos))
+ if (!check_owi(fid, h, rd, read_pos))
return false;
txn_rec ar;
while (!done)
@@ -611,7 +612,7 @@
break;
case RHM_JDAT_TXC_MAGIC:
{
- if (!check_rid(fid, h, rd, read_pos))
+ if (!check_owi(fid, h, rd, read_pos))
return false;
txn_rec cr;
while (!done)
@@ -681,7 +682,10 @@
rd._lfid = fid++;
ifsp->close();
if (fid >= JRNL_NUM_FILES)
+ {
fid = 0;
+ rd._owi = !rd._owi; // Flip owi
+ }
if (fid == rd._ffid) // used up all journal files
return false;
}
@@ -716,11 +720,12 @@
}
const bool
-jcntl::check_rid(u_int16_t fid, hdr& h, rcvdat& rd, std::streampos read_pos) throw (jexception)
+jcntl::check_owi(u_int16_t fid, hdr& h, rcvdat& rd, std::streampos read_pos) throw (jexception)
{
- if (rd._h_rid && rd._h_rid >= h._rid)
+ if (rd._ffid ? h.get_owi() == rd._owi : h.get_owi() != rd._owi) // Overwrite indicator changed
{
- if (fid == (rd._ffid ? rd._ffid - 1 : JRNL_NUM_FILES - 1))
+ u_int16_t expected_fid = rd._ffid ? rd._ffid - 1 : JRNL_NUM_FILES - 1;
+ if (fid == expected_fid)
{
rd._lfid = fid;
rd._eo = read_pos;
@@ -728,12 +733,14 @@
}
std::stringstream ss;
ss << std::hex << std::setfill('0') << "Magic=0x" << std::setw(8) << h._magic;
- ss << " fid=" << fid << " rid=" << h._rid << " hrid=" << rd._h_rid;
+ ss << " fid=0x" << std::setw(4) << fid << " rid=0x" << std::setw(8) << h._rid;
ss << " foffs=0x" << std::setw(8) << read_pos;
- throw jexception(jerrno::JERR_JCNTL_RIDORDERBAD, ss.str().c_str(), "jcntl",
- "check_rid");
- }
- rd._h_rid = h._rid;
+ ss << " expected_fid=0x" << std::setw(4) << expected_fid;
+ throw jexception(jerrno::JERR_JCNTL_OWIMISMATCH, ss.str().c_str(), "jcntl",
+ "check_owi");
+ }
+ if (rd._h_rid < h._rid)
+ rd._h_rid = h._rid;
return true;
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -641,7 +641,7 @@
const bool jfile_cycle(u_int16_t& fid, std::ifstream* ifsp, rcvdat& rd,
const bool jump_fro);
- const bool check_rid(u_int16_t fid, hdr& h, rcvdat& rd, std::streampos read_pos)
+ const bool check_owi(u_int16_t fid, hdr& h, rcvdat& rd, std::streampos read_pos)
throw (jexception);
/**
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -59,7 +59,7 @@
const u_int32_t jerrno::JERR_JCNTL_UNKNOWNMAGIC = 0x0203;
const u_int32_t jerrno::JERR_JCNTL_NOTRECOVERED = 0x0204;
const u_int32_t jerrno::JERR_JCNTL_RECOVERJFULL = 0x0205;
-const u_int32_t jerrno::JERR_JCNTL_RIDORDERBAD = 0x0206;
+const u_int32_t jerrno::JERR_JCNTL_OWIMISMATCH = 0x0206;
// class jdir
const u_int32_t jerrno::JERR_JDIR_NOTDIR = 0x0300;
@@ -143,8 +143,8 @@
"Operation requires recover() to be run first.";
_err_map[JERR_JCNTL_RECOVERJFULL] = "JERR_JCNTL_RECOVERJFULL: "
"Journal data files full, cannot write.";
- _err_map[JERR_JCNTL_RIDORDERBAD] = "JERR_JCNTL_RIDORDERBAD: "
- "Record found with RID out-of-order.";
+ _err_map[JERR_JCNTL_OWIMISMATCH] = "JERR_JCNTL_OWIMISMATCH: "
+ "Overwrite Indecator (OWI) change found in unexpected location.";
// class jdir
_err_map[JERR_JDIR_NOTDIR] = "JERR_JDIR_NOTDIR: Directory name exists but is not a directory.";
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -76,7 +76,7 @@
static const u_int32_t JERR_JCNTL_UNKNOWNMAGIC; ///< Found record with unknown magic
static const u_int32_t JERR_JCNTL_NOTRECOVERED; ///< Req' recover() to be called first
static const u_int32_t JERR_JCNTL_RECOVERJFULL; ///< Journal data files full, cannot write
- static const u_int32_t JERR_JCNTL_RIDORDERBAD; ///< RID out-of-order
+ static const u_int32_t JERR_JCNTL_OWIMISMATCH; ///< OWI change found in unexpected location
// class jdir
static const u_int32_t JERR_JDIR_NOTDIR; ///< Exists but is not a directory
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -56,7 +56,8 @@
_tm_ptr(NULL),
_valid_flag(false),
_analyzed_flag(false),
- _start_file(0)
+ _start_file(0),
+ _initial_owi(false)
{
read(jinf_filename);
if (validate_flag)
@@ -81,7 +82,8 @@
_tm_ptr(::localtime(&ts.tv_sec)),
_valid_flag(false),
_analyzed_flag(false),
- _start_file(0)
+ _start_file(0),
+ _initial_owi(false)
{}
jinf::~jinf()
@@ -155,7 +157,8 @@
jinf::analyze() throw (jexception)
{
u_int16_t fid = 0xffff;
- u_int64_t rid = (u_int64_t)-1; // TODO: check this, 64-bit literals are a problem!
+ bool owi = false;
+ bool found = false;
if (!_valid_flag)
validate();
@@ -172,16 +175,23 @@
jifs.read((char*)&fhdr, sizeof(fhdr));
if (fhdr._hdr._magic != RHM_JDAT_FILE_MAGIC)
break;
- if (fhdr._hdr._rid < rid)
+ if (!fnum) // First file only
{
+ owi = fhdr.get_owi();
+ _initial_owi = owi;
+ fid = 0;
+ }
+ else if (fhdr.get_owi() != owi && !found)
+ {
fid = fnum;
- rid = fhdr._hdr._rid;
+ found = true;
}
jifs.close();
}
- if (fid == (u_int16_t)-1)
+ if (fid == 0xffff)
throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
_start_file = fid;
+ _analyzed_flag = true;
return _start_file;
}
@@ -205,6 +215,14 @@
return _start_file;
}
+const bool
+jinf::get_initial_owi() throw (jexception)
+{
+ if (!_analyzed_flag)
+ analyze();
+ return _initial_owi;
+}
+
const std::string
jinf::to_string() const
{
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -64,6 +64,7 @@
bool _valid_flag;
bool _analyzed_flag;
u_int16_t _start_file;
+ bool _initial_owi;
public:
// constructor for reading existing jinf file
@@ -91,6 +92,7 @@
inline const u_int32_t rmgr_page_size_dblks() const { return _rmgr_page_size_dblks; }
inline const u_int32_t rmgr_num_pages() const { return _rmgr_num_pages; }
const u_int16_t get_start_file() throw (jexception);
+ const bool get_initial_owi() throw (jexception);
const std::string to_string() const;
const std::string xml_str() const;
Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -207,19 +207,19 @@
}
}
-bool
-pmgr::rotate_page(page_state state)
-{
- _page_cb_arr[_pg_index]._state = state;
- if (_pg_offset_dblks >= JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE)
- {
- _pg_offset_dblks = 0;
- _pg_cntr++;
- }
- if (++_pg_index >= _pages)
- _pg_index = 0;
- return false;
-}
+// bool
+// pmgr::rotate_page(page_state state)
+// {
+// _page_cb_arr[_pg_index]._state = state;
+// if (_pg_offset_dblks >= JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE)
+// {
+// _pg_offset_dblks = 0;
+// _pg_cntr++;
+// }
+// if (++_pg_index >= _pages)
+// _pg_index = 0;
+// return false;
+// }
void
pmgr::clean()
Modified: store/trunk/cpp/lib/jrnl/pmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -150,7 +150,8 @@
protected:
virtual void initialize() throw (jexception);
- virtual bool rotate_page(page_state state = UNUSED);
+// virtual bool rotate_page(page_state state = UNUSED);
+ virtual void rotate_page() = 0;
virtual void clean();
};
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -42,6 +42,7 @@
struct rcvdat
{
+ bool _owi;
bool _empty; ///< Journal data files empty
u_int16_t _ffid; ///< First file id
size_t _fro; ///< First record offset in ffid
@@ -52,6 +53,7 @@
std::vector<u_int32_t> _enq_cnt_list; ///< Number enqueued records found for each file
rcvdat():
+ _owi(false),
_empty(true),
_ffid(0),
_fro(0),
@@ -64,6 +66,7 @@
void reset()
{
+ _owi=false;
_empty=true;
_ffid=0;
_fro=0;
@@ -86,7 +89,8 @@
std::cout << " Last fid (_lfid) = " << _lfid << std::endl;
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 << " Highest rid (_h_rid) = 0x" << std::hex << _h_rid << std::dec <<
+ 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++)
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -284,6 +284,7 @@
bool is_enq = false;
try
{
+//std::cout << " rid=0x" << std::hex << _hdr._rid << std::dec << std::flush;
//std::cout << " rid=" << _hdr._rid << std::flush;
fid = _emap.get_fid(_hdr._rid);
//std::cout << ":ok" << std::flush;
@@ -629,6 +630,7 @@
_pg_offset_dblks += this_dblk_cnt;
tot_dblk_cnt += this_dblk_cnt;
}
+ // If skip still incomplete, move to next page and decode again
if (tot_dblk_cnt < dsize_dblks)
{
if (_pg_offset_dblks == JRNL_SBLK_SIZE * JRNL_RMGR_PAGE_SIZE)
@@ -650,6 +652,10 @@
dtokp->set_dsize(0);
dtokp->set_dblocks_read(0);
//std::cout << "]" << std::flush;
+
+ // If we have finished with this page, rotate it
+ if (dblks_rem() == 0)
+ rotate_page();
return RHM_IORES_SUCCESS;
}
}
@@ -747,7 +753,15 @@
rmgr::rotate_page()
{
_page_cb_arr[_pg_index]._rdblks = 0;
- pmgr::rotate_page();
+// pmgr::rotate_page();
+ _page_cb_arr[_pg_index]._state = UNUSED;
+ if (_pg_offset_dblks >= JRNL_RMGR_PAGE_SIZE * JRNL_SBLK_SIZE)
+ {
+ _pg_offset_dblks = 0;
+ _pg_cntr++;
+ }
+ if (++_pg_index >= _pages)
+ _pg_index = 0;
aio_cycle();
_pg_offset_dblks = 0;
// This counter is for bookkeeping only, page rotates are handled directly in init_aio_reads()
Modified: store/trunk/cpp/lib/jrnl/txn_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_rec.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/txn_rec.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -53,8 +53,8 @@
}
txn_rec::txn_rec(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen):
- _txn_hdr(magic, RHM_JDAT_VERSION, 0, rid, xidlen),
+ const size_t xidlen, const bool owi):
+ _txn_hdr(magic, RHM_JDAT_VERSION, rid, xidlen, owi),
_xidp(xidp),
_buff(NULL),
_txn_tail(_txn_hdr._hdr)
@@ -77,10 +77,11 @@
void
txn_rec::reset(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen)
+ const size_t xidlen, const bool owi)
{
_txn_hdr._hdr._magic = magic;
_txn_hdr._hdr._rid = rid;
+ _txn_hdr.set_owi(owi);
_txn_hdr._xidsize = xidlen;
_xidp = xidp;
_buff = NULL;
Modified: store/trunk/cpp/lib/jrnl/txn_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_rec.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/txn_rec.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -65,14 +65,14 @@
txn_rec();
// constructor used for write operations, where xid already exists
txn_rec(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen);
+ const size_t xidlen, const bool owi);
virtual ~txn_rec();
// Prepare instance for use in reading data from journal
void reset(const u_int32_t magic);
// Prepare instance for use in writing data to journal
void reset(const u_int32_t magic, const u_int64_t rid, const void* const xidp,
- const size_t xidlen);
+ const size_t xidlen, const bool owi);
const u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks)
throw (jexception);
const u_int32_t decode(hdr& h, void* rptr, u_int32_t rec_offs_dblks,
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -126,7 +126,8 @@
_enq_busy = true;
u_int64_t rid = initialize_rid(cont, dtokp);
- _enq_rec.reset(rid, data_buff, tot_data_len, xid_ptr, xid_len, transient, external);
+ _enq_rec.reset(rid, data_buff, tot_data_len, xid_ptr, xid_len, _wrfc.owi(), transient,
+ external);
if (!cont)
{
dtokp->set_rid(rid);
@@ -274,7 +275,7 @@
dtokp->set_rid(rid);
dtokp->set_dequeue_rid(dequeue_rid);
}
- _deq_rec.reset(rid, dequeue_rid, xid_ptr, xid_len);
+ _deq_rec.reset(rid, dequeue_rid, xid_ptr, xid_len, _wrfc.owi());
if (!cont)
{
if (xid_len)
@@ -409,7 +410,7 @@
_abort_busy = true;
u_int64_t rid = dtokp->rid() ? dtokp->rid() : (cont ? _wrfc.rid() - 1 : _wrfc.get_incr_rid());
- _txn_rec.reset(RHM_JDAT_TXA_MAGIC, rid, xid_ptr, xid_len);
+ _txn_rec.reset(RHM_JDAT_TXA_MAGIC, rid, xid_ptr, xid_len, _wrfc.owi());
if (!cont)
{
dtokp->set_rid(rid);
@@ -552,7 +553,7 @@
_commit_busy = true;
u_int64_t rid = dtokp->rid() ? dtokp->rid() : (cont ? _wrfc.rid() - 1 : _wrfc.get_incr_rid());
- _txn_rec.reset(RHM_JDAT_TXC_MAGIC, rid, xid_ptr, xid_len);
+ _txn_rec.reset(RHM_JDAT_TXC_MAGIC, rid, xid_ptr, xid_len, _wrfc.owi());
if (!cont)
{
dtokp->set_rid(rid);
@@ -718,7 +719,8 @@
//std::cout << "{w^" << _pg_index << "," << _cached_offset_dblks << "}" << std::flush;
_cached_offset_dblks = 0;
- rotate_page(AIO_PENDING); // increments _pg_index, resets _pg_offset_dblks if req'd
+// rotate_page(AIO_PENDING); // increments _pg_index, resets _pg_offset_dblks if req'd
+ rotate_page(); // increments _pg_index, resets _pg_offset_dblks if req'd
if (_page_cb_arr[_pg_index]._state == UNUSED)
_page_cb_arr[_pg_index]._state = IN_USE;
}
@@ -1007,7 +1009,7 @@
void
wmgr::write_fhdr(u_int64_t rid, u_int32_t fid, size_t fro) throw (jexception)
{
- file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, 0, rid, fid, fro, true);
+ file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, rid, fid, fro, _wrfc.owi(), true);
::memcpy(_fhdr_ptr_arr[fid], &fhdr, sizeof(fhdr));
#ifdef RHM_CLEAN
::memset((char*)_fhdr_ptr_arr[fid] + sizeof(fhdr), RHM_CLEAN_CHAR, _sblksize - sizeof(fhdr));
@@ -1022,6 +1024,19 @@
}
void
+wmgr::rotate_page()
+{
+ _page_cb_arr[_pg_index]._state = AIO_PENDING;
+ if (_pg_offset_dblks >= JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE)
+ {
+ _pg_offset_dblks = 0;
+ _pg_cntr++;
+ }
+ if (++_pg_index >= _pages)
+ _pg_index = 0;
+}
+
+void
wmgr::clean()
{
if (_fhdr_base_ptr)
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -124,6 +124,7 @@
const iores rotate_file();
void dblk_roundup();
void write_fhdr(u_int64_t rid, u_int32_t fid, size_t fro) throw (jexception);
+ void rotate_page();
void clean();
// Special version of libaio's io_prep_pwrite() which preserves the value of the data
Modified: store/trunk/cpp/lib/jrnl/wrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/wrfc.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -47,7 +47,8 @@
#else
_rid(0),
#endif
- _reset_ok(false)
+ _reset_ok(false),
+ _owi(false)
{}
wrfc::~wrfc() {}
@@ -80,7 +81,10 @@
throw jexception(jerrno::JERR__NINIT, "wrfc", "rotate");
_fh_index++;
if (_fh_index == _nfiles)
+ {
_fh_index = 0;
+ _owi = !_owi; // flip owi
+ }
_curr_fh = _fh_arr[_fh_index];
return reset(); //Checks if file is still in use (ie not fully dequeued yet)
}
Modified: store/trunk/cpp/lib/jrnl/wrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.hpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/lib/jrnl/wrfc.hpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -57,6 +57,7 @@
private:
u_int64_t _rid; ///< Master counter for record ID (rid)
bool _reset_ok; ///< Flag set when reset succeeds
+ bool _owi; ///< Overwrite indicator
public:
wrfc();
@@ -82,6 +83,7 @@
inline const u_int64_t get_incr_rid() { return _rid++; }
const bool reset();
inline const bool is_reset() const { return _reset_ok; }
+ inline const bool owi() const { return _owi; }
// Convenience access methods to current file handle
Modified: store/trunk/cpp/tests/jrnl/unit_test_file_hdr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_file_hdr.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/tests/jrnl/unit_test_file_hdr.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -49,13 +49,15 @@
BOOST_CHECK_EQUAL(h1._eflag, 0);
BOOST_CHECK_EQUAL(h1._uflag, 0);
BOOST_CHECK_EQUAL(h1._rid, 0ULL);
+ BOOST_CHECK(!h1.get_owi());
const u_int32_t magic = 0x89abcdefUL;
+ const u_int16_t uflag = 0x5537;
const u_int8_t version = 0xef;
- const u_int16_t uflag = 0xabcd;
const u_int64_t rid = 0x123456789abcdef0ULL;
+ const bool owi = true;
- hdr h2(magic, version, uflag, rid);
+ hdr h2(magic, version, rid, owi);
BOOST_CHECK_EQUAL(h2._magic, magic);
BOOST_CHECK_EQUAL(h2._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -63,8 +65,20 @@
#else
BOOST_CHECK_EQUAL(h2._eflag, RHM_BENDIAN_FLAG);
#endif
+ BOOST_CHECK_EQUAL(h2._uflag, hdr::HDR_OVERWRITE_INDICATOR_MASK);
+ BOOST_CHECK_EQUAL(h2._rid, rid);
+ BOOST_CHECK_EQUAL(h2.get_owi(), owi);
+ h2._uflag = uflag;
+ BOOST_CHECK(h2.get_owi());
+ h2.set_owi(true);
+ BOOST_CHECK(h2.get_owi());
BOOST_CHECK_EQUAL(h2._uflag, uflag);
- BOOST_CHECK_EQUAL(h2._rid, rid);
+ h2.set_owi(false);
+ BOOST_CHECK(!h2.get_owi());
+ BOOST_CHECK_EQUAL(h2._uflag, (uflag & ~hdr::HDR_OVERWRITE_INDICATOR_MASK));
+ h2.set_owi(true);
+ BOOST_CHECK(h2.get_owi());
+ BOOST_CHECK_EQUAL(h2._uflag, uflag);
h1.copy(h2);
BOOST_CHECK_EQUAL(h1._magic, magic);
@@ -76,6 +90,8 @@
#endif
BOOST_CHECK_EQUAL(h1._uflag, uflag);
BOOST_CHECK_EQUAL(h1._rid, rid);
+ BOOST_CHECK(h1.get_owi());
+ BOOST_CHECK_EQUAL(h1._uflag, uflag);
h1.reset();
BOOST_CHECK_EQUAL(h1._magic, 0UL);
@@ -83,6 +99,7 @@
BOOST_CHECK_EQUAL(h1._eflag, 0);
BOOST_CHECK_EQUAL(h1._uflag, 0);
BOOST_CHECK_EQUAL(h1._rid, 0ULL);
+ BOOST_CHECK(!h1.get_owi());
}
void test_rec_tail()
@@ -104,7 +121,7 @@
}
{
- hdr h(magic, RHM_JDAT_VERSION, 0, rid);
+ hdr h(magic, RHM_JDAT_VERSION, rid, true);
rec_tail rt3(h);
BOOST_CHECK_EQUAL(rt3._xmagic, xmagic);
BOOST_CHECK_EQUAL(rt3._rid, rid);
@@ -115,7 +132,7 @@
{
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
- const u_int16_t uflag = 0x1234;
+ const u_int16_t uflag = 0x5537;
const u_int64_t rid = 0xfedcba9876543210ULL;
const u_int32_t fid = 0xfedcba98UL;
#ifdef JRNL_32_BIT
@@ -124,6 +141,7 @@
const size_t fro = 0xfedcba9876543210ULL;
#endif
timespec ts;
+ const bool owi = true;
{
file_hdr fh1;
@@ -139,13 +157,14 @@
BOOST_CHECK_EQUAL(fh1._ts_nsec, 0UL);
#else
BOOST_CHECK_EQUAL(fh1._fro, 0ULL);
- BOOST_CHECK_EQUAL(fh1._ts_sec, 0ULL);
+ BOOST_CHECK_EQUAL(fh1._ts_sec, 0LL);
BOOST_CHECK_EQUAL(fh1._ts_nsec, 0ULL);
#endif
+ BOOST_CHECK(!fh1.get_owi());
}
{
- file_hdr fh2(magic, version, uflag, rid, fid, fro);
+ file_hdr fh2(magic, version, rid, fid, fro, owi, false);
BOOST_CHECK_EQUAL(fh2._hdr._magic, magic);
BOOST_CHECK_EQUAL(fh2._hdr._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -153,7 +172,7 @@
#else
BOOST_CHECK_EQUAL(fh2._hdr._eflag, RHM_BENDIAN_FLAG);
#endif
- BOOST_CHECK_EQUAL(fh2._hdr._uflag, uflag);
+ BOOST_CHECK_EQUAL(fh2._hdr._uflag, hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(fh2._hdr._rid, rid);
BOOST_CHECK_EQUAL(fh2._fid,fid );
BOOST_CHECK_EQUAL(fh2._fro, fro);
@@ -168,10 +187,22 @@
fh2.set_time(ts);
BOOST_CHECK_EQUAL(fh2._ts_sec, ts.tv_sec);
BOOST_CHECK_EQUAL(fh2._ts_nsec, (u_int32_t)ts.tv_nsec);
+ BOOST_CHECK(fh2.get_owi());
+
+ fh2._hdr._uflag = uflag;
+ BOOST_CHECK(fh2.get_owi());
+
+ fh2.set_owi(false);
+ BOOST_CHECK(!fh2.get_owi());
+ BOOST_CHECK_EQUAL(fh2._hdr._uflag, (uflag & ~hdr::HDR_OVERWRITE_INDICATOR_MASK));
+
+ fh2.set_owi(true);
+ BOOST_CHECK(fh2.get_owi());
+ BOOST_CHECK_EQUAL(fh2._hdr._uflag, uflag);
}
{
- file_hdr fh3(magic, version, uflag, rid, fid, fro, true);
+ file_hdr fh3(magic, version, rid, fid, fro, owi, true);
BOOST_CHECK_EQUAL(fh3._hdr._magic, magic);
BOOST_CHECK_EQUAL(fh3._hdr._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -179,7 +210,7 @@
#else
BOOST_CHECK_EQUAL(fh3._hdr._eflag, RHM_BENDIAN_FLAG);
#endif
- BOOST_CHECK_EQUAL(fh3._hdr._uflag, uflag);
+ BOOST_CHECK_EQUAL(fh3._hdr._uflag, hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(fh3._hdr._rid, rid);
BOOST_CHECK_EQUAL(fh3._fid, fid);
BOOST_CHECK_EQUAL(fh3._fro, fro);
@@ -192,6 +223,7 @@
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
const u_int64_t rid = 0xfedcba9876543210ULL;
+ const u_int16_t uflag = 0x5537;
#ifdef JRNL_32_BIT
const size_t xidsize = 0xfedcba98UL;
const size_t dsize = 0x76543210UL;
@@ -199,6 +231,7 @@
const size_t xidsize = 0xfedcba9876543210ULL;
const size_t dsize = 0x76543210fedcba98ULL;
#endif
+ const bool owi = true;
{
enq_hdr eh1;
@@ -214,10 +247,11 @@
BOOST_CHECK_EQUAL(eh1._xidsize, 0ULL);
BOOST_CHECK_EQUAL(eh1._dsize, 0ULL);
#endif
+ BOOST_CHECK(!eh1.get_owi());
}
{
- enq_hdr eh2(magic, version, rid, xidsize, dsize);
+ enq_hdr eh2(magic, version, rid, xidsize, dsize, owi, false);
BOOST_CHECK_EQUAL(eh2._hdr._magic, magic);
BOOST_CHECK_EQUAL(eh2._hdr._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -225,41 +259,58 @@
#else
BOOST_CHECK_EQUAL(eh2._hdr._eflag, RHM_BENDIAN_FLAG);
#endif
- BOOST_CHECK_EQUAL(eh2._hdr._uflag, 0);
+ BOOST_CHECK_EQUAL(eh2._hdr._uflag, hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(eh2._hdr._rid, rid);
BOOST_CHECK_EQUAL(eh2._xidsize, xidsize);
BOOST_CHECK_EQUAL(eh2._dsize, dsize);
+ BOOST_CHECK(eh2.get_owi());
BOOST_CHECK(!eh2.is_transient());
BOOST_CHECK(!eh2.is_external());
- eh2.set_transient(true);
- BOOST_CHECK_EQUAL(eh2._hdr._uflag, enq_hdr::ENQ_HDR_TRANSIENT_MASK);
+ eh2._hdr._uflag = uflag;
+ BOOST_CHECK(eh2.get_owi());
BOOST_CHECK(eh2.is_transient());
- BOOST_CHECK(!eh2.is_external());
+ BOOST_CHECK(eh2.is_external());
+ eh2.set_owi(false);
+ BOOST_CHECK(!eh2.get_owi());
+ BOOST_CHECK(eh2.is_transient());
+ BOOST_CHECK(eh2.is_external());
+ BOOST_CHECK_EQUAL(eh2._hdr._uflag, (uflag & ~hdr::HDR_OVERWRITE_INDICATOR_MASK));
+
+ eh2.set_owi(true);
+ BOOST_CHECK(eh2.get_owi());
+ BOOST_CHECK(eh2.is_transient());
+ BOOST_CHECK(eh2.is_external());
+ BOOST_CHECK_EQUAL(eh2._hdr._uflag, uflag);
+
eh2.set_transient(false);
- BOOST_CHECK_EQUAL(eh2._hdr._uflag, 0);
+ BOOST_CHECK(eh2.get_owi());
BOOST_CHECK(!eh2.is_transient());
- BOOST_CHECK(!eh2.is_external());
+ BOOST_CHECK(eh2.is_external());
+ BOOST_CHECK_EQUAL(eh2._hdr._uflag, uflag & ~enq_hdr::ENQ_HDR_TRANSIENT_MASK);
- eh2.set_external(true);
- BOOST_CHECK_EQUAL(eh2._hdr._uflag, enq_hdr::ENQ_HDR_EXTERNAL_MASK);
- BOOST_CHECK(!eh2.is_transient());
+ eh2.set_transient(true);
+ BOOST_CHECK(eh2.get_owi());
+ BOOST_CHECK(eh2.is_transient());
BOOST_CHECK(eh2.is_external());
+ BOOST_CHECK_EQUAL(eh2._hdr._uflag, uflag);
eh2.set_external(false);
- BOOST_CHECK_EQUAL(eh2._hdr._uflag, 0);
- BOOST_CHECK(!eh2.is_transient());
+ BOOST_CHECK(eh2.get_owi());
+ BOOST_CHECK(eh2.is_transient());
BOOST_CHECK(!eh2.is_external());
+ BOOST_CHECK_EQUAL(eh2._hdr._uflag, uflag & ~enq_hdr::ENQ_HDR_EXTERNAL_MASK);
- eh2.set_transient(true);
eh2.set_external(true);
- BOOST_CHECK_EQUAL(eh2._hdr._uflag,
- enq_hdr::ENQ_HDR_TRANSIENT_MASK | enq_hdr::ENQ_HDR_EXTERNAL_MASK);
+ BOOST_CHECK(eh2.get_owi());
+ BOOST_CHECK(eh2.is_transient());
+ BOOST_CHECK(eh2.is_external());
+ BOOST_CHECK_EQUAL(eh2._hdr._uflag, uflag);
}
{
- enq_hdr eh3(magic, version, rid, xidsize, dsize, true);
+ enq_hdr eh3(magic, version, rid, xidsize, dsize, owi, true);
BOOST_CHECK_EQUAL(eh3._hdr._magic, magic);
BOOST_CHECK_EQUAL(eh3._hdr._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -267,10 +318,12 @@
#else
BOOST_CHECK_EQUAL(eh3._hdr._eflag, RHM_BENDIAN_FLAG);
#endif
- BOOST_CHECK_EQUAL(eh3._hdr._uflag, enq_hdr::ENQ_HDR_TRANSIENT_MASK);
+ BOOST_CHECK_EQUAL(eh3._hdr._uflag,
+ enq_hdr::ENQ_HDR_TRANSIENT_MASK | hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(eh3._hdr._rid, rid);
BOOST_CHECK_EQUAL(eh3._xidsize, xidsize);
BOOST_CHECK_EQUAL(eh3._dsize, dsize);
+ BOOST_CHECK(eh3.get_owi());
BOOST_CHECK(eh3.is_transient());
BOOST_CHECK(!eh3.is_external());
}
@@ -280,7 +333,7 @@
{
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
- const u_int16_t uflag = 0x1234;
+ const u_int16_t uflag = 0x5537;
const u_int64_t rid = 0xfedcba9876543210ULL;
const u_int64_t drid = 0x76543210fedcba98ULL;
#ifdef JRNL_32_BIT
@@ -288,6 +341,7 @@
#else
const size_t xidsize = 0xfedcba9876543210ULL;
#endif
+ const bool owi = true;
{
deq_hdr dh1;
@@ -302,10 +356,11 @@
#else
BOOST_CHECK_EQUAL(dh1._xidsize, 0ULL);
#endif
+ BOOST_CHECK(!dh1.get_owi());
}
{
- deq_hdr dh2(magic, version, uflag, rid, drid, xidsize);
+ deq_hdr dh2(magic, version, rid, drid, xidsize, owi);
BOOST_CHECK_EQUAL(dh2._hdr._magic, magic);
BOOST_CHECK_EQUAL(dh2._hdr._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -313,10 +368,22 @@
#else
BOOST_CHECK_EQUAL(dh2._hdr._eflag, RHM_BENDIAN_FLAG);
#endif
- BOOST_CHECK_EQUAL(dh2._hdr._uflag, uflag);
+ BOOST_CHECK_EQUAL(dh2._hdr._uflag, hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(dh2._hdr._rid, rid);
BOOST_CHECK_EQUAL(dh2._deq_rid, drid);
BOOST_CHECK_EQUAL(dh2._xidsize, xidsize);
+ BOOST_CHECK(dh2.get_owi());
+
+ dh2._hdr._uflag = uflag;
+ BOOST_CHECK(dh2.get_owi());
+
+ dh2.set_owi(false);
+ BOOST_CHECK(!dh2.get_owi());
+ BOOST_CHECK_EQUAL(dh2._hdr._uflag, (uflag & ~hdr::HDR_OVERWRITE_INDICATOR_MASK));
+
+ dh2.set_owi(true);
+ BOOST_CHECK(dh2.get_owi());
+ BOOST_CHECK_EQUAL(dh2._hdr._uflag, uflag);
}
}
@@ -324,13 +391,14 @@
{
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
- const u_int16_t uflag = 0x1234;
+ const u_int16_t uflag = 0x5537;
const u_int64_t rid = 0xfedcba9876543210ULL;
#ifdef JRNL_32_BIT
const size_t xidsize = 0xfedcba98UL;
#else
const size_t xidsize = 0xfedcba9876543210ULL;
#endif
+ const bool owi = true;
{
txn_hdr th1;
@@ -344,10 +412,11 @@
#else
BOOST_CHECK_EQUAL(th1._xidsize, 0ULL);
#endif
+ BOOST_CHECK(!th1.get_owi());
}
{
- txn_hdr th2(magic, version, uflag, rid, xidsize);
+ txn_hdr th2(magic, version, rid, xidsize, owi);
BOOST_CHECK_EQUAL(th2._hdr._magic, magic);
BOOST_CHECK_EQUAL(th2._hdr._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -355,9 +424,21 @@
#else
BOOST_CHECK_EQUAL(th2._hdr._eflag, RHM_BENDIAN_FLAG);
#endif
- BOOST_CHECK_EQUAL(th2._hdr._uflag, uflag);
+ BOOST_CHECK_EQUAL(th2._hdr._uflag, hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(th2._hdr._rid, rid);
BOOST_CHECK_EQUAL(th2._xidsize, xidsize);
+ BOOST_CHECK(th2.get_owi());
+
+ th2._hdr._uflag = uflag;
+ BOOST_CHECK(th2.get_owi());
+
+ th2.set_owi(false);
+ BOOST_CHECK(!th2.get_owi());
+ BOOST_CHECK_EQUAL(th2._hdr._uflag, (uflag & ~hdr::HDR_OVERWRITE_INDICATOR_MASK));
+
+ th2.set_owi(true);
+ BOOST_CHECK(th2.get_owi());
+ BOOST_CHECK_EQUAL(th2._hdr._uflag, uflag);
}
}
Modified: store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp 2007-11-29 14:50:56 UTC (rev 1388)
+++ store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp 2007-11-29 14:51:02 UTC (rev 1389)
@@ -55,7 +55,8 @@
void create_journal_files(std::vector<std::string>& jfiles, rid_scheme scheme,
u_int32_t min_fid_offs = 0, u_int64_t rid_offs = 0);
void clean_journal_files(std::vector<std::string>& jfiles);
-void init_fhdr(file_hdr& fh, u_int32_t fid, u_int64_t rid, bool no_enq = false);
+void init_fhdr(file_hdr& fh, const u_int32_t fid, const u_int64_t rid, const bool owi,
+ const bool no_enq = false);
void clean_journal_info_file();
@@ -187,7 +188,7 @@
if (scheme == RID_NONE) // create file containing 0s
::memset(&fh, 0, sizeof(file_hdr));
else
- init_fhdr(fh, fid, rid);
+ init_fhdr(fh, fid, rid, fid >= min_fid_offs);
// write file header
int cnt = sizeof(file_hdr);
@@ -219,7 +220,8 @@
jfiles.clear();
}
-void init_fhdr(file_hdr& fh, u_int32_t fid, u_int64_t rid, bool no_enq)
+void init_fhdr(file_hdr& fh, const u_int32_t fid, const u_int64_t rid, const bool owi,
+ const bool no_enq)
{
fh._hdr._magic = RHM_JDAT_FILE_MAGIC;
fh._hdr._version = RHM_JDAT_VERSION;
@@ -228,7 +230,7 @@
#else
fh._hdr._eflag = RHM_LENDIAN_FLAG;
#endif
- fh._hdr._uflag = 0;
+ fh._hdr._uflag = owi ? hdr::HDR_OVERWRITE_INDICATOR_MASK : 0;
fh._hdr._rid = rid;
fh._fid = fid;
fh._fro = no_enq ? 0 : 0x200;
17 years, 1 month
rhmessaging commits: r1388 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-29 09:50:56 -0500 (Thu, 29 Nov 2007)
New Revision: 1388
Modified:
mgmt/cumin/python/wooly/__init__.py
Log:
Gets rid of a leftover println.
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-11-29 12:38:22 UTC (rev 1387)
+++ mgmt/cumin/python/wooly/__init__.py 2007-11-29 14:50:56 UTC (rev 1388)
@@ -447,8 +447,6 @@
if not self.cached_css:
writer = Writer()
- print self.widget_classes
-
for cls in sorted(self.widget_classes):
strs = cls.get_module_strings()
17 years, 1 month