rhmessaging commits: r2526 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-22 15:48:09 -0400 (Mon, 22 Sep 2008)
New Revision: 2526
Modified:
mgmt/trunk/cumin/python/cumin/scheduler.py
mgmt/trunk/cumin/python/cumin/submitter.py
Log:
Tied in Submitter to use Job.submitter
Modified: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py 2008-09-22 19:47:10 UTC (rev 2525)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py 2008-09-22 19:48:09 UTC (rev 2526)
@@ -64,6 +64,8 @@
def show_jobs_remove(self, session):
return self.frame.show_jobs_remove(session)
+ def show_submitter(self, session, submitter):
+ return self.frame.show_submitter(session, submitter)
class SchedulerView(CuminView):
def __init__(self, app, name):
@@ -141,18 +143,12 @@
self.__release = JobReleaseButton(app, "release", self)
self.add_child(self.__release)
- def do_process(self, session, *args):
- self.show_column(session, "global_job_id")
- self.show_column(session, "custom_id")
- self.show_column(session, "cmd")
- self.show_column(session, "submitter")
- self.show_column(session, "custom_group")
- self.show_column(session, "job_status")
- super(SchedulerJobSet, self).do_process(session, *args)
-
+ def get_visible_columns(self, session):
+ return self.get_request_visible_columns(session, ["custom_group", "submitter"])
+
def render_sql_where(self, session, scheduler):
phase_sql = self.get_phase_sql(session)
- scheduler_sql = "scheduler_id = %i" % scheduler.id
+ scheduler_sql = "j.scheduler_id = %i" % scheduler.id
return "where %s" % " and ".join([phase_sql, scheduler_sql])
def render_title(self, session, scheduler):
Modified: mgmt/trunk/cumin/python/cumin/submitter.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/submitter.py 2008-09-22 19:47:10 UTC (rev 2525)
+++ mgmt/trunk/cumin/python/cumin/submitter.py 2008-09-22 19:48:09 UTC (rev 2526)
@@ -132,21 +132,15 @@
self.__release = JobReleaseButton(app, "release", self)
self.add_child(self.__release)
- def do_process(self, session, *args):
- self.show_column(session, "global_job_id")
- self.show_column(session, "custom_id")
- self.show_column(session, "cmd")
- self.show_column(session, "scheduler")
- self.show_column(session, "custom_group")
- self.show_column(session, "job_status")
- super(SubmitterJobSet, self).do_process(session, *args)
-
+ def get_visible_columns(self, session):
+ return self.get_request_visible_columns(session, ["custom_group", "scheduler"])
+
def render_sql_where(self, session, submitter):
phase_sql = self.get_phase_sql(session)
- submitter_sql = "owner = '%s'" % submitter.Name
+ submitter_sql = "j.submitter_id = %i" % submitter.id
return "where %s" % " and ".join([phase_sql, submitter_sql])
def render_title(self, session, submitter):
- submitter_sql = "owner = '%s'" % submitter.Name
+ submitter_sql = "submitter_id = %i" % submitter.id
return "Jobs %s" % fmt_count(Job.select(submitter_sql).count())
17 years, 7 months
rhmessaging commits: r2525 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-22 15:47:10 -0400 (Mon, 22 Sep 2008)
New Revision: 2525
Modified:
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/queue.py
Log:
Switch to new way to hide columns
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-09-22 19:46:15 UTC (rev 2524)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-09-22 19:47:10 UTC (rev 2525)
@@ -308,9 +308,8 @@
self.set_default_column_name("q_id")
- def do_process(self, session, *args):
- self.show_column(session, "q_id")
- return super(ExchangeBindingSet, self).do_process(session, *args)
+ def get_visible_columns(self, session):
+ return self.get_request_visible_columns(session, ["q_id"])
def render_title(self, session, exchange):
return "Queue Bindings %s" % \
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-09-22 19:46:15 UTC (rev 2524)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-09-22 19:47:10 UTC (rev 2525)
@@ -289,10 +289,9 @@
self.set_default_column_name("e_id")
- def do_process(self, session, *args):
- self.show_column(session, "e_id")
- super(QueueBindingSet, self).do_process(session, *args)
-
+ def get_visible_columns(self, session):
+ return self.get_request_visible_columns(session, ["e_id"])
+
def render_add_queue_binding_url(self, session, vhost):
branch = session.branch()
self.frame.show_queue_binding_add(branch)
17 years, 7 months
rhmessaging commits: r2524 - mgmt/trunk/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-22 15:46:15 -0400 (Mon, 22 Sep 2008)
New Revision: 2524
Modified:
mgmt/trunk/cumin/python/wooly/tables.py
Log:
Put visibility attribute on ItemTableColumn per Justin's recommendataion.
Modified: mgmt/trunk/cumin/python/wooly/tables.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/tables.py 2008-09-22 18:23:23 UTC (rev 2523)
+++ mgmt/trunk/cumin/python/wooly/tables.py 2008-09-22 19:46:15 UTC (rev 2524)
@@ -20,81 +20,37 @@
self.reversed.default = False
self.add_parameter(self.reversed)
- # list of columns that default to hidden
- self.hidden_column_names = list()
+ def get_visible_columns(self, session):
+ # default impl
+ return [col for col in self.columns if col.visible]
+
+ def get_request_visible_columns(self, session, vlist):
+ return [col for col in self.columns if col.visible or col.name in vlist]
- # list of column indexes that have been shown
- self.vcols = Attribute(app, "vcols")
- self.add_attribute(self.vcols)
-
- def add_hidden_column(self, column):
- self.add_column(column)
- self.hide_column(column.name)
-
- def hide_column(self, column_name):
- self.hidden_column_names.append(column_name)
-
- def show_column(self, session, column_name):
- if column_name in self.hidden_column_names:
- vlist = self.get_vlist(session)
- shown, vindex = self.is_shown(session, column_name, vlist)
- if not shown:
- vlist.append(vindex)
- vcols = "_".join(vlist)
- self.vcols.set(session, vcols)
-
def render_headers(self, session, *args):
writer = Writer()
- vlist = self.get_vlist(session)
- for column in self.columns:
- show = True
- if column.name in self.hidden_column_names:
- show, vindex = self.is_shown(session, column.name, vlist)
-
- if show:
- header = self.headers_by_column[column]
- writer.write(header.render(session))
+ vlist = self.get_visible_columns(session)
+ for column in vlist:
+ header = self.headers_by_column[column]
+ writer.write(header.render(session))
return writer.to_string()
def render_column_count(self, session, *args):
- vlist = self.get_vlist(session)
- return len(self.columns) - len(self.hidden_column_names) + len(vlist)
+ vlist = self.get_visible_columns(session)
+ return len(vlist)
def render_cells(self, session, item):
writer = Writer()
- vlist = self.get_vlist(session)
- for col in self.columns:
+ vlist = self.get_visible_columns(session)
+ for col in vlist:
col.set_item(session, item)
- render = True
- if col.name in self.hidden_column_names:
- render, vindex = self.is_shown(session, col.name, vlist)
-
- if render:
- writer.write(col.render(session))
+ writer.write(col.render(session))
return writer.to_string()
- def is_shown(self, session, name, vlist=None):
- if vlist is None:
- vlist = self.get_vlist(session)
- for i in range(len(self.columns)):
- if self.columns[i].name == name:
- return str(i) in vlist, str(i)
-
- return False, 0
-
- def get_vlist(self, session):
- """ get list of visibilized columns """
-
- vcols = self.vcols.get(session)
- if vcols:
- return vcols.split("_")
- else:
- return []
-
def add_column(self, column):
self.columns.append(column)
self.add_child(column)
@@ -135,7 +91,7 @@
def render_none(self, session, *args):
"""For producing a message when the table is empty"""
-
+
return None
class ItemTableColumn(Widget):
@@ -144,6 +100,7 @@
self.header_class = ItemTableColumnHeader
self.alignment = None
+ self.visible = True
self.__item = Attribute(app, "item")
self.add_attribute(self.__item)
17 years, 7 months
rhmessaging commits: r2523 - in mgmt/trunk/mint: sql and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-09-22 14:23:23 -0400 (Mon, 22 Sep 2008)
New Revision: 2523
Modified:
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/sql/schema.sql
Log:
temporary handling of namespace info in references; store absTime type values in a TimestampCol
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2008-09-22 18:23:12 UTC (rev 2522)
+++ mgmt/trunk/mint/python/mint/schema.py 2008-09-22 18:23:23 UTC (rev 2523)
@@ -512,7 +512,7 @@
session = ForeignKey('Session', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
attached = BoolCol(default=None)
- expireTime = BigIntCol(default=None)
+ expireTime = TimestampCol(default=None)
framesOutstanding = IntCol(default=None)
@@ -535,7 +535,7 @@
policyFile = StringCol(length=1000, default=None)
enforcingAcl = BoolCol(default=None)
transferAcl = BoolCol(default=None)
- lastAclLoad = BigIntCol(default=None)
+ lastAclLoad = TimestampCol(default=None)
def reloadACLFile(self, model, callback):
@@ -746,6 +746,7 @@
Arch = StringCol(length=1000, default=None)
CheckpointPlatform = StringCol(length=1000, default=None)
ClientMachine = StringCol(length=1000, default=None)
+ ConcurrencyLimits = StringCol(length=1000, default=None)
Cpus = IntCol(default=None)
CurrentRank = FloatCol(default=None)
Disk = IntCol(default=None)
@@ -754,7 +755,7 @@
ImageSize = IntCol(default=None)
IsValidCheckpointPlatform = StringCol(length=4000, default=None)
JobId = StringCol(length=1000, default=None)
- JobStart = BigIntCol(default=None)
+ JobStart = TimestampCol(default=None)
KFlops = IntCol(default=None)
Machine = StringCol(length=1000, default=None)
MaxJobRetirementTime = StringCol(length=4000, default=None)
@@ -763,6 +764,7 @@
MyAddress = StringCol(length=1000, default=None)
Name = StringCol(length=1000, default=None)
OpSys = StringCol(length=1000, default=None)
+ PreemptingConcurrencyLimits = StringCol(length=1000, default=None)
PreemptingOwner = StringCol(length=1000, default=None)
PreemptingUser = StringCol(length=1000, default=None)
PreemptingRank = FloatCol(default=None)
@@ -791,7 +793,7 @@
CondorPlatform = StringCol(length=1000, default=None)
CondorVersion = StringCol(length=1000, default=None)
- DaemonStartTime = BigIntCol(default=None)
+ DaemonStartTime = TimestampCol(default=None)
class SlotStats(SQLObject):
@@ -806,16 +808,16 @@
ClockMin = IntCol(default=None)
CondorLoadAvg = FloatCol(default=None)
ConsoleIdle = IntCol(default=None)
- EnteredCurrentActivity = BigIntCol(default=None)
- EnteredCurrentState = BigIntCol(default=None)
+ EnteredCurrentActivity = TimestampCol(default=None)
+ EnteredCurrentState = TimestampCol(default=None)
KeyboardIdle = IntCol(default=None)
- LastBenchmark = BigIntCol(default=None)
- LastFetchWorkCompleted = BigIntCol(default=None)
- LastFetchWorkSpawned = BigIntCol(default=None)
- LastPeriodicCheckpoint = BigIntCol(default=None)
+ LastBenchmark = TimestampCol(default=None)
+ LastFetchWorkCompleted = TimestampCol(default=None)
+ LastFetchWorkSpawned = TimestampCol(default=None)
+ LastPeriodicCheckpoint = TimestampCol(default=None)
LoadAvg = FloatCol(default=None)
- MyCurrentTime = BigIntCol(default=None)
- NextFetchWorkDelay = BigIntCol(default=None)
+ MyCurrentTime = TimestampCol(default=None)
+ NextFetchWorkDelay = TimestampCol(default=None)
State = StringCol(length=1000, default=None)
TimeToLive = IntCol(default=None)
TotalCondorLoadAvg = FloatCol(default=None)
@@ -839,7 +841,7 @@
MonitorSelfImageSize = FloatCol(default=None)
MonitorSelfRegisteredSocketCount = IntCol(default=None)
MonitorSelfResidentSetSize = IntCol(default=None)
- MonitorSelfTime = BigIntCol(default=None)
+ MonitorSelfTime = TimestampCol(default=None)
@@ -875,7 +877,7 @@
Out = StringCol(length=4000, default=None)
Owner = StringCol(length=1000, default=None)
ProcId = IntCol(default=None)
- QDate = BigIntCol(default=None)
+ QDate = TimestampCol(default=None)
Requirements = StringCol(length=4000, default=None)
Title = StringCol(length=1000, default=None)
UserLog = StringCol(length=4000, default=None)
@@ -964,7 +966,7 @@
statsCurr = ForeignKey('SchedulerStats', cascade='null', default=None)
statsPrev = ForeignKey('SchedulerStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
- JobQueueBirthdate = BigIntCol(default=None)
+ JobQueueBirthdate = TimestampCol(default=None)
MaxJobsRunning = IntCol(default=None)
Machine = StringCol(length=1000, default=None)
MyAddress = StringCol(length=1000, default=None)
@@ -973,7 +975,7 @@
CondorPlatform = StringCol(length=1000, default=None)
CondorVersion = StringCol(length=1000, default=None)
- DaemonStartTime = BigIntCol(default=None)
+ DaemonStartTime = TimestampCol(default=None)
class SchedulerStats(SQLObject):
@@ -995,7 +997,7 @@
MonitorSelfImageSize = FloatCol(default=None)
MonitorSelfRegisteredSocketCount = IntCol(default=None)
MonitorSelfResidentSetSize = IntCol(default=None)
- MonitorSelfTime = BigIntCol(default=None)
+ MonitorSelfTime = TimestampCol(default=None)
@@ -1163,8 +1165,8 @@
Journal.sqlmeta.addJoin(SQLMultipleJoin('JournalStats', joinMethodName='stats'))
-classToSchemaNameMap['Slot'] = 'slot'
-schemaNameToClassMap['slot'] = Slot
+classToSchemaNameMap['Slot'] = 'Slot'
+schemaNameToClassMap['Slot'] = Slot
Slot.sqlmeta.addJoin(SQLMultipleJoin('SlotStats', joinMethodName='stats'))
Modified: mgmt/trunk/mint/sql/schema.sql
===================================================================
--- mgmt/trunk/mint/sql/schema.sql 2008-09-22 18:23:12 UTC (rev 2522)
+++ mgmt/trunk/mint/sql/schema.sql 2008-09-22 18:23:23 UTC (rev 2523)
@@ -84,7 +84,7 @@
policy_file VARCHAR(1000),
enforcing_acl BOOL,
transfer_acl BOOL,
- last_acl_load BIGINT
+ last_acl_load TIMESTAMP
);
CREATE TABLE acl_stats (
@@ -311,7 +311,7 @@
out VARCHAR(4000),
owner VARCHAR(1000),
proc_id INT,
- q_date BIGINT,
+ q_date TIMESTAMP,
requirements VARCHAR(4000),
title VARCHAR(1000),
user_log VARCHAR(4000),
@@ -475,7 +475,7 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
- job_queue_birthdate BIGINT,
+ job_queue_birthdate TIMESTAMP,
max_jobs_running INT,
machine VARCHAR(1000),
my_address VARCHAR(1000),
@@ -483,7 +483,7 @@
public_network_ip_addr VARCHAR(1000),
condor_platform VARCHAR(1000),
condor_version VARCHAR(1000),
- daemon_start_time BIGINT
+ daemon_start_time TIMESTAMP
);
CREATE TABLE scheduler_stats (
@@ -501,7 +501,7 @@
monitor_self_image_size FLOAT,
monitor_self_registered_socket_count INT,
monitor_self_resident_set_size INT,
- monitor_self_time BIGINT
+ monitor_self_time TIMESTAMP
);
CREATE TABLE session (
@@ -526,7 +526,7 @@
rec_time TIMESTAMP,
session_id INT,
attached BOOL,
- expire_time BIGINT,
+ expire_time TIMESTAMP,
frames_outstanding INT
);
@@ -544,6 +544,7 @@
arch VARCHAR(1000),
checkpoint_platform VARCHAR(1000),
client_machine VARCHAR(1000),
+ concurrency_limits VARCHAR(1000),
cpus INT,
current_rank FLOAT,
disk INT,
@@ -552,7 +553,7 @@
image_size INT,
is_valid_checkpoint_platform VARCHAR(4000),
job_id VARCHAR(1000),
- job_start BIGINT,
+ job_start TIMESTAMP,
k_flops INT,
machine VARCHAR(1000),
max_job_retirement_time VARCHAR(4000),
@@ -561,6 +562,7 @@
my_address VARCHAR(1000),
name VARCHAR(1000),
op_sys VARCHAR(1000),
+ preempting_concurrency_limits VARCHAR(1000),
preempting_owner VARCHAR(1000),
preempting_user VARCHAR(1000),
preempting_rank FLOAT,
@@ -588,7 +590,7 @@
windows_minor_version INT,
condor_platform VARCHAR(1000),
condor_version VARCHAR(1000),
- daemon_start_time BIGINT
+ daemon_start_time TIMESTAMP
);
CREATE TABLE slot_stats (
@@ -600,16 +602,16 @@
clock_min INT,
condor_load_avg FLOAT,
console_idle INT,
- entered_current_activity BIGINT,
- entered_current_state BIGINT,
+ entered_current_activity TIMESTAMP,
+ entered_current_state TIMESTAMP,
keyboard_idle INT,
- last_benchmark BIGINT,
- last_fetch_work_completed BIGINT,
- last_fetch_work_spawned BIGINT,
- last_periodic_checkpoint BIGINT,
+ last_benchmark TIMESTAMP,
+ last_fetch_work_completed TIMESTAMP,
+ last_fetch_work_spawned TIMESTAMP,
+ last_periodic_checkpoint TIMESTAMP,
load_avg FLOAT,
- my_current_time BIGINT,
- next_fetch_work_delay BIGINT,
+ my_current_time TIMESTAMP,
+ next_fetch_work_delay TIMESTAMP,
state VARCHAR(1000),
time_to_live INT,
total_condor_load_avg FLOAT,
@@ -632,7 +634,7 @@
monitor_self_image_size FLOAT,
monitor_self_registered_socket_count INT,
monitor_self_resident_set_size INT,
- monitor_self_time BIGINT
+ monitor_self_time TIMESTAMP
);
CREATE TABLE store (
17 years, 7 months
rhmessaging commits: r2522 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-09-22 14:23:12 -0400 (Mon, 22 Sep 2008)
New Revision: 2522
Modified:
mgmt/trunk/mint/python/mint/schemaparser.py
Log:
temporary handling of namespace info in references; store absTime type values in a TimestampCol
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-09-22 17:20:08 UTC (rev 2521)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-09-22 18:23:12 UTC (rev 2522)
@@ -24,14 +24,14 @@
self.dataTypesMap["uint32"] = self.dataTypesMap["hilo32"] = self.dataTypesMap["count32"] = self.dataTypesMap["mma32"] = self.dataTypesMap["atomic32"] = "IntCol"
self.dataTypesMap["uint64"] = self.dataTypesMap["hilo64"] = self.dataTypesMap["count64"] = self.dataTypesMap["mma64"] = self.dataTypesMap["mmaTime"] = "BigIntCol"
self.dataTypesMap["float"] = self.dataTypesMap["double"] = "FloatCol"
- self.dataTypesMap["absTime"] = self.dataTypesMap["deltaTime"] = "BigIntCol"
+ self.dataTypesMap["absTime"] = "TimestampCol"
+ self.dataTypesMap["deltaTime"] = "BigIntCol"
self.dataTypesMap["bool"] = "BoolCol"
self.dataTypesMap["sstr"] = self.dataTypesMap["lstr"] = "StringCol"
self.dataTypesMap["map"] = "PickleCol"
# mapping for identifiers in the XML schema that are reserved words in either SQL or Python
self.reservedWords = {"in": "inRsv", "In": "InRsv",
- "connection": "clientConnection", "Connection": "ClientConnection",
- "other": "otherRsv"}
+ "connection": "clientConnection", "Connection": "ClientConnection"}
def renameReservedWord(self, name):
if (name in self.reservedWords.keys()):
@@ -92,8 +92,10 @@
elemName = self.renameReservedWord(elem["@name"])
if (elem["@type"] == "objId"):
reference = elem["@references"]
- # handle cases where the referenced class is in a different namespace (ie, contains a ".")
- namespaceIndex = reference.find(".")
+ #XXX: TO-DO: properly handle namespaces
+ # handle cases where the referenced class is in a different namespace (ie, contains a ".");
+ # for now, discard namespace
+ namespaceIndex = reference.rfind(".")
if (namespaceIndex > 0):
reference = reference[namespaceIndex + 1:]
reference = self.style.dbTableToPythonClass(reference)
17 years, 7 months
rhmessaging commits: r2521 - in mgmt/trunk: mint/python/mint and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-09-22 13:20:08 -0400 (Mon, 22 Sep 2008)
New Revision: 2521
Modified:
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/broker.strings
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/util.py
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/sql/schema.sql
Log:
Update the schema with the new acl and cluster modules.
Add UI metadata for new props and stats.
Add new tabs to broker to display module info.
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -266,10 +266,13 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.__body.add_mode(self.__tabs)
+ #self.__tabs.add_tab(BrokerStats(app, "stats"))
self.__tabs.add_tab(self.BrokerQueueTab(app, "queues"))
self.__tabs.add_tab(ExchangeSet(app, "exchanges"))
self.__tabs.add_tab(ConnectionSet(app, "conns"))
self.__tabs.add_tab(PeerSet(app, "peers"))
+ self.__tabs.add_tab(BrokerAccessControl(app, "access"))
+ self.__tabs.add_tab(BrokerClustering(app, "cluster"))
self.__tabs.add_tab(self.BrokerDetailsTab(app, "details"))
self.__missing = self.BrokerMissing(app, "missing")
@@ -324,13 +327,6 @@
self.frame.show_queue(branch, None).show_add(branch)
return branch.marshal()
- class BrokerStatsTab(Widget):
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def render_title(self, session, reg):
- return "Statistics"
-
class BrokerLogTab(Widget):
def get_args(self, session):
return self.frame.get_args(session)
@@ -379,6 +375,112 @@
return acts
+class ModuleNotEnabled(Widget):
+ def do_render(self, session):
+ return "This module is not enabled"
+
+class BrokerAccessControl(ModeSet):
+ def __init__(self, app, name):
+ super(BrokerAccessControl, self).__init__(app, name)
+
+ mode = ModuleNotEnabled(app, "notenabled")
+ self.add_mode(mode)
+
+ self.__view = BrokerAccessControlView(app, "view")
+ self.add_mode(self.__view)
+
+ def get_args(self, session):
+ broker = self.frame.get_object(session).broker
+ acl = None
+
+ try:
+ acl = Acl.selectBy(broker=broker)[0]
+ except IndexError:
+ pass
+
+ return (acl,)
+
+ def do_process(self, session, acl):
+ if acl:
+ self.show_mode(session, self.__view)
+
+ def render_title(self, session, acl):
+ return "Access Control"
+
+class BrokerAccessControlView(Widget):
+ def __init__(self, app, name):
+ super(BrokerAccessControlView, self).__init__(app, name)
+
+ props = self.Properties(app, "props")
+ self.add_child(props)
+
+ stats = self.Stats(app, "stats", "general")
+ self.add_child(stats)
+
+ class Properties(CuminProperties):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+ class Stats(StatSet):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+class BrokerClustering(ModeSet):
+ def __init__(self, app, name):
+ super(BrokerClustering, self).__init__(app, name)
+
+ mode = ModuleNotEnabled(app, "notenabled")
+ self.add_mode(mode)
+
+ self.__view = BrokerClusteringView(app, "view")
+ self.add_mode(self.__view)
+
+ def get_args(self, session):
+ broker = self.frame.get_object(session).broker
+ cluster = None
+
+ try:
+ cluster = Cluster.selectBy(broker=broker)[0]
+ except IndexError:
+ pass
+
+ return (cluster,)
+
+ def do_process(self, session, cluster):
+ if cluster:
+ self.show_mode(session, self.__view)
+
+ def render_title(self, session, cluster):
+ return "Clustering"
+
+class BrokerClusteringView(Widget):
+ def __init__(self, app, name):
+ super(BrokerClusteringView, self).__init__(app, name)
+
+ props = self.Properties(app, "props")
+ self.add_child(props)
+
+ stats = self.Stats(app, "stats", "general")
+ self.add_child(stats)
+
+ class Properties(CuminProperties):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+ class Stats(StatSet):
+ def get_args(self, session):
+ return self.parent.parent.get_args(session)
+
+class BrokerStats(Widget):
+ def __init__(self, app, name):
+ super(BrokerStats, self).__init__(app, name)
+
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_title(self, session, reg):
+ return "Statistics"
+
class BrokerBrowser(Widget):
def __init__(self, app, name):
super(BrokerBrowser, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.strings 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/broker.strings 2008-09-22 17:20:08 UTC (rev 2521)
@@ -102,6 +102,21 @@
</tbody>
</table>
+[BrokerStats.html]
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Access Control</h2>
+ {acl}
+ </td>
+ <td>
+<!-- -->
+ </td>
+ </tr>
+ </tbody>
+</table>
+
[BrokerBrowser.css]
table.BrokerBrowser {
width: 100%;
@@ -238,3 +253,37 @@
<input type="checkbox" id="{id}" name="{name}" value="{item_value}" tabindex="{tab_index}" {item_checked_attr}/>
<label for="{id}">{item_content}</label>
</div>
+
+[BrokerAccessControlView.html]
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Properties</h2>
+ {props}
+
+ <h2>Statistics</h2>
+ {stats}
+ </td>
+ <td>
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+[BrokerClusteringView.html]
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Properties</h2>
+ {props}
+
+ <h2>Statistics</h2>
+ {stats}
+ </td>
+ <td>
+ </td>
+ </tr>
+ </tbody>
+</table>
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -33,8 +33,10 @@
CuminSession(self)
CuminLink(self)
CuminRoute(self)
- CuminStore(self)
+ CuminBrokerStoreModule(self)
CuminJournal(self)
+ CuminBrokerAclModule(self)
+ CuminBrokerClusterModule(self)
CuminBrokerRegistration(self)
CuminBrokerGroup(self)
@@ -1342,9 +1344,10 @@
def do_invoke(self, link, args, completion):
link.close(self.cumin_model.data, completion)
-class CuminStore(RemoteClass):
+class CuminBrokerStoreModule(RemoteClass):
def __init__(self, model):
- super(CuminStore, self).__init__(model, "store", Store, StoreStats)
+ super(CuminBrokerStoreModule, self).__init__ \
+ (model, "store", Store, StoreStats)
prop = CuminProperty(self, "location")
prop.title = "Location"
@@ -1426,6 +1429,50 @@
stat.unit = "page"
stat.category = "io.journal"
+class CuminBrokerAclModule(RemoteClass):
+ def __init__(self, model):
+ super(CuminBrokerAclModule, self).__init__ \
+ (model, "store", Acl, AclStats)
+
+ prop = CuminProperty(self, "policyFile")
+ prop.title = "Policy File"
+
+ prop = CuminProperty(self, "enforcingAcl")
+ prop.title = "Enforcing?"
+
+ prop = CuminProperty(self, "transferAcl")
+ prop.title = "Transfer?"
+
+ prop = CuminProperty(self, "lastAclLoad")
+ prop.title = "Last Loaded"
+
+ stat = CuminStat(self, "aclDenyCount")
+ stat.title = "Denials"
+ stat.unit = "denial"
+
+class CuminBrokerClusterModule(RemoteClass):
+ def __init__(self, model):
+ super(CuminBrokerClusterModule, self).__init__ \
+ (model, "broker_cluster_module", Cluster, ClusterStats)
+
+ prop = CuminProperty(self, "clusterName")
+ prop.title = "Name"
+
+ prop = CuminProperty(self, "clusterID")
+ prop.title = "ID"
+
+ prop = CuminProperty(self, "publishedURL")
+ prop.title = "URL"
+
+ prop = CuminProperty(self, "clusterSize")
+ prop.title = "Size"
+
+ prop = CuminProperty(self, "status")
+ prop.title = "Status"
+
+ prop = CuminProperty(self, "members")
+ prop.title = "Members"
+
class CuminBrokerRegistration(LocalClass):
def __init__(self, model):
super(CuminBrokerRegistration, self).__init__ \
Modified: mgmt/trunk/cumin/python/cumin/util.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/util.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/cumin/python/cumin/util.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -3,6 +3,7 @@
from logging import getLogger
from time import mktime, time, sleep
from random import randint
+from xml.sax.saxutils import escape as xml_escape
import sys
def short_id():
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/mint/python/mint/schema.py 2008-09-22 17:20:08 UTC (rev 2521)
@@ -518,6 +518,96 @@
+class Acl(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ sourceScopeId = BigIntCol(default=None)
+ sourceObjectId = BigIntCol(default=None)
+ creationTime = TimestampCol(default=None)
+ deletionTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
+ statsCurr = ForeignKey('AclStats', cascade='null', default=None)
+ statsPrev = ForeignKey('AclStats', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ broker = ForeignKey('Broker', cascade='null', default=None)
+ policyFile = StringCol(length=1000, default=None)
+ enforcingAcl = BoolCol(default=None)
+ transferAcl = BoolCol(default=None)
+ lastAclLoad = BigIntCol(default=None)
+
+
+ def reloadACLFile(self, model, callback):
+ """Reload the ACL file"""
+ actualArgs = dict()
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "reloadACLFile",
+ callback, args=actualArgs)
+
+class AclStats(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ acl = ForeignKey('Acl', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ aclDenyCount = BigIntCol(default=None)
+
+
+
+
+class Cluster(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ sourceScopeId = BigIntCol(default=None)
+ sourceObjectId = BigIntCol(default=None)
+ creationTime = TimestampCol(default=None)
+ deletionTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
+ statsCurr = ForeignKey('ClusterStats', cascade='null', default=None)
+ statsPrev = ForeignKey('ClusterStats', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ broker = ForeignKey('Broker', cascade='null', default=None)
+ clusterName = StringCol(length=1000, default=None)
+ clusterID = StringCol(length=1000, default=None)
+ publishedURL = StringCol(length=1000, default=None)
+ clusterSize = SmallIntCol(default=None)
+ status = StringCol(length=1000, default=None)
+ members = StringCol(length=4000, default=None)
+
+
+ def stopClusterNode(self, model, callback):
+ actualArgs = dict()
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "stopClusterNode",
+ callback, args=actualArgs)
+
+ def stopFullCluster(self, model, callback):
+ actualArgs = dict()
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "stopFullCluster",
+ callback, args=actualArgs)
+
+class ClusterStats(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ cluster = ForeignKey('Cluster', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+
+
+
+
class Store(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -1041,6 +1131,22 @@
Session.sqlmeta.addJoin(SQLMultipleJoin('SessionStats', joinMethodName='stats'))
+classToSchemaNameMap['Acl'] = 'acl'
+schemaNameToClassMap['acl'] = Acl
+
+Broker.sqlmeta.addJoin(SQLMultipleJoin('Acl', joinMethodName='acls'))
+
+
+Acl.sqlmeta.addJoin(SQLMultipleJoin('AclStats', joinMethodName='stats'))
+
+classToSchemaNameMap['Cluster'] = 'cluster'
+schemaNameToClassMap['cluster'] = Cluster
+
+Broker.sqlmeta.addJoin(SQLMultipleJoin('Cluster', joinMethodName='clusters'))
+
+
+Cluster.sqlmeta.addJoin(SQLMultipleJoin('ClusterStats', joinMethodName='stats'))
+
classToSchemaNameMap['Store'] = 'Store'
schemaNameToClassMap['Store'] = Store
Modified: mgmt/trunk/mint/sql/schema.sql
===================================================================
--- mgmt/trunk/mint/sql/schema.sql 2008-09-22 15:47:59 UTC (rev 2520)
+++ mgmt/trunk/mint/sql/schema.sql 2008-09-22 17:20:08 UTC (rev 2521)
@@ -70,6 +70,30 @@
);
CREATE UNIQUE INDEX subject_role_mapping_unique ON subject_role_mapping (subject_id, role_id);
+CREATE TABLE acl (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ source_scope_id BIGINT,
+ source_object_id BIGINT,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
+ stats_curr_id INT,
+ stats_prev_id INT,
+ broker_id INT,
+ policy_file VARCHAR(1000),
+ enforcing_acl BOOL,
+ transfer_acl BOOL,
+ last_acl_load BIGINT
+);
+
+CREATE TABLE acl_stats (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ acl_id INT,
+ acl_deny_count BIGINT
+);
+
CREATE TABLE agent (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
@@ -200,6 +224,31 @@
bytes_to_client BIGINT
);
+CREATE TABLE cluster (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ source_scope_id BIGINT,
+ source_object_id BIGINT,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
+ stats_curr_id INT,
+ stats_prev_id INT,
+ broker_id INT,
+ cluster_name VARCHAR(1000),
+ cluster_id VARCHAR(1000),
+ published_ur_l VARCHAR(1000),
+ cluster_size SMALLINT,
+ status VARCHAR(1000),
+ members VARCHAR(4000)
+);
+
+CREATE TABLE cluster_stats (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ cluster_id INT
+);
+
CREATE TABLE exchange (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
@@ -708,6 +757,14 @@
ALTER TABLE subject_role_mapping ADD CONSTRAINT role_id_exists FOREIGN KEY (role_id) REFERENCES role (id) ON DELETE CASCADE;
+ALTER TABLE acl ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES acl_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE acl ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES acl_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE acl ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker (id) ON DELETE SET NULL;
+
+ALTER TABLE acl_stats ADD CONSTRAINT acl_id_exists FOREIGN KEY (acl_id) REFERENCES acl (id) ON DELETE SET NULL;
+
ALTER TABLE agent ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES agent_stats (id) ON DELETE SET NULL;
ALTER TABLE agent ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES agent_stats (id) ON DELETE SET NULL;
@@ -754,6 +811,14 @@
ALTER TABLE client_connection_stats ADD CONSTRAINT client_connection_id_exists FOREIGN KEY (client_connection_id) REFERENCES client_connection (id) ON DELETE SET NULL;
+ALTER TABLE cluster ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES cluster_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE cluster ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES cluster_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE cluster ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker (id) ON DELETE SET NULL;
+
+ALTER TABLE cluster_stats ADD CONSTRAINT cluster_id_exists FOREIGN KEY (cluster_id) REFERENCES cluster (id) ON DELETE SET NULL;
+
ALTER TABLE exchange ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES exchange_stats (id) ON DELETE SET NULL;
ALTER TABLE exchange ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES exchange_stats (id) ON DELETE SET NULL;
17 years, 7 months
rhmessaging commits: r2520 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-09-22 11:47:59 -0400 (Mon, 22 Sep 2008)
New Revision: 2520
Modified:
store/trunk/cpp/lib/jrnl/jinf.cpp
Log:
commented out test code that accidentally got checked in
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:31:44 UTC (rev 2519)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:47:59 UTC (rev 2520)
@@ -145,17 +145,69 @@
u_int16_t
jinf::analyze()
{
- lf_map early_map; // map for all owi flags same as fid 0
- lf_map late_map; // map for all owi flags opposite to fid 0
-
+// lf_map early_map; // map for all owi flags same as fid 0
+// lf_map late_map; // map for all owi flags opposite to fid 0
+//
+// if (!_valid_flag)
+// validate();
+// bool done = false;
+// for (u_int16_t fid=0; fid<_num_jfiles && !done; fid++)
+// {
+// std::ostringstream oss;
+// oss << _jdir << "/" << _base_filename << ".";
+// oss << std::setw(4) << std::setfill('0') << std::hex << fid;
+// oss << "." << JRNL_DATA_EXTENSION;
+// std::ifstream jifs(oss.str().c_str());
+// if (!jifs.good())
+// throw jexception(jerrno::JERR__FILEIO, oss.str(), "jinf", "analyze");
+// file_hdr fhdr;
+// jifs.read((char*)&fhdr, sizeof(fhdr));
+// if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
+// {
+// if (!fid)
+// throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
+// _frot = true;
+// done = true;
+// }
+// else
+// {
+// assert(fid == fhdr._fid);
+// if (fid == 0)
+// {
+// _initial_owi = fhdr.get_owi();
+// early_map.insert(fhdr._lid, fid);
+// }
+// else
+// {
+// if (_initial_owi == fhdr.get_owi())
+// early_map.insert(fhdr._lid, fid);
+// else
+// late_map.insert(fhdr._lid, fid);
+// }
+// }
+// jifs.close();
+// } // for (fid)
+//
+// // If this is not the first rotation, all files should be in either early or late maps
+// if (!_frot) assert(early_map.size() + late_map.size() == _num_jfiles);
+//
+// if (late_map.empty())
+// _start_file = 0;
+// else
+// _start_file = (*late_map.begin()).second;
+// -------------------
+ u_int16_t ffid = 0xffff;
+ bool owi = false;
+ bool done = false;
+
if (!_valid_flag)
validate();
- bool done = false;
- for (u_int16_t fid=0; fid<_num_jfiles && !done; fid++)
+ u_int16_t fnum=0;
+ while (!done && fnum < _num_jfiles)
{
std::ostringstream oss;
oss << _jdir << "/" << _base_filename << ".";
- oss << std::setw(4) << std::setfill('0') << std::hex << fid;
+ oss << std::setw(4) << std::setfill('0') << std::hex << fnum;
oss << "." << JRNL_DATA_EXTENSION;
std::ifstream jifs(oss.str().c_str());
if (!jifs.good())
@@ -164,80 +216,28 @@
jifs.read((char*)&fhdr, sizeof(fhdr));
if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
{
- if (!fid)
+ if (!fnum)
throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
_frot = true;
done = true;
}
- else
+ else if (fnum == 0) // First file only
{
- assert(fid == fhdr._fid);
- if (fid == 0)
- {
- _initial_owi = fhdr.get_owi();
- early_map.insert(fhdr._lid, fid);
- }
- else
- {
- if (_initial_owi == fhdr.get_owi())
- early_map.insert(fhdr._lid, fid);
- else
- late_map.insert(fhdr._lid, fid);
- }
+ owi = fhdr.get_owi();
+ _initial_owi = owi;
+ ffid = 0;
}
+ else if (fhdr.get_owi() != owi) // Change in OWI
+ {
+ ffid = fnum;
+ done = true;
+ }
+ else
+ _end_file = fnum;
jifs.close();
- } // for (fid)
-
- // If this is not the first rotation, all files should be in either early or late maps
- if (!_frot) assert(early_map.size() + late_map.size() == _num_jfiles);
-
- if (late_map.empty())
- _start_file = 0;
- else
- _start_file = (*late_map.begin()).second;
-// -------------------
-// u_int16_t ffid = 0xffff;
-// bool owi = false;
-// bool done = false;
-//
-// if (!_valid_flag)
-// validate();
-// u_int16_t fnum=0;
-// while (!done && fnum < _num_jfiles)
-// {
-// std::ostringstream oss;
-// oss << _jdir << "/" << _base_filename << ".";
-// oss << std::setw(4) << std::setfill('0') << std::hex << fnum;
-// oss << "." << JRNL_DATA_EXTENSION;
-// std::ifstream jifs(oss.str().c_str());
-// if (!jifs.good())
-// throw jexception(jerrno::JERR__FILEIO, oss.str(), "jinf", "analyze");
-// file_hdr fhdr;
-// jifs.read((char*)&fhdr, sizeof(fhdr));
-// if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
-// {
-// if (!fnum)
-// throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
-// _frot = true;
-// done = true;
-// }
-// else if (fnum == 0) // First file only
-// {
-// owi = fhdr.get_owi();
-// _initial_owi = owi;
-// ffid = 0;
-// }
-// else if (fhdr.get_owi() != owi) // Change in OWI
-// {
-// ffid = fnum;
-// done = true;
-// }
-// else
-// _end_file = fnum;
-// jifs.close();
-// fnum++;
-// }
-// _start_file = ffid;
+ fnum++;
+ }
+ _start_file = ffid;
_analyzed_flag = true;
return _start_file;
}
17 years, 7 months
rhmessaging commits: r2519 - in store/trunk/cpp: lib/jrnl and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-09-22 11:31:44 -0400 (Mon, 22 Sep 2008)
New Revision: 2519
Added:
store/trunk/cpp/lib/jrnl/lf_map.cpp
store/trunk/cpp/lib/jrnl/lf_map.hpp
Modified:
store/trunk/cpp/lib/Makefile.am
store/trunk/cpp/lib/jrnl/file_hdr.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
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/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp
store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
Log:
Backport of r.2518 on 1.0 branch: Further bug uncovered by testing for BZ458053. This is a logic error handling recovered records where the end of the record coincides with the end of the file.
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/Makefile.am 2008-09-22 15:31:44 UTC (rev 2519)
@@ -55,6 +55,7 @@
jrnl/jexception.cpp \
jrnl/jinf.cpp \
jrnl/jrec.cpp \
+ jrnl/lf_map.cpp \
jrnl/pmgr.cpp \
jrnl/rmgr.cpp \
jrnl/rrfc.cpp \
@@ -84,6 +85,7 @@
jrnl/jexception.hpp \
jrnl/jinf.hpp \
jrnl/jrec.hpp \
+ jrnl/lf_map.hpp \
jrnl/pmgr.hpp \
jrnl/rcvdat.hpp \
jrnl/rec_hdr.hpp \
Modified: store/trunk/cpp/lib/jrnl/file_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -65,7 +65,7 @@
* +---+---+---+---+---+---+---+---+ | struct hdr
* | first rid in file | |
* +---+---+---+---+---+---+---+---+ -+
- * | fid | reserved (0) |
+ * | fid | lid | reserved (0) |
* +---+---+---+---+---+---+---+---+
* | fro |
* +---+---+---+---+---+---+---+---+
@@ -77,6 +77,7 @@
* number should be incremented)
* e = endian flag, false (0x00) for little endian, true (0x01) for big endian
* fid = File ID (number used in naming file)
+ * lid = Logical ID (order used in circular buffer)
* fro = First record offset, offset from start of file to first record header
* </pre>
*
@@ -87,12 +88,13 @@
*/
struct file_hdr : rec_hdr
{
- u_int32_t _fid; ///< File ID (fid)
+ u_int16_t _fid; ///< File ID (fid)
+ u_int16_t _lid; ///< Logical ID (lid)
u_int32_t _res; ///< Reserved (for alignment/flags)
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Big-endian filler for 32-bit size_t
#endif
- std::size_t _fro; ///< First record offset
+ std::size_t _fro; ///< First record offset
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Little-endian filler for 32-bit size_t
#endif
@@ -114,7 +116,7 @@
/**
* \brief Default constructor, which sets all values to 0.
*/
- inline file_hdr(): rec_hdr(), _fid(0), _res(0),
+ inline file_hdr(): rec_hdr(), _fid(0), _lid(0), _res(0),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
@@ -142,8 +144,9 @@
* \brief Convenience constructor which initializes values during construction.
*/
inline file_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
- const u_int32_t fid, const std::size_t fro, const bool owi, const bool settime = false):
- rec_hdr(magic, version, rid, owi), _fid(fid), _res(0),
+ const u_int16_t fid, const u_int16_t lid, const std::size_t fro,
+ const bool owi, const bool settime = false):
+ rec_hdr(magic, version, rid, owi), _fid(fid), _lid(lid), _res(0),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -860,7 +860,7 @@
rd._eo = start_file_offs;
return false;
}
- if (!jfile_cycle(fid, ifsp, lowi, rd, false))
+ if (!done && !jfile_cycle(fid, ifsp, lowi, rd, false))
return false;
}
return true;
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -117,6 +117,7 @@
const u_int32_t jerrno::JERR_JINF_NOVALUESTR = 0x0c01;
const u_int32_t jerrno::JERR_JINF_BADVALUESTR = 0x0c02;
const u_int32_t jerrno::JERR_JINF_JDATEMPTY = 0x0c03;
+const u_int32_t jerrno::JERR_JINF_TOOMANYFILES = 0x0c04;
// static initialization fn
@@ -218,6 +219,7 @@
_err_map[JERR_JINF_BADVALUESTR] = "JERR_JINF_BADVALUESTR: "
"Bad format for value attribute in jinf file";
_err_map[JERR_JINF_JDATEMPTY] = "JERR_JINF_JDATEMPTY: Journal data files empty.";
+ _err_map[JERR_JINF_TOOMANYFILES] = "JERR_JINF_TOOMANYFILES: Too many journal data files.";
//_err_map[] = "";
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -135,6 +135,7 @@
static const u_int32_t JERR_JINF_NOVALUESTR; ///< No value attr found in jinf file
static const u_int32_t JERR_JINF_BADVALUESTR; ///< Bad format for value attr in jinf file
static const u_int32_t JERR_JINF_JDATEMPTY; ///< Journal data files empty
+ static const u_int32_t JERR_JINF_TOOMANYFILES; ///< Too many journal data files
/**
* \brief Method to access error message from known error number.
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -38,6 +38,7 @@
#include "jrnl/file_hdr.hpp"
#include "jrnl/jcntl.hpp"
#include "jrnl/jerrno.hpp"
+#include "jrnl/lf_map.hpp"
#include <sstream>
namespace mrg
@@ -112,6 +113,12 @@
oss << "; minimum=" << JRNL_MIN_NUM_FILES << std::endl;
err = true;
}
+ if (_num_jfiles > JRNL_MAX_NUM_FILES)
+ {
+ oss << "Number of journal files too large: found=" << _num_jfiles;
+ oss << "; maximum=" << JRNL_MAX_NUM_FILES << std::endl;
+ err = true;
+ }
if (_jfsize_sblks < JRNL_MIN_FILE_SIZE)
{
oss << "Journal file size too small: found=" << _jfsize_sblks;
@@ -138,18 +145,17 @@
u_int16_t
jinf::analyze()
{
- u_int16_t ffid = 0xffff;
- bool owi = false;
- bool done = false;
-
+ lf_map early_map; // map for all owi flags same as fid 0
+ lf_map late_map; // map for all owi flags opposite to fid 0
+
if (!_valid_flag)
validate();
- u_int16_t fnum=0;
- while (!done && fnum < _num_jfiles)
+ bool done = false;
+ for (u_int16_t fid=0; fid<_num_jfiles && !done; fid++)
{
std::ostringstream oss;
oss << _jdir << "/" << _base_filename << ".";
- oss << std::setw(4) << std::setfill('0') << std::hex << fnum;
+ oss << std::setw(4) << std::setfill('0') << std::hex << fid;
oss << "." << JRNL_DATA_EXTENSION;
std::ifstream jifs(oss.str().c_str());
if (!jifs.good())
@@ -158,28 +164,80 @@
jifs.read((char*)&fhdr, sizeof(fhdr));
if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
{
- if (!fnum)
+ if (!fid)
throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
_frot = true;
done = true;
}
- else if (fnum == 0) // First file only
+ else
{
- owi = fhdr.get_owi();
- _initial_owi = owi;
- ffid = 0;
+ assert(fid == fhdr._fid);
+ if (fid == 0)
+ {
+ _initial_owi = fhdr.get_owi();
+ early_map.insert(fhdr._lid, fid);
+ }
+ else
+ {
+ if (_initial_owi == fhdr.get_owi())
+ early_map.insert(fhdr._lid, fid);
+ else
+ late_map.insert(fhdr._lid, fid);
+ }
}
- else if (fhdr.get_owi() != owi) // Change in OWI
- {
- ffid = fnum;
- done = true;
- }
- else
- _end_file = fnum;
jifs.close();
- fnum++;
- }
- _start_file = ffid;
+ } // for (fid)
+
+ // If this is not the first rotation, all files should be in either early or late maps
+ if (!_frot) assert(early_map.size() + late_map.size() == _num_jfiles);
+
+ if (late_map.empty())
+ _start_file = 0;
+ else
+ _start_file = (*late_map.begin()).second;
+// -------------------
+// u_int16_t ffid = 0xffff;
+// bool owi = false;
+// bool done = false;
+//
+// if (!_valid_flag)
+// validate();
+// u_int16_t fnum=0;
+// while (!done && fnum < _num_jfiles)
+// {
+// std::ostringstream oss;
+// oss << _jdir << "/" << _base_filename << ".";
+// oss << std::setw(4) << std::setfill('0') << std::hex << fnum;
+// oss << "." << JRNL_DATA_EXTENSION;
+// std::ifstream jifs(oss.str().c_str());
+// if (!jifs.good())
+// throw jexception(jerrno::JERR__FILEIO, oss.str(), "jinf", "analyze");
+// file_hdr fhdr;
+// jifs.read((char*)&fhdr, sizeof(fhdr));
+// if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
+// {
+// if (!fnum)
+// throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
+// _frot = true;
+// done = true;
+// }
+// else if (fnum == 0) // First file only
+// {
+// owi = fhdr.get_owi();
+// _initial_owi = owi;
+// ffid = 0;
+// }
+// else if (fhdr.get_owi() != owi) // Change in OWI
+// {
+// ffid = fnum;
+// done = true;
+// }
+// else
+// _end_file = fnum;
+// jifs.close();
+// fnum++;
+// }
+// _start_file = ffid;
_analyzed_flag = true;
return _start_file;
}
@@ -197,6 +255,14 @@
}
u_int16_t
+jinf::incr_num_jfiles()
+{
+ if (_num_jfiles >= JRNL_MAX_NUM_FILES)
+ throw jexception(jerrno::JERR_JINF_TOOMANYFILES, "jinf", "incr_num_jfiles");
+ return ++_num_jfiles;
+}
+
+u_int16_t
jinf::get_start_file()
{
if (!_analyzed_flag)
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -89,6 +89,7 @@
inline const std::string& base_filename() const { return _base_filename; }
inline const timespec& ts() const { return _ts; }
inline u_int16_t num_jfiles() const { return _num_jfiles; }
+ u_int16_t incr_num_jfiles();
inline u_int32_t jfsize_sblks() const { return _jfsize_sblks; }
inline u_int16_t sblk_size_dblks() const { return _sblk_size_dblks; }
inline u_int32_t dblk_size() const { return _dblk_size; }
Added: store/trunk/cpp/lib/jrnl/lf_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lf_map.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/lf_map.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -0,0 +1,65 @@
+/**
+* \file lf_map.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class mrg::journal::lf_map (logical file map). See
+* comments in file lf_map.hpp for details.
+*
+* Copyright (C) 2007, 2008 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 "jrnl/lf_map.hpp"
+
+#include "jrnl/jerrno.hpp"
+#include "jrnl/jexception.hpp"
+#include <sstream>
+
+namespace mrg
+{
+namespace journal
+{
+lf_map::lf_map() : _map() {}
+lf_map::~lf_map() {}
+
+void
+lf_map::insert(u_int16_t lid, u_int16_t fid)
+{
+ lfpair ip = lfpair(lid, fid);
+ lfret ret = _map.insert(ip);
+ if (ret.second == false)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "lid=0x" << lid << " fid=0x" << fid;
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "lf_map", "insert");
+ }
+}
+
+void
+lf_map::get_fid_list(std::vector<u_int16_t>& fid_list)
+{
+ for (lfmap_citr i = _map.begin(); i != _map.end(); i++)
+ fid_list.push_back(i->second);
+}
+
+} // namespace journal
+} // namespace mrg
Added: store/trunk/cpp/lib/jrnl/lf_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lf_map.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/lf_map.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -0,0 +1,76 @@
+/**
+* \file lf_map.hpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class mrg::journal::lf_map (logical file map).
+* See class documentation for details.
+*
+* \author Kim van der Riet
+*
+* Copyright (C) 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.
+*/
+
+#ifndef mrg_journal_lf_map_hpp
+#define mrg_journal_lf_map_hpp
+
+#include <map>
+#include <sys/types.h>
+#include <vector>
+
+namespace mrg
+{
+namespace journal
+{
+ /**
+ * \class lf_map
+ * \brief Maps the logical file id (lid) to the physical file id (fid)
+ * in the journal. NOTE: NOT THREAD SAFE - use only in
+ * single-threaded environments.
+ */
+ class lf_map
+ {
+ public:
+ typedef std::map<u_int16_t, u_int16_t> lfmap;
+ typedef lfmap::const_iterator lfmap_citr;
+
+ private:
+ typedef std::pair<u_int16_t, u_int16_t> lfpair;
+ typedef std::pair<lfmap::iterator, bool> lfret;
+ lfmap _map;
+
+ public:
+ lf_map();
+ virtual ~lf_map();
+
+ void insert(u_int16_t lid, u_int16_t fid);
+ inline u_int16_t size() const { return u_int16_t(_map.size()); }
+ inline bool empty() const { return _map.empty(); }
+ inline lfmap_citr begin() { return _map.begin(); }
+ inline lfmap_citr end() { return _map.end(); }
+ void get_fid_list(std::vector<u_int16_t>& fid_list);
+ };
+
+} // namespace journal
+} // namespace mrg
+
+#endif // ifndef mrg_journal_lf_map_hpp
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -217,7 +217,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -358,7 +358,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -497,7 +497,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -632,7 +632,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -1048,9 +1048,9 @@
}
void
-wmgr::write_fhdr(u_int64_t rid, u_int32_t fid, std::size_t fro)
+wmgr::write_fhdr(u_int64_t rid, u_int16_t fid, u_int16_t lid, std::size_t fro)
{
- file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, rid, fid, fro, _wrfc.owi(), true);
+ file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, rid, fid, lid, fro, _wrfc.owi(), true);
std::memcpy(_fhdr_ptr_arr[fid], &fhdr, sizeof(fhdr));
#ifdef RHM_CLEAN
std::memset((char*)_fhdr_ptr_arr[fid] + sizeof(fhdr), RHM_CLEAN_CHAR, _sblksize - sizeof(fhdr));
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -133,7 +133,7 @@
iores write_flush();
iores rotate_file();
void dblk_roundup();
- void write_fhdr(u_int64_t rid, u_int32_t fid, std::size_t fro);
+ void write_fhdr(u_int64_t rid, u_int16_t fid, u_int16_t lid, std::size_t fro);
void rotate_page();
void clean();
};
Modified: store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -144,7 +144,8 @@
const u_int8_t version = 0xa5;
const u_int16_t uflag = 0x5537;
const u_int64_t rid = 0xfedcba9876543210ULL;
- const u_int32_t fid = 0xfedcba98UL;
+ const u_int16_t fid = 0xfedcU;
+ const u_int16_t lid = 0xf0e1U;
#ifdef JRNL_32_BIT
const std::size_t fro = 0xfedcba98UL;
#else
@@ -161,6 +162,7 @@
BOOST_CHECK_EQUAL(fh1._uflag, 0);
BOOST_CHECK_EQUAL(fh1._rid, 0ULL);
BOOST_CHECK_EQUAL(fh1._fid, 0UL);
+ BOOST_CHECK_EQUAL(fh1._lid, 0U);
BOOST_CHECK_EQUAL(fh1._fro, std::size_t(0));
BOOST_CHECK_EQUAL(fh1._ts_sec, std::time_t(0));
BOOST_CHECK_EQUAL(fh1._ts_nsec, uint32_t(0));
@@ -168,7 +170,7 @@
}
{
- file_hdr fh2(magic, version, rid, fid, fro, owi, false);
+ file_hdr fh2(magic, version, rid, fid, lid, fro, owi, false);
BOOST_CHECK_EQUAL(fh2._magic, magic);
BOOST_CHECK_EQUAL(fh2._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -178,7 +180,8 @@
#endif
BOOST_CHECK_EQUAL(fh2._uflag, (const u_int16_t)rec_hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(fh2._rid, rid);
- BOOST_CHECK_EQUAL(fh2._fid,fid );
+ BOOST_CHECK_EQUAL(fh2._fid, fid );
+ BOOST_CHECK_EQUAL(fh2._lid, lid);
BOOST_CHECK_EQUAL(fh2._fro, fro);
BOOST_CHECK_EQUAL(fh2._ts_sec, std::time_t(0));
BOOST_CHECK_EQUAL(fh2._ts_nsec, uint32_t(0));
@@ -202,7 +205,7 @@
}
{
- file_hdr fh3(magic, version, rid, fid, fro, owi, true);
+ file_hdr fh3(magic, version, rid, fid, lid, fro, owi, true);
BOOST_CHECK_EQUAL(fh3._magic, magic);
BOOST_CHECK_EQUAL(fh3._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -213,6 +216,7 @@
BOOST_CHECK_EQUAL(fh3._uflag, (const u_int16_t)rec_hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(fh3._rid, rid);
BOOST_CHECK_EQUAL(fh3._fid, fid);
+ BOOST_CHECK_EQUAL(fh3._lid, lid);
BOOST_CHECK_EQUAL(fh3._fro, fro);
BOOST_CHECK(fh3._ts_sec - ts.tv_sec <= 1); // No more than 1 sec difference
}
Modified: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-09-22 15:31:44 UTC (rev 2519)
@@ -222,16 +222,17 @@
class FileHdr(Hdr):
- format = '=I4x3Q'
+ format = '=2H4x3Q'
- def init(self, f, foffs, fid, fro, time_sec, time_ns):
+ def init(self, f, foffs, fid, lid, fro, time_sec, time_ns):
self.fid = fid
+ self.lid = lid
self.fro = fro
self.time_sec = time_sec
self.time_ns = time_ns
def __str__(self):
- return '%s fid=%d fro=0x%08x t=%s' % (Hdr.__str__(self), self.fid, self.fro, self.timestamp_str())
+ return '%s fid=%d lid=%d fro=0x%08x t=%s' % (Hdr.__str__(self), self.fid, self.lid, self.fro, self.timestamp_str())
def skip(self, f):
f.read(rem_in_blk(f, sblk_size))
17 years, 7 months
rhmessaging commits: r2518 - store/branches/mrg-1.0/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-09-22 11:30:26 -0400 (Mon, 22 Sep 2008)
New Revision: 2518
Modified:
store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp
Log:
Further bug uncovered by testing for BZ458053. This is a logic error handling recovered records where the end of the record coincides with the end of the file.
Modified: store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp 2008-09-22 15:29:40 UTC (rev 2517)
+++ store/branches/mrg-1.0/cpp/lib/jrnl/jcntl.cpp 2008-09-22 15:30:26 UTC (rev 2518)
@@ -865,7 +865,7 @@
rd._eo = start_file_offs;
return false;
}
- if (!jfile_cycle(fid, ifsp, lowi, rd, false))
+ if (!done && !jfile_cycle(fid, ifsp, lowi, rd, false))
return false;
}
return true;
17 years, 7 months
rhmessaging commits: r2517 - in store/trunk/cpp/tests: python_tests and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2008-09-22 11:29:40 -0400 (Mon, 22 Sep 2008)
New Revision: 2517
Modified:
store/trunk/cpp/tests/OrderingTest.cpp
store/trunk/cpp/tests/SimpleTest.cpp
store/trunk/cpp/tests/TransactionalTest.cpp
store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
store/trunk/cpp/tests/python_tests/flow_to_disk.py
Log:
Changes for tests to match with signature changes in qpids Queue.h
Modified: store/trunk/cpp/tests/OrderingTest.cpp
===================================================================
--- store/trunk/cpp/tests/OrderingTest.cpp 2008-09-22 11:36:16 UTC (rev 2516)
+++ store/trunk/cpp/tests/OrderingTest.cpp 2008-09-22 15:29:40 UTC (rev 2517)
@@ -79,7 +79,9 @@
{
boost::intrusive_ptr<Message> msg = queue->get().payload;
if (msg) {
- queue->dequeue(0, msg);
+ QueuedMessage qm;
+ qm.payload = msg;
+ queue->dequeue(0, qm);
BOOST_CHECK_EQUAL(ids.front(), msg->getProperties<MessageProperties>()->getMessageId());
ids.pop();
return true;
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2008-09-22 11:36:16 UTC (rev 2516)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2008-09-22 15:29:40 UTC (rev 2517)
@@ -196,7 +196,7 @@
{
cout << test_filename << ".QueueCreateWithSettings: " << flush;
- QueuePolicy policy(101, 202);
+ std::auto_ptr<QueuePolicy> policy( QueuePolicy::createQueuePolicy(101, 202));
string name("MyDurableQueue");
{
MessageStoreImpl store;
@@ -204,7 +204,7 @@
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
- policy.update(settings);
+ policy->update(settings);
queue.create(settings);
BOOST_REQUIRE(queue.getPersistenceId());
}//db will be closed
@@ -217,8 +217,8 @@
Queue::shared_ptr queue = registry.find(name);
BOOST_REQUIRE(queue);
BOOST_REQUIRE(queue->getPolicy());
- BOOST_CHECK_EQUAL(policy.getMaxCount(), queue->getPolicy()->getMaxCount());
- BOOST_CHECK_EQUAL(policy.getMaxSize(), queue->getPolicy()->getMaxSize());
+ BOOST_CHECK_EQUAL(policy->getMaxCount(), queue->getPolicy()->getMaxCount());
+ BOOST_CHECK_EQUAL(policy->getMaxSize(), queue->getPolicy()->getMaxSize());
}
cout << "ok" << endl;
@@ -335,8 +335,10 @@
MessageUtils::addContent(msg, data);
msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
+ QueuedMessage qm;
+ qm.payload = msg;
queue->enqueue(0, msg);
- queue->dequeue(0, msg);
+ queue->dequeue(0, qm);
}//db will be closed
{
MessageStoreImpl store;
@@ -434,8 +436,8 @@
//load lazily
DummyHandler handler;
- QueuedMessage qm(queue.get(),msg,0);
- MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getMessageDeliveryToken("ignore", 0, 0), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12
+ QueuedMessage qm(queue.get(),msg,0);
+ MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getMessageDeliveryToken("ignore", 0, 0), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12
BOOST_REQUIRE(handler.frames.size() > 2);
string loaded;
@@ -447,7 +449,7 @@
BOOST_CHECK_EQUAL(data1 + data2, loaded);
//dequeue
- queue->dequeue(0, msg);
+ queue->dequeue(0, qm);
}
cout << "ok" << endl;
Modified: store/trunk/cpp/tests/TransactionalTest.cpp
===================================================================
--- store/trunk/cpp/tests/TransactionalTest.cpp 2008-09-22 11:36:16 UTC (rev 2516)
+++ store/trunk/cpp/tests/TransactionalTest.cpp 2008-09-22 15:29:40 UTC (rev 2517)
@@ -170,7 +170,9 @@
//move the message from one queue to the other as a transaction
std::auto_ptr<TransactionContext> txn = store->begin();
queueB->enqueue(txn.get(), msgB);//note: need to enqueue it first to avoid message being deleted
- queueA->dequeue(txn.get(), msgB);
+ QueuedMessage qmB;
+ qmB.payload = msgB;
+ queueA->dequeue(txn.get(), qmB);
if (commit) {
store->commit(*txn);
} else {
Modified: store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
===================================================================
--- store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2008-09-22 11:36:16 UTC (rev 2516)
+++ store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2008-09-22 15:29:40 UTC (rev 2517)
@@ -282,16 +282,16 @@
void swap(TPCTransactionContext* txn, Queue::shared_ptr& from, Queue::shared_ptr& to)
{
- msg1 = from->get().payload;//just dequeues in memory
+ QueuedMessage msg1 = from->get();//just dequeues in memory
//move the message from one queue to the other as part of a
//distributed transaction
- to->enqueue(txn, msg1);//note: need to enqueue it first to avoid message being deleted
+ to->enqueue(txn, msg1.payload);//note: need to enqueue it first to avoid message being deleted
from->dequeue(txn, msg1);
}
void dequeue(TPCTransactionContext* txn, Queue::shared_ptr& queue)
{
- msg2 = queue->get().payload;//just dequeues in memory
+ QueuedMessage msg2 = queue->get();//just dequeues in memory
queue->dequeue(txn, msg2);
}
Modified: store/trunk/cpp/tests/python_tests/flow_to_disk.py
===================================================================
--- store/trunk/cpp/tests/python_tests/flow_to_disk.py 2008-09-22 11:36:16 UTC (rev 2516)
+++ store/trunk/cpp/tests/python_tests/flow_to_disk.py 2008-09-22 15:29:40 UTC (rev 2517)
@@ -26,35 +26,35 @@
"""Tests for async store flow-to-disk"""
def test_01_simple_max_count_transient(self):
- queue_args = {'qpid.max_count': 10}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_count': 10}
self.simple_limit("test_simple_max_count_transient", queue_args, self.session.delivery_mode.non_persistent, self.session.acquire_mode.pre_acquired)
def test_02_simple_max_count_persistent(self):
- queue_args = {'qpid.max_count': 10}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_count': 10}
self.simple_limit("test_simple_max_count_persistent", queue_args, self.session.delivery_mode.persistent, self.session.acquire_mode.pre_acquired)
def test_03_simple_max_size_transient(self):
- queue_args = {'qpid.max_size': 100}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_size': 100}
self.simple_limit("test_simple_max_size_transient", queue_args, self.session.delivery_mode.non_persistent, self.session.acquire_mode.pre_acquired)
def test_04_simple_max_size_persistent(self):
- queue_args = {'qpid.max_size': 100}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_size': 100}
self.simple_limit("test_simple_max_size_persistent", queue_args, self.session.delivery_mode.persistent, self.session.acquire_mode.pre_acquired)
def test_05_simple_max_count_transient_not_acquired(self):
- queue_args = {'qpid.max_count': 10}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_count': 10}
self.simple_limit("test_simple_max_count_transient_not_acquired", queue_args, self.session.delivery_mode.non_persistent, self.session.acquire_mode.not_acquired)
def test_06_simple_max_count_persistent_not_acquired(self):
- queue_args = {'qpid.max_count': 10}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_count': 10}
self.simple_limit("test_simple_max_count_persistent_not_acquired", queue_args, self.session.delivery_mode.persistent, self.session.acquire_mode.not_acquired)
def test_07_simple_max_size_transient_not_acquired(self):
- queue_args = {'qpid.max_size': 100}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_size': 100}
self.simple_limit("test_simple_max_size_transient_not_acquired", queue_args, self.session.delivery_mode.non_persistent, self.session.acquire_mode.not_acquired)
def test_08_simple_max_size_persistent_not_acquired(self):
- queue_args = {'qpid.max_size': 100}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_size': 100}
self.simple_limit("test_simple_max_size_persistent_not_acquired", queue_args, self.session.delivery_mode.persistent, self.session.acquire_mode.not_acquired)
def simple_limit(self, queue_name, queue_args, delivery_mode, acquire_mode):
@@ -102,19 +102,19 @@
def test_09_max_count_browse_consume_transient(self):
- queue_args = {'qpid.max_count': 10}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_count': 10}
self.not_acquired_browse_consume_limit("test_max_count_browse_consume_transient", queue_args, self.session.delivery_mode.non_persistent)
def test_10_max_count_browse_consume_persistent(self):
- queue_args = {'qpid.max_count': 10}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_count': 10}
self.not_acquired_browse_consume_limit("test_max_count_browse_consume_persistent", queue_args, self.session.delivery_mode.persistent)
def test_11_max_size_browse_consume_transient(self):
- queue_args = {'qpid.max_size': 100}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_size': 100}
self.not_acquired_browse_consume_limit("test_max_size_browse_consume_transient", queue_args, self.session.delivery_mode.non_persistent)
def test_12_max_size_browse_consume_persistent(self):
- queue_args = {'qpid.max_size': 100}
+ queue_args = {'qpid.policy_type':'flow_to_disk', 'qpid.max_size': 100}
self.not_acquired_browse_consume_limit("test_max_size_browse_consume_persistent", queue_args, self.session.delivery_mode.persistent)
17 years, 7 months