[rhmessaging-commits] rhmessaging commits: r3114 - store/trunk/cpp/lib/jrnl.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Feb 10 10:45:51 EST 2009


Author: kpvdr
Date: 2009-02-10 10:45:50 -0500 (Tue, 10 Feb 2009)
New Revision: 3114

Modified:
   store/trunk/cpp/lib/jrnl/jcntl.cpp
   store/trunk/cpp/lib/jrnl/jcntl.hpp
Log:
Fix for BZ474366 - "qpidd+store jcntl::check_owi() threw JERR_JCNTL_OWIMISMATCH on journal recovery".

Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp	2009-02-10 12:35:49 UTC (rev 3113)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp	2009-02-10 15:45:50 UTC (rev 3114)
@@ -818,13 +818,11 @@
             }
             break;
         case 0:
-            check_journal_alignment(fid, file_pos);
-            rd._eo = file_pos;
+            check_journal_alignment(fid, file_pos, rd);
             return false;
         default:
             // Stop as this is the overwrite boundary.
-            check_journal_alignment(fid, file_pos);
-            rd._eo = file_pos;
+            check_journal_alignment(fid, file_pos, rd);
             return false;
     }
     return true;
@@ -850,9 +848,8 @@
 //                     fid != (rd._ffid ? rd._ffid - 1 : _num_jfiles - 1)) throw;
 // Tried this, but did not work
 //             if (e.err_code() != jerrno::JERR_JREC_BADRECTAIL || h._magic != 0) throw;
-            check_journal_alignment(start_fid, start_file_offs);
+            check_journal_alignment(start_fid, start_file_offs, rd);
 //             rd._lfid = start_fid;
-            rd._eo = start_file_offs;
             return false;
         }
         if (!done && !jfile_cycle(fid, ifsp, lowi, rd, false))
@@ -919,8 +916,7 @@
         u_int16_t expected_fid = rd._ffid ? rd._ffid - 1 : rd._njf - 1;
         if (fid == expected_fid)
         {
-            check_journal_alignment(fid, file_pos);
-            rd._eo = file_pos;
+            check_journal_alignment(fid, file_pos, rd);
             return false;
         }
         std::ostringstream oss;
@@ -938,7 +934,7 @@
 
 
 void
-jcntl::check_journal_alignment(const u_int16_t fid, std::streampos& file_pos)
+jcntl::check_journal_alignment(const u_int16_t fid, std::streampos& file_pos, rcvdat& rd)
 {
     unsigned sblk_offs = file_pos % (JRNL_DBLK_SIZE * JRNL_SBLK_SIZE);
     if (sblk_offs)
@@ -972,14 +968,18 @@
             ofsp.write((const char*)buff, JRNL_DBLK_SIZE);
             assert(!ofsp.fail());
             std::ostringstream oss;
-            oss << "Recover phase write: Wrote filler record at offs=0x" << std::hex << file_pos << std::dec;
+            oss << std::hex << "Recover phase write: Wrote filler record: fid=0x" << fid << " offs=0x" << file_pos;
             this->log(LOG_NOTICE, oss.str());
             file_pos = ofsp.tellp();
         }
         ofsp.close();
         std::free(buff);
+        rd._lfid = fid;
+        if (rd._ffid)
+            rd._ffid = (fid + 1) % rd._njf;
         this->log(LOG_INFO, "Bad record alignment fixed.");
     }
+    rd._eo = file_pos;
 }
 
 } // namespace journal

Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp	2009-02-10 12:35:49 UTC (rev 3113)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp	2009-02-10 15:45:50 UTC (rev 3114)
@@ -701,7 +701,7 @@
         bool check_owi(const u_int16_t fid, rec_hdr& h, bool& lowi, rcvdat& rd,
                 std::streampos& read_pos);
 
-        void check_journal_alignment(const u_int16_t fid, std::streampos& rec_offset);
+        void check_journal_alignment(const u_int16_t fid, std::streampos& rec_offset, rcvdat& rd);
     };
 
 } // namespace journal




More information about the rhmessaging-commits mailing list