Author: kpvdr
Date: 2008-04-02 16:23:05 -0400 (Wed, 02 Apr 2008)
New Revision: 1833
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/tests/jrnl/_st_basic.cpp
store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
store/trunk/cpp/tests/jrnl/_st_read.cpp
store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
Log:
Moved journal file geometry parameters (num files & file size) from constructor to
initialize() and recover() methods. This is logically where they belong; also it enables
the management instrumentation to change these parameters through a stop() and
initialize() sequence.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -251,12 +251,12 @@
JournalImpl* jQueue = 0;
{
qpid::sys::Mutex::ScopedLock sl(jrnlCreateLock);
- jQueue = new JournalImpl(queue.getName(), getJrnlDir(queue),
string("JournalData"), numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE,
defJournalGetEventsTimeout, defJournalFlushTimeout);
+ jQueue = new JournalImpl(queue.getName(), getJrnlDir(queue),
string("JournalData"), defJournalGetEventsTimeout, defJournalFlushTimeout);
}
queue.setExternalQueueStore(dynamic_cast<ExternalQueueStore*>(jQueue));
try {
// init will create the deque's for the init...
- jQueue->initialize();
+ jQueue->initialize(numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE);
} catch (const journal::jexception& e) {
THROW_STORE_EXCEPTION(std::string("Queue ") + queue.getName() +
": create() failed: " + e.what());
}
@@ -423,14 +423,14 @@
JournalImpl* jQueue = 0;
{
qpid::sys::Mutex::ScopedLock sl(jrnlCreateLock);
- jQueue = new JournalImpl(queueName, getJrnlDir(queueName),
string("JournalData"), numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE,
defJournalGetEventsTimeout, defJournalFlushTimeout);
+ jQueue = new JournalImpl(queueName, getJrnlDir(queueName),
string("JournalData"), defJournalGetEventsTimeout, defJournalFlushTimeout);
}
queue->setExternalQueueStore(dynamic_cast<ExternalQueueStore*>(jQueue));
try
{
u_int64_t thisHighestRid = 0;
- jQueue->recover(prepared, thisHighestRid, key.id); // start recovery
+ jQueue->recover(numJrnlFiles, jrnlFsizePgs * JRNL_RMGR_PAGE_SIZE,
prepared, thisHighestRid, key.id); // start recovery
if (thisHighestRid > highestRid)
highestRid = thisHighestRid;
recoverMessages(txn, registry, queue, prepared, messages);
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -45,11 +45,9 @@
JournalImpl::JournalImpl(const std::string& journalId,
const std::string& journalDirectory,
const std::string& journalBaseFilename,
- const u_int16_t num_jfiles,
- const u_int32_t jfsize_sblks,
const qpid::sys::Duration getEventsTimeout,
const qpid::sys::Duration flushTimeout):
- jcntl(journalId, journalDirectory, journalBaseFilename,
num_jfiles, jfsize_sblks),
+ jcntl(journalId, journalDirectory, journalBaseFilename),
getEventsTimerSetFlag(false),
writeActivityFlag(false),
flushTriggeredFlag(true),
@@ -70,23 +68,13 @@
journalTimerPtr->add(inactivityFireEventPtr);
log(LOG_NOTICE, "Instantiation");
- std::ostringstream oss1;
- oss1 << "Journal directory = \"" << journalDirectory
<< "\"";
- log(LOG_INFO, oss1.str());
- std::ostringstream oss2;
- oss2 << "Base file name = \"" << journalBaseFilename
<< "\"";
- log(LOG_DEBUG, oss2.str());
- std::ostringstream oss3;
- oss3 << "Number of journal files = " << num_jfiles;
- log(LOG_DEBUG, oss3.str());
- std::ostringstream oss4;
- oss4 << "Journal file size (sblks) = " << jfsize_sblks;
- log(LOG_DEBUG, oss4.str());
+ std::ostringstream oss;
+ oss << "Journal directory = \"" << journalDirectory
<< "\"; Base file name = \"" << journalBaseFilename
<< "\"";
+ log(LOG_DEBUG, oss.str());
}
JournalImpl::~JournalImpl()
{
- log(LOG_DEBUG, "Destroyed");
if (_init_flag && !_stop_flag){
try { stop(true); }
catch (const jexception& e) { std::cerr << e << std::endl; }
@@ -100,29 +88,37 @@
::free(_datap);
_datap = 0;
}
+
+ // TODO: Make this if() thread-safe
if (journalTimerPtr && --cnt == 0)
{
delete journalTimerPtr;
journalTimerPtr = 0;
}
+
::pthread_mutex_destroy(&_getf_mutex);
+ log(LOG_DEBUG, "Destroyed");
}
void
-JournalImpl::initialize(const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb)
+JournalImpl::initialize(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb)
{
- log(LOG_DEBUG, "Initialize");
- jcntl::initialize(rd_cb, wr_cb);
+ std::ostringstream oss;
+ oss << "Initialize; num_jfiles=" << num_jfiles << "
jfsize_sblks=" << jfsize_sblks;
+ log(LOG_DEBUG, oss.str());
+ jcntl::initialize(num_jfiles, jfsize_sblks, rd_cb, wr_cb);
log(LOG_DEBUG, "Initialization complete");
}
void
-JournalImpl::recover(const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb,
+JournalImpl::recover(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb,
boost::ptr_list<bdbstore::PreparedTransaction>& prep_tx_list,
u_int64_t& highest_rid,
u_int64_t queue_id)
{
std::ostringstream oss1;
- oss1 << "Recover, queue_id = 0x" << std::hex <<
queue_id;
+ oss1 << "Recover; num_jfiles=" << num_jfiles << "
jfsize_sblks=" << jfsize_sblks << " queue_id = 0x" <<
std::hex << queue_id;
log(LOG_DEBUG, oss1.str());
// Create list of prepared xids
std::vector<std::string> prep_xid_list;
@@ -131,7 +127,7 @@
prep_xid_list.push_back(i->xid);
}
- jcntl::recover(rd_cb, wr_cb, prep_xid_list, highest_rid);
+ jcntl::recover(num_jfiles, jfsize_sblks, rd_cb, wr_cb, prep_xid_list, highest_rid);
// Populate PreparedTransaction lists from _tmap
for (bdbstore::PreparedTransaction::list::iterator i = prep_tx_list.begin();
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/JournalImpl.h 2008-04-02 20:23:05 UTC (rev 1833)
@@ -89,22 +89,27 @@
JournalImpl(const std::string& journalId,
const std::string& journalDirectory,
const std::string& journalBaseFilename,
- const u_int16_t num_jfiles,
- const u_int32_t jfsize_sblks,
const qpid::sys::Duration getEventsTimeout,
const qpid::sys::Duration flushTimeout);
virtual ~JournalImpl();
- inline void initialize() { jcntl::initialize(0, &aio_wr_callback); }
+ void initialize(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb);
- void initialize(const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb
wr_cb);
- void recover(const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb,
+ inline void initialize(const u_int16_t num_jfiles, const u_int32_t
jfsize_sblks) {
+ jcntl::initialize(num_jfiles, jfsize_sblks, 0, &aio_wr_callback);
+ }
+
+ void recover(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const journal::rd_aio_cb rd_cb, const journal::wr_aio_cb wr_cb,
boost::ptr_list<bdbstore::PreparedTransaction>&
prep_tx_list,
u_int64_t& highest_rid, u_int64_t queue_id);
- inline void recover(boost::ptr_list<bdbstore::PreparedTransaction>&
prep_tx_list,
+ inline void recover(const u_int16_t num_jfiles, const u_int32_t
jfsize_sblks,
+ boost::ptr_list<bdbstore::PreparedTransaction>&
prep_tx_list,
u_int64_t& highest_rid, u_int64_t queue_id) {
- recover(0, &aio_wr_callback, prep_tx_list, highest_rid, queue_id);
+ recover(num_jfiles, jfsize_sblks, 0, &aio_wr_callback, prep_tx_list,
highest_rid,
+ queue_id);
}
// Temporary fn to read and save last msg read from journal so it can be
assigned
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -51,8 +51,7 @@
// Functions
-jcntl::jcntl(const std::string& jid, const std::string& jdir, const
std::string& base_filename,
- const u_int16_t num_jfiles, const u_int32_t jfsize_sblks):
+jcntl::jcntl(const std::string& jid, const std::string& jdir, const
std::string& base_filename):
_jid(jid),
_jdir(jdir, base_filename),
_base_filename(base_filename),
@@ -60,8 +59,8 @@
_stop_flag(false),
_readonly_flag(false),
_autostop(true),
- _num_jfiles(num_jfiles > JRNL_MIN_NUM_FILES ? num_jfiles : JRNL_MIN_NUM_FILES),
- _jfsize_sblks(jfsize_sblks > JRNL_MIN_FILE_SIZE ? jfsize_sblks
:JRNL_MIN_FILE_SIZE),
+ _num_jfiles(0),
+ _jfsize_sblks(0),
_datafh(0),
_emap(),
_tmap(),
@@ -69,7 +68,7 @@
_wrfc(),
_rmgr(this, _emap, _tmap, _rrfc),
_wmgr(this, _emap, _tmap, _wrfc),
- _rcvdat(_num_jfiles)
+ _rcvdat()
{
::pthread_mutex_init(&_wr_mutex, 0);
::pthread_mutex_init(&_gev_mutex, 0);
@@ -91,15 +90,14 @@
}
void
-jcntl::initialize(const rd_aio_cb rd_cb, const wr_aio_cb wr_cb)
+jcntl::initialize(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks, const
rd_aio_cb rd_cb, const wr_aio_cb wr_cb)
{
_init_flag = false;
_stop_flag = false;
_readonly_flag = false;
- // Prepare journal dir, journal files and file handles
- _jdir.clear_dir();
_emap.clear();
+ _tmap.clear();
// TODO - place this in a finalize() fn? - see ~jcntl() & recover()...
if (_datafh)
@@ -109,6 +107,18 @@
delete[] _datafh;
}
+ // Set new file geometry parameters
+ assert(num_jfiles >= JRNL_MIN_NUM_FILES);
+ assert(num_jfiles <= JRNL_MAX_NUM_FILES);
+ _num_jfiles = num_jfiles;
+
+ assert(jfsize_sblks >= JRNL_MIN_FILE_SIZE);
+ assert(jfsize_sblks <= JRNL_MAX_FILE_SIZE);
+ _jfsize_sblks = jfsize_sblks;
+
+ // Clear any existing journal files
+ _jdir.clear_dir();
+
_datafh = new lfh*[_num_jfiles];
// Zero the pointer array first because new() can throw exceptions
::memset(_datafh, 0, sizeof(lfh*) * _num_jfiles);
@@ -135,26 +145,16 @@
}
void
-jcntl::recover(const rd_aio_cb rd_cb, const wr_aio_cb wr_cb,
+jcntl::recover(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks, const rd_aio_cb
rd_cb, const wr_aio_cb wr_cb,
const std::vector<std::string>& prep_txn_list, u_int64_t&
highest_rid)
{
_init_flag = false;
_stop_flag = false;
_readonly_flag = false;
- // Verify journal dir and journal files
- _jdir.verify_dir();
- _rcvdat.reset();
_emap.clear();
_tmap.clear();
- rcvr_janalyze(_rcvdat, prep_txn_list);
- highest_rid = _rcvdat._h_rid;
- if (_rcvdat._full)
- throw jexception(jerrno::JERR_JCNTL_RECOVERJFULL, "jcntl",
"recover");
-
- this->log(LOG_DEBUG, _rcvdat.to_string(_jid));
-
// TODO - place this in a finalize() fn? - see ~jcntl() & initialize()...
if (_datafh)
{
@@ -163,6 +163,26 @@
delete[] _datafh;
}
+ // Set new file geometry parameters
+ assert(num_jfiles >= JRNL_MIN_NUM_FILES);
+ assert(num_jfiles <= JRNL_MAX_NUM_FILES);
+ _num_jfiles = num_jfiles;
+
+ assert(jfsize_sblks >= JRNL_MIN_FILE_SIZE);
+ assert(jfsize_sblks <= JRNL_MAX_FILE_SIZE);
+ _jfsize_sblks = jfsize_sblks;
+
+ // Verify journal dir and journal files
+ _jdir.verify_dir();
+ _rcvdat.reset(_num_jfiles);
+
+ rcvr_janalyze(_rcvdat, prep_txn_list);
+ highest_rid = _rcvdat._h_rid;
+ if (_rcvdat._full)
+ throw jexception(jerrno::JERR_JCNTL_RECOVERJFULL, "jcntl",
"recover");
+
+ this->log(LOG_DEBUG, _rcvdat.to_string(_jid));
+
_datafh = new lfh*[_num_jfiles];
// 0 the pointer array first because new() can throw exceptions
::memset(_datafh, 0, sizeof(lfh*) * _num_jfiles);
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -141,27 +141,24 @@
pthread_mutex_t _gev_mutex; ///< Mutex for get_events
public:
- /**
- * \brief Journal constructor.
- *
- * Constructor which sets the physical file location and base name.
- *
- * \param jid A unique identifier for this journal instance.
- * \param jdir The directory which will contain the journal files.
- * \param base_filename The string which will be used to start all journal
filenames.
- * \param num_jfiles The number of journal files to be created.
- * \param jfsize_sblks The size of each journal file expressed in softblocks.
- */
- jcntl(const std::string& jid, const std::string& jdir, const
std::string& base_filename,
- const u_int16_t num_jfiles, const u_int32_t jfsize_sblks);
+ /**
+ * \brief Journal constructor.
+ *
+ * Constructor which sets the physical file location and base name.
+ *
+ * \param jid A unique identifier for this journal instance.
+ * \param jdir The directory which will contain the journal files.
+ * \param base_filename The string which will be used to start all journal
filenames.
+ */
+ jcntl(const std::string& jid, const std::string& jdir, const
std::string& base_filename);
/**
* \brief Destructor.
*/
- virtual ~jcntl();
+ virtual ~jcntl();
- inline const std::string& id() const { return _jid; }
- inline const std::string& jrnl_dir() const { return _jdir.dirname(); }
+ inline const std::string& id() const { return _jid; }
+ inline const std::string& jrnl_dir() const { return _jdir.dirname(); }
/**
* \brief Initialize the journal for storing data.
@@ -178,12 +175,15 @@
* <b>NOTE: If <i>NULL</i> is passed to the callbacks, internal
default callbacks will be
* used.</b>
*
+ * \param num_jfiles The number of journal files to be created.
+ * \param jfsize_sblks The size of each journal file expressed in softblocks.
* \param rd_cb Function pointer to callback function for read operations. May be
0 (NULL).
* \param wr_cb Function pointer to callback function for write operations. May be
0 (NULL).
*
* \exception TODO
*/
- void initialize(const rd_aio_cb rd_cb, const wr_aio_cb wr_cb);
+ void initialize(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const rd_aio_cb rd_cb, const wr_aio_cb wr_cb);
/**
* /brief Initialize journal by recovering state from previously written journal.
@@ -200,6 +200,8 @@
* <b>NOTE: If <i>NULL</i> is passed to the callbacks, internal
default callbacks will be
* used.</b>
*
+ * \param num_jfiles The number of journal files to be created.
+ * \param jfsize_sblks The size of each journal file expressed in softblocks.
* \param rd_cb Function pointer to callback function for read operations. May be
0 (NULL).
* \param wr_cb Function pointer to callback function for write operations. May be
0 (NULL).
* \param prep_txn_list
@@ -207,7 +209,8 @@
*
* \exception TODO
*/
- void recover(const rd_aio_cb rd_cb, const wr_aio_cb wr_cb,
+ void recover(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ const rd_aio_cb rd_cb, const wr_aio_cb wr_cb,
const std::vector<std::string>& prep_txn_list, u_int64_t&
highest_rid);
/**
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -56,7 +56,7 @@
bool _full; ///< Journal is full
std::vector<u_int32_t> _enq_cnt_list; ///< Number enqueued records
found for each file
- rcvdat(u_int16_t num_jfiles):
+ rcvdat():
_owi(false),
_frot(false),
_empty(true),
@@ -66,10 +66,10 @@
_eo(0),
_h_rid(0),
_full(false),
- _enq_cnt_list(num_jfiles, 0)
+ _enq_cnt_list()
{}
- void reset()
+ void reset(u_int16_t num_jfiles)
{
_owi=false;
_frot = false;
@@ -80,8 +80,8 @@
_eo=0;
_h_rid=0;
_full = false;
- for (unsigned f=0; f<_enq_cnt_list.size(); f++)
- _enq_cnt_list[f] = 0;
+ _enq_cnt_list.clear();
+ _enq_cnt_list.resize(num_jfiles, 0);
}
std::string to_string(std::string& jid)
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -51,16 +51,14 @@
_fhdr_ptr_arr(0),
_iocba(0),
_cached_offset_dblks(0),
- _jfsize_dblks(_jc->jfsize_sblks() * JRNL_SBLK_SIZE),
- _jfsize_pgs(_jc->jfsize_sblks() / JRNL_WMGR_PAGE_SIZE),
+ _jfsize_dblks(0),
+ _jfsize_pgs(0),
_enq_busy(false),
_deq_busy(false),
_abort_busy(false),
_commit_busy(false),
_txn_pending_set()
-{
- assert(_jc->jfsize_sblks() % JRNL_RMGR_PAGE_SIZE == 0);
-}
+{}
wmgr::wmgr(jcntl* jc, enq_map& emap, txn_map& tmap, wrfc& wrfc,
const u_int32_t max_dtokpp, const u_int32_t max_iowait_us):
@@ -72,16 +70,14 @@
_fhdr_ptr_arr(0),
_iocba(0),
_cached_offset_dblks(0),
- _jfsize_dblks(_jc->jfsize_sblks() * JRNL_SBLK_SIZE),
- _jfsize_pgs(_jc->jfsize_sblks() / JRNL_WMGR_PAGE_SIZE),
+ _jfsize_dblks(0),
+ _jfsize_pgs(0),
_enq_busy(false),
_deq_busy(false),
_abort_busy(false),
_commit_busy(false),
_txn_pending_set()
-{
- assert(_jc->jfsize_sblks() % JRNL_RMGR_PAGE_SIZE == 0);
-}
+{}
wmgr::~wmgr()
{
@@ -99,6 +95,11 @@
_max_dtokpp = max_dtokpp;
_max_io_wait_us = max_iowait_us;
_cb = wr_cb;
+
+ _jfsize_dblks = _jc->jfsize_sblks() * JRNL_SBLK_SIZE;
+ _jfsize_pgs = _jc->jfsize_sblks() / JRNL_WMGR_PAGE_SIZE;
+ assert(_jc->jfsize_sblks() % JRNL_RMGR_PAGE_SIZE == 0);
+
initialize();
if (eo)
{
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -77,8 +77,8 @@
iocb** _iocba; ///< Array of iocb pointers for file header
writes
u_int32_t _cached_offset_dblks; ///< Amount of unwritten data in page
(dblocks)
std::deque<data_tok*> _ddtokl; ///< Deferred dequeue data_tok list
- const u_int32_t _jfsize_dblks; ///< Journal file size in dblks (NOT sblks!)
- const u_int32_t _jfsize_pgs; ///< Journal file size in cache pages
+ u_int32_t _jfsize_dblks; ///< Journal file size in dblks (NOT sblks!)
+ u_int32_t _jfsize_pgs; ///< Journal file size in cache pages
// TODO: Convert _enq_busy etc into a proper threadsafe lock
// TODO: Convert to enum? Are these encodes mutually exclusive?
Modified: store/trunk/cpp/tests/jrnl/_st_basic.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -34,6 +34,8 @@
#include <iostream>
#include <cmath>
+#include <iostream> // debug
+
using namespace boost::unit_test;
using namespace rhm::journal;
using namespace std;
@@ -51,7 +53,7 @@
string test_name = get_test_name(test_filename, "instantiation");
try
{
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jcntl jc(test_name, JRNL_DIR, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -63,9 +65,9 @@
string test_name = get_test_name(test_filename, "initialization");
try
{
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jcntl jc(test_name, JRNL_DIR, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
- jrnl_init(jc);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -79,8 +81,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
for (int m=0; m<NUM_MSGS; m++)
@@ -97,8 +99,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<2*NUM_MSGS; m+=2)
{
BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
@@ -116,8 +118,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS *
JRNL_SBLK_SIZE,
MSG_REC_SIZE_DBLKS, true);
for (unsigned m=0; m<3*2*n; m+=2) // overwrite files 3 times
@@ -137,10 +139,10 @@
try
{
{
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
+ jcntl jc(test_name, JRNL_DIR, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
- jrnl_init(jc);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
}
@@ -148,10 +150,10 @@
vector<string> txn_list;
u_int64_t hrid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
+ jcntl jc(test_name, JRNL_DIR, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
- jrnl_recover(jc, txn_list, hrid);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
BOOST_CHECK_EQUAL(jc.is_read_only(), true);
BOOST_CHECK_EQUAL(hrid, u_int64_t(0));
@@ -160,10 +162,10 @@
vector<string> txn_list;
u_int64_t hrid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
+ jcntl jc(test_name, JRNL_DIR, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
- jrnl_recover(jc, txn_list, hrid);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
BOOST_CHECK_EQUAL(jc.is_read_only(), true);
BOOST_CHECK_EQUAL(hrid, u_int64_t(0));
@@ -184,8 +186,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
@@ -193,8 +195,8 @@
vector<string> txn_list;
u_int64_t hrid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_recover(jc, txn_list, hrid);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
jc.recover_complete();
for (int m=0; m<NUM_MSGS; m++)
@@ -217,20 +219,20 @@
for (int m=0; m<2*NUM_MSGS; m+=2)
{
{
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
+ jcntl jc(test_name, JRNL_DIR, test_name);
if (m == 0)
- jrnl_init(jc); // First time only
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS); // First time
only
else
{
- jrnl_recover(jc, txn_list, hrid);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list,
hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(m - 1));
jc.recover_complete();
}
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
{
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_recover(jc, txn_list, hrid);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(m));
jc.recover_complete();
deq_msg(jc, m);
@@ -249,8 +251,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
// Transient msgs - should not recover
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), true);
@@ -269,8 +271,8 @@
vector<string> txn_list;
u_int64_t hrid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_recover(jc, txn_list, hrid);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
// Recover non-transient msgs
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
{
@@ -344,8 +346,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_DEFAULT_JFILES,
DEFAULT_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
unsigned m;
// Fill journal to just below threshold
@@ -380,8 +382,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_DEFAULT_JFILES,
DEFAULT_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
unsigned m;
// Fill journal to just below threshold
@@ -409,8 +411,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
u_int64_t rid = enq_msg(jc, 0, create_msg(msg, 0, MSG_SIZE), false);
deq_msg(jc, rid);
try{ deq_msg(jc, rid); BOOST_ERROR("Did not throw exception on second
dequeue."); }
Modified: store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -54,8 +54,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -76,8 +76,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -105,8 +105,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -128,8 +128,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -156,8 +156,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -178,8 +178,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -200,8 +200,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -223,8 +223,8 @@
string msg;
string xid;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -83,15 +83,16 @@
}
void
-jrnl_init(jcntl& jc)
+jrnl_init(jcntl& jc, const u_int16_t num_jfiles, const u_int32_t jfsize_sblks)
{
- jc.initialize(0, 0);
+ jc.initialize(num_jfiles, jfsize_sblks, 0, 0);
}
void
-jrnl_recover(jcntl& jc, vector<string>& txn_list, u_int64_t&
highest_rid)
+jrnl_recover(jcntl& jc, const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
+ vector<string>& txn_list, u_int64_t& highest_rid)
{
- jc.recover(0, 0, txn_list, highest_rid);
+ jc.recover(num_jfiles, jfsize_sblks, 0, 0, txn_list, highest_rid);
}
const u_int64_t
Modified: store/trunk/cpp/tests/jrnl/_st_read.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -57,8 +57,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -76,8 +76,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
jc.flush();
@@ -109,8 +109,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<2*NUM_MSGS; m+=2)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -137,8 +137,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
@@ -151,8 +151,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_recover(jc, txn_list, hrid);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
jc.recover_complete();
for (int m=0; m<NUM_MSGS; m++)
@@ -180,8 +180,8 @@
{
string msg;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
@@ -194,8 +194,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_recover(jc, txn_list, hrid);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
for (int m=0; m<NUM_MSGS; m++)
{
@@ -216,8 +216,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES,
TEST_JFSIZE_SBLKS);
- jrnl_recover(jc, txn_list, hrid);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_recover(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, txn_list, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
for (int m=0; m<NUM_MSGS; m++)
{
@@ -257,8 +257,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned m;
for (m=0; m<2*NUM_MSGS; m+=2)
{
@@ -285,8 +285,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned m;
unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE *
JRNL_SBLK_SIZE;
unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, MSG_REC_SIZE_DBLKS,
true);
@@ -315,8 +315,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE *
JRNL_SBLK_SIZE;
unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, MSG_REC_SIZE_DBLKS,
true);
unsigned m = 0;
Modified: store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -57,8 +57,8 @@
string rxid;
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
@@ -92,8 +92,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -124,8 +124,8 @@
string rxid;
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 1, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
@@ -151,8 +151,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -180,8 +180,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
create_xid(xid, 2, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
@@ -207,8 +207,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -236,8 +236,8 @@
bool externalFlag;
create_xid(xid, 3, XID_SIZE);
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
for (int m=0; m<NUM_MSGS; m++)
@@ -264,8 +264,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<3*NUM_MSGS; m+=3)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -295,8 +295,8 @@
bool externalFlag;
create_xid(xid, 4, XID_SIZE);
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
for (int m=0; m<NUM_MSGS; m++)
@@ -331,8 +331,8 @@
bool transientFlag;
bool externalFlag;
- jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
- jrnl_init(jc);
+ jcntl jc(test_name, JRNL_DIR, test_name);
+ jrnl_init(jc, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
for (int m=0; m<3*NUM_MSGS; m+=3)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2008-04-02 18:24:24 UTC (rev 1832)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2008-04-02 20:23:05 UTC (rev 1833)
@@ -40,7 +40,7 @@
jrnl_instance::jrnl_instance(const std::string& jid, const std::string& jdir,
const std::string& base_filename, const u_int16_t num_jfiles, const u_int32_t
jfsize_sblks):
- rhm::journal::jcntl(jid, jdir, base_filename, num_jfiles, jfsize_sblks),
+ rhm::journal::jcntl(jid, jdir, base_filename),
_jpp(new jrnl_init_params(jid, jdir, base_filename, num_jfiles, jfsize_sblks)),
_args_ptr(0),
_dtok_master_enq_list(),
@@ -61,8 +61,7 @@
}
jrnl_instance::jrnl_instance(const jrnl_init_params::shared_ptr& p):
- rhm::journal::jcntl(p->jid(), p->jdir(), p->base_filename(),
p->num_jfiles(),
- p->jfsize_sblks()),
+ rhm::journal::jcntl(p->jid(), p->jdir(), p->base_filename()),
_jpp(p),
_args_ptr(0),
_dtok_master_enq_list(),
@@ -111,19 +110,21 @@
{
std::vector<std::string> prep_txn_list;
u_int64_t highest_rid;
- recover(aio_rd_callback, aio_wr_callback, prep_txn_list, highest_rid);
+ recover(_jpp->num_jfiles(), _jpp->jfsize_sblks(), aio_rd_callback,
aio_wr_callback,
+ prep_txn_list, highest_rid);
recover_complete();
}
catch (const rhm::journal::jexception& e)
{
if (e.err_code() == rhm::journal::jerrno::JERR_JDIR_STAT)
- initialize(aio_rd_callback, aio_wr_callback);
+ initialize(_jpp->num_jfiles(), _jpp->jfsize_sblks(),
aio_rd_callback,
+ aio_wr_callback);
else
throw;
}
}
else
- initialize(aio_rd_callback, aio_wr_callback);
+ initialize(_jpp->num_jfiles(), _jpp->jfsize_sblks(), aio_rd_callback,
aio_wr_callback);
}
catch (const rhm::journal::jexception& e) { _tcrp->add_exception(e); }
catch (const std::exception& e) { _tcrp->add_exception(e.what()); }