Author: kpvdr
Date: 2008-10-20 16:10:05 -0400 (Mon, 20 Oct 2008)
New Revision: 2664
Added:
store/trunk/cpp/tests/jrnl/_st_auto_expand.cpp
Modified:
store/trunk/cpp/tests/jrnl/
store/trunk/cpp/tests/jrnl/Makefile.am
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
Log:
Revised and reorganized journal tests for addition of auto-expand testing; added boost
test auto-expand test module.
Property changes on: store/trunk/cpp/tests/jrnl
___________________________________________________________________
Name: svn:ignore
- .deps
.libs
Makefile
Makefile.in
jtest
_ut_enq_map
_ut_arr_cnt
_ut_jdir
_ut_jerrno
_ut_jexception
_ut_jinf
_ut_lfmgr
_ut_rec_hdr
_ut_time_ns
_ut_txn_map
_st_basic
_st_basic_txn
_st_read
_st_read_txn
.valgrind.supp
.valgrindrc
+ .deps
.libs
Makefile
Makefile.in
jtest
_ut_enq_map
_ut_arr_cnt
_ut_jdir
_ut_jerrno
_ut_jexception
_ut_jinf
_ut_lfmgr
_ut_rec_hdr
_ut_time_ns
_ut_txn_map
_st_basic
_st_basic_txn
_st_read
_st_read_txn
_st_auto_expand
.valgrind.supp
.valgrindrc
Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am 2008-10-20 19:18:49 UTC (rev 2663)
+++ store/trunk/cpp/tests/jrnl/Makefile.am 2008-10-20 20:10:05 UTC (rev 2664)
@@ -56,6 +56,7 @@
_st_basic_txn \
_st_read \
_st_read_txn \
+ _st_auto_expand \
run-journal-tests \
../clean.sh
@@ -73,7 +74,8 @@
_st_basic \
_st_basic_txn \
_st_read \
- _st_read_txn
+ _st_read_txn \
+ _st_auto_expand
UNIT_TEST_SRCS = ../unit_test.cpp
UNIT_TEST_LDADD = -lboost_unit_test_framework ${top_builddir}/lib/msgstore.la
@@ -120,6 +122,9 @@
_st_read_txn_SOURCES = _st_read_txn.cpp _st_helper_fns.hpp $(UNIT_TEST_SRCS)
_st_read_txn_LDADD = $(UNIT_TEST_LDADD) -lrt
+_st_auto_expand_SOURCES = _st_auto_expand.cpp _st_helper_fns.hpp $(UNIT_TEST_SRCS)
+_st_auto_expand_LDADD = $(UNIT_TEST_LDADD) -lrt
+
EXTRA_DIST = \
run-journal-tests \
tests.ods
Added: store/trunk/cpp/tests/jrnl/_st_auto_expand.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_auto_expand.cpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/_st_auto_expand.cpp 2008-10-20 20:10:05 UTC (rev 2664)
@@ -0,0 +1,143 @@
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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 "../unit_test.h"
+#include <cmath>
+#include <iostream>
+#include "jrnl/jcntl.hpp"
+
+using namespace boost::unit_test;
+using namespace mrg::journal;
+using namespace std;
+
+QPID_AUTO_TEST_SUITE(journal_auto_expand)
+
+const string test_filename("_st_auto_expand");
+
+#include "_st_helper_fns.hpp"
+
+// === Test suite ===
+
+QPID_AUTO_TEST_CASE(no_ae_threshold)
+{
+ string test_name = get_test_name(test_filename, "no_ae_threshold");
+ try
+ {
+ string msg;
+
+ test_jrnl jc(test_name, test_dir, test_name);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
+ unsigned m;
+
+ // Fill journal to just below threshold
+ u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES,
+ DEFAULT_JFSIZE_SBLKS * JRNL_SBLK_SIZE, LARGE_MSG_REC_SIZE_DBLKS);
+ for (m=0; m<t; m++)
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
+ // This enqueue should exceed the threshold
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false,
RHM_IORES_ENQCAPTHRESH);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
+ }
+ catch(const exception& e) { BOOST_FAIL(e.what()); }
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(no_ae_threshold_dequeue_some)
+{
+ string test_name = get_test_name(test_filename,
"no_ae_threshold_dequeue_some");
+ try
+ {
+ string msg;
+
+ test_jrnl jc(test_name, test_dir, test_name);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
+ unsigned m;
+
+ // Fill journal to just below threshold
+ u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES,
+ DEFAULT_JFSIZE_SBLKS * JRNL_SBLK_SIZE, LARGE_MSG_REC_SIZE_DBLKS);
+ for (m=0; m<t; m++)
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
+ // This enqueue should exceed the threshold
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false,
RHM_IORES_ENQCAPTHRESH);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
+
+ // Dequeue 25 msgs
+ #define NUM_MSGS_DEQ 25
+ for (m=0; m<NUM_MSGS_DEQ; m++)
+ deq_msg(jc, m, m+t);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), u_int32_t(t-NUM_MSGS_DEQ));
+
+ // Check we can still enqueue and dequeue
+ for (m=t+NUM_MSGS_DEQ; m<t+NUM_MSGS_DEQ+NUM_MSGS; m++)
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
+ for (m=t+NUM_MSGS_DEQ; m<t+NUM_MSGS_DEQ+NUM_MSGS; m++)
+ deq_msg(jc, m, m+NUM_MSGS_DEQ+NUM_MSGS);
+ }
+ catch(const exception& e) { BOOST_FAIL(e.what()); }
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_CASE(no_ae_threshold_dequeue_all)
+{
+ string test_name = get_test_name(test_filename,
"no_ae_threshold_dequeue_all");
+ try
+ {
+ string msg;
+
+ test_jrnl jc(test_name, test_dir, test_name);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
+ unsigned m;
+
+ // Fill journal to just below threshold
+ u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES,
+ DEFAULT_JFSIZE_SBLKS * JRNL_SBLK_SIZE, LARGE_MSG_REC_SIZE_DBLKS);
+ for (m=0; m<t; m++)
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
+ // This enqueue should exceed the threshold
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false,
RHM_IORES_ENQCAPTHRESH);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
+
+ // Dequeue all msgs
+ for (m=0; m<t; m++)
+ deq_msg(jc, m, m+t);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), u_int32_t(0));
+
+ // Check we can still enqueue and dequeue
+ for (m=2*t; m<2*t + NUM_MSGS; m++)
+ enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
+ for (m=2*t; m<2*t + NUM_MSGS; m++)
+ deq_msg(jc, m, m+2*t+NUM_MSGS);
+ }
+ catch(const exception& e) { BOOST_FAIL(e.what()); }
+ cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/_st_basic.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-10-20 19:18:49 UTC (rev 2663)
+++ store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-10-20 20:10:05 UTC (rev 2664)
@@ -29,9 +29,6 @@
#include <cmath>
#include <iostream>
#include "jrnl/jcntl.hpp"
-#include "jrnl/jerrno.hpp"
-#include "jrnl/jexception.hpp"
-#include "jrnl/jcfg.hpp"
using namespace boost::unit_test;
using namespace mrg::journal;
@@ -83,7 +80,19 @@
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++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS);
+
+ // Again...
+ for (int m=2*NUM_MSGS; m<3*NUM_MSGS; m++)
+ BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
+ for (int m=2*NUM_MSGS; m<3*NUM_MSGS; m++)
+ deq_msg(jc, m, m+3*NUM_MSGS);
+
+ // Disjoint rids
+ for (int m=10*NUM_MSGS; m<11*NUM_MSGS; m++)
+ BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
+ for (int m=10*NUM_MSGS; m<11*NUM_MSGS; m++)
+ deq_msg(jc, m, m+11*NUM_MSGS);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
@@ -101,8 +110,22 @@
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));
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
}
+
+ // Again...
+ for (int m=2*NUM_MSGS; m<4*NUM_MSGS; m+=2)
+ {
+ BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
+ deq_msg(jc, m, m+1);
+ }
+
+ // Disjoint rids
+ for (int m=10*NUM_MSGS; m<12*NUM_MSGS; m+=2)
+ {
+ BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
+ deq_msg(jc, m, m+1);
+ }
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
@@ -118,11 +141,11 @@
test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS *
JRNL_SBLK_SIZE,
- MSG_REC_SIZE_DBLKS, true);
+ 16*MSG_REC_SIZE_DBLKS, true);
for (unsigned m=0; m<3*2*n; m+=2) // overwrite files 3 times
{
- enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
- deq_msg(jc, m);
+ enq_msg(jc, m, create_msg(msg, m, 16*MSG_SIZE), false);
+ deq_msg(jc, m, m+1);
}
jc.stop(true);
}
@@ -194,7 +217,7 @@
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
jc.recover_complete();
for (int m=0; m<NUM_MSGS; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -228,7 +251,7 @@
jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(m));
jc.recover_complete();
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
}
}
}
@@ -322,51 +345,15 @@
}
// Dequeue recovered messages
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+3*NUM_MSGS);
for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+2*NUM_MSGS);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
}
-QPID_AUTO_TEST_CASE(journal_threshold)
-{
- string test_name = get_test_name(test_filename, "journal_threshold");
- try
- {
- string msg;
-
- test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
- unsigned m;
-
- // Fill journal to just below threshold
- u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES,
- DEFAULT_JFSIZE_SBLKS * JRNL_SBLK_SIZE, LARGE_MSG_REC_SIZE_DBLKS);
- for (m=0; m<t; m++)
- enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
- // This enqueue should exceed the threshold
- BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
- enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false,
RHM_IORES_ENQCAPTHRESH);
- BOOST_CHECK_EQUAL(jc.get_enq_cnt(), t);
-
- // Dequeue all msgs
- for (m=0; m<t; m++)
- deq_msg(jc, m);
- BOOST_CHECK_EQUAL(jc.get_enq_cnt(), u_int32_t(0));
-
- // Check we can still enqueue and dequeue
- for (m=2*t; m<2*t + NUM_MSGS; m++)
- enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
- for (m=2*t; m<2*t + NUM_MSGS; m++)
- deq_msg(jc, m);
- }
- catch(const exception& e) { BOOST_FAIL(e.what()); }
- cout << "ok" << endl;
-}
-
QPID_AUTO_TEST_CASE(journal_overflow)
{
string test_name = get_test_name(test_filename, "journal_overflow");
@@ -389,8 +376,8 @@
// Dequeue as many msgs as possible except first
for (m=1; m<=d; m++)
- deq_msg(jc, m);
- deq_msg(jc, d+1, RHM_IORES_FULL);
+ deq_msg(jc, m, m+t);
+ deq_msg(jc, d+1, d+2, RHM_IORES_FULL);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
@@ -414,7 +401,7 @@
for (unsigned m=2*i*t; m<(2*i+1)*t; m++)
enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
for (unsigned m=2*i*t; m<(2*i+1)*t; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+t);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -437,7 +424,7 @@
for (unsigned m=0; m<5*2*t; m+=2)
{
enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -470,7 +457,7 @@
for (unsigned m=2*i*t; m<(2*i+1)*t; m++)
enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
for (unsigned m=2*i*t; m<(2*i+1)*t; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+t);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -503,7 +490,7 @@
for (unsigned m=2*i*t; m<2*(i+1)*t; m+=2)
{
enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
}
}
}
@@ -520,12 +507,12 @@
test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, false, 0, 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."); }
+ enq_msg(jc, 0, create_msg(msg, 0, MSG_SIZE), false);
+ deq_msg(jc, 0, 1);
+ try{ deq_msg(jc, 0, 2); BOOST_ERROR("Did not throw exception on second
dequeue."); }
catch (const jexception& e){ BOOST_CHECK_EQUAL(e.err_code(),
jerrno::JERR_WMGR_DEQRIDNOTENQ); }
- rid = enq_msg(jc, 1, create_msg(msg, 1, MSG_SIZE), false);
- deq_msg(jc, rid);
+ enq_msg(jc, 2, create_msg(msg, 1, MSG_SIZE), false);
+ deq_msg(jc, 2, 3);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
Modified: store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-10-20 19:18:49 UTC (rev 2663)
+++ store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-10-20 20:10:05 UTC (rev 2664)
@@ -29,9 +29,6 @@
#include <cmath>
#include <iostream>
#include "jrnl/jcntl.hpp"
-#include "jrnl/jerrno.hpp"
-#include "jrnl/jexception.hpp"
-#include "jrnl/jcfg.hpp"
using namespace boost::unit_test;
using namespace mrg::journal;
@@ -57,11 +54,10 @@
jc.initialize(NUM_TEST_JFILES, false, 0, 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),
- u_int64_t(m));
- txn_commit(jc, xid);
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(m));
+ txn_commit(jc, NUM_MSGS, xid);
for (int m=0; m<NUM_MSGS; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS+1);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
@@ -79,14 +75,13 @@
jc.initialize(NUM_TEST_JFILES, false, 0, 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),
- u_int64_t(m));
- txn_abort(jc, xid);
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(m));
+ txn_abort(jc, NUM_MSGS, xid);
for (int m=0; m<NUM_MSGS; m++)
{
try
{
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS+1);
BOOST_ERROR("Expected dequeue to fail with exception
JERR_WMGR_DEQRIDNOTENQ.");
}
catch (const jexception& e) { if (e.err_code() !=
jerrno::JERR_WMGR_DEQRIDNOTENQ) throw; }
@@ -109,10 +104,9 @@
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
- BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false),
- u_int64_t(3*m));
- txn_commit(jc, xid);
- deq_msg(jc, 3*m);
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(3*m));
+ txn_commit(jc, 3*m+1, xid);
+ deq_msg(jc, 3*m, 3*m+2);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -132,12 +126,11 @@
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
- BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false),
- u_int64_t(3*m));
- txn_abort(jc, xid);
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(3*m));
+ txn_abort(jc, 3*m+1, xid);
try
{
- deq_msg(jc, 3*m);
+ deq_msg(jc, 2*m, 2*m+2);
BOOST_ERROR("Expected dequeue to fail with exception
JERR_WMGR_DEQRIDNOTENQ.");
}
catch (const jexception& e) { if (e.err_code() !=
jerrno::JERR_WMGR_DEQRIDNOTENQ) throw; }
@@ -159,11 +152,13 @@
jc.initialize(NUM_TEST_JFILES, false, 0, 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),
- u_int64_t(m));
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(m));
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
for (int m=0; m<NUM_MSGS; m++)
- deq_txn_msg(jc, m, xid);
- txn_commit(jc, xid);
+ deq_txn_msg(jc, m, m+NUM_MSGS, xid);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
+ txn_commit(jc, 2*NUM_MSGS, xid);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
@@ -181,11 +176,13 @@
jc.initialize(NUM_TEST_JFILES, false, 0, 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),
- u_int64_t(m));
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(m));
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
for (int m=0; m<NUM_MSGS; m++)
- deq_txn_msg(jc, m, xid);
- txn_abort(jc, xid);
+ deq_txn_msg(jc, m, m+NUM_MSGS, xid);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
+ txn_abort(jc, 2*NUM_MSGS, xid);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
@@ -204,10 +201,10 @@
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
- BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false),
- u_int64_t(3*m));
- deq_txn_msg(jc, 3*m, xid);
- txn_commit(jc, xid);
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(3*m));
+ deq_txn_msg(jc, 3*m, 3*m+1, xid);
+ txn_commit(jc, 3*m+2, xid);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -227,10 +224,10 @@
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
- BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false),
- u_int64_t(3*m));
- deq_txn_msg(jc, 3*m, xid);
- txn_abort(jc, xid);
+ BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid,
false), u_int64_t(3*m));
+ deq_txn_msg(jc, 3*m, 3*m+1, xid);
+ txn_abort(jc, 3*m+2, xid);
+ BOOST_CHECK_EQUAL(jc.get_enq_cnt(), 0);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-10-20 19:18:49 UTC (rev 2663)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-10-20 20:10:05 UTC (rev 2664)
@@ -563,6 +563,8 @@
ctxt << "enq_msg(" << rid << ")";
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_external_rid(true);
try
{
iores res = jc.enqueue_data_record(msg.c_str(), msg.size(), msg.size(), dtp,
transient);
@@ -582,6 +584,8 @@
ctxt << "enq_extern_msg(" << rid << ")";
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_external_rid(true);
try
{
iores res = jc.enqueue_extern_data_record(msg_size, dtp, transient);
@@ -601,6 +605,8 @@
ctxt << "enq_txn_msg(" << rid << ")";
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_external_rid(true);
try
{
iores res = jc.enqueue_txn_data_record(msg.c_str(), msg.size(), msg.size(), dtp,
xid,
@@ -621,6 +627,8 @@
ctxt << "enq_extern_txn_msg(" << rid << ")";
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_external_rid(true);
try
{
iores res = jc.enqueue_extern_txn_data_record(msg_size, dtp, xid, transient);
@@ -633,14 +641,16 @@
}
u_int64_t
-deq_msg(jcntl& jc, const u_int64_t drid, const iores exp_ret = RHM_IORES_SUCCESS)
+deq_msg(jcntl& jc, const u_int64_t drid, const u_int64_t rid, const iores exp_ret =
RHM_IORES_SUCCESS)
{
ostringstream ctxt;
ctxt << "deq_msg(" << drid << ")";
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_dequeue_rid(drid);
+ dtp->set_external_rid(true);
dtp->set_wstate(data_tok::ENQ);
- dtp->set_rid(drid);
try
{
iores res = jc.dequeue_data_record(dtp);
@@ -653,15 +663,17 @@
}
u_int64_t
-deq_txn_msg(jcntl& jc, const u_int64_t drid, const string& xid,
+deq_txn_msg(jcntl& jc, const u_int64_t drid, const u_int64_t rid, const string&
xid,
const iores exp_ret = RHM_IORES_SUCCESS)
{
ostringstream ctxt;
ctxt << "deq_txn_msg(" << drid << ")";
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_dequeue_rid(drid);
+ dtp->set_external_rid(true);
dtp->set_wstate(data_tok::ENQ);
- dtp->set_rid(drid);
try
{
iores res = jc.dequeue_txn_data_record(dtp, xid);
@@ -674,10 +686,12 @@
}
u_int64_t
-txn_abort(jcntl& jc, const string& xid, const iores exp_ret = RHM_IORES_SUCCESS)
+txn_abort(jcntl& jc, const u_int64_t rid, const string& xid, const iores exp_ret
= RHM_IORES_SUCCESS)
{
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_external_rid(true);
try
{
iores res = jc.txn_abort(dtp, xid);
@@ -690,10 +704,12 @@
}
u_int64_t
-txn_commit(jcntl& jc, const string& xid, const iores exp_ret =
RHM_IORES_SUCCESS)
+txn_commit(jcntl& jc, const u_int64_t rid, const string& xid, const iores exp_ret
= RHM_IORES_SUCCESS)
{
test_dtok* dtp = new test_dtok;
BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+ dtp->set_rid(rid);
+ dtp->set_external_rid(true);
try
{
iores res = jc.txn_commit(dtp, xid);
Modified: store/trunk/cpp/tests/jrnl/_st_read.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-10-20 19:18:49 UTC (rev 2663)
+++ store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-10-20 20:10:05 UTC (rev 2664)
@@ -27,12 +27,8 @@
#include "../unit_test.h"
#include <cmath>
-#include <cstddef>
#include <iostream>
#include "jrnl/jcntl.hpp"
-#include "jrnl/jerrno.hpp"
-#include "jrnl/jexception.hpp"
-#include "jrnl/jcfg.hpp"
using namespace boost::unit_test;
using namespace mrg::journal;
@@ -91,7 +87,7 @@
}
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
for (int m=0; m<NUM_MSGS; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS);
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -100,7 +96,7 @@
QPID_AUTO_TEST_CASE(multi_page_enqueue_read_dequeue_block)
{
- string test_name = get_test_name(test_filename, "multi_page_read");
+ string test_name = get_test_name(test_filename,
"multi_page_enqueue_read_dequeue_block");
try
{
string msg;
@@ -111,20 +107,20 @@
test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(2*NUM_TEST_JFILES, false, 0, 10*TEST_JFSIZE_SBLKS);
- for (int m=0; m<NUM_MSGS*2000; m++)
- enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ for (int m=0; m<NUM_MSGS*125; m++)
+ enq_msg(jc, m, create_msg(msg, m, 16*MSG_SIZE), false);
jc.flush();
- for (int m=0; m<NUM_MSGS*2000; m++)
+ for (int m=0; m<NUM_MSGS*125; m++)
{
read_msg(jc, rmsg, xid, transientFlag, externalFlag);
- BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+ BOOST_CHECK_EQUAL(create_msg(msg, m, 16*MSG_SIZE), rmsg);
BOOST_CHECK_EQUAL(xid.size(), std::size_t(0));
BOOST_CHECK_EQUAL(transientFlag, false);
BOOST_CHECK_EQUAL(externalFlag, false);
}
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
- for (int m=0; m<NUM_MSGS*2000; m++)
- deq_msg(jc, m);
+ for (int m=0; m<NUM_MSGS*125; m++)
+ deq_msg(jc, m, m+NUM_MSGS*125);
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -153,7 +149,7 @@
BOOST_CHECK_EQUAL(xid.size(), std::size_t(0));
BOOST_CHECK_EQUAL(transientFlag, false);
BOOST_CHECK_EQUAL(externalFlag, false);
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
jc.flush();
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -197,16 +193,17 @@
}
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
for (int m=0; m<NUM_MSGS; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS);
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
}
-QPID_AUTO_TEST_CASE(multi_page_enqueue_recovered_read_dequeue)
+QPID_AUTO_TEST_CASE(multi_page_enqueue_recovered_read_dequeue_block)
{
- string test_name = get_test_name(test_filename,
"multi_page_enqueue_recovered_read_dequeue");
+ string test_name = get_test_name(test_filename,
"multi_page_enqueue_recovered_read_dequeue_block");
try
{
{
@@ -214,8 +211,8 @@
test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(2*NUM_TEST_JFILES, false, 0, 10*TEST_JFSIZE_SBLKS);
- for (int m=0; m<NUM_MSGS*2000; m++)
- enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+ for (int m=0; m<NUM_MSGS*125; m++)
+ enq_msg(jc, m, create_msg(msg, m, 16*MSG_SIZE), false);
}
{
string msg;
@@ -227,28 +224,29 @@
test_jrnl jc(test_name, test_dir, test_name);
jc.recover(2*NUM_TEST_JFILES, false, 0, 10*TEST_JFSIZE_SBLKS, 0, hrid);
- BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS*2000 - 1));
+ BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS*125 - 1));
jc.recover_complete();
- for (int m=0; m<NUM_MSGS*2000; m++)
+ for (int m=0; m<NUM_MSGS*125; m++)
{
read_msg(jc, rmsg, xid, transientFlag, externalFlag);
- BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+ BOOST_CHECK_EQUAL(create_msg(msg, m, 16*MSG_SIZE), rmsg);
BOOST_CHECK_EQUAL(xid.size(), std::size_t(0));
BOOST_CHECK_EQUAL(transientFlag, false);
BOOST_CHECK_EQUAL(externalFlag, false);
}
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
- for (int m=0; m<NUM_MSGS*2000; m++)
- deq_msg(jc, m);
+ for (int m=0; m<NUM_MSGS*125; m++)
+ deq_msg(jc, m, m+NUM_MSGS*125);
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "ok" << endl;
}
-QPID_AUTO_TEST_CASE(enqueue_recover_read_recovered_read_dequeue)
+QPID_AUTO_TEST_CASE(enqueue_recover_read_recovered_read_dequeue_block)
{
- string test_name = get_test_name(test_filename,
"enqueue_recover_read_recovered_read_dequeue");
+ string test_name = get_test_name(test_filename,
"enqueue_recover_read_recovered_read_dequeue_block");
try
{
{
@@ -311,7 +309,8 @@
}
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
for (int m=0; m<NUM_MSGS; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS);
+ read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -335,7 +334,7 @@
for (m=0; m<2*NUM_MSGS; m+=2)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
}
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
jc.flush();
@@ -361,11 +360,11 @@
jc.initialize(NUM_TEST_JFILES, false, 0, 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);
+ unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, 16*MSG_REC_SIZE_DBLKS,
true);
for (m=0; m<2*2*n + 20; m+=2) // fill read buffer twice + 10 msgs
{
- enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
- deq_msg(jc, m);
+ enq_msg(jc, m, create_msg(msg, m, 16*MSG_SIZE), false);
+ deq_msg(jc, m, m+1);
}
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
jc.flush();
@@ -397,7 +396,7 @@
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
jc.flush();
read_msg(jc, rmsg, xid, transientFlag, externalFlag);
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
m += 2;
// repeat the following multiple times...
@@ -408,7 +407,7 @@
for (; m<t; m+=2)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
}
// Revalidate read pipeline
@@ -416,7 +415,7 @@
jc.flush();
read_msg(jc, rmsg, xid, transientFlag, externalFlag);
BOOST_CHECK_EQUAL(msg, rmsg);
- deq_msg(jc, m);
+ deq_msg(jc, m, m+1);
m += 2;
}
}
Modified: store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-10-20 19:18:49 UTC (rev 2663)
+++ store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-10-20 20:10:05 UTC (rev 2664)
@@ -27,12 +27,8 @@
#include "../unit_test.h"
#include <cmath>
-#include <cstddef>
#include <iostream>
#include "jrnl/jcntl.hpp"
-#include "jrnl/jerrno.hpp"
-#include "jrnl/jexception.hpp"
-#include "jrnl/jcfg.hpp"
using namespace boost::unit_test;
using namespace mrg::journal;
@@ -64,7 +60,7 @@
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_commit(jc, xid);
+ txn_commit(jc, NUM_MSGS, xid);
jc.flush();
for (int m=0; m<NUM_MSGS; m++)
{
@@ -96,14 +92,14 @@
jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
- create_xid(xid, m, XID_SIZE);
- enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false);
+ create_xid(xid, 2*m, XID_SIZE);
+ enq_txn_msg(jc, 2*m, create_msg(msg, 2*m, MSG_SIZE), xid, false);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_commit(jc, xid);
+ txn_commit(jc, 2*m+1, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag);
- BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+ BOOST_CHECK_EQUAL(create_msg(msg, 2*m, MSG_SIZE), rmsg);
BOOST_CHECK_EQUAL(rxid, xid);
BOOST_CHECK_EQUAL(transientFlag, false);
BOOST_CHECK_EQUAL(externalFlag, false);
@@ -131,7 +127,7 @@
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_abort(jc, xid);
+ txn_abort(jc, NUM_MSGS, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -155,11 +151,11 @@
jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
- create_xid(xid, m, XID_SIZE);
- enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false);
+ create_xid(xid, 2*m, XID_SIZE);
+ enq_txn_msg(jc, 2*m, create_msg(msg, 2*m, MSG_SIZE), xid, false);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_abort(jc, xid);
+ txn_abort(jc, 2*m+1, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -185,9 +181,9 @@
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);
- txn_commit(jc, xid);
+ txn_commit(jc, NUM_MSGS, xid);
for (int m=0; m<NUM_MSGS; m++)
- deq_msg(jc, m);
+ deq_msg(jc, m, m+NUM_MSGS+1);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -211,10 +207,10 @@
jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
- create_xid(xid, m, XID_SIZE);
+ create_xid(xid, 3*m, XID_SIZE);
enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false);
- txn_commit(jc, xid);
- deq_msg(jc, 3*m);
+ txn_commit(jc, 3*m+1, xid);
+ deq_msg(jc, 3*m, 3*m+2);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -241,10 +237,10 @@
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++)
- deq_txn_msg(jc, m, xid);
+ deq_txn_msg(jc, m, m+NUM_MSGS, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_commit(jc, xid);
+ txn_commit(jc, 2*NUM_MSGS, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -266,14 +262,14 @@
test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
- for (int m=0; m<3*NUM_MSGS; m+=3)
+ for (int m=0; m<NUM_MSGS; m++)
{
- enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
- create_xid(xid, m, XID_SIZE);
- deq_txn_msg(jc, m, xid);
+ enq_msg(jc, 3*m, create_msg(msg, 3*m, MSG_SIZE), false);
+ create_xid(xid, 3*m, XID_SIZE);
+ deq_txn_msg(jc, 3*m, 3*m+1, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_commit(jc, xid);
+ txn_commit(jc, 3*m+2, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
@@ -300,10 +296,10 @@
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++)
- deq_txn_msg(jc, m, xid);
+ deq_txn_msg(jc, m, m+NUM_MSGS, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_abort(jc, xid);
+ txn_abort(jc, 2*NUM_MSGS, xid);
jc.flush();
for (int m=0; m<NUM_MSGS; m++)
{
@@ -333,14 +329,14 @@
test_jrnl jc(test_name, test_dir, test_name);
jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
- for (int m=0; m<3*NUM_MSGS; m+=3)
+ for (int m=0; m<NUM_MSGS; m++)
{
- enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
- create_xid(xid, m, XID_SIZE);
- deq_txn_msg(jc, m, xid);
+ enq_msg(jc, 3*m, create_msg(msg, 3*m, MSG_SIZE), false);
+ create_xid(xid, 3*m, XID_SIZE);
+ deq_txn_msg(jc, 3*m, 3*m+1, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_TXPENDING);
- txn_abort(jc, xid);
+ txn_abort(jc, 3*m+2, xid);
jc.flush();
read_msg(jc, rmsg, rxid, transientFlag, externalFlag);
read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);