Author: kpvdr
Date: 2009-01-21 11:19:47 -0500 (Wed, 21 Jan 2009)
New Revision: 3062
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/txn_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
Log:
Further preparation for auto-expand: class txn_map - changed names using fid to pfid.
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -381,7 +381,7 @@
{
u_int16_t ffid = _wrfc.earliest_index();
u_int16_t fid = _wrfc.index();
- while ( _emap.get_enq_cnt(ffid) == 0 && _tmap.get_txn_fid_cnt(ffid) == 0
&& ffid != fid)
+ while ( _emap.get_enq_cnt(ffid) == 0 && _tmap.get_txn_pfid_cnt(ffid) == 0
&& ffid != fid)
{
if (++ffid >= _lpmgr.num_jfiles())
ffid = 0;
@@ -629,7 +629,7 @@
for (tdl_itr i=tdl.begin(); i<tdl.end(); i++)
{
if (i->_enq_flag) // enq op - decrement enqueue count
- rd._enq_cnt_list[i->_fid]--;
+ rd._enq_cnt_list[i->_pfid]--;
else if (_emap.is_enqueued(i->_drid, true)) // deq op - unlock
enq record
_emap.unlock(i->_drid);
}
@@ -751,7 +751,7 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag)
- rd._enq_cnt_list[itr->_fid]--;
+ rd._enq_cnt_list[itr->_pfid]--;
else
{
try { _emap.unlock(itr->_drid); }
@@ -784,7 +784,7 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag) // txn enqueue
- _emap.insert_pfid(itr->_rid, itr->_fid);
+ _emap.insert_pfid(itr->_rid, itr->_pfid);
else // txn dequeue
{
try
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -41,11 +41,11 @@
namespace journal
{
-txn_data_struct::txn_data_struct(const u_int64_t rid, const u_int64_t drid, const
u_int16_t fid,
+txn_data_struct::txn_data_struct(const u_int64_t rid, const u_int64_t drid, const
u_int16_t pfid,
const bool enq_flag, const bool commit_flag):
_rid(rid),
_drid(drid),
- _fid(fid),
+ _pfid(pfid),
_enq_flag(enq_flag),
_commit_flag(commit_flag),
_aio_compl(false)
@@ -53,7 +53,7 @@
txn_map::txn_map():
_map(),
- _fid_txn_cnt()
+ _pfid_txn_cnt()
{
pthread_mutex_init(&_mutex, 0);
}
@@ -66,7 +66,7 @@
void
txn_map::set_num_jfiles(const u_int16_t num_jfiles)
{
- _fid_txn_cnt.set_size(num_jfiles);
+ _pfid_txn_cnt.set_size(num_jfiles);
}
bool
@@ -85,7 +85,7 @@
}
else
itr->second.push_back(td);
- _fid_txn_cnt.incr(td._fid);
+ _pfid_txn_cnt.incr(td._pfid);
return ok;
}
@@ -123,7 +123,7 @@
txn_data_list list = itr->second;
_map.erase(itr);
for (tdl_itr i=list.begin(); i!=list.end(); i++)
- _fid_txn_cnt.decr(i->_fid);
+ _pfid_txn_cnt.decr(i->_pfid);
return list;
}
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -62,11 +62,11 @@
{
u_int64_t _rid; ///< Record id for this operation
u_int64_t _drid; ///< Dequeue record id for this operation
- u_int16_t _fid; ///< File id, to be used when transferring to emap on
commit
+ u_int16_t _pfid; ///< Physical file id, to be used when transferring to
emap on commit
bool _enq_flag; ///< If true, enq op, otherwise deq op
bool _commit_flag; ///< (2PC transactions) Records 2PC complete c/a mode
bool _aio_compl; ///< Initially false, set to true when record AIO returns
- txn_data_struct(const u_int64_t rid, const u_int64_t drid, const u_int16_t fid,
+ txn_data_struct(const u_int64_t rid, const u_int64_t drid, const u_int16_t pfid,
const bool enq_flag, const bool commit_flag = false);
};
typedef txn_data_struct txn_data;
@@ -89,7 +89,7 @@
*
* On transaction commit, then each operation is handled as follows:
*
- * If an enqueue (_enq_flag is true), then the rid and fid are transferred to the
enq_map.
+ * If an enqueue (_enq_flag is true), then the rid and pfid are transferred to the
enq_map.
* If a dequeue (_enq_flag is false), then the rid stored in the drid field is used
to
* remove the corresponding record from the enq_map.
*
@@ -102,9 +102,9 @@
* <pre>
* key data
*
- * xid1 --- vector< [ rid, drid, fid, enq_flag, commit_flag, aio_compl ] >
- * xid2 --- vector< [ rid, drid, fid, enq_flag, commit_flag, aio_compl ] >
- * xid3 --- vector< [ rid, drid, fid, enq_flag, commit_flag, aio_compl ] >
+ * xid1 --- vector< [ rid, drid, pfid, enq_flag, commit_flag, aio_compl ] >
+ * xid2 --- vector< [ rid, drid, pfid, enq_flag, commit_flag, aio_compl ] >
+ * xid3 --- vector< [ rid, drid, pfid, enq_flag, commit_flag, aio_compl ] >
* ...
* </pre>
*/
@@ -117,15 +117,15 @@
xmap _map;
pthread_mutex_t _mutex;
- arr_cnt _fid_txn_cnt;
+ arr_cnt _pfid_txn_cnt;
public:
txn_map();
virtual ~txn_map();
void set_num_jfiles(const u_int16_t num_jfiles);
- inline u_int32_t get_txn_fid_cnt(const u_int16_t fid) const
- { return _fid_txn_cnt.cnt(fid); };
+ inline u_int32_t get_txn_pfid_cnt(const u_int16_t pfid) const
+ { return _pfid_txn_cnt.cnt(pfid); };
bool insert_txn_data(const std::string& xid, const txn_data& td);
const txn_data_list get_tdata_list(const std::string& xid);
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -467,7 +467,7 @@
if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw;
}
if (itr->_enq_flag)
- _wrfc.decr_enqcnt(itr->_fid);
+ _wrfc.decr_enqcnt(itr->_pfid);
}
std::pair<std::set<std::string>::iterator, bool> res =
_txn_pending_set.insert(xid);
if (!res.second)
@@ -597,7 +597,7 @@
for (tdl_itr itr = tdl.begin(); itr != tdl.end(); itr++)
{
if (itr->_enq_flag) // txn enqueue
- _emap.insert_pfid(itr->_rid, itr->_fid);
+ _emap.insert_pfid(itr->_rid, itr->_pfid);
else // txn dequeue
{
u_int16_t fid = _emap.get_remove_pfid(itr->_drid, true);
Modified: store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp 2009-01-21 16:14:57 UTC (rev 3061)
+++ store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp 2009-01-21 16:19:47 UTC (rev 3062)
@@ -56,7 +56,7 @@
{
BOOST_CHECK_EQUAL(td1._rid, td2._rid);
BOOST_CHECK_EQUAL(td1._drid, td2._drid);
- BOOST_CHECK_EQUAL(td1._fid, td2._fid);
+ BOOST_CHECK_EQUAL(td1._pfid, td2._pfid);
BOOST_CHECK_EQUAL(td1._enq_flag, td2._enq_flag);
BOOST_CHECK_EQUAL(td1._aio_compl, td2._aio_compl);
}
@@ -68,12 +68,12 @@
cout << test_filename << ".constructor: " << flush;
const u_int64_t rid = 0x123456789abcdef0ULL;
const u_int64_t drid = 0xfedcba9876543210ULL;
- const u_int16_t fid = 0xfedcU;
+ const u_int16_t pfid = 0xfedcU;
const bool enq_flag = true;
- txn_data td(rid, drid, fid, enq_flag);
+ txn_data td(rid, drid, pfid, enq_flag);
BOOST_CHECK_EQUAL(td._rid, rid);
BOOST_CHECK_EQUAL(td._drid, drid);
- BOOST_CHECK_EQUAL(td._fid, fid);
+ BOOST_CHECK_EQUAL(td._pfid, pfid);
BOOST_CHECK_EQUAL(td._enq_flag, enq_flag);
BOOST_CHECK_EQUAL(td._aio_compl, false);