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 2013/04/29 20:28:37 UTC
git commit: TS-1811 Make the HostDB sizes variable on the SRV enabled
config.
Updated Branches:
refs/heads/master 7e417c471 -> 08ca473d0
TS-1811 Make the HostDB sizes variable on the SRV enabled config.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/08ca473d
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/08ca473d
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/08ca473d
Branch: refs/heads/master
Commit: 08ca473d05a59718d80de5aca7cf17aef1064d6d
Parents: 7e417c4
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Apr 19 10:35:09 2013 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Mon Apr 29 12:23:22 2013 -0600
----------------------------------------------------------------------
CHANGES | 3 +
iocore/hostdb/HostDB.cc | 10 ++--
iocore/hostdb/MultiCache.cc | 9 ++--
iocore/hostdb/P_HostDBProcessor.h | 65 ++++++++++++++-------------
mgmt/RecordsConfig.cc | 2 +-
proxy/Main.cc | 2 +-
proxy/config/records.config.default.in | 2 +-
proxy/http/HttpConfig.cc | 3 -
proxy/http/HttpConfig.h | 3 -
proxy/http/HttpSM.cc | 3 +-
proxy/http/HttpTransact.cc | 3 -
11 files changed, 52 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index b99556e..d0a6473 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
Changes with Apache Traffic Server 3.3.3
+ *) [TS-1811] Make the HostDB sizes variable on the SRV enabled config.
+ This restores compatibility with HostDB's prior to v3.3.1.
+
*) [TS-1843] Detect and link libhwloc on Ubuntu.
*) [TS-1858] Fix redefinition of timersub on Solaris.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/iocore/hostdb/HostDB.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 6221885..51f58a4 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -65,6 +65,7 @@ unsigned int hostdb_serve_stale_but_revalidate = 0;
char hostdb_filename[PATH_NAME_MAX + 1] = DEFAULT_HOST_DB_FILENAME;
int hostdb_size = DEFAULT_HOST_DB_SIZE;
int hostdb_sync_frequency = 120;
+int hostdb_srv_enabled = 0;
int hostdb_disable_reverse_lookup = 0;
ClassAllocator<HostDBContinuation> hostDBContAllocator("hostDBContAllocator");
@@ -379,7 +380,7 @@ HostDBCache::start(int flags)
Store *hostDBStore;
Span *hostDBSpan;
char storage_path[PATH_NAME_MAX + 1];
- int storage_size = 0;
+ int storage_size = 33554432; // 32MB default
bool reconfigure = ((flags & PROCESSOR_RECONFIGURE) ? true : false);
bool fix = ((flags & PROCESSOR_FIX) ? true : false);
@@ -390,12 +391,12 @@ HostDBCache::start(int flags)
REC_ReadConfigInt32(hostdb_enable, "proxy.config.hostdb");
REC_ReadConfigString(hostdb_filename, "proxy.config.hostdb.filename", PATH_NAME_MAX);
REC_ReadConfigInt32(hostdb_size, "proxy.config.hostdb.size");
+ REC_ReadConfigInt32(hostdb_srv_enabled, "proxy.config.srv_enabled");
REC_ReadConfigString(storage_path, "proxy.config.hostdb.storage_path", PATH_NAME_MAX);
REC_ReadConfigInt32(storage_size, "proxy.config.hostdb.storage_size");
if (storage_path[0] != '/') {
- Layout::relative_to(storage_path, PATH_NAME_MAX,
- system_root_dir, storage_path);
+ Layout::relative_to(storage_path, PATH_NAME_MAX, system_root_dir, storage_path);
}
Debug("hostdb", "Storage path is %s", storage_path);
@@ -418,8 +419,7 @@ HostDBCache::start(int flags)
Note("reconfiguring host database");
char p[PATH_NAME_MAX + 1];
- Layout::relative_to(p, PATH_NAME_MAX,
- system_config_directory, "internal/hostdb.config");
+ Layout::relative_to(p, PATH_NAME_MAX, system_config_directory, "internal/hostdb.config");
if (unlink(p) < 0)
Debug("hostdb", "unable to unlink %s", p);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/iocore/hostdb/MultiCache.cc
----------------------------------------------------------------------
diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc
index 00af859..1691940 100644
--- a/iocore/hostdb/MultiCache.cc
+++ b/iocore/hostdb/MultiCache.cc
@@ -566,8 +566,8 @@ MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, i
// Set up cache
{
Store tStore;
- int res = read_config(config_filename, tStore, t_db_filename,
- &t_db_size, &t_db_buckets);
+ int res = read_config(config_filename, tStore, t_db_filename, &t_db_size, &t_db_buckets);
+
ink_assert(store_verify(&tStore));
if (res < 0)
goto LfailRead;
@@ -581,7 +581,6 @@ MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, i
goto LfailMap;
clear();
} else {
-
// don't know how to rebuild from this problem
ink_assert(!db_filename || !strcmp(t_db_filename, db_filename));
if (!db_filename)
@@ -599,6 +598,7 @@ MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, i
// Try to get back our storage
Store diff;
+
s->try_realloc(cStore, diff);
if (diff.n_disks && !reconfigure)
goto LfailConfig;
@@ -606,8 +606,8 @@ MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, i
// Do we need to do a reconfigure?
if (diff.n_disks || change) {
// find a new store to old the amount of space we need
-
int delta = change;
+
if (diff.n_disks)
delta += diff.total_blocks();
@@ -674,6 +674,7 @@ MultiCacheBase::open(Store *s, const char *config_filename, char *db_filename, i
}
}
}
+
if (store)
ink_assert(store_verify(store));
Lcontinue:
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/iocore/hostdb/P_HostDBProcessor.h
----------------------------------------------------------------------
diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h
index 1920c2e..94da9bf 100644
--- a/iocore/hostdb/P_HostDBProcessor.h
+++ b/iocore/hostdb/P_HostDBProcessor.h
@@ -30,6 +30,38 @@
#include "I_HostDBProcessor.h"
+//
+// Data
+//
+
+extern int hostdb_enable;
+extern int hostdb_migrate_on_demand;
+extern int hostdb_cluster;
+extern int hostdb_cluster_round_robin;
+extern int hostdb_lookup_timeout;
+extern int hostdb_insert_timeout;
+extern int hostdb_re_dns_on_reload;
+
+// 0 = obey, 1 = ignore, 2 = min(X,ttl), 3 = max(X,ttl)
+enum
+ { TTL_OBEY, TTL_IGNORE, TTL_MIN, TTL_MAX };
+extern int hostdb_ttl_mode;
+
+extern unsigned int hostdb_current_interval;
+extern unsigned int hostdb_ip_stale_interval;
+extern unsigned int hostdb_ip_timeout_interval;
+extern unsigned int hostdb_ip_fail_timeout_interval;
+extern int hostdb_size;
+extern int hostdb_srv_enabled;
+extern char hostdb_filename[PATH_NAME_MAX + 1];
+
+//extern int hostdb_timestamp;
+extern int hostdb_sync_frequency;
+extern int hostdb_disable_reverse_lookup;
+
+// Static configuration information
+extern HostDBCache hostDB;
+
/** Host DB record mark.
The records in the host DB are de facto segregated by roughly the
@@ -175,7 +207,8 @@ struct HostDBCache: public MultiCache<HostDBInfo>
}
// This accounts for an average of 2 HostDBInfo per DNS cache (for round-robin etc.)
- virtual size_t estimated_heap_bytes_per_entry() const { return sizeof(HostDBInfo) * 2 + 512; }
+ // In addition, we can do a padding for additional SRV records storage.
+ virtual size_t estimated_heap_bytes_per_entry() const { return sizeof(HostDBInfo) * 2 + 512 * hostdb_srv_enabled; }
Queue<HostDBContinuation, Continuation::Link_link> pending_dns[MULTI_CACHE_PARTITIONS];
Queue<HostDBContinuation, Continuation::Link_link> &pending_dns_for_hash(INK_MD5 & md5);
@@ -498,36 +531,6 @@ HostDBContinuation():
}
};
-//
-// Data
-//
-
-extern int hostdb_enable;
-extern int hostdb_migrate_on_demand;
-extern int hostdb_cluster;
-extern int hostdb_cluster_round_robin;
-extern int hostdb_lookup_timeout;
-extern int hostdb_insert_timeout;
-extern int hostdb_re_dns_on_reload;
-
-// 0 = obey, 1 = ignore, 2 = min(X,ttl), 3 = max(X,ttl)
-enum
-{ TTL_OBEY, TTL_IGNORE, TTL_MIN, TTL_MAX };
-extern int hostdb_ttl_mode;
-
-extern unsigned int hostdb_current_interval;
-extern unsigned int hostdb_ip_stale_interval;
-extern unsigned int hostdb_ip_timeout_interval;
-extern unsigned int hostdb_ip_fail_timeout_interval;
-extern int hostdb_size;
-extern char hostdb_filename[PATH_NAME_MAX + 1];
-
-extern int hostdb_sync_frequency;
-extern int hostdb_disable_reverse_lookup;
-
-// Static configuration information
-extern HostDBCache hostDB;
-
//extern Queue<HostDBContinuation> remoteHostDBQueue[MULTI_CACHE_PARTITIONS];
inline unsigned int
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/mgmt/RecordsConfig.cc
----------------------------------------------------------------------
diff --git a/mgmt/RecordsConfig.cc b/mgmt/RecordsConfig.cc
index 6735615..3c9071a 100644
--- a/mgmt/RecordsConfig.cc
+++ b/mgmt/RecordsConfig.cc
@@ -146,7 +146,7 @@ RecordElement RecordsConfig[] = {
//# Support for SRV records
//#
//##############################################################################
- {RECT_CONFIG, "proxy.config.srv_enabled", RECD_INT, "0", RECU_DYNAMIC, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
+ {RECT_CONFIG, "proxy.config.srv_enabled", RECD_INT, "0", RECU_RESTART_TS, RR_NULL, RECC_INT, "[0-1]", RECA_NULL}
,
//##############################################################################
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/proxy/Main.cc
----------------------------------------------------------------------
diff --git a/proxy/Main.cc b/proxy/Main.cc
index 793add0..219cd8c 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -427,7 +427,7 @@ cmd_list(char *cmd)
// show hostdb size
#ifndef INK_NO_HOSTDB
- int h_size = 0;
+ int h_size = 120000;
TS_ReadConfigInteger(h_size, "proxy.config.hostdb.size");
printf("Host Database size:\t%d\n", h_size);
#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/proxy/config/records.config.default.in
----------------------------------------------------------------------
diff --git a/proxy/config/records.config.default.in b/proxy/config/records.config.default.in
index 7b39d07..f09ffe2 100644
--- a/proxy/config/records.config.default.in
+++ b/proxy/config/records.config.default.in
@@ -396,7 +396,7 @@ CONFIG proxy.config.dns.validate_query_name INT 0
# note that in order to increase hostdb.size, hostdb.storage_size should
# also be increase. These are best guesses, you will have to monitor this.
CONFIG proxy.config.hostdb.size INT 120000
-CONFIG proxy.config.hostdb.storage_size INT 200M
+CONFIG proxy.config.hostdb.storage_size INT 32M
# ttl modes:
# 0 = obey
# 1 = ignore
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/proxy/http/HttpConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 8793e6f..21f6fd0 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -1351,9 +1351,6 @@ HttpConfig::startup()
// Stat Page Info
HttpEstablishStaticConfigByte(c.enable_http_info, "proxy.config.http.enable_http_info");
- // Support SRV records
- HttpEstablishStaticConfigLongLong(c.srv_enabled, "proxy.config.srv_enabled");
-
//##############################################################################
//#
//# Redirection
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/proxy/http/HttpConfig.h
----------------------------------------------------------------------
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index 494fc60..024154d 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -771,8 +771,6 @@ public:
// rather it is the time skew which the manager observes
int32_t cluster_time_delta;
- MgmtInt srv_enabled; /* added by: ebalsa */
-
//##############################################################################
//#
//# Redirection
@@ -955,7 +953,6 @@ HttpConfigParams::HttpConfigParams()
default_buffer_water_mark(0),
enable_http_info(0),
cluster_time_delta(0),
- srv_enabled(0),
redirection_enabled(1),
number_of_redirections(0),
post_copy_size(2048),
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index db3a415..38a489f 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -418,7 +418,8 @@ HttpSM::init()
t_state.cache_info.config.cache_vary_default_other = t_state.http_config_param->cache_vary_default_other;
t_state.init();
- t_state.srv_lookup = HttpConfig::m_master.srv_enabled;
+ t_state.srv_lookup = hostdb_srv_enabled;
+
// Added to skip dns if the document is in cache. DNS will be forced if there is a ip based ACL in
// cache control or parent.config or if the doc_in_cache_skip_dns is disabled or if http caching is disabled
// TODO: This probably doesn't honor this as a per-transaction overridable config.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/08ca473d/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 663a114..61fcf77 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -3527,9 +3527,6 @@ HttpTransact::handle_response_from_server(State* s)
if (is_request_retryable(s) && s->current.attempts < max_connect_retries) {
// If this is a round robin DNS entry & we're tried configured
// number of times, we should try another node
-
- //bool use_srv_records = HttpConfig::m_master.srv_enabled;
-
if (DNSLookupInfo::OS_ADDR_TRY_CLIENT == s->dns_info.os_addr_style) {
// attempt was based on client supplied server address. Try again
// using HostDB.