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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Fri Jan 4 16:25:33 EST 2008


Author: kpvdr
Date: 2008-01-04 16:25:32 -0500 (Fri, 04 Jan 2008)
New Revision: 1536

Modified:
   store/trunk/cpp/lib/jrnl/jcntl.cpp
   store/trunk/cpp/lib/jrnl/jcntl.hpp
   store/trunk/cpp/lib/jrnl/wmgr.cpp
   store/trunk/cpp/tests/jrnl/
   store/trunk/cpp/tests/jrnl/Makefile.am
Log:
Minor updates and fixes

Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp	2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp	2008-01-04 21:25:32 UTC (rev 1536)
@@ -97,6 +97,10 @@
 jcntl::initialize(std::deque<data_tok*>* rdtoklp, const aio_cb rd_cb,
         std::deque<data_tok*>* wdtoklp, const aio_cb wr_cb)
 {
+    _init_flag = false;
+    _stop_flag = false;
+    _readonly_flag = false;
+
     // Prepare journal dir, journal files and file handles
     _jdir.clear_dir();
     _emap.clear();
@@ -139,6 +143,10 @@
 jcntl::recover(std::deque<data_tok*>* rdtoklp, const aio_cb rd_cb, std::deque<data_tok*>* wdtoklp,
         const aio_cb wr_cb, const std::vector<std::string>& prep_txn_list, u_int64_t& highest_rid)
 {
+    _init_flag = false;
+    _stop_flag = false;
+    _readonly_flag = false;
+
     // Verify journal dir and journal files
     _jdir.verify_dir();
     _rcvdat.reset();
@@ -354,7 +362,7 @@
 }
 
 void
-jcntl::stop(bool block_till_aio_cmpl)
+jcntl::stop(const bool block_till_aio_cmpl)
 {
     if (_readonly_flag)
         check_rstatus("stop");
@@ -362,24 +370,24 @@
         check_wstatus("stop");
     _stop_flag = true;
     if (!_readonly_flag)
-    {
-        flush();
-        if (block_till_aio_cmpl)
-            aio_cmpl_wait();
-    }
+        flush(block_till_aio_cmpl);
 }
 
 const iores
-jcntl::flush()
+jcntl::flush(const bool block_till_aio_cmpl)
 {
     if (!_init_flag)
         return RHM_IORES_SUCCESS;
     if (_readonly_flag)
         throw jexception(jerrno::JERR_JCNTL_READONLY, "jcntl", "flush");
+    iores res;
     {
         slock s(&_wr_mutex);
-        return _wmgr.flush();
+        res = _wmgr.flush();
     }
+    if (block_till_aio_cmpl)
+        aio_cmpl_wait();
+    return res;
 }
 
 // Private functions
@@ -430,7 +438,7 @@
         _wmgr.get_events(pmgr::UNUSED);
         if (cnt++ > MAX_AIO_CMPL_SLEEPS)
             throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "aio_cmpl_wait");
-        usleep(AIO_CMPL_SLEEP);
+        ::usleep(AIO_CMPL_SLEEP);
     }
 }
 
@@ -445,7 +453,7 @@
         {
             if (cnt++ > MAX_AIO_CMPL_SLEEPS)
                 throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "aio_cmpl_wait");
-            usleep(AIO_CMPL_SLEEP);
+            ::usleep(AIO_CMPL_SLEEP);
         }
         return true;
     }

Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp	2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp	2008-01-04 21:25:32 UTC (rev 1536)
@@ -510,12 +510,12 @@
         * \param block_till_aio_cmpl If true, will block the thread while waiting for all
         *     outstanding AIO operations to complete.
         */
-        void stop(bool block_till_aio_cmpl = false);
+        void stop(const bool block_till_aio_cmpl = false);
 
         /**
         * \brief Force a flush of the write page cache, creating a single AIO write operation.
         */
-        const iores flush();
+        const iores flush(const bool block_till_aio_cmpl = false);
 
         inline const u_int32_t get_enq_cnt() const { return _emap.size(); }
 

Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp	2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp	2008-01-04 21:25:32 UTC (rev 1536)
@@ -94,6 +94,10 @@
 wmgr::initialize(std::deque<data_tok*>* dtoklp, const aio_cb wr_cb, const u_int32_t max_dtokpp,
         const u_int32_t max_iowait_us, size_t eo)
 {
+    _enq_busy = false;
+    _deq_busy = false;
+    _abort_busy = false;
+    _commit_busy = false;
     _dtoklp = dtoklp;
     _max_dtokpp = max_dtokpp;
     _max_io_wait_us = max_iowait_us;


Property changes on: store/trunk/cpp/tests/jrnl
___________________________________________________________________
Name: svn:ignore
   - .deps
.libs
Makefile
Makefile.in
jtest
unit_test_enq_map
unit_test_jerrno
unit_test_jexception
unit_test_jdir
unit_test_rec_hdr
unit_test_jinf
unit_test_txn_map

   + .deps
.libs
Makefile
Makefile.in
jtest
unit_test_enq_map
unit_test_jdir
unit_test_jerrno
unit_test_jexception
unit_test_jinf
unit_test_rec_hdr
unit_test_txn_map


Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am	2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/tests/jrnl/Makefile.am	2008-01-04 21:25:32 UTC (rev 1536)
@@ -48,8 +48,8 @@
   unit_test_enq_map \
   unit_test_txn_map
 
-UNIT_TEST_SRCS=../unit_test.cpp
-UNIT_TEST_LDADD= -lboost_unit_test_framework -lbdbstore -L../../lib/.libs 
+UNIT_TEST_SRCS = ../unit_test.cpp
+UNIT_TEST_LDADD = -lboost_unit_test_framework -lbdbstore -L../../lib/.libs 
 
 unit_test_jexception_SOURCES = unit_test_jexception.cpp $(UNIT_TEST_SRCS)
 unit_test_jexception_LDFLAGS = $(UNIT_TEST_LDADD)




More information about the rhmessaging-commits mailing list