rhmessaging commits: r1377 - in store/trunk/cpp/lib: jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-11-27 17:49:31 -0500 (Tue, 27 Nov 2007)
New Revision: 1377
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/jerrno.cpp
store/trunk/cpp/lib/jrnl/jerrno.hpp
store/trunk/cpp/lib/jrnl/jrec.cpp
store/trunk/cpp/lib/jrnl/jrec.hpp
store/trunk/cpp/lib/jrnl/nlfh.cpp
store/trunk/cpp/lib/jrnl/nlfh.hpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/lib/jrnl/rrfc.hpp
store/trunk/cpp/lib/jrnl/wrfc.hpp
Log:
Bugfixes. BZ# 381851,401151,401191. Put mutex across enqueue, dequeue, flush and get_events methods. Placed checks for RID discontinuity into recover to identify overwrite boundary where it coincides with old record.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -370,6 +370,7 @@
IdDbt key;
Dbt value;
//read all queues
+ u_int64_t highestRid = 0;
while (queues.next(key, value)) {
Buffer buffer(reinterpret_cast<char*>(value.get_data()), value.get_size());
//create a Queue instance
@@ -385,10 +386,11 @@
try
{
- u_int64_t highestRid = 0;
- jQueue->recover(prepared, highestRid, key.id); // start recovery
+ u_int64_t thisHighestRid = 0;
+ jQueue->recover(prepared, thisHighestRid, key.id); // start recovery
+ if (thisHighestRid > highestRid)
+ highestRid = thisHighestRid;
recoverMessages(txn, registry, queue, prepared, messages);
- messageIdSequence.reset(highestRid + 1);
jQueue->recover_complete(); // start journal.
} catch (const journal::jexception& e) {
THROW_STORE_EXCEPTION(std::string("Queue ") + queueName + ": recoverQueues() failed: " + e.what());
@@ -399,6 +401,7 @@
queue_index[key.id] = queue;
maxQueueId = max(key.id, maxQueueId);
}
+ messageIdSequence.reset(highestRid + 1);
queueIdSequence.reset(maxQueueId + 1);
if (!usingJrnl()) //read all messages:
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -141,7 +141,7 @@
throw jexception(jerrno::JERR_JCNTL_RECOVERJFULL, "jcntl", "recover_complete");
// Debug info, but may be useful to print with a flag
-//_rcvdat.print();
+//_rcvdat.print(_jid);
if (_datafh)
{
@@ -201,16 +201,33 @@
const size_t this_data_len, data_tok* dtokp, const bool transient)
throw (jexception)
{
+ iores res;
check_wstatus("enqueue_data_record");
- return _wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, NULL, 0, transient, false);
+ pthread_mutex_lock(&_mutex);
+ try
+ {
+ res = _wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, NULL, 0, transient,
+ false);
+ }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const iores
jcntl::enqueue_extern_data_record(const size_t tot_data_len, data_tok* dtokp, const bool transient)
throw (jexception)
{
+ iores res;
check_wstatus("enqueue_extern_data_record");
- return _wmgr.enqueue(NULL, tot_data_len, 0, dtokp, NULL, 0, transient, true);
+ pthread_mutex_lock(&_mutex);
+ try
+ {
+ res = _wmgr.enqueue(NULL, tot_data_len, 0, dtokp, NULL, 0, transient, true);
+ }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const iores
@@ -218,17 +235,33 @@
const size_t this_data_len, data_tok* dtokp, const std::string& xid,
const bool transient) throw (jexception)
{
+ iores res;
check_wstatus("enqueue_tx_data_record");
- return _wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, xid.data(), xid.size(),
- transient, false);
+ pthread_mutex_lock(&_mutex);
+ try
+ {
+ res = _wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, xid.data(), xid.size(),
+ transient, false);
+ }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const iores
jcntl::enqueue_extern_txn_data_record(const size_t tot_data_len, data_tok* dtokp,
const std::string& xid, const bool transient) throw (jexception)
{
+ iores res;
check_wstatus("enqueue_extern_txn_data_record");
- return _wmgr.enqueue(NULL, tot_data_len, 0, dtokp, xid.data(), xid.size(), transient, true);
+ pthread_mutex_lock(&_mutex);
+ try
+ {
+ res = _wmgr.enqueue(NULL, tot_data_len, 0, dtokp, xid.data(), xid.size(), transient, true);
+ }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const iores
@@ -257,29 +290,49 @@
const iores
jcntl::dequeue_data_record(data_tok* const dtokp) throw (jexception)
{
+ iores res;
check_wstatus("dequeue_data");
- return _wmgr.dequeue(dtokp, NULL, 0);
+ pthread_mutex_lock(&_mutex);
+ try { res = _wmgr.dequeue(dtokp, NULL, 0); }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const iores
jcntl::dequeue_txn_data_record(data_tok* const dtokp, const std::string& xid) throw (jexception)
{
+ iores res;
check_wstatus("dequeue_data");
- return _wmgr.dequeue(dtokp, xid.data(), xid.size());
+ pthread_mutex_lock(&_mutex);
+ try { res = _wmgr.dequeue(dtokp, xid.data(), xid.size()); }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const iores
jcntl::txn_abort(data_tok* const dtokp, const std::string& xid) throw (jexception)
{
+ iores res;
check_wstatus("txn_abort");
- return _wmgr.abort(dtokp, xid.data(), xid.size());
+ pthread_mutex_lock(&_mutex);
+ try { res = _wmgr.abort(dtokp, xid.data(), xid.size()); }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const iores
jcntl::txn_commit(data_tok* const dtokp, const std::string& xid) throw (jexception)
{
+ iores res;
check_wstatus("txn_commit");
- return _wmgr.commit(dtokp, xid.data(), xid.size());
+ pthread_mutex_lock(&_mutex);
+ try { res = _wmgr.commit(dtokp, xid.data(), xid.size()); }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
+ return res;
}
const bool
@@ -291,6 +344,7 @@
const u_int32_t
jcntl::get_wr_events() throw (jexception)
{
+ u_int32_t res;
int ret = pthread_mutex_trylock(&_mutex);
if (ret)
{
@@ -302,7 +356,8 @@
}
return 0; // already locked, return immediately
}
- u_int32_t res = _wmgr.get_events(pmgr::UNUSED);
+ try { res = _wmgr.get_events(pmgr::UNUSED); }
+ catch (const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
pthread_mutex_unlock(&_mutex);
return res;
}
@@ -336,7 +391,10 @@
return;
if (_readonly_flag)
throw jexception(jerrno::JERR_JCNTL_READONLY, "jcntl", "flush");
- _wmgr.flush();
+ pthread_mutex_lock(&_mutex);
+ try { _wmgr.flush(); }
+ catch(const std::exception& e) { pthread_mutex_unlock(&_mutex); throw e; }
+ pthread_mutex_unlock(&_mutex);
}
// Private functions
@@ -446,6 +504,8 @@
{
case RHM_JDAT_ENQ_MAGIC:
{
+ if (!check_rid(fid, h, rd, read_pos))
+ return false;
enq_rec er;
while (!done)
{
@@ -469,12 +529,12 @@
_emap.insert_fid(h._rid, fid);
}
//else std::cout << "t";
- if (rd._h_rid < h._rid)
- rd._h_rid = h._rid;
}
break;
case RHM_JDAT_DEQ_MAGIC:
{
+ if (!check_rid(fid, h, rd, read_pos))
+ return false;
deq_rec dr;
while (!done)
{
@@ -512,12 +572,12 @@
throw e;
}
}
- if (rd._h_rid < h._rid)
- rd._h_rid = h._rid;
}
break;
case RHM_JDAT_TXA_MAGIC:
{
+ if (!check_rid(fid, h, rd, read_pos))
+ return false;
txn_rec ar;
while (!done)
{
@@ -547,12 +607,12 @@
rd._enq_cnt_list[itr->_fid]--;
}
free(xidp);
- if (rd._h_rid < h._rid)
- rd._h_rid = h._rid;
}
break;
case RHM_JDAT_TXC_MAGIC:
{
+ if (!check_rid(fid, h, rd, read_pos))
+ return false;
txn_rec cr;
while (!done)
{
@@ -578,8 +638,6 @@
}
free(xidp);
- if (rd._h_rid < h._rid)
- rd._h_rid = h._rid;
}
break;
case RHM_JDAT_EMPTY_MAGIC:
@@ -595,6 +653,13 @@
rd._eo = ifsp->tellg();
return false;
default:
+ // Is this the last file, if so, stop as this is the overwrite boundary.
+ if (fid == (rd._ffid ? rd._ffid - 1 : JRNL_NUM_FILES - 1))
+ {
+ rd._lfid = fid;
+ rd._eo = read_pos;
+ return false;
+ }
std::stringstream ss;
ss << std::hex << std::setfill('0') << "Magic=0x" << std::setw(8) << h._magic;
ss << " fid=" << fid << " foffs=0x" << std::setw(8) << read_pos;
@@ -649,6 +714,28 @@
}
return true;
}
+
+const bool
+jcntl::check_rid(u_int16_t fid, hdr& h, rcvdat& rd, std::streampos read_pos) throw (jexception)
+{
+ if (rd._h_rid && rd._h_rid >= h._rid)
+ {
+ if (fid == (rd._ffid ? rd._ffid - 1 : JRNL_NUM_FILES - 1))
+ {
+ rd._lfid = fid;
+ rd._eo = read_pos;
+ return false;
+ }
+ std::stringstream ss;
+ ss << std::hex << std::setfill('0') << "Magic=0x" << std::setw(8) << h._magic;
+ ss << " fid=" << fid << " rid=" << h._rid << " hrid=" << rd._h_rid;
+ ss << " foffs=0x" << std::setw(8) << read_pos;
+ throw jexception(jerrno::JERR_JCNTL_RIDORDERBAD, ss.str().c_str(), "jcntl",
+ "check_rid");
+ }
+ rd._h_rid = h._rid;
+ return true;
+}
void
jcntl::aio_wr_callback(jcntl* journal, u_int32_t num_dtoks)
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -640,6 +640,10 @@
const bool jfile_cycle(u_int16_t& fid, std::ifstream* ifsp, rcvdat& rd,
const bool jump_fro);
+
+ const bool check_rid(u_int16_t fid, hdr& h, rcvdat& rd, std::streampos read_pos)
+ throw (jexception);
+
/**
* \brief Analyze a particular journal file for recovery.
*
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -59,6 +59,7 @@
const u_int32_t jerrno::JERR_JCNTL_UNKNOWNMAGIC = 0x0203;
const u_int32_t jerrno::JERR_JCNTL_NOTRECOVERED = 0x0204;
const u_int32_t jerrno::JERR_JCNTL_RECOVERJFULL = 0x0205;
+const u_int32_t jerrno::JERR_JCNTL_RIDORDERBAD = 0x0206;
// class jdir
const u_int32_t jerrno::JERR_JDIR_NOTDIR = 0x0300;
@@ -142,6 +143,8 @@
"Operation requires recover() to be run first.";
_err_map[JERR_JCNTL_RECOVERJFULL] = "JERR_JCNTL_RECOVERJFULL: "
"Journal data files full, cannot write.";
+ _err_map[JERR_JCNTL_RIDORDERBAD] = "JERR_JCNTL_RIDORDERBAD: "
+ "Record found with RID out-of-order.";
// class jdir
_err_map[JERR_JDIR_NOTDIR] = "JERR_JDIR_NOTDIR: Directory name exists but is not a directory.";
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -76,6 +76,7 @@
static const u_int32_t JERR_JCNTL_UNKNOWNMAGIC; ///< Found record with unknown magic
static const u_int32_t JERR_JCNTL_NOTRECOVERED; ///< Req' recover() to be called first
static const u_int32_t JERR_JCNTL_RECOVERJFULL; ///< Journal data files full, cannot write
+ static const u_int32_t JERR_JCNTL_RIDORDERBAD; ///< RID out-of-order
// class jdir
static const u_int32_t JERR_JDIR_NOTDIR; ///< Exists but is not a directory
Modified: store/trunk/cpp/lib/jrnl/jrec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jrec.cpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/jrec.cpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -45,24 +45,6 @@
jrec::jrec() {}
jrec::~jrec() {}
-const u_int32_t
-jrec::size_dblks(const size_t size)
-{
- return size_blks(size, JRNL_DBLK_SIZE);
-}
-
-const u_int32_t
-jrec::size_sblks(const size_t size)
-{
- return size_blks(size, JRNL_DBLK_SIZE * JRNL_SBLK_SIZE);
-}
-
-const u_int32_t
-jrec::size_blks(const size_t size, const size_t blksize)
-{
- return (size + blksize - 1)/blksize;
-}
-
void
jrec::chk_hdr(const hdr& hdr) throw (jexception)
{
Modified: store/trunk/cpp/lib/jrnl/jrec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jrec.hpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/jrec.hpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -158,9 +158,12 @@
virtual const size_t xid_size() const = 0;
virtual const size_t rec_size() const = 0;
inline virtual const u_int32_t rec_size_dblks() const { return size_dblks(rec_size()); }
- static const u_int32_t size_dblks(const size_t size);
- static const u_int32_t size_sblks(const size_t size);
- static const u_int32_t size_blks(const size_t size, const size_t blksize);
+ static inline const u_int32_t size_dblks(const size_t size)
+ { return size_blks(size, JRNL_DBLK_SIZE); }
+ static inline const u_int32_t size_sblks(const size_t size)
+ { return size_blks(size, JRNL_DBLK_SIZE * JRNL_SBLK_SIZE); }
+ static inline const u_int32_t size_blks(const size_t size, const size_t blksize)
+ { return (size + blksize - 1)/blksize; }
protected:
virtual void chk_hdr() const throw (jexception) = 0;
Modified: store/trunk/cpp/lib/jrnl/nlfh.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.cpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/nlfh.cpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -255,20 +255,6 @@
}
const u_int32_t
-nlfh::incr_rd_subm_cnt_dblks() throw (jexception)
-{
- if (_rd_subm_cnt_dblks >= _wr_subm_cnt_dblks)
- {
- std::stringstream ss;
- ss << "_rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks;
- ss << " _wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
- throw jexception(jerrno::JERR_NFLH_RDOFFSOVFL, ss.str().c_str(), "nlfh",
- "incr_rd_subm_cnt_dblks");
- }
- return ++_rd_subm_cnt_dblks;
-}
-
-const u_int32_t
nlfh::add_rd_subm_cnt_dblks(u_int32_t a) throw (jexception)
{
if (_rd_subm_cnt_dblks + a > _wr_subm_cnt_dblks)
@@ -284,20 +270,6 @@
}
const u_int32_t
-nlfh::incr_rd_cmpl_cnt_dblks() throw (jexception)
-{
- if (_rd_cmpl_cnt_dblks >= _rd_subm_cnt_dblks)
- {
- std::stringstream ss;
- ss << "_rd_cmpl_cnt_dblks=" << _rd_cmpl_cnt_dblks;
- ss << " _rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks;
- throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str().c_str(), "nlfh",
- "incr_rd_cmpl_cnt_dblks");
- }
- return ++_rd_cmpl_cnt_dblks;
-}
-
-const u_int32_t
nlfh::add_rd_cmpl_cnt_dblks(u_int32_t a) throw (jexception)
{
if (_rd_cmpl_cnt_dblks + a > _rd_subm_cnt_dblks)
@@ -313,20 +285,6 @@
}
const u_int32_t
-nlfh::incr_wr_subm_cnt_dblks() throw (jexception)
-{
- if (_wr_subm_cnt_dblks + 1 > JRNL_SBLK_SIZE * (JRNL_FILE_SIZE + 1)) // Allow for file header
- {
- std::stringstream ss;
- ss << "_wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
- ss << " fsize=" << JRNL_SBLK_SIZE * (JRNL_FILE_SIZE + 1) << " dblks";
- throw jexception(jerrno::JERR_NLFH_FILEOFFSOVFL, ss.str().c_str(), "nlfh",
- "incr_wr_subm_cnt_dblks");
- }
- return ++_wr_subm_cnt_dblks;
-}
-
-const u_int32_t
nlfh::add_wr_subm_cnt_dblks(u_int32_t a) throw (jexception)
{
if (_wr_subm_cnt_dblks + a > JRNL_SBLK_SIZE * (JRNL_FILE_SIZE + 1)) // Allow for file header
@@ -342,20 +300,6 @@
}
const u_int32_t
-nlfh::incr_wr_cmpl_cnt_dblks() throw (jexception)
-{
- if (_wr_cmpl_cnt_dblks >= _wr_subm_cnt_dblks)
- {
- std::stringstream ss;
- ss << "_wr_cmpl_cnt_dblks=" << _wr_cmpl_cnt_dblks;
- ss << " _wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
- throw jexception(jerrno::JERR_NFLH_CMPLOFFSOVFL, ss.str().c_str(), "nlfh",
- "incr_wr_cmpl_cnt_dblks");
- }
- return ++_wr_cmpl_cnt_dblks;
-}
-
-const u_int32_t
nlfh::add_wr_cmpl_cnt_dblks(u_int32_t a) throw (jexception)
{
if (_wr_cmpl_cnt_dblks + a > _wr_subm_cnt_dblks)
Modified: store/trunk/cpp/lib/jrnl/nlfh.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.hpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/nlfh.hpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -92,22 +92,18 @@
inline const u_int32_t rd_subm_cnt_dblks() const { return _rd_subm_cnt_dblks; }
inline const size_t rd_subm_offs() const { return _rd_subm_cnt_dblks * JRNL_DBLK_SIZE; }
- const u_int32_t incr_rd_subm_cnt_dblks() throw (jexception);
const u_int32_t add_rd_subm_cnt_dblks(u_int32_t a) throw (jexception);
inline const u_int32_t rd_cmpl_cnt_dblks() const { return _rd_cmpl_cnt_dblks; }
inline const size_t rd_cmpl_offs() const { return _rd_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
- const u_int32_t incr_rd_cmpl_cnt_dblks() throw (jexception);
const u_int32_t add_rd_cmpl_cnt_dblks(u_int32_t a) throw (jexception);
inline const u_int32_t wr_subm_cnt_dblks() const { return _wr_subm_cnt_dblks; }
inline const size_t wr_subm_offs() const { return _wr_subm_cnt_dblks * JRNL_DBLK_SIZE; }
- const u_int32_t incr_wr_subm_cnt_dblks() throw (jexception);
const u_int32_t add_wr_subm_cnt_dblks(u_int32_t a) throw (jexception);
inline const u_int32_t wr_cmpl_cnt_dblks() const { return _wr_cmpl_cnt_dblks; }
inline const size_t wr_cmpl_offs() const { return _wr_cmpl_cnt_dblks * JRNL_DBLK_SIZE; }
- const u_int32_t incr_wr_cmpl_cnt_dblks() throw (jexception);
const u_int32_t add_wr_cmpl_cnt_dblks(u_int32_t a) throw (jexception);
// Derived helper functions
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -75,9 +75,9 @@
_enq_cnt_list[f] = 0;
}
- void print()
+ void print(std::string& jid)
{
- std::cout << "Recovery jorunal file analysis summary:" << std::endl;
+ std::cout << "Jorunal file analysis (jid=\"" << jid << "\"):" << std::endl;
std::cout << " Journal empty (_empty) = " << (_empty ? "TRUE" : "FALSE") <<
std::endl;
std::cout << " First fid (_ffid) = " << _ffid << std::endl;
Modified: store/trunk/cpp/lib/jrnl/rrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.hpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/rrfc.hpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -114,15 +114,11 @@
inline const u_int32_t subm_cnt_dblks() const { return _curr_fh->rd_subm_cnt_dblks(); }
inline const size_t subm_offs() const { return _curr_fh->rd_subm_offs(); }
- inline const u_int32_t incr_subm_cnt_dblks() throw (jexception)
- { return _curr_fh->incr_rd_subm_cnt_dblks(); }
inline const u_int32_t add_subm_cnt_dblks(u_int32_t a) throw (jexception)
{ return _curr_fh->add_rd_subm_cnt_dblks(a); }
inline const u_int32_t cmpl_cnt_dblks() const { return _curr_fh->rd_cmpl_cnt_dblks(); }
inline const size_t cmpl_offs() const { return _curr_fh->rd_cmpl_offs(); }
- inline const u_int32_t incr_cmpl_cnt_dblks() throw (jexception)
- { return _curr_fh->incr_rd_cmpl_cnt_dblks(); }
inline const u_int32_t add_cmpl_cnt_dblks(u_int32_t a) throw (jexception)
{ return _curr_fh->add_rd_cmpl_cnt_dblks(a); }
Modified: store/trunk/cpp/lib/jrnl/wrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.hpp 2007-11-27 22:18:07 UTC (rev 1376)
+++ store/trunk/cpp/lib/jrnl/wrfc.hpp 2007-11-27 22:49:31 UTC (rev 1377)
@@ -89,15 +89,11 @@
inline const u_int32_t subm_cnt_dblks() const { return _curr_fh->wr_subm_cnt_dblks(); }
inline const size_t subm_offs() const { return _curr_fh->wr_subm_offs(); }
- inline const u_int32_t incr_subm_cnt_dblks() throw (jexception)
- { return _curr_fh->incr_wr_subm_cnt_dblks(); }
inline const u_int32_t add_subm_cnt_dblks(u_int32_t a) throw (jexception)
{ return _curr_fh->add_wr_subm_cnt_dblks(a); }
inline const u_int32_t cmpl_cnt_dblks() const { return _curr_fh->wr_cmpl_cnt_dblks(); }
inline const size_t cmpl_offs() const { return _curr_fh->wr_cmpl_offs(); }
- inline const u_int32_t incr_cmpl_cnt_dblks() throw (jexception)
- { return _curr_fh->incr_wr_cmpl_cnt_dblks(); }
inline const u_int32_t add_cmpl_cnt_dblks(u_int32_t a) throw (jexception)
{ return _curr_fh->add_wr_cmpl_cnt_dblks(a); }
17 years
rhmessaging commits: r1376 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-27 17:18:07 -0500 (Tue, 27 Nov 2007)
New Revision: 1376
Modified:
mgmt/mint/python/mint/__init__.py
Log:
Small fix to instCallback to reflect the recently renamed statsCurr
attr.
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-27 22:09:16 UTC (rev 1375)
+++ mgmt/mint/python/mint/__init__.py 2007-11-27 22:18:07 UTC (rev 1376)
@@ -114,7 +114,7 @@
if (timestamps[2] != 0):
d["deletionTime"] = datetime.fromtimestamp(timestamps[2]/1000000000)
d["statsPrev"] = obj.stats
- d["stats"] = objStats
+ d["statsCurr"] = objStats
obj.set(**d)
self.log("END INST---------------------------------------------------\n")
return objStats
17 years
rhmessaging commits: r1375 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-27 17:09:16 -0500 (Tue, 27 Nov 2007)
New Revision: 1375
Modified:
mgmt/mint/python/mint/__init__.py
Log:
replace prints with conditional logging, off by default
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-27 22:03:51 UTC (rev 1374)
+++ mgmt/mint/python/mint/__init__.py 2007-11-27 22:09:16 UTC (rev 1375)
@@ -42,10 +42,18 @@
class MintModel:
- def __init__(self):
+ def __init__(self, debug=False):
self.currentMethodId = 1
self.outstandingMethodCalls = dict()
self.connectedBrokers = dict()
+ self.debug = debug
+
+ def setDebug(self, debug=True):
+ self.debug = debug
+
+ def log(self, message):
+ if (self.debug):
+ print message
def sanitizeDict(self, d):
if ("id" in d):
@@ -65,14 +73,14 @@
return ""
def configCallback(self, broker, objectName, list, timestamps):
- print "\nCONFIG---------------------------------------------------"
- print objectName
+ self.log("\nCONFIG---------------------------------------------------")
+ self.log(objectName)
d = self.sanitizeDict(dict(list))
connectedBroker = self.connectedBrokers[broker]
d["managedBroker"] = broker
d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
d["creationTime"] = datetime.fromtimestamp(timestamps[1]/1000000000)
- print d
+ self.log(d)
###FIX
if (objectName == "broker"):
# needs special handling until schema is sendind info about systems
@@ -86,16 +94,16 @@
###FIX
obj = connectedBroker.getByOriginalId(schema.schemaNameToClassMap[objectName], d["idOriginal"], create=True)
obj.set(**d)
- print "END CONFIG---------------------------------------------------\n"
+ self.log("END CONFIG---------------------------------------------------\n")
return obj
def instCallback(self, broker, objectName, list, timestamps):
- print "\nINST---------------------------------------------------"
- print objectName
+ self.log("\nINST---------------------------------------------------")
+ self.log(objectName)
d = self.sanitizeDict(dict(list))
connectedBroker = self.connectedBrokers[broker]
d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
- print d
+ self.log(d)
obj = connectedBroker.getByOriginalId(schema.schemaNameToClassMap[objectName], d[self.convertIdKey("id")])
d[objectName] = obj
objNameStats = eval("schema.%sStats" % (schema.schemaNameToClassMap[objectName].__name__))
@@ -108,18 +116,18 @@
d["statsPrev"] = obj.stats
d["stats"] = objStats
obj.set(**d)
- print "END INST---------------------------------------------------\n"
+ self.log("END INST---------------------------------------------------\n")
return objStats
def methodCallback(self, broker, methodId, errorNo, errorText, args):
- print "\nMETHOD---------------------------------------------------"
- print "MethodId=%d" % (methodId)
- print "Error: %d %s" % (errorNo, errorText)
- print "Args: "
- print args
+ self.log("\nMETHOD---------------------------------------------------")
+ self.log("MethodId=%d" % (methodId))
+ self.log("Error: %d %s" % (errorNo, errorText))
+ self.log("Args: ")
+ self.log(args)
method = self.outstandingMethodCalls.pop(methodId)
result = method(errorText, args)
- print "END METHOD---------------------------------------------------\n"
+ self.log("END METHOD---------------------------------------------------\n")
return result
def connectToBroker(self, host, port):
17 years
rhmessaging commits: r1374 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-27 17:03:51 -0500 (Tue, 27 Nov 2007)
New Revision: 1374
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/notes/justin-todo.txt
Log:
Updates my todo list.
Broadens the set of brokers returned in the broker list. Fixes the
pagination.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-27 19:33:11 UTC (rev 1373)
+++ mgmt/cumin/python/cumin/broker.py 2007-11-27 22:03:51 UTC (rev 1374)
@@ -83,7 +83,7 @@
def get_items(self, session, model):
start, end = self.paginator.get_bounds(session)
- return model.sys.brokers[start:end]
+ return list(mint.Broker.select())[start:end]
def do_process(self, session, model):
if self.submit.get(session):
@@ -109,7 +109,7 @@
class BrokerPaginator(Paginator):
def get_object(self, session, model):
- return self.parent().get_items(session, model)
+ return list(mint.Broker.select()) #XXX ugh
class BrokerFrame(CuminFrame):
def __init__(self, app, name):
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-11-27 19:33:11 UTC (rev 1373)
+++ mgmt/notes/justin-todo.txt 2007-11-27 22:03:51 UTC (rev 1374)
@@ -4,22 +4,21 @@
* Queue: Add a msg enq rate msg deq rate chart
- * Pagination and sort in tables
+ * Sort in tables
+ * Restore high-low
+
+ * Restore the consumer, producer, and bindings stat links
+
+ * Add queue journal stats
+
Deferred
* Add a wooly.focus(id) method to replace the ad-hoc javascript I'm
using
- * Think about making css and jscript pages produce their document in
- some kind of widget-tree traversal order
-
- * We're generating lots of duplicate css rules
-
* The granularity of radio and checkbox disabling seems to be off
- * Rename Widget.name to .__name
-
* Make the status lights also be links to an appropriate view
- Defer until we know what we're going to link to
@@ -41,8 +40,6 @@
* Make item counts in tab labels a little grayer, that is, less
intense than the name
- * Add favicon and a mapping in the server to serve it
-
* Separate wooly stuff into its own devel subdir
* Consider having a cssclass set on widgets
17 years
rhmessaging commits: r1373 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-27 14:33:11 -0500 (Tue, 27 Nov 2007)
New Revision: 1373
Modified:
mgmt/mint/python/mint/schema.py
mgmt/mint/python/mint/schema.sql
Log:
add stats attrib, rename existing stats attrib to statsCurr
Modified: mgmt/mint/python/mint/schema.py
===================================================================
--- mgmt/mint/python/mint/schema.py 2007-11-27 19:32:35 UTC (rev 1372)
+++ mgmt/mint/python/mint/schema.py 2007-11-27 19:33:11 UTC (rev 1373)
@@ -7,7 +7,7 @@
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('SystemStats', cascade='null', default=None)
+ statsCurr = ForeignKey('SystemStats', cascade='null', default=None)
statsPrev = ForeignKey('SystemStats', cascade='null', default=None)
sysId = StringCol(length=1000, default=None)
@@ -16,13 +16,16 @@
recTime = TimestampCol(default=None)
system = ForeignKey('System', cascade='null', default=None)
+System.sqlmeta.addJoin(MultipleJoin('SystemStats', joinMethodName='stats'))
+
+
class Broker(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('BrokerStats', cascade='null', default=None)
+ statsCurr = ForeignKey('BrokerStats', cascade='null', default=None)
statsPrev = ForeignKey('BrokerStats', cascade='null', default=None)
system = ForeignKey('System', cascade='null', default=None)
port = SmallIntCol(default=None)
@@ -74,13 +77,16 @@
recTime = TimestampCol(default=None)
broker = ForeignKey('Broker', cascade='null', default=None)
+Broker.sqlmeta.addJoin(MultipleJoin('BrokerStats', joinMethodName='stats'))
+
+
class Vhost(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('VhostStats', cascade='null', default=None)
+ statsCurr = ForeignKey('VhostStats', cascade='null', default=None)
statsPrev = ForeignKey('VhostStats', cascade='null', default=None)
broker = ForeignKey('Broker', cascade='null', default=None)
name = StringCol(length=1000, default=None)
@@ -93,13 +99,16 @@
recTime = TimestampCol(default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
+Vhost.sqlmeta.addJoin(MultipleJoin('VhostStats', joinMethodName='stats'))
+
+
class Queue(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('QueueStats', cascade='null', default=None)
+ statsCurr = ForeignKey('QueueStats', cascade='null', default=None)
statsPrev = ForeignKey('QueueStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
name = StringCol(length=1000, default=None)
@@ -198,13 +207,16 @@
unackedMessagesLow = IntCol(default=None)
unackedMessagesHigh = IntCol(default=None)
+Queue.sqlmeta.addJoin(MultipleJoin('QueueStats', joinMethodName='stats'))
+
+
class Exchange(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('ExchangeStats', cascade='null', default=None)
+ statsCurr = ForeignKey('ExchangeStats', cascade='null', default=None)
statsPrev = ForeignKey('ExchangeStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
name = StringCol(length=1000, default=None)
@@ -230,13 +242,16 @@
byteDrops = BigIntCol(default=None)
byteRoutes = BigIntCol(default=None)
+Exchange.sqlmeta.addJoin(MultipleJoin('ExchangeStats', joinMethodName='stats'))
+
+
class Binding(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('BindingStats', cascade='null', default=None)
+ statsCurr = ForeignKey('BindingStats', cascade='null', default=None)
statsPrev = ForeignKey('BindingStats', cascade='null', default=None)
queue = ForeignKey('Queue', cascade='null', default=None)
exchange = ForeignKey('Exchange', cascade='null', default=None)
@@ -253,13 +268,16 @@
binding = ForeignKey('Binding', cascade='null', default=None)
msgMatched = BigIntCol(default=None)
+Binding.sqlmeta.addJoin(MultipleJoin('BindingStats', joinMethodName='stats'))
+
+
class Client(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('ClientStats', cascade='null', default=None)
+ statsCurr = ForeignKey('ClientStats', cascade='null', default=None)
statsPrev = ForeignKey('ClientStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
ipAddr = IntCol(default=None)
@@ -290,13 +308,16 @@
bytesProduced = BigIntCol(default=None)
bytesConsumed = BigIntCol(default=None)
+Client.sqlmeta.addJoin(MultipleJoin('ClientStats', joinMethodName='stats'))
+
+
class Session(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('SessionStats', cascade='null', default=None)
+ statsCurr = ForeignKey('SessionStats', cascade='null', default=None)
statsPrev = ForeignKey('SessionStats', cascade='null', default=None)
vhost = ForeignKey('Vhost', cascade='null', default=None)
name = StringCol(length=1000, default=None)
@@ -340,13 +361,16 @@
remainingLifespan = IntCol(default=None)
framesOutstanding = IntCol(default=None)
+Session.sqlmeta.addJoin(MultipleJoin('SessionStats', joinMethodName='stats'))
+
+
class Destination(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('DestinationStats', cascade='null', default=None)
+ statsCurr = ForeignKey('DestinationStats', cascade='null', default=None)
statsPrev = ForeignKey('DestinationStats', cascade='null', default=None)
session = ForeignKey('Session', cascade='null', default=None)
name = StringCol(length=1000, default=None)
@@ -384,13 +408,16 @@
msgCredits = IntCol(default=None)
byteCredits = IntCol(default=None)
+Destination.sqlmeta.addJoin(MultipleJoin('DestinationStats', joinMethodName='stats'))
+
+
class Producer(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('ProducerStats', cascade='null', default=None)
+ statsCurr = ForeignKey('ProducerStats', cascade='null', default=None)
statsPrev = ForeignKey('ProducerStats', cascade='null', default=None)
destination = ForeignKey('Destination', cascade='null', default=None)
exchange = ForeignKey('Exchange', cascade='null', default=None)
@@ -407,13 +434,16 @@
msgsProduced = BigIntCol(default=None)
bytesProduced = BigIntCol(default=None)
+Producer.sqlmeta.addJoin(MultipleJoin('ProducerStats', joinMethodName='stats'))
+
+
class Consumer(SQLObject):
idOriginal = BigIntCol(default=None)
recTime = TimestampCol(default=None)
creationTime = TimestampCol(default=None)
deletionTime = TimestampCol(default=None)
managedBroker = StringCol(length=1000, default=None)
- stats = ForeignKey('ConsumerStats', cascade='null', default=None)
+ statsCurr = ForeignKey('ConsumerStats', cascade='null', default=None)
statsPrev = ForeignKey('ConsumerStats', cascade='null', default=None)
destination = ForeignKey('Destination', cascade='null', default=None)
queue = ForeignKey('Queue', cascade='null', default=None)
@@ -439,6 +469,9 @@
unackedMessagesLow = IntCol(default=None)
unackedMessagesHigh = IntCol(default=None)
+Consumer.sqlmeta.addJoin(MultipleJoin('ConsumerStats', joinMethodName='stats'))
+
+
classToSchemaNameMap = dict()
schemaNameToClassMap = dict()
classToSchemaNameMap['System'] = 'system'
Modified: mgmt/mint/python/mint/schema.sql
===================================================================
--- mgmt/mint/python/mint/schema.sql 2007-11-27 19:32:35 UTC (rev 1372)
+++ mgmt/mint/python/mint/schema.sql 2007-11-27 19:33:11 UTC (rev 1373)
@@ -5,7 +5,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
queue_id INT,
exchange_id INT,
@@ -27,7 +27,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
system_id INT,
port SMALLINT,
@@ -58,7 +58,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
ip_addr INT,
@@ -84,7 +84,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
destination_id INT,
queue_id INT
@@ -109,7 +109,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
session_id INT,
name VARCHAR(1000)
@@ -134,7 +134,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
name VARCHAR(1000),
@@ -167,7 +167,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
destination_id INT,
exchange_id INT
@@ -189,7 +189,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
name VARCHAR(1000),
@@ -280,7 +280,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
vhost_id INT,
name VARCHAR(1000),
@@ -305,7 +305,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
sys_id VARCHAR(1000)
);
@@ -324,7 +324,7 @@
creation_time TIMESTAMP,
deletion_time TIMESTAMP,
managed_broker VARCHAR(1000),
- stats_id INT,
+ stats_curr_id INT,
stats_prev_id INT,
broker_id INT,
name VARCHAR(1000)
@@ -337,7 +337,7 @@
vhost_id INT
);
-ALTER TABLE binding ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
+ALTER TABLE binding ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
ALTER TABLE binding ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES binding_stats (id) ON DELETE SET NULL;
@@ -347,7 +347,7 @@
ALTER TABLE binding_stats ADD CONSTRAINT binding_id_exists FOREIGN KEY (binding_id) REFERENCES binding (id) ON DELETE SET NULL;
-ALTER TABLE broker ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES broker_stats (id) ON DELETE SET NULL;
+ALTER TABLE broker ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES broker_stats (id) ON DELETE SET NULL;
ALTER TABLE broker ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES broker_stats (id) ON DELETE SET NULL;
@@ -355,7 +355,7 @@
ALTER TABLE broker_stats ADD CONSTRAINT broker_id_exists FOREIGN KEY (broker_id) REFERENCES broker (id) ON DELETE SET NULL;
-ALTER TABLE client ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES client_stats (id) ON DELETE SET NULL;
+ALTER TABLE client ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES client_stats (id) ON DELETE SET NULL;
ALTER TABLE client ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES client_stats (id) ON DELETE SET NULL;
@@ -363,7 +363,7 @@
ALTER TABLE client_stats ADD CONSTRAINT client_id_exists FOREIGN KEY (client_id) REFERENCES client (id) ON DELETE SET NULL;
-ALTER TABLE consumer ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES consumer_stats (id) ON DELETE SET NULL;
+ALTER TABLE consumer ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES consumer_stats (id) ON DELETE SET NULL;
ALTER TABLE consumer ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES consumer_stats (id) ON DELETE SET NULL;
@@ -373,7 +373,7 @@
ALTER TABLE consumer_stats ADD CONSTRAINT consumer_id_exists FOREIGN KEY (consumer_id) REFERENCES consumer (id) ON DELETE SET NULL;
-ALTER TABLE destination ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES destination_stats (id) ON DELETE SET NULL;
+ALTER TABLE destination ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES destination_stats (id) ON DELETE SET NULL;
ALTER TABLE destination ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES destination_stats (id) ON DELETE SET NULL;
@@ -381,7 +381,7 @@
ALTER TABLE destination_stats ADD CONSTRAINT destination_id_exists FOREIGN KEY (destination_id) REFERENCES destination (id) ON DELETE SET NULL;
-ALTER TABLE exchange ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES exchange_stats (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;
@@ -389,7 +389,7 @@
ALTER TABLE exchange_stats ADD CONSTRAINT exchange_id_exists FOREIGN KEY (exchange_id) REFERENCES exchange (id) ON DELETE SET NULL;
-ALTER TABLE producer ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES producer_stats (id) ON DELETE SET NULL;
+ALTER TABLE producer ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES producer_stats (id) ON DELETE SET NULL;
ALTER TABLE producer ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES producer_stats (id) ON DELETE SET NULL;
@@ -399,7 +399,7 @@
ALTER TABLE producer_stats ADD CONSTRAINT producer_id_exists FOREIGN KEY (producer_id) REFERENCES producer (id) ON DELETE SET NULL;
-ALTER TABLE queue ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES queue_stats (id) ON DELETE SET NULL;
+ALTER TABLE queue ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES queue_stats (id) ON DELETE SET NULL;
ALTER TABLE queue ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES queue_stats (id) ON DELETE SET NULL;
@@ -407,7 +407,7 @@
ALTER TABLE queue_stats ADD CONSTRAINT queue_id_exists FOREIGN KEY (queue_id) REFERENCES queue (id) ON DELETE SET NULL;
-ALTER TABLE session ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES session_stats (id) ON DELETE SET NULL;
+ALTER TABLE session ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES session_stats (id) ON DELETE SET NULL;
ALTER TABLE session ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES session_stats (id) ON DELETE SET NULL;
@@ -417,13 +417,13 @@
ALTER TABLE session_stats ADD CONSTRAINT session_id_exists FOREIGN KEY (session_id) REFERENCES session (id) ON DELETE SET NULL;
-ALTER TABLE system ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES system_stats (id) ON DELETE SET NULL;
+ALTER TABLE system ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES system_stats (id) ON DELETE SET NULL;
ALTER TABLE system ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES system_stats (id) ON DELETE SET NULL;
ALTER TABLE system_stats ADD CONSTRAINT system_id_exists FOREIGN KEY (system_id) REFERENCES system (id) ON DELETE SET NULL;
-ALTER TABLE vhost ADD CONSTRAINT stats_id_exists FOREIGN KEY (stats_id) REFERENCES vhost_stats (id) ON DELETE SET NULL;
+ALTER TABLE vhost ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES vhost_stats (id) ON DELETE SET NULL;
ALTER TABLE vhost ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES vhost_stats (id) ON DELETE SET NULL;
17 years
rhmessaging commits: r1372 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2007-11-27 14:32:35 -0500 (Tue, 27 Nov 2007)
New Revision: 1372
Modified:
mgmt/mint/python/mint/__init__.py
mgmt/mint/python/mint/schemaparser.py
Log:
add stats attrib, rename existing stats attrib to statsCurr
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-11-27 16:44:33 UTC (rev 1371)
+++ mgmt/mint/python/mint/__init__.py 2007-11-27 19:32:35 UTC (rev 1372)
@@ -127,8 +127,8 @@
label = "%s:%d" % (host, port)
self.connectedBrokers[label] = ConnectedBroker(broker)
broker.configListener(label, self.configCallback)
- broker.instrumentationListener (label, self.instCallback)
- broker.methodListener (label, self.methodCallback)
+ broker.instrumentationListener(label, self.instCallback)
+ broker.methodListener(label, self.methodCallback)
broker.start()
return label
Modified: mgmt/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/mint/python/mint/schemaparser.py 2007-11-27 16:44:33 UTC (rev 1371)
+++ mgmt/mint/python/mint/schemaparser.py 2007-11-27 19:32:35 UTC (rev 1372)
@@ -51,8 +51,9 @@
self.generateAttrib(name + "Low", type)
self.generateAttrib(name + "High", type)
- def generateMultipleJoin(self, tableFrom, tableTo):
- attrib = tableTo.lower() + "s"
+ def generateMultipleJoin(self, tableFrom, tableTo, attrib=""):
+ if (attrib == ""):
+ attrib = tableTo.lower() + "s"
self.additionalPythonOutput += "\n%s.sqlmeta.addJoin(MultipleJoin('%s', joinMethodName='%s'))\n" % (tableFrom, tableTo, attrib)
def generateClassAttribs(self, schemaName, elements):
@@ -74,6 +75,7 @@
def startClass(self, schemaName, stats=False):
if (stats):
+ origPythonName = self.style.dbTableToPythonClass(schemaName)
pythonName = self.style.dbTableToPythonClass(schemaName + "_stats")
colPythonName = self.style.dbColumnToPythonAttr(schemaName)
keyPythonName = self.style.dbTableToPythonClass(schemaName)
@@ -86,11 +88,12 @@
self.generateTimestampAttrib("rec")
if (stats):
self.generateForeignKeyAttrib(colPythonName, keyPythonName)
+ self.generateMultipleJoin(origPythonName, pythonName, "stats")
else:
self.generateTimestampAttrib("creation")
self.generateTimestampAttrib("deletion")
self.generateAttrib("managedBroker", "StringCol", "length=1000")
- self.generateForeignKeyAttrib("stats", statsPythonName)
+ self.generateForeignKeyAttrib("statsCurr", statsPythonName)
self.generateForeignKeyAttrib("statsPrev", statsPythonName)
self.finalPythonOutput += "classToSchemaNameMap['%s'] = '%s'\n" % (pythonName, schemaName)
self.finalPythonOutput += "schemaNameToClassMap['%s'] = %s\n" % (schemaName, pythonName)
17 years
rhmessaging commits: r1371 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-27 11:44:33 -0500 (Tue, 27 Nov 2007)
New Revision: 1371
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
Log:
Implements a paginator and deploys it on the broker list.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-11-27 16:26:44 UTC (rev 1370)
+++ mgmt/cumin/python/cumin/broker.py 2007-11-27 16:44:33 UTC (rev 1371)
@@ -81,6 +81,10 @@
self.paginator = self.BrokerPaginator(app, "page")
self.add_child(self.paginator)
+ def get_items(self, session, model):
+ start, end = self.paginator.get_bounds(session)
+ return model.sys.brokers[start:end]
+
def do_process(self, session, model):
if self.submit.get(session):
self.submit.set(session, False)
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-27 16:26:44 UTC (rev 1370)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-27 16:44:33 UTC (rev 1371)
@@ -271,14 +271,24 @@
self.param.set_default(0)
self.add_parameter(self.param)
+ self.page_size = 2
+
def get(self, session):
return self.param.get(session)
def set(self, session, value):
return self.param.set(session, value)
+ def get_bounds(self, session):
+ page = self.get(session)
+ return (self.page_size * page, self.page_size * (page + 1))
+
def get_items(self, session, object):
- return range(0, int(ceil(len(object) / float(2))))
+ return range(0, int(ceil(len(object) / float(self.page_size))))
+
+ def render_item_class_attr(self, session, page):
+ if self.get(session) == page:
+ return " class=\"selected\""
def render_item_href(self, session, page):
branch = session.branch()
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2007-11-27 16:26:44 UTC (rev 1370)
+++ mgmt/cumin/python/cumin/widgets.strings 2007-11-27 16:44:33 UTC (rev 1371)
@@ -26,10 +26,23 @@
<li>{bytes_link}</li>
</ul>
+[Paginator.css]
+div.Paginator {
+ margin: 0 0 0.5em 0;
+}
+
+div.Paginator ul {
+ display: inline;
+}
+
+div.Paginator li {
+ display: inline;
+}
+
[Paginator.html]
-<ul class="comma">
- {items}
-</ul>
+<div class="Paginator">
+ Page <ul class="comma">{items}</ul>
+</div>
[Paginator.item_html]
-<li><a href="{item_href}">{item_content}</a></li>
+<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
17 years
rhmessaging commits: r1370 - mgmt/cumin/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-27 11:26:44 -0500 (Tue, 27 Nov 2007)
New Revision: 1370
Modified:
mgmt/cumin/python/wooly/__init__.py
Log:
Fixes a bug in string resolution. We weren't getting to strings of certain
superclasses' modules.
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2007-11-27 15:59:34 UTC (rev 1369)
+++ mgmt/cumin/python/wooly/__init__.py 2007-11-27 16:26:44 UTC (rev 1370)
@@ -28,9 +28,14 @@
self.__path = None
self.__page = None
self.child_index = None
-
+
app.add_widget(self)
+ for cls in self.__class__.__mro__:
+ app.add_widget_class(cls)
+ if cls is Widget:
+ break
+
def name(self):
return self.__name
@@ -399,8 +404,10 @@
raise Exception()
self.widgets.append(widget)
- self.widget_classes.add(widget.__class__)
+ def add_widget_class(self, cls):
+ self.widget_classes.add(cls)
+
def get_widget(self, key):
if not self.widget_index:
index = dict()
@@ -440,6 +447,8 @@
if not self.cached_css:
writer = Writer()
+ print self.widget_classes
+
for cls in sorted(self.widget_classes):
strs = cls.get_module_strings()
17 years
rhmessaging commits: r1369 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-27 10:59:34 -0500 (Tue, 27 Nov 2007)
New Revision: 1369
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Fixes the query behind the charts. Kind of a hack. Will need to introduce
another set of associations in the model to make this work better.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-27 03:37:34 UTC (rev 1368)
+++ mgmt/cumin/python/cumin/model.py 2007-11-27 15:59:34 UTC (rev 1369)
@@ -21,8 +21,9 @@
return self.classes[mint_object.__class__]
class CuminClass(object):
- def __init__(self, model, mint_class):
+ def __init__(self, model, name, mint_class):
self.model = model
+ self.name = name
self.mint_class = mint_class
self.mint_stats_class = None
@@ -65,8 +66,12 @@
return nvl(getattr(object.stats, self.name), -1)
def samples(self, object, limit=None):
+ name = self.cumin_class.name
cls = self.cumin_class.mint_stats_class
- stats = cls.select(orderBy="-id")[:limit]
+
+ stats = cls.select("%s_id = %i" % (name, object.id),
+ orderBy="-id")[:limit]
+
samples = list()
for stat in stats:
@@ -100,7 +105,7 @@
class CuminQueue(CuminClass):
def __init__(self, model):
- super(CuminQueue, self).__init__(model, mint.Queue)
+ super(CuminQueue, self).__init__(model, "queue", mint.Queue)
self.mint_stats_class = mint.QueueStats
@@ -265,7 +270,7 @@
class CuminExchange(CuminClass):
def __init__(self, model):
- super(CuminExchange, self).__init__(model, mint.Exchange)
+ super(CuminExchange, self).__init__(model, "exchange", mint.Exchange)
self.mint_stats_class = mint.ExchangeStats
17 years
rhmessaging commits: r1368 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-11-26 22:37:34 -0500 (Mon, 26 Nov 2007)
New Revision: 1368
Modified:
mgmt/cumin/python/cumin/widgets.py
Log:
Fixes some slightly incorrect math that was preventing the paginator from
functioning.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-11-27 03:20:12 UTC (rev 1367)
+++ mgmt/cumin/python/cumin/widgets.py 2007-11-27 03:37:34 UTC (rev 1368)
@@ -278,8 +278,8 @@
return self.param.set(session, value)
def get_items(self, session, object):
- return range(0, ceil(len(object) / 20) - 1)
-
+ return range(0, int(ceil(len(object) / float(2))))
+
def render_item_href(self, session, page):
branch = session.branch()
self.set(branch, page)
17 years