[rhmessaging-commits] rhmessaging commits: r1692 - in store/trunk/cpp: lib/jrnl and 1 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Feb 12 18:06:36 EST 2008


Author: kpvdr
Date: 2008-02-12 18:06:36 -0500 (Tue, 12 Feb 2008)
New Revision: 1692

Modified:
   store/trunk/cpp/docs/jrnl_tmpl.dox
   store/trunk/cpp/lib/jrnl/jcntl.cpp
   store/trunk/cpp/lib/jrnl/jinf.cpp
   store/trunk/cpp/lib/jrnl/jinf.hpp
   store/trunk/cpp/lib/jrnl/rmgr.cpp
   store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
Log:
Bugfixes for read logic and recovery logic.

Modified: store/trunk/cpp/docs/jrnl_tmpl.dox
===================================================================
--- store/trunk/cpp/docs/jrnl_tmpl.dox	2008-02-12 16:56:16 UTC (rev 1691)
+++ store/trunk/cpp/docs/jrnl_tmpl.dox	2008-02-12 23:06:36 UTC (rev 1692)
@@ -1,4 +1,4 @@
-# Doxyfile 1.5.1
+# Doxyfile 1.5.4
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project
@@ -14,10 +14,18 @@
 # Project related configuration options
 #---------------------------------------------------------------------------
 
+# This tag specifies the encoding used for all characters in the config file that 
+# follow. The default is UTF-8 which is also the encoding used for all text before 
+# the first occurrence of this tag. Doxygen uses libiconv (or the iconv built into 
+# libc) for the transcoding. See http://www.gnu.org/software/libiconv for the list of 
+# possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
 # by quotes) that should identify the project.
 
-PROJECT_NAME           = "Red Hat Messaging Journal (RHMJ)"
+PROJECT_NAME           = "Red Hat Messaging Journal (RHMJ) "
 
 # The PROJECT_NUMBER tag can be used to enter a project or revision number. 
 # This could be handy for archiving the generated documentation or 
@@ -53,16 +61,6 @@
 
 OUTPUT_LANGUAGE        = English
 
-# This tag can be used to specify the encoding used in the generated output. 
-# The encoding is not always determined by the language that is chosen, 
-# but also whether or not the output is meant for Windows or non-Windows users. 
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
-# forces the Windows encoding (this is the default for the Windows binary), 
-# whereas setting the tag to NO uses a Unix-style encoding (the default for 
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING   = NO
-
 # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
 # include brief member descriptions after the members that are listed in 
 # the file and class documentation (similar to JavaDoc). 
@@ -135,11 +133,19 @@
 # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
 # will interpret the first line (until the first dot) of a JavaDoc-style 
 # comment as the brief description. If set to NO, the JavaDoc 
-# comments will behave just like the Qt-style comments (thus requiring an 
-# explicit @brief command for a brief description.
+# comments will behave just like regular Qt-style comments 
+# (thus requiring an explicit @brief command for a brief description.)
 
 JAVADOC_AUTOBRIEF      = NO
 
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will 
+# interpret the first line (until the first dot) of a Qt-style 
+# comment as the brief description. If set to NO, the comments 
+# will behave just like regular Qt-style comments (thus requiring 
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
 # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
 # treat a multi-line C++ special comment block (i.e. a block of //! or /// 
 # comments) as a brief description. This used to be the default behaviour. 
@@ -204,6 +210,17 @@
 
 BUILTIN_STL_SUPPORT    = YES
 
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. 
+# Doxygen will parse them like normal C++ but will assume all classes use public 
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
 # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
 # tag is set to YES, then doxygen will reuse the documentation of the first 
 # member in the group (if any) for the other members of the group. By default 
@@ -219,6 +236,16 @@
 
 SUBGROUPING            = YES
 
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct (or union) is 
+# documented as struct with the name of the typedef. So 
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct 
+# with name TypeT. When disabled the typedef will appear as a member of a file, 
+# namespace, or class. And the struct will be named TypeS. This can typically 
+# be useful for C code where the coding convention is that all structs are 
+# typedef'ed and only the typedef is referenced never the struct's name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
@@ -253,6 +280,13 @@
 
 EXTRACT_LOCAL_METHODS  = YES
 
+# If this flag is set to YES, the members of anonymous namespaces will be extracted 
+# and appear in the documentation as a namespace called 'anonymous_namespace{file}', 
+# where file will be replaced with the base name of the file that contains the anonymous 
+# namespace. By default anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
 # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
 # undocumented members of documented classes, files or namespaces. 
 # If set to NO (the default) these members will be included in the 
@@ -442,7 +476,7 @@
 # $version, which will be replaced by the version of the file (if it could 
 # be obtained via FILE_VERSION_FILTER)
 
-WARN_FORMAT            = "$file:$line: $text"
+WARN_FORMAT            = "$file:$line: $text "
 
 # The WARN_LOGFILE tag can be used to specify a file to which warning 
 # and error messages should be written. If left blank the output is written 
@@ -461,14 +495,22 @@
 
 INPUT                  = ../lib/jrnl
 
+# This tag can be used to specify the character encoding of the source files that 
+# doxygen parses. Internally doxygen uses the UTF-8 encoding, which is also the default 
+# input encoding. Doxygen uses libiconv (or the iconv built into libc) for the transcoding. 
+# See http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
 # If the value of the INPUT tag contains directories, you can use the 
 # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
 # and *.h) to filter out the source-files in the directories. If left 
 # blank the following patterns are tested: 
 # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
 
-FILE_PATTERNS          = *.cpp *.hpp
+FILE_PATTERNS          = *.cpp \
+                         *.hpp
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories 
 # should be searched for input files as well. Possible values are YES and NO. 
@@ -496,6 +538,13 @@
 
 EXCLUDE_PATTERNS       = 
 
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names 
+# (namespaces, classes, functions, etc.) that should be excluded from the output. 
+# The symbol name can be a fully qualified name, a word, or if the wildcard * is used, 
+# a substring. Examples: ANamespace, AClass, AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = 
+
 # The EXAMPLE_PATH tag can be used to specify one or more files or 
 # directories that contain example code fragments that are included (see 
 # the \include command).
@@ -554,7 +603,9 @@
 # If the SOURCE_BROWSER tag is set to YES then a list of source files will 
 # be generated. Documented entities will be cross-referenced with these sources. 
 # Note: To get rid of all source code in the generated output, make sure also 
-# VERBATIM_HEADERS is set to NO.
+# VERBATIM_HEADERS is set to NO. If you have enabled CALL_GRAPH or CALLER_GRAPH 
+# then you must also enable this option. If you don't then doxygen will produce 
+# a warning and turn it on anyway
 
 SOURCE_BROWSER         = YES
 
@@ -680,6 +731,14 @@
 
 GENERATE_HTMLHELP      = NO
 
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
+# documentation will contain sections that can be hidden and shown after the 
+# page has loaded. For this to work a browser that supports 
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = NO
+
 # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
 # be used to specify the file name of the resulting .chm file. You 
 # can add a path in front of the file if the result should not be 
@@ -1085,6 +1144,14 @@
 
 CLASS_DIAGRAMS         = YES
 
+# You can define message sequence charts within doxygen comments using the \msc 
+# command. Doxygen will then run the mscgen tool (see http://www.mcternan.me.uk/mscgen/) to 
+# produce the chart and insert it in the documentation. The MSCGEN_PATH tag allows you to 
+# specify the directory where the mscgen tool resides. If left empty the tool is assumed to 
+# be found in the default search path.
+
+MSCGEN_PATH            = 
+
 # If set to YES, the inheritance and collaboration graphs will hide 
 # inheritance and usage relations if the target is undocumented 
 # or is not a class.
@@ -1142,7 +1209,7 @@
 
 INCLUDED_BY_GRAPH      = YES
 
-# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# If the CALL_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will 
 # generate a call dependency graph for every global function or class method. 
 # Note that enabling this option will significantly increase the time of a run. 
 # So in most cases it will be better to enable call graphs for selected 
@@ -1150,7 +1217,7 @@
 
 CALL_GRAPH             = NO
 
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# If the CALLER_GRAPH, SOURCE_BROWSER and HAVE_DOT tags are set to YES then doxygen will 
 # generate a caller dependency graph for every global function or class method. 
 # Note that enabling this option will significantly increase the time of a run. 
 # So in most cases it will be better to enable caller graphs for selected 
@@ -1187,31 +1254,23 @@
 
 DOTFILE_DIRS           = 
 
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
+# The MAX_DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of 
+# nodes that will be shown in the graph. If the number of nodes in a graph 
+# becomes larger than this value, doxygen will truncate the graph, which is 
+# visualized by representing a node as a red box. Note that doxygen if the number 
+# of direct children of the root node in a graph is already larger than 
+# MAX_DOT_GRAPH_NOTES then the graph will not be shown at all. Also note 
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
 
-MAX_DOT_GRAPH_WIDTH    = 1024
+DOT_GRAPH_MAX_NODES    = 50
 
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
-# this value, doxygen will try to truncate the graph, so that it fits within 
-# the specified constraint. Beware that most browsers cannot cope with very 
-# large images.
-
-MAX_DOT_GRAPH_HEIGHT   = 1024
-
 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
 # graphs generated by dot. A depth value of 3 means that only nodes reachable 
 # from the root by following a path via at most 3 edges will be shown. Nodes 
 # that lay further from the root node will be omitted. Note that setting this 
 # option to 1 or 2 may greatly reduce the computation time needed for large 
-# code bases. Also note that a graph may be further truncated if the graph's 
-# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
-# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
-# the graph is not depth-constrained.
+# code bases. Also note that the size of a graph can be further restricted by 
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
 
 MAX_DOT_GRAPH_DEPTH    = 0
 

Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp	2008-02-12 16:56:16 UTC (rev 1691)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp	2008-02-12 23:06:36 UTC (rev 1692)
@@ -78,7 +78,7 @@
 jcntl::~jcntl()
 {
     if (_init_flag && !_stop_flag)
-    	try { stop(true); }
+        try { stop(true); }
         catch (const jexception& e) { std::cerr << e << std::endl; }
     if (_datafh)
     {
@@ -507,16 +507,16 @@
             rd._full = true;
 
         // Remove all transactions not in prep_txn_list      
-		std::vector<std::string> xid_list;
-		_tmap.xid_list(xid_list);
-		for (std::vector<std::string>::iterator itr = xid_list.begin(); itr != xid_list.end();
+        std::vector<std::string> xid_list;
+        _tmap.xid_list(xid_list);
+        for (std::vector<std::string>::iterator itr = xid_list.begin(); itr != xid_list.end();
                 itr++)
-		{
-		    std::vector<std::string>::const_iterator pitr = std::find(prep_txn_list.begin(),
+        {
+            std::vector<std::string>::const_iterator pitr = std::find(prep_txn_list.begin(),
                     prep_txn_list.end(), *itr);
-			if (pitr == prep_txn_list.end())
-				_tmap.get_remove_tdata_list(*itr);
-		} 
+            if (pitr == prep_txn_list.end())
+                _tmap.get_remove_tdata_list(*itr);
+        }
     }
 }
 
@@ -689,8 +689,12 @@
         try { done = rec.rcv_decode(h, ifsp, cum_size_read); }
         catch (const jexception& e)
         {
-            if (e.err_code() != jerrno::JERR_JREC_BADRECTAIL ||
-                    fid != (rd._ffid ? rd._ffid - 1 : _num_jfiles - 1)) throw;
+// TODO - review this logic and tidy up how rd._lfid is assigned. See new jinf.get_end_file() fn.
+// Original
+//             if (e.err_code() != jerrno::JERR_JREC_BADRECTAIL ||
+//                     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);
             rd._lfid = start_fid;
             rd._eo = start_file_offs;
@@ -784,8 +788,8 @@
     if (sblk_offs)
     {
         // TODO: Connect the following with logger:
-        std::cout << std::hex  << "INFO: Bad record alignment found at fid=0x" << fid <<
-                " offs=0x" << file_pos << " (likely journal overwrite boundary); " <<
+        std::cout << std::hex  << "INFO: " << _jid << ": Bad record alignment found at fid=0x" <<
+                fid << " offs=0x" << file_pos << " (likely journal overwrite boundary); " <<
                 (JRNL_SBLK_SIZE - (sblk_offs/JRNL_DBLK_SIZE)) <<
                 " filler record(s) required." << std::endl;
         const u_int32_t xmagic = RHM_JDAT_EMPTY_MAGIC;

Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp	2008-02-12 16:56:16 UTC (rev 1691)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp	2008-02-12 23:06:36 UTC (rev 1692)
@@ -56,6 +56,7 @@
         _valid_flag(false),
         _analyzed_flag(false),
         _start_file(0),
+        _end_file(0),
         _initial_owi(false)
 {
     read(jinf_filename);
@@ -82,6 +83,7 @@
         _valid_flag(false),
         _analyzed_flag(false),
         _start_file(0),
+        _end_file(0),
         _initial_owi(false)
 {}
 
@@ -155,13 +157,15 @@
 const u_int16_t
 jinf::analyze()
 {
-    u_int16_t fid = 0xffff;
+    u_int16_t ffid = 0xffff;
     bool owi = false;
-    bool found = false;
+    bool done = false;
     
     if (!_valid_flag)
         validate();
-    for (u_int16_t fnum=0; fnum < _num_jfiles; fnum++)
+//    for (u_int16_t fnum=0; fnum < _num_jfiles; fnum++)
+    u_int16_t fnum=0;
+    while (!done && fnum < _num_jfiles)
     {
         std::ostringstream oss;
         oss << _jdir << "/" << _base_filename << ".";
@@ -172,24 +176,29 @@
             throw jexception(jerrno::JERR__FILEIO, oss.str(), "jinf", "analyze");
         file_hdr fhdr;
         jifs.read((char*)&fhdr, sizeof(fhdr));
-        if (fhdr._magic != RHM_JDAT_FILE_MAGIC)
-            break;
-        if (!fnum) // First file only
+        if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
         {
+            if (!fnum)
+                throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
+            done = true;
+        }
+        else if (fnum == 0) // First file only
+        {
             owi = fhdr.get_owi();
             _initial_owi = owi;
-            fid = 0;
+            ffid = 0;
         }
-        else if (fhdr.get_owi() != owi && !found)
+        else if (fhdr.get_owi() != owi) // Change in OWI
         {
-            fid = fnum;
-            found = true;
+            ffid = fnum;
+            done = true;
         }
+        else
+            _end_file = fnum;
         jifs.close();
+        fnum++;
     }
-    if (fid == 0xffff)
-        throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf", "analyze");
-    _start_file = fid;
+    _start_file = ffid;
     _analyzed_flag = true;
     return _start_file;
 }
@@ -214,6 +223,14 @@
     return _start_file;
 }
 
+const u_int16_t
+jinf::get_end_file()
+{
+    if (!_analyzed_flag)
+        analyze();
+    return _end_file;
+}
+
 const bool
 jinf::get_initial_owi()
 {

Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp	2008-02-12 16:56:16 UTC (rev 1691)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp	2008-02-12 23:06:36 UTC (rev 1692)
@@ -62,6 +62,7 @@
         bool _valid_flag;
         bool _analyzed_flag;
         u_int16_t _start_file;
+        u_int16_t _end_file;
         bool _initial_owi;
 
     public:
@@ -90,6 +91,7 @@
         inline const u_int32_t rmgr_page_size_dblks() const { return _rmgr_page_size_dblks; }
         inline const u_int32_t rmgr_num_pages() const { return _rmgr_num_pages; }
         const u_int16_t get_start_file();
+        const u_int16_t get_end_file();
         const bool get_initial_owi();
 
         const std::string to_string() const;

Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp	2008-02-12 16:56:16 UTC (rev 1691)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp	2008-02-12 23:06:36 UTC (rev 1692)
@@ -224,6 +224,8 @@
 
     if (dtokp->rstate() == data_tok::SKIP_PART)
     {
+        if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
+            return RHM_IORES_AIO_WAIT;
         const iores res = skip(dtokp);
         if (res != RHM_IORES_SUCCESS)
         {

Modified: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py	2008-02-12 16:56:16 UTC (rev 1691)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py	2008-02-12 23:06:36 UTC (rev 1692)
@@ -610,7 +610,7 @@
         return self.file_num
 
     def check_rid(self, hdr):
-        if  self.last_rid != -1 and hdr.rid != self.last_rid + 1:
+        if  self.last_rid != -1 and hdr.rid <= self.last_rid:
             return False
         self.last_rid = hdr.rid
         return True




More information about the rhmessaging-commits mailing list