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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Dec 10 16:50:07 EST 2007


Author: kpvdr
Date: 2007-12-10 16:50:07 -0500 (Mon, 10 Dec 2007)
New Revision: 1451

Modified:
   store/trunk/cpp/lib/BdbMessageStore.cpp
   store/trunk/cpp/lib/JournalImpl.cpp
   store/trunk/cpp/lib/JournalImpl.h
   store/trunk/cpp/lib/jrnl/jcfg.hpp
   store/trunk/cpp/lib/jrnl/jcntl.cpp
   store/trunk/cpp/lib/jrnl/jcntl.hpp
   store/trunk/cpp/lib/jrnl/rcvdat.hpp
   store/trunk/cpp/lib/jrnl/txn_map.cpp
Log:
Minor fixes and cleanup

Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp	2007-12-10 21:50:07 UTC (rev 1451)
@@ -898,7 +898,8 @@
     try {
         JournalImpl* jc = static_cast<JournalImpl*>(queue.getExternalQueueStore());
         if (jc){
-            jc->flush();
+            // TODO: check if this result should be used...
+            /*rhm::journal::iores res =*/ jc->flush();
         }
     }catch (const journal::jexception& e) {
         THROW_STORE_EXCEPTION(std::string("Queue ") + queue.getName() + ": flush() failed: " + e.what() );

Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/JournalImpl.cpp	2007-12-10 21:50:07 UTC (rev 1451)
@@ -240,15 +240,16 @@
     jcntl::stop(block_till_aio_cmpl);
 }
 
-void
+const iores
 JournalImpl::flush()
 {
-    jcntl::flush();
+    const iores res = jcntl::flush();
     if (_wmgr.get_aio_evt_rem() && !getEventsTimerSetFlag) {
         getEventsFireEventsPtr->addRef();
         journalTimer.add(getEventsFireEventsPtr);
         getEventsTimerSetFlag = true;
     }
+    return res;
 }
 
 void

Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/JournalImpl.h	2007-12-10 21:50:07 UTC (rev 1451)
@@ -136,7 +136,7 @@
             void stop(bool block_till_aio_cmpl = false);
 
             // Overrides for get_events timer
-            void flush();
+            const journal::iores flush();
 
             // TimerTask callback
             void getEventsFire();

Modified: store/trunk/cpp/lib/jrnl/jcfg.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcfg.hpp	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/jrnl/jcfg.hpp	2007-12-10 21:50:07 UTC (rev 1451)
@@ -33,9 +33,6 @@
 #ifndef rhm_journal_jcfg_hpp
 #define rhm_journal_jcfg_hpp
 
-// #include <iomanip>  // for debug only
-// #include <iostream> // for debug only
-
 #if defined(__i386__) /* little endian, 32 bits */
 #define JRNL_LITTLE_ENDIAN
 #define JRNL_32_BIT

Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp	2007-12-10 21:50:07 UTC (rev 1451)
@@ -146,7 +146,7 @@
         throw jexception(jerrno::JERR_JCNTL_RECOVERJFULL, "jcntl", "recover_complete");
 
     // Debug info; may be useful to print with a flag
-    // _rcvdat.print(_jid);
+    // std::cout << _rcvdat.to_string(_jid) << std::endl;
 
     if (_datafh)
     {
@@ -329,15 +329,15 @@
     }
 }
 
-void
+const iores
 jcntl::flush()
 {
     if (!_init_flag)
-        return;
+        return RHM_IORES_SUCCESS;
     if (_readonly_flag)
         throw jexception(jerrno::JERR_JCNTL_READONLY, "jcntl", "flush");
     slock s(&_mutex);
-    _wmgr.flush();
+    return _wmgr.flush();
 }
 
 // Private functions

Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp	2007-12-10 21:50:07 UTC (rev 1451)
@@ -545,7 +545,7 @@
         /**
         * \brief Force a flush of the write page cache, creating a single AIO write operation.
         */
-        void flush();
+        const iores flush();
 
         inline const u_int32_t get_enq_cnt() const { return _emap.size(); }
 

Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp	2007-12-10 21:50:07 UTC (rev 1451)
@@ -32,9 +32,9 @@
 #ifndef rhm_journal_rcvdat_hpp
 #define rhm_journal_rcvdat_hpp
 
-#include <iostream>
 #include <iomanip>
 #include <map>
+#include <sstream>
 #include <vector>
 
 namespace rhm
@@ -80,26 +80,25 @@
                     _enq_cnt_list[f] = 0;
             }
 
-            void print(std::string& jid)
+            std::string to_string(std::string& jid)
             {
-                std::cout << "Jorunal file analysis (jid=\"" << jid << "\"):" << std::endl;
-                std::cout << "  Overwrite indicator (_owi) = " << (_owi ? "TRUE" : "FALSE") <<
-                        std::endl;
-                std::cout << "  Journal empty (_empty) = " << (_empty ? "TRUE" : "FALSE") <<
-                        std::endl;
-                std::cout << "  First fid (_ffid) = " << _ffid << std::endl;
-                std::cout << "  First record offset in first fid (_fro) = 0x" << std::hex << _fro <<
+                std::ostringstream oss;
+                oss << "Jorunal file analysis (jid=\"" << jid << "\"):" << std::endl;
+                oss << "  Overwrite indicator (_owi) = " << (_owi ? "TRUE" : "FALSE") << std::endl;
+                oss << "  Journal empty (_empty) = " << (_empty ? "TRUE" : "FALSE") << std::endl;
+                oss << "  First fid (_ffid) = " << _ffid << std::endl;
+                oss << "  First record offset in first fid (_fro) = 0x" << std::hex << _fro <<
                         std::dec << " (" << (_fro/JRNL_DBLK_SIZE) << " dblks)" << std::endl;
-                std::cout << "  Last fid (_lfid) = " << _lfid << std::endl;
-                std::cout << "  End offset (_eo) = 0x" << std::hex << _eo << std::dec << " ("  <<
+                oss << "  Last fid (_lfid) = " << _lfid << std::endl;
+                oss << "  End offset (_eo) = 0x" << std::hex << _eo << std::dec << " ("  <<
                         (_eo/JRNL_DBLK_SIZE) << " dblks)" << std::endl;
-                std::cout << "  Highest rid (_h_rid) = 0x" << std::hex << _h_rid << std::dec <<
-                        std::endl;
-                std::cout << "  Journal full (_full) = " << (_full ? "TRUE" : "FALSE") << std::endl;
-                std::cout << "  Enqueued records (txn & non-txn):" << std::endl;
+                oss << "  Highest rid (_h_rid) = 0x" << std::hex << _h_rid << std::dec << std::endl;
+                oss << "  Journal full (_full) = " << (_full ? "TRUE" : "FALSE") << std::endl;
+                oss << "  Enqueued records (txn & non-txn):" << std::endl;
                 for (unsigned i=0; i<_enq_cnt_list.size(); i++)
-                    std::cout << "    File " << std::setw(2) << i << ": " << _enq_cnt_list[i] <<
+                   oss << "    File " << std::setw(2) << i << ": " << _enq_cnt_list[i] <<
                             std::endl;
+                return oss.str();
             }
         };
 }

Modified: store/trunk/cpp/lib/jrnl/txn_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/txn_map.cpp	2007-12-10 19:34:57 UTC (rev 1450)
+++ store/trunk/cpp/lib/jrnl/txn_map.cpp	2007-12-10 21:50:07 UTC (rev 1451)
@@ -154,11 +154,9 @@
         ss << std::hex << "xid=\"" << xid << "\"";
         throw jexception(jerrno::JERR_MAP_NOTFOUND, ss.str().c_str(), "txn_map", "is_txn_synced");
     }
-//std::cout << " its: found XID" << std::flush;
     bool is_synced = true;
     for (tdl_itr litr = itr->second.begin(); litr < itr->second.end(); litr++)
     {
-//std::cout << " rid=" << litr->_rid << " aioc=" << litr->_aio_compl << std::flush;
         if (!litr->_aio_compl)
         {
             is_synced = false;
@@ -180,19 +178,12 @@
         ok = false;
     else
     {
-//std::cout << " sac: found XID" << std::flush;
-//        txn_data_list list = itr->second;
         for (tdl_itr litr = itr->second.begin(); litr < itr->second.end(); litr++)
         {
             if (litr->_rid == rid)
             {
-// txn_data_struct t(litr->_rid, litr->_drid, litr->_fid, litr->_enq_flag);
-// t._aio_compl = true;
-// itr->second.erase(litr);
-// itr->second.push_back(t);
                 found = true;
                 litr->_aio_compl = true;
-//std::cout << " rid=" << rid << " aioc=" << litr->_aio_compl << " ptr=" << std::flush;
                 break;
             }
         }




More information about the rhmessaging-commits mailing list