rhmessaging commits: r2008 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-08 14:09:50 -0400 (Thu, 08 May 2008)
New Revision: 2008
Modified:
mgmt/mint/python/mint/__init__.py
Log:
Rearrange some things in broker connection to match changes in the
python client.
Catch connection failures and store the exception.
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-05-08 17:27:43 UTC (rev 2007)
+++ mgmt/mint/python/mint/__init__.py 2008-05-08 18:09:50 UTC (rev 2008)
@@ -172,29 +172,50 @@
###FIX
return None
+# Not thread safe
class BrokerConnection(object):
def __init__(self, model, host, port):
self.model = model
+ self.host = host
+ self.port = port
self.key = "%s:%i" % (host, port)
self.objs = OriginalIdDict()
- spec = qpid.spec.load(model.specPath)
- self.conn = Connection(connect(host, port), spec)
- self.mclient = managementClient(spec, None,
- self.model.configCallback,
- self.model.instCallback,
- self.model.methodCallback)
- self.mclient.schemaListener(self.model.schemaCallback)
-
- self.state = None # in (None, "opening", "opened", "closing", "closed")
+ # state in (None, "opening", "opened", "open_failed",
+ # "closing", "closed", "close_failed")
+ self.state = None
self.exception = None
+ self.conn = None
+ self.mclient = None
+ self.mchan = None
+
def isOpen(self):
return self.state == "opened"
def open(self):
+ assert self.conn is None
+ assert self.mclient is None
+ assert self.mchan is None
+
self.state = "opening"
+ spec = qpid.spec.load(self.model.specPath)
+
+ try:
+ sock = connect(self.host, self.port)
+ except Exception, e:
+ self.state = "open_failed"
+ self.exception = e
+ return
+
+ self.conn = Connection(sock, spec)
+ self.mclient = managementClient(spec, None,
+ self.model.configCallback,
+ self.model.instCallback,
+ self.model.methodCallback)
+ self.mclient.schemaListener(self.model.schemaCallback)
+
self.model.lock.acquire()
try:
try:
@@ -204,7 +225,8 @@
self.model.connections[self.key] = self
self.conn.start()
- self.mchan = self.mclient.addChannel (self.conn.session(str(uuid4())), self.key)
+ self.mchan = self.mclient.addChannel(self.conn.session(str(uuid4())),
+ self.key)
self.state = "opened"
except Exception, e:
@@ -214,12 +236,15 @@
self.model.lock.release()
def getSessionId(self):
- if self.isOpen():
- return self.mchan.sessionId
- else:
- return None
+ if not self.isOpen():
+ raise Exception("Connection not open")
+ return self.mchan.sessionId
+
def callMethod(self, objId, className, methodName, callback, args):
+ if not self.isOpen():
+ raise Exception("Connection not open")
+
self.model.lock.acquire()
try:
self.model.currentMethodId += 1
@@ -248,6 +273,13 @@
finally:
self.model.lock.release()
+ self.conn.close()
+ # XXX What else do I need to try to shutdown here?
+
+ self.conn = None
+ self.mclient = None
+ self.mchan = None
+
def getByOriginalId(self, objType, idOriginal, create=False, args={}):
return self.objs.getByOriginalId(objType, idOriginal, create, args)
16 years, 8 months
rhmessaging commits: r2007 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-08 13:27:43 -0400 (Thu, 08 May 2008)
New Revision: 2007
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Fix frame navigation in broker registration add form.
Don't violate the 80th column.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-05-08 16:05:36 UTC (rev 2006)
+++ mgmt/cumin/python/cumin/broker.py 2008-05-08 17:27:43 UTC (rev 2007)
@@ -573,7 +573,8 @@
class BrokerSetAdd(BrokerSetForm):
def process_cancel(self, session):
branch = session.branch()
- self.frame.show_view(branch)
+ frame = self.page.pop_current_frame(branch)
+ frame.show_view(branch)
self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
@@ -629,8 +630,10 @@
errs.append("The address field is empty; it is required")
else:
host, port = parse_broker_addr(addr)
+ count = BrokerRegistration.selectBy \
+ (host=host, port=port).count()
- if BrokerRegistration.selectBy(host=host, port=port).count():
+ if count:
errs = aerrs.setdefault(i, list())
errs.append("The broker at %s:%i " % (host, port) +
"is already registered")
16 years, 8 months
rhmessaging commits: r2006 - in mgmt/mint: sql and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-08 12:05:36 -0400 (Thu, 08 May 2008)
New Revision: 2006
Modified:
mgmt/mint/python/mint/__init__.py
mgmt/mint/sql/schema.sql
Log:
Unique constraint for host,port on BrokerRegistration
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-05-08 15:42:30 UTC (rev 2005)
+++ mgmt/mint/python/mint/__init__.py 2008-05-08 16:05:36 UTC (rev 2006)
@@ -47,6 +47,8 @@
cluster = ForeignKey("BrokerCluster", cascade="null", default=None)
profile = ForeignKey("BrokerProfile", cascade="null", default=None)
+ host_port_unique = index.DatabaseIndex(host, port, unique=True)
+
def connect(self, model):
log.info("Connecting to broker '%s' at %s:%i" % \
(self.name, self.host, self.port or 5672))
Modified: mgmt/mint/sql/schema.sql
===================================================================
--- mgmt/mint/sql/schema.sql 2008-05-08 15:42:30 UTC (rev 2005)
+++ mgmt/mint/sql/schema.sql 2008-05-08 16:05:36 UTC (rev 2006)
@@ -29,6 +29,7 @@
cluster_id INT,
profile_id INT
);
+CREATE UNIQUE INDEX broker_registration_host_port_unique ON broker_registration (host, port);
CREATE TABLE config_property (
id SERIAL PRIMARY KEY,
16 years, 8 months
rhmessaging commits: r2005 - in mgmt: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-08 11:42:30 -0400 (Thu, 08 May 2008)
New Revision: 2005
Modified:
mgmt/cumin/python/cumin/page.strings
mgmt/mint/python/mint/__init__.py
Log:
Formatting fix
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2008-05-08 15:40:21 UTC (rev 2004)
+++ mgmt/cumin/python/cumin/page.strings 2008-05-08 15:42:30 UTC (rev 2005)
@@ -266,6 +266,10 @@
vertical-align: -35%;
}
+form.mform td {
+ vertical-align: top;
+}
+
ul.radiotabs {
list-style: none;
margin: 0 0 1em 0;
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2008-05-08 15:40:21 UTC (rev 2004)
+++ mgmt/mint/python/mint/__init__.py 2008-05-08 15:42:30 UTC (rev 2005)
@@ -358,6 +358,11 @@
d["recTime"] = datetime.fromtimestamp(timestamps[0]/1000000000)
self.log(d)
obj = conn.getByOriginalId(schema.schemaNameToClassMap[objectName], d[self.convertIdKey("id")])
+
+ if not obj:
+ print "lion", classInfo, list
+ return
+
d[objectName] = obj
objNameStats = eval("schema.%sStats" % (schema.schemaNameToClassMap[objectName].__name__))
objStats = objNameStats.__new__(objNameStats)
16 years, 8 months
rhmessaging commits: r2004 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-08 11:40:21 -0400 (Thu, 08 May 2008)
New Revision: 2004
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Prevent the user from creating duplicate registrations. Use the
parse_broker_addr utility function.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-05-07 15:41:15 UTC (rev 2003)
+++ mgmt/cumin/python/cumin/broker.py 2008-05-08 15:40:21 UTC (rev 2004)
@@ -589,21 +589,15 @@
if addr:
name = names[i]
+ host, port = parse_broker_addr(addr)
- elems = addr.split(":")
-
- if len(elems) > 1:
- host, port = elems[0], int(elems[1])
- else:
- host, port = elems[0], 5672
-
args = {
"name": name,
"host": host,
"port": port
}
- reg = action.invoke(None, args);
+ reg = action.invoke(None, args)
if len(groups) > i:
group = groups[i]
@@ -633,7 +627,14 @@
if not addr:
errs = aerrs.setdefault(i, list())
errs.append("The address field is empty; it is required")
+ else:
+ host, port = parse_broker_addr(addr)
+ if BrokerRegistration.selectBy(host=host, port=port).count():
+ errs = aerrs.setdefault(i, list())
+ errs.append("The broker at %s:%i " % (host, port) +
+ "is already registered")
+
return not len(nerrs) and not len(aerrs)
def render_title(self, session):
16 years, 8 months
rhmessaging commits: r2003 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-07 11:41:15 -0400 (Wed, 07 May 2008)
New Revision: 2003
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Can't test this yet due to broker conditions, but this change makes
session protection non-broken at a minimum.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-05-06 19:39:27 UTC (rev 2002)
+++ mgmt/cumin/python/cumin/model.py 2008-05-07 15:41:15 UTC (rev 2003)
@@ -863,7 +863,8 @@
return "Close"
def do_invoke(self, client, args, completion):
- conn = self.cumin_model.data.getConnectionByObject(client)
+ reg = client.vhost.broker.registration
+ conn = self.cumin_model.data.getConnectionByRegistration(reg)
# Does it contain a mgmt session?
@@ -914,8 +915,16 @@
return "Close"
def do_invoke(self, object, args, completion):
- conn = self.cumin_model.data.getConnectionByObject(object)
+ reg = object.client.vhost.broker.registration
+ conn = self.cumin_model.data.getConnectionByRegistration(reg)
+ print "curr session, conn session", object.name, conn.getSessionId()
+
+ for c in self.cumin_model.data.connections:
+ print "conn", self.cumin_model.data.connections[c].getSessionId()
+
+ return
+
if object.name == conn.getSessionId():
raise Exception \
("Cannot close management session %s" % object.name)
@@ -927,7 +936,8 @@
return "Detach"
def do_invoke(self, object, args, completion):
- conn = self.cumin_model.data.getConnectionByObject(object)
+ reg = object.client.vhost.broker.registration
+ conn = self.cumin_model.data.getConnectionByRegistration(reg)
if object.name == conn.getSessionId():
raise Exception \
16 years, 8 months
rhmessaging commits: r2002 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-05-06 15:39:27 -0400 (Tue, 06 May 2008)
New Revision: 2002
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/lib/jrnl/jinf.hpp
store/trunk/cpp/lib/jrnl/lfh.cpp
store/trunk/cpp/lib/jrnl/lfh.hpp
store/trunk/cpp/lib/jrnl/nlfh.cpp
store/trunk/cpp/lib/jrnl/nlfh.hpp
store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
Log:
Removed references to JRNL_WMGR_PAGE_SIZE in preparation for turning it into a configurable parameter. Some tidy-up. Also fixed BZ426278: "Journal recovery fails if journal files are moved to new location"
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -498,7 +498,7 @@
oss << "errno=" << errno;
throw jexception(jerrno::JERR__RTCLOCK, oss.str(), "jcntl", "write_infofile");
}
- jinf ji(_jid, _jdir.dirname(), _base_filename, _num_jfiles, _jfsize_sblks, ts);
+ jinf ji(_jid, _jdir.dirname(), _base_filename, _num_jfiles, _jfsize_sblks, JRNL_WMGR_PAGE_SIZE, JRNL_WMGR_PAGES, ts);
ji.write();
}
@@ -590,6 +590,14 @@
this->log(LOG_WARN, oss.str());
_jfsize_sblks = ji.jfsize_sblks();
}
+ if (_jdir.dirname().compare(ji.jdir()))
+ {
+ std::ostringstream oss;
+ oss << "Journal file location change: original = \"" << ji.jdir() <<
+ "\"; current = \"" << _jdir.dirname() << "\"";
+ this->log(LOG_WARN, oss.str());
+ ji.set_jdir(_jdir.dirname());
+ }
try
{
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -51,10 +51,10 @@
_jfsize_sblks(0),
_sblk_size_dblks(0),
_dblk_size(0),
- _wmgr_page_size_dblks(0),
- _wmgr_num_pages(0),
- _rmgr_page_size_dblks(0),
- _rmgr_num_pages(0),
+ _wcache_pgsize_sblks(0),
+ _wcache_num_pages(0),
+ _rcache_pgsize_sblks(0),
+ _rcache_num_pages(0),
_tm_ptr(0),
_valid_flag(false),
_analyzed_flag(false),
@@ -69,7 +69,8 @@
}
jinf::jinf(const std::string& jid, const std::string& jdir, const std::string& base_filename,
- const u_int16_t num_jfiles, const u_int32_t jfsize_sblks, const timespec& ts):
+ const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const u_int32_t wcache_pgsize_sblks, const u_int32_t wcache_num_pages, const timespec& ts):
_jver(RHM_JDAT_VERSION),
_jid(jid),
_jdir(jdir),
@@ -79,10 +80,10 @@
_jfsize_sblks(jfsize_sblks),
_sblk_size_dblks(JRNL_SBLK_SIZE),
_dblk_size(JRNL_DBLK_SIZE),
- _wmgr_page_size_dblks(JRNL_WMGR_PAGE_SIZE),
- _wmgr_num_pages(JRNL_WMGR_PAGES),
- _rmgr_page_size_dblks(JRNL_RMGR_PAGE_SIZE),
- _rmgr_num_pages(JRNL_RMGR_PAGES),
+ _wcache_pgsize_sblks(wcache_pgsize_sblks),
+ _wcache_num_pages(wcache_num_pages),
+ _rcache_pgsize_sblks(JRNL_RMGR_PAGE_SIZE),
+ _rcache_num_pages(JRNL_RMGR_PAGES),
_tm_ptr(std::localtime(&ts.tv_sec)),
_valid_flag(false),
_analyzed_flag(false),
@@ -129,30 +130,6 @@
oss << "; required=" << JRNL_DBLK_SIZE << std::endl;
err = true;
}
- if (_wmgr_page_size_dblks != JRNL_WMGR_PAGE_SIZE)
- {
- oss << "JRNL_WMGR_PAGE_SIZE mismatch: " << _wmgr_page_size_dblks;
- oss << "; required=" << JRNL_WMGR_PAGE_SIZE << std::endl;
- err = true;
- }
- if (_wmgr_num_pages != JRNL_WMGR_PAGES)
- {
- oss << "JRNL_WMGR_PAGES mismatch: " << _wmgr_num_pages;
- oss << "; required=" << JRNL_WMGR_PAGES << std::endl;
- err = true;
- }
- if (_rmgr_page_size_dblks != JRNL_RMGR_PAGE_SIZE)
- {
- oss << "JRNL_RMGR_PAGE_SIZE mismatch: " << _rmgr_page_size_dblks;
- oss << "; required=" << JRNL_RMGR_PAGE_SIZE << std::endl;
- err = true;
- }
- if (_rmgr_num_pages != JRNL_RMGR_PAGES)
- {
- oss << "JRNL_RMGR_PAGES mismatch: " << _rmgr_num_pages;
- oss << "; required=" << JRNL_RMGR_PAGES << std::endl;
- err = true;
- }
if (err)
throw jexception(jerrno::JERR_JINF_CVALIDFAIL, oss.str(), "jinf", "validate");
_valid_flag = true;
@@ -268,12 +245,11 @@
oss << " Journal file size: " << _jfsize_sblks << " sblks" << std::endl;
oss << " Softblock size (JRNL_SBLK_SIZE): " << _sblk_size_dblks << " dblks" << std::endl;
oss << " Datablock size (JRNL_DBLK_SIZE): " << _dblk_size << " bytes" << std::endl;
- oss << " Write page size (JRNL_WMGR_PAGE_SIZE): " << _wmgr_page_size_dblks << " dblks" <<
+ oss << " Write page size: " << _wcache_pgsize_sblks << " sblks" << std::endl;
+ oss << " Number of write pages: " << _wcache_num_pages << std::endl;
+ oss << " Read page size (JRNL_RMGR_PAGE_SIZE): " << _rcache_pgsize_sblks << " sblks" <<
std::endl;
- oss << " Number of write pages (JRNL_WMGR_PAGES): " << _wmgr_num_pages << std::endl;
- oss << " Read page size (JRNL_RMGR_PAGE_SIZE): " << _rmgr_page_size_dblks << " dblks" <<
- std::endl;
- oss << " Number of read pages (JRNL_RMGR_PAGES): " << _rmgr_num_pages << std::endl;
+ oss << " Number of read pages (JRNL_RMGR_PAGES): " << _rcache_num_pages << std::endl;
return oss.str();
}
@@ -306,11 +282,13 @@
oss << " <jrnl_file_size_sblks value=\"" << _jfsize_sblks << "\" />" << std::endl;
oss << " <JRNL_SBLK_SIZE value=\"" << _sblk_size_dblks << "\" />" << std::endl;
oss << " <JRNL_DBLK_SIZE value=\"" << _dblk_size << "\" />" << std::endl;
- oss << " <JRNL_WMGR_PAGE_SIZE value=\"" << _wmgr_page_size_dblks << "\" />" << std::endl;
- oss << " <JRNL_WMGR_PAGES value=\"" << _wmgr_num_pages << "\" />" << std::endl;
- oss << " <JRNL_RMGR_PAGE_SIZE value=\"" << _rmgr_page_size_dblks << "\" />" << std::endl;
- oss << " <JRNL_RMGR_PAGES value=\"" << _rmgr_num_pages << "\" />" << std::endl;
oss << " </journal_file_geometry>" << std::endl;
+ oss << " <cache_geometry>" << std::endl;
+ oss << " <wcache_pgsize_sblks value=\"" << _wcache_pgsize_sblks << "\" />" << std::endl;
+ oss << " <wcache_num_pages value=\"" << _wcache_num_pages << "\" />" << std::endl;
+ oss << " <JRNL_RMGR_PAGE_SIZE value=\"" << _rcache_pgsize_sblks << "\" />" << std::endl;
+ oss << " <JRNL_RMGR_PAGES value=\"" << _rcache_num_pages << "\" />" << std::endl;
+ oss << " </cache_geometry>" << std::endl;
oss << "</jrnl>" << std::endl;
return oss.str();
}
@@ -318,7 +296,7 @@
void
jinf::read(const std::string& jinf_filename)
{
- // FIXME: This is *not* an XML reader, rather for simplicity, it is a brute-force
+ // TODO: This is *not* an XML reader, rather for simplicity, it is a brute-force
// line reader which relies on string recognition.
char buff[1024];
@@ -344,14 +322,14 @@
_sblk_size_dblks = u_int16_value(buff);
else if(std::strstr(buff, "JRNL_DBLK_SIZE"))
_dblk_size = u_int32_value(buff);
- else if(std::strstr(buff, "JRNL_WMGR_PAGE_SIZE"))
- _wmgr_page_size_dblks = u_int32_value(buff);
- else if(std::strstr(buff, "JRNL_WMGR_PAGES"))
- _wmgr_num_pages = u_int32_value(buff);
+ else if(std::strstr(buff, "wcache_pgsize_sblks"))
+ _wcache_pgsize_sblks = u_int32_value(buff);
+ else if(std::strstr(buff, "wcache_num_pages"))
+ _wcache_num_pages = u_int32_value(buff);
else if(std::strstr(buff, "JRNL_RMGR_PAGE_SIZE"))
- _rmgr_page_size_dblks = u_int32_value(buff);
+ _rcache_pgsize_sblks = u_int32_value(buff);
else if(std::strstr(buff, "JRNL_RMGR_PAGES"))
- _rmgr_num_pages = u_int32_value(buff);
+ _rcache_num_pages = u_int32_value(buff);
else if(std::strstr(buff, "nanoseconds"))
_ts.tv_nsec = u_int32_value(buff);
else if(std::strstr(buff, "seconds"))
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -56,10 +56,10 @@
u_int32_t _jfsize_sblks;
u_int16_t _sblk_size_dblks;
u_int32_t _dblk_size;
- u_int32_t _wmgr_page_size_dblks;
- u_int32_t _wmgr_num_pages;
- u_int32_t _rmgr_page_size_dblks;
- u_int32_t _rmgr_num_pages;
+ u_int32_t _wcache_pgsize_sblks;
+ u_int32_t _wcache_num_pages;
+ u_int32_t _rcache_pgsize_sblks;
+ u_int32_t _rcache_num_pages;
std::tm* _tm_ptr;
bool _valid_flag;
bool _analyzed_flag;
@@ -73,7 +73,9 @@
jinf(const std::string& jinf_filename, bool validate_flag);
// constructor for writing jinf file
jinf(const std::string& jid, const std::string& jdir, const std::string& base_filename,
- const u_int16_t num_jfiles, const u_int32_t jfsize_sblks, const timespec& ts);
+ const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const u_int32_t wcache_pgsize_sblks, const u_int32_t wcache_num_pages,
+ const timespec& ts);
virtual ~jinf();
void validate();
@@ -83,16 +85,17 @@
inline u_int8_t jver() const { return _jver; }
inline const std::string& jid() const { return _jid; }
inline const std::string& jdir() const { return _jdir; }
+ inline void set_jdir(const std::string& jdir) { _jdir = jdir; }
inline const std::string& base_filename() const { return _base_filename; }
inline const timespec& ts() const { return _ts; }
inline u_int16_t num_jfiles() const { return _num_jfiles; }
inline u_int32_t jfsize_sblks() const { return _jfsize_sblks; }
inline u_int16_t sblk_size_dblks() const { return _sblk_size_dblks; }
inline u_int32_t dblk_size() const { return _dblk_size; }
- inline u_int32_t wmgr_page_size_dblks() const { return _wmgr_page_size_dblks; }
- inline u_int32_t wmgr_num_pages() const { return _wmgr_num_pages; }
- inline u_int32_t rmgr_page_size_dblks() const { return _rmgr_page_size_dblks; }
- inline u_int32_t rmgr_num_pages() const { return _rmgr_num_pages; }
+ inline u_int32_t wcache_pgsize_sblks() const { return _wcache_pgsize_sblks; }
+ inline u_int32_t wcache_num_pages() const { return _wcache_num_pages; }
+ inline u_int32_t rcache_pgsize_sblks() const { return _rcache_pgsize_sblks; }
+ inline u_int32_t rcache_num_pages() const { return _rcache_num_pages; }
u_int16_t get_start_file();
u_int16_t get_end_file();
bool get_initial_owi();
Modified: store/trunk/cpp/lib/jrnl/lfh.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lfh.cpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/lib/jrnl/lfh.cpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -38,8 +38,8 @@
namespace journal
{
-lfh::lfh(const u_int32_t jfsize_sblks):
- nlfh(jfsize_sblks)
+lfh::lfh(const u_int32_t jfsize_sblks, const u_int16_t fid):
+ nlfh(jfsize_sblks, fid)
{}
lfh::lfh(const std::string& fbasename, const u_int16_t fid, const u_int32_t jfsize_sblks,
Modified: store/trunk/cpp/lib/jrnl/lfh.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lfh.hpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/lib/jrnl/lfh.hpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -55,7 +55,7 @@
class lfh : public nlfh
{
public:
- lfh(const u_int32_t jfsize_sblks);
+ lfh(const u_int32_t jfsize_sblks, const u_int16_t fid);
lfh(const std::string& fbasename, const u_int16_t fid, const u_int32_t jfsize_sblks,
rcvdat const * const ro);
virtual ~lfh();
Modified: store/trunk/cpp/lib/jrnl/nlfh.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/lib/jrnl/nlfh.cpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -45,9 +45,9 @@
namespace journal
{
-nlfh::nlfh(const u_int32_t jfsize_sblks):
+nlfh::nlfh(const u_int32_t jfsize_sblks, const u_int16_t fid):
_fname(),
- _fid(0),
+ _fid(fid),
_ffull_dblks(JRNL_SBLK_SIZE * (jfsize_sblks + 1)),
_rd_fh(-1),
_wr_fh(-1),
@@ -97,11 +97,7 @@
const u_int32_t jfsize_sblks, const rcvdat* const ro)
{
_fid = fid;
- std::ostringstream oss;
- oss << fbasename << ".";
- oss << std::setw(4) << std::setfill('0') << std::hex << fid;
- oss << "." << JRNL_DATA_EXTENSION;
- _fname = oss.str();
+ _fname = filename(fbasename, fid);
#ifdef RHM_JOWRITE
// In test mode, only create file if it does not exist
@@ -130,60 +126,7 @@
}
}
else // Normal initialization: create empty journal files
- {
- const std::size_t sblksize = JRNL_DBLK_SIZE * JRNL_SBLK_SIZE;
- const std::size_t writesize = sblksize * JRNL_WMGR_PAGE_SIZE;
-
- // NOTE: The journal file size is always one sblock bigger than the specified journal
- // file size, which is the data content size. The extra block is for the journal file
- // header which precedes all data on each file and is exactly one sblock in size.
- u_int32_t nsblks = jfsize_sblks + 1;
-
- void* nullbuf = 0;
- if (::posix_memalign(&nullbuf, sblksize, writesize))
- {
- std::ostringstream oss;
- oss << ": posix_memalign() failed: size=" << writesize << " blk_size=" << sblksize;
- oss << " errno=" << errno;
- throw jexception(jerrno::JERR__MALLOC, oss.str(), "nlfh", "initialize");
- }
- std::memset(nullbuf, 0, writesize);
-
- int fh = ::open(_fname.c_str(), O_WRONLY | O_CREAT | O_DIRECT,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); // 0644 -rw-r--r--
- if (fh < 0)
- {
- std::ostringstream oss;
- oss << ": open() failed:" << "\" errno=" << errno;
- std::free(nullbuf);
- throw jexception(jerrno::JERR_NLFH_OPENWR, oss.str(), "nlfh", "initialize");
- }
-
- while (nsblks > 0)
- {
- u_int32_t this_write_sblks = nsblks >= JRNL_WMGR_PAGE_SIZE ?
- JRNL_WMGR_PAGE_SIZE : nsblks;
- if (::write(fh, (void*)nullbuf, this_write_sblks * sblksize) == -1)
- {
- std::ostringstream oss;
- oss << ": wr_size=" << (this_write_sblks * sblksize) << " errno=" << errno;
- ::close(fh);
- std::free(nullbuf);
- throw jexception(jerrno::JERR_NLFH_WRITE, oss.str(), "nlfh",
- "initialize");
- }
- nsblks -= this_write_sblks;
- }
-
- // Clean up
- std::free(nullbuf);
- if (::close(fh))
- {
- std::ostringstream oss;
- oss << ": errno=" << errno;
- throw jexception(jerrno::JERR_NLFH_CLOSE, oss.str(), "nlfh", "initialize");
- }
- }
+ create_jfile(jfsize_sblks);
#ifdef RHM_JOWRITE
}
#endif
@@ -354,7 +297,7 @@
{
std::ostringstream oss;
oss << "file=\"" << _fname << "\" errno=" << errno;
- throw jexception(jerrno::JERR_NLFH_OPENRD, oss.str(), "nlfh", "open");
+ throw jexception(jerrno::JERR_NLFH_OPENRD, oss.str(), "nlfh", "open_fh");
}
_wr_fh = ::open(_fname.c_str(), O_WRONLY | O_DIRECT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); // 0644 -rw-r--r--
@@ -362,7 +305,7 @@
{
std::ostringstream oss;
oss << "file=\"" << _fname << "\" errno=" << errno;
- throw jexception(jerrno::JERR_NLFH_OPENWR, oss.str(), "nlfh", "open");
+ throw jexception(jerrno::JERR_NLFH_OPENWR, oss.str(), "nlfh", "open_fh");
}
}
@@ -381,5 +324,100 @@
}
}
+std::string
+nlfh::filename(const std::string& fbasename, const u_int16_t fid)
+{
+ std::ostringstream oss;
+ oss << fbasename << ".";
+ oss << std::setw(4) << std::setfill('0') << std::hex << fid;
+ oss << "." << JRNL_DATA_EXTENSION;
+ return oss.str();
+}
+
+void
+nlfh::clean_file(const u_int32_t jfsize_sblks)
+{
+ // NOTE: The journal file size is always one sblock bigger than the specified journal
+ // file size, which is the data content size. The extra block is for the journal file
+ // header which precedes all data on each file and is exactly one sblock in size.
+ u_int32_t nsblks = jfsize_sblks + 1;
+
+ // TODO - look at more efficient alternatives to allocating a null block:
+ // 1. mmap() against /dev/zero, but can alignment for O_DIRECT be assured?
+ // 2. ftruncate(), but does this result in a sparse file? If so, then this is no good.
+
+ // Create temp null block for writing
+ const std::size_t sblksize = JRNL_DBLK_SIZE * JRNL_SBLK_SIZE;
+ void* nullbuf = 0;
+ // Allocate no more than 2MB (4096 sblks) as a null buffer
+ const u_int32_t nullbuffsize_sblks = nsblks > 4096 ? 4096 : nsblks;
+ const std::size_t nullbuffsize = nullbuffsize_sblks * sblksize;
+ if (::posix_memalign(&nullbuf, sblksize, nullbuffsize))
+ {
+ std::ostringstream oss;
+ oss << ": posix_memalign() failed: size=" << nullbuffsize << " blk_size=" << sblksize;
+ oss << " errno=" << errno;
+ throw jexception(jerrno::JERR__MALLOC, oss.str(), "nlfh", "clean_file");
+ }
+ std::memset(nullbuf, 0, nullbuffsize);
+
+ int fh = ::open(_fname.c_str(), O_WRONLY | O_CREAT | O_DIRECT,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); // 0644 -rw-r--r--
+ if (fh < 0)
+ {
+ std::free(nullbuf);
+ std::ostringstream oss;
+ oss << ": open() failed:" << "\" errno=" << errno;
+ throw jexception(jerrno::JERR_NLFH_OPENWR, oss.str(), "nlfh", "clean_file");
+ }
+
+ while (nsblks > 0)
+ {
+ u_int32_t this_write_sblks = nsblks >= nullbuffsize_sblks ? nullbuffsize_sblks : nsblks;
+ if (::write(fh, nullbuf, this_write_sblks * sblksize) == -1)
+ {
+ ::close(fh);
+ std::free(nullbuf);
+ std::ostringstream oss;
+ oss << ": wr_size=" << (this_write_sblks * sblksize) << " errno=" << errno;
+ throw jexception(jerrno::JERR_NLFH_WRITE, oss.str(), "nlfh", "clean_file");
+ }
+ nsblks -= this_write_sblks;
+ }
+
+ // Clean up
+ std::free(nullbuf);
+ if (::close(fh))
+ {
+ std::ostringstream oss;
+ oss << ": errno=" << errno;
+ throw jexception(jerrno::JERR_NLFH_CLOSE, oss.str(), "nlfh", "clean_file");
+ }
+}
+
+void
+nlfh::create_jfile(const u_int32_t jfsize_sblks)
+{
+ clean_file(jfsize_sblks);
+}
+
+void
+nlfh::get_jfile()
+{
+ // Step 1: stat _pool_dir, locate first available file, check file size matches
+ // Step 2: move file to current directory
+}
+
+void return_jfile()
+{
+ // Step 1: Clean file (if req'd)
+ // Step 2: Move file to _pool_dir
+}
+
+
+// Static declarations
+
+std::string nlfh::_pool_dir;
+
} // namespace journal
} // namespace rhm
Modified: store/trunk/cpp/lib/jrnl/nlfh.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/lib/jrnl/nlfh.hpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -57,6 +57,7 @@
class nlfh
{
protected:
+ static std::string _pool_dir; ///< Directory containing unused file pool
std::string _fname; ///< File name
u_int16_t _fid; ///< File ID (ordinal number in ring buffer)
const u_int32_t _ffull_dblks; ///< File size in dblks (incl. file header)
@@ -70,12 +71,15 @@
u_int16_t _aio_cnt; ///< Outstanding AIO operations on this file
public:
- nlfh(const u_int32_t jfsize_sblks);
+ nlfh(const u_int32_t jfsize_sblks, const u_int16_t fid);
// Constructors with implicit initialize() and open()
nlfh(const std::string& fbasename, const u_int16_t fid, const u_int32_t jfsize_sblks,
const rcvdat* const ro);
virtual ~nlfh();
+ inline static std::string& pool_dir() { return _pool_dir; }
+ inline static void set_pool_dir(const std::string pool_dir) { _pool_dir = pool_dir; }
+
virtual void initialize(const std::string& fbasename, const u_int16_t fid,
const u_int32_t jfsize_sblks, const rcvdat* const ro);
virtual bool reset(const rcvdat* const ro = 0);
@@ -141,6 +145,13 @@
protected:
virtual void open_fh();
virtual void close_fh();
+ static std::string filename(const std::string& fbasename, const u_int16_t fid);
+ void clean_file(const u_int32_t jfsize_sblks);
+ void create_jfile(const u_int32_t jfsize_sblks);
+
+ // These functions for future use of file pool
+ void get_jfile();
+ void return_jfile();
};
} // namespace journal
Modified: store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jdir.cpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/tests/jrnl/_ut_jdir.cpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -86,7 +86,8 @@
{
timespec ts;
::clock_gettime(CLOCK_REALTIME, &ts);
- jinf ji("test journal id", dirname, base_filename, NUM_JFILES, JFSIZE_SBLKS, ts);
+ jinf ji("test journal id", dirname, base_filename, NUM_JFILES, JFSIZE_SBLKS,
+ JRNL_WMGR_PAGE_SIZE, JRNL_WMGR_PAGES, ts);
ji.write();
}
Modified: store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2008-05-06 18:14:25 UTC (rev 2001)
+++ store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2008-05-06 19:39:27 UTC (rev 2002)
@@ -145,7 +145,8 @@
{
cout << test_filename << ".write_constructor: " << flush;
::clock_gettime(CLOCK_REALTIME, &ts);
- jinf ji(jid, jdir, base_filename, NUM_JFILES, JFSIZE_SBLKS, ts);
+ jinf ji(jid, jdir, base_filename, NUM_JFILES, JFSIZE_SBLKS, JRNL_WMGR_PAGE_SIZE,
+ JRNL_WMGR_PAGES, ts);
BOOST_CHECK_EQUAL(ji.jver(), RHM_JDAT_VERSION);
BOOST_CHECK(ji.jid().compare(jid) == 0);
BOOST_CHECK(ji.jdir().compare(jdir) == 0);
@@ -157,10 +158,6 @@
BOOST_CHECK_EQUAL(ji.jfsize_sblks(), (u_int32_t)JFSIZE_SBLKS);
BOOST_CHECK_EQUAL(ji.sblk_size_dblks(), (u_int16_t)JRNL_SBLK_SIZE);
BOOST_CHECK_EQUAL(ji.dblk_size(), (u_int32_t)JRNL_DBLK_SIZE);
- BOOST_CHECK_EQUAL(ji.wmgr_page_size_dblks(), (u_int32_t)JRNL_WMGR_PAGE_SIZE);
- BOOST_CHECK_EQUAL(ji.wmgr_num_pages(), (u_int32_t)JRNL_WMGR_PAGES);
- BOOST_CHECK_EQUAL(ji.rmgr_page_size_dblks(), (u_int32_t)JRNL_RMGR_PAGE_SIZE);
- BOOST_CHECK_EQUAL(ji.rmgr_num_pages(), (u_int32_t)JRNL_RMGR_PAGES);
ji.write();
cout << "ok" << endl;
}
@@ -182,10 +179,6 @@
BOOST_CHECK_EQUAL(ji.jfsize_sblks(), (u_int32_t)JFSIZE_SBLKS);
BOOST_CHECK_EQUAL(ji.sblk_size_dblks(), (u_int16_t)JRNL_SBLK_SIZE);
BOOST_CHECK_EQUAL(ji.dblk_size(), (u_int32_t)JRNL_DBLK_SIZE);
- BOOST_CHECK_EQUAL(ji.wmgr_page_size_dblks(), (u_int32_t)JRNL_WMGR_PAGE_SIZE);
- BOOST_CHECK_EQUAL(ji.wmgr_num_pages(), (u_int32_t)JRNL_WMGR_PAGES);
- BOOST_CHECK_EQUAL(ji.rmgr_page_size_dblks(), (u_int32_t)JRNL_RMGR_PAGE_SIZE);
- BOOST_CHECK_EQUAL(ji.rmgr_num_pages(), (u_int32_t)JRNL_RMGR_PAGES);
cout << "ok" << endl;
}
16 years, 8 months
rhmessaging commits: r2001 - mgmt/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-06 14:14:25 -0400 (Tue, 06 May 2008)
New Revision: 2001
Modified:
mgmt/cumin/Makefile
Log:
Change executable permissions
Modified: mgmt/cumin/Makefile
===================================================================
--- mgmt/cumin/Makefile 2008-05-06 18:08:26 UTC (rev 2000)
+++ mgmt/cumin/Makefile 2008-05-06 18:14:25 UTC (rev 2001)
@@ -19,8 +19,7 @@
install -d ${lib}
install -pm 0644 python/cumin/*.py python/cumin/*.pyc python/cumin/*.strings ${lib}
install -d ${BIN_DIR}
- install -pm 0755 bin/cumin bin/cumin-test bin/cumin-bench ${BIN_DIR}
- install -pm 0700 bin/cumin-admin bin/cumin-database-* bin/cumin-instance-init ${BIN_DIR}
+ install -pm 0755 bin/* ${BIN_DIR}
install -d ${doc}
install -pm 0644 LICENSE COPYING ${doc}
install -d ${share}/resources
16 years, 8 months
rhmessaging commits: r2000 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-06 14:08:26 -0400 (Tue, 06 May 2008)
New Revision: 2000
Modified:
mgmt/cumin/python/cumin/__init__.py
Log:
Change the default system cumin home
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2008-05-06 17:58:12 UTC (rev 1999)
+++ mgmt/cumin/python/cumin/__init__.py 2008-05-06 18:08:26 UTC (rev 2000)
@@ -133,7 +133,7 @@
def __init__(self):
super(CuminConfig, self).__init__()
- hdef = os.path.normpath("/usr/share/cumin")
+ hdef = os.path.normpath("/var/lib/cumin")
self.home = os.environ.get("CUMIN_HOME", hdef)
if not os.path.isdir(self.home):
16 years, 8 months
rhmessaging commits: r1999 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-05-06 13:58:12 -0400 (Tue, 06 May 2008)
New Revision: 1999
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Turn off debug printing
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-05-06 17:44:31 UTC (rev 1998)
+++ mgmt/cumin/python/cumin/model.py 2008-05-06 17:58:12 UTC (rev 1999)
@@ -13,7 +13,7 @@
class CuminModel(object):
def __init__(self, app, data_uri, spec_path):
self.app = app
- self.data = MintModel(data_uri, spec_path, debug=True)
+ self.data = MintModel(data_uri, spec_path, debug=False)
self.classes = list()
self.invocations = set()
16 years, 8 months