This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new e3ec7827e7 remove -k parameter and clear_hostdb command (#12188)
e3ec7827e7 is described below

commit e3ec7827e720e691a57f524b1c455609ea7792c8
Author: Chris McFarlen <[email protected]>
AuthorDate: Tue Apr 15 10:41:38 2025 -0500

    remove -k parameter and clear_hostdb command (#12188)
    
    Co-authored-by: Chris McFarlen <[email protected]>
---
 include/iocore/hostdb/HostDBProcessor.h |  3 --
 src/iocore/hostdb/HostDB.cc             | 11 -----
 src/traffic_server/traffic_server.cc    | 75 +++++++++++----------------------
 3 files changed, 24 insertions(+), 65 deletions(-)

diff --git a/include/iocore/hostdb/HostDBProcessor.h 
b/include/iocore/hostdb/HostDBProcessor.h
index a532e23e49..cc4d1ddb89 100644
--- a/include/iocore/hostdb/HostDBProcessor.h
+++ b/include/iocore/hostdb/HostDBProcessor.h
@@ -737,9 +737,6 @@ struct HostDBProcessor : public Processor {
    */
   int start(int no_of_additional_event_threads = 0, size_t stacksize = 
DEFAULT_STACKSIZE) override;
 
-  // clear_and_start is the same start, except the persistent database is 
cleared first.
-  int clear_and_start(int no_of_additional_event_threads = 0, size_t stacksize 
= DEFAULT_STACKSIZE);
-
   // Private
   HostDBCache *cache();
 
diff --git a/src/iocore/hostdb/HostDB.cc b/src/iocore/hostdb/HostDB.cc
index 406504d7fd..fcb1a85273 100644
--- a/src/iocore/hostdb/HostDB.cc
+++ b/src/iocore/hostdb/HostDB.cc
@@ -323,17 +323,6 @@ HostDBCache::start(int flags)
   return 0;
 }
 
-int
-HostDBProcessor::clear_and_start(int, size_t)
-{
-  if (hostDB.start(0) < 0) {
-    return -1;
-  }
-
-  hostDB.refcountcache->clear();
-  return init();
-}
-
 // Start up the Host Database processor.
 // Load configuration, register configuration and statistics and
 // open the cache. This doesn't create any threads, so those
diff --git a/src/traffic_server/traffic_server.cc 
b/src/traffic_server/traffic_server.cc
index ce482eb31b..bc8896733c 100644
--- a/src/traffic_server/traffic_server.cc
+++ b/src/traffic_server/traffic_server.cc
@@ -176,7 +176,6 @@ char regression_test[1024] = "";
 int  regression_list       = 0;
 int  regression_level      = REGRESSION_TEST_NONE;
 #endif
-int auto_clear_hostdb_flag = 0;
 
 char command_string[512] = "";
 char conf_dir[512]       = "";
@@ -213,39 +212,38 @@ int cmd_block = 0;
 int delay_listen_for_cache = 0;
 
 ArgumentDescription argument_descriptions[] = {
-  {"net_threads",       'n', "Number of Net Threads",                          
                                                     "I",     
&num_of_net_threads,             "PROXY_NET_THREADS",       nullptr             
       },
-  {"udp_threads",       'U', "Number of UDP Threads",                          
                                                     "I",     
&num_of_udp_threads,             "PROXY_UDP_THREADS",       nullptr             
       },
-  {"accept_thread",     'a', "Use an Accept Thread",                           
                                                     "T",     
&num_accept_threads,             "PROXY_ACCEPT_THREAD",     nullptr             
       },
-  {"httpport",          'p', "Port descriptor for HTTP Accept",                
                                                     "S*",    
&http_accept_port_descriptor,    "PROXY_HTTP_ACCEPT_PORT",  nullptr             
       },
-  {"disable_freelist",  'f', "Disable the freelist memory allocator",          
                                                     "T",     
&cmd_disable_freelist,           "PROXY_DPRINTF_LEVEL",     nullptr             
       },
-  {"disable_pfreelist", 'F', "Disable the freelist memory allocator in 
ProxyAllocator",                                             "T",     
&cmd_disable_pfreelist,
-   "PROXY_DPRINTF_LEVEL",                                                      
                                                                                
                                          nullptr                    },
-  {"maxRecords",        'm', "Max number of librecords metrics and 
configurations (default & minimum: 2048)",                       "I",     
&max_records_entries,
-   "PROXY_MAX_RECORDS",                                                        
                                                                                
                                          &check_max_records_argument},
+  {"net_threads",       'n', "Number of Net Threads",                          
                                       "I",     &num_of_net_threads,            
 "PROXY_NET_THREADS",       nullptr                    },
+  {"udp_threads",       'U', "Number of UDP Threads",                          
                                       "I",     &num_of_udp_threads,            
 "PROXY_UDP_THREADS",       nullptr                    },
+  {"accept_thread",     'a', "Use an Accept Thread",                           
                                       "T",     &num_accept_threads,            
 "PROXY_ACCEPT_THREAD",     nullptr                    },
+  {"httpport",          'p', "Port descriptor for HTTP Accept",                
                                       "S*",    &http_accept_port_descriptor,   
 "PROXY_HTTP_ACCEPT_PORT",  nullptr                    },
+  {"disable_freelist",  'f', "Disable the freelist memory allocator",          
                                       "T",     &cmd_disable_freelist,          
 "PROXY_DPRINTF_LEVEL",     nullptr                    },
+  {"disable_pfreelist", 'F', "Disable the freelist memory allocator in 
ProxyAllocator",                               "T",     &cmd_disable_pfreelist,
+   "PROXY_DPRINTF_LEVEL",                                                      
                                                                                
                            nullptr                    },
+  {"maxRecords",        'm', "Max number of librecords metrics and 
configurations (default & minimum: 2048)",         "I",     
&max_records_entries,
+   "PROXY_MAX_RECORDS",                                                        
                                                                                
                            &check_max_records_argument},
 
 #if TS_HAS_TESTS
-  {"regression",        'R', "Regression Level (quick:1..long:3)",             
                                                     "I",     
&regression_level,               "PROXY_REGRESSION",        nullptr             
       },
-  {"regression_test",   'r', "Run Specific Regression Test",                   
                                                     "S512",  regression_test,  
               "PROXY_REGRESSION_TEST",   nullptr                    },
-  {"regression_list",   'l', "List Regression Tests",                          
                                                     "T",     &regression_list, 
               "PROXY_REGRESSION_LIST",   nullptr                    },
+  {"regression",        'R', "Regression Level (quick:1..long:3)",             
                                       "I",     &regression_level,              
 "PROXY_REGRESSION",        nullptr                    },
+  {"regression_test",   'r', "Run Specific Regression Test",                   
                                       "S512",  regression_test,                
 "PROXY_REGRESSION_TEST",   nullptr                    },
+  {"regression_list",   'l', "List Regression Tests",                          
                                       "T",     &regression_list,               
 "PROXY_REGRESSION_LIST",   nullptr                    },
 #endif  // TS_HAS_TESTS
 
 #if TS_USE_DIAGS
-  {"debug_tags",        'T', "Vertical-bar-separated Debug Tags",              
                                                     "S1023", error_tags,       
               "PROXY_DEBUG_TAGS",        nullptr                    },
-  {"action_tags",       'B', "Vertical-bar-separated Behavior Tags",           
                                                     "S1023", action_tags,      
               "PROXY_BEHAVIOR_TAGS",     nullptr                    },
+  {"debug_tags",        'T', "Vertical-bar-separated Debug Tags",              
                                       "S1023", error_tags,                     
 "PROXY_DEBUG_TAGS",        nullptr                    },
+  {"action_tags",       'B', "Vertical-bar-separated Behavior Tags",           
                                       "S1023", action_tags,                    
 "PROXY_BEHAVIOR_TAGS",     nullptr                    },
 #endif
 
-  {"interval",          'i', "Statistics Interval",                            
                                                     "I",     &show_statistics, 
               "PROXY_STATS_INTERVAL",    nullptr                    },
+  {"interval",          'i', "Statistics Interval",                            
                                       "I",     &show_statistics,               
 "PROXY_STATS_INTERVAL",    nullptr                    },
   {"command",           'C',
    "Maintenance Command to Execute\n"
-   "      Commands: list, check, clear, clear_cache, clear_hostdb, 
verify_config, verify_global_plugin, verify_remap_plugin, help", "S511",  
&command_string,                 "PROXY_COMMAND_STRING",    nullptr             
       },
-  {"conf_dir",          'D', "config dir to verify",                           
                                                     "S511",  &conf_dir,        
               "PROXY_CONFIG_CONFIG_DIR", nullptr                    },
-  {"clear_hostdb",      'k', "Clear HostDB on Startup",                        
                                                     "F",     
&auto_clear_hostdb_flag,         "PROXY_CLEAR_HOSTDB",      nullptr             
       },
-  {"clear_cache",       'K', "Clear Cache on Startup",                         
                                                     "F",     
&cacheProcessor.auto_clear_flag, "PROXY_CLEAR_CACHE",       nullptr             
       },
-  {"bind_stdout",       '-', "Regular file to bind stdout to",                 
                                                     "S512",  &bind_stdout,     
               "PROXY_BIND_STDOUT",       nullptr                    },
-  {"bind_stderr",       '-', "Regular file to bind stderr to",                 
                                                     "S512",  &bind_stderr,     
               "PROXY_BIND_STDERR",       nullptr                    },
-  {"accept_mss",        '-', "MSS for client connections",                     
                                                     "I",     &accept_mss,      
               nullptr,                   nullptr                    },
-  {"poll_timeout",      't', "poll timeout in milliseconds",                   
                                                     "I",     &poll_timeout,    
               nullptr,                   nullptr                    },
-  {"block",             '-', "block for debug attach",                         
                                                     "T",     &cmd_block,       
               nullptr,                   nullptr                    },
+   "      Commands: list, check, clear, clear_cache, verify_config, 
verify_global_plugin, verify_remap_plugin, help", "S511",  &command_string,     
            "PROXY_COMMAND_STRING",    nullptr                    },
+  {"conf_dir",          'D', "config dir to verify",                           
                                       "S511",  &conf_dir,                      
 "PROXY_CONFIG_CONFIG_DIR", nullptr                    },
+  {"clear_cache",       'K', "Clear Cache on Startup",                         
                                       "F",     
&cacheProcessor.auto_clear_flag, "PROXY_CLEAR_CACHE",       nullptr             
       },
+  {"bind_stdout",       '-', "Regular file to bind stdout to",                 
                                       "S512",  &bind_stdout,                   
 "PROXY_BIND_STDOUT",       nullptr                    },
+  {"bind_stderr",       '-', "Regular file to bind stderr to",                 
                                       "S512",  &bind_stderr,                   
 "PROXY_BIND_STDERR",       nullptr                    },
+  {"accept_mss",        '-', "MSS for client connections",                     
                                       "I",     &accept_mss,                    
 nullptr,                   nullptr                    },
+  {"poll_timeout",      't', "poll timeout in milliseconds",                   
                                       "I",     &poll_timeout,                  
 nullptr,                   nullptr                    },
+  {"block",             '-', "block for debug attach",                         
                                       "T",     &cmd_block,                     
 nullptr,                   nullptr                    },
   HELP_ARGUMENT_DESCRIPTION(),
   VERSION_ARGUMENT_DESCRIPTION(),
   RUNROOT_ARGUMENT_DESCRIPTION(),
@@ -912,31 +910,8 @@ cmd_clear(char *cmd)
   Note("CLEAR");
 
   bool c_all   = !strcmp(cmd, "clear");
-  bool c_hdb   = !strcmp(cmd, "clear_hostdb");
   bool c_cache = !strcmp(cmd, "clear_cache");
 
-  if (c_all || c_hdb) {
-    std::string rundir(RecConfigReadRuntimeDir());
-    std::string config(Layout::relative_to(rundir, "hostdb.config"));
-
-    Note("Clearing HostDB Configuration");
-    if (unlink(config.c_str()) < 0) {
-      Note("unable to unlink %s", config.c_str());
-    }
-  }
-
-  if (c_hdb || c_all) {
-    Note("Clearing Host Database");
-    if (hostDBProcessor.cache()->start(PROCESSOR_RECONFIGURE) < 0) {
-      Note("unable to open Host Database, CLEAR failed");
-      return CMD_FAILED;
-    }
-    hostDBProcessor.cache()->refcountcache->clear();
-    if (c_hdb) {
-      return CMD_OK;
-    }
-  }
-
   if (c_all || c_cache) {
     Note("Clearing Cache");
 
@@ -2219,9 +2194,7 @@ main(int /* argc ATS_UNUSED */, const char **argv)
 
     dnsProcessor.start(0, stacksize);
 
-    if ((auto_clear_hostdb_flag ? hostDBProcessor.clear_and_start() : 
hostDBProcessor.start()) < 0) {
-      Warning("bad hostdb or storage configuration, hostdb disabled");
-    }
+    hostDBProcessor.start();
 
     // initialize logging (after event and net processor)
     Log::init();

Reply via email to