[rhmessaging-commits] rhmessaging commits: r3687 - in store/trunk/cpp/lib: jrnl and 1 other directory.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Mon Nov 2 10:39:33 EST 2009
Author: kpvdr
Date: 2009-11-02 10:39:32 -0500 (Mon, 02 Nov 2009)
New Revision: 3687
Modified:
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/jrnl/rec_tail.hpp
Log:
Fix for BZ 515461 - "Segfault when sending large durable message and staging threshold is set to particular values". No test written yet. Also included a small comment fix for Doxygen docs on an unrelated class.
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-10-30 17:59:46 UTC (rev 3686)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2009-11-02 15:39:32 UTC (rev 3687)
@@ -1461,11 +1461,16 @@
{
u_int32_t headerSize = message->encodedHeaderSize();
u_int64_t size = message->encodedSize() + sizeof(u_int32_t);
- char* buff = 0;
+ std::vector<char> buff;
if (!message->isContentReleased() )
{
- buff = static_cast<char*>(::alloca(size)); // long + headers + content
- Buffer buffer(buff,size);
+ try { buff = std::vector<char>(size); } // long + headers + content
+ catch (const std::exception& e) {
+ std::ostringstream oss;
+ oss << "Unable to allocate memory for encoding message; requested size: " << size << "; error: " << e.what();
+ THROW_STORE_EXCEPTION(oss.str());
+ }
+ Buffer buffer(buff.data(),size);
buffer.putLong(headerSize);
message->encode(buffer);
}
@@ -1483,19 +1488,19 @@
if (message->isContentReleased()) {
jc->enqueue_extern_data_record(size, dtokp.get(), !message->isPersistent());
} else {
- jc->enqueue_data_record(buff, size, size, dtokp.get(), !message->isPersistent());
+ jc->enqueue_data_record(buff.data(), size, size, dtokp.get(), !message->isPersistent());
}
} else {
if (message->isContentReleased()) {
jc->enqueue_extern_txn_data_record(size, dtokp.get(), txn->getXid(), !message->isPersistent());
} else {
- jc->enqueue_txn_data_record(buff, size, size, dtokp.get(), txn->getXid(), !message->isPersistent());
+ jc->enqueue_txn_data_record(buff.data(), size, size, dtokp.get(), txn->getXid(), !message->isPersistent());
}
}
} else {
/// cct message db
if (newId) { // only store in Bd if first time message is stored
- Dbt data(buff,size);
+ Dbt data(buff.data(),size);
messageDb->put(txn->get(), &messageId, &data, DB_NOOVERWRITE);
}
}
Modified: store/trunk/cpp/lib/jrnl/rec_tail.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rec_tail.hpp 2009-10-30 17:59:46 UTC (rev 3686)
+++ store/trunk/cpp/lib/jrnl/rec_tail.hpp 2009-11-02 15:39:32 UTC (rev 3687)
@@ -48,10 +48,10 @@
* \brief Struct for data common to the tail of all records. The magic number
* used here is the binary inverse (1's complement) of the magic used in the
* record header; this minimizes possible confusion with other headers that may
- * be present during recovery.
+ * be present during recovery. The tail is used with all records that have either
+ * XIDs or data - ie any size-variable content. Currently the only records that
+ * do NOT use the tail are non-transactional dequeues and filler records.
*
- * This header precedes all records in journal files.
- *
* Record header info in binary format (12 bytes):
* <pre>
* 0 7
More information about the rhmessaging-commits
mailing list