Author: kpvdr
Date: 2007-10-02 16:45:10 -0400 (Tue, 02 Oct 2007)
New Revision: 960
Added:
store/trunk/cpp/lib/jrnl/txn_rec.cpp
store/trunk/cpp/lib/jrnl/txn_rec.hpp
Removed:
store/trunk/cpp/lib/jrnl/dtx_rec.cpp
store/trunk/cpp/lib/jrnl/dtx_rec.hpp
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/Makefile.am
store/trunk/cpp/lib/TxnCtxt.h
store/trunk/cpp/lib/jrnl/deq_rec.cpp
store/trunk/cpp/lib/jrnl/enq_rec.cpp
store/trunk/cpp/lib/jrnl/enq_rec.hpp
store/trunk/cpp/lib/jrnl/file_hdr.cpp
store/trunk/cpp/lib/jrnl/file_hdr.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/pmgr.cpp
store/trunk/cpp/lib/jrnl/pmgr.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/lib/jrnl/rmgr.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
store/trunk/cpp/tests/jrnl/Makefile.rtest
store/trunk/cpp/tests/jrnl/janalyze.py
store/trunk/cpp/tests/jrnl/jtest.cpp
store/trunk/cpp/tests/jrnl/jtest.hpp
store/trunk/cpp/tests/jrnl/msg_consumer.cpp
store/trunk/cpp/tests/jrnl/msg_consumer.hpp
store/trunk/cpp/tests/jrnl/msg_producer.cpp
store/trunk/cpp/tests/jrnl/msg_producer.hpp
store/trunk/cpp/tests/jrnl/rtest
store/trunk/cpp/tests/jrnl/rtests.csv
store/trunk/cpp/tests/jrnl/rwtests.csv
store/trunk/cpp/tests/jrnl/tests.ods
store/trunk/cpp/tests/jrnl/wtests.csv
Log:
Wired dtx encoding for enqueue records, other fixes and cleanups
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -910,7 +910,7 @@
{
rhm::journal::iores dres;
try {
- dres = jc->dequeue_tx_data_record(ddtokp, tid);
+ dres = jc->dequeue_txn_data_record(ddtokp, tid);
} catch (rhm::journal::jexception& e) {
std::string str;
delete ddtokp;
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/Makefile.am 2007-10-02 20:45:10 UTC (rev 960)
@@ -35,7 +35,6 @@
TxnCtxt.h \
jrnl/data_tok.cpp \
jrnl/deq_rec.cpp \
- jrnl/dtx_rec.cpp \
jrnl/enq_map.cpp \
jrnl/enq_rec.cpp \
jrnl/file_hdr.cpp \
@@ -50,12 +49,12 @@
jrnl/pmgr.cpp \
jrnl/rmgr.cpp \
jrnl/rrfc.cpp \
+ jrnl/txn_rec.cpp \
jrnl/wmgr.cpp \
jrnl/wrfc.cpp \
jrnl/aio_cb.hpp \
jrnl/data_tok.hpp \
jrnl/deq_rec.hpp \
- jrnl/dtx_rec.hpp \
jrnl/enq_map.hpp \
jrnl/enq_rec.hpp \
jrnl/file_hdr.hpp \
@@ -72,6 +71,7 @@
jrnl/rcvdat.hpp \
jrnl/rmgr.hpp \
jrnl/rrfc.hpp \
+ jrnl/txn_rec.hpp \
jrnl/wmgr.hpp \
jrnl/wrfc.hpp
Modified: store/trunk/cpp/lib/TxnCtxt.h
===================================================================
--- store/trunk/cpp/lib/TxnCtxt.h 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/TxnCtxt.h 2007-10-02 20:45:10 UTC (rev 960)
@@ -63,9 +63,9 @@
journal::jcntl* jc =
static_cast<journal::jcntl*>((*i)->getExternalQueueStore());
if (jc) /* if using journal */
if (commit)
- jc->commit_dtx(getXid());
+ jc->txn_commit(getXid());
else
- jc->abort_dtx(getXid());
+ jc->txn_abort(getXid());
}
deleteXidRecord();
sync();
@@ -93,7 +93,7 @@
for (TxnCtxt::ipqdef::iterator i = impactedQueues.begin(); i != impactedQueues.end();
i++) {
qcnt ++;
journal::jcntl* jc =
static_cast<journal::jcntl*>((*i)->getExternalQueueStore());
- if (jc && !(jc->is_dtx_synced(getXid())))
+ if (jc && !(jc->is_txn_synced(getXid())))
{
if (firstloop)
jc->flush();
Modified: store/trunk/cpp/lib/jrnl/deq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/deq_rec.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/deq_rec.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -43,19 +43,19 @@
{
deq_rec::deq_rec():
- _deq_hdr(RHM_JDAT_DEQ_MAGIC, 0, 0, 0, RHM_JDAT_VERSION),
+ _deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, 0, 0, 0, 0),
_xid(),
_deq_tail()
{}
deq_rec::deq_rec(const u_int64_t rid, const u_int64_t drid):
- _deq_hdr(RHM_JDAT_DEQ_MAGIC, rid, drid, 0, RHM_JDAT_VERSION),
+ _deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, 0, rid, drid, 0),
_xid(),
_deq_tail(_deq_hdr._hdr)
{}
deq_rec::deq_rec(const u_int64_t rid, const u_int64_t drid, const std::string& xid):
- _deq_hdr(RHM_JDAT_DEQ_MAGIC, rid, drid, xid.size(), RHM_JDAT_VERSION),
+ _deq_hdr(RHM_JDAT_DEQ_MAGIC, RHM_JDAT_VERSION, 0, rid, drid, xid.size()),
_xid(xid),
_deq_tail(_deq_hdr._hdr)
{}
Deleted: store/trunk/cpp/lib/jrnl/dtx_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/dtx_rec.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/dtx_rec.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -1,361 +0,0 @@
-/**
-* \file dtx_rec.cpp
-*
-* Red Hat Messaging - Message Journal
-*
-* This file contains the code for the rhm::journal::dtx_rec (journal dequeue
-* record) class. See comments in file dtx_rec.hpp for details.
-*
-* \author Kim van der Riet
-*
-* Copyright 2007 Red Hat, Inc.
-*
-* This file is part of Red Hat Messaging.
-*
-* Red Hat Messaging is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
-* USA
-*
-* The GNU Lesser General Public License is available in the file COPYING.
-*/
-
-#include <jrnl/dtx_rec.hpp>
-
-#include <assert.h>
-#include <iomanip>
-#include <sstream>
-#include <jrnl/jerrno.hpp>
-
-namespace rhm
-{
-namespace journal
-{
-
-dtx_rec::dtx_rec():
- _dtx_hdr(),
- _xid(),
- _dtx_tail()
-{}
-
-dtx_rec::dtx_rec(const u_int32_t magic, const u_int64_t rid):
- _dtx_hdr(magic, rid, 0, RHM_JDAT_VERSION),
- _xid(),
- _dtx_tail(_dtx_hdr._hdr)
-{}
-
-dtx_rec::dtx_rec(const u_int32_t magic, const u_int64_t rid, const std::string&
xid):
- _dtx_hdr(magic, rid, xid.size(), RHM_JDAT_VERSION),
- _xid(xid),
- _dtx_tail(_dtx_hdr._hdr)
-{}
-
-dtx_rec::~dtx_rec()
-{}
-
-void
-dtx_rec::reset(const u_int64_t rid)
-{
- _dtx_hdr._hdr._rid = rid;
- _dtx_hdr._xidsize = 0;
- _dtx_tail._rid = rid;
-}
-
-void
-dtx_rec::reset(const u_int64_t rid, const std::string& xid)
-{
- _dtx_hdr._hdr._rid = rid;
- _dtx_hdr._xidsize = xid.size();
- _dtx_tail._rid = rid;
-}
-
-u_int32_t
-dtx_rec::encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks) throw
(jexception)
-{
- assert(wptr != NULL);
- assert(max_size_dblks > 0);
- assert(_xid.size() == _dtx_hdr._xidsize);
- assert(_dtx_hdr._xidsize > 0);
-
- size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
- size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
- size_t wr_cnt = 0;
- if (rec_offs_dblks) // Continuation of split dequeue record (over 2 or more pages)
- {
- if (size_dblks(rec_size()) - rec_offs_dblks > max_size_dblks) // Further split
required
- {
- rec_offs -= sizeof(_dtx_hdr);
- size_t wsize = _dtx_hdr._xidsize > rec_offs ? _dtx_hdr._xidsize - rec_offs
: 0;
- size_t wsize2 = wsize;
- if (wsize)
- {
- if (wsize > rem)
- wsize = rem;
- ::memcpy(wptr, (const char*)_xid.c_str() + rec_offs, wsize);
- wr_cnt += wsize;
- rem -= wsize;
- }
- rec_offs -= _dtx_hdr._xidsize - wsize2;
- if (rem)
- {
- wsize = sizeof(_dtx_tail) > rec_offs ? sizeof(_dtx_tail) - rec_offs :
0;
- wsize2 = wsize;
- if (wsize)
- {
- if (wsize > rem)
- wsize = rem;
- ::memcpy((char*)wptr + wr_cnt, (char*)&_dtx_tail + rec_offs,
wsize);
- wr_cnt += wsize;
- rem -= wsize;
- }
- rec_offs -= sizeof(_dtx_tail) - wsize2;
- }
- assert(rem == 0);
- assert(rec_offs == 0);
- }
- else // No further split required
- {
- rec_offs -= sizeof(_dtx_hdr);
- size_t wsize = _dtx_hdr._xidsize > rec_offs ? _dtx_hdr._xidsize - rec_offs
: 0;
- if (wsize)
- {
- ::memcpy(wptr, _xid.c_str() + rec_offs, wsize);
- wr_cnt += wsize;
- }
- rec_offs -= _dtx_hdr._xidsize - wsize;
- wsize = sizeof(_dtx_tail) > rec_offs ? sizeof(_dtx_tail) - rec_offs : 0;
- if (wsize)
- {
- ::memcpy((char*)wptr + wr_cnt, (char*)&_dtx_tail + rec_offs, wsize);
- wr_cnt += wsize;
-#ifdef RHM_CLEAN
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR,
- (size_dblks(rec_size()) * JRNL_DBLK_SIZE) -
- (rec_offs_dblks * JRNL_DBLK_SIZE) - wr_cnt);
-#endif
- }
- rec_offs -= sizeof(_dtx_tail) - wsize;
- assert(rec_offs == 0);
- }
- }
- else // Start at beginning of data record
- {
- // Assumption: the header will always fit into the first dblk
- ::memcpy(wptr, (void*)&_dtx_hdr, sizeof(_dtx_hdr));
- wr_cnt = sizeof(_dtx_hdr);
- if (size_dblks(rec_size()) > max_size_dblks) // Split required
- {
- size_t wsize;
- rem -= sizeof(_dtx_hdr);
- if (rem)
- {
- wsize = rem >= _dtx_hdr._xidsize ? _dtx_hdr._xidsize : rem;
- ::memcpy((char*)wptr + wr_cnt, _xid.c_str(), wsize);
- wr_cnt += wsize;
- rem -= wsize;
- }
- if (rem)
- {
- wsize = rem >= sizeof(_dtx_tail) ? sizeof(_dtx_tail) : rem;
- ::memcpy((char*)wptr + wr_cnt, (void*)&_dtx_tail, wsize);
- wr_cnt += wsize;
- rem -= wsize;
- }
- assert(rem == 0);
- }
- else // No split required
- {
- if (_dtx_hdr._xidsize)
- {
- ::memcpy((char*)wptr + wr_cnt, _xid.c_str(), _dtx_hdr._xidsize);
- wr_cnt += _dtx_hdr._xidsize;
- ::memcpy((char*)wptr + wr_cnt, (void*)&_dtx_tail,
sizeof(_dtx_tail));
- wr_cnt += sizeof(_dtx_tail);
- }
-#ifdef RHM_CLEAN
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR,
- (size_dblks(rec_size()) * JRNL_DBLK_SIZE) - wr_cnt);
-#endif
- }
- }
- return size_dblks(wr_cnt);
-}
-
-u_int32_t
-dtx_rec::decode(hdr& h, void* rptr, u_int32_t rec_offs_dblks, u_int32_t
max_size_dblks)
- throw (jexception)
-{
- assert(rptr != NULL);
- assert(max_size_dblks > 0);
-
- size_t rd_cnt = 0;
- if (rec_offs_dblks) // Continuation of record on new page
- {
- const u_int32_t hdr_xid_dblks = size_dblks(deq_hdr::size() + _dtx_hdr._xidsize);
- const u_int32_t hdr_xid_tail_dblks = size_dblks(enq_hdr::size() +
_dtx_hdr._xidsize +
- rec_tail::size());
- const size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
-
- if (hdr_xid_tail_dblks - rec_offs_dblks <= max_size_dblks)
- {
- // Remainder of xid fits within this page
- if (rec_offs - deq_hdr::size() < _dtx_hdr._xidsize)
- {
- // Part of xid still outstanding, copy remainder of xid and tail
- const size_t xid_offs = rec_offs - deq_hdr::size();
- const size_t xid_rem = _dtx_hdr._xidsize - xid_offs;
- _xid.append((char*)rptr, xid_rem);
- rd_cnt = xid_rem;
- ::memcpy((void*)&_dtx_tail, ((char*)rptr + rd_cnt),
sizeof(_dtx_tail));
- chk_tail();
- rd_cnt += sizeof(_dtx_tail);
- }
- else
- {
- // Tail or part of tail only outstanding, complete tail
- const size_t tail_offs = rec_offs - deq_hdr::size() - _dtx_hdr._xidsize;
- const size_t tail_rem = rec_tail::size() - tail_offs;
- ::memcpy((char*)&_dtx_tail + tail_offs, rptr, tail_rem);
- chk_tail();
- rd_cnt = tail_rem;
- }
- }
- else if (hdr_xid_dblks - rec_offs_dblks <= max_size_dblks)
- {
- // Remainder of xid fits within this page, tail split
- const size_t xid_offs = rec_offs - deq_hdr::size();
- const size_t xid_rem = _dtx_hdr._xidsize - xid_offs;
- _xid.append((char*)rptr, xid_rem);
- rd_cnt += xid_rem;
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
- if (tail_rem)
- {
- ::memcpy((void*)&_dtx_tail, ((char*)rptr + xid_rem), tail_rem);
- rd_cnt += tail_rem;
- }
- }
- else
- {
- // Remainder of xid split
- const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
- _xid.append((char*)rptr, xid_cp_size);
- rd_cnt += xid_cp_size;
- }
- }
- else // Start of record
- {
- // Get and check header
- _dtx_hdr._hdr.copy(h);
- rd_cnt = sizeof(hdr);
-#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
- rd_cnt += sizeof(u_int32_t); // Filler 0
-#endif
- _dtx_hdr._xidsize = *(size_t*)((char*)rptr + rd_cnt);
- rd_cnt = _dtx_hdr.size();
- chk_hdr();
- const u_int32_t hdr_xid_dblks = size_dblks(deq_hdr::size() + _dtx_hdr._xidsize);
- const u_int32_t hdr_xid_tail_dblks = size_dblks(enq_hdr::size() +
_dtx_hdr._xidsize +
- rec_tail::size());
-
- // Check if record (header + xid + tail) fits within this page, we can check the
- // tail before the expense of copying data to memory
- if (hdr_xid_tail_dblks <= max_size_dblks)
- {
- // Entire header, xid and tail fits within this page
- ::memcpy((void*)&_dtx_tail, (char*)rptr + rd_cnt + _dtx_hdr._xidsize,
- sizeof(_dtx_tail));
- chk_tail();
- _xid.assign((char*)rptr + rd_cnt, _dtx_hdr._xidsize);
- rd_cnt += _dtx_hdr._xidsize + sizeof(_dtx_tail);
- }
- else if (hdr_xid_dblks <= max_size_dblks)
- {
- // Entire header and xid fit within this page, tail split
- _xid.assign((char*)rptr + rd_cnt, _dtx_hdr._xidsize);
- rd_cnt += _dtx_hdr._xidsize;
- const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
- if (tail_rem)
- {
- ::memcpy((void*)&_dtx_tail, (char*)rptr + rd_cnt, tail_rem);
- rd_cnt += tail_rem;
- }
- }
- else
- {
- // Header fits within this page, xid split
- const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
- _xid.assign((char*)rptr + rd_cnt, xid_cp_size);
- rd_cnt += xid_cp_size;
- }
- }
- return size_dblks(rd_cnt);
-}
-
-std::string&
-dtx_rec::str(std::string& str) const
-{
- std::stringstream ss;
- if (_dtx_hdr._hdr._magic == RHM_JDAT_DTXA_MAGIC)
- ss << "dtxa_rec: m=" << _dtx_hdr._hdr._magic;
- else
- ss << "dtxc_rec: m=" << _dtx_hdr._hdr._magic;
- ss << " v=" << (int)_dtx_hdr._hdr._version;
- ss << " rid=" << _dtx_hdr._hdr._rid;
- ss << " xid=\"" << _xid << "\"";
- str.append(ss.str());
- return str;
-}
-
-const size_t
-dtx_rec::xid_size() const
-{
- return _dtx_hdr._xidsize;
-}
-
-const size_t
-dtx_rec::rec_size() const
-{
- return deq_hdr::size() + _dtx_hdr._xidsize + rec_tail::size();
-}
-
-void
-dtx_rec::chk_hdr() const throw (jexception)
-{
- jrec::chk_hdr(_dtx_hdr._hdr);
- if (_dtx_hdr._hdr._magic != RHM_JDAT_DTXA_MAGIC && _dtx_hdr._hdr._magic !=
RHM_JDAT_DTXC_MAGIC)
- {
- std::stringstream ss;
- ss << std::hex << std::setfill('0');
- ss << "dtx magic: rid=0x" << std::setw(16) <<
_dtx_hdr._hdr._rid;
- ss << ": expected=(0x" << std::setw(8) <<
RHM_JDAT_DTXA_MAGIC;
- ss << " or 0x" << RHM_JDAT_DTXC_MAGIC;
- ss << ") read=0x" << std::setw(2) <<
(int)_dtx_hdr._hdr._magic;
- throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "dtx_rec",
"chk_hdr");
- }
-}
-
-void
-dtx_rec::chk_hdr(u_int64_t rid) const throw (jexception)
-{
- chk_hdr();
- jrec::chk_rid(_dtx_hdr._hdr, rid);
-}
-
-void
-dtx_rec::chk_tail() const throw (jexception)
-{
- jrec::chk_tail(_dtx_tail, _dtx_hdr._hdr);
-}
-
-} // namespace journal
-} // namespace rhm
Deleted: store/trunk/cpp/lib/jrnl/dtx_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/dtx_rec.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/dtx_rec.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -1,88 +0,0 @@
-/**
-* \file dtx_rec.hpp
-*
-* Red Hat Messaging - Message Journal
-*
-* This file contains the code for the rhm::journal::dtx_rec (journal data
-* record) class. See class documentation for details.
-*
-* \author Kim van der Riet
-*
-* Copyright 2007 Red Hat, Inc.
-*
-* This file is part of Red Hat Messaging.
-*
-* Red Hat Messaging is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
-* USA
-*
-* The GNU Lesser General Public License is available in the file COPYING.
-*/
-
-#ifndef rhm_journal_dtx_rec_hpp
-#define rhm_journal_dtx_rec_hpp
-
-namespace rhm
-{
-namespace journal
-{
-class dtx_rec;
-}
-}
-
-#include <jrnl/jrec.hpp>
-
-namespace rhm
-{
-namespace journal
-{
-
- /**
- * \class dtx_rec
- * \brief Class to handle a single journal DTX commit or abort record.
- */
- class dtx_rec : public jrec
- {
- private:
- dtx_hdr _dtx_hdr; ///< DTX header
- std::string _xid; ///< XID
- rec_tail _dtx_tail; ///< Record tail
-
- public:
- dtx_rec();
- dtx_rec(const u_int32_t magic, const u_int64_t rid);
- dtx_rec(const u_int32_t magic, const u_int64_t rid, const std::string& xid);
- ~dtx_rec();
-
- void reset(const u_int64_t rid);
- void reset(const u_int64_t rid, const std::string& xid);
- u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks)
- throw (jexception);
- u_int32_t decode(hdr& h, void* rptr, u_int32_t rec_offs_dblks, u_int32_t
max_size_dblks)
- throw (jexception);
- std::string& str(std::string& str) const;
- inline const size_t data_size() const { return 0; } // This record never carries
data
- const size_t xid_size() const;
- const size_t rec_size() const;
-
- private:
- void chk_hdr() const throw (jexception);
- void chk_hdr(u_int64_t rid) const throw (jexception);
- void chk_tail() const throw (jexception);
- }; // class dtx_rec
-
-} // namespace journal
-} // namespace rhm
-
-#endif // ifndef rhm_journal_dtx_rec_hpp
Modified: store/trunk/cpp/lib/jrnl/enq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/enq_rec.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -46,57 +46,39 @@
// instance for use with write or read operations
enq_rec::enq_rec():
jrec(), // superclass
- _enq_hdr(RHM_JDAT_ENQ_MAGIC, 0, 0, 0, RHM_JDAT_VERSION),
- _xid(),
+ _enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, 0, 0, 0),
+ _xidp(NULL),
_data(NULL),
_buff(NULL),
_enq_tail(_enq_hdr._hdr),
_max_data_size(0),
- _data_size(0),
- _rec_size(0)
+ _data_size(0)
{}
-// Constructor used for write operations, where dbuf contains data to be written.
-enq_rec::enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen):
- jrec(), // superclass
- _enq_hdr(RHM_JDAT_ENQ_MAGIC, rid, 0, dlen, RHM_JDAT_VERSION),
- _xid(),
- _data(dbuf),
- _buff(NULL),
- _enq_tail(_enq_hdr._hdr),
- _max_data_size(0),
- _data_size(dlen),
- _rec_size(size_dblks(enq_hdr::size() + _enq_hdr._xidsize + dlen +
rec_tail::size()) *
- JRNL_DBLK_SIZE)
-{}
-
// Constructor used for transactional write operations, where dbuf contains data to be
written.
enq_rec::enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const std::string& xid):
+ const void* const xidp, const size_t xidlen, bool transient):
jrec(), // superclass
- _enq_hdr(RHM_JDAT_ENQ_MAGIC, rid, xid.size(), dlen, RHM_JDAT_VERSION),
- _xid(xid),
+ _enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, rid, xidlen, dlen,
+ transient),
+ _xidp(xidp),
_data(dbuf),
_buff(NULL),
_enq_tail(_enq_hdr._hdr),
_max_data_size(0),
- _data_size(dlen),
- _rec_size(size_dblks(enq_hdr::size() + _enq_hdr._xidsize + dlen +
rec_tail::size()) *
- JRNL_DBLK_SIZE)
+ _data_size(dlen)
{}
-// Constructor used for read operations, where buf contains preallocated space
-// to receive data.
+// Constructor used for read operations, where buf contains preallocated space to receive
data.
enq_rec::enq_rec(void* const buf, const size_t bufsize):
jrec(), // superclass
- _enq_hdr(RHM_JDAT_ENQ_MAGIC, 0, 0, bufsize, RHM_JDAT_VERSION),
- _xid(),
+ _enq_hdr(RHM_JDAT_ENQ_MAGIC, RHM_JDAT_VERSION, 0, 0, bufsize),
+ _xidp(NULL),
_data(NULL),
_buff(buf),
_enq_tail(_enq_hdr._hdr),
_max_data_size(bufsize),
- _data_size(0),
- _rec_size(0)
+ _data_size(0)
{}
enq_rec::~enq_rec()
@@ -110,36 +92,22 @@
#endif
}
-// Prepare instance for use in writing data to journal, where dbuf contains data to be
written.
-void
-enq_rec::reset(const u_int64_t rid, const void* const dbuf, const size_t dlen)
-{
- _enq_hdr._hdr._rid = rid;
- _enq_hdr._xidsize = 0;
- _enq_hdr._dsize = dlen;
- _data = dbuf;
- _buff = NULL;
- _enq_tail._rid = rid;
- _max_data_size = 0;
- _data_size = dlen;
- _rec_size = size_dblks(dlen + enq_hdr::size() + rec_tail::size()) * JRNL_DBLK_SIZE;
-}
-
// Prepare instance for use in writing transactional data to journal, where dbuf contains
data to
// be written.
void
enq_rec::reset(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const std::string& xid)
+ const void* const xidp, const size_t xidlen, bool transient)
{
_enq_hdr._hdr._rid = rid;
- _enq_hdr._xidsize = xid.size();
+ _enq_hdr.set_transient(transient);
+ _enq_hdr._xidsize = xidlen;
_enq_hdr._dsize = dlen;
+ _xidp = xidp;
_data = dbuf;
_buff = NULL;
_enq_tail._rid = rid;
_max_data_size = 0;
_data_size = dlen;
- _rec_size = size_dblks(dlen + enq_hdr::size() + rec_tail::size()) * JRNL_DBLK_SIZE;
}
// Prepare instance for use in reading data from journal, where buf contains preallocated
space
@@ -150,12 +118,12 @@
_enq_hdr._hdr._rid = 0;
_enq_hdr._xidsize = 0;
_enq_hdr._dsize = bufsize;
+ _xidp = NULL;
_data = NULL;
_buff = buf;
_enq_tail._rid = 0;
_max_data_size = bufsize;
_data_size = 0;
- _rec_size = 0;
}
u_int32_t
@@ -163,7 +131,8 @@
{
assert(wptr != NULL);
assert(max_size_dblks > 0);
- assert(_xid.size() == _enq_hdr._xidsize);
+ if (_xidp == NULL)
+ assert(_enq_hdr._xidsize == 0);
size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
@@ -179,7 +148,7 @@
{
if (wsize > rem)
wsize = rem;
- ::memcpy(wptr, (const char*)_xid.c_str() + rec_offs, wsize);
+ ::memcpy(wptr, (const char*)_xidp + rec_offs, wsize);
wr_cnt = wsize;
rem -= wsize;
}
@@ -221,7 +190,7 @@
size_t wsize = _enq_hdr._xidsize > rec_offs ? _enq_hdr._xidsize - rec_offs
: 0;
if (wsize)
{
- ::memcpy(wptr, _xid.c_str() + rec_offs, wsize);
+ ::memcpy(wptr, (char*)_xidp + rec_offs, wsize);
wr_cnt += wsize;
}
rec_offs -= _enq_hdr._xidsize - wsize;
@@ -238,8 +207,9 @@
::memcpy((char*)wptr + wr_cnt, (char*)&_enq_tail + rec_offs, wsize);
wr_cnt += wsize;
#ifdef RHM_CLEAN
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR,
- _rec_size - (rec_offs_dblks * JRNL_DBLK_SIZE) - wr_cnt);
+ size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ size_t dblk_rec_size = size_dblks(rec_size() - rec_offs) *
JRNL_DBLK_SIZE;
+ ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
rec_offs -= sizeof(_enq_tail) - wsize;
@@ -258,7 +228,7 @@
if (rem)
{
wsize = rem >= _enq_hdr._xidsize ? _enq_hdr._xidsize : rem;
- ::memcpy((char*)wptr + wr_cnt, _xid.c_str(), wsize);
+ ::memcpy((char*)wptr + wr_cnt, _xidp, wsize);
wr_cnt += wsize;
rem -= wsize;
}
@@ -282,15 +252,16 @@
{
if (_enq_hdr._xidsize)
{
- ::memcpy((char*)wptr + wr_cnt, _xid.c_str(), _xid.size());
- wr_cnt += _xid.size();
+ ::memcpy((char*)wptr + wr_cnt, _xidp, _enq_hdr._xidsize);
+ wr_cnt += _enq_hdr._xidsize;
}
::memcpy((char*)wptr + wr_cnt, _data, _data_size);
wr_cnt += _data_size;
::memcpy((char*)wptr + wr_cnt, (void*)&_enq_tail, sizeof(_enq_tail));
wr_cnt += sizeof(_enq_tail);
#ifdef RHM_CLEAN
- ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, _rec_size - wr_cnt);
+ size_t dblk_rec_size = size_dblks(rec_size()) * JRNL_DBLK_SIZE;
+ ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR, dblk_rec_size - wr_cnt);
#endif
}
}
@@ -425,8 +396,8 @@
ss << "enq_rec: m=" << _enq_hdr._hdr._magic;
ss << " v=" << (int)_enq_hdr._hdr._version;
ss << " rid=" << _enq_hdr._hdr._rid;
- if (_xid.size())
- ss << " xid=\"" << _xid << "\"";
+ if (_xidp)
+ ss << " xid=\"" << _xidp <<
"\"";
ss << " len=" << _enq_hdr._dsize;
str.append(ss.str());
return str;
@@ -441,13 +412,13 @@
const size_t
enq_rec::xid_size() const
{
- return _xid.size();
+ return _enq_hdr._xidsize;
}
const size_t
enq_rec::rec_size() const
{
- return enq_hdr::size() + _xid.size() + _data_size + rec_tail::size();
+ return enq_hdr::size() + _enq_hdr._xidsize + _data_size + rec_tail::size();
}
void
Modified: store/trunk/cpp/lib/jrnl/enq_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/enq_rec.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -56,13 +56,12 @@
{
private:
enq_hdr _enq_hdr;
- std::string _xid; ///< XID
+ const void* _xidp; ///< xid pointer
const void* _data; ///< Pointer to data to be written to disk
void* _buff; ///< Pointer to buffer to receive data read
from disk
rec_tail _enq_tail;
size_t _max_data_size; ///< Max buffer size for decoding into during
read
size_t _data_size; ///< Size of data (bytes)
- size_t _rec_size; ///< Size of data blocks required for record
(bytes)
public:
/**
@@ -74,14 +73,8 @@
/**
* \brief Constructor used for write operations, where mbuf contains data to be
written.
*/
- enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen);
-
- /**
- * \brief Constructor used for transactional write operations, where mbuf contains
data to
- * be written.
- */
enq_rec(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const std::string& xid);
+ const void* const xidp, const size_t xidlen, bool transient);
/**
* \brief Constructor used for read operations, where buf contains preallocated
space
@@ -95,9 +88,8 @@
~enq_rec();
// Prepare instance for use in writing data to journal
- void reset(const u_int64_t rid, const void* const dbuf, const size_t dlen);
void reset(const u_int64_t rid, const void* const dbuf, const size_t dlen,
- const std::string& xid);
+ const void* const xidp, const size_t xidlen, bool transient);
// Prepare instance for use in reading data from journal
void reset(void* const buf, const size_t bufsize);
Modified: store/trunk/cpp/lib/jrnl/file_hdr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/file_hdr.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -52,8 +52,7 @@
_rid(0)
{}
-hdr::hdr(const u_int32_t magic, const u_int64_t rid, const u_int8_t version,
- const u_int8_t uflag):
+hdr::hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag, const
u_int64_t rid):
_magic(magic),
_version(version),
#if defined(JRNL_BIG_ENDIAN)
@@ -133,10 +132,10 @@
#endif
{}
-file_hdr::file_hdr(const u_int32_t magic, const u_int64_t rid, const u_int32_t fid,
- const size_t fro, const bool settime, const u_int8_t version, const u_int8_t
uflag)
+file_hdr::file_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
+ const u_int64_t rid, const u_int32_t fid, const size_t fro, const bool settime)
throw (jexception):
- _hdr(magic, rid, version, uflag),
+ _hdr(magic, version, uflag, rid),
_fid(fid),
_res(0),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
@@ -178,15 +177,6 @@
}
_ts_sec = ts.tv_sec;
_ts_nsec = ts.tv_nsec;
-// This version uses a call with microsecond resolution instead of nanosecond
resolution...
-// timeval tv;
-// if (::gettimeofday(&tv, 0))
-// ;
-// else
-// {
-// _ts_sec = tv.tv_sec;
-// _ts_nsec = tv.tv_usec * 1000;
-// }
}
void
@@ -217,9 +207,9 @@
#endif
{}
-enq_hdr::enq_hdr(const u_int32_t magic, const u_int64_t rid, const size_t xidsize,
- const size_t dsize, const u_int8_t version, const bool transient):
- _hdr(magic, rid, version, transient?ENQ_HDR_TRANSIENT_MASK:0),
+enq_hdr::enq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const size_t xidsize, const size_t dsize, const bool transient):
+ _hdr(magic, version, transient ? ENQ_HDR_TRANSIENT_MASK : 0, rid),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
@@ -236,9 +226,18 @@
#endif
{}
-const u_int32_t enq_hdr::ENQ_HDR_TRANSIENT_MASK = 0x1;
+void
+enq_hdr::set_transient(const bool transient)
+{
+ if (transient)
+ _hdr._uflag |= ENQ_HDR_TRANSIENT_MASK;
+ else
+ _hdr._uflag &= (~ENQ_HDR_TRANSIENT_MASK);
+}
+const u_int16_t enq_hdr::ENQ_HDR_TRANSIENT_MASK = 0x1;
+
// ***** struct deq_hdr *****
deq_hdr::deq_hdr():
@@ -253,9 +252,9 @@
#endif
{}
-deq_hdr::deq_hdr(const u_int32_t magic, const u_int64_t rid, const u_int64_t deq_rid,
- const size_t xidsize, const u_int8_t version, const u_int8_t uflag):
- _hdr(magic, rid, version, uflag),
+deq_hdr::deq_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
+ const u_int64_t rid, const u_int64_t deq_rid, const size_t xidsize):
+ _hdr(magic, version, uflag, rid),
_deq_rid(deq_rid),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
@@ -267,10 +266,10 @@
{}
-// ***** struct dtx_hdr *****
+// ***** struct txn_hdr *****
-dtx_hdr::dtx_hdr():
+txn_hdr::txn_hdr():
_hdr(),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
@@ -281,9 +280,9 @@
#endif
{}
-dtx_hdr::dtx_hdr(const u_int32_t magic, const u_int64_t rid, const size_t xidsize,
- const u_int8_t version, const u_int8_t uflag):
- _hdr(magic, rid, version, uflag),
+txn_hdr::txn_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
+ const u_int64_t rid, const size_t xidsize):
+ _hdr(magic, version, uflag, rid),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
Modified: store/trunk/cpp/lib/jrnl/file_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/file_hdr.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -92,8 +92,8 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- hdr(const u_int32_t magic, const u_int64_t rid, const u_int8_t version = 0,
- const u_int8_t uflag = 0);
+ hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
+ const u_int64_t rid);
/**
* \brief Convenience copy method.
@@ -232,9 +232,9 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- file_hdr(const u_int32_t magic, const u_int64_t rid, const u_int32_t fid,
- const size_t fro, const bool settime = false, const u_int8_t version =
0,
- const u_int8_t uflag = 0) throw (jexception);
+ file_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
+ const u_int64_t rid, const u_int32_t fid, const size_t fro,
+ const bool settime = false) throw (jexception);
/**
* \brief Gets the current time from the system clock and sets the timestamp in
the struct.
@@ -301,7 +301,7 @@
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler1; ///< Little-endian filler for 32-bit size_t
#endif
- static const u_int32_t ENQ_HDR_TRANSIENT_MASK;
+ static const u_int16_t ENQ_HDR_TRANSIENT_MASK;
/**
* \brief Default constructor, which sets all values to 0.
@@ -311,10 +311,11 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- enq_hdr(const u_int32_t magic, const u_int64_t rid, const size_t xidsize,
- const size_t dsize, const u_int8_t version = 0, const bool transient =
false);
+ enq_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t rid,
+ const size_t xidsize, const size_t dsize, const bool transient = false);
inline const bool is_transient() { return _hdr._uflag &
ENQ_HDR_TRANSIENT_MASK; }
+ void set_transient(const bool transient);
/**
* \brief Returns the size of the header in bytes.
@@ -377,8 +378,8 @@
/**
* \brief Convenience constructor which initializes values during construction.
*/
- deq_hdr(const u_int32_t magic, const u_int64_t rid, const u_int64_t deq_rid,
- const size_t xidsize, const u_int8_t version = 0, const u_int8_t uflag =
0);
+ deq_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
+ const u_int64_t rid, const u_int64_t deq_rid, const size_t xidsize);
/**
* \brief Returns the size of the header in bytes.
@@ -418,7 +419,7 @@
* entianness without some sort of binary conversion utility. Thus buffering
* will be needed for types that change size between 32- and 64-bit compiles.
*/
- struct dtx_hdr
+ struct txn_hdr
{
hdr _hdr; ///< Common header
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
@@ -432,18 +433,18 @@
/**
* \brief Default constructor, which sets all values to 0.
*/
- dtx_hdr();
+ txn_hdr();
/**
* \brief Convenience constructor which initializes values during construction.
*/
- dtx_hdr(const u_int32_t magic, const u_int64_t rid, const size_t xidsize,
- const u_int8_t version = 0, const u_int8_t uflag = 0);
+ txn_hdr(const u_int32_t magic, const u_int8_t version, const u_int16_t uflag,
+ const u_int64_t rid, const size_t xidsize);
/**
* \brief Returns the size of the header in bytes.
*/
- inline static const size_t size() { return sizeof(dtx_hdr); }
+ inline static const size_t size() { return sizeof(txn_hdr); }
};
#pragma pack()
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -128,6 +128,7 @@
std::set<std::string> prep_xid_list;
for (bdbstore::PreparedTransaction::list::iterator i = prep_tx_list.begin();
i != prep_tx_list.end(); i++);
+// TODO!
// prep_xid_list.insert(i->??);
// Verify journal dir and journal files
@@ -193,29 +194,32 @@
throw (jexception)
{
check_wstatus("enqueue_data_record");
- return _wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, transient);
+ return _wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, NULL, 0,
transient);
}
const iores
-jcntl::enqueue_tx_data_record(const void* const data_buff, const size_t tot_data_len,
+jcntl::enqueue_txn_data_record(const void* const data_buff, const size_t tot_data_len,
const size_t this_data_len, data_tok* dtokp, const std::string& xid,
const bool transient) throw (jexception)
{
check_wstatus("enqueue_tx_data_record");
- return _wmgr.enqueue_tx(data_buff, tot_data_len, this_data_len, dtokp, xid,
transient);
+ return _wmgr.enqueue(data_buff, tot_data_len, this_data_len, dtokp, xid.c_str(),
xid.size(),
+ transient);
}
const iores
-jcntl::get_data_record(const u_int64_t& /*rid*/, const size_t& /*dsize*/, const
size_t& /*dsize_avail*/,
- const void** const /*data*/, bool /*auto_discard*/) throw (jexception)
+jcntl::get_data_record(const u_int64_t& rid, const size_t& dsize, const
size_t& dsize_avail,
+ const void** const data, bool auto_discard) throw (jexception)
{
- return RHM_IORES_NOTIMPL;
+ check_rstatus("get_data_record");
+ return _rmgr.get(rid, dsize, dsize_avail, data, auto_discard);
}
const iores
-jcntl::discard_data_record() throw (jexception)
+jcntl::discard_data_record(data_tok* const dtokp) throw (jexception)
{
- return RHM_IORES_NOTIMPL;
+ check_rstatus("discard_data_record");
+ return _rmgr.discard(dtokp);
}
const iores
@@ -230,28 +234,34 @@
jcntl::dequeue_data_record(data_tok* const dtokp) throw (jexception)
{
check_wstatus("dequeue_data");
- return _wmgr.dequeue(dtokp);
+ return _wmgr.dequeue(dtokp, NULL, 0);
}
const iores
-jcntl::dequeue_tx_data_record(data_tok* const dtokp, const std::string& xid) throw
(jexception)
+jcntl::dequeue_txn_data_record(data_tok* const dtokp, const std::string& xid) throw
(jexception)
{
check_wstatus("dequeue_data");
- return _wmgr.dequeue_tx(dtokp, xid);
+ return _wmgr.dequeue(dtokp, xid.c_str(), xid.size());
}
const iores
-jcntl::abort_dtx(const std::string& /*xid*/) throw (jexception)
+jcntl::txn_abort(const std::string& /*xid*/) throw (jexception)
{
return RHM_IORES_NOTIMPL;
}
const iores
-jcntl::commit_dtx(const std::string& /*xid*/) throw (jexception)
+jcntl::txn_commit(const std::string& /*xid*/) throw (jexception)
{
return RHM_IORES_NOTIMPL;
}
+const bool
+is_txn_synced(const std::string& /*xid*/) throw (jexception)
+{
+ return RHM_IORES_NOTIMPL;
+}
+
const u_int32_t
jcntl::get_wr_events() throw (jexception)
{
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -315,7 +315,7 @@
*
* \exception TODO
*/
- const iores enqueue_tx_data_record(const void* const data_buff, const size_t
tot_data_len,
+ const iores enqueue_txn_data_record(const void* const data_buff, const size_t
tot_data_len,
const size_t this_data_len, data_tok* dtokp, const std::string& xid,
const bool transient = false) throw (jexception);
@@ -385,7 +385,7 @@
*
* \exception TODO
*/
- const iores discard_data_record() throw (jexception);
+ const iores discard_data_record(data_tok* const dtokp) throw (jexception);
/**
* \brief Reads data from the journal.
@@ -433,7 +433,7 @@
*
* \exception TODO
*/
- const iores dequeue_tx_data_record(data_tok* const dtokp, const std::string&
xid)
+ const iores dequeue_txn_data_record(data_tok* const dtokp, const std::string&
xid)
throw (jexception);
/**
@@ -447,7 +447,7 @@
*
* \exception TODO
*/
- const iores abort_dtx(const std::string& xid) throw (jexception);
+ const iores txn_abort(const std::string& xid) throw (jexception);
/**
* \brief Commit the transaction for all records enqueued or dequeued with the
matching xid.
@@ -460,7 +460,7 @@
*
* \exception TODO
*/
- const iores commit_dtx(const std::string& xid) throw (jexception);
+ const iores txn_commit(const std::string& xid) throw (jexception);
/**
* \brief Check whether all the enqueue records for the given xid have reached
disk.
@@ -469,7 +469,7 @@
*
* \exception TODO
*/
- const bool is_dtx_synced(const std::string& xid) throw (jexception);
+ const bool is_txn_synced(const std::string& xid) throw (jexception);
/**
* \brief Forces a check for returned AIO write events.
Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -262,5 +262,28 @@
return "<page_state unknown>";
}
+const char*
+pmgr::iores_str(iores res)
+{
+ switch (res)
+ {
+ case RHM_IORES_SUCCESS:
+ return "RHM_IORES_SUCCESS";
+ case RHM_IORES_AIO_WAIT:
+ return "RHM_IORES_AIO_WAIT";
+ case RHM_IORES_EMPTY:
+ return "RHM_IORES_EMPTY";
+ case RHM_IORES_FULL:
+ return "RHM_IORES_FULL";
+ case RHM_IORES_BUSY:
+ return "RHM_IORES_BUSY";
+ case RHM_IORES_TXPENDING:
+ return "RHM_IORES_TXPENDING";
+ case RHM_IORES_NOTIMPL:
+ return "RHM_IORES_NOTIMPL";
+ }
+ return "<iores unknown>";
+}
+
} // namespace journal
} // namespace rhm
Modified: store/trunk/cpp/lib/jrnl/pmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -47,10 +47,10 @@
#include <jrnl/aio_cb.hpp>
#include <jrnl/data_tok.hpp>
#include <jrnl/deq_rec.hpp>
-#include <jrnl/dtx_rec.hpp>
#include <jrnl/enq_map.hpp>
#include <jrnl/enq_rec.hpp>
#include <jrnl/nlfh.hpp>
+#include <jrnl/txn_rec.hpp>
namespace rhm
{
@@ -130,7 +130,7 @@
enq_rec _enq_rec; ///< Enqueue record used for
encoding/decoding
deq_rec _deq_rec; ///< Dequeue record used for
encoding/decoding
- dtx_rec _dtx_rec; ///< Transaction record used for
encoding/decoding
+ txn_rec _txn_rec; ///< Transaction record used for
encoding/decoding
// TODO: move _cb down to wmgr, it is the only class that uses it There is no
need for
// read callbacks based on AIO. - (check this asertion)
@@ -145,6 +145,7 @@
virtual const u_int32_t get_events(page_state state) throw (jexception) = 0;
inline const u_int32_t get_aio_evt_rem() const { return _aio_evt_rem; }
static const char* page_state_str(page_state ps);
+ static const char* iores_str(iores res);
protected:
virtual void initialize() throw (jexception);
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -66,29 +66,156 @@
}
const iores
+rmgr::get(const u_int64_t& /*rid*/, const size_t& /*dsize*/, const size_t&
/*dsize_avail*/,
+ const void** const /*data*/, bool /*auto_discard*/) throw (jexception)
+{
+//std::cout << " rmgr::get()" << std::flush;
+ iores res = pre_read_check(NULL);
+ if (res != RHM_IORES_SUCCESS)
+ return res;
+
+ return RHM_IORES_NOTIMPL;
+
+// TODO - untangle this...
+// _hdr.reset();
+// // Read header, determine next record type
+// while (true)
+// {
+// if(dblks_rem() == 0 && _rrfc.is_compl() &&
!_rrfc.is_wr_aio_outstanding())
+// {
+// aio_cycle(); // check if any AIOs have returned
+// return RHM_IORES_EMPTY;
+// }
+// if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+// {
+// aio_cycle();
+// return RHM_IORES_AIO_WAIT;
+// }
+// void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
+// (_pg_offset_dblks * JRNL_DBLK_SIZE));
+// ::memcpy(&_hdr, rptr, sizeof(hdr));
+// switch (_hdr._magic)
+// {
+// case RHM_JDAT_ENQ_MAGIC:
+// {
+// size_t xid_size = *((size_t*)((char*)rptr + sizeof(hdr)
+// #if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+// + sizeof(u_int32_t) // filler0
+// #endif
+// ));
+// size_t data_size = *((size_t*)((char*)rptr + sizeof(hdr) +
sizeof(u_int64_t)
+// #if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+// + sizeof(u_int32_t) // filler1
+// #endif
+// ));
+// // TODO: Check if transaction is still in transaction map. If so,
block read
+// // (unless in recovery, in whcih case return info normally
+// // std::string xid = ?? (decode xid here)
+// // if (xid_size && !readonly &&
tx_map.exists(xid))
+// // return RHM_IORES_TXPENDING;
+// rid = _hdr._rid;
+// dsize = data_size;
+//
+// // Analyze how much of message is available
+// void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
+// void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize
* _pages;
+// u_int16_t data_start_pg_index = _pg_index;
+// u_int16_t data_start_pg_index = _pg_index;
+// for (u_int16_t i=0; i<_pages; i++)
+// {
+// pi = (i + _pg_index) % _pages;
+// if (data_ptr >= _page_ptr_arr[pi] &&
+// data_ptr < (char*)_page_ptr_arr[pi] + _pagesize *
_sblksize)
+// data_end_pg_index = pi; // found start page index
+//
+// }
+// u_int16_t data_end_pg_index;
+// u_int16_t last_pg_avail_index;
+//
+// void* data_ptr = (char*)rptr + sizeof(enq_hdr) + xid_size;
+// void* page_end_ptr = (char*)_page_base_ptr + _pagesize * _sblksize
* _pages;
+// if (data_ptr >= page_end_ptr) // folded, go back to first
page...
+// data_ptr = (char*)_page_base_ptr + data_ptr - page_end_ptr;
+// void* data_end_ptr = (char*)data_ptr + data_size;
+// if (data_end_ptr >= page_end_ptr) // folded, go back to first
page...
+// data_end_ptr = (char*)_page_base_ptr + data_end_ptr -
page_end_ptr;
+// dsize_avail = ??;
+// if(data_ptr folded)
+// else
+// *data = data_ptr;
+// }
+// break;
+// case RHM_JDAT_DEQ_MAGIC:
+// consume_deq();
+// break;
+// case RHM_JDAT_EMPTY_MAGIC:
+// consume_filler();
+// break;
+// default:
+// std::stringstream ss;
+// ss << std::hex << std::setfill('0');
+// ss << "Magic=0x" << std::setw(8) <<
_hdr._magic << std::dec;
+// throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str(),
"rmgr", "read");
+// } // switch(_hdr._magic)
+// } // while
+}
+
+const iores
+rmgr::discard(data_tok* dtokp) throw (jexception)
+{
+//std::cout << " rmgr::get()" << std::flush;
+ iores res = pre_read_check(dtokp);
+ if (res != RHM_IORES_SUCCESS)
+ return res;
+
+ return RHM_IORES_NOTIMPL;
+
+// TODO - untangle this...
+// _hdr.reset();
+// // Read header, determine next record type
+// while (true)
+// {
+// if(dblks_rem() == 0 && _rrfc.is_compl() &&
!_rrfc.is_wr_aio_outstanding())
+// {
+// aio_cycle(); // check if any AIOs have returned
+// return RHM_IORES_EMPTY;
+// }
+// if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+// {
+// aio_cycle();
+// return RHM_IORES_AIO_WAIT;
+// }
+// void* rptr = (void*)((char*)_page_ptr_arr[_pg_index] +
+// (_pg_offset_dblks * JRNL_DBLK_SIZE));
+// ::memcpy(&_hdr, rptr, sizeof(hdr));
+// switch (_hdr._magic)
+// {
+// case RHM_JDAT_ENQ_MAGIC:
+// {
+// }
+// break;
+// case RHM_JDAT_DEQ_MAGIC:
+// consume_deq();
+// break;
+// case RHM_JDAT_EMPTY_MAGIC:
+// consume_filler();
+// break;
+// default:
+// std::stringstream ss;
+// ss << std::hex << std::setfill('0');
+// ss << "Magic=0x" << std::setw(8) <<
_hdr._magic << std::dec;
+// throw jexception(jerrno::JERR_RMGR_UNKNOWNMAGIC, ss.str(),
"rmgr", "read");
+// } // switch
+// } // while
+}
+
+const iores
rmgr::read(void* const mbuf, const size_t mbsize, data_tok* dtokp) throw (jexception)
{
//std::cout << " rmgr::read()" << std::flush;
- if (_aio_evt_rem)
- get_events();
-//std::string s;
-//std::cout << " [a pi=" << _pg_index << " d="
<< dblks_rem() << " c=" <<
(_rrfc.is_compl()?"T":"F") << " wo=" <<
(_rrfc.is_wr_aio_outstanding()?"T":"F") << " status:"
<< _rrfc.file_handle()->status_str(s) << "]" <<
std::flush;
- if(dblks_rem() == 0 && _rrfc.is_compl() &&
!_rrfc.is_wr_aio_outstanding())
- {
- aio_cycle(); // check if any AIOs have returned
- return RHM_IORES_EMPTY;
- }
-//std::cout << " b" << std::flush;
- // Check write state of this token is ENQ - required for read
- if (!dtokp->is_readable())
- {
- std::stringstream ss;
- ss << std::hex << std::setfill('0');
- ss << "dtok_id=0x" << std::setw(8) <<
dtokp->id();
- ss << "; dtok_rid=0x" << std::setw(16) <<
dtokp->rid();
- ss << "; dtok_wstate=" << dtokp->wstate_str();
- throw jexception(jerrno::JERR_RMGR_ENQSTATE, ss.str(), "rmgr",
"read");
- }
+ iores res = pre_read_check(dtokp);
+ if (res != RHM_IORES_SUCCESS)
+ return res;
//std::cout << " c" << std::flush;
if (dtokp->rstate() == data_tok::SKIP_PART)
@@ -285,6 +412,38 @@
}
const iores
+rmgr::pre_read_check(data_tok* dtokp) throw (jexception)
+{
+ if (_aio_evt_rem)
+ get_events();
+
+//std::string s;
+//std::cout << " [a pi=" << _pg_index << " d="
<< dblks_rem() << " c=" <<
(_rrfc.is_compl()?"T":"F") << " wo=" <<
(_rrfc.is_wr_aio_outstanding()?"T":"F") << " status:"
<< _rrfc.file_handle()->status_str(s) << "]" <<
std::flush;
+ if(dblks_rem() == 0 && _rrfc.is_compl() &&
!_rrfc.is_wr_aio_outstanding())
+ {
+ aio_cycle(); // check if any AIOs have returned
+ return RHM_IORES_EMPTY;
+ }
+
+//std::cout << " b" << std::flush;
+ // Check write state of this token is ENQ - required for read
+ if (dtokp)
+ {
+ if (!dtokp->is_readable())
+ {
+ std::stringstream ss;
+ ss << std::hex << std::setfill('0');
+ ss << "dtok_id=0x" << std::setw(8) <<
dtokp->id();
+ ss << "; dtok_rid=0x" << std::setw(16) <<
dtokp->rid();
+ ss << "; dtok_wstate=" << dtokp->wstate_str();
+ throw jexception(jerrno::JERR_RMGR_ENQSTATE, ss.str(), "rmgr",
"read");
+ }
+ }
+
+ return RHM_IORES_SUCCESS;
+}
+
+const iores
rmgr::read_enq(hdr& h, void* rptr, data_tok* dtokp)
throw (jexception)
{
Modified: store/trunk/cpp/lib/jrnl/rmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/rmgr.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -68,14 +68,18 @@
~rmgr();
void initialize(std::deque<data_tok*>* const dtokl, const aio_cb rd_cb)
throw (jexception);
+ const iores get(const u_int64_t& rid, const size_t& dsize, const
size_t& dsize_avail,
+ const void** const data, bool auto_discard) throw (jexception);
+ const iores discard(data_tok* dtok) throw (jexception);
const iores read(void* const mbuf, const size_t mbsize, data_tok* dtok)
throw (jexception);
const u_int32_t get_events(page_state state = AIO_COMPLETE) throw (jexception);
private:
void initialize() throw (jexception);
- const iores read_enq(hdr& h, void* rptr, data_tok* dtok) throw (jexception);
- const iores read_deq(hdr& h, void* rptr, data_tok* dtok) throw (jexception);
+ const iores pre_read_check(data_tok* dtokp) throw (jexception);
+ const iores read_enq(hdr& h, void* rptr, data_tok* dtokp) throw
(jexception);
+ const iores read_deq(hdr& h, void* rptr, data_tok* dtokp) throw
(jexception);
void consume_deq() throw (jexception); // DEPRECATED, to be removed, use
read_deq()
void consume_filler() throw (jexception);
const iores skip(data_tok* dtokp) throw (jexception);
Copied: store/trunk/cpp/lib/jrnl/txn_rec.cpp (from rev 959,
store/trunk/cpp/lib/jrnl/dtx_rec.cpp)
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_rec.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/txn_rec.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -0,0 +1,361 @@
+/**
+* \file txn_rec.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* This file contains the code for the rhm::journal::txn_rec (journal dequeue
+* record) class. See comments in file txn_rec.hpp for details.
+*
+* \author Kim van der Riet
+*
+* Copyright 2007 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#include <jrnl/txn_rec.hpp>
+
+#include <assert.h>
+#include <iomanip>
+#include <sstream>
+#include <jrnl/jerrno.hpp>
+
+namespace rhm
+{
+namespace journal
+{
+
+txn_rec::txn_rec():
+ _txn_hdr(),
+ _xid(),
+ _dtx_tail()
+{}
+
+txn_rec::txn_rec(const u_int32_t magic, const u_int64_t rid):
+ _txn_hdr(magic, RHM_JDAT_VERSION, 0, rid, 0),
+ _xid(),
+ _dtx_tail(_txn_hdr._hdr)
+{}
+
+txn_rec::txn_rec(const u_int32_t magic, const u_int64_t rid, const std::string&
xid):
+ _txn_hdr(magic, RHM_JDAT_VERSION, 0, rid, xid.size()),
+ _xid(xid),
+ _dtx_tail(_txn_hdr._hdr)
+{}
+
+txn_rec::~txn_rec()
+{}
+
+void
+txn_rec::reset(const u_int64_t rid)
+{
+ _txn_hdr._hdr._rid = rid;
+ _txn_hdr._xidsize = 0;
+ _dtx_tail._rid = rid;
+}
+
+void
+txn_rec::reset(const u_int64_t rid, const std::string& xid)
+{
+ _txn_hdr._hdr._rid = rid;
+ _txn_hdr._xidsize = xid.size();
+ _dtx_tail._rid = rid;
+}
+
+u_int32_t
+txn_rec::encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks) throw
(jexception)
+{
+ assert(wptr != NULL);
+ assert(max_size_dblks > 0);
+ assert(_xid.size() == _txn_hdr._xidsize);
+ assert(_txn_hdr._xidsize > 0);
+
+ size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+ size_t rem = max_size_dblks * JRNL_DBLK_SIZE;
+ size_t wr_cnt = 0;
+ if (rec_offs_dblks) // Continuation of split dequeue record (over 2 or more pages)
+ {
+ if (size_dblks(rec_size()) - rec_offs_dblks > max_size_dblks) // Further split
required
+ {
+ rec_offs -= sizeof(_txn_hdr);
+ size_t wsize = _txn_hdr._xidsize > rec_offs ? _txn_hdr._xidsize - rec_offs
: 0;
+ size_t wsize2 = wsize;
+ if (wsize)
+ {
+ if (wsize > rem)
+ wsize = rem;
+ ::memcpy(wptr, (const char*)_xid.c_str() + rec_offs, wsize);
+ wr_cnt += wsize;
+ rem -= wsize;
+ }
+ rec_offs -= _txn_hdr._xidsize - wsize2;
+ if (rem)
+ {
+ wsize = sizeof(_dtx_tail) > rec_offs ? sizeof(_dtx_tail) - rec_offs :
0;
+ wsize2 = wsize;
+ if (wsize)
+ {
+ if (wsize > rem)
+ wsize = rem;
+ ::memcpy((char*)wptr + wr_cnt, (char*)&_dtx_tail + rec_offs,
wsize);
+ wr_cnt += wsize;
+ rem -= wsize;
+ }
+ rec_offs -= sizeof(_dtx_tail) - wsize2;
+ }
+ assert(rem == 0);
+ assert(rec_offs == 0);
+ }
+ else // No further split required
+ {
+ rec_offs -= sizeof(_txn_hdr);
+ size_t wsize = _txn_hdr._xidsize > rec_offs ? _txn_hdr._xidsize - rec_offs
: 0;
+ if (wsize)
+ {
+ ::memcpy(wptr, _xid.c_str() + rec_offs, wsize);
+ wr_cnt += wsize;
+ }
+ rec_offs -= _txn_hdr._xidsize - wsize;
+ wsize = sizeof(_dtx_tail) > rec_offs ? sizeof(_dtx_tail) - rec_offs : 0;
+ if (wsize)
+ {
+ ::memcpy((char*)wptr + wr_cnt, (char*)&_dtx_tail + rec_offs, wsize);
+ wr_cnt += wsize;
+#ifdef RHM_CLEAN
+ ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR,
+ (size_dblks(rec_size()) * JRNL_DBLK_SIZE) -
+ (rec_offs_dblks * JRNL_DBLK_SIZE) - wr_cnt);
+#endif
+ }
+ rec_offs -= sizeof(_dtx_tail) - wsize;
+ assert(rec_offs == 0);
+ }
+ }
+ else // Start at beginning of data record
+ {
+ // Assumption: the header will always fit into the first dblk
+ ::memcpy(wptr, (void*)&_txn_hdr, sizeof(_txn_hdr));
+ wr_cnt = sizeof(_txn_hdr);
+ if (size_dblks(rec_size()) > max_size_dblks) // Split required
+ {
+ size_t wsize;
+ rem -= sizeof(_txn_hdr);
+ if (rem)
+ {
+ wsize = rem >= _txn_hdr._xidsize ? _txn_hdr._xidsize : rem;
+ ::memcpy((char*)wptr + wr_cnt, _xid.c_str(), wsize);
+ wr_cnt += wsize;
+ rem -= wsize;
+ }
+ if (rem)
+ {
+ wsize = rem >= sizeof(_dtx_tail) ? sizeof(_dtx_tail) : rem;
+ ::memcpy((char*)wptr + wr_cnt, (void*)&_dtx_tail, wsize);
+ wr_cnt += wsize;
+ rem -= wsize;
+ }
+ assert(rem == 0);
+ }
+ else // No split required
+ {
+ if (_txn_hdr._xidsize)
+ {
+ ::memcpy((char*)wptr + wr_cnt, _xid.c_str(), _txn_hdr._xidsize);
+ wr_cnt += _txn_hdr._xidsize;
+ ::memcpy((char*)wptr + wr_cnt, (void*)&_dtx_tail,
sizeof(_dtx_tail));
+ wr_cnt += sizeof(_dtx_tail);
+ }
+#ifdef RHM_CLEAN
+ ::memset((char*)wptr + wr_cnt, RHM_CLEAN_CHAR,
+ (size_dblks(rec_size()) * JRNL_DBLK_SIZE) - wr_cnt);
+#endif
+ }
+ }
+ return size_dblks(wr_cnt);
+}
+
+u_int32_t
+txn_rec::decode(hdr& h, void* rptr, u_int32_t rec_offs_dblks, u_int32_t
max_size_dblks)
+ throw (jexception)
+{
+ assert(rptr != NULL);
+ assert(max_size_dblks > 0);
+
+ size_t rd_cnt = 0;
+ if (rec_offs_dblks) // Continuation of record on new page
+ {
+ const u_int32_t hdr_xid_dblks = size_dblks(deq_hdr::size() + _txn_hdr._xidsize);
+ const u_int32_t hdr_xid_tail_dblks = size_dblks(enq_hdr::size() +
_txn_hdr._xidsize +
+ rec_tail::size());
+ const size_t rec_offs = rec_offs_dblks * JRNL_DBLK_SIZE;
+
+ if (hdr_xid_tail_dblks - rec_offs_dblks <= max_size_dblks)
+ {
+ // Remainder of xid fits within this page
+ if (rec_offs - deq_hdr::size() < _txn_hdr._xidsize)
+ {
+ // Part of xid still outstanding, copy remainder of xid and tail
+ const size_t xid_offs = rec_offs - deq_hdr::size();
+ const size_t xid_rem = _txn_hdr._xidsize - xid_offs;
+ _xid.append((char*)rptr, xid_rem);
+ rd_cnt = xid_rem;
+ ::memcpy((void*)&_dtx_tail, ((char*)rptr + rd_cnt),
sizeof(_dtx_tail));
+ chk_tail();
+ rd_cnt += sizeof(_dtx_tail);
+ }
+ else
+ {
+ // Tail or part of tail only outstanding, complete tail
+ const size_t tail_offs = rec_offs - deq_hdr::size() - _txn_hdr._xidsize;
+ const size_t tail_rem = rec_tail::size() - tail_offs;
+ ::memcpy((char*)&_dtx_tail + tail_offs, rptr, tail_rem);
+ chk_tail();
+ rd_cnt = tail_rem;
+ }
+ }
+ else if (hdr_xid_dblks - rec_offs_dblks <= max_size_dblks)
+ {
+ // Remainder of xid fits within this page, tail split
+ const size_t xid_offs = rec_offs - deq_hdr::size();
+ const size_t xid_rem = _txn_hdr._xidsize - xid_offs;
+ _xid.append((char*)rptr, xid_rem);
+ rd_cnt += xid_rem;
+ const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ if (tail_rem)
+ {
+ ::memcpy((void*)&_dtx_tail, ((char*)rptr + xid_rem), tail_rem);
+ rd_cnt += tail_rem;
+ }
+ }
+ else
+ {
+ // Remainder of xid split
+ const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE);
+ _xid.append((char*)rptr, xid_cp_size);
+ rd_cnt += xid_cp_size;
+ }
+ }
+ else // Start of record
+ {
+ // Get and check header
+ _txn_hdr._hdr.copy(h);
+ rd_cnt = sizeof(hdr);
+#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
+ rd_cnt += sizeof(u_int32_t); // Filler 0
+#endif
+ _txn_hdr._xidsize = *(size_t*)((char*)rptr + rd_cnt);
+ rd_cnt = _txn_hdr.size();
+ chk_hdr();
+ const u_int32_t hdr_xid_dblks = size_dblks(deq_hdr::size() + _txn_hdr._xidsize);
+ const u_int32_t hdr_xid_tail_dblks = size_dblks(enq_hdr::size() +
_txn_hdr._xidsize +
+ rec_tail::size());
+
+ // Check if record (header + xid + tail) fits within this page, we can check the
+ // tail before the expense of copying data to memory
+ if (hdr_xid_tail_dblks <= max_size_dblks)
+ {
+ // Entire header, xid and tail fits within this page
+ ::memcpy((void*)&_dtx_tail, (char*)rptr + rd_cnt + _txn_hdr._xidsize,
+ sizeof(_dtx_tail));
+ chk_tail();
+ _xid.assign((char*)rptr + rd_cnt, _txn_hdr._xidsize);
+ rd_cnt += _txn_hdr._xidsize + sizeof(_dtx_tail);
+ }
+ else if (hdr_xid_dblks <= max_size_dblks)
+ {
+ // Entire header and xid fit within this page, tail split
+ _xid.assign((char*)rptr + rd_cnt, _txn_hdr._xidsize);
+ rd_cnt += _txn_hdr._xidsize;
+ const size_t tail_rem = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ if (tail_rem)
+ {
+ ::memcpy((void*)&_dtx_tail, (char*)rptr + rd_cnt, tail_rem);
+ rd_cnt += tail_rem;
+ }
+ }
+ else
+ {
+ // Header fits within this page, xid split
+ const size_t xid_cp_size = (max_size_dblks * JRNL_DBLK_SIZE) - rd_cnt;
+ _xid.assign((char*)rptr + rd_cnt, xid_cp_size);
+ rd_cnt += xid_cp_size;
+ }
+ }
+ return size_dblks(rd_cnt);
+}
+
+std::string&
+txn_rec::str(std::string& str) const
+{
+ std::stringstream ss;
+ if (_txn_hdr._hdr._magic == RHM_JDAT_DTXA_MAGIC)
+ ss << "dtxa_rec: m=" << _txn_hdr._hdr._magic;
+ else
+ ss << "dtxc_rec: m=" << _txn_hdr._hdr._magic;
+ ss << " v=" << (int)_txn_hdr._hdr._version;
+ ss << " rid=" << _txn_hdr._hdr._rid;
+ ss << " xid=\"" << _xid << "\"";
+ str.append(ss.str());
+ return str;
+}
+
+const size_t
+txn_rec::xid_size() const
+{
+ return _txn_hdr._xidsize;
+}
+
+const size_t
+txn_rec::rec_size() const
+{
+ return deq_hdr::size() + _txn_hdr._xidsize + rec_tail::size();
+}
+
+void
+txn_rec::chk_hdr() const throw (jexception)
+{
+ jrec::chk_hdr(_txn_hdr._hdr);
+ if (_txn_hdr._hdr._magic != RHM_JDAT_DTXA_MAGIC && _txn_hdr._hdr._magic !=
RHM_JDAT_DTXC_MAGIC)
+ {
+ std::stringstream ss;
+ ss << std::hex << std::setfill('0');
+ ss << "dtx magic: rid=0x" << std::setw(16) <<
_txn_hdr._hdr._rid;
+ ss << ": expected=(0x" << std::setw(8) <<
RHM_JDAT_DTXA_MAGIC;
+ ss << " or 0x" << RHM_JDAT_DTXC_MAGIC;
+ ss << ") read=0x" << std::setw(2) <<
(int)_txn_hdr._hdr._magic;
+ throw jexception(jerrno::JERR_DREC_INVRHDR, ss.str(), "txn_rec",
"chk_hdr");
+ }
+}
+
+void
+txn_rec::chk_hdr(u_int64_t rid) const throw (jexception)
+{
+ chk_hdr();
+ jrec::chk_rid(_txn_hdr._hdr, rid);
+}
+
+void
+txn_rec::chk_tail() const throw (jexception)
+{
+ jrec::chk_tail(_dtx_tail, _txn_hdr._hdr);
+}
+
+} // namespace journal
+} // namespace rhm
Copied: store/trunk/cpp/lib/jrnl/txn_rec.hpp (from rev 959,
store/trunk/cpp/lib/jrnl/dtx_rec.hpp)
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_rec.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/txn_rec.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -0,0 +1,88 @@
+/**
+* \file txn_rec.hpp
+*
+* Red Hat Messaging - Message Journal
+*
+* This file contains the code for the rhm::journal::txn_rec (journal data
+* record) class. See class documentation for details.
+*
+* \author Kim van der Riet
+*
+* Copyright 2007 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#ifndef rhm_journal_txn_rec_hpp
+#define rhm_journal_txn_rec_hpp
+
+namespace rhm
+{
+namespace journal
+{
+class txn_rec;
+}
+}
+
+#include <jrnl/jrec.hpp>
+
+namespace rhm
+{
+namespace journal
+{
+
+ /**
+ * \class txn_rec
+ * \brief Class to handle a single journal DTX commit or abort record.
+ */
+ class txn_rec : public jrec
+ {
+ private:
+ txn_hdr _txn_hdr; ///< transaction header
+ std::string _xid; ///< XID
+ rec_tail _dtx_tail; ///< Record tail
+
+ public:
+ txn_rec();
+ txn_rec(const u_int32_t magic, const u_int64_t rid);
+ txn_rec(const u_int32_t magic, const u_int64_t rid, const std::string& xid);
+ ~txn_rec();
+
+ void reset(const u_int64_t rid);
+ void reset(const u_int64_t rid, const std::string& xid);
+ u_int32_t encode(void* wptr, u_int32_t rec_offs_dblks, u_int32_t max_size_dblks)
+ throw (jexception);
+ u_int32_t decode(hdr& h, void* rptr, u_int32_t rec_offs_dblks, u_int32_t
max_size_dblks)
+ throw (jexception);
+ std::string& str(std::string& str) const;
+ inline const size_t data_size() const { return 0; } // This record never carries
data
+ const size_t xid_size() const;
+ const size_t rec_size() const;
+
+ private:
+ void chk_hdr() const throw (jexception);
+ void chk_hdr(u_int64_t rid) const throw (jexception);
+ void chk_tail() const throw (jexception);
+ }; // class txn_rec
+
+} // namespace journal
+} // namespace rhm
+
+#endif // ifndef rhm_journal_txn_rec_hpp
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -86,11 +86,14 @@
}
const iores
-wmgr::enqueue(const void* const data_buff, const size_t tot_data_len,
- const size_t /*this_data_len*/, data_tok* dtokp, const bool transient)
+wmgr::enqueue(const void* const data_buff, const size_t tot_data_len, const size_t
this_data_len,
+ data_tok* dtokp, const void* const xid_ptr, const size_t xid_len, const bool
transient)
throw (jexception)
{
- if (transient)
+ if (xid_len)
+ assert(xid_ptr != NULL);
+
+ if (this_data_len != tot_data_len)
return RHM_IORES_NOTIMPL;
if (_deq_busy)
@@ -124,7 +127,7 @@
else
rid = cont ? _wrfc.rid() - 1 : _wrfc.get_incr_rid();
- _enq_rec.reset(rid, data_buff, tot_data_len);
+ _enq_rec.reset(rid, data_buff, tot_data_len, xid_ptr, xid_len, transient);
if (!cont)
dtokp->set_rid(rid);
bool done = false;
@@ -216,16 +219,11 @@
}
const iores
-wmgr::enqueue_tx(const void* const /*data_buff*/, const size_t /*tot_data_len*/,
- const size_t /*this_data_len*/, data_tok* /*dtokp*/, const std::string&
/*xid*/,
- const bool /*transient*/) throw (jexception)
+wmgr::dequeue(data_tok* dtokp, const void* const xid_ptr, const size_t xid_len) throw
(jexception)
{
- return RHM_IORES_NOTIMPL;
-}
+ if (xid_len)
+ assert(xid_ptr != NULL);
-const iores
-wmgr::dequeue(data_tok* dtokp) throw (jexception)
-{
if (_enq_busy)
return RHM_IORES_BUSY;
@@ -342,57 +340,10 @@
if (dtokp->wstate() >= data_tok::DEQ_SUBM)
_deq_busy = false;
-// iores res = pre_write_check(false, dtokp);
-// if (res != RHM_IORES_SUCCESS)
-// return res;
-//
-// u_int64_t rid;
-//
-// if (dtokp->getSourceMessage())
-// {
-// rid = dtokp->dequeue_rid();
-// assert(rid != 0);
-// }
-// else
-// rid = _wrfc.get_incr_rid();
-//
-// //***
-// // NOTE: ASSUMPTION: sizeof(deq_hdr) <= JRNL_DBLK_SIZE
-// // This encoding is a simplification: it assumes deq_hdr (currently 20 bytes) fits
inside
-// // one dblk. The dblk is a tunable parameter, but is unlikely to go lower than
deq_hdr
-// // (currently dblk = 128 bytes). JRNL_DBLK_SIZE must be a power of 2.
-// // IF JRNL_DBLK_SIZE IS SET TO < 32 (i.e. 16 OR LESS) BYTES, THIS ENCODING WILL
FAIL!
-// //***
-// deq_hdr dhdr(RHM_JDAT_DEQ_MAGIC, rid, dtokp->rid(), 0, RHM_JDAT_VERSION);
-// void* wptr = (void*)((char*)_page_ptr_arr[_pg_index] + _pg_offset_dblks *
JRNL_DBLK_SIZE);
-// ::memcpy(wptr, &dhdr, sizeof(dhdr));
-// #ifdef RHM_CLEAN
-// ::memset((char*)wptr + sizeof(dhdr), RHM_CLEAN_CHAR, JRNL_DBLK_SIZE -
sizeof(dhdr));
-// #endif
-// #if !(defined RHM_WRONLY || defined RHM_RDONLY)
-// u_int16_t fid = _emap.get_remove_fid(dtokp->rid());
-// _wrfc.decr_enqcnt(fid);
-// #endif
-// _pg_offset_dblks++;
-// _cached_offset_dblks++;
-// // TODO: Incorrect - must set state to DEQ_CACHED; DEQ_SUBM is set when AIO
returns.
-// dtokp->set_wstate(data_tok::DEQ_SUBM);
-// _page_cb_arr[_pg_index]._pdtokl->push_back(dtokp);
-// if (_wrfc.empty()) // Has the file_hdr been written?
-// write_fhdr(rid, _wrfc.index(), JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
-// if (_pg_offset_dblks >= JRNL_WMGR_PAGE_SIZE * JRNL_SBLK_SIZE)
-// res = flush();
-
return res;
}
const iores
-wmgr::dequeue_tx(data_tok* /*dtokp*/, const std::string& /*xid*/) throw (jexception)
-{
- return RHM_IORES_NOTIMPL;
-}
-
-const iores
wmgr::flush()
{
iores res = write_flush();
@@ -626,7 +577,7 @@
void
wmgr::write_fhdr(u_int64_t rid, u_int32_t fid, size_t fro) throw (jexception)
{
- file_hdr fhdr(RHM_JDAT_FILE_MAGIC, rid, fid, fro, true, RHM_JDAT_VERSION);
+ file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, 0, rid, fid, fro, true);
::memcpy(_fhdr_buff, &fhdr, sizeof(fhdr));
#ifdef RHM_CLEAN
::memset((char*)_fhdr_buff + sizeof(fhdr), RHM_CLEAN_CHAR, _sblksize -
sizeof(fhdr));
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -88,13 +88,10 @@
void initialize(std::deque<data_tok*>* const dtokl, aio_cb wr_cb,
const u_int32_t max_dtokpp, const u_int32_t max_iowait_us) throw
(jexception);
const iores enqueue(const void* const data_buff, const size_t tot_data_len,
- const size_t this_data_len, data_tok* dtokp, const bool transient)
+ const size_t this_data_len, data_tok* dtokp, const void* const xid_ptr,
+ const size_t xid_len, const bool transient) throw (jexception);
+ const iores dequeue(data_tok* dtokp, const void* const xid_ptr, const size_t
xid_len)
throw (jexception);
- const iores enqueue_tx(const void* const data_buff, const size_t tot_data_len,
- const size_t this_data_len, data_tok* dtokp, const std::string& xid,
- const bool transient) throw (jexception);
- const iores dequeue(data_tok* dtokp) throw (jexception);
- const iores dequeue_tx(data_tok* dtokp, const std::string& xid) throw
(jexception);
const iores flush();
const u_int32_t get_events(page_state state) throw (jexception);
Modified: store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -573,151 +573,153 @@
void EncodeTest_000()
{
- runEncodeTest(0, 0, 0, false, 2, "Empty journal");
+ runEncodeTest(0, 0, 0, false, 0, 0, false, 2, "Empty journal");
}
void EncodeTest_001()
{
- runEncodeTest(1, 10, 10, false, 2, "1*(10 bytes)");
+ runEncodeTest(1, 10, 10, false, 0, 0, false, 2, "1*(10 bytes)");
}
void EncodeTest_002()
{
- runEncodeTest(1, 10, 10, true, 2, "1*(10 bytes), auto-deq");
+ runEncodeTest(1, 10, 10, true, 0, 0, false, 2, "1*(10 bytes),
auto-deq");
}
void EncodeTest_003()
{
- runEncodeTest(10, 10, 10, false, 2, "10*(10 bytes)");
+ runEncodeTest(10, 10, 10, false, 0, 0, false, 2, "10*(10 bytes)");
}
void EncodeTest_004()
{
- runEncodeTest(10, 10, 10, true, 2, "10*(10 bytes), auto-deq");
+ runEncodeTest(10, 10, 10, true, 0, 0, false, 2, "10*(10 bytes),
auto-deq");
}
void EncodeTest_005()
{
- runEncodeTest(10, 92, 92, false, 2, "10*(1 dblk exact fit)");
+ runEncodeTest(10, 92, 92, false, 0, 0, false, 2, "10*(1 dblk exact
fit)");
}
void EncodeTest_006()
{
- runEncodeTest(10, 92, 92, true, 2, "10*(1 dblk exact fit), auto-deq");
+ runEncodeTest(10, 92, 92, true, 0, 0, false, 2, "10*(1 dblk exact fit),
auto-deq");
}
void EncodeTest_007()
{
- runEncodeTest(10, 93, 93, false, 2, "10*(1 dblk + 1 byte)");
+ runEncodeTest(10, 93, 93, false, 0, 0, false, 2, "10*(1 dblk + 1
byte)");
}
void EncodeTest_008()
{
- runEncodeTest(10, 93, 93, true, 2, "10*(1 dblk + 1 byte), auto-deq");
+ runEncodeTest(10, 93, 93, true, 0, 0, false, 2, "10*(1 dblk + 1 byte),
auto-deq");
}
void EncodeTest_009()
{
- runEncodeTest(10, 476, 476, false, 2, "10*(1 sblk exact fit)");
+ runEncodeTest(10, 476, 476, false, 0, 0, false, 2, "10*(1 sblk exact
fit)");
}
void EncodeTest_010()
{
- runEncodeTest(10, 476, 476, true, 2, "10*(1 sblk exact fit),
auto-deq");
+ runEncodeTest(10, 476, 476, true, 0, 0, false, 2, "10*(1 sblk exact fit),
auto-deq");
}
void EncodeTest_011()
{
- runEncodeTest(10, 477, 477, false, 2, "10*(1 sblk + 1 byte)");
+ runEncodeTest(10, 477, 477, false, 0, 0, false, 2, "10*(1 sblk + 1
byte)");
}
void EncodeTest_012()
{
- runEncodeTest(10, 477, 477, true, 2, "10*(1 sblk + 1 byte),
auto-deq");
+ runEncodeTest(10, 477, 477, true, 0, 0, false, 2, "10*(1 sblk + 1 byte),
auto-deq");
}
void EncodeTest_013()
{
- runEncodeTest(8, 4060, 4060, false, 2, "8*(1/8 page)");
+ runEncodeTest(8, 4060, 4060, false, 0, 0, false, 2, "8*(1/8 page)");
}
void EncodeTest_014()
{
- runEncodeTest(9, 4060, 4060, false, 2, "9*(1/8 page)");
+ runEncodeTest(9, 4060, 4060, false, 0, 0, false, 2, "9*(1/8 page)");
}
void EncodeTest_015()
{
- runEncodeTest(8, 4061, 4061, false, 2, "8*(1/8 page + 1 byte)");
+ runEncodeTest(8, 4061, 4061, false, 0, 0, false, 2, "8*(1/8 page + 1
byte)");
}
void EncodeTest_016()
{
- runEncodeTest(8, 3932, 3932, true, 2, "8*(1/8 page - 1 dblk for deq record),
auto-deq");
+ runEncodeTest(8, 3932, 3932, true, 0, 0, false, 2,
+ "8*(1/8 page - 1 dblk for deq record), auto-deq");
}
void EncodeTest_017()
{
- runEncodeTest(9, 3932, 3932, true, 2, "9*(1/8 page - 1 dblk for deq record),
auto-deq");
+ runEncodeTest(9, 3932, 3932, true, 0, 0, false, 2,
+ "9*(1/8 page - 1 dblk for deq record), auto-deq");
}
void EncodeTest_018()
{
- runEncodeTest(8, 3933, 3933, true, 2,
+ runEncodeTest(8, 3933, 3933, true, 0, 0, false, 2,
"8*(1/8 page - 1 dblk for deq record + 1 byte), auto-deq");
}
void EncodeTest_019()
{
- runEncodeTest(32, 32732, 32732, false, 2, "32*(1 page exact fit)");
+ runEncodeTest(32, 32732, 32732, false, 0, 0, false, 2, "32*(1 page exact
fit)");
}
void EncodeTest_020()
{
- runEncodeTest(33, 32732, 32732, false, 2, "33*(1 page exact fit)");
+ runEncodeTest(33, 32732, 32732, false, 0, 0, false, 2, "33*(1 page exact
fit)");
}
void EncodeTest_021()
{
- runEncodeTest(22, 49116, 49116, false, 2, "22*(1.5 pages)");
+ runEncodeTest(22, 49116, 49116, false, 0, 0, false, 2, "22*(1.5
pages)");
}
void EncodeTest_022()
{
- runEncodeTest(22, 48988, 48988, true, 2,
+ runEncodeTest(22, 48988, 48988, true, 0, 0, false, 2,
"22*(1.5 pages - 1 dblk for deq record), auto-deq");
}
void EncodeTest_023()
{
- runEncodeTest(48, 32732, 32732, false, 2, "48*(1 page exact fit)");
+ runEncodeTest(48, 32732, 32732, false, 0, 0, false, 2, "48*(1 page exact
fit)");
}
void EncodeTest_024()
{
- runEncodeTest(49, 32732, 32732, false, 2, "49*(1 page exact fit)");
+ runEncodeTest(49, 32732, 32732, false, 0, 0, false, 2, "49*(1 page exact
fit)");
}
void EncodeTest_025()
{
- runEncodeTest(20, 81884, 81884, false, 2, "20*(2.5 pages)");
+ runEncodeTest(20, 81884, 81884, false, 0, 0, false, 2, "20*(2.5
pages)");
}
void EncodeTest_026()
{
- runEncodeTest(20, 81756, 81756, true, 2,
+ runEncodeTest(20, 81756, 81756, true, 0, 0, false, 2,
"20*(2.5 pages - 1 dblk for deq record), auto-deq");
}
void EncodeTest_027()
{
- runEncodeTest(16, 786268, 786268, true, 2,
+ runEncodeTest(16, 786268, 786268, true, 0, 0, false, 2,
"16*(24 pages = 1/2 file); Total = 8 files exactly (full journal
filespace)");
}
void EncodeTest_028()
{
- runEncodeTest(17, 786268, 786268, true, 2,
+ runEncodeTest(17, 786268, 786268, true, 0, 0, false, 2,
"17*(24 pages = 1/2 file); Total = 8 files + file 0 overwritten by
1/2 file");
}
@@ -807,11 +809,13 @@
}
void runEncodeTest(const unsigned num_msgs, const unsigned min_msg_size,
- const unsigned max_msg_szie, const bool auto_deq, const unsigned iterations,
+ const unsigned max_msg_szie, const bool auto_deq, const unsigned
min_xid_size,
+ const unsigned max_xid_size, const bool transient, const unsigned
iterations,
const char* test_descr)
{
std::cout << " [" << test_descr << "] "
<< std::flush;
- jtest::targs ta(num_msgs, min_msg_size, max_msg_szie, auto_deq, test_descr);
+ jtest::targs ta(num_msgs, min_msg_size, max_msg_szie, auto_deq, min_xid_size,
+ max_xid_size, transient, test_descr);
for (unsigned i=0; i<iterations; i++)
{
std::cout << "." << std::flush;
Modified: store/trunk/cpp/tests/jrnl/Makefile.rtest
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/Makefile.rtest 2007-10-02 20:45:10 UTC (rev 960)
@@ -58,7 +58,7 @@
jrec.o \
enq_rec.o \
deq_rec.o \
- dtx_rec.o \
+ txn_rec.o \
nlfh.o \
lfh.o \
rrfc.o \
Modified: store/trunk/cpp/tests/jrnl/janalyze.py
===================================================================
--- store/trunk/cpp/tests/jrnl/janalyze.py 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/janalyze.py 2007-10-02 20:45:10 UTC (rev 960)
@@ -31,6 +31,8 @@
num_files = 8
hdr_ver = 1
+transient_mask = 0x1
+
def load(f, klass):
args = load_args(f, klass)
subclass = klass.descriminate(args)
@@ -347,6 +349,7 @@
def __init__(self, tfile, tnum):
if tfile != None:
+ self.tnum = tnum
tparams = self.get_test(tfile, tnum)
if tparams == None:
raise Exception('Test %d not found in file %s' % (tnum, tfile))
@@ -356,10 +359,18 @@
else:
self.msg_len = 0
self.auto_deq = tparams['auto_deq']
+ if tparams['xid_min_size'] == tparams['xid_max_size']:
+ self.xid_len = tparams['xid_max_size']
+ else:
+ self.xid_len = 0
+ self.transient = tparams['transient']
else:
+ self.tnum = None
self.num_msgs = 0
self.msg_len = 0
self.auto_deq = False
+ self.xid_len = 0
+ self.transient = False
self.file_start = 0
self.file_num = 0
self.fro = 0x200
@@ -407,7 +418,15 @@
break
hdr.load(self.f)
if self.msg_len > 0 and len(hdr.data) != self.msg_len:
- raise Exception('Message length (%d) incorrect: expected %d'
% (len(hdr.data), self.msg_len))
+ raise Exception('Message length (%d) incorrect; expected %d'
% (len(hdr.data), self.msg_len))
+ if self.xid_len > 0 and len(hdr.xid) != self.xid_len:
+ raise Exception('XID length (%d) incorrect; expected %d' %
(len(hdr.xidsize), self.xid_len))
+ if self.transient:
+ if hdr.flags & transient_mask == 0:
+ raise Exception('Expected transient record, found
persistent')
+ else:
+ if hdr.flags & transient_mask != 0:
+ raise Exception('Expected persistent record, found
transient')
stop = not self.check_rid(hdr)
if stop:
warn = ' (WARNING: rid out of order, last rid = %d - could be
overwrite boundary.)' % hdr.rid
@@ -424,7 +443,7 @@
stop = not self.check_rid(hdr)
if stop:
warn = ' (WARNING: rid out of order, last rid = %d - could be
overwrite boundary.)' % hdr.rid
- else:
+ elif self.tnum != None:
warn = 'WARNING: Dequeue record rid=%d found in non-dequeue test
- ignoring.' % hdr.rid
print ' > %s%s' % (hdr, warn)
if not stop:
@@ -487,7 +506,10 @@
return { 'num_msgs':int(sl[1]),
'min_size':int(sl[2]),
'max_size':int(sl[3]),
- 'auto_deq':sl[4] != 'FALSE' }
+ 'auto_deq':sl[4] != 'FALSE',
+ 'xid_min_size':int(sl[5]),
+ 'xid_max_size':int(sl[6]),
+ 'transient':sl[7] != 'FALSE' }
except Exception:
pass
return None
Modified: store/trunk/cpp/tests/jrnl/jtest.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtest.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/jtest.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -76,15 +76,22 @@
_min_msg_size(0),
_max_msg_size(0),
_auto_deq(false),
+ _min_xid_size(0),
+ _max_xid_size(0),
+ _transient(false),
_comment(NULL)
{}
-jtest::targs::targs(const u_int32_t num_msgs, const size_t min_msg_size, const size_t
max_msg_size, const bool auto_deq,
- const char* comment):
+jtest::targs::targs(const u_int32_t num_msgs, const size_t min_msg_size, const size_t
max_msg_size,
+ const bool auto_deq, const size_t min_xid_size, const size_t max_xid_size,
+ const bool transient, const char* comment):
_num_msgs(num_msgs),
_min_msg_size(min_msg_size),
_max_msg_size(max_msg_size),
_auto_deq(auto_deq),
+ _min_xid_size(min_xid_size),
+ _max_xid_size(max_xid_size),
+ _transient(transient),
_comment(comment)
{}
@@ -126,8 +133,9 @@
#endif
p_args = new msg_producer::_p_args(_jc, ta._num_msgs, ta._min_msg_size,
ta._max_msg_size,
- ta._auto_deq);
- c_args = new msg_consumer::_c_args(_jc, ta._num_msgs, ta._min_msg_size,
ta._max_msg_size);
+ ta._auto_deq, ta._min_xid_size, ta._max_xid_size, ta._transient);
+ c_args = new msg_consumer::_c_args(_jc, ta._num_msgs, ta._min_msg_size,
ta._max_msg_size,
+ ta._min_xid_size, ta._max_xid_size, ta._transient);
#ifndef RHM_RDONLY
_mp.initialize(p_args);
@@ -371,8 +379,11 @@
tap->_min_msg_size = atol(toks[2]);
tap->_max_msg_size = atol(toks[3]);
tap->_auto_deq = strcmp(toks[4], "FALSE") != 0;
- if (toks.size() > 5)
- tap->_comment = toks[5];
+ tap->_min_xid_size = atol(toks[5]);
+ tap->_max_xid_size = atol(toks[6]);
+ tap->_transient = strcmp(toks[7], "FALSE") != 0;
+ if (toks.size() > 8)
+ tap->_comment = toks[8];
else
tap->_comment = NULL;
std::cout << "Test " << tnum << ":
Messages=" << tap->_num_msgs << " Size=" <<
@@ -382,6 +393,15 @@
else
std::cout << " - " << tap->_max_msg_size
<< " (random)";
std::cout << (tap->_auto_deq ? " auto-dequeue" :
" no dequeue");
+ if (tap->_max_xid_size > 0)
+ {
+ std::cout << " XID_size=" <<
tap->_min_xid_size;
+ if (tap->_min_xid_size == tap->_max_xid_size)
+ std::cout << " (fixed)";
+ else
+ std::cout << " - " << tap->_max_xid_size
<< " (random)";
+ }
+ std::cout << (tap->_transient ? " transient" : "
persistent");
if (tap->_comment)
std::cout << " [" << tap->_comment <<
"]";
std::cout << std::endl;
Modified: store/trunk/cpp/tests/jrnl/jtest.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtest.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/jtest.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -53,10 +53,14 @@
size_t _min_msg_size;
size_t _max_msg_size;
bool _auto_deq;
+ size_t _min_xid_size;
+ size_t _max_xid_size;
+ bool _transient;
const char* _comment;
targs();
- targs(const u_int32_t num_msgs, const size_t min_msg_size, const size_t
max_msg_size, const bool auto_deq = false,
- const char* comment = NULL);
+ targs(const u_int32_t num_msgs, const size_t min_msg_size, const size_t
max_msg_size,
+ const bool auto_deq, const size_t min_xid_size, const size_t
max_xid_size,
+ const bool transient, const char* comment = NULL);
};
private:
Modified: store/trunk/cpp/tests/jrnl/msg_consumer.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/msg_consumer.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/msg_consumer.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -37,12 +37,16 @@
#define EXCEPTION_BASE 0x40
-msg_consumer::_c_args::_c_args(rhm::journal::jcntl& jc, u_int32_t num_msgs, size_t
min_msg_size,
- size_t max_msg_size):
+msg_consumer::_c_args::_c_args(rhm::journal::jcntl& jc, const u_int32_t num_msgs,
+ const size_t min_msg_size, const size_t max_msg_size, const size_t
min_xid_size,
+ const size_t max_xid_size, const bool transient):
_jc(jc),
_num_msgs(num_msgs),
_min_msg_size(min_msg_size),
_max_msg_size(max_msg_size),
+ _min_xid_size(min_xid_size),
+ _max_xid_size(max_xid_size),
+ _transient(transient),
_err(0)
{}
@@ -90,7 +94,8 @@
u_int32_t
msg_consumer::consume(rhm::journal::jcntl& _jcntl, const u_int32_t num_msgs,
- const size_t min_msg_size, const size_t max_msg_size) throw
(rhm::journal::jexception)
+ const size_t min_msg_size, const size_t max_msg_size, const size_t
/*min_xid_size*/,
+ const size_t /*max_xid_size*/, const bool /*transient*/) throw
(rhm::journal::jexception)
{
//std::cout << "msg_consumer::consume() num_msgs=" << num_msgs
<< std::endl;
size_t data_size;
@@ -181,7 +186,8 @@
u_int32_t
msg_consumer::consume(_c_args* args) throw (rhm::journal::jexception)
{
- return consume(args->_jc, args->_num_msgs, args->_min_msg_size,
args->_max_msg_size);
+ return consume(args->_jc, args->_num_msgs, args->_min_msg_size,
args->_max_msg_size,
+ args->_min_xid_size, args->_max_xid_size, args->_transient);
}
void
Modified: store/trunk/cpp/tests/jrnl/msg_consumer.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/msg_consumer.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/msg_consumer.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -49,9 +49,13 @@
u_int32_t _num_msgs;
size_t _min_msg_size;
size_t _max_msg_size;
+ size_t _min_xid_size;
+ size_t _max_xid_size;
+ bool _transient;
u_int32_t _err;
- _c_args(rhm::journal::jcntl& jc, u_int32_t num_msgs, size_t min_msg_size,
- size_t max_msg_size);
+ _c_args(rhm::journal::jcntl& jc, const u_int32_t num_msgs, const size_t
min_msg_size,
+ const size_t max_msg_size, const size_t min_xid_size, const size_t
max_xid_size,
+ const bool transient);
};
static const char* iores_str[];
@@ -76,7 +80,8 @@
void finalize();
u_int32_t consume(rhm::journal::jcntl& _jcntl, const u_int32_t numMsgs,
- const size_t min_msg_size, const size_t max_msg_size) throw
(rhm::journal::jexception);
+ const size_t min_msg_size, const size_t max_msg_size, const size_t
min_xid_size,
+ const size_t max_xid_size, const bool transient) throw
(rhm::journal::jexception);
u_int32_t consume(_c_args* args) throw (rhm::journal::jexception);
void aio_callback(rhm::journal::jcntl* jc, u_int32_t num_dtoks);
Modified: store/trunk/cpp/tests/jrnl/msg_producer.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/msg_producer.cpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/msg_producer.cpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -36,12 +36,16 @@
#define EXCEPTION_BASE 0x50
msg_producer::_p_args::_p_args(rhm::journal::jcntl& jc, u_int32_t num_msgs,
- size_t min_msg_size, size_t max_msg_size, bool auto_dequeue):
+ size_t min_msg_size, size_t max_msg_size, bool auto_dequeue, size_t
min_xid_size,
+ size_t max_xid_size, bool transient):
_jc(jc),
_num_msgs(num_msgs),
_min_msg_size(min_msg_size),
_max_msg_size(max_msg_size),
_auto_dequeue(auto_dequeue),
+ _min_xid_size(min_xid_size),
+ _max_xid_size(max_xid_size),
+ _transient(transient),
_err(0)
{}
@@ -58,6 +62,7 @@
{
instance_cnt++;
init_msg_buff();
+ init_xid_buff();
_aio_cmpl_dtok_list.clear();
_dd_dtok_list.clear();
}
@@ -104,8 +109,9 @@
}
u_int32_t
-msg_producer::produce(rhm::journal::jcntl& jc, const size_t minMsgSize,
- const size_t maxMsgSize) throw (rhm::journal::jexception)
+msg_producer::produce(rhm::journal::jcntl& jc, const size_t minMsgSize, const size_t
maxMsgSize,
+ const size_t minXidSize, const size_t maxXidSize, const bool transient)
+ throw (rhm::journal::jexception)
{
_jcptr = &jc;
if (!_num_msgs)
@@ -113,25 +119,40 @@
if (maxMsgSize > _msg_buff_size)
throw rhm::journal::jexception(EXCEPTION_BASE+0,
"Message size exceeds internal buffer limit",
"msg_producer", "produce");
+ if (maxXidSize > _xid_buff_size)
+ throw rhm::journal::jexception(EXCEPTION_BASE+1,
+ "XID size exceeds internal buffer limit",
"msg_producer", "produce");
+
{
//std::cout << "[" << _num_msgs << "]" <<
std::flush;
for(u_int32_t msgCntr = 0; msgCntr < _num_msgs && !_interrupt_flag;
msgCntr++)
{
unsigned aio_sleep_cnt = 0;
unsigned jfull_sleep_cnt = 0;
+ size_t xid_size = maxXidSize;
+ if (minXidSize < maxXidSize)
+ {
+ size_t sizeRange = maxXidSize - minXidSize + 1;
+ xid_size = minXidSize + (int)(1.0*rand()*sizeRange/(RAND_MAX + 1.0));
+ }
+ const std::string xid((char*)_xid_buff + (msgCntr%26), xid_size);
size_t size = maxMsgSize;
if (minMsgSize < maxMsgSize)
{
size_t sizeRange = maxMsgSize - minMsgSize + 1;
size = minMsgSize + (int)(1.0*rand()*sizeRange/(RAND_MAX + 1.0));
}
+ const void* const msg = (char*)_msg_buff + (msgCntr%10);
rhm::journal::data_tok* dtokp = _dtok_master_list[msgCntr];
- const void* const msg = (char*)_msg_buff + (msgCntr%10);
//std::cout << " E" << dtokp->id() << /*"-"
<< dtokp->wstate_str() <<*/ " " << std::flush;
bool written = false;
while (!written)
{
- rhm::journal::iores eres = jc.enqueue_data_record(msg, size, size, dtokp,
false);
+ rhm::journal::iores eres;
+ if (maxXidSize)
+ eres = jc.enqueue_txn_data_record(msg, size, size, dtokp, xid,
transient);
+ else
+ eres = jc.enqueue_data_record(msg, size, size, dtokp, transient);
rhm::journal::data_tok::write_state ws = dtokp->wstate();
const char* wsstr = dtokp->wstate_str();
switch (eres)
@@ -154,7 +175,7 @@
dtokp->id() << " ws=" <<
wsstr << " eres=" << iores_str[eres] <<
std::flush;
if (aio_sleep_cnt >= MAX_AIO_SLEEPS)
- throw rhm::journal::jexception(EXCEPTION_BASE+1,
+ throw rhm::journal::jexception(EXCEPTION_BASE+2,
"Page cache full (AIO events outstanding for all
pages); "
"exceeced wait time for pages to free.",
"msg_producer",
"produce");
@@ -172,7 +193,7 @@
std::cout << "WARNING: Journal full."
<< std::flush;
}
if (jfull_sleep_cnt >= MAX_FULL_SLEEPS)
- throw rhm::journal::jexception(EXCEPTION_BASE+2,
+ throw rhm::journal::jexception(EXCEPTION_BASE+3,
"Journal full (next file to write still has
undequeued data); "
"exceeded wait time for journal to free.",
"msg_producer",
"produce");
@@ -184,6 +205,9 @@
std::cout << "msg_producer::produce() Unexpected msg
state: id=" <<
dtokp->id() << " ws=" << wsstr
<< " eres=" << iores_str[eres] <<
std::flush;
+ throw rhm::journal::jexception(EXCEPTION_BASE+4,
+ "Unknown return from enqueue() or
enqueue_tx()", "msg_producer",
+ "produce");
}
//print_dbug(msgCntr, size, (char*)msg, true);
@@ -199,7 +223,7 @@
while (!_dd_dtok_list.empty() && !_interrupt_flag)
{
if (++cnt > 10000)
- throw rhm::journal::jexception(EXCEPTION_BASE+3,
+ throw rhm::journal::jexception(EXCEPTION_BASE+5,
"Timeout waiting for all messages to be read.",
"msg_producer",
"produce");
usleep(1000);
@@ -223,7 +247,8 @@
u_int32_t
msg_producer::produce(_p_args* args) throw (rhm::journal::jexception)
{
- return produce(args->_jc, args->_min_msg_size, args->_max_msg_size);
+ return produce(args->_jc, args->_min_msg_size, args->_max_msg_size,
args->_min_xid_size,
+ args->_max_xid_size, args->_transient);
}
void
@@ -263,6 +288,13 @@
}
void
+msg_producer::init_xid_buff()
+{
+ for (unsigned int i=0; i<_xid_buff_size; i++)
+ _xid_buff[i] = 'a' + i%26;
+}
+
+void
msg_producer::send_deferred_dequeues(rhm::journal::jcntl& jc)
{
std::deque<rhm::journal::data_tok*>::iterator ditr = _dd_dtok_list.begin();
@@ -290,7 +322,7 @@
break;
case rhm::journal::RHM_IORES_AIO_WAIT:
if (aio_sleep_cnt >= MAX_AIO_SLEEPS)
- throw rhm::journal::jexception(EXCEPTION_BASE+4,
+ throw rhm::journal::jexception(EXCEPTION_BASE+6,
"Page cache full (AIO events outstanding for all
pages); "
"exceeced wait time for pages to free.",
"msg_producer",
"send_deferred_dequeues");
@@ -329,7 +361,7 @@
std::stringstream ss;
ss << "Journal flush phase 1 failed, _num_msgs_enq="
<< _num_msgs_enq;
ss << " num_msgs_sent=" << num_msgs_sent;
- throw rhm::journal::jexception(EXCEPTION_BASE+5, ss.str(),
"msg_producer",
+ throw rhm::journal::jexception(EXCEPTION_BASE+7, ss.str(),
"msg_producer",
"jrnl_flush");
}
//std::cout << "+" << std::flush;
@@ -348,7 +380,7 @@
while (!_dd_dtok_list.empty() && !_interrupt_flag)
{
if (++cnt > 10000)
- throw rhm::journal::jexception(EXCEPTION_BASE+6,
+ throw rhm::journal::jexception(EXCEPTION_BASE+8,
"Timeout waiting for all messages to be read.",
"msg_producer",
"jrnl_flush");
usleep(1000);
@@ -368,7 +400,7 @@
std::stringstream ss;
ss << "Journal flush phase 2 failed, _num_msgs_deq="
<< _num_msgs_deq;
ss << " num_msgs_sent=" << num_msgs_sent;
- throw rhm::journal::jexception(EXCEPTION_BASE+7, ss.str(),
"msg_producer",
+ throw rhm::journal::jexception(EXCEPTION_BASE+9, ss.str(),
"msg_producer",
"jrnl_flush");
}
//std::cout << "*" << std::flush;
@@ -417,11 +449,15 @@
"RHM_IORES_AIO_WAIT",
"RHM_IORES_EMPTY",
"RHM_IORES_FULL",
- "RHM_IORES_BUSY"
+ "RHM_IORES_BUSY",
+ "RHM_IORES_TXPENDING",
+ "RHM_IORES_NOTIMPL"
};
u_int16_t msg_producer::instance_cnt = 0;
const size_t msg_producer::_msg_buff_size = JRNL_DBLK_SIZE * JRNL_SBLK_SIZE *
JRNL_FILE_SIZE * JRNL_NUM_FILES;
+const size_t msg_producer::_xid_buff_size = JRNL_DBLK_SIZE * JRNL_SBLK_SIZE *
JRNL_FILE_SIZE * JRNL_NUM_FILES;
char msg_producer::_msg_buff[msg_producer::_msg_buff_size];
+char msg_producer::_xid_buff[msg_producer::_xid_buff_size];
bool msg_producer::_interrupt_flag = false;
Modified: store/trunk/cpp/tests/jrnl/msg_producer.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/msg_producer.hpp 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/msg_producer.hpp 2007-10-02 20:45:10 UTC (rev 960)
@@ -50,9 +50,13 @@
size_t _min_msg_size;
size_t _max_msg_size;
bool _auto_dequeue;
+ size_t _min_xid_size;
+ size_t _max_xid_size;
+ bool _transient;
u_int32_t _err;
_p_args(rhm::journal::jcntl& jc, u_int32_t num_msgs, size_t min_msg_size,
- size_t max_msg_size, bool auto_dequeue);
+ size_t max_msg_size, bool auto_dequeue, size_t min_xid_size,
+ size_t max_xid_size, bool transient);
};
static const char* iores_str[];
@@ -61,6 +65,8 @@
static u_int16_t instance_cnt;
static const size_t _msg_buff_size;
static char _msg_buff[];
+ static const size_t _xid_buff_size;
+ static char _xid_buff[];
static bool _interrupt_flag;
rhm::journal::jcntl* _jcptr;
u_int32_t _num_msgs;
@@ -83,7 +89,8 @@
void initialize(_p_args* args);
void finalize();
- u_int32_t produce(rhm::journal::jcntl& jc, const size_t minMsgSize, const size_t
maxMsgSize)
+ u_int32_t produce(rhm::journal::jcntl& jc, const size_t minMsgSize, const size_t
maxMsgSize,
+ const size_t minXidSize, const size_t maxXidSize, const bool transient)
throw (rhm::journal::jexception);
u_int32_t produce(_p_args* args) throw (rhm::journal::jexception);
void aio_callback(rhm::journal::jcntl* jc, u_int32_t num_dtoks);
@@ -95,6 +102,7 @@
private:
void init_msg_buff();
+ void init_xid_buff();
void send_deferred_dequeues(rhm::journal::jcntl& jc);
void jrnl_flush(rhm::journal::jcntl& jc, u_int32_t num_msgs_sent);
void print_dbug(u_int32_t msg_cnt, size_t msg_size, char* _msg_buff, bool show_msg =
false) const;
Modified: store/trunk/cpp/tests/jrnl/rtest
===================================================================
--- store/trunk/cpp/tests/jrnl/rtest 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/rtest 2007-10-02 20:45:10 UTC (rev 960)
@@ -36,7 +36,7 @@
W_DO_TEST=T
W_TEST_FILE=wtests.csv
W_TEST_START=0
-W_TEST_STOP=67
+W_TEST_STOP=99
W_NITER=5
# Read test
Modified: store/trunk/cpp/tests/jrnl/rtests.csv
===================================================================
--- store/trunk/cpp/tests/jrnl/rtests.csv 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/rtests.csv 2007-10-02 20:45:10 UTC (rev 960)
@@ -1,72 +1,72 @@
-"Initialize only",,,,,,
-0,0,0,0,FALSE,,"No messages"
-,,,,,,
-"Within first block, page, file",,,,,,
-1,1,10,10,FALSE,,"10-byte message"
-2,10,10,10,FALSE,,"10-byte message"
-3,1,10,10,TRUE,,"10-byte message"
-4,10,10,10,TRUE,,"10-byte message"
-,,,,,,
-"Transition from one d-block to two per message",,,,,,
-5,10,84,84,FALSE,,"1 dblk exact fit"
-6,10,85,85,FALSE,,"1 dblk + 1 byte"
-7,10,84,84,TRUE,,"1 dblk exact fit"
-8,10,85,85,TRUE,,"1 dblk + 1 byte"
-,,,,,,
-"Transition from one s-block to two per message",,,,,,
-9,10,468,468,FALSE,,"1 sblk exact fit"
-10,10,469,469,FALSE,,"1 sblk + 1 byte"
-11,10,468,468,TRUE,,"1 sblk exact fit"
-12,10,469,469,TRUE,,"1 sblk + 1 byte"
-,,,,,,
-"Transition from first page to second",,,,,,
-13,8,8148,8148,FALSE,,"8 * 1/8 page; Total = 1 page exact fit"
-14,9,8148,8148,FALSE,,"9 * 1/8 page"
-15,8,8149,8149,FALSE,,"8 * (1/8 page + 1 byte)"
-16,8,8020,8020,TRUE,,"8 * (1/8 page – 1 dblk for deq record); Total = 1 page exact
fit with deqs"
-17,9,8020,8020,TRUE,,"9 * (1/8 page – 1 dblk for deq record)"
-18,8,8021,8021,TRUE,,"8 * (1/8 page – 1 dblk for deq record + 1 byte)"
-,,,,,,
-"Page cache rollover (from last page back to page 0) - no dequeues as exact sizes
are needed and dequeues are non-deterministic",,,,,,
-19,16,65492,65492,FALSE,,"16 * (1 page exact fit); Total = entire cache
exactly"
-20,17,65492,65492,FALSE,,"17 * (1 page exact fit); Total = entire cache + reuse of 1
page"
-21,11,98260,98260,FALSE,,"11 * 1.5 pages"
-22,11,98132,98132,TRUE,,"11 * (1.5 pages including 1 sblk for deq record)"
-,,,,,,
-"File transition (from file 0000 to 0001) - no dequeues as exact sizes are needed
and dequeues are non-deterministic",,,,,,
-23,24,65492,65492,FALSE,,"24 * (1 page exact fit); Total = entire file
exactly"
-24,25,65492,65492,FALSE,,"25 * (1 page exact fit); Total = entire file + 1
page"
-25,10,163796,163796,FALSE,,"10 * (2.5 pages); Total = entire file + 2 pages"
-26,10,163668,163668,TRUE,,"10 * (2.5 pages including 1 sblk for deq record); Total =
entire file + 2 pages"
-,,,,,,
-"File rollover (from file 0007 to 0000) - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,
-27,16,786388,786388,FALSE,,"16 * (12 pages = ½ file); Total = 8 files exactly"
-,,,,,,
-"Multi-page messages (large messages) - tests various paths in encoder; no dequeues
required to test this functionality.",,,,,,
-28,16,65492,65492,FALSE,,"16 * (1 page exact fit)"
-29,16,65493,65493,FALSE,,"16 * (1 page + 1 byte): tail split"
-30,16,65503,65503,FALSE,,"16 * (1 page + 11 bytes): tail split"
-31,16,65504,65504,FALSE,,"16 * (1 page + 12 bytes): tail separated exactly"
-32,16,65505,65505,FALSE,,"16 * (1 page + 13 bytes): data split"
-33,16,131028,131028,FALSE,,"16 * (2 pages exact fit)"
-34,16,131029,131029,FALSE,,"16 * (2 pages + 1 byte): tail split"
-35,16,131039,131039,FALSE,,"16 * (2 pages + 11 bytes): tail split"
-36,16,131040,131040,FALSE,,"16 * (2 pages + 12 bytes): tail separated exactly"
-37,16,131041,131041,FALSE,,"16 * (2 pages + 13 bytes) data split"
-38,16,262100,262100,FALSE,,"16 * (4 pages exact fit)"
-39,16,262101,262101,FALSE,,"16 * (4 pages + 1 byte: tail split)"
-40,16,262111,262111,FALSE,,"16 * (4 pages + 1 byte: tail split)"
-41,16,262112,262112,FALSE,,"16 * (4 pages + 12 bytes: tail separated)"
-42,16,262113,262113,FALSE,,"16 * (4 pages + 13 bytes: data split)"
-43,16,229332,229332,FALSE,,"16 * (3.5 pages)"
-44,16,229333,229333,FALSE,,"16 * (3.5 pages + 1 byte)"
-,,,,,,
-"These set up journals for circular tests (repeatedly reading same journal) Make
sure value testing is off!",,,,,,
-45,98304,0,84,FALSE,,"1 dblk no dequeues"
-46,49152,0,84,TRUE,,"1 dblk with dequeues"
-47,49152,0,212,FALSE,,"2 dblk no dequeues"
-48,24576,0,212,TRUE,,"2 dblk with dequeues"
-49,32768,212,212,TRUE,,"2 dblk fixed with dequeues"
-,,,,,,
-"Circular tests",,,,,,
-50,10000000,0,0,FALSE,,"Read 10,000,000 messages from one of the circular test
journals above"
+"Initialize only",,,,,,,,,
+0,0,0,0,FALSE,0,0,FALSE,,"No messages"
+,,,,,,,,,
+"Within first block, page, file",,,,,,,,,
+1,1,10,10,FALSE,0,0,FALSE,,"10-byte message"
+2,10,10,10,FALSE,0,0,FALSE,,"10-byte message"
+3,1,10,10,TRUE,0,0,FALSE,,"10-byte message"
+4,10,10,10,TRUE,0,0,FALSE,,"10-byte message"
+,,,,,,,,,
+"Transition from one d-block to two per message",,,,,,,,,
+5,10,84,84,FALSE,0,0,FALSE,,"1 dblk exact fit"
+6,10,85,85,FALSE,0,0,FALSE,,"1 dblk + 1 byte"
+7,10,84,84,TRUE,0,0,FALSE,,"1 dblk exact fit"
+8,10,85,85,TRUE,0,0,FALSE,,"1 dblk + 1 byte"
+,,,,,,,,,
+"Transition from one s-block to two per message",,,,,,,,,
+9,10,468,468,FALSE,0,0,FALSE,,"1 sblk exact fit"
+10,10,469,469,FALSE,0,0,FALSE,,"1 sblk + 1 byte"
+11,10,468,468,TRUE,0,0,FALSE,,"1 sblk exact fit"
+12,10,469,469,TRUE,0,0,FALSE,,"1 sblk + 1 byte"
+,,,,,,,,,
+"Transition from first page to second",,,,,,,,,
+13,8,8148,8148,FALSE,0,0,FALSE,,"8 * 1/8 page; Total = 1 page exact fit"
+14,9,8148,8148,FALSE,0,0,FALSE,,"9 * 1/8 page"
+15,8,8149,8149,FALSE,0,0,FALSE,,"8 * (1/8 page + 1 byte)"
+16,8,8020,8020,TRUE,0,0,FALSE,,"8 * (1/8 page – 1 dblk for deq record); Total = 1
page exact fit with deqs"
+17,9,8020,8020,TRUE,0,0,FALSE,,"9 * (1/8 page – 1 dblk for deq record)"
+18,8,8021,8021,TRUE,0,0,FALSE,,"8 * (1/8 page – 1 dblk for deq record + 1
byte)"
+,,,,,,,,,
+"Page cache rollover (from last page back to page 0) - no dequeues as exact sizes
are needed and dequeues are non-deterministic",,,,,,,,,
+19,16,65492,65492,FALSE,0,0,FALSE,,"16 * (1 page exact fit); Total = entire cache
exactly"
+20,17,65492,65492,FALSE,0,0,FALSE,,"17 * (1 page exact fit); Total = entire cache +
reuse of 1 page"
+21,11,98260,98260,FALSE,0,0,FALSE,,"11 * 1.5 pages"
+22,11,98132,98132,TRUE,0,0,FALSE,,"11 * (1.5 pages including 1 sblk for deq
record)"
+,,,,,,,,,
+"File transition (from file 0000 to 0001) - no dequeues as exact sizes are needed
and dequeues are non-deterministic",,,,,,,,,
+23,24,65492,65492,FALSE,0,0,FALSE,,"24 * (1 page exact fit); Total = entire file
exactly"
+24,25,65492,65492,FALSE,0,0,FALSE,,"25 * (1 page exact fit); Total = entire file + 1
page"
+25,10,163796,163796,FALSE,0,0,FALSE,,"10 * (2.5 pages); Total = entire file + 2
pages"
+26,10,163668,163668,TRUE,0,0,FALSE,,"10 * (2.5 pages including 1 sblk for deq
record); Total = entire file + 2 pages"
+,,,,,,,,,
+"File rollover (from file 0007 to 0000) - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,,,,
+27,16,786388,786388,FALSE,0,0,FALSE,,"16 * (12 pages = ½ file); Total = 8 files
exactly"
+,,,,,,,,,
+"Multi-page messages (large messages) - tests various paths in encoder; no dequeues
required to test this functionality.",,,,,,,,,
+28,16,65492,65492,FALSE,0,0,FALSE,,"16 * (1 page exact fit)"
+29,16,65493,65493,FALSE,0,0,FALSE,,"16 * (1 page + 1 byte): tail split"
+30,16,65503,65503,FALSE,0,0,FALSE,,"16 * (1 page + 11 bytes): tail split"
+31,16,65504,65504,FALSE,0,0,FALSE,,"16 * (1 page + 12 bytes): tail separated
exactly"
+32,16,65505,65505,FALSE,0,0,FALSE,,"16 * (1 page + 13 bytes): data split"
+33,16,131028,131028,FALSE,0,0,FALSE,,"16 * (2 pages exact fit)"
+34,16,131029,131029,FALSE,0,0,FALSE,,"16 * (2 pages + 1 byte): tail split"
+35,16,131039,131039,FALSE,0,0,FALSE,,"16 * (2 pages + 11 bytes): tail split"
+36,16,131040,131040,FALSE,0,0,FALSE,,"16 * (2 pages + 12 bytes): tail separated
exactly"
+37,16,131041,131041,FALSE,0,0,FALSE,,"16 * (2 pages + 13 bytes) data split"
+38,16,262100,262100,FALSE,0,0,FALSE,,"16 * (4 pages exact fit)"
+39,16,262101,262101,FALSE,0,0,FALSE,,"16 * (4 pages + 1 byte: tail split)"
+40,16,262111,262111,FALSE,0,0,FALSE,,"16 * (4 pages + 1 byte: tail split)"
+41,16,262112,262112,FALSE,0,0,FALSE,,"16 * (4 pages + 12 bytes: tail
separated)"
+42,16,262113,262113,FALSE,0,0,FALSE,,"16 * (4 pages + 13 bytes: data split)"
+43,16,229332,229332,FALSE,0,0,FALSE,,"16 * (3.5 pages)"
+44,16,229333,229333,FALSE,0,0,FALSE,,"16 * (3.5 pages + 1 byte)"
+,,,,,,,,,
+"These set up journals for circular tests (repeatedly reading same journal) Make
sure value testing is off!",,,,,,,,,
+45,98304,0,84,FALSE,0,0,FALSE,,"1 dblk no dequeues"
+46,49152,0,84,TRUE,0,0,FALSE,,"1 dblk with dequeues"
+47,49152,0,212,FALSE,0,0,FALSE,,"2 dblk no dequeues"
+48,24576,0,212,TRUE,0,0,FALSE,,"2 dblk with dequeues"
+49,32768,212,212,TRUE,0,0,FALSE,,"2 dblk fixed with dequeues"
+,,,,,,,,,
+"Circular tests",,,,,,,,,
+50,10000000,0,0,FALSE,0,0,FALSE,,"Read 10,000,000 messages from one of the circular
test journals above"
Modified: store/trunk/cpp/tests/jrnl/rwtests.csv
===================================================================
--- store/trunk/cpp/tests/jrnl/rwtests.csv 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/rwtests.csv 2007-10-02 20:45:10 UTC (rev 960)
@@ -1,68 +1,68 @@
-"Initialize only",,,,,,
-0,0,0,0,FALSE,,"No messages"
-,,,,,,
-"Within first block, page, file",,,,,,
-1,1,10,10,FALSE,,"10-byte message"
-2,10,10,10,FALSE,,"10-byte message"
-3,1,10,10,TRUE,,"10-byte message"
-4,10,10,10,TRUE,,"10-byte message"
-,,,,,,
-"Transition from one d-block to two per message",,,,,,
-5,10,84,84,FALSE,,"1 dblk exact fit"
-6,10,85,85,FALSE,,"1 dblk + 1 byte"
-7,10,84,84,TRUE,,"1 dblk exact fit"
-8,10,85,85,TRUE,,"1 dblk + 1 byte"
-,,,,,,
-"Transition from one s-block to two per message",,,,,,
-9,10,468,468,FALSE,,"1 sblk exact fit"
-10,10,469,469,FALSE,,"1 sblk + 1 byte"
-11,10,468,468,TRUE,,"1 sblk exact fit"
-12,10,469,469,TRUE,,"1 sblk + 1 byte"
-,,,,,,
-"Transition from first page to second",,,,,,
-13,8,4052,4052,FALSE,,"8 * 1/8 page; Total = 1 page exact fit"
-14,9,4052,4052,FALSE,,"9 * 1/8 page"
-15,8,4053,4053,FALSE,,"8 * (1/8 page + 1 byte)"
-16,8,3924,3924,TRUE,,"8 * (1/8 page - 1 dblk for deq record); Total = 1 page exact
fit with deqs"
-17,9,3924,3924,TRUE,,"9 * (1/8 page - 1 dblk for deq record)"
-18,8,3925,3925,TRUE,,"8 * (1/8 page - 1 dblk for deq record + 1 byte)"
-,,,,,,
-"Page cache rollover (from page 32 back to page 0) - no dequeues as exact sizes are
needed and dequeues are non-deterministic",,,,,,
-19,32,32724,32724,FALSE,,"32 * (1 page exact fit); Total = entire cache
exactly"
-20,33,32724,32724,FALSE,,"33 * (1 page exact fit); Total = entire cache + reuse of 1
page"
-21,22,49108,49108,FALSE,,"22 * 1.5 pages"
-22,22,48980,48980,TRUE,,"22 * (1.5 pages including 1 sblk for deq record)"
-,,,,,,
-"File transition (from file 0000 to 0001) - no dequeues as exact sizes are needed
and dequeues are non-deterministic",,,,,,
-23,48,32724,32724,FALSE,,"48 * (1 page exact fit); Total = entire file
exactly"
-24,49,32724,32724,FALSE,,"49 * (1 page exact fit); Total = entire file + 1
page"
-25,20,81876,81876,FALSE,,"20 * (2.5 pages); Total = entire file + 2 pages"
-26,20,81748,81748,TRUE,,"20 * (2.5 pages including 1 sblk for deq record); Total =
entire file + 2 pages"
-,,,,,,
-"File rollover (from file 0007 to 0000) - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,
-27,16,786388,786388,FALSE,,"16 * (24 pages = ½ file); Total = 8 files exactly"
-28,16,786260,786260,TRUE,,"16 * (24 pages = ½ file); Total = 8 files exactly"
-29,17,786260,786260,TRUE,,"17 * (24 pages = ½ file); Total = 8 files + file 0
overwritten by ½ file"
-30,16,786261,786261,TRUE,,"16 * (24 pages + 1 byte); Total = 8 files + file 0
overwritten by 16 sblks"
-31,32,786260,786260,TRUE,,"32 * (24 pages = ½ file); Total = 16 files exactly, all
files overwritten once"
-32,33,786260,786260,TRUE,,"33 * (24 pages = ½ file); Total = 16 ½ files, all files
overwritten once + file 0 overwritten again by ½ file"
-33,32,786261,786261,TRUE,,"32 * (24 pages + 1 byte); All files overwritten once +
file 0 overwritten again by 32 sblks"
-,,,,,,
-"Multi-page messages (large messages) - tests various paths in encoder; no dequeues
required to test this functionality.",,,,,,
-34,16,32724,32724,FALSE,,"16 * (1 page exact fit)"
-35,16,32725,32725,FALSE,,"16 * (1 page + 1 byte): tail split"
-36,16,32735,32735,FALSE,,"16 * (1 page + 11 bytes): tail split"
-37,16,32736,32736,FALSE,,"16 * (1 page + 12 bytes): tail separated exactly"
-38,16,32737,32737,FALSE,,"16 * (1 page + 13 bytes): data split"
-39,16,65492,65492,FALSE,,"16 * (2 pages exact fit)"
-40,16,65493,65493,FALSE,,"16 * (2 pages + 1 byte): tail split"
-41,16,65503,65503,FALSE,,"16 * (2 pages + 11 bytes): tail split"
-42,16,65504,65504,FALSE,,"16 * (2 pages + 12 bytes): tail separated exactly"
-43,16,65505,65505,FALSE,,"16 * (2 pages + 13 bytes) data split"
-44,16,131028,131028,FALSE,,"16 * (4 pages exact fit)"
-45,16,131029,131029,FALSE,,"16 * (4 pages + 1 byte: tail split)"
-46,16,131039,131039,FALSE,,"16 * (4 pages + 1 byte: tail split)"
-47,16,131040,131040,FALSE,,"16 * (4 pages + 12 bytes: tail separated)"
-48,16,131041,131041,FALSE,,"16 * (4 pages + 13 bytes: data split)"
-49,16,114644,114644,FALSE,,"16 * (3.5 pages)"
-50,16,114645,114645,FALSE,,"16 * (3.5 pages + 1 byte)"
+"Initialize only",,,,,,,,,
+0,0,0,0,FALSE,0,0,FALSE,,"No messages"
+,,,,,,,,,
+"Within first block, page, file",,,,,,,,,
+1,1,10,10,FALSE,0,0,FALSE,,"10-byte message"
+2,10,10,10,FALSE,0,0,FALSE,,"10-byte message"
+3,1,10,10,TRUE,0,0,FALSE,,"10-byte message"
+4,10,10,10,TRUE,0,0,FALSE,,"10-byte message"
+,,,,,,,,,
+"Transition from one d-block to two per message",,,,,,,,,
+5,10,84,84,FALSE,0,0,FALSE,,"1 dblk exact fit"
+6,10,85,85,FALSE,0,0,FALSE,,"1 dblk + 1 byte"
+7,10,84,84,TRUE,0,0,FALSE,,"1 dblk exact fit"
+8,10,85,85,TRUE,0,0,FALSE,,"1 dblk + 1 byte"
+,,,,,,,,,
+"Transition from one s-block to two per message",,,,,,,,,
+9,10,468,468,FALSE,0,0,FALSE,,"1 sblk exact fit"
+10,10,469,469,FALSE,0,0,FALSE,,"1 sblk + 1 byte"
+11,10,468,468,TRUE,0,0,FALSE,,"1 sblk exact fit"
+12,10,469,469,TRUE,0,0,FALSE,,"1 sblk + 1 byte"
+,,,,,,,,,
+"Transition from first page to second",,,,,,,,,
+13,8,4052,4052,FALSE,0,0,FALSE,,"8 * 1/8 page; Total = 1 page exact fit"
+14,9,4052,4052,FALSE,0,0,FALSE,,"9 * 1/8 page"
+15,8,4053,4053,FALSE,0,0,FALSE,,"8 * (1/8 page + 1 byte)"
+16,8,3924,3924,TRUE,0,0,FALSE,,"8 * (1/8 page - 1 dblk for deq record); Total = 1
page exact fit with deqs"
+17,9,3924,3924,TRUE,0,0,FALSE,,"9 * (1/8 page - 1 dblk for deq record)"
+18,8,3925,3925,TRUE,0,0,FALSE,,"8 * (1/8 page - 1 dblk for deq record + 1
byte)"
+,,,,,,,,,
+"Page cache rollover (from page 32 back to page 0) - no dequeues as exact sizes are
needed and dequeues are non-deterministic",,,,,,,,,
+19,32,32724,32724,FALSE,0,0,FALSE,,"32 * (1 page exact fit); Total = entire cache
exactly"
+20,33,32724,32724,FALSE,0,0,FALSE,,"33 * (1 page exact fit); Total = entire cache +
reuse of 1 page"
+21,22,49108,49108,FALSE,0,0,FALSE,,"22 * 1.5 pages"
+22,22,48980,48980,TRUE,0,0,FALSE,,"22 * (1.5 pages including 1 sblk for deq
record)"
+,,,,,,,,,
+"File transition (from file 0000 to 0001) - no dequeues as exact sizes are needed
and dequeues are non-deterministic",,,,,,,,,
+23,48,32724,32724,FALSE,0,0,FALSE,,"48 * (1 page exact fit); Total = entire file
exactly"
+24,49,32724,32724,FALSE,0,0,FALSE,,"49 * (1 page exact fit); Total = entire file + 1
page"
+25,20,81876,81876,FALSE,0,0,FALSE,,"20 * (2.5 pages); Total = entire file + 2
pages"
+26,20,81748,81748,TRUE,0,0,FALSE,,"20 * (2.5 pages including 1 sblk for deq record);
Total = entire file + 2 pages"
+,,,,,,,,,
+"File rollover (from file 0007 to 0000) - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,,,,
+27,16,786388,786388,FALSE,FALSE,FALSE,FALSE,,"16 * (24 pages = ½ file); Total = 8
files exactly"
+28,16,786260,786260,TRUE,0,0,FALSE,,"16 * (24 pages = ½ file); Total = 8 files
exactly"
+29,17,786260,786260,TRUE,0,0,FALSE,,"17 * (24 pages = ½ file); Total = 8 files +
file 0 overwritten by ½ file"
+30,16,786261,786261,TRUE,0,0,FALSE,,"16 * (24 pages + 1 byte); Total = 8 files +
file 0 overwritten by 16 sblks"
+31,32,786260,786260,TRUE,0,0,FALSE,,"32 * (24 pages = ½ file); Total = 16 files
exactly, all files overwritten once"
+32,33,786260,786260,TRUE,0,0,FALSE,,"33 * (24 pages = ½ file); Total = 16 ½ files,
all files overwritten once + file 0 overwritten again by ½ file"
+33,32,786261,786261,TRUE,0,0,FALSE,,"32 * (24 pages + 1 byte); All files overwritten
once + file 0 overwritten again by 32 sblks"
+,,,,,,,,,
+"Multi-page messages (large messages) - tests various paths in encoder; no dequeues
required to test this functionality.",,,,,,,,,
+34,16,32724,32724,FALSE,0,0,FALSE,,"16 * (1 page exact fit)"
+35,16,32725,32725,FALSE,0,0,FALSE,,"16 * (1 page + 1 byte): tail split"
+36,16,32735,32735,FALSE,0,0,FALSE,,"16 * (1 page + 11 bytes): tail split"
+37,16,32736,32736,FALSE,0,0,FALSE,,"16 * (1 page + 12 bytes): tail separated
exactly"
+38,16,32737,32737,FALSE,0,0,FALSE,,"16 * (1 page + 13 bytes): data split"
+39,16,65492,65492,FALSE,0,0,FALSE,,"16 * (2 pages exact fit)"
+40,16,65493,65493,FALSE,0,0,FALSE,,"16 * (2 pages + 1 byte): tail split"
+41,16,65503,65503,FALSE,0,0,FALSE,,"16 * (2 pages + 11 bytes): tail split"
+42,16,65504,65504,FALSE,0,0,FALSE,,"16 * (2 pages + 12 bytes): tail separated
exactly"
+43,16,65505,65505,FALSE,0,0,FALSE,,"16 * (2 pages + 13 bytes) data split"
+44,16,131028,131028,FALSE,0,0,FALSE,,"16 * (4 pages exact fit)"
+45,16,131029,131029,FALSE,0,0,FALSE,,"16 * (4 pages + 1 byte: tail split)"
+46,16,131039,131039,FALSE,0,0,FALSE,,"16 * (4 pages + 1 byte: tail split)"
+47,16,131040,131040,FALSE,0,0,FALSE,,"16 * (4 pages + 12 bytes: tail
separated)"
+48,16,131041,131041,FALSE,0,0,FALSE,,"16 * (4 pages + 13 bytes: data split)"
+49,16,114644,114644,FALSE,0,0,FALSE,,"16 * (3.5 pages)"
+50,16,114645,114645,FALSE,0,0,FALSE,,"16 * (3.5 pages + 1 byte)"
Modified: store/trunk/cpp/tests/jrnl/tests.ods
===================================================================
(Binary files differ)
Modified: store/trunk/cpp/tests/jrnl/wtests.csv
===================================================================
--- store/trunk/cpp/tests/jrnl/wtests.csv 2007-10-02 12:35:40 UTC (rev 959)
+++ store/trunk/cpp/tests/jrnl/wtests.csv 2007-10-02 20:45:10 UTC (rev 960)
@@ -1,107 +1,139 @@
-"Initialize only",,,,,,
-0,0,0,0,FALSE,,"No messages"
-,,,,,,
-"Within first block, page, file",,,,,,
-1,1,10,10,FALSE,,"10-byte message"
-2,10,10,10,FALSE,,"10-byte message"
-3,1,10,10,TRUE,,"10-byte message"
-4,10,10,10,TRUE,,"10-byte message"
-,,,,,,
-"Transition from one d-block to two per message",,,,,,
-5,10,84,84,FALSE,,"1 dblk exact fit"
-6,10,85,85,FALSE,,"1 dblk + 1 byte"
-7,10,84,84,TRUE,,"1 dblk exact fit"
-8,10,85,85,TRUE,,"1 dblk + 1 byte"
-,,,,,,
-"Transition from one s-block to two per message",,,,,,
-9,10,468,468,FALSE,,"1 sblk exact fit"
-10,10,469,469,FALSE,,"1 sblk + 1 byte"
-11,10,468,468,TRUE,,"1 sblk exact fit"
-12,10,469,469,TRUE,,"1 sblk + 1 byte"
-,,,,,,
-"Transition from first page to second",,,,,,
-13,8,4052,4052,FALSE,,"8 * 1/8 page; Total = 1 page exact fit"
-14,9,4052,4052,FALSE,,"9 * 1/8 page"
-15,8,4053,4053,FALSE,,"8 * (1/8 page + 1 byte)"
-16,8,3924,3924,TRUE,,"8 * (1/8 page - 1 dblk for deq record); Total = 1 page exact
fit with deqs"
-17,9,3924,3924,TRUE,,"9 * (1/8 page - 1 dblk for deq record)"
-18,8,3925,3925,TRUE,,"8 * (1/8 page - 1 dblk for deq record + 1 byte)"
-,,,,,,
-"Page cache rollover (from page 32 back to page 0) - no dequeues as exact sizes are
needed and dequeues are non-deterministic",,,,,,
-19,32,32724,32724,FALSE,,"32 * (1 page exact fit); Total = entire cache
exactly"
-20,33,32724,32724,FALSE,,"33 * (1 page exact fit); Total = entire cache + reuse of 1
page"
-21,22,49108,49108,FALSE,,"22 * 1.5 pages"
-22,22,48980,48980,TRUE,,"22 * (1.5 pages including 1 sblk for deq record)"
-,,,,,,
-"File transition (from file 0000 to 0001) - no dequeues as exact sizes are needed
and dequeues are non-deterministic",,,,,,
-23,48,32724,32724,FALSE,,"48 * (1 page exact fit); Total = entire file
exactly"
-24,49,32724,32724,FALSE,,"49 * (1 page exact fit); Total = entire file + 1
page"
-25,20,81876,81876,FALSE,,"20 * (2.5 pages); Total = entire file + 2 pages"
-26,20,81748,81748,TRUE,,"20 * (2.5 pages including 1 sblk for deq record); Total =
entire file + 2 pages"
-,,,,,,
-"File rollover (from file 0007 to 0000) - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,
-27,16,786388,786388,FALSE,,"16 * (24 pages = ½ file); Total = 8 files exactly"
-28,17,786388,786388,FALSE,,"17 * (24 pages = ½ file); Total = 8 files + file 0
overwritten by ½ file"
-29,16,786389,786389,FALSE,,"16 * (24 pages + 1 byte); Total = 8 files + file 0
overwritten by 16 sblks"
-30,32,786388,786388,FALSE,,"32 * (24 pages = ½ file); Total = 16 files exactly, all
files overwritten once"
-31,33,786388,786388,FALSE,,"33 * (24 pages = ½ file); Total = 16 ½ files, all files
overwritten once + file 0 overwritten again by ½ file"
-32,32,786389,786389,FALSE,,"32 * (24 pages + 1 byte); All files overwritten once +
file 0 overwritten again by 32 sblks"
-,,,,,,
-"Multi-page messages (large messages) - tests various paths in encoder; no dequeues
required to test this functionality.",,,,,,
-33,16,32724,32724,FALSE,,"16 * (1 page exact fit)"
-34,16,32725,32725,FALSE,,"16 * (1 page + 1 byte): tail split"
-35,16,32735,32735,FALSE,,"16 * (1 page + 11 bytes): tail split"
-36,16,32736,32736,FALSE,,"16 * (1 page + 12 bytes): tail separated exactly"
-37,16,32737,32737,FALSE,,"16 * (1 page + 13 bytes): data split"
-38,16,65492,65492,FALSE,,"16 * (2 pages exact fit)"
-39,16,65493,65493,FALSE,,"16 * (2 pages + 1 byte): tail split"
-40,16,65503,65503,FALSE,,"16 * (2 pages + 11 bytes): tail split"
-41,16,65504,65504,FALSE,,"16 * (2 pages + 12 bytes): tail separated exactly"
-42,16,65505,65505,FALSE,,"16 * (2 pages + 13 bytes) data split"
-43,16,131028,131028,FALSE,,"16 * (4 pages exact fit)"
-44,16,131029,131029,FALSE,,"16 * (4 pages + 1 byte: tail split)"
-45,16,131039,131039,FALSE,,"16 * (4 pages + 1 byte: tail split)"
-46,16,131040,131040,FALSE,,"16 * (4 pages + 12 bytes: tail separated)"
-47,16,131041,131041,FALSE,,"16 * (4 pages + 13 bytes: data split)"
-48,16,114644,114644,FALSE,,"16 * (3.5 pages)"
-49,16,114645,114645,FALSE,,"16 * (3.5 pages + 1 byte)"
-,,,,,,
-"Large (multi-megabyte) messages - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,
-50,32,1572820,1572820,FALSE,,"32 * (48 pages = 1 file exactly)"
-51,32,1572821,1572821,FALSE,,"32 * (48 pages + 1 byte)"
-52,32,1605588,1605588,FALSE,,"32 * (49 pages = 1 file + 1 page)"
-53,16,3145684,3145684,FALSE,,"16 * (96 pages = 2 files exactly)"
-54,16,3145685,3145685,FALSE,,"16 * (96 pages + 1 byte)"
-55,16,3178452,3178452,FALSE,,"16 * (97 pages = 2 files + 1 page"
-56,8,6291412,6291412,FALSE,,"8 * (192 pages = 4 files exactly)"
-57,8,6291413,6291413,FALSE,,"8 * (192 pages + 1 byte)"
-58,8,6324180,6324180,FALSE,,"8 * (193 pages = 4 files + 1 page)"
-59,32,1572692,1572692,TRUE,,"32 * (48 pages including 1 sblk for deq record = 1 file
exactly)"
-60,32,1572693,1572693,TRUE,,"32 * (48 pages including 1 sblk for deq record + 1
byte)"
-61,32,1605460,1605460,TRUE,,"32 * (49 pages including 1 sblk for deq record = 1 file
+ 1 page)"
-62,16,3145556,3145556,TRUE,,"16 * (96 pages including 1 sblk for deq record = 2
files exactly)"
-63,16,3145557,3145557,TRUE,,"16 * (96 pages including 1 sblk for deq record + 1
byte)"
-64,16,3178324,3178324,TRUE,,"16 * (97 pages including 1 sblk for deq record = 2
files + 1 page"
-65,8,6291284,6291284,TRUE,,"8 * (192 pages including 1 sblk for deq record = 4 files
exactly)"
-66,8,6291285,6291285,TRUE,,"8 * (192 pages including 1 sblk for deq record + 1
byte)"
-67,8,6324052,6324052,TRUE,,"8 * (193 pages including 1 sblk for deq record = 4 files
+ 1 page)"
-,,,,,,
-"High volume tests of random message lengths - RHM_WRONLY req'd for auto-dequeue
== FALSE",,,,,,
-68,5000000,0,84,FALSE,,"1 dblk max"
-69,3000000,0,340,FALSE,,"3 dblks max"
-70,1600000,0,1236,FALSE,,"10 dblks max"
-71,600000,0,3796,FALSE,,"30 dblks max"
-72,200000,0,12756,FALSE,,"100 dblks max"
-73,60000,0,38356,FALSE,,"300 dblks max"
-74,20000,0,127956,FALSE,,"1000 dblks max"
-75,2500000,0,84,TRUE,,"1 dblk max"
-76,1500000,0,340,TRUE,,"3 dblks max"
-77,800000,0,1236,TRUE,,"10 dblks max"
-78,300000,0,3796,TRUE,,"30 dblks max"
-79,100000,0,12756,TRUE,,"100 dblks max"
-80,30000,0,38356,TRUE,,"300 dblks max"
-81,10000,0,127956,TRUE,,"1000 dblks max"
-,,,,,,
-"STANDARD PERFORMANCE BENCHMARK: 10,000,000 writes, data=212b (2 dblks)",,,,,,
-82,10000000,212,212,FALSE,,"2 dblks"
-83,10000000,212,212,TRUE,,"2 dblks"
+"Initialize only",,,,,,,,,
+0,0,0,0,FALSE,0,0,FALSE,,"No messages"
+,,,,,,,,,
+"Within first block, page, file",,,,,,,,,
+1,1,10,10,FALSE,0,0,FALSE,,"1 * 10-byte message"
+2,10,10,10,FALSE,0,0,FALSE,,"10 * 10-byte message"
+3,1,10,10,FALSE,0,0,TRUE,,"1 * 10-byte message, transient"
+4,10,10,10,FALSE,0,0,TRUE,,"10 * 10-byte message, transient"
+5,1,10,10,FALSE,10,10,FALSE,,"1 * 10-byte message, txn"
+6,10,10,10,FALSE,10,10,FALSE,,"10 * 10-byte message, txn"
+7,1,10,10,FALSE,10,10,TRUE,,"1 * 10-byte message, txn, transient"
+8,10,10,10,FALSE,10,10,TRUE,,"10 * 10-byte message, txn, transient"
+9,1,10,10,TRUE,0,0,FALSE,,"1 * 10-byte message, deq"
+10,10,10,10,TRUE,0,0,FALSE,,"10 * 10-byte message, deq"
+11,1,10,10,TRUE,0,0,TRUE,,"1 * 10-byte message, transient, deq"
+12,10,10,10,TRUE,0,0,TRUE,,"10 * 10-byte message, transient, deq"
+13,1,10,10,TRUE,10,10,FALSE,,"1 * 10-byte message, txn, deq"
+14,10,10,10,TRUE,10,10,FALSE,,"10 * 10-byte message, txn, deq"
+15,1,10,10,TRUE,10,10,TRUE,,"1 * 10-byte message, txn, transient, deq"
+16,10,10,10,TRUE,10,10,TRUE,,"10 * 10-byte message, txn, transient, deq"
+,,,,,,,,,
+"Transition from one d-block to two per message",,,,,,,,,
+17,10,84,84,FALSE,0,0,FALSE,,"1 dblk exact fit"
+18,10,85,85,FALSE,0,0,FALSE,,"1 dblk + 1 byte"
+19,10,58,58,FALSE,26,26,FALSE,,"1 dblk exact fit, txn"
+20,10,59,59,FALSE,26,26,FALSE,,"1 dblk + 1 byte, txn"
+,,,,,,,,,
+"Transition from one s-block to two per message",,,,,,,,,
+21,10,468,468,FALSE,0,0,FALSE,,"1 sblk exact fit"
+22,10,469,469,FALSE,0,0,FALSE,,"1 sblk + 1 byte"
+23,10,442,442,FALSE,26,26,FALSE,,"1 sblk exact fit, txn"
+24,10,443,443,FALSE,26,26,FALSE,,"1 sblk + 1 byte, txn"
+,,,,,,,,,
+"Transition from first page to second",,,,,,,,,
+25,8,4052,4052,FALSE,0,0,FALSE,,"8 * 1/8 page; Total = 1 page exact fit"
+26,9,4052,4052,FALSE,0,0,FALSE,,"9 * 1/8 page"
+27,8,4053,4053,FALSE,0,0,FALSE,,"8 * (1/8 page + 1 byte)"
+28,8,3796,3796,FALSE,256,256,FALSE,,"8 * 1/8 page; Total = 1 page exact fit,
txn"
+29,9,3796,3796,FALSE,256,256,FALSE,,"9 * 1/8 page, txn"
+30,8,3797,3797,FALSE,256,256,FALSE,,"8 * (1/8 page + 1 byte), txn"
+,,,,,,,,,
+"Page cache rollover (from page 32 back to page 0) - no dequeues as exact sizes are
needed and dequeues are non-deterministic",,,,,,,,,
+31,32,32724,32724,FALSE,0,0,FALSE,,"32 * (1 page exact fit); Total = entire cache
exactly"
+32,33,32724,32724,FALSE,0,0,FALSE,,"33 * (1 page exact fit); Total = entire cache +
reuse of 1 page"
+33,22,49108,49108,FALSE,0,0,FALSE,,"22 * 1.5 pages"
+34,32,32468,32468,FALSE,256,256,FALSE,,"32 * (1 page exact fit); Total = entire
cache exactly, txn"
+35,33,32468,32468,FALSE,256,256,FALSE,,"33 * (1 page exact fit); Total = entire
cache + reuse of 1 page, txn"
+36,22,48852,48852,FALSE,256,256,FALSE,,"22 * 1.5 pages, txn"
+,,,,,,,,,
+"File transition (from file 0000 to 0001) - no dequeues as exact sizes are needed
and dequeues are non-deterministic",,,,,,,,,
+37,48,32724,32724,FALSE,0,0,FALSE,,"48 * (1 page exact fit); Total = entire file
exactly"
+38,49,32724,32724,FALSE,0,0,FALSE,,"49 * (1 page exact fit); Total = entire file + 1
page"
+39,20,81876,81876,FALSE,0,0,FALSE,,"20 * (2.5 pages); Total = entire file + 2
pages"
+40,48,32468,32468,FALSE,256,256,FALSE,,"48 * (1 page exact fit); Total = entire file
exactly, txn"
+41,49,32468,32468,FALSE,256,256,FALSE,,"49 * (1 page exact fit); Total = entire file
+ 1 page, txn"
+42,20,81620,81620,FALSE,256,256,FALSE,,"20 * (2.5 pages); Total = entire file + 2
pages, txn"
+,,,,,,,,,
+"File rollover (from file 0007 to 0000) - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,,,,
+43,16,786388,786388,FALSE,0,0,FALSE,,"16 * (24 pages = ½ file); Total = 8 files
exactly"
+44,17,786388,786388,FALSE,0,0,FALSE,,"17 * (24 pages = ½ file); Total = 8 files +
file 0 overwritten by ½ file"
+45,16,786389,786389,FALSE,0,0,FALSE,,"16 * (24 pages + 1 byte); Total = 8 files +
file 0 overwritten by 16 sblks"
+46,32,786388,786388,FALSE,0,0,FALSE,,"32 * (24 pages = ½ file); Total = 16 files
exactly, all files overwritten once"
+47,33,786388,786388,FALSE,0,0,FALSE,,"33 * (24 pages = ½ file); Total = 16 ½ files,
all files overwritten once + file 0 overwritten again by ½ file"
+48,32,786389,786389,FALSE,0,0,FALSE,,"32 * (24 pages + 1 byte); All files
overwritten once + file 0 overwritten again by 32 sblks"
+49,16,786132,786132,FALSE,256,256,FALSE,,"16 * (24 pages = ½ file); Total = 8 files
exactly, txn"
+50,17,786132,786132,FALSE,256,256,FALSE,,"17 * (24 pages = ½ file); Total = 8 files
+ file 0 overwritten by ½ file, txn"
+51,16,786133,786133,FALSE,256,256,FALSE,,"16 * (24 pages + 1 byte); Total = 8 files
+ file 0 overwritten by 16 sblks, txn"
+52,32,786132,786132,FALSE,256,256,FALSE,,"32 * (24 pages = ½ file); Total = 16 files
exactly, all files overwritten once, txn"
+53,33,786132,786132,FALSE,256,256,FALSE,,"33 * (24 pages = ½ file); Total = 16 ½
files, all files overwritten once + file 0 overwritten again by ½ file, txn"
+54,32,786133,786133,FALSE,256,256,FALSE,,"32 * (24 pages + 1 byte); All files
overwritten once + file 0 overwritten again by 32 sblks, txn"
+,,,,,,,,,
+"Multi-page messages (large messages) - tests various paths in encoder; no dequeues
required to test this functionality.",,,,,,,,,
+55,16,10,10,FALSE,32724,32724,FALSE,,"16 * (xid 1 page exact fit)"
+56,16,10,10,FALSE,32725,32725,FALSE,,"16 * (xid 1 page + 1 byte): tail split"
+57,16,10,10,FALSE,32735,32735,FALSE,,"16 * (xid 1 page + 11 bytes): tail
split"
+58,16,10,10,FALSE,32736,32736,FALSE,,"16 * (xid 1 page + 12 bytes): tail separated
exactly"
+59,16,10,10,FALSE,32737,32737,FALSE,,"16 * (xid 1 page + 13 bytes): data
split"
+60,16,10,10,FALSE,65492,65492,FALSE,,"16 * (xid 2 pages exact fit)"
+61,16,10,10,FALSE,65493,65493,FALSE,,"16 * (xid 2 pages + 1 byte): tail split"
+62,16,10,10,FALSE,65503,65503,FALSE,,"16 * (xid 2 pages + 11 bytes): tail
split"
+63,16,10,10,FALSE,65504,65504,FALSE,,"16 * (xid 2 pages + 12 bytes): tail separated
exactly"
+64,16,10,10,FALSE,65505,65505,FALSE,,"16 * (xid 2 pages + 13 bytes) data
split"
+65,16,32724,32724,FALSE,0,0,FALSE,,"16 * (1 page exact fit)"
+66,16,32725,32725,FALSE,0,0,FALSE,,"16 * (1 page + 1 byte): tail split"
+67,16,32735,32735,FALSE,0,0,FALSE,,"16 * (1 page + 11 bytes): tail split"
+68,16,32736,32736,FALSE,0,0,FALSE,,"16 * (1 page + 12 bytes): tail separated
exactly"
+69,16,32737,32737,FALSE,0,0,FALSE,,"16 * (1 page + 13 bytes): data split"
+70,16,65492,65492,FALSE,0,0,FALSE,,"16 * (2 pages exact fit)"
+71,16,65493,65493,FALSE,0,0,FALSE,,"16 * (2 pages + 1 byte): tail split"
+72,16,65503,65503,FALSE,0,0,FALSE,,"16 * (2 pages + 11 bytes): tail split"
+73,16,65504,65504,FALSE,0,0,FALSE,,"16 * (2 pages + 12 bytes): tail separated
exactly"
+74,16,65505,65505,FALSE,0,0,FALSE,,"16 * (2 pages + 13 bytes) data split"
+75,16,131028,131028,FALSE,0,0,FALSE,,"16 * (4 pages exact fit)"
+76,16,131029,131029,FALSE,0,0,FALSE,,"16 * (4 pages + 1 byte: tail split)"
+77,16,131039,131039,FALSE,0,0,FALSE,,"16 * (4 pages + 1 byte: tail split)"
+78,16,131040,131040,FALSE,0,0,FALSE,,"16 * (4 pages + 12 bytes: tail
separated)"
+79,16,131041,131041,FALSE,0,0,FALSE,,"16 * (4 pages + 13 bytes: data split)"
+80,16,114644,114644,FALSE,0,0,FALSE,,"16 * (3.5 pages)"
+81,16,114645,114645,FALSE,0,0,FALSE,,"16 * (3.5 pages + 1 byte)"
+,,,,,,,,,
+"Large (multi-megabyte) messages - RHM_WRONLY req'd for auto-dequeue ==
FALSE",,,,,,,,,
+82,32,1572820,1572820,FALSE,0,0,FALSE,,"32 * (48 pages = 1 file exactly)"
+83,32,1572821,1572821,FALSE,0,0,FALSE,,"32 * (48 pages + 1 byte)"
+84,32,1605588,1605588,FALSE,0,0,FALSE,,"32 * (49 pages = 1 file + 1 page)"
+85,16,3145684,3145684,FALSE,0,0,FALSE,,"16 * (96 pages = 2 files exactly)"
+86,16,3145685,3145685,FALSE,0,0,FALSE,,"16 * (96 pages + 1 byte)"
+87,16,3178452,3178452,FALSE,0,0,FALSE,,"16 * (97 pages = 2 files + 1 page"
+88,8,6291412,6291412,FALSE,0,0,FALSE,,"8 * (192 pages = 4 files exactly)"
+89,8,6291413,6291413,FALSE,0,0,FALSE,,"8 * (192 pages + 1 byte)"
+90,8,6324180,6324180,FALSE,0,0,FALSE,,"8 * (193 pages = 4 files + 1 page)"
+91,32,1572692,1572692,TRUE,0,0,FALSE,,"32 * (48 pages including 1 sblk for deq
record = 1 file exactly)"
+92,32,1572693,1572693,TRUE,0,0,FALSE,,"32 * (48 pages including 1 sblk for deq
record + 1 byte)"
+93,32,1605460,1605460,TRUE,0,0,FALSE,,"32 * (49 pages including 1 sblk for deq
record = 1 file + 1 page)"
+94,16,3145556,3145556,TRUE,0,0,FALSE,,"16 * (96 pages including 1 sblk for deq
record = 2 files exactly)"
+95,16,3145557,3145557,TRUE,0,0,FALSE,,"16 * (96 pages including 1 sblk for deq
record + 1 byte)"
+96,16,3178324,3178324,TRUE,0,0,FALSE,,"16 * (97 pages including 1 sblk for deq
record = 2 files + 1 page"
+97,8,6291284,6291284,TRUE,0,0,FALSE,,"8 * (192 pages including 1 sblk for deq record
= 4 files exactly)"
+98,8,6291285,6291285,TRUE,0,0,FALSE,,"8 * (192 pages including 1 sblk for deq record
+ 1 byte)"
+99,8,6324052,6324052,TRUE,0,0,FALSE,,"8 * (193 pages including 1 sblk for deq record
= 4 files + 1 page)"
+,,,,,,,,,
+"High volume tests of random message lengths - RHM_WRONLY req'd for auto-dequeue
== FALSE",,,,,,,,,
+100,5000000,0,84,FALSE,0,0,FALSE,,"1 dblk max"
+101,3000000,0,340,FALSE,0,0,FALSE,,"3 dblks max"
+102,1600000,0,1236,FALSE,0,0,FALSE,,"10 dblks max"
+103,600000,0,3796,FALSE,0,0,FALSE,,"30 dblks max"
+104,200000,0,12756,FALSE,0,0,FALSE,,"100 dblks max"
+105,60000,0,38356,FALSE,0,0,FALSE,,"300 dblks max"
+106,20000,0,127956,FALSE,0,0,FALSE,,"1000 dblks max"
+107,2500000,0,84,TRUE,0,0,FALSE,,"1 dblk max"
+108,1500000,0,340,TRUE,0,0,FALSE,,"3 dblks max"
+109,800000,0,1236,TRUE,0,0,FALSE,,"10 dblks max"
+110,300000,0,3796,TRUE,0,0,FALSE,,"30 dblks max"
+111,100000,0,12756,TRUE,0,0,FALSE,,"100 dblks max"
+112,30000,0,38356,TRUE,0,0,FALSE,,"300 dblks max"
+113,10000,0,127956,TRUE,0,0,FALSE,,"1000 dblks max"
+,,,,,,,,,
+"STANDARD PERFORMANCE BENCHMARK: 10,000,000 writes, data=212b (2
dblks)",,,,,,,,,
+114,10000000,212,212,FALSE,0,0,FALSE,,"2 dblks"
+115,10000000,212,212,TRUE,0,0,FALSE,,"2 dblks"