Skip to content

Commit e3ec782

Browse files
authored
remove -k parameter and clear_hostdb command (#12188)
Co-authored-by: Chris McFarlen <cmcfarlen@apple.com>
1 parent 9ce3e49 commit e3ec782

3 files changed

Lines changed: 24 additions & 65 deletions

File tree

include/iocore/hostdb/HostDBProcessor.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,6 @@ struct HostDBProcessor : public Processor {
737737
*/
738738
int start(int no_of_additional_event_threads = 0, size_t stacksize = DEFAULT_STACKSIZE) override;
739739

740-
// clear_and_start is the same start, except the persistent database is cleared first.
741-
int clear_and_start(int no_of_additional_event_threads = 0, size_t stacksize = DEFAULT_STACKSIZE);
742-
743740
// Private
744741
HostDBCache *cache();
745742

src/iocore/hostdb/HostDB.cc

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -323,17 +323,6 @@ HostDBCache::start(int flags)
323323
return 0;
324324
}
325325

326-
int
327-
HostDBProcessor::clear_and_start(int, size_t)
328-
{
329-
if (hostDB.start(0) < 0) {
330-
return -1;
331-
}
332-
333-
hostDB.refcountcache->clear();
334-
return init();
335-
}
336-
337326
// Start up the Host Database processor.
338327
// Load configuration, register configuration and statistics and
339328
// open the cache. This doesn't create any threads, so those

src/traffic_server/traffic_server.cc

Lines changed: 24 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ char regression_test[1024] = "";
176176
int regression_list = 0;
177177
int regression_level = REGRESSION_TEST_NONE;
178178
#endif
179-
int auto_clear_hostdb_flag = 0;
180179

181180
char command_string[512] = "";
182181
char conf_dir[512] = "";
@@ -213,39 +212,38 @@ int cmd_block = 0;
213212
int delay_listen_for_cache = 0;
214213

215214
ArgumentDescription argument_descriptions[] = {
216-
{"net_threads", 'n', "Number of Net Threads", "I", &num_of_net_threads, "PROXY_NET_THREADS", nullptr },
217-
{"udp_threads", 'U', "Number of UDP Threads", "I", &num_of_udp_threads, "PROXY_UDP_THREADS", nullptr },
218-
{"accept_thread", 'a', "Use an Accept Thread", "T", &num_accept_threads, "PROXY_ACCEPT_THREAD", nullptr },
219-
{"httpport", 'p', "Port descriptor for HTTP Accept", "S*", &http_accept_port_descriptor, "PROXY_HTTP_ACCEPT_PORT", nullptr },
220-
{"disable_freelist", 'f', "Disable the freelist memory allocator", "T", &cmd_disable_freelist, "PROXY_DPRINTF_LEVEL", nullptr },
221-
{"disable_pfreelist", 'F', "Disable the freelist memory allocator in ProxyAllocator", "T", &cmd_disable_pfreelist,
222-
"PROXY_DPRINTF_LEVEL", nullptr },
223-
{"maxRecords", 'm', "Max number of librecords metrics and configurations (default & minimum: 2048)", "I", &max_records_entries,
224-
"PROXY_MAX_RECORDS", &check_max_records_argument},
215+
{"net_threads", 'n', "Number of Net Threads", "I", &num_of_net_threads, "PROXY_NET_THREADS", nullptr },
216+
{"udp_threads", 'U', "Number of UDP Threads", "I", &num_of_udp_threads, "PROXY_UDP_THREADS", nullptr },
217+
{"accept_thread", 'a', "Use an Accept Thread", "T", &num_accept_threads, "PROXY_ACCEPT_THREAD", nullptr },
218+
{"httpport", 'p', "Port descriptor for HTTP Accept", "S*", &http_accept_port_descriptor, "PROXY_HTTP_ACCEPT_PORT", nullptr },
219+
{"disable_freelist", 'f', "Disable the freelist memory allocator", "T", &cmd_disable_freelist, "PROXY_DPRINTF_LEVEL", nullptr },
220+
{"disable_pfreelist", 'F', "Disable the freelist memory allocator in ProxyAllocator", "T", &cmd_disable_pfreelist,
221+
"PROXY_DPRINTF_LEVEL", nullptr },
222+
{"maxRecords", 'm', "Max number of librecords metrics and configurations (default & minimum: 2048)", "I", &max_records_entries,
223+
"PROXY_MAX_RECORDS", &check_max_records_argument},
225224

226225
#if TS_HAS_TESTS
227-
{"regression", 'R', "Regression Level (quick:1..long:3)", "I", &regression_level, "PROXY_REGRESSION", nullptr },
228-
{"regression_test", 'r', "Run Specific Regression Test", "S512", regression_test, "PROXY_REGRESSION_TEST", nullptr },
229-
{"regression_list", 'l', "List Regression Tests", "T", &regression_list, "PROXY_REGRESSION_LIST", nullptr },
226+
{"regression", 'R', "Regression Level (quick:1..long:3)", "I", &regression_level, "PROXY_REGRESSION", nullptr },
227+
{"regression_test", 'r', "Run Specific Regression Test", "S512", regression_test, "PROXY_REGRESSION_TEST", nullptr },
228+
{"regression_list", 'l', "List Regression Tests", "T", &regression_list, "PROXY_REGRESSION_LIST", nullptr },
230229
#endif // TS_HAS_TESTS
231230

232231
#if TS_USE_DIAGS
233-
{"debug_tags", 'T', "Vertical-bar-separated Debug Tags", "S1023", error_tags, "PROXY_DEBUG_TAGS", nullptr },
234-
{"action_tags", 'B', "Vertical-bar-separated Behavior Tags", "S1023", action_tags, "PROXY_BEHAVIOR_TAGS", nullptr },
232+
{"debug_tags", 'T', "Vertical-bar-separated Debug Tags", "S1023", error_tags, "PROXY_DEBUG_TAGS", nullptr },
233+
{"action_tags", 'B', "Vertical-bar-separated Behavior Tags", "S1023", action_tags, "PROXY_BEHAVIOR_TAGS", nullptr },
235234
#endif
236235

237-
{"interval", 'i', "Statistics Interval", "I", &show_statistics, "PROXY_STATS_INTERVAL", nullptr },
236+
{"interval", 'i', "Statistics Interval", "I", &show_statistics, "PROXY_STATS_INTERVAL", nullptr },
238237
{"command", 'C',
239238
"Maintenance Command to Execute\n"
240-
" Commands: list, check, clear, clear_cache, clear_hostdb, verify_config, verify_global_plugin, verify_remap_plugin, help", "S511", &command_string, "PROXY_COMMAND_STRING", nullptr },
241-
{"conf_dir", 'D', "config dir to verify", "S511", &conf_dir, "PROXY_CONFIG_CONFIG_DIR", nullptr },
242-
{"clear_hostdb", 'k', "Clear HostDB on Startup", "F", &auto_clear_hostdb_flag, "PROXY_CLEAR_HOSTDB", nullptr },
243-
{"clear_cache", 'K', "Clear Cache on Startup", "F", &cacheProcessor.auto_clear_flag, "PROXY_CLEAR_CACHE", nullptr },
244-
{"bind_stdout", '-', "Regular file to bind stdout to", "S512", &bind_stdout, "PROXY_BIND_STDOUT", nullptr },
245-
{"bind_stderr", '-', "Regular file to bind stderr to", "S512", &bind_stderr, "PROXY_BIND_STDERR", nullptr },
246-
{"accept_mss", '-', "MSS for client connections", "I", &accept_mss, nullptr, nullptr },
247-
{"poll_timeout", 't', "poll timeout in milliseconds", "I", &poll_timeout, nullptr, nullptr },
248-
{"block", '-', "block for debug attach", "T", &cmd_block, nullptr, nullptr },
239+
" Commands: list, check, clear, clear_cache, verify_config, verify_global_plugin, verify_remap_plugin, help", "S511", &command_string, "PROXY_COMMAND_STRING", nullptr },
240+
{"conf_dir", 'D', "config dir to verify", "S511", &conf_dir, "PROXY_CONFIG_CONFIG_DIR", nullptr },
241+
{"clear_cache", 'K', "Clear Cache on Startup", "F", &cacheProcessor.auto_clear_flag, "PROXY_CLEAR_CACHE", nullptr },
242+
{"bind_stdout", '-', "Regular file to bind stdout to", "S512", &bind_stdout, "PROXY_BIND_STDOUT", nullptr },
243+
{"bind_stderr", '-', "Regular file to bind stderr to", "S512", &bind_stderr, "PROXY_BIND_STDERR", nullptr },
244+
{"accept_mss", '-', "MSS for client connections", "I", &accept_mss, nullptr, nullptr },
245+
{"poll_timeout", 't', "poll timeout in milliseconds", "I", &poll_timeout, nullptr, nullptr },
246+
{"block", '-', "block for debug attach", "T", &cmd_block, nullptr, nullptr },
249247
HELP_ARGUMENT_DESCRIPTION(),
250248
VERSION_ARGUMENT_DESCRIPTION(),
251249
RUNROOT_ARGUMENT_DESCRIPTION(),
@@ -912,31 +910,8 @@ cmd_clear(char *cmd)
912910
Note("CLEAR");
913911

914912
bool c_all = !strcmp(cmd, "clear");
915-
bool c_hdb = !strcmp(cmd, "clear_hostdb");
916913
bool c_cache = !strcmp(cmd, "clear_cache");
917914

918-
if (c_all || c_hdb) {
919-
std::string rundir(RecConfigReadRuntimeDir());
920-
std::string config(Layout::relative_to(rundir, "hostdb.config"));
921-
922-
Note("Clearing HostDB Configuration");
923-
if (unlink(config.c_str()) < 0) {
924-
Note("unable to unlink %s", config.c_str());
925-
}
926-
}
927-
928-
if (c_hdb || c_all) {
929-
Note("Clearing Host Database");
930-
if (hostDBProcessor.cache()->start(PROCESSOR_RECONFIGURE) < 0) {
931-
Note("unable to open Host Database, CLEAR failed");
932-
return CMD_FAILED;
933-
}
934-
hostDBProcessor.cache()->refcountcache->clear();
935-
if (c_hdb) {
936-
return CMD_OK;
937-
}
938-
}
939-
940915
if (c_all || c_cache) {
941916
Note("Clearing Cache");
942917

@@ -2219,9 +2194,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
22192194

22202195
dnsProcessor.start(0, stacksize);
22212196

2222-
if ((auto_clear_hostdb_flag ? hostDBProcessor.clear_and_start() : hostDBProcessor.start()) < 0) {
2223-
Warning("bad hostdb or storage configuration, hostdb disabled");
2224-
}
2197+
hostDBProcessor.start();
22252198

22262199
// initialize logging (after event and net processor)
22272200
Log::init();

0 commit comments

Comments
 (0)