Author: kpvdr
Date: 2009-02-23 15:03:59 -0500 (Mon, 23 Feb 2009)
New Revision: 3128
Modified:
store/trunk/cpp/lib/jrnl/enq_rec.cpp
Log:
Fix for BZ 486952 "qpidd+store loadContent() failed: jexception 0x0a00
data_tok::set_rstate( ) threw JERR_MTOK_ILLEGALSTATE: Attempted to change to illegal
state.".
Modified: store/trunk/cpp/lib/jrnl/enq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.cpp 2009-02-23 19:13:41 UTC (rev 3127)
+++ store/trunk/cpp/lib/jrnl/enq_rec.cpp 2009-02-23 20:03:59 UTC (rev 3128)
@@ -8,7 +8,7 @@
*
* \author Kim van der Riet
*
- * Copyright (c) 2007, 2008 Red Hat, Inc.
+ * Copyright (c) 2007, 2008, 2009 Red Hat, Inc.
*
* This file is part of the Qpid async store library msgstore.so.
*
@@ -261,10 +261,11 @@
std::size_t rd_cnt = 0;
if (rec_offs_dblks) // Continuation of record on new page
{
- const u_int32_t hdr_data_dblks = size_dblks(enq_hdr::size() + _enq_hdr._xidsize
+
- _enq_hdr._dsize);
- const u_int32_t hdr_tail_dblks = size_dblks(enq_hdr::size() + _enq_hdr._xidsize
+
- _enq_hdr._dsize + rec_tail::size());
+ const u_int32_t hdr_xid_data_size = enq_hdr::size() + _enq_hdr._xidsize +
+ (_enq_hdr.is_external() ? 0 : _enq_hdr._dsize);
+ const u_int32_t hdr_xid_data_tail_size = hdr_xid_data_size + rec_tail::size();
+ const u_int32_t hdr_data_dblks = size_dblks(hdr_xid_data_size);
+ const u_int32_t hdr_tail_dblks = size_dblks(hdr_xid_data_tail_size);
const std::size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
const std::size_t offs = rec_offs - enq_hdr::size();
@@ -281,7 +282,7 @@
chk_tail();
rd_cnt += sizeof(_enq_tail);
}
- else if (offs < _enq_hdr._xidsize + _enq_hdr._dsize)
+ else if (offs < _enq_hdr._xidsize + _enq_hdr._dsize &&
!_enq_hdr.is_external())
{
// some data still outstanding, copy remainder of data and tail
const std::size_t data_offs = offs - _enq_hdr._xidsize;
@@ -313,7 +314,7 @@
std::memcpy((char*)_buff + offs, rptr, rem);
rd_cnt += rem;
}
- else if (offs < _enq_hdr._xidsize + _enq_hdr._dsize)
+ else if (offs < _enq_hdr._xidsize + _enq_hdr._dsize &&
!_enq_hdr.is_external())
{
// some data still outstanding, copy remainder of data
const std::size_t data_offs = offs - _enq_hdr._xidsize;
@@ -360,11 +361,12 @@
_buff = std::malloc(_enq_hdr._xidsize + (_enq_hdr.is_external() ? 0 :
_enq_hdr._dsize));
MALLOC_CHK(_buff, "_buff", "enq_rec",
"decode");
- const u_int32_t hdr_xid_dblks = size_dblks(enq_hdr::size() +
_enq_hdr._xidsize);
- const u_int32_t hdr_data_dblks = size_dblks(enq_hdr::size() +
_enq_hdr._xidsize +
- _enq_hdr._dsize);
- const u_int32_t hdr_tail_dblks = size_dblks(enq_hdr::size() +
_enq_hdr._xidsize +
- _enq_hdr._dsize + rec_tail::size());
+ const u_int32_t hdr_xid_size = enq_hdr::size() + _enq_hdr._xidsize;
+ const u_int32_t hdr_xid_data_size = hdr_xid_size + (_enq_hdr.is_external() ?
0 : _enq_hdr._dsize);
+ const u_int32_t hdr_xid_data_tail_size = hdr_xid_data_size +
rec_tail::size();
+ const u_int32_t hdr_xid_dblks = size_dblks(hdr_xid_size);
+ const u_int32_t hdr_data_dblks = size_dblks(hdr_xid_data_size);
+ const u_int32_t hdr_tail_dblks = size_dblks(hdr_xid_data_tail_size);
// Check if record (header + data + tail) fits within this page, we can check
the
// tail before the expense of copying data to memory
if (hdr_tail_dblks <= max_size_dblks)
Show replies by date