You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/06/09 00:27:50 UTC

[1/2] trafficserver git commit: TS-3668 Make cache promotion explicit for internal requests, we can make it optional later if someone really, really feel that internal requests should not get promoted like this

Repository: trafficserver
Updated Branches:
  refs/heads/master 109d7bc62 -> c6ef7b496


TS-3668 Make cache promotion explicit for internal requests, we can make it optional later if someone really, really feel that internal requests should not get promoted like this


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

Branch: refs/heads/master
Commit: e90d9b918c3cb1ece639109a15031fd6d898f340
Parents: 109d7bc
Author: Leif Hedstrom <zw...@apache.org>
Authored: Thu Jun 4 19:12:06 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Jun 8 16:25:14 2015 -0600

----------------------------------------------------------------------
 .../experimental/cache_promote/cache_promote.cc | 35 +++++++++++---------
 1 file changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e90d9b91/plugins/experimental/cache_promote/cache_promote.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/cache_promote/cache_promote.cc b/plugins/experimental/cache_promote/cache_promote.cc
index bb49bcd..a7be269 100644
--- a/plugins/experimental/cache_promote/cache_promote.cc
+++ b/plugins/experimental/cache_promote/cache_promote.cc
@@ -383,27 +383,32 @@ cont_handle_policy(TSCont contp, TSEvent event, void *edata)
 {
   TSHttpTxn txnp = static_cast<TSHttpTxn>(edata);
   PromotionConfig *config = static_cast<PromotionConfig *>(TSContDataGet(contp));
-  int obj_status;
 
   switch (event) {
   // Main HOOK
   case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE:
-    if (TS_ERROR != TSHttpTxnCacheLookupStatusGet(txnp, &obj_status)) {
-      switch (obj_status) {
-      case TS_CACHE_LOOKUP_MISS:
-      case TS_CACHE_LOOKUP_SKIPPED:
-        if (config->getPolicy()->doSample() && config->getPolicy()->doPromote(txnp)) {
-          TSDebug(PLUGIN_NAME, "cache-status is %d, and leaving cache on (promoted)", obj_status);
-        } else {
-          TSDebug(PLUGIN_NAME, "cache-status is %d, and turning off the cache (not promoted)", obj_status);
-          TSHttpTxnHookAdd(txnp, TS_HTTP_READ_RESPONSE_HDR_HOOK, contp);
+    if (TS_SUCCESS != TSHttpTxnIsInternal(txnp)) {
+      int obj_status;
+
+      if (TS_ERROR != TSHttpTxnCacheLookupStatusGet(txnp, &obj_status)) {
+        switch (obj_status) {
+        case TS_CACHE_LOOKUP_MISS:
+        case TS_CACHE_LOOKUP_SKIPPED:
+          if (config->getPolicy()->doSample() && config->getPolicy()->doPromote(txnp)) {
+            TSDebug(PLUGIN_NAME, "cache-status is %d, and leaving cache on (promoted)", obj_status);
+          } else {
+            TSDebug(PLUGIN_NAME, "cache-status is %d, and turning off the cache (not promoted)", obj_status);
+            TSHttpTxnHookAdd(txnp, TS_HTTP_READ_RESPONSE_HDR_HOOK, contp);
+          }
+          break;
+        default:
+          // Do nothing, just let it handle the lookup.
+          TSDebug(PLUGIN_NAME, "cache-status is %d (hit), nothing to do", obj_status);
+          break;
         }
-        break;
-      default:
-        // Do nothing, just let it handle the lookup.
-        TSDebug(PLUGIN_NAME, "cache-status is %d (hit), nothing to do", obj_status);
-        break;
       }
+    } else {
+      TSDebug(PLUGIN_NAME, "Request is an internal (plugin) request, implicitly promoted");
     }
     break;
 


[2/2] trafficserver git commit: Added TS-3668

Posted by zw...@apache.org.
Added TS-3668


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

Branch: refs/heads/master
Commit: c6ef7b4967dc8a48f1022ba48fe977ab5d018b37
Parents: e90d9b9
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Jun 8 16:26:12 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Jun 8 16:26:12 2015 -0600

----------------------------------------------------------------------
 CHANGES | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c6ef7b49/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 75c6da9..0a51854 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3668] cache_promote: Make cache promotion explicit for internal
+   requests. This helps when e.g. background_fetch is used together with this
+   plugin.
+
   *) [TS-3122] Add support for hugepages on Linux.
 
   *) [TS-2032] Eliminate remnant code for milestone for cache-lookup times.