Github user PSUdaemon commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/834#discussion_r78237199
--- Diff: proxy/ParentConsistentHash.cc ---
@@ -58,26 +61,135 @@ ParentConsistentHash::~ParentConsistentHash()
delete chash[SECONDARY];
}
+static void
+getPathHash_Helper(char *buffer, int size, const char *tmp, int len)
+{
+ int slen;
+ int max = size - 1;
+ slen = MIN(max, len);
+ strncpy(buffer, tmp, slen);
+ buffer[slen] = '\0';
+}
+
uint64_t
ParentConsistentHash::getPathHash(HttpRequestData *hrdata, ATSHash64 *h)
{
const char *tmp = NULL;
int len;
URL *url = hrdata->hdr->url_get();
+ char buffer[1024];
+ 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", "hrdata->cache_info_parent_selection_url = %p",
hrdata->cache_info_parent_selection_url);
+ if (hrdata->cache_info_parent_selection_url) {
+ ps_url = *(hrdata->cache_info_parent_selection_url);
+ Debug("parent_select", "ps_url = %p", ps_url);
+ if (ps_url) {
+ tmp = ps_url->string_get_ref(&len);
+ if (tmp && len > 0) {
+ // Print the over-ride URL
+ if (is_debug_tag_set("parent_select")) {
+ getPathHash_Helper(buffer, sizeof(buffer), tmp, len);
+ Debug("parent_select", "Using Over-Ride String='%s'.", buffer);
--- End diff --
Also, if that works for you, then you can get rid of the
`is_debug_tag_set()`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---