Author: kpvdr
Date: 2010-08-19 13:12:41 -0400 (Thu, 19 Aug 2010)
New Revision: 4213
Removed:
store/trunk/cpp/lib/jrnl/arr_cnt.cpp
store/trunk/cpp/lib/jrnl/arr_cnt.hpp
store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp
Modified:
store/trunk/cpp/lib/Makefile.am
store/trunk/cpp/lib/jrnl/enq_map.cpp
store/trunk/cpp/lib/jrnl/enq_map.hpp
store/trunk/cpp/lib/jrnl/txn_map.cpp
store/trunk/cpp/lib/jrnl/txn_map.hpp
store/trunk/cpp/tests/jrnl/Makefile.am
store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
Log:
Removed class arr_cnt and replaced it with an instance of std::vector<u_int32_t>.
The corresponding unit test was also removed. Tests of enq_map and txn_map were fixed
(having an undiscovered logic error in them).
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/lib/Makefile.am 2010-08-19 17:12:41 UTC (rev 4213)
@@ -60,7 +60,6 @@
StoreException.h \
TxnCtxt.h \
jrnl/aio.cpp \
- jrnl/arr_cnt.cpp \
jrnl/cvar.cpp \
jrnl/data_tok.cpp \
jrnl/deq_rec.cpp \
@@ -88,7 +87,6 @@
jrnl/wrfc.cpp \
jrnl/aio.hpp \
jrnl/aio_callback.hpp \
- jrnl/arr_cnt.hpp \
jrnl/cvar.hpp \
jrnl/data_tok.hpp \
jrnl/deq_hdr.hpp \
Deleted: store/trunk/cpp/lib/jrnl/arr_cnt.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/arr_cnt.cpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/lib/jrnl/arr_cnt.cpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -1,171 +0,0 @@
-/**
- * \file arr_cnt.cpp
- *
- * Qpid asynchronous store plugin library
- *
- * File containing code for class mrg::journal::arr_cnt (enqueue map). See
- * comments in file arr_cnt.hpp for details.
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2007, 2008 Red Hat Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library 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/arr_cnt.hpp"
-
-#include <cassert>
-
-namespace mrg
-{
-namespace journal
-{
-
-arr_cnt::arr_cnt(): _size(0), _cnt_arr_ptr(0)
-{}
-
-arr_cnt::~arr_cnt()
-{
- clean(_cnt_arr_ptr, _size);
-}
-
-void
-arr_cnt::set_size(const u_int16_t size)
-{
- u_int16_t old_size = _size;
- u_int32_t** old_cnt_arr_ptr = _cnt_arr_ptr;
- _size = size;
- if (_size)
- {
- _cnt_arr_ptr = new u_int32_t*[_size];
- for (u_int16_t i=0; i<_size; i++)
- {
- _cnt_arr_ptr[i] = new u_int32_t;
- // transfer counts from old file array
- *_cnt_arr_ptr[i] = i < old_size ? *(old_cnt_arr_ptr[i]) : u_int32_t(0);
- }
- }
- else
- _cnt_arr_ptr = 0;
- clean(old_cnt_arr_ptr, old_size);
-}
-
-u_int32_t
-arr_cnt::cnt(const u_int16_t index) const
-{
- assert(_size == 0 || index < _size);
- if (_cnt_arr_ptr)
- return *(_cnt_arr_ptr[index]);
- return 0;
-}
-
-u_int32_t
-arr_cnt::incr(const u_int16_t index)
-{
- assert(_size == 0 || index < _size);
- if (_cnt_arr_ptr)
- return ++(*(_cnt_arr_ptr[index]));
- return 0;
-}
-
-u_int32_t
-arr_cnt::decr(const u_int16_t index)
-{
- assert(_size == 0 || index < _size);
- if (_cnt_arr_ptr)
- {
- assert(*(_cnt_arr_ptr[index]) > 0);
- return --(*(_cnt_arr_ptr[index]));
- }
- return 0;
-}
-
-u_int32_t
-arr_cnt::add(const u_int16_t index, u_int32_t amt)
-{
- assert(_size == 0 || index < _size);
- if (_cnt_arr_ptr)
- {
- *(_cnt_arr_ptr[index]) += amt;
- return *(_cnt_arr_ptr[index]);
- }
- return 0;
-}
-
-u_int32_t
-arr_cnt::sub(const u_int16_t index, u_int32_t amt)
-{
- assert(_size == 0 || index < _size);
- if (_cnt_arr_ptr)
- {
- assert(*(_cnt_arr_ptr[index]) >= amt);
- *(_cnt_arr_ptr[index]) -= amt;
- return *(_cnt_arr_ptr[index]);
- }
- return 0;
-}
-
-void
-arr_cnt::set_cnt(const u_int16_t index, u_int32_t val)
-{
- assert(_size == 0 || index < _size);
- if (_cnt_arr_ptr)
- *(_cnt_arr_ptr[index]) = val;
-}
-
-void
-arr_cnt::clear_cnt(const u_int16_t index)
-{
- assert(_size == 0 || index < _size);
- if (_cnt_arr_ptr)
- *(_cnt_arr_ptr[index]) = 0;
-}
-
-void
-arr_cnt::clear_all()
-{
- if (_cnt_arr_ptr)
- {
- for (u_int16_t i=0; i<_size; i++)
- *(_cnt_arr_ptr[i]) = 0;
- }
-}
-
-void
-arr_cnt::clean(u_int32_t** cnt_arr_ptr, const u_int16_t size)
-{
- if (cnt_arr_ptr)
- {
- for (u_int16_t i=0; i<size; i++)
- {
- if (cnt_arr_ptr[i])
- {
- delete cnt_arr_ptr[i];
- cnt_arr_ptr[i] = 0;
- }
- }
- delete[] cnt_arr_ptr;
- cnt_arr_ptr = 0;
- }
-}
-
-} // namespace journal
-} // namespace mrg
Deleted: store/trunk/cpp/lib/jrnl/arr_cnt.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/arr_cnt.hpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/lib/jrnl/arr_cnt.hpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -1,79 +0,0 @@
-/**
- * \file arr_cnt.hpp
- *
- * Qpid asynchronous store plugin library
- *
- * File containing code for class mrg::journal::arr_cnt (array counter).
- * See class documentation for details.
- *
- * \author Kim van der Riet
- *
- * Copyright (c) 2007, 2008 Red Hat Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library 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 mrg_journal_arr_cnt_hpp
-#define mrg_journal_arr_cnt_hpp
-
-#include <sys/types.h>
-
-namespace mrg
-{
-namespace journal
-{
-
- /**
- * \class arr_cnt
- * \brief Class which implements a dynamically allocated array of u_int32_t counters.
- * This is ideal where it is necessary to increment and decrement counts for an
entity
- * for which the number of elements is unknown, but for which the efficiency of a
static
- * array is required. None of the counts may go below zero.
- */
-
- // TODO: Replace this class with instance of std::vector<u_int32_t>
- class arr_cnt
- {
- private:
- u_int16_t _size;
- u_int32_t** _cnt_arr_ptr;
-
- public:
- arr_cnt();
- virtual ~arr_cnt();
-
- inline u_int16_t size() const { return _size; }
- void set_size(const u_int16_t size);
- u_int32_t cnt(const u_int16_t index) const;
- u_int32_t incr(const u_int16_t index);
- u_int32_t decr(const u_int16_t index);
- u_int32_t add(const u_int16_t index, u_int32_t amt);
- u_int32_t sub(const u_int16_t index, u_int32_t amt);
- void set_cnt(const u_int16_t index, u_int32_t val);
- void clear_cnt(const u_int16_t index);
- void clear_all();
- private:
- void clean(u_int32_t** cnt_arr_ptr, const u_int16_t size);
- };
-
-} // namespace journal
-} // namespace mrg
-
-#endif // ifndef mrg_journal_arr_cnt_hpp
Modified: store/trunk/cpp/lib/jrnl/enq_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.cpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/lib/jrnl/enq_map.cpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -61,7 +61,7 @@
void
enq_map::set_num_jfiles(const u_int16_t num_jfiles)
{
- _pfid_enq_cnt.set_size(num_jfiles);
+ _pfid_enq_cnt.resize(num_jfiles, 0);
}
@@ -82,7 +82,7 @@
}
if (ret.second == false)
return EMAP_DUP_RID;
- _pfid_enq_cnt.incr(pfid);
+ _pfid_enq_cnt.at(pfid)++;
return EMAP_OK;
}
@@ -109,7 +109,7 @@
return EMAP_LOCKED;
u_int16_t pfid = itr->second._pfid;
_map.erase(itr);
- _pfid_enq_cnt.decr(pfid);
+ _pfid_enq_cnt.at(pfid)--;
return pfid;
}
Modified: store/trunk/cpp/lib/jrnl/enq_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_map.hpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/lib/jrnl/enq_map.hpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -41,7 +41,6 @@
}
}
-#include "jrnl/arr_cnt.hpp"
#include "jrnl/jexception.hpp"
#include "jrnl/smutex.hpp"
#include <map>
@@ -98,14 +97,14 @@
emap _map;
smutex _mutex;
- arr_cnt _pfid_enq_cnt;
+ std::vector<u_int32_t> _pfid_enq_cnt;
public:
enq_map();
virtual ~enq_map();
void set_num_jfiles(const u_int16_t num_jfiles);
- inline u_int32_t get_enq_cnt(const u_int16_t pfid) const { return
_pfid_enq_cnt.cnt(pfid); };
+ inline u_int32_t get_enq_cnt(const u_int16_t pfid) const { return
_pfid_enq_cnt.at(pfid); };
int16_t insert_pfid(const u_int64_t rid, const u_int16_t pfid); // 0=ok;
-3=duplicate rid;
int16_t insert_pfid(const u_int64_t rid, const u_int16_t pfid, const bool
locked); // 0=ok; -3=duplicate rid;
Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -70,13 +70,13 @@
void
txn_map::set_num_jfiles(const u_int16_t num_jfiles)
{
- _pfid_txn_cnt.set_size(num_jfiles);
+ _pfid_txn_cnt.resize(num_jfiles, 0);
}
u_int32_t
txn_map::get_txn_pfid_cnt(const u_int16_t pfid) const
{
- return _pfid_txn_cnt.cnt(pfid);
+ return _pfid_txn_cnt.at(pfid);
}
bool
@@ -95,7 +95,7 @@
}
else
itr->second.push_back(td);
- _pfid_txn_cnt.incr(td._pfid);
+ _pfid_txn_cnt.at(td._pfid)++;
return ok;
}
@@ -125,7 +125,7 @@
txn_data_list list = itr->second;
_map.erase(itr);
for (tdl_itr i=list.begin(); i!=list.end(); i++)
- _pfid_txn_cnt.decr(i->_pfid);
+ _pfid_txn_cnt.at(i->_pfid)--;
return list;
}
Modified: store/trunk/cpp/lib/jrnl/txn_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.hpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/lib/jrnl/txn_map.hpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -41,7 +41,6 @@
}
}
-#include "jrnl/arr_cnt.hpp"
#include "jrnl/smutex.hpp"
#include <map>
#include <pthread.h>
@@ -126,7 +125,7 @@
xmap _map;
smutex _mutex;
- arr_cnt _pfid_txn_cnt;
+ std::vector<u_int32_t> _pfid_txn_cnt;
const txn_data_list _empty_data_list;
public:
Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/tests/jrnl/Makefile.am 2010-08-19 17:12:41 UTC (rev 4213)
@@ -43,7 +43,6 @@
TESTS = \
_ut_time_ns \
- _ut_arr_cnt \
_ut_jexception \
_ut_jerrno \
_ut_rec_hdr \
@@ -66,7 +65,6 @@
check_PROGRAMS = \
_ut_time_ns \
- _ut_arr_cnt \
_ut_jexception \
_ut_jerrno \
_ut_rec_hdr \
@@ -90,9 +88,6 @@
_ut_time_ns_SOURCES = _ut_time_ns.cpp $(UNIT_TEST_SRCS)
_ut_time_ns_LDADD = $(UNIT_TEST_LDADD)
-_ut_arr_cnt_SOURCES = _ut_arr_cnt.cpp $(UNIT_TEST_SRCS)
-_ut_arr_cnt_LDADD = $(UNIT_TEST_LDADD) -lrt
-
_ut_jexception_SOURCES = _ut_jexception.cpp $(UNIT_TEST_SRCS)
_ut_jexception_LDADD = $(UNIT_TEST_LDADD) -lrt
Deleted: store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/tests/jrnl/_ut_arr_cnt.cpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2008 Red Hat, Inc.
- *
- * This file is part of the Qpid async store library msgstore.so.
- *
- * This library 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 "../unit_test.h"
-
-#include <iostream>
-#include "jrnl/arr_cnt.hpp"
-
-using namespace boost::unit_test;
-using namespace mrg::journal;
-using namespace std;
-
-QPID_AUTO_TEST_SUITE(arr_cnt_suite)
-
-const string test_filename("_ut_arr_cnt");
-
-QPID_AUTO_TEST_CASE(default_constructor)
-{
- cout << test_filename << ".default_constructor: " <<
flush;
- arr_cnt a1;
- BOOST_CHECK_EQUAL(a1.size(), u_int16_t(0));
- BOOST_CHECK_EQUAL(a1.cnt(0), u_int32_t(0));
- BOOST_CHECK_EQUAL(a1.incr(0), u_int32_t(0));
- BOOST_CHECK_EQUAL(a1.decr(0), u_int32_t(0));
- BOOST_CHECK_EQUAL(a1.add(0, 100), u_int32_t(0));
- BOOST_CHECK_EQUAL(a1.sub(0, 100), u_int32_t(0));
- a1.set_cnt(0, 100);
- a1.clear_cnt(0);
- a1.clear_all();
- cout << "ok" << endl;
-}
-
-QPID_AUTO_TEST_CASE(basic_fns)
-{
- cout << test_filename << ".basic_fns: " << flush;
- const u_int16_t num_elts = 8;
- arr_cnt a2;
- BOOST_CHECK_EQUAL(a2.size(), u_int16_t(0));
- a2.set_size(num_elts);
- BOOST_CHECK_EQUAL(a2.size(), num_elts);
- for (u_int16_t i=0; i<num_elts; i++)
- {
- BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(0));
- BOOST_CHECK_EQUAL(a2.incr(i), u_int32_t(1));
- BOOST_CHECK_EQUAL(a2.decr(i), u_int32_t(0));
- BOOST_CHECK_EQUAL(a2.add(i, 100), u_int32_t(100));
- BOOST_CHECK_EQUAL(a2.sub(i, 100), u_int32_t(0));
- a2.set_cnt(i, 100);
- a2.set_cnt(i, 100);
- BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(100));
- a2.clear_cnt(i);
- BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(0));
- a2.set_cnt(i, i);
- }
- a2.clear_all();
- for (u_int16_t i=0; i<num_elts; i++)
- BOOST_CHECK_EQUAL(a2.cnt(i), u_int32_t(0));
- cout << "ok" << endl;
-}
-
-QPID_AUTO_TEST_CASE(resize)
-{
- cout << test_filename << ".resize: " << flush;
- arr_cnt a3;
- BOOST_CHECK_EQUAL(a3.size(), u_int16_t(0));
- a3.set_size(8);
- BOOST_CHECK_EQUAL(a3.size(), u_int16_t(8));
- a3.set_size(1000);
- BOOST_CHECK_EQUAL(a3.size(), u_int16_t(1000));
- a3.set_size(4);
- BOOST_CHECK_EQUAL(a3.size(), u_int16_t(4));
- a3.set_size(0);
- BOOST_CHECK_EQUAL(a3.size(), u_int16_t(0));
- a3.set_size(10);
- BOOST_CHECK_EQUAL(a3.size(), u_int16_t(10));
- cout << "ok" << endl;
-}
-
-QPID_AUTO_TEST_CASE(resize_up_transfer_cnt)
-{
- cout << test_filename << ".transfer_up: " << flush;
- const u_int16_t num_elts = 8;
- arr_cnt a4;
- a4.set_size(num_elts);
- for (u_int16_t i=0; i<num_elts; i++)
- a4.set_cnt(i, i*i);
- a4.set_size(2*num_elts);
- for (u_int16_t i=0; i<num_elts; i++)
- BOOST_CHECK_EQUAL(a4.cnt(i), u_int32_t(i*i));
- for (u_int16_t i=num_elts; i<2*num_elts; i++)
- BOOST_CHECK_EQUAL(a4.cnt(i), u_int32_t(0));
- cout << "ok" << endl;
-}
-
-QPID_AUTO_TEST_CASE(resize_down_transfer_cnt)
-{
- cout << test_filename << ".transfer_up: " << flush;
- const u_int16_t num_elts = 16;
- arr_cnt a5;
- a5.set_size(num_elts);
- for (u_int16_t i=0; i<num_elts; i++)
- a5.set_cnt(i, i*i);
- a5.set_size(num_elts/2);
- for (u_int16_t i=0; i<num_elts/2; i++)
- BOOST_CHECK_EQUAL(a5.cnt(i), u_int32_t(i*i));
- cout << "ok" << endl;
-}
-
-QPID_AUTO_TEST_CASE(null_immunity_after_resize_to_zero)
-{
- cout << test_filename << ".null_immunity_after_resize_to_zero:
" << flush;
- arr_cnt a6;
- a6.set_size(8);
- a6.set_size(0);
- BOOST_CHECK_EQUAL(a6.size(), u_int16_t(0));
- BOOST_CHECK_EQUAL(a6.cnt(8), u_int32_t(0));
- BOOST_CHECK_EQUAL(a6.incr(8), u_int32_t(0));
- BOOST_CHECK_EQUAL(a6.decr(8), u_int32_t(0));
- BOOST_CHECK_EQUAL(a6.add(8, 100), u_int32_t(0));
- BOOST_CHECK_EQUAL(a6.sub(8, 100), u_int32_t(0));
- a6.set_cnt(8, 100);
- a6.clear_cnt(8);
- a6.clear_all();
- cout << "ok" << endl;
-}
-
-QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -56,6 +56,7 @@
// insert with no dups
u_int64_t rid_incr_1 = 4ULL;
enq_map e2;
+ e2.set_num_jfiles(pfid_start + (rid_end - rid_begin)/rid_incr_1);
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1,
pfid++)
BOOST_CHECK_EQUAL(e2.insert_pfid(rid, pfid), enq_map::EMAP_OK);
BOOST_CHECK(!e2.empty());
@@ -113,6 +114,7 @@
u_int64_t rid_incr_1 = 4ULL;
u_int64_t num_incr_1 = (rid_end - rid_begin)/rid_incr_1;
enq_map e3;
+ e3.set_num_jfiles(pfid_start + (rid_end - rid_begin)/rid_incr_1);
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1,
pfid++)
BOOST_CHECK_EQUAL(e3.insert_pfid(rid, pfid), enq_map::EMAP_OK);
BOOST_CHECK_EQUAL(e3.size(), num_incr_1);
@@ -151,6 +153,7 @@
u_int64_t num_incr_1 = (rid_end - rid_begin)/rid_incr_1;
bool locked = false;
enq_map e4;
+ e4.set_num_jfiles(pfid_start + (rid_end - rid_begin)/rid_incr_1);
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1,
pfid++)
{
BOOST_CHECK_EQUAL(e4.insert_pfid(rid, pfid, locked), enq_map::EMAP_OK);
@@ -212,6 +215,7 @@
vector<u_int64_t> rid_list;
vector<u_int16_t> pfid_list;
enq_map e5;
+ e5.set_num_jfiles(pfid_start + (rid_end - rid_begin)/rid_incr_1);
for (rid = rid_begin, pfid = pfid_start; rid < rid_end; rid += rid_incr_1,
pfid++)
{
BOOST_CHECK_EQUAL(e5.insert_pfid(rid, pfid), enq_map::EMAP_OK);
@@ -295,6 +299,7 @@
u_int64_t num_rid = 10;
enq_map e7;
+ e7.set_num_jfiles(rid_begin + num_rid);
// insert even rids with no dups
for (rid = rid_begin, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL,
rid_cnt++)
@@ -308,7 +313,6 @@
// remove even rids
for (rid = rid_begin, rid_cnt = u_int64_t(0); rid_cnt < num_rid; rid += 2ULL,
rid_cnt++)
-// e7.Xget_remove_pfid(rid);
BOOST_CHECK(e7.get_remove_pfid(rid) >= enq_map::EMAP_OK);
BOOST_CHECK_EQUAL(e7.size(), num_rid);
Modified: store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp 2010-08-18 15:40:28 UTC (rev 4212)
+++ store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp 2010-08-19 17:12:41 UTC (rev 4213)
@@ -82,14 +82,15 @@
cout << test_filename << ".insert_get: " << flush;
u_int16_t fid;
u_int64_t rid;
- u_int16_t fid_start = 0x2000U;
+ u_int16_t pfid_start = 0x2000U;
u_int64_t rid_begin = 0xffffffff00000000ULL;
u_int64_t rid_end = 0xffffffff00000200ULL;
// insert with no dups
u_int64_t rid_incr_1 = 4ULL;
txn_map t2;
- for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_1, fid++)
+ t2.set_num_jfiles(pfid_start + (rid_end - rid_begin)/rid_incr_1);
+ for (rid = rid_begin, fid = pfid_start; rid < rid_end; rid += rid_incr_1, fid++)
t2.insert_txn_data(make_xid(rid), txn_data(rid, ~rid, fid, false));
BOOST_CHECK(!t2.empty());
BOOST_CHECK_EQUAL(t2.size(), u_int32_t(128));