rhmessaging commits: r4297 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-16 06:45:52 -0400 (Thu, 16 Sep 2010)
New Revision: 4297
Modified:
mgmt/newdata/mint/python/mint/update.py
Log:
Disable by-class stats; they cause trouble on earlier python versions
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-09-15 21:56:28 UTC (rev 4296)
+++ mgmt/newdata/mint/python/mint/update.py 2010-09-16 10:45:52 UTC (rev 4297)
@@ -349,7 +349,7 @@
self.model.print_event(3, "Created %s", obj)
stats.objects_created += 1
- stats.objects_created_by_class[cls] += 1
+ #stats.objects_created_by_class[cls] += 1
return obj
@@ -406,7 +406,7 @@
self.model.print_event(4, "Updated %s", obj)
stats.objects_updated += 1
- stats.objects_updated_by_class[cls] += 1
+ #stats.objects_updated_by_class[cls] += 1
def delete_object(self, cursor, stats, obj):
obj.delete(cursor)
@@ -414,7 +414,7 @@
self.model.print_event(3, "Deleted %s", obj)
stats.objects_deleted += 1
- stats.objects_deleted_by_class[obj._class] += 1
+ #stats.objects_deleted_by_class[obj._class] += 1
def process_properties(self, obj, columns, cursor):
cls = obj._class
@@ -603,7 +603,7 @@
count = cls.delete_selection(cursor, _qmf_agent_id=agent.id)
stats.objects_deleted += count
- stats.objects_deleted_by_class[cls] += count
+ #stats.objects_deleted_by_class[cls] += count
cursor.connection.commit()
15 years, 7 months
rhmessaging commits: r4296 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-15 17:56:28 -0400 (Wed, 15 Sep 2010)
New Revision: 4296
Modified:
mgmt/newdata/mint/python/mint/update.py
Log:
For bz 629988. Turn write mitigation off in general, except for
broker objects. Further instrumentation revealed that they are the
source of the droppable stat updates.
This change also enhances cumin-data's reporting.
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-09-15 20:01:27 UTC (rev 4295)
+++ mgmt/newdata/mint/python/mint/update.py 2010-09-15 21:56:28 UTC (rev 4296)
@@ -11,8 +11,8 @@
log = logging.getLogger("mint.update")
-minutes_ago = timedelta(minutes=5)
-seconds_ago = timedelta(seconds=60)
+sample_window_min = 60
+sample_window_max = 60 * 5
class UpdateThread(MintDaemonThread):
def __init__(self, app):
@@ -52,27 +52,49 @@
update.process(self)
class UpdateStats(object):
- names = ("*Enqueued", "*Dequeued", "Depth", "*Created", "*Updated",
- "*Deleted", "*Dropped", "*Sql Ops", "Errors", "Cpu (%)",
- "Mem (M)")
- headings = ("%10s " * 11) % names
- values_fmt = "%10.1f %10.1f %10i %10.1f %10.1f %10.1f " + \
- "%10.1f %10.1f %10i %10i %10.1f"
+ group_names = ("Updates", "Agents", "Objects")
+ groups = "%43s | %32s | %32s |" % group_names
+ heading_names = \
+ ("Depth", "*Enqueued", "*Dequeued", "*Dropped",
+ "*Created", "*Updated", "*Deleted",
+ "*Created", "*Updated", "*Deleted",
+ "*Sql Ops", "Errors", "Cpu (%)", "Mem (M)")
+ headings_fmt = \
+ "%10s %10s %10s %10s | " + \
+ "%10s %10s %10s | " + \
+ "%10s %10s %10s | " + \
+ "%10s %10s %10s %10s"
+ headings = headings_fmt % heading_names
+
+
+ values_fmt = \
+ "%10i %10.1f %10.1f %10.1f | " + \
+ "%10.1f %10.1f %10.1f | " + \
+ "%10.1f %10.1f %10.1f | " + \
+ "%10.1f %10i %10i %10.1f"
+
then = None
now = None
def __init__(self, app):
self.enqueued = 0
self.dequeued = 0
-
- self.created = 0
- self.updated = 0
- self.deleted = 0
self.dropped = 0
+ self.agents_created = 0
+ self.agents_updated = 0
+ self.agents_deleted = 0
+
+ self.objects_created = 0
+ self.objects_updated = 0
+ self.objects_deleted = 0
+
+ self.objects_created_by_class = defaultdict(int)
+ self.objects_updated_by_class = defaultdict(int)
+ self.objects_deleted_by_class = defaultdict(int)
+
self.sql_ops = 0
-
self.errors = 0
self.time = None
@@ -101,6 +123,7 @@
return int(line.split()[1])
def print_headings(self):
+ print self.groups
print self.headings
def print_values(self):
@@ -111,22 +134,41 @@
values = [self.now.enqueued - self.then.enqueued,
self.now.dequeued - self.then.dequeued,
- self.now.created - self.then.created,
- self.now.updated - self.then.updated,
- self.now.deleted - self.then.deleted,
self.now.dropped - self.then.dropped,
+ self.now.agents_created - self.then.agents_created,
+ self.now.agents_updated - self.then.agents_updated,
+ self.now.agents_deleted - self.then.agents_deleted,
+ self.now.objects_created - self.then.objects_created,
+ self.now.objects_updated - self.then.objects_updated,
+ self.now.objects_deleted - self.then.objects_deleted,
self.now.sql_ops - self.then.sql_ops]
+ # self.now.dropped - self.then.dropped,
+
secs = self.now.time - self.then.time
values = map(lambda x: x / secs, values)
- values.insert(2, self.now.enqueued - self.now.dequeued)
+ values.insert(0, self.now.enqueued - self.now.dequeued)
values.append(self.errors)
values.append(int((self.now.cpu - self.then.cpu) / secs * 100))
values.append(self.now.memory / 1000000.0)
print self.values_fmt % tuple(values)
+
+ def print_values_by_class(self):
+ names = ("Class", "Created", "Updated", "Deleted")
+ print "%20s %10s %10s %10s" % names
+
+ for pkg in mint.model._packages:
+ for cls in pkg._classes:
+ created = stats.created_by_class[cls]
+ updated = stats.updated_by_class[cls]
+ deleted = stats.deleted_by_class[cls]
+
+ if created or updated or deleted:
+ args = (cls._name, created, updated, deleted)
+ print "%-20s %10i %10i %10i" % args
class UpdateCursor(Cursor):
def execute(self, sql, args=None):
@@ -145,6 +187,8 @@
self.do_process(thread.cursor, thread.stats)
thread.conn.commit()
+
+ # XXX UpdateCommitted
except UpdateDropped:
thread.stats.dropped += 1
except UpdateException, e:
@@ -180,6 +224,8 @@
agent_id = self.get_agent_id()
object_id = self.get_object_id()
+ delete_time = self.qmf_object.getTimestamps()[2]
+
try:
agent = self.model.agents_by_id[agent_id]
except KeyError:
@@ -188,49 +234,28 @@
try:
obj = agent.get_object(cursor, cls, object_id)
except RosemaryNotFound:
- obj = None
+ if not self.qmf_object.getProperties():
+ raise UpdateDropped()
- update_time, create_time, delete_time = self.qmf_object.getTimestamps()
-
- if obj:
if delete_time != 0:
- self.delete_object(cursor, stats, obj)
+ raise UpdateDropped()
- agent.objects_by_id.pop(obj._qmf_object_id)
+ obj = self.create_object(cursor, stats, cls)
- return
+ return
- properties = self.qmf_object.getProperties()
- statistics = self.qmf_object.getStatistics()
+ if delete_time != 0:
+ self.delete_object(cursor, stats, obj)
- if not properties and statistics:
- # Just stats; do we want it?
- # if stats.enqueued - stats.dequeued > 500:
+ del agent.objects_by_id[obj._qmf_object_id]
- now = datetime.now()
- update = datetime.fromtimestamp(update_time / 1000000000)
- sample = obj._sample_time
+ return
- if update < now - minutes_ago:
- # The sample is too old
- raise UpdateDropped()
+ if cls._package is self.model.org_apache_qpid_broker:
+ self.maybe_drop_sample(obj)
- if sample and sample > now - seconds_ago:
- # The samples are too fidelitous
- raise UpdateDropped()
+ self.update_object(cursor, stats, obj)
- self.update_object(cursor, stats, obj)
- else:
- if not self.qmf_object.getProperties():
- raise UpdateDropped()
-
- if delete_time != 0:
- raise UpdateDropped()
-
- obj = self.create_object(cursor, stats, cls)
-
- assert obj
-
def get_agent_id(self):
return make_agent_id(self.qmf_object.getAgent())
@@ -248,13 +273,34 @@
try:
cls = pkg._classes_by_lowercase_name[name.lower()]
except KeyError:
+ # XXX UpdateDropped instead?
raise ClassUnknown(name)
-
+
return cls
def get_object_id(self):
return self.qmf_object.getObjectId().objectName
+ def maybe_drop_sample(self, obj):
+ properties = self.qmf_object.getProperties()
+ statistics = self.qmf_object.getStatistics()
+
+ if not properties and statistics:
+ # Just stats; do we want it?
+ # if stats.enqueued - stats.dequeued > 500:
+
+ now = time.time()
+ update = self.qmf_object.getTimestamps()[0] / 1000000000
+ sample = obj._sample_time
+
+ if update < now - sample_window_max:
+ # The sample is too old
+ raise UpdateDropped()
+
+ if sample and sample > now - sample_window_min:
+ # The samples are too fidelitous
+ raise UpdateDropped()
+
def create_object(self, cursor, stats, cls):
update_time, create_time, delete_time = self.qmf_object.getTimestamps()
create_time = datetime.fromtimestamp(create_time / 1000000000)
@@ -291,7 +337,7 @@
sql = cls.sql_samples_insert.emit(sample_columns)
statements.append(sql)
- obj._sample_time = datetime.now()
+ obj._sample_time = time.time()
sql = "; ".join(statements)
self.execute_sql(cursor, sql, obj.__dict__)
@@ -301,8 +347,10 @@
obj._sync_time = datetime.now()
self.model.print_event(3, "Created %s", obj)
- stats.created += 1
+ stats.objects_created += 1
+ stats.objects_created_by_class[cls] += 1
+
return obj
def process_deferred_links(self, cursor, obj):
@@ -327,12 +375,11 @@
object_columns = list()
sample_columns = list()
- cls = obj._class
-
self.process_properties(obj, object_columns, cursor)
self.process_statistics(obj, object_columns, sample_columns)
statements = list()
+ cls = obj._class
if object_columns:
object_columns.append(cls.sql_table._qmf_update_time)
@@ -346,7 +393,7 @@
sql = cls.sql_samples_insert.emit(sample_columns)
statements.append(sql)
- obj._sample_time = datetime.now()
+ obj._sample_time = time.time()
if not statements:
raise UpdateDropped()
@@ -357,14 +404,18 @@
obj._sync_time = datetime.now()
self.model.print_event(4, "Updated %s", obj)
- stats.updated += 1
+ stats.objects_updated += 1
+ stats.objects_updated_by_class[cls] += 1
+
def delete_object(self, cursor, stats, obj):
obj.delete(cursor)
self.model.print_event(3, "Deleted %s", obj)
- stats.deleted += 1
+ stats.objects_deleted += 1
+ stats.objects_deleted_by_class[obj._class] += 1
+
def process_properties(self, obj, columns, cursor):
cls = obj._class
@@ -527,14 +578,18 @@
except KeyError:
agent = MintAgent(self.model, agent_id)
+ stats.agents_created += 1
+
self.delete_agent_objects(cursor, stats, agent)
+ return
+
#timestamp = timestamp / 1000000000
#agent.last_heartbeat = datetime.fromtimestamp(timestamp)
agent.last_heartbeat = datetime.now()
- stats.updated += 1
+ stats.agents_updated += 1
def delete_agent_objects(self, cursor, stats, agent):
for pkg in self.model._packages:
@@ -547,7 +602,8 @@
count = cls.delete_selection(cursor, _qmf_agent_id=agent.id)
- stats.deleted += count
+ stats.objects_deleted += count
+ stats.objects_deleted_by_class[cls] += count
cursor.connection.commit()
@@ -562,6 +618,8 @@
agent.delete()
+ stats.agents_deleted += 1
+
self.delete_agent_objects(cursor, stats, agent)
class UpdateDropped(Exception):
15 years, 7 months
rhmessaging commits: r4295 - mgmt/trunk/sesame/cpp/src.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2010-09-15 16:01:27 -0400 (Wed, 15 Sep 2010)
New Revision: 4295
Modified:
mgmt/trunk/sesame/cpp/src/SysAgent.cpp
Log:
Removed unused include file.
Modified: mgmt/trunk/sesame/cpp/src/SysAgent.cpp
===================================================================
--- mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2010-09-15 19:57:43 UTC (rev 4294)
+++ mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2010-09-15 20:01:27 UTC (rev 4295)
@@ -6,7 +6,6 @@
#include "qpid/log/SinkOptions.h"
#include "qpid/log/Statement.h"
#include "qpid/sys/SystemInfo.h"
-#include "qpid/framing/Uuid.h"
#include "qpid/types/Uuid.h"
#include "qmf/com/redhat/sesame/Package.h"
#include "qmf/com/redhat/sesame/Sysimage.h"
15 years, 7 months
rhmessaging commits: r4294 - in mgmt/trunk/sesame/cpp: src and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2010-09-15 15:57:43 -0400 (Wed, 15 Sep 2010)
New Revision: 4294
Modified:
mgmt/trunk/sesame/cpp/configure.ac
mgmt/trunk/sesame/cpp/src/Makefile.am
mgmt/trunk/sesame/cpp/src/SysAgent.cpp
Log:
System ID now comes from the Dbus UUID (thanks in part to a patch by Matt Farrellee)
Errors are now logged rather than printed to stderr.
Modified: mgmt/trunk/sesame/cpp/configure.ac
===================================================================
--- mgmt/trunk/sesame/cpp/configure.ac 2010-09-15 17:13:56 UTC (rev 4293)
+++ mgmt/trunk/sesame/cpp/configure.ac 2010-09-15 19:57:43 UTC (rev 4294)
@@ -173,6 +173,8 @@
AC_CHECK_PROG([do_doxygen], [doxygen], [yes])
AM_CONDITIONAL([DOXYGEN], [test x$do_doxygen = xyes])
+PKG_CHECK_MODULES([DBUS], [dbus-1])
+
AC_CONFIG_FILES([
Makefile
src/Makefile
Modified: mgmt/trunk/sesame/cpp/src/Makefile.am
===================================================================
--- mgmt/trunk/sesame/cpp/src/Makefile.am 2010-09-15 17:13:56 UTC (rev 4293)
+++ mgmt/trunk/sesame/cpp/src/Makefile.am 2010-09-15 19:57:43 UTC (rev 4294)
@@ -2,6 +2,7 @@
sesame_CXXFLAGS = $(QPID_CXXFLAGS) -Iqmfgen \
-DCONF_FILE=\"$(sysconfdir)/sesame/sesame.conf\" \
-DLOCSTATE_DIR=\"$(localstatedir)/lib/sesame\" \
+ $(DBUS_CFLAGS) \
-I$(QPID_INCLUDE)
include qmfgen/qmfgen.mk
@@ -10,4 +11,4 @@
nodist_sesame_SOURCES = $(qmfgen_sources)
sesame_SOURCES = SysAgent.cpp
-sesame_LDADD = $(QPID_LIBS)
+sesame_LDADD = $(QPID_LIBS) $(DBUS_LIBS)
Modified: mgmt/trunk/sesame/cpp/src/SysAgent.cpp
===================================================================
--- mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2010-09-15 17:13:56 UTC (rev 4293)
+++ mgmt/trunk/sesame/cpp/src/SysAgent.cpp 2010-09-15 19:57:43 UTC (rev 4294)
@@ -4,12 +4,15 @@
#include <qpid/sys/Mutex.h>
#include "qpid/log/Logger.h"
#include "qpid/log/SinkOptions.h"
+#include "qpid/log/Statement.h"
#include "qpid/sys/SystemInfo.h"
#include "qpid/framing/Uuid.h"
#include "qpid/types/Uuid.h"
#include "qmf/com/redhat/sesame/Package.h"
#include "qmf/com/redhat/sesame/Sysimage.h"
+#include <dbus/dbus.h> // for dbus_get_local_machine_id
+
#include <signal.h>
#include <unistd.h>
#include <cstdlib>
@@ -25,16 +28,26 @@
using qpid::sys::Mutex;
namespace _qmf = qmf::com::redhat::sesame;
+static qpid::types::Uuid fixupDbusUuid(const string& in)
+{
+ stringstream properUuid;
+ properUuid << in.substr(0,8) << "-" << in.substr(8,4) << "-" <<
+ in.substr(12,4) << "-" << in.substr(16,4) << "-" <<
+ in.substr(20,12);
+ qpid::types::Uuid uuid;
+ properUuid >> uuid;
+ return uuid;
+}
+
class SysAgent : public Manageable
{
ManagementAgent* agent;
_qmf::Sysimage* mgmtObject;
- qpid::framing::Uuid uuid;
public:
- SysAgent(ManagementAgent* agent, const string& uuidFile);
+ SysAgent(ManagementAgent* agent, const qpid::types::Uuid& uuid);
~SysAgent() { mgmtObject->resourceDestroy(); }
ManagementObject* GetManagementObject(void) const
@@ -62,25 +75,9 @@
void getMem(Mem& mem);
};
-SysAgent::SysAgent(ManagementAgent* _agent, const string& uuidFile) : agent(_agent)
+SysAgent::SysAgent(ManagementAgent* _agent, const qpid::types::Uuid& uuid) : agent(_agent)
{
- // obtain or establish the system-id
- ifstream input(uuidFile.c_str());
- if (input.good()) {
- input >> uuid;
- input.close();
- }
-
- if (uuid.isNull()) {
- uuid.generate();
- ofstream output(uuidFile.c_str());
- if (output.good()) {
- output << uuid << endl;
- output.close();
- }
- }
-
- mgmtObject = new _qmf::Sysimage(agent, this, qpid::types::Uuid(uuid.c_array()));
+ mgmtObject = new _qmf::Sysimage(agent, this, uuid);
setSystemId();
ifstream distro("/etc/redhat-release");
if (distro.good()) {
@@ -229,7 +226,7 @@
if (!options["config"].value.empty()) {
ifstream input(options["config"].value.c_str());
if (!input.good()) {
- cerr << "Can't open config file: " << options["config"].value << endl;
+ QPID_LOG(error, "Can't open config file: " << options["config"].value);
exit(1);
}
@@ -240,7 +237,7 @@
input.getline(line, 512);
if (input.fail() && !input.eof()) {
- cerr << "Line too long in config file: " << options["config"].value << endl;
+ QPID_LOG(error, "Line too long in config file: " << options["config"].value);
exit(1);
}
@@ -249,7 +246,7 @@
while (*cursor != '\0' && *cursor != '=')
cursor++;
if (*cursor == '\0') {
- cerr << "Missing value in config line: " << line << endl;
+ QPID_LOG(error, "Missing value in config line: " << line);
exit(1);
}
*cursor = '\0';
@@ -257,7 +254,7 @@
map<string, Option>::iterator iter = options.find(line);
if (iter == options.end()) {
- cerr << "Config file option '" << line << "' not known" << endl;
+ QPID_LOG(error, "Config file option '" << line << "' not known");
exit(1);
}
@@ -274,19 +271,19 @@
if (arg == "--no-config")
continue;
if (arg.substr(0, 2) != "--") {
- cerr << "Invalid argument: " << arg << endl;
+ QPID_LOG(error, "Invalid argument: " << arg);
usage();
}
map<string, Option>::iterator iter = options.find(arg.substr(2));
if (iter == options.end()) {
- cerr << "Unknown option: " << arg << endl;
+ QPID_LOG(error, "Unknown option: " << arg);
usage();
}
i++;
if (i == argc) {
- cerr << "No value for option: " << arg << endl;
+ QPID_LOG(error, "No value for option: " << arg);
usage();
}
@@ -302,7 +299,7 @@
ifstream input(file.c_str());
if (!input.good()) {
- cerr << "Can't read password file" << endl;
+ QPID_LOG(error, "Can't read password file");
exit(1);
}
@@ -371,7 +368,16 @@
settings.minSsf = ::atoi(options["min-ssf"].value.c_str());
settings.maxSsf = ::atoi(options["max-ssf"].value.c_str());
- agent->setName("redhat.com", "sesame");
+ char* uuid_hex = dbus_get_local_machine_id();
+ if (!uuid_hex) {
+ QPID_LOG(error, "Failed to acquire UUID from dbus");
+ return 1;
+ }
+
+ qpid::types::Uuid uuid(fixupDbusUuid(uuid_hex));
+ dbus_free(uuid_hex);
+
+ agent->setName("redhat.com", "sesame", uuid.str());
agent->init(settings, interval, false, options["state-dir"].value + "/agentdata");
::close(0);
@@ -379,7 +385,7 @@
::close(2);
// Allocate core object
- SysAgent core(agent, options["state-dir"].value + "/uuid");
+ SysAgent core(agent, uuid);
core.run();
return 0;
}
@@ -389,7 +395,7 @@
try {
return main_int(argc, argv);
} catch(std::exception& e) {
- cout << "Top Level Exception: " << e.what() << endl;
+ QPID_LOG(error, "Top Level Exception: " << e.what());
}
}
15 years, 7 months
rhmessaging commits: r4293 - in mgmt/newdata: wooly/resources and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-09-15 13:13:56 -0400 (Wed, 15 Sep 2010)
New Revision: 4293
Modified:
mgmt/newdata/cumin/python/cumin/widgets.strings
mgmt/newdata/wooly/resources/wooly.js
Log:
Fix BZ 633943: When "Resume Updates" button is clicked, change text and resume updating immediately instead of after 1 update interval.
Modified: mgmt/newdata/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/widgets.strings 2010-09-15 16:44:44 UTC (rev 4292)
+++ mgmt/newdata/cumin/python/cumin/widgets.strings 2010-09-15 17:13:56 UTC (rev 4293)
@@ -131,8 +131,10 @@
$('heartbeat').style.display = "none";
$('shock').style.display = "block"}, 1000);
$('shock').onclick = function () {
+ wooly.updateNow();
wooly.resumeIntervalUpdate();
cumin.expireIntervalUpdate();
+ cumin.set_updated();
}
}, 30*60*1000);
};
Modified: mgmt/newdata/wooly/resources/wooly.js
===================================================================
--- mgmt/newdata/wooly/resources/wooly.js 2010-09-15 16:44:44 UTC (rev 4292)
+++ mgmt/newdata/wooly/resources/wooly.js 2010-09-15 17:13:56 UTC (rev 4293)
@@ -479,6 +479,12 @@
wooly.intervalUpdateInfo.interval,
wooly.intervalUpdateInfo.passback);
}
+ this.updateNow = function () {
+ wooly.setIntervalUpdate(wooly.intervalUpdateInfo.url,
+ wooly.intervalUpdateInfo.callback,
+ 0,
+ wooly.intervalUpdateInfo.passback);
+ }
this.doubleIntervalUpdate = function () {
wooly.cancelIntervalUpdate();
wooly.intervalUpdateInfo.interval *= 2;
15 years, 7 months
rhmessaging commits: r4292 - mgmt/newdata/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-09-15 12:44:44 -0400 (Wed, 15 Sep 2010)
New Revision: 4292
Modified:
mgmt/newdata/cumin/python/cumin/session.py
Log:
Fix BZ 634180 and 630853: Exclude reference attributes from the constructed object id for qmf v1 objects. Needed since the class attribute names for references don't match the object attribute.
Modified: mgmt/newdata/cumin/python/cumin/session.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/session.py 2010-09-15 14:45:06 UTC (rev 4291)
+++ mgmt/newdata/cumin/python/cumin/session.py 2010-09-15 16:44:44 UTC (rev 4292)
@@ -86,7 +86,7 @@
else:
key_args = [getattr(obj, x.name)
for x in obj._class._attributes
- if x.index]
+ if x.index and not x.references]
key = ",".join(key_args)
id_args = (obj._class._package._name, obj._class._name.lower(), key)
15 years, 7 months
rhmessaging commits: r4291 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-15 10:45:06 -0400 (Wed, 15 Sep 2010)
New Revision: 4291
Modified:
mgmt/newdata/mint/python/mint/update.py
Log:
Bail out of deferred link processing if there's nothing to do
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-09-15 09:56:16 UTC (rev 4290)
+++ mgmt/newdata/mint/python/mint/update.py 2010-09-15 14:45:06 UTC (rev 4291)
@@ -307,6 +307,10 @@
def process_deferred_links(self, cursor, obj):
agent = self.model.agents_by_id[obj._qmf_agent_id]
+
+ if obj._qmf_object_id not in agent.deferred_links_by_id:
+ return
+
links = agent.deferred_links_by_id[obj._qmf_object_id]
for link in links:
15 years, 7 months
rhmessaging commits: r4290 - store/branches/java/0.5.x-dev/bin.
by rhmessaging-commits@lists.jboss.org
Author: rgemmell
Date: 2010-09-15 05:56:16 -0400 (Wed, 15 Sep 2010)
New Revision: 4290
Modified:
store/branches/java/0.5.x-dev/bin/qpid-server-bdb.bat
Log:
add the BDB JMX jar to the .bat script classpath and enable it
Modified: store/branches/java/0.5.x-dev/bin/qpid-server-bdb.bat
===================================================================
--- store/branches/java/0.5.x-dev/bin/qpid-server-bdb.bat 2010-09-15 08:35:50 UTC (rev 4289)
+++ store/branches/java/0.5.x-dev/bin/qpid-server-bdb.bat 2010-09-15 09:56:16 UTC (rev 4290)
@@ -37,5 +37,6 @@
set BDBSTORE_HOME=%QPID_HOME%
-set QPID_MODULE_JARS=%BDBSTORE_HOME%\lib\qpid-bdbstore-%VERSION%.jar;%BDBSTORE_HOME%\lib\je-4.0.103.jar
+set QPID_OPTS=%QPID_OPTS% -DJEMonitor=true
+set QPID_MODULE_JARS=%BDBSTORE_HOME%\lib\qpid-bdbstore-%VERSION%.jar;%BDBSTORE_HOME%\lib\je-4.0.103.jar;%BDBSTORE_HOME%\lib\JEJConsole.jar
.\qpid-server.bat %*
15 years, 7 months
rhmessaging commits: r4289 - store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb.
by rhmessaging-commits@lists.jboss.org
Author: rgemmell
Date: 2010-09-15 04:35:50 -0400 (Wed, 15 Sep 2010)
New Revision: 4289
Modified:
store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
Log:
Update test to reflect code change in the systests module
Modified: store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java
===================================================================
--- store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java 2010-09-14 20:55:50 UTC (rev 4288)
+++ store/trunk/java/bdbstore/src/test/java/org/apache/qpid/server/store/berkeleydb/BDBMessageStoreTest.java 2010-09-15 08:35:50 UTC (rev 4289)
@@ -62,7 +62,7 @@
*/
public void testBDBMessagePersistence() throws Exception
{
- MessageStore store = _virtualHost.getMessageStore();
+ MessageStore store = getVirtualHost().getMessageStore();
BDBMessageStore bdbStore = assertBDBStore(store);
@@ -281,7 +281,7 @@
*/
public void testMessageCreationAndRemoval() throws Exception
{
- MessageStore store = _virtualHost.getMessageStore();
+ MessageStore store = getVirtualHost().getMessageStore();
BDBMessageStore bdbStore = assertBDBStore(store);
StoredMessage<MessageMetaData> storedMessage_0_8 = createAndStoreMultiChunkMessage_0_8(store);
@@ -352,7 +352,7 @@
*/
public void testTranCommit() throws Exception
{
- TransactionLog log = _virtualHost.getTransactionLog();
+ TransactionLog log = getVirtualHost().getTransactionLog();
BDBMessageStore bdbStore = assertBDBStore(log);
@@ -390,7 +390,7 @@
*/
public void testTranRollbackBeforeCommit() throws Exception
{
- TransactionLog log = _virtualHost.getTransactionLog();
+ TransactionLog log = getVirtualHost().getTransactionLog();
BDBMessageStore bdbStore = assertBDBStore(log);
@@ -431,7 +431,7 @@
*/
public void testTranRollbackAfterCommit() throws Exception
{
- TransactionLog log = _virtualHost.getTransactionLog();
+ TransactionLog log = getVirtualHost().getTransactionLog();
BDBMessageStore bdbStore = assertBDBStore(log);
15 years, 7 months
rhmessaging commits: r4288 - in mgmt/newdata: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-14 16:55:50 -0400 (Tue, 14 Sep 2010)
New Revision: 4288
Modified:
mgmt/newdata/cumin/python/cumin/session.py
mgmt/newdata/mint/python/mint/model.py
mgmt/newdata/mint/python/mint/update.py
mgmt/newdata/mint/python/mint/util.py
Log:
For bz 632296. Qualify v1 agent ids using broker host and port. This
is to prevent v1 agent id collisions that cause data corruption.
This change also addresses a data ordering problem that prevented
brokers and other objects from appearing when they were updated
infrequently (or never).
Modified: mgmt/newdata/cumin/python/cumin/session.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/session.py 2010-09-14 20:43:08 UTC (rev 4287)
+++ mgmt/newdata/cumin/python/cumin/session.py 2010-09-14 20:55:50 UTC (rev 4288)
@@ -1,5 +1,6 @@
from model import *
from util import *
+from mint.util import make_agent_id
from qmf.console import Console, Session, ClassKey, ObjectId
@@ -132,18 +133,22 @@
def newAgent(self, qmf_agent):
log.debug("New agent %s", qmf_agent)
+ agent_id = make_agent_id(qmf_agent)
+
self.session.lock.acquire()
try:
- self.session.qmf_agents[qmf_agent.getAgentBank()] = qmf_agent
+ self.session.qmf_agents[agent_id] = qmf_agent
finally:
self.session.lock.release()
def delAgent(self, qmf_agent):
log.debug("Deleting agent %s", qmf_agent)
+ agent_id = make_agent_id(qmf_agent)
+
self.session.lock.acquire()
try:
- del self.session.qmf_agents[qmf_agent.getAgentBank()]
+ del self.session.qmf_agents[agent_id]
finally:
self.session.lock.release()
Modified: mgmt/newdata/mint/python/mint/model.py
===================================================================
--- mgmt/newdata/mint/python/mint/model.py 2010-09-14 20:43:08 UTC (rev 4287)
+++ mgmt/newdata/mint/python/mint/model.py 2010-09-14 20:55:50 UTC (rev 4288)
@@ -16,7 +16,7 @@
# int seq => callable
self.outstanding_method_calls = dict()
- self.lock = RLock()
+ self.lock = Lock()
def check(self):
log.info("Checking %s", self)
@@ -49,6 +49,7 @@
self.last_heartbeat = None
self.objects_by_id = dict()
+ self.deferred_links_by_id = defaultdict(list)
assert self.id not in self.model.agents_by_id
self.model.agents_by_id[self.id] = self
@@ -60,5 +61,14 @@
self.model = None
+ def get_object(self, cursor, cls, object_id):
+ try:
+ obj = self.objects_by_id[object_id]
+ except KeyError:
+ obj = cls.get_object_by_qmf_id(cursor, self.id, object_id)
+ self.objects_by_id[object_id] = obj
+
+ return obj
+
def __repr__(self):
return "%s(%s)" % (self.__class__.__name__, self.id)
Modified: mgmt/newdata/mint/python/mint/update.py
===================================================================
--- mgmt/newdata/mint/python/mint/update.py 2010-09-14 20:43:08 UTC (rev 4287)
+++ mgmt/newdata/mint/python/mint/update.py 2010-09-14 20:55:50 UTC (rev 4288)
@@ -176,24 +176,19 @@
self.qmf_object = qmf_object
def do_process(self, cursor, stats):
+ cls = self.get_class()
agent_id = self.get_agent_id()
+ object_id = self.get_object_id()
try:
agent = self.model.agents_by_id[agent_id]
except KeyError:
raise UpdateDropped()
- cls = self.get_class()
- obj_id = self.get_object_id()
- obj = None
-
try:
- obj = agent.objects_by_id[obj_id]
- except KeyError:
- try:
- obj = cls.get_object_by_qmf_id(cursor, agent_id, obj_id)
- except RosemaryNotFound:
- pass
+ obj = agent.get_object(cursor, cls, object_id)
+ except RosemaryNotFound:
+ obj = None
update_time, create_time, delete_time = self.qmf_object.getTimestamps()
@@ -236,10 +231,8 @@
assert obj
- agent.objects_by_id[obj_id] = obj
-
def get_agent_id(self):
- return self.qmf_object.getObjectId().agentName
+ return make_agent_id(self.qmf_object.getAgent())
def get_class(self):
class_key = self.qmf_object.getClassKey()
@@ -272,7 +265,7 @@
obj._qmf_object_id = self.get_object_id()
obj._qmf_create_time = create_time
obj._qmf_update_time = update_time
-
+
object_columns = list()
sample_columns = list()
@@ -303,6 +296,8 @@
sql = "; ".join(statements)
self.execute_sql(cursor, sql, obj.__dict__)
+ self.process_deferred_links(cursor, obj)
+
obj._sync_time = datetime.now()
self.model.print_event(3, "Created %s", obj)
@@ -310,6 +305,15 @@
return obj
+ def process_deferred_links(self, cursor, obj):
+ agent = self.model.agents_by_id[obj._qmf_agent_id]
+ links = agent.deferred_links_by_id[obj._qmf_object_id]
+
+ for link in links:
+ link.realize(cursor, obj)
+
+ del agent.deferred_links_by_id[obj._qmf_object_id]
+
def update_object(self, cursor, stats, obj):
update_time, create_time, delete_time = self.qmf_object.getTimestamps()
update_time = datetime.fromtimestamp(update_time / 1000000000)
@@ -364,7 +368,7 @@
try:
if prop.type == 10:
col, nvalue = self.process_reference \
- (cls, prop, value, cursor)
+ (obj, prop, value, cursor)
else:
col, nvalue = self.process_value(cls, prop, value)
except MappingException, e:
@@ -380,36 +384,43 @@
setattr(obj, col.name, nvalue)
columns.append(col)
- def process_reference(self, cls, prop, value, cursor):
+ def process_reference(self, obj, prop, oid, cursor):
try:
- ref = cls._references_by_name[prop.name]
+ ref = obj._class._references_by_name[prop.name]
except KeyError:
raise MappingException("Reference %s is unknown" % prop.name)
if not ref.sql_column:
raise MappingException("Reference %s has no column" % ref.name)
- col = ref.sql_column
+ value = None
- if value:
+ if oid:
+ if oid.isV2:
+ agent_id = oid.agentName
+ else:
+ # Not much we can do but assume same agent
+ agent_id = self.get_agent_id()
+
try:
- agent = self.model.agents_by_id[value.agentName]
+ agent = self.model.agents_by_id[agent_id]
except KeyError:
- raise MappingException("Agent %s is unknown" % value.agentName)
+ raise MappingException("Agent %s is unknown" % agent_id)
+ object_id = oid.objectName
+
try:
- that = agent.objects_by_id[value.objectName]
- except KeyError:
- try:
- that = ref.that_cls.get_object_by_qmf_id \
- (cursor, agent.id, value.objectName)
- except RosemaryNotFound:
- msg = "Referenced object %s hasn't appeared yet"
- raise MappingException(msg % value.objectName)
+ that = agent.get_object(cursor, ref.that_cls, object_id)
+ except RosemaryNotFound:
+ link = DeferredLink(obj, ref)
+ agent.deferred_links_by_id[object_id].append(link)
+ msg = "Referenced object %s hasn't appeared yet"
+ raise MappingException(msg % object_id)
+
value = that._id
- return col, value
+ return ref.sql_column, value
def process_value(self, cls, prop, value):
try:
@@ -484,6 +495,17 @@
return "%s(%s,%s,%s)" % (name, agent_id, cls, obj_id)
+class DeferredLink(object):
+ def __init__(self, this, reference):
+ self.this = this
+ self.reference = reference
+
+ def realize(self, cursor, that):
+ column = self.reference.sql_column
+ values = {column.name: that._id, "_id": self.this._id}
+
+ self.this._class.sql_update_object.execute(cursor, values, (column,))
+
class AgentUpdate(Update):
def __init__(self, model, qmf_agent):
super(AgentUpdate, self).__init__(model)
@@ -491,7 +513,7 @@
self.qmf_agent = qmf_agent
def get_agent_id(self):
- return str(self.qmf_agent.getAgentBank())
+ return make_agent_id(self.qmf_agent)
def do_process(self, cursor, stats):
agent_id = self.get_agent_id()
Modified: mgmt/newdata/mint/python/mint/util.py
===================================================================
--- mgmt/newdata/mint/python/mint/util.py 2010-09-14 20:43:08 UTC (rev 4287)
+++ mgmt/newdata/mint/python/mint/util.py 2010-09-14 20:55:50 UTC (rev 4288)
@@ -55,6 +55,14 @@
return password
+def make_agent_id(agent):
+ broker = agent.getBroker()
+
+ if not agent.isV2 or agent is broker.getBrokerAgent():
+ return "!!%s:%i!!%s" % (broker.host, broker.port, agent.getAgentBank())
+
+ return agent.agentBank
+
class QmfAgentId(object):
def __init__(self, brokerId, brokerBank, agentBank):
assert brokerId
15 years, 7 months