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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Aug 19 10:14:34 EDT 2011


Author: kpvdr
Date: 2011-08-19 10:14:33 -0400 (Fri, 19 Aug 2011)
New Revision: 4471

Modified:
   store/trunk/cpp/lib/jrnl/jerrno.cpp
   store/trunk/cpp/lib/jrnl/jerrno.hpp
   store/trunk/cpp/lib/jrnl/jinf.cpp
Log:
BZ732004: "Improve async store error messages for null .jinf file during recovery". Fixed up formatting error which caused the error message to be truncated, also inserted a new exception JERR_JINF_ZEROLENFILE which is thrown if the .jinf file is zero length.

Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp	2011-08-09 14:43:35 UTC (rev 4470)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp	2011-08-19 14:14:33 UTC (rev 4471)
@@ -132,6 +132,7 @@
 const u_int32_t jerrno::JERR_JINF_NOTREGFILE    = 0x0c07;
 const u_int32_t jerrno::JERR_JINF_BADFILESIZE   = 0x0c08;
 const u_int32_t jerrno::JERR_JINF_OWIBAD        = 0x0c09;
+const u_int32_t jerrno::JERR_JINF_ZEROLENFILE   = 0x0c0a;
 
 // Negative returns for some functions
 const int32_t jerrno::AIO_TIMEOUT               = -1;
@@ -232,6 +233,7 @@
     _err_map[JERR_JINF_NOTREGFILE] = "JERR_JINF_NOTREGFILE: Target journal data file is not a regular file";
     _err_map[JERR_JINF_BADFILESIZE] = "JERR_JINF_BADFILESIZE: Journal data file is of incorrect or unexpected size";
     _err_map[JERR_JINF_OWIBAD] = "JERR_JINF_OWIBAD: Journal data files have inconsistent OWI flags; >1 transition found in non-auto-expand or min-size journal";
+    _err_map[JERR_JINF_ZEROLENFILE] = "JERR_JINF_ZEROLENFILE: Journal info file zero length";
 
     //_err_map[] = "";
 

Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp	2011-08-09 14:43:35 UTC (rev 4470)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp	2011-08-19 14:14:33 UTC (rev 4471)
@@ -113,8 +113,8 @@
         static const u_int32_t JERR_RRFC_OPENRD;        ///< Unable to open file for read
 
         // class jrec, enq_rec, deq_rec, txn_rec
-        static const u_int32_t JERR_JREC_BADRECHDR;       ///< Invalid data record header
-        static const u_int32_t JERR_JREC_BADRECTAIL;      ///< Invalid data record tail
+        static const u_int32_t JERR_JREC_BADRECHDR;     ///< Invalid data record header
+        static const u_int32_t JERR_JREC_BADRECTAIL;    ///< Invalid data record tail
 
         // class wmgr
         static const u_int32_t JERR_WMGR_BADPGSTATE;    ///< Page buffer in illegal state.
@@ -150,6 +150,7 @@
         static const u_int32_t JERR_JINF_NOTREGFILE;    ///< Target file is not a regular file
         static const u_int32_t JERR_JINF_BADFILESIZE;   ///< File is of incorrect or unexpected size
         static const u_int32_t JERR_JINF_OWIBAD;        ///< OWI inconsistent (>1 transition in non-ae journal)
+        static const u_int32_t JERR_JINF_ZEROLENFILE;   ///< Journal info file is zero length (empty).
 
         // Negative returns for some functions
         static const int32_t AIO_TIMEOUT;               ///< Timeout waiting for AIO return

Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp	2011-08-09 14:43:35 UTC (rev 4470)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp	2011-08-19 14:14:33 UTC (rev 4471)
@@ -110,7 +110,7 @@
     if (_jver != RHM_JDAT_VERSION)
     {
         oss << "File \"" << _filename << "\": ";
-        oss << "RHM_JDAT_VERSION mismatch: " << _jver;
+        oss << "RHM_JDAT_VERSION mismatch: found=" << (int)_jver;
         oss << "; required=" << RHM_JDAT_VERSION << std::endl;
         err = true;
     }
@@ -155,14 +155,14 @@
     if (_sblk_size_dblks != JRNL_SBLK_SIZE)
     {
         oss << "File \"" << _filename << "\": ";
-        oss << "JRNL_SBLK_SIZE mismatch: " << _sblk_size_dblks;
+        oss << "JRNL_SBLK_SIZE mismatch: found=" << _sblk_size_dblks;
         oss << "; required=" << JRNL_SBLK_SIZE << std::endl;
         err = true;
     }
     if (_dblk_size != JRNL_DBLK_SIZE)
     {
         oss << "File \"" << _filename << "\": ";
-        oss << "JRNL_DBLK_SIZE mismatch: " << _dblk_size;
+        oss << "JRNL_DBLK_SIZE mismatch: found=" << _dblk_size;
         oss << "; required=" << JRNL_DBLK_SIZE << std::endl;
         err = true;
     }
@@ -421,9 +421,11 @@
     std::ifstream jinfs(jinf_filename.c_str());
     if (!jinfs.good())
         throw jexception(jerrno::JERR__FILEIO, jinf_filename.c_str(), "jinf", "read");
+    u_int32_t charcnt = 0;
     while (jinfs.good())
     {
         jinfs.getline(buff, 1023);
+        charcnt += std::strlen(buff);
         if (std::strstr(buff, "journal_version"))
             _jver = u_int16_value(buff);
         else if(std::strstr(buff, "id_string"))
@@ -461,6 +463,8 @@
         }
     }
     jinfs.close();
+    if (charcnt == 0)
+        throw jexception(jerrno::JERR_JINF_ZEROLENFILE, jinf_filename.c_str(), "jinf", "read");
 }
 
 bool



More information about the rhmessaging-commits mailing list