[
https://issues.apache.org/jira/browse/TS-4707?focusedWorklogId=28313&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-28313
]
ASF GitHub Bot logged work on TS-4707:
--------------------------------------
Author: ASF GitHub Bot
Created on: 07/Sep/16 17:25
Start Date: 07/Sep/16 17:25
Worklog Time Spent: 10m
Work Description: Github user jrushford commented on a diff in the pull
request:
https://github.com/apache/trafficserver/pull/834#discussion_r77867576
--- Diff: proxy/ParentConsistentHash.cc ---
@@ -64,23 +66,117 @@ ParentConsistentHash::getPathHash(HttpRequestData
*hrdata, ATSHash64 *h)
const char *tmp = NULL;
int len;
URL *url = hrdata->hdr->url_get();
+ char buffer[1024];
+ int slen = 0;
+ int num_dirs = 0;
+
+ // Use over-ride URL from HttpTransact::State's
cache_info.parent_selection_url, if present.
+ URL *ps_url = NULL;
+ Debug("parent_select", "ParentConsistentHash::%s()
hrdata->cache_info_parent_selection_url = 0x%lx", __func__,
+ (unsigned long int)hrdata->cache_info_parent_selection_url);
+ if (hrdata->cache_info_parent_selection_url) {
+ ps_url = *(hrdata->cache_info_parent_selection_url);
+ Debug("parent_select", "ParentConsistentHash::%s() ps_url = 0x%lx",
__func__, (unsigned long int)ps_url);
+ if (ps_url) {
+ tmp = ps_url->string_get_ref(&len);
+ if (tmp && len > 0) {
+ // Print the over-ride URL
+ slen = (len > 1023) ? 1023 : len;
+ strncpy(buffer, tmp, slen);
+ buffer[slen] = 0;
+ Debug("parent_select", "ParentConsistentHash::%s() Using Over-Ride
String='%s'.", __func__, buffer);
+ h->update(tmp, len);
+ goto done;
+ }
+ }
+ }
// Always hash on '/' because paths returned by ATS are always stripped
of it
h->update("/", 1);
tmp = url->path_get(&len);
- if (tmp) {
+
+ if (tmp && len > 0) {
+ // Print Original Path
--- End diff --
Perhaps include "ts/Diags.h" and use:
if (is_debug_tag_set("parent_select") {
slen = (len > 1023) ? 1023 : len;
strncpy(buffer, tmp, slen);
buffer[slen] = 0;
Debug("parent_select", "ParentConsistentHash::%s() Original Path='%s'.",
__func__, buffer);
}
Issue Time Tracking
-------------------
Worklog Id: (was: 28313)
Time Spent: 2h 20m (was: 2h 10m)
> Parent Consistent Hash Selection - add fname and maxdirs options.
> -----------------------------------------------------------------
>
> Key: TS-4707
> URL: https://issues.apache.org/jira/browse/TS-4707
> Project: Traffic Server
> Issue Type: Improvement
> Components: Parent Proxy
> Reporter: Peter Chou
> Assignee: Peter Chou
> Fix For: 7.0.0
>
> Time Spent: 2h 20m
> Remaining Estimate: 0h
>
> This enhancement adds two options, "fname" and "maxdirs", which can be used
> to exclude the file-name and some of the directories in the path. The
> remaining portions of the path are then used as part of the hash computation
> for selecting among multiple parent caches.
> For our usage, it was desirable from an operational perspective to direct all
> components of particular sub-tree to a single parent cache (to simplify
> trouble-shooting, pre-loading, etc.). This can be achieved by excluding the
> query-string, file-name, and right-most portions of the path from the hash
> computation.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)