You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2014/04/10 01:45:16 UTC

[1/2] git commit: TS-2622: optimize the function ink_cluster_time

Repository: trafficserver
Updated Branches:
  refs/heads/master a8ed22df0 -> 2ab1bb6ac


TS-2622: optimize the function ink_cluster_time

  1. remove useless two global variables
  2. use ink_get_hrtime() instead of time(NULL)
  3. remove useless CAS to set variable global_time


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/8aa3af93
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/8aa3af93
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/8aa3af93

Branch: refs/heads/master
Commit: 8aa3af937548942e8130ccdf1400e043870e3a0e
Parents: a8ed22d
Author: Yu Qing <zh...@taobao.com>
Authored: Fri Mar 7 15:21:20 2014 +0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Apr 9 16:25:13 2014 -0700

----------------------------------------------------------------------
 CHANGES                    |  3 +++
 proxy/http/HttpTransact.cc | 22 ++++------------------
 2 files changed, 7 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8aa3af93/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 9f9e7aa..010a6e4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2622] Optimize the ink_cluster_time() function.
+   Author: Yu Qing <zh...@taobao.com>
+
   *) [TS-2701] Silence traffic_cop logging on chown of missing lock files.
 
   *) [TS-2656 Determine server connection scheme immediately before

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8aa3af93/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 0f464e6..c5ee223 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -8333,23 +8333,18 @@ HttpTransact::get_error_string(int erno)
   }
 }
 
-
-volatile ink_time_t global_time;
-volatile int32_t cluster_time_delta;
-
 ink_time_t
 ink_cluster_time(void)
 {
-  ink_time_t old;
-  int highest_delta = 0;
+  int highest_delta;
 
 #ifdef DEBUG
   ink_mutex_acquire(&http_time_lock);
-  ink_time_t local_time = time(NULL);
+  ink_time_t local_time = ink_get_hrtime() / HRTIME_SECOND;
   last_http_local_time = local_time;
   ink_mutex_release(&http_time_lock);
 #else
-  ink_time_t local_time = time(NULL);
+  ink_time_t local_time = ink_get_hrtime() / HRTIME_SECOND;
 #endif
 
   highest_delta = (int) HttpConfig::m_master.cluster_time_delta;
@@ -8366,16 +8361,7 @@ ink_cluster_time(void)
 
   ink_assert(highest_delta >= 0);
 
-  local_time += (ink_time_t) highest_delta;
-  old = global_time;
-
-  while (local_time > global_time) {
-    if (ink_atomic_cas(&global_time, old, local_time))
-      break;
-    old = global_time;
-  }
-
-  return global_time;
+  return local_time + (ink_time_t) highest_delta;
 }
 
 //


[2/2] git commit: TS-2603: Do not update hostdb if intercept exists

Posted by jp...@apache.org.
TS-2603: Do not update hostdb if intercept exists

We should not update hostdb if a HttpSM was intercepted, as the
HttpSM did not really connect to the origin server.  Otherwise we
may set the hostdb address to zero if timeout occurs.

Signed-off-by: Quehan <qu...@taobao.com>


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/2ab1bb6a
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/2ab1bb6a
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/2ab1bb6a

Branch: refs/heads/master
Commit: 2ab1bb6ac56469e212148f665c9db7b725183a7b
Parents: 8aa3af9
Author: Quehan <qu...@taobao.com>
Authored: Sat Mar 1 20:07:48 2014 +0800
Committer: James Peach <jp...@apache.org>
Committed: Wed Apr 9 16:32:46 2014 -0700

----------------------------------------------------------------------
 CHANGES              | 3 +++
 proxy/http/HttpSM.cc | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2ab1bb6a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 010a6e4..dd31b00 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2603] Do not update HostDB for server intercept requests.
+   Author: Quehan <qu...@taobao.com>
+
   *) [TS-2622] Optimize the ink_cluster_time() function.
    Author: Yu Qing <zh...@taobao.com>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2ab1bb6a/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 80c5d78..36135be 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -3926,7 +3926,7 @@ HttpSM::do_hostdb_update_if_necessary()
 {
   int issue_update = 0;
 
-  if (t_state.current.server == NULL) {
+  if (t_state.current.server == NULL || plugin_tunnel_type != HTTP_NO_PLUGIN_TUNNEL) {
     // No server, so update is not necessary
     return;
   }