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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Mon Sep 28 13:28:25 EDT 2009


Author: kpvdr
Date: 2009-09-28 13:28:24 -0400 (Mon, 28 Sep 2009)
New Revision: 3650

Modified:
   store/trunk/cpp/lib/JournalImpl.cpp
   store/trunk/cpp/lib/JournalImpl.h
Log:
Fix to RHM_IORES_EMPTY problem on flow-to-disk. See BZ525813 - "Move Flow to disk from BDB to journal".

Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp	2009-09-28 15:13:35 UTC (rev 3649)
+++ store/trunk/cpp/lib/JournalImpl.cpp	2009-09-28 17:28:24 UTC (rev 3650)
@@ -262,13 +262,20 @@
         // Free any previous msg
         free_read_buffers();
 
+        // Last read encountered out-of-order rids, check if this rid is in that list
+        bool oooFlag = false;
+        for (std::vector<u_int64_t>::const_iterator i=oooRidList.begin(); i!=oooRidList.end() && !oooFlag; i++) {
+            if (*i == rid) {
+                oooFlag = true;
+            }
+        }
+
         // TODO: This is a brutal approach - very inefficient and slow. Rather introduce a system of remembering
         // jumpover points and allow the read to jump back to the first known jumpover point - but this needs
         // a mechanism in rrfc to accomplish it. Also helpful is a struct containing a journal address - a
         // combination of lid/offset.
-        if (rid < lastReadRid)
+        if (oooFlag || rid < lastReadRid)
             _rmgr.invalidate();
-
         _dlen = 0;
         _dtok.reset();
         _dtok.set_wstate(DataTokenImpl::ENQ);
@@ -279,11 +286,15 @@
         bool done = false;
         bool rid_found = false;
         unsigned aio_sleep_cnt = 0;
+        oooRidList.clear();
         while (!done) {
             iores res = read_data_record(&_datap, _dlen, &_xidp, xlen, transient, _external, &_dtok);
             switch (res) {
                 case mrg::journal::RHM_IORES_SUCCESS:
                     if (_dtok.rid() != rid) {
+                        // Check if this is an out-of-order rid that may impact next read
+                        if (_dtok.rid() > rid)
+                            oooRidList.push_back(_dtok.rid());
                         free_read_buffers();
                         // Reset data token for next read
                         _dlen = 0;

Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h	2009-09-28 15:13:35 UTC (rev 3649)
+++ store/trunk/cpp/lib/JournalImpl.h	2009-09-28 17:28:24 UTC (rev 3650)
@@ -79,7 +79,8 @@
             boost::intrusive_ptr<qpid::sys::TimerTask> getEventsFireEventsPtr;
             pthread_mutex_t _getf_mutex;
 
-            u_int64_t lastReadRid; // rid of last read msg for loadMsgContent()
+            u_int64_t lastReadRid; // rid of last read msg for loadMsgContent() - detects out-of-order read requests
+            std::vector<u_int64_t> oooRidList; // list of out-of-order rids (greater than current rid) encountered during read sequence
 
             bool writeActivityFlag;
             bool flushTriggeredFlag;



More information about the rhmessaging-commits mailing list