This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new d52f317  Fix cache_read_busy_success_stat
d52f317 is described below

commit d52f317f704bc87ba2ef223c2a6437df308eabf1
Author: Masakazu Kitajo <mas...@apache.org>
AuthorDate: Thu Apr 12 15:43:46 2018 +0900

    Fix cache_read_busy_success_stat
    
    The stat was incremented unintentionally in a certain case.
---
 iocore/cache/CacheRead.cc      |  3 ++-
 iocore/cache/P_CacheInternal.h | 32 ++++++++++++++++++++------------
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/iocore/cache/CacheRead.cc b/iocore/cache/CacheRead.cc
index 40b318d..fbb4cd1 100644
--- a/iocore/cache/CacheRead.cc
+++ b/iocore/cache/CacheRead.cc
@@ -953,8 +953,9 @@ CacheVC::openReadStartEarliest(int /* event ATS_UNUSED */, 
Event * /* e ATS_UNUS
 Lcallreturn:
   return handleEvent(AIO_EVENT_DONE, nullptr); // hopefully a tail call
 Lsuccess:
-  if (write_vc)
+  if (write_vc) {
     CACHE_INCREMENT_DYN_STAT(cache_read_busy_success_stat);
+  }
   SET_HANDLER(&CacheVC::openReadMain);
   return callcont(CACHE_EVENT_OPEN_READ);
 }
diff --git a/iocore/cache/P_CacheInternal.h b/iocore/cache/P_CacheInternal.h
index 8b30c81..4bf5080 100644
--- a/iocore/cache/P_CacheInternal.h
+++ b/iocore/cache/P_CacheInternal.h
@@ -165,23 +165,31 @@ extern RecRawStatBlock *cache_rsb;
 #define CACHE_SET_DYN_STAT(x, y) \
   RecSetGlobalRawStatSum(cache_rsb, (x), (y)) 
RecSetGlobalRawStatSum(vol->cache_vol->vol_rsb, (x), (y))
 
-#define CACHE_INCREMENT_DYN_STAT(x)                              \
-  RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), 1); \
-  RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 1);
+#define CACHE_INCREMENT_DYN_STAT(x)                                            
  \
+  do {                                                                         
  \
+    RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), 1);             
  \
+    RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 
1); \
+  } while (0);
 
-#define CACHE_DECREMENT_DYN_STAT(x)                               \
-  RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), -1); \
-  RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), -1);
+#define CACHE_DECREMENT_DYN_STAT(x)                                            
   \
+  do {                                                                         
   \
+    RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), -1);            
   \
+    RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 
-1); \
+  } while (0);
 
 #define CACHE_VOL_SUM_DYN_STAT(x, y) RecIncrRawStat(vol->cache_vol->vol_rsb, 
mutex->thread_holding, (int)(x), (int64_t)y);
 
-#define CACHE_SUM_DYN_STAT(x, y)                                            \
-  RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), (int64_t)(y)); \
-  RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 
(int64_t)(y));
+#define CACHE_SUM_DYN_STAT(x, y)                                               
             \
+  do {                                                                         
             \
+    RecIncrRawStat(cache_rsb, mutex->thread_holding, (int)(x), (int64_t)(y));  
             \
+    RecIncrRawStat(vol->cache_vol->vol_rsb, mutex->thread_holding, (int)(x), 
(int64_t)(y)); \
+  } while (0);
 
-#define CACHE_SUM_DYN_STAT_THREAD(x, y)                              \
-  RecIncrRawStat(cache_rsb, this_ethread(), (int)(x), (int64_t)(y)); \
-  RecIncrRawStat(vol->cache_vol->vol_rsb, this_ethread(), (int)(x), 
(int64_t)(y));
+#define CACHE_SUM_DYN_STAT_THREAD(x, y)                                        
      \
+  do {                                                                         
      \
+    RecIncrRawStat(cache_rsb, this_ethread(), (int)(x), (int64_t)(y));         
      \
+    RecIncrRawStat(vol->cache_vol->vol_rsb, this_ethread(), (int)(x), 
(int64_t)(y)); \
+  } while (0);
 
 #define GLOBAL_CACHE_SUM_GLOBAL_DYN_STAT(x, y) 
RecIncrGlobalRawStatSum(cache_rsb, (x), (y))
 

-- 
To stop receiving notification emails like this one, please contact
zw...@apache.org.

Reply via email to