[rhmessaging-commits] rhmessaging commits: r3058 - in store/trunk/cpp: tests/jrnl and 1 other directory.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Tue Jan 20 12:42:23 EST 2009
Author: kpvdr
Date: 2009-01-20 12:42:23 -0500 (Tue, 20 Jan 2009)
New Revision: 3058
Modified:
store/trunk/cpp/lib/jrnl/fcntl.cpp
store/trunk/cpp/lib/jrnl/fcntl.hpp
store/trunk/cpp/lib/jrnl/lpmgr.cpp
store/trunk/cpp/lib/jrnl/rfc.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp
Log:
More incremental preparations for auto-expand
Modified: store/trunk/cpp/lib/jrnl/fcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/fcntl.cpp 2009-01-20 15:46:23 UTC (rev 3057)
+++ store/trunk/cpp/lib/jrnl/fcntl.cpp 2009-01-20 17:42:23 UTC (rev 3058)
@@ -45,11 +45,11 @@
namespace journal
{
-fcntl::fcntl(const std::string& fbasename, const u_int16_t fid, const u_int16_t lid, const u_int32_t jfsize_sblks,
+fcntl::fcntl(const std::string& fbasename, const u_int16_t pfid, const u_int16_t lfid, const u_int32_t jfsize_sblks,
const rcvdat* const ro):
_fname(),
- _fid(fid),
- _lid(lid),
+ _pfid(pfid),
+ _lfid(lfid),
_ffull_dblks(JRNL_SBLK_SIZE * (jfsize_sblks + 1)),
_wr_fh(-1),
_rec_enqcnt(0),
@@ -60,7 +60,7 @@
_aio_cnt(0),
_fhdr_wr_aio_outstanding(false)
{
- initialize(fbasename, fid, lid, jfsize_sblks, ro);
+ initialize(fbasename, pfid, lfid, jfsize_sblks, ro);
open_wr_fh();
}
@@ -90,7 +90,7 @@
{
if (!ro->_jempty)
{
- if (ro->_lfid == _fid)
+ if (ro->_lfid == _pfid)
{
_wr_subm_cnt_dblks = ro->_eo/JRNL_DBLK_SIZE;
_wr_cmpl_cnt_dblks = ro->_eo/JRNL_DBLK_SIZE;
@@ -100,7 +100,7 @@
_wr_subm_cnt_dblks = _ffull_dblks;
_wr_cmpl_cnt_dblks = _ffull_dblks;
}
- _rec_enqcnt = ro->_enq_cnt_list[_fid];
+ _rec_enqcnt = ro->_enq_cnt_list[_pfid];
return true;
}
}
@@ -122,7 +122,7 @@
if (_wr_fh < 0)
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid << " file=\"" << _fname << "\"" << FORMAT_SYSERR(errno);
+ oss << "pfid=" << _pfid << " lfid=" << _lfid << " file=\"" << _fname << "\"" << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR_FCNTL_OPENWR, oss.str(), "fcntl", "open_fh");
}
}
@@ -152,7 +152,7 @@
if (_rec_enqcnt == 0)
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid;
+ oss << "pfid=" << _pfid << " lfid=" << _lfid;
throw jexception(jerrno::JERR__UNDERFLOW, oss.str(), "fcntl", "decr_enqcnt");
}
return --_rec_enqcnt;
@@ -164,7 +164,7 @@
if (_rec_enqcnt < s)
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid << " rec_enqcnt=" << _rec_enqcnt << " decr=" << s;
+ oss << "pfid=" << _pfid << " lfid=" << _lfid << " rec_enqcnt=" << _rec_enqcnt << " decr=" << s;
throw jexception(jerrno::JERR__UNDERFLOW, oss.str(), "fcntl", "subtr_enqcnt");
}
_rec_enqcnt -= s;
@@ -177,7 +177,7 @@
if (_rd_subm_cnt_dblks + a > _wr_subm_cnt_dblks)
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid << " rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks << " incr=" << a;
+ oss << "pfid=" << _pfid << " lfid=" << _lfid << " rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks << " incr=" << a;
oss << " wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
throw jexception(jerrno::JERR_FCNTL_RDOFFSOVFL, oss.str(), "fcntl", "add_rd_subm_cnt_dblks");
}
@@ -191,7 +191,7 @@
if (_rd_cmpl_cnt_dblks + a > _rd_subm_cnt_dblks)
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid << " rd_cmpl_cnt_dblks=" << _rd_cmpl_cnt_dblks << " incr=" << a;
+ oss << "pfid=" << _pfid << " lfid=" << _lfid << " rd_cmpl_cnt_dblks=" << _rd_cmpl_cnt_dblks << " incr=" << a;
oss << " rd_subm_cnt_dblks=" << _rd_subm_cnt_dblks;
throw jexception(jerrno::JERR_FCNTL_CMPLOFFSOVFL, oss.str(), "fcntl", "add_rd_cmpl_cnt_dblks");
}
@@ -205,7 +205,7 @@
if (_wr_subm_cnt_dblks + a > _ffull_dblks) // Allow for file header
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid << " wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks << " incr=" << a;
+ oss << "pfid=" << _pfid << " lfid=" << _lfid << " wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks << " incr=" << a;
oss << " fsize=" << _ffull_dblks << " dblks";
throw jexception(jerrno::JERR_FCNTL_FILEOFFSOVFL, oss.str(), "fcntl", "add_wr_subm_cnt_dblks");
}
@@ -219,7 +219,7 @@
if (_wr_cmpl_cnt_dblks + a > _wr_subm_cnt_dblks)
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid << " wr_cmpl_cnt_dblks=" << _wr_cmpl_cnt_dblks << " incr=" << a;
+ oss << "pfid=" << _pfid << " lfid=" << _lfid << " wr_cmpl_cnt_dblks=" << _wr_cmpl_cnt_dblks << " incr=" << a;
oss << " wr_subm_cnt_dblks=" << _wr_subm_cnt_dblks;
throw jexception(jerrno::JERR_FCNTL_CMPLOFFSOVFL, oss.str(), "fcntl", "add_wr_cmpl_cnt_dblks");
}
@@ -233,7 +233,7 @@
if(_aio_cnt == 0)
{
std::ostringstream oss;
- oss << "fid=" << _fid << " lid=" << _lid << " Decremented aio_cnt to below zero";
+ oss << "pfid=" << _pfid << " lfid=" << _lfid << " Decremented aio_cnt to below zero";
throw jexception(jerrno::JERR__UNDERFLOW, oss.str(), "fcntl", "decr_aio_cnt");
}
return --_aio_cnt;
@@ -244,7 +244,7 @@
fcntl::status_str() const
{
std::ostringstream oss;
- oss << "fid=" << _fid << " ws=" << _wr_subm_cnt_dblks << " wc=" << _wr_cmpl_cnt_dblks;
+ oss << "pfid=" << _pfid << " ws=" << _wr_subm_cnt_dblks << " wc=" << _wr_cmpl_cnt_dblks;
oss << " rs=" << _rd_subm_cnt_dblks << " rc=" << _rd_cmpl_cnt_dblks;
oss << " ec=" << _rec_enqcnt << " ac=" << _aio_cnt;
return oss.str();
@@ -253,12 +253,12 @@
// Protected functions
void
-fcntl::initialize(const std::string& fbasename, const u_int16_t fid, const u_int16_t lid, const u_int32_t jfsize_sblks,
+fcntl::initialize(const std::string& fbasename, const u_int16_t pfid, const u_int16_t lfid, const u_int32_t jfsize_sblks,
const rcvdat* const ro)
{
- _fid = fid;
- _lid = lid;
- _fname = filename(fbasename, fid);
+ _pfid = pfid;
+ _lfid = lfid;
+ _fname = filename(fbasename, pfid);
#ifdef RHM_JOWRITE
// In test mode, only create file if it does not exist
@@ -272,7 +272,7 @@
{
// For last file only, set write counters to end of last record (the
// continuation point); for all others, set to eof.
- if (ro->_lfid == _fid)
+ if (ro->_lfid == _pfid)
{
_wr_subm_cnt_dblks = ro->_eo/JRNL_DBLK_SIZE;
_wr_cmpl_cnt_dblks = ro->_eo/JRNL_DBLK_SIZE;
@@ -283,7 +283,7 @@
_wr_cmpl_cnt_dblks = _ffull_dblks;
}
// Set the number of enqueued records for this file.
- _rec_enqcnt = ro->_enq_cnt_list[_fid];
+ _rec_enqcnt = ro->_enq_cnt_list[_pfid];
}
}
else // Normal initialization: create empty journal files
@@ -294,11 +294,11 @@
}
std::string
-fcntl::filename(const std::string& fbasename, const u_int16_t fid)
+fcntl::filename(const std::string& fbasename, const u_int16_t pfid)
{
std::ostringstream oss;
oss << fbasename << ".";
- oss << std::setw(4) << std::setfill('0') << std::hex << fid;
+ oss << std::setw(4) << std::setfill('0') << std::hex << pfid;
oss << "." << JRNL_DATA_EXTENSION;
return oss.str();
}
Modified: store/trunk/cpp/lib/jrnl/fcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/fcntl.hpp 2009-01-20 15:46:23 UTC (rev 3057)
+++ store/trunk/cpp/lib/jrnl/fcntl.hpp 2009-01-20 17:42:23 UTC (rev 3058)
@@ -58,8 +58,8 @@
{
protected:
std::string _fname; ///< File name
- u_int16_t _fid; ///< File ID (file number in order of creation)
- u_int16_t _lid; ///< Logical ID (ordinal number in ring store)
+ u_int16_t _pfid; ///< Physical file ID (file number in order of creation)
+ u_int16_t _lfid; ///< Logical file ID (ordinal number in ring store)
const u_int32_t _ffull_dblks; ///< File size in dblks (incl. file header)
int _wr_fh; ///< Write file handle
u_int32_t _rec_enqcnt; ///< Count of enqueued records
@@ -72,7 +72,7 @@
public:
// Constructors with implicit initialize() and open()
- fcntl(const std::string& fbasename, const u_int16_t fid, const u_int16_t lid, const u_int32_t jfsize_sblks,
+ fcntl(const std::string& fbasename, const u_int16_t pfid, const u_int16_t lfid, const u_int32_t jfsize_sblks,
const rcvdat* const ro);
virtual ~fcntl();
@@ -85,9 +85,9 @@
inline bool is_wr_fh_open() const { return _wr_fh >= 0; }
inline const std::string& fname() const { return _fname; }
- inline u_int16_t fid() const { return _fid; }
- inline u_int16_t lid() const { return _lid; }
- inline void set_lid(const u_int16_t lid) { _lid = lid; }
+ inline u_int16_t pfid() const { return _pfid; }
+ inline u_int16_t lfid() const { return _lfid; }
+ inline void set_lfid(const u_int16_t lfid) { _lfid = lfid; }
inline int wr_fh() const { return _wr_fh; }
inline u_int32_t enqcnt() const { return _rec_enqcnt; }
inline u_int32_t incr_enqcnt() { return ++_rec_enqcnt; }
@@ -140,10 +140,10 @@
const std::string status_str() const;
protected:
- virtual void initialize(const std::string& fbasename, const u_int16_t fid, const u_int16_t lid,
+ virtual void initialize(const std::string& fbasename, const u_int16_t pfid, const u_int16_t lfid,
const u_int32_t jfsize_sblks, const rcvdat* const ro);
- static std::string filename(const std::string& fbasename, const u_int16_t fid);
+ static std::string filename(const std::string& fbasename, const u_int16_t pfid);
void clean_file(const u_int32_t jfsize_sblks);
void create_jfile(const u_int32_t jfsize_sblks);
};
Modified: store/trunk/cpp/lib/jrnl/lpmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lpmgr.cpp 2009-01-20 15:46:23 UTC (rev 3057)
+++ store/trunk/cpp/lib/jrnl/lpmgr.cpp 2009-01-20 17:42:23 UTC (rev 3058)
@@ -133,7 +133,7 @@
{
fcntl* p = _fcntl_arr[lid];
assert(p != 0);
- p->set_lid(p->lid() + num_jfiles);
+ p->set_lfid(p->lfid() + num_jfiles);
}
}
@@ -190,7 +190,7 @@
{
pfid_list.clear();
for (std::size_t i = 0; i < _fcntl_arr.size(); i++)
- pfid_list.push_back(_fcntl_arr[i]->fid());
+ pfid_list.push_back(_fcntl_arr[i]->pfid());
}
void
@@ -199,7 +199,7 @@
lfid_list.clear();
lfid_list.assign(_fcntl_arr.size(), 0);
for (std::size_t i = 0; i < _fcntl_arr.size(); i++)
- lfid_list[_fcntl_arr[i]->fid()] = i;
+ lfid_list[_fcntl_arr[i]->pfid()] = i;
}
// === protected fns ===
Modified: store/trunk/cpp/lib/jrnl/rfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rfc.hpp 2009-01-20 15:46:23 UTC (rev 3057)
+++ store/trunk/cpp/lib/jrnl/rfc.hpp 2009-01-20 17:42:23 UTC (rev 3058)
@@ -150,9 +150,9 @@
inline fcntl* file_controller() const { return _curr_fc; }
/**
- * \brief Returns the currently active file id (fid)
+ * \brief Returns the currently active physical file id (pfid)
*/
- inline u_int16_t fid() const { return _curr_fc->fid(); }
+ inline u_int16_t pfid() const { return _curr_fc->pfid(); }
// Convenience access methods to current file controller
// Note: Do not call when not in active state
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2009-01-20 15:46:23 UTC (rev 3057)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2009-01-20 17:42:23 UTC (rev 3058)
@@ -658,7 +658,7 @@
void
rmgr::init_file_header_read()
{
- _jc->fhdr_wr_sync(_rrfc.fid()); // wait if the file header write is outstanding
+ _jc->fhdr_wr_sync(_rrfc.index()); // wait if the file header write is outstanding
int rfh = _rrfc.fh();
aio::prep_pread_2(_fhdr_aio_cb_ptr, rfh, _fhdr_buffer, _sblksize, 0);
if (aio::submit(_ioctx, 1, &_fhdr_aio_cb_ptr) < 0)
Modified: store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp 2009-01-20 15:46:23 UTC (rev 3057)
+++ store/trunk/cpp/tests/jrnl/_ut_lpmgr.cpp 2009-01-20 17:42:23 UTC (rev 3058)
@@ -370,7 +370,7 @@
BOOST_CHECK_EQUAL(a[i], b[i]);
fcntl* fp = lm.get_fcntlp(i);
BOOST_CHECK_MESSAGE(fp != (void*)0, "Unexpected void pointer returned by lpmgr::get_fcntlp()");
- if (fp) BOOST_CHECK_EQUAL(pfid_check ? fp->fid() : fp->lid(), pfid_check ? a[i] : i);
+ if (fp) BOOST_CHECK_EQUAL(pfid_check ? fp->pfid() : fp->lfid(), pfid_check ? a[i] : i);
}
}
@@ -382,7 +382,7 @@
BOOST_CHECK_EQUAL(a[i], b[i]);
fcntl* fp = lm.get_fcntlp(i);
BOOST_CHECK_MESSAGE(fp != (void*)0, "Unexpected void pointer returned by lpmgr::get_fcntlp()");
- if (fp) BOOST_CHECK_EQUAL(pfid_check ? fp->fid() : fp->lid(), pfid_check ? a[i] : i);
+ if (fp) BOOST_CHECK_EQUAL(pfid_check ? fp->pfid() : fp->lfid(), pfid_check ? a[i] : i);
}
}
@@ -394,7 +394,7 @@
BOOST_CHECK_EQUAL(i, f[i]);
fcntl* fp = lm.get_fcntlp(i);
BOOST_CHECK_MESSAGE(fp != (void*)0, "Unexpected void pointer returned by lpmgr::get_fcntlp()");
- if (fp) BOOST_CHECK_EQUAL(pfid_check ? fp->fid() : fp->lid(), i);
+ if (fp) BOOST_CHECK_EQUAL(pfid_check ? fp->pfid() : fp->lfid(), i);
}
}
};
More information about the rhmessaging-commits
mailing list