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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Jul 27 14:22:44 EDT 2010


Author: kpvdr
Date: 2010-07-27 14:22:43 -0400 (Tue, 27 Jul 2010)
New Revision: 4152

Modified:
   store/trunk/cpp/lib/JournalImpl.cpp
   store/trunk/cpp/lib/TxnCtxt.cpp
   store/trunk/cpp/lib/jrnl/jcntl.cpp
   store/trunk/cpp/lib/jrnl/jcntl.hpp
   store/trunk/cpp/lib/jrnl/jerrno.cpp
   store/trunk/cpp/lib/jrnl/jerrno.hpp
   store/trunk/cpp/lib/jrnl/rmgr.cpp
   store/trunk/cpp/lib/jrnl/wmgr.cpp
Log:
Tidied up definition of error constants from r.4148 that were in jcntl; I moved them to jerrno instead where they belong.

Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/JournalImpl.cpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -294,7 +294,7 @@
                     }
                     break;
                 case mrg::journal::RHM_IORES_PAGE_AIOWAIT:
-                    if (get_wr_events(&_aio_cmpl_timeout) == AIO_TIMEOUT) {
+                    if (get_wr_events(&_aio_cmpl_timeout) == journal::jerrno::AIO_TIMEOUT) {
                         std::stringstream ss;
                         ss << "read_data_record() returned " << mrg::journal::iores_str(res);
                         ss << "; timed out waiting for page to be processed.";

Modified: store/trunk/cpp/lib/TxnCtxt.cpp
===================================================================
--- store/trunk/cpp/lib/TxnCtxt.cpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/TxnCtxt.cpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -100,7 +100,7 @@
 void TxnCtxt::jrnl_sync(JournalImpl* jc, timespec* timeout) {
     if (!jc || jc->is_txn_synced(getXid()))
         return;
-    if (jc->get_wr_events(timeout) == journal::jcntl::AIO_TIMEOUT && timeout)
+    if (jc->get_wr_events(timeout) == journal::jerrno::AIO_TIMEOUT && timeout)
         THROW_STORE_EXCEPTION(std::string("Error: timeout waiting for TxnCtxt::jrnl_sync()"));
 }
 

Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -71,8 +71,6 @@
     _final_aio_cmpl_timeout.tv_nsec = FINAL_AIO_CMPL_TIMEOUT_NSEC;
     return true;
 }
-int32_t jcntl::AIO_TIMEOUT = int32_t(-1);
-int32_t jcntl::THREAD_BLOCKED = int32_t(-2);
 
 
 // Functions
@@ -362,7 +360,7 @@
 {
     stlock t(_wr_mutex);
     if (!t.locked())
-        return THREAD_BLOCKED;
+        return jerrno::LOCK_TAKEN;
     return _wmgr.get_events(pmgr::UNUSED, timeout);
 }
 
@@ -446,7 +444,7 @@
     fcntl* fcntlp = _lpmgr.get_fcntlp(lid);
     while (fcntlp->wr_fhdr_aio_outstanding())
     {
-        if (get_wr_events(&_aio_cmpl_timeout) == AIO_TIMEOUT)
+        if (get_wr_events(&_aio_cmpl_timeout) == jerrno::AIO_TIMEOUT)
             throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "fhdr_wr_sync");
     }
 }
@@ -502,7 +500,7 @@
 {
     while (_wmgr.get_aio_evt_rem())
     {
-        if (get_wr_events(&_aio_cmpl_timeout) == AIO_TIMEOUT)
+        if (get_wr_events(&_aio_cmpl_timeout) == jerrno::AIO_TIMEOUT)
             throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "aio_cmpl_wait");
     }
 }
@@ -515,7 +513,7 @@
     {
         while (_wmgr.curr_pg_blocked())
         {
-            if (_wmgr.get_events(pmgr::UNUSED, &_aio_cmpl_timeout) == AIO_TIMEOUT)
+            if (_wmgr.get_events(pmgr::UNUSED, &_aio_cmpl_timeout) == jerrno::AIO_TIMEOUT)
             {
                 std::ostringstream oss;
                 oss << "get_events() returned JERR_JCNTL_AIOCMPLWAIT; wmgr_status: " << _wmgr.status_str();
@@ -529,7 +527,7 @@
     {
         while (_wmgr.curr_file_blocked())
         {
-            if (_wmgr.get_events(pmgr::UNUSED, &_aio_cmpl_timeout) == AIO_TIMEOUT)
+            if (_wmgr.get_events(pmgr::UNUSED, &_aio_cmpl_timeout) == jerrno::AIO_TIMEOUT)
             {
                 std::ostringstream oss;
                 oss << "get_events() returned JERR_JCNTL_AIOCMPLWAIT; wmgr_status: " << _wmgr.status_str();

Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -149,8 +149,6 @@
     public:
         static timespec _aio_cmpl_timeout; ///< Timeout for blocking libaio returns
         static timespec _final_aio_cmpl_timeout; ///< Timeout for blocking libaio returns when stopping or finalizing
-        static int32_t AIO_TIMEOUT;
-        static int32_t THREAD_BLOCKED;
 
         /**
         * \brief Journal constructor.

Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -128,7 +128,11 @@
 const u_int32_t jerrno::JERR_JINF_JDATEMPTY     = 0x0c03;
 const u_int32_t jerrno::JERR_JINF_TOOMANYFILES  = 0x0c04;
 
+// Negative returns for some functions
+const int32_t jerrno::AIO_TIMEOUT               = -1;
+const int32_t jerrno::LOCK_TAKEN                = -2;
 
+
 // static initialization fn
 
 bool

Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -146,6 +146,9 @@
         static const u_int32_t JERR_JINF_JDATEMPTY;     ///< Journal data files empty
         static const u_int32_t JERR_JINF_TOOMANYFILES;  ///< Too many journal data files
 
+        // Negative returns for some functions
+        static const int32_t AIO_TIMEOUT;               ///< Timeout waiting for AIO return
+        static const int32_t LOCK_TAKEN;                ///< Attempted to take lock, but it was taken by another thread
         /**
         * \brief Method to access error message from known error number.
         */

Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -245,7 +245,7 @@
         throw jexception(jerrno::JERR__AIO, oss.str(), "rmgr", "get_events");
     }
     if (ret == 0 && timeout)
-        return _jc->AIO_TIMEOUT;
+        return jerrno::AIO_TIMEOUT;
 
     std::vector<u_int16_t> pil;
     pil.reserve(ret);
@@ -326,7 +326,7 @@
     // Wait for any outstanding AIO read operations to complete before synchronizing
     while (_aio_evt_rem)
     {
-        if (get_events(AIO_COMPLETE, timeout) == _jc->AIO_TIMEOUT) // timed out, nothing returned
+        if (get_events(AIO_COMPLETE, timeout) == jerrno::AIO_TIMEOUT) // timed out, nothing returned
         {
             throw jexception(jerrno::JERR__TIMEOUT,
                             "Timed out waiting for outstanding read aio to return", "rmgr", "init_validation");
@@ -347,7 +347,7 @@
     bool timed_out = false;
     while (!_rrfc.is_valid() && !timed_out)
     {
-        timed_out = get_events(AIO_COMPLETE, timeout) == _jc->AIO_TIMEOUT;
+        timed_out = get_events(AIO_COMPLETE, timeout) == jerrno::AIO_TIMEOUT;
         if (timed_out && throw_on_timeout)
             throw jexception(jerrno::JERR__TIMEOUT, "Timed out waiting for read validity", "rmgr", "wait_for_validity");
     }

Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp	2010-07-26 21:37:19 UTC (rev 4151)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp	2010-07-27 18:22:43 UTC (rev 4152)
@@ -677,7 +677,7 @@
     }
 
     if (ret == 0 && timeout)
-        return _jc->AIO_TIMEOUT;
+        return jerrno::AIO_TIMEOUT;
 
     int32_t tot_data_toks = 0;
     for (int i=0; i<ret; i++) // Index of returned AIOs



More information about the rhmessaging-commits mailing list