rhmessaging commits: r4318 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-09-21 11:53:24 -0400 (Tue, 21 Sep 2010)
New Revision: 4318
Modified:
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/lpmgr.hpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp
Log:
Made store recovery checks more stringent to eliminate obvioiusly corrupted files. This change adds a file size consistency check, and where possible, and OWI flag consistency check. The test for this class had to be upgraded also.
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -127,6 +127,11 @@
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;
+const u_int32_t jerrno::JERR_JINF_INVALIDFHDR = 0x0c05;
+const u_int32_t jerrno::JERR_JINF_STAT = 0x0c06;
+const u_int32_t jerrno::JERR_JINF_NOTREGFILE = 0x0c07;
+const u_int32_t jerrno::JERR_JINF_BADFILESIZE = 0x0c08;
+const u_int32_t jerrno::JERR_JINF_OWIBAD = 0x0c09;
// Negative returns for some functions
const int32_t jerrno::AIO_TIMEOUT = -1;
@@ -222,6 +227,11 @@
_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[JERR_JINF_INVALIDFHDR] = "JERR_JINF_INVALIDFHDR: Invalid journal data file header";
+ _err_map[JERR_JINF_STAT] = "JERR_JINF_STAT: Error while trying to stat a journal data file";
+ _err_map[JERR_JINF_NOTREGFILE] = "JERR_JINF_NOTREGFILE: Target journal data file is not a regular file";
+ _err_map[JERR_JINF_BADFILESIZE] = "JERR_JINF_BADFILESIZE: Journal data file is of incorrect or unexpected size";
+ _err_map[JERR_JINF_OWIBAD] = "JERR_JINF_OWIBAD: Journal data files have inconsistent OWI flags; >1 transition found in non-auto-expand or min-size journal";
//_err_map[] = "";
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -145,6 +145,11 @@
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
+ static const u_int32_t JERR_JINF_INVALIDFHDR; ///< Invalid file header
+ static const u_int32_t JERR_JINF_STAT; ///< Error while trying to stat a file
+ static const u_int32_t JERR_JINF_NOTREGFILE; ///< Target file is not a regular file
+ static const u_int32_t JERR_JINF_BADFILESIZE; ///< File is of incorrect or unexpected size
+ static const u_int32_t JERR_JINF_OWIBAD; ///< OWI inconsistent (>1 transition in non-ae journal)
// Negative returns for some functions
static const int32_t AIO_TIMEOUT; ///< Timeout waiting for AIO return
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -42,6 +42,7 @@
#include "jrnl/jerrno.hpp"
#include "jrnl/lp_map.hpp"
#include <sstream>
+#include <sys/stat.h>
namespace mrg
{
@@ -129,7 +130,7 @@
}
if (_ae)
{
- if (_ae_max_jfiles > _num_jfiles)
+ if (_ae_max_jfiles < _num_jfiles)
{
oss << "File \"" << _filename << "\": ";
oss << "Number of journal files exceeds auto-expansion limit: found=" << _num_jfiles;
@@ -173,19 +174,32 @@
void
jinf::analyze()
{
- bool done = false;
lp_map early_map; // map for all owi flags same as pfid 0
lp_map late_map; // map for all owi flags opposite to pfid 0
+ bool late_latch = false; // latch for owi switchover
- if (!_valid_flag)
- validate();
- done = false;
+ if (!_valid_flag)
+ validate();
+ bool done = false;
for (u_int16_t pfid=0; pfid<_num_jfiles && !done; pfid++)
{
std::ostringstream oss;
- oss << _jdir << "/" << _base_filename << ".";
+ if (_jdir.at(_jdir.size() - 1) == '/')
+ oss << _jdir << _base_filename << ".";
+ else
+ oss << _jdir << "/" << _base_filename << ".";
oss << std::setw(4) << std::setfill('0') << std::hex << pfid;
oss << "." << JRNL_DATA_EXTENSION;
+
+ // Check size of each file is consistent and expected
+ u_int32_t fsize = get_filesize(oss.str());
+ if (fsize != (_jfsize_sblks + 1) * _sblk_size_dblks * _dblk_size)
+ {
+ std::ostringstream oss1;
+ oss1 << "File \"" << oss.str() << "\": size=" << fsize << "; expected=" << ((_jfsize_sblks + 1) * _sblk_size_dblks * _dblk_size);
+ throw jexception(jerrno::JERR_JINF_BADFILESIZE, oss1.str(), "jinf", "analyze");
+ }
+
std::ifstream jifs(oss.str().c_str());
if (!jifs.good())
throw jexception(jerrno::JERR__FILEIO, oss.str(), "jinf", "analyze");
@@ -193,8 +207,10 @@
jifs.read((char*)&fhdr, sizeof(fhdr));
if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
{
+ if (fhdr._magic != 0)
+ throw jexception(jerrno::JERR_JINF_INVALIDFHDR, oss.str(), "jinf", "analyze");
if (!pfid) // pfid 0 == lid 0 cannot be empty
- throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
+ throw jexception(jerrno::JERR_JINF_JDATEMPTY, oss.str(), "jinf", "analyze");
_frot = true;
done = true;
}
@@ -209,9 +225,16 @@
else
{
if (_initial_owi == fhdr.get_owi())
+ {
early_map.insert(fhdr._lfid, pfid);
+ if (late_latch && (!_ae || _num_jfiles == JRNL_MIN_NUM_FILES))
+ throw jexception(jerrno::JERR_JINF_OWIBAD, oss.str(), "jinf", "analyze");
+ }
else
+ {
late_map.insert(fhdr._lfid, pfid);
+ late_latch = true;
+ }
}
}
jifs.close();
@@ -223,6 +246,13 @@
_pfid_list.clear();
late_map.get_pfid_list(_pfid_list);
early_map.get_pfid_list(_pfid_list);
+
+ // Check OWI consistency
+// for (u_int16_t lfid=0; lfid<_num_jfiles && !done; lfid++)
+// {
+// throw jexception(jerrno::JERR_JINF_OWIBAD, oss.str(), "jinf", "analyze");
+// }
+
_analyzed_flag = true;
}
@@ -404,10 +434,10 @@
string_value(_base_filename, buff);
else if(std::strstr(buff, "number_jrnl_files"))
_num_jfiles = u_int16_value(buff);
+ else if(std::strstr(buff, "auto_expand_max_jrnl_files"))
+ _ae_max_jfiles = u_int16_value(buff);
else if(std::strstr(buff, "auto_expand"))
_ae = bool_value(buff);
- else if(std::strstr(buff, "auto_expand_max_jrnl_files"))
- _ae_max_jfiles = u_int16_value(buff);
else if(std::strstr(buff, "jrnl_file_size_sblks"))
_jfsize_sblks = u_int32_value(buff);
else if(std::strstr(buff, "JRNL_SBLK_SIZE"))
@@ -483,5 +513,24 @@
return t1;
}
+u_int32_t
+jinf::get_filesize(const std::string& file_name) const
+{
+ struct stat s;
+ if (::stat(file_name.c_str(), &s))
+ {
+ std::ostringstream oss;
+ oss << "stat: file=\"" << file_name << "\"" << FORMAT_SYSERR(errno);
+ throw jexception(jerrno::JERR_JINF_STAT, oss.str(), "jinf", "get_filesize");
+ }
+ if (!S_ISREG(s.st_mode)) // not a regular file,
+ {
+ std::ostringstream oss;
+ oss << "File \"" << file_name << "\" is not a regular file: mode=0x" << std::hex << s.st_mode;
+ throw jexception(jerrno::JERR_JINF_NOTREGFILE, oss.str(), "jinf", "get_filesize");
+ }
+ return u_int32_t(s.st_size);
+}
+
} // namespace journal
} // namespace mrg
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -124,6 +124,7 @@
u_int32_t u_int32_value(char* line) const;
std::string& string_value(std::string& str, char* line) const;
char* find_value(char* line) const;
+ u_int32_t get_filesize(const std::string& file_name) const;
};
} // namespace journal
Modified: store/trunk/cpp/lib/jrnl/lpmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lpmgr.hpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/lib/jrnl/lpmgr.hpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -88,7 +88,7 @@
* </pre>
*
* The insert() function updates the internal map immediately, but the physical files (which have both the pfid and
- * lfid written into the file header) are only updated as they are overwirtten in the normal course of enqueueing
+ * lfid written into the file header) are only updated as they are overwritten in the normal course of enqueueing
* and dequeueing messages. If the %journal should fail after insertion but before the files following those inserted
* are overwritten, then duplicate lfids will be present (though no duplicate pfids are possible). The overwrite
* indicator (owi) flag and the pfid numbers may be used to resolve the ambiguity and determine the logically earlier
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -86,14 +86,14 @@
_njf = num_jfiles;
_ae = auto_expand;
_aemjf = ae_max_jfiles;
- _owi=false;
+ _owi = false;
_frot = false;
- _jempty=true;
- _ffid=0;
- _fro=0;
- _lfid=0;
- _eo=0;
- _h_rid=0;
+ _jempty = true;
+ _ffid = 0;
+ _fro = 0;
+ _lfid = 0;
+ _eo = 0;
+ _h_rid = 0;
_lffull = false;
_jfull = false;
_fid_list.clear();
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -383,16 +383,16 @@
* header (512 bytes each) and a single jinf file which contains the journal metadata required for recovery
* analysis.
*/
- void write_journal(const bool ae, const u_int16_t ae_max_jfiles)
+ void write_journal(const bool ae, const u_int16_t ae_max_jfiles, const u_int32_t fsize_sblks = JFSIZE_SBLKS)
{
create_jinf(ae, ae_max_jfiles);
u_int16_t pfid = 0;
for (lpmap_citr itr = _map.begin(); itr != _map.end(); itr++, pfid++)
{
- if (itr->second._pfid == 0 && itr->second._magic == 0) // empty header, use pfid counter instaed
- create_journal_file(pfid, itr->second, _base_filename);
+ if (itr->second._pfid == 0 && itr->second._magic == 0) // empty header, use pfid counter instead
+ create_journal_file(pfid, itr->second, _base_filename, fsize_sblks);
else
- create_journal_file(itr->second._pfid, itr->second, _base_filename);
+ create_journal_file(itr->second._pfid, itr->second, _base_filename, fsize_sblks);
}
}
@@ -481,35 +481,51 @@
ji.write();
}
- static void create_journal_file(const u_int16_t pfid, const file_hdr& fh, const string base_filename)
+ static void create_journal_file(const u_int16_t pfid,
+ const file_hdr& fh,
+ const string base_filename,
+ const u_int32_t fsize_sblks = JFSIZE_SBLKS,
+ const char fill_char = 0)
{
- write_file_header(fh, create_journal_filename(pfid, base_filename));
- }
-
- static void write_file_header(const file_hdr& fh,
- const string filename)
- {
+ const std::string filename = create_journal_filename(pfid, base_filename);
ofstream of(filename.c_str(), ofstream::out | ofstream::trunc);
if (!of.good())
BOOST_FAIL("Unable to open test journal file \"" << filename << "\" for writing.");
+ write_file_header(filename, of, fh, fill_char);
+ write_file_body(of, fsize_sblks, fill_char);
+
+ of.close();
+ if (of.fail() || of.bad())
+ BOOST_FAIL("Error closing test journal file \"" << filename << "\".");
+ }
+
+ static void write_file_header(const std::string& filename, ofstream& of, const file_hdr& fh, const char fill_char)
+ {
// write file header
u_int32_t cnt = sizeof(file_hdr);
of.write((const char*)&fh, cnt);
if (of.fail() || of.bad())
BOOST_FAIL("Error writing file header to test journal file \"" << filename << "\".");
- // fill remaining sblk with 0s
+ // fill remaining sblk with fill char
while (cnt++ < JRNL_DBLK_SIZE * JRNL_SBLK_SIZE)
{
- of.put(0);
+ of.put(fill_char);
if (of.fail() || of.bad())
BOOST_FAIL("Error writing filler to test journal file \"" << filename << "\".");
}
+ }
- of.close();
- if (of.fail() || of.bad())
- BOOST_FAIL("Error closing test journal file \"" << filename << "\".");
+ static void write_file_body(ofstream& of, const u_int32_t fsize_sblks, const char fill_char)
+ {
+ if (fsize_sblks > 1)
+ {
+ std::vector<char> sblk_buffer(JRNL_DBLK_SIZE * JRNL_SBLK_SIZE, fill_char);
+ u_int32_t fwritten_sblks = 0; // hdr
+ while (fwritten_sblks++ < fsize_sblks)
+ of.write(sblk_buffer.data(), JRNL_DBLK_SIZE * JRNL_SBLK_SIZE);
+ }
}
static string create_journal_filename(const u_int16_t pfid, const string base_filename)
Modified: store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -215,12 +215,12 @@
const string base_filename = test_name + "_bfn";
lfid_pfid_map m(jid, base_filename);
for (u_int16_t oldest_lid = 0; oldest_lid < NUM_JFILES; oldest_lid++)
- for (u_int16_t after_lid = 0; after_lid < NUM_JFILES; after_lid++)
+ for (u_int16_t after_lid = 0; after_lid < NUM_JFILES; after_lid++)
for (u_int16_t num_files = 1; num_files <= 5; num_files++)
{
m.journal_create(NUM_JFILES, NUM_JFILES, oldest_lid);
m.journal_insert(after_lid, num_files);
- m.write_journal(false, 0);
+ m.write_journal(true, 16);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -251,7 +251,7 @@
const u_int16_t after_lid = u_int16_t(m.size() * ::drand48());
m.journal_insert(after_lid, num_files);
}
- m.write_journal(false, 0);
+ m.write_journal(true, 24);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -291,7 +291,7 @@
const u_int16_t num_files = u_int16_t(1 + (NUM_JFILES * ::drand48()));
const u_int16_t after_lid = oldest_lid == 0 ? m.size() - 1 : oldest_lid - 1;
m.journal_insert(after_lid, num_files, false);
- m.write_journal(false, 0);
+ m.write_journal(true, 32);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
Modified: store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp 2010-09-21 15:51:59 UTC (rev 4317)
+++ store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp 2010-09-21 15:53:24 UTC (rev 4318)
@@ -152,7 +152,7 @@
lfm.get_pfid_list(pfidl);
lfm.get_lfid_list(lfidl);
lm.finalize(); // clear all file handles before erasing old journal files
- lfm.write_journal(ae, ae_max_jfiles);
+ lfm.write_journal(ae, ae_max_jfiles, JFSIZE_SBLKS);
lpmgr_test_helper::rcvdat_init(rd, pfidl, ae, ae_max_jfiles);
lm.recover(rd, &jc, &jc.new_fcntl);
@@ -822,7 +822,7 @@
// Recover from previous iteration
lfm.get_pfid_list(pfidl);
lfm.get_lfid_list(lfidl);
- lfm.write_journal(true, curr_ae_max_jfiles);
+ lfm.write_journal(true, curr_ae_max_jfiles, JFSIZE_SBLKS);
lpmgr_test_helper::rcvdat_init(rd, pfidl, true, curr_ae_max_jfiles);
lm.recover(rd, &jc, &jc.new_fcntl);
lpmgr_test_helper::check_pfids_lfids(lm, pfidl, lfidl);
14 years, 3 months
rhmessaging commits: r4317 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2010-09-21 11:51:59 -0400 (Tue, 21 Sep 2010)
New Revision: 4317
Modified:
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.h
Log:
Renamed the MessageStore interface truncateInit parameter to a more generic name. Matches qpid checkin r.999473. This is a tidy-up only, there should be no code implications.
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2010-09-21 15:11:36 UTC (rev 4316)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2010-09-21 15:51:59 UTC (rev 4317)
@@ -396,7 +396,7 @@
}
}
-void MessageStoreImpl::truncateInit(const bool pushDownStoreFiles)
+void MessageStoreImpl::truncateInit(const bool saveStoreContent)
{
if (isInit) {
{
@@ -415,8 +415,8 @@
}
std::ostringstream oss;
oss << storeDir << "/" << storeTopLevelDir;
- if (pushDownStoreFiles) {
- QPID_LOG(notice, "Store directory " << oss.str() << " was pushed down into directory " << mrg::journal::jdir::push_down(storeDir, storeTopLevelDir, "cluster") << ".");
+ if (saveStoreContent) {
+ QPID_LOG(notice, "Store directory " << oss.str() << " was pushed down (saved) into directory " << mrg::journal::jdir::push_down(storeDir, storeTopLevelDir, "cluster") << ".");
} else {
mrg::journal::jdir::delete_dir(oss.str().c_str());
QPID_LOG(notice, "Store directory " << oss.str() << " was truncated.");
Modified: store/trunk/cpp/lib/MessageStoreImpl.h
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.h 2010-09-21 15:11:36 UTC (rev 4316)
+++ store/trunk/cpp/lib/MessageStoreImpl.h 2010-09-21 15:51:59 UTC (rev 4317)
@@ -289,7 +289,7 @@
bool autoJExpand = defAutoJrnlExpand,
u_int16_t autoJExpandMaxFiles = defAutoJrnlExpandMaxFiles);
- void truncateInit(const bool pushDownStoreFiles = false);
+ void truncateInit(const bool saveStoreContent = false);
void initManagement (qpid::broker::Broker* broker);
14 years, 3 months
rhmessaging commits: r4316 - mgmt/newdata.
by rhmessaging-commits@lists.jboss.org
Author: tmckay
Date: 2010-09-21 11:11:36 -0400 (Tue, 21 Sep 2010)
New Revision: 4316
Modified:
mgmt/newdata/README
Log:
Modified the steps to install and configure cumin from sources.
Modified: mgmt/newdata/README
===================================================================
--- mgmt/newdata/README 2010-09-21 13:30:47 UTC (rev 4315)
+++ mgmt/newdata/README 2010-09-21 15:11:36 UTC (rev 4316)
@@ -31,12 +31,16 @@
method below links to the qpid code via symlinks in ~/lib/python,
which is in the mgmt devel environment's PYTHONPATH:
- $ svn co http://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/python ~/pyqpid
+ $ svn co http://svn.apache.org/repos/asf/qpid/trunk/qpid ~/qpid
+ $ cd ~/qpid/python
+ $ python setup.py build
+ $ cd ~/qpid/extras/qmf
+ $ python setup.py build
$ mkdir -p ~/lib/python
$ cd ~/lib/python
- $ ln -s ~/pyqpid/qpid
- $ ln -s ~/pyqpid/mllib
- $ ln -s ~/pyqpid/qmf
+ $ ln -s ~/qpid/python/build/lib/qpid
+ $ ln -s ~/qpid/python/build/lib/mllib
+ $ ln -s ~/qpid/extras/qmf/build/lib/qmf
*Alternatively*, install python-qpid:
14 years, 3 months
rhmessaging commits: r4314 - mgmt/newdata/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-21 06:06:35 -0400 (Tue, 21 Sep 2010)
New Revision: 4314
Modified:
mgmt/newdata/cumin/python/cumin/database.py
Log:
Use a thread local to reuse database connections
Modified: mgmt/newdata/cumin/python/cumin/database.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/database.py 2010-09-20 21:04:34 UTC (rev 4313)
+++ mgmt/newdata/cumin/python/cumin/database.py 2010-09-21 10:06:35 UTC (rev 4314)
@@ -1,5 +1,6 @@
import psycopg2
import re
+import threading
from util import *
@@ -11,6 +12,7 @@
self.dsn = dsn
self.connection_args = dict()
+ self.thread_local = threading.local()
def init(self):
log.info("Initializing %s", self)
@@ -18,8 +20,11 @@
#m = re.match(r"^([^:]+)://([^@]+)@([^/]+)/(.+)$", self.uri)
def get_connection(self):
- return psycopg2.connect(self.dsn)
+ if not hasattr(self.thread_local, "connection"):
+ self.thread_local.connection = psycopg2.connect(self.dsn)
+ return self.thread_local.connection
+
def __repr__(self):
return self.__class__.__name__
14 years, 3 months
rhmessaging commits: r4313 - in mgmt/newdata/cumin/python/cumin: grid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-09-20 17:04:34 -0400 (Mon, 20 Sep 2010)
New Revision: 4313
Modified:
mgmt/newdata/cumin/python/cumin/grid/limit.py
mgmt/newdata/cumin/python/cumin/grid/negotiator.py
mgmt/newdata/cumin/python/cumin/widgets.py
mgmt/newdata/cumin/python/cumin/widgets.strings
Log:
Don't allow sort on limits and quotas table columns.
Indent quota group name based on level in hierarchy
Modified: mgmt/newdata/cumin/python/cumin/grid/limit.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/limit.py 2010-09-20 21:00:53 UTC (rev 4312)
+++ mgmt/newdata/cumin/python/cumin/grid/limit.py 2010-09-20 21:04:34 UTC (rev 4313)
@@ -85,7 +85,7 @@
def render_title(self, session):
return "Limits"
- class NameColumn(ItemTableColumn):
+ class NameColumn(NonSortableTableColumn):
def render_title(self, session):
return "Name"
@@ -97,11 +97,11 @@
href = self.frame.limit.set_limit.get_href(session)
return fmt_link(href, limit)
- class CurrentColumn(ItemTableColumn):
+ class CurrentColumn(NonSortableTableColumn):
def render_title(self, session):
return "Current Usage"
- class MaxColumn(ItemTableColumn):
+ class MaxColumn(NonSortableTableColumn):
def render_title(self, session):
return "Max Allowance"
Modified: mgmt/newdata/cumin/python/cumin/grid/negotiator.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-09-20 21:00:53 UTC (rev 4312)
+++ mgmt/newdata/cumin/python/cumin/grid/negotiator.py 2010-09-20 21:04:34 UTC (rev 4313)
@@ -53,7 +53,7 @@
def __init__(self, app, name, getter, negotiator, task):
super(QmfGroupColumn, self).__init__(app, name)
- self.header_class = ItemTableColumnHeader
+ self.header_class = StaticTableColumnHeader
self.title = None
self.getter = getter
@@ -197,15 +197,17 @@
return fmt_link(branch.marshal(), state, class_=cls, link_title=hover)
- class GroupColumn(ItemTableColumn):
+ class GroupColumn(NonSortableTableColumn):
def render_title(self, session, *args):
return "Name"
def render_content(self, session, group):
# if a user
if "." in group:
- (g, sep, user) = rpartition(group, ".")
- return "<span style='padding-left: 1em;'>%s</span>" % user
+ parts = group.split('.')
+ indent = len(parts) - 1
+ user = parts[indent]
+ return "<span style='padding-left: %dem;'>%s</span>" % (indent, user)
return group
Modified: mgmt/newdata/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/widgets.py 2010-09-20 21:00:53 UTC (rev 4312)
+++ mgmt/newdata/cumin/python/cumin/widgets.py 2010-09-20 21:04:34 UTC (rev 4313)
@@ -914,6 +914,15 @@
def get_default(self, session):
return datetime.now() - timedelta(minutes=10)
+class StaticTableColumnHeader(ItemTableColumnHeader):
+ pass
+
+class NonSortableTableColumn(ItemTableColumn):
+ def __init__(self, app, name):
+ super(NonSortableTableColumn, self).__init__(app, name)
+
+ self.header_class = StaticTableColumnHeader
+
class PaginatedItemSet(ItemSet):
def __init__(self, app, name):
super(PaginatedItemSet, self).__init__(app, name)
Modified: mgmt/newdata/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/newdata/cumin/python/cumin/widgets.strings 2010-09-20 21:00:53 UTC (rev 4312)
+++ mgmt/newdata/cumin/python/cumin/widgets.strings 2010-09-20 21:04:34 UTC (rev 4313)
@@ -866,3 +866,6 @@
);
//]]>
</script>
+
+[StaticTableColumnHeader.html]
+<th {attrs}>{content}</th>
14 years, 3 months
rhmessaging commits: r4312 - mgmt/newdata/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-09-20 17:00:53 -0400 (Mon, 20 Sep 2010)
New Revision: 4312
Modified:
mgmt/newdata/cumin/python/cumin/main.py
Log:
Remove the filter on _qmf_update_time for TopSubmissions
Modified: mgmt/newdata/cumin/python/cumin/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/main.py 2010-09-20 17:00:42 UTC (rev 4311)
+++ mgmt/newdata/cumin/python/cumin/main.py 2010-09-20 21:00:53 UTC (rev 4312)
@@ -380,10 +380,6 @@
filter = SqlComparisonFilter(table.Running, "0", ">")
self.adapter.query.add_filter(filter)
- filter = SqlComparisonFilter(table._qmf_update_time,
- "now() - interval '60 seconds'", ">=")
- self.adapter.query.add_filter(filter)
-
def render_rows(self, session):
data = self.data.get(session)
14 years, 3 months
rhmessaging commits: r4311 - mgmt/newdata/cumin/python/cumin/messaging.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-20 13:00:42 -0400 (Mon, 20 Sep 2010)
New Revision: 4311
Modified:
mgmt/newdata/cumin/python/cumin/messaging/binding.py
Log:
Can't use try/except/finally on older pythons (#2)
Modified: mgmt/newdata/cumin/python/cumin/messaging/binding.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/binding.py 2010-09-20 16:56:26 UTC (rev 4310)
+++ mgmt/newdata/cumin/python/cumin/messaging/binding.py 2010-09-20 17:00:42 UTC (rev 4311)
@@ -101,14 +101,15 @@
queue = None
exchange = None
try:
- cls = self.app.model.org_apache_qpid_broker.Queue
- queue = cls.get_object_by_id(cursor, binding._queueRef_id)
- cls = self.app.model.org_apache_qpid_broker.Exchange
- exchange = cls.get_object_by_id(cursor, binding._exchangeRef_id)
- except Exception, e:
- invoc.status = "failed"
- invoc.exception = e
- log.exception(e)
+ try:
+ cls = self.app.model.org_apache_qpid_broker.Queue
+ queue = cls.get_object_by_id(cursor, binding._queueRef_id)
+ cls = self.app.model.org_apache_qpid_broker.Exchange
+ exchange = cls.get_object_by_id(cursor, binding._exchangeRef_id)
+ except Exception, e:
+ invoc.status = "failed"
+ invoc.exception = e
+ log.exception(e)
finally:
conn.close()
14 years, 3 months
rhmessaging commits: r4310 - mgmt/newdata/cumin/python/cumin/messaging.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-20 12:56:26 -0400 (Mon, 20 Sep 2010)
New Revision: 4310
Modified:
mgmt/newdata/cumin/python/cumin/messaging/binding.py
Log:
Can't use try/except/finally on older pythons
Modified: mgmt/newdata/cumin/python/cumin/messaging/binding.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/messaging/binding.py 2010-09-20 15:29:09 UTC (rev 4309)
+++ mgmt/newdata/cumin/python/cumin/messaging/binding.py 2010-09-20 16:56:26 UTC (rev 4310)
@@ -28,14 +28,15 @@
queue = None
exchange = None
try:
- cls = self.app.model.org_apache_qpid_broker.Queue
- queue = cls.get_object_by_id(cursor, binding._queueRef_id)
- cls = self.app.model.org_apache_qpid_broker.Exchange
- exchange = cls.get_object_by_id(cursor, binding._exchangeRef_id)
- except Exception, e:
- invoc.status = "failed"
- invoc.exception = e
- log.exception(e)
+ try:
+ cls = self.app.model.org_apache_qpid_broker.Queue
+ queue = cls.get_object_by_id(cursor, binding._queueRef_id)
+ cls = self.app.model.org_apache_qpid_broker.Exchange
+ exchange = cls.get_object_by_id(cursor, binding._exchangeRef_id)
+ except Exception, e:
+ invoc.status = "failed"
+ invoc.exception = e
+ log.exception(e)
finally:
conn.close()
14 years, 3 months
rhmessaging commits: r4309 - mgmt/newdata/cumin/open-flash-chart/com/serialization/json.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2010-09-20 11:29:09 -0400 (Mon, 20 Sep 2010)
New Revision: 4309
Modified:
mgmt/newdata/cumin/open-flash-chart/com/serialization/json/JSON.as
Log:
Allow strings "True" and "False" in addition to "true" and "false"
Modified: mgmt/newdata/cumin/open-flash-chart/com/serialization/json/JSON.as
===================================================================
--- mgmt/newdata/cumin/open-flash-chart/com/serialization/json/JSON.as 2010-09-20 15:27:10 UTC (rev 4308)
+++ mgmt/newdata/cumin/open-flash-chart/com/serialization/json/JSON.as 2010-09-20 15:29:09 UTC (rev 4309)
@@ -417,18 +417,21 @@
_word = function ():* {
switch (ch) {
case 't':
+ case 'T':
if (_next() == 'r' && _next() == 'u' && _next() == 'e') {
_next();
return true;
}
break;
case 'f':
+ case 'F':
if (_next() == 'a' && _next() == 'l' && _next() == 's' && _next() == 'e') {
_next();
return false;
}
break;
case 'n':
+ case 'N':
if (_next() == 'u' && _next() == 'l' && _next() == 'l') {
_next();
return null;
14 years, 3 months
rhmessaging commits: r4308 - mgmt/newdata/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2010-09-20 11:27:10 -0400 (Mon, 20 Sep 2010)
New Revision: 4308
Modified:
mgmt/newdata/mint/python/mint/vacuum.py
Log:
Fix typo in log message
Modified: mgmt/newdata/mint/python/mint/vacuum.py
===================================================================
--- mgmt/newdata/mint/python/mint/vacuum.py 2010-09-20 15:21:18 UTC (rev 4307)
+++ mgmt/newdata/mint/python/mint/vacuum.py 2010-09-20 15:27:10 UTC (rev 4308)
@@ -16,7 +16,7 @@
class VacuumUpdate(Update):
def do_process(self, cursor, stats):
- log.info("Vacumming tables")
+ log.info("Vacuuming tables")
conn = self.model.app.update_thread.conn
14 years, 3 months