Author: kpvdr
Date: 2010-08-11 13:07:24 -0400 (Wed, 11 Aug 2010)
New Revision: 4199
Modified:
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/rmgr.cpp
store/trunk/cpp/tests/python_tests/resize.py
Log:
Fix for Bug 622889 - "Store resize operation causes Qpid broker recovery to fail with
JERR_FCNTL_RDOFFSOVFL" A partly written journal (caused by a failure in the resize
utility - fixed under another BZ) was recovered, and caused this failure. This showed up a
corner case in which a large single recored spanning more than one journal file was partly
written.
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-08-11 12:57:39 UTC (rev 4198)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2010-08-11 17:07:24 UTC (rev 4199)
@@ -651,6 +651,7 @@
void chk_wr_frot();
inline u_int32_t unflushed_dblks() { return _wmgr.unflushed_dblks(); }
void fhdr_wr_sync(const u_int16_t lid);
+ inline u_int32_t wr_subm_cnt_dblks(const u_int16_t lfid) const { return
_lpmgr.get_fcntlp(lfid)->wr_subm_cnt_dblks(); }
// Management instrumentation callbacks
inline virtual void instr_incr_outstanding_aio_cnt() {}
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2010-08-11 12:57:39 UTC (rev 4198)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2010-08-11 17:07:24 UTC (rev 4199)
@@ -291,6 +291,9 @@
_rrfc.add_cmpl_cnt_dblks(JRNL_SBLK_SIZE);
u_int32_t fro_dblks = (_fhdr._fro / JRNL_DBLK_SIZE) - JRNL_SBLK_SIZE;
+ // Check fro_dblks does not exceed the write pointers which can happen in
some corrupted journal recoveries
+ if (fro_dblks > _jc->wr_subm_cnt_dblks(_fhdr._pfid) - JRNL_SBLK_SIZE)
+ fro_dblks = _jc->wr_subm_cnt_dblks(_fhdr._pfid) - JRNL_SBLK_SIZE;
_pg_cntr = fro_dblks / (JRNL_RMGR_PAGE_SIZE * JRNL_SBLK_SIZE);
u_int32_t tot_pg_offs_dblks = _pg_cntr * JRNL_RMGR_PAGE_SIZE *
JRNL_SBLK_SIZE;
_pg_index = _pg_cntr % JRNL_RMGR_PAGES;
Modified: store/trunk/cpp/tests/python_tests/resize.py
===================================================================
--- store/trunk/cpp/tests/python_tests/resize.py 2010-08-11 12:57:39 UTC (rev 4198)
+++ store/trunk/cpp/tests/python_tests/resize.py 2010-08-11 17:07:24 UTC (rev 4199)
@@ -77,6 +77,8 @@
broker = self.broker(store_args(), name="broker")
self.check_messages(broker, queue_name, msgs, True)
+
+ # TODO: Check the physical files to check number and size are as expected.
class SimpleTest(ResizeTest):
@@ -102,7 +104,7 @@
init_num_files = 8, init_file_size = 24,
resize_num_files = 6, resize_file_size = 12)
-# Put into long tests, make sure there is > 128GB free disk space
+# TODO: Put into long tests, make sure there is > 128GB free disk space
# def test_empty_store_max(self):
# self._resize_test(queue_name = "empty_store_max",
# num_msgs = 0, msg_size = 0,
Show replies by date