Tim Starling has submitted this change and it was merged.

Change subject: Bug: 45795 Ignore non-existent host; reduces noise
......................................................................


Bug: 45795 Ignore non-existent host; reduces noise

Suppress attempts to connect to non-existent hosts (causes a lot of noise in 
log files).
Needs parallel changes to puppet/templates/lucene/lsearch.conf.erb

Bug: 45795
Change-Id: Ia68eef0307fe69843ccfcd678b62c42e91e1d3ec
---
M src/org/wikimedia/lsearch/search/NetworkStatusThread.java
M src/org/wikimedia/lsearch/search/SearcherCache.java
2 files changed, 15 insertions(+), 4 deletions(-)

Approvals:
  Tim Starling: Verified; Looks good to me, approved
  Demon: Looks good to me, but someone else must approve



diff --git a/src/org/wikimedia/lsearch/search/NetworkStatusThread.java 
b/src/org/wikimedia/lsearch/search/NetworkStatusThread.java
index 0fdc551..d7fa17a 100644
--- a/src/org/wikimedia/lsearch/search/NetworkStatusThread.java
+++ b/src/org/wikimedia/lsearch/search/NetworkStatusThread.java
@@ -32,7 +32,8 @@
        protected RMIMessenger messenger;
        protected ArrayList<SearchHost> indexUpdates;
        protected SearcherCache cache;
-       
+       protected String nullHost;
+
        protected static NetworkStatusThread instance = null;
        
        protected NetworkStatusThread(){
@@ -40,6 +41,8 @@
                pingInterval = config.getInt("Search","checkinterval",10) * 
1000;
                indexUpdates = new ArrayList<SearchHost>();
                cache = SearcherCache.getInstance();
+               nullHost = config.getString( "Search", "nullHost", "" );    // 
non-existent host
+               log.info( "nullHost = " + nullHost );
        }
        
        @Override
@@ -67,14 +70,13 @@
        
        /** Check dead hosts, and flush caches is host is alive */
        protected void pingHosts() {
-               HashSet<String> noRetryHosts = new HashSet<String>();
                HashSet<SearchHost> deadPool = new HashSet<SearchHost>();
                deadPool.addAll(cache.getDeadPools());
                RMIMessengerClient messenger = new RMIMessengerClient();
                
                log.debug("Pinging remote hosts to see if they are up");
                for(SearchHost sh : deadPool){
-                       if(noRetryHosts.contains(sh.host)){
+                       if ( nullHost.equals( sh.host ) ) {
                                continue;
                        }
                        try {
@@ -85,7 +87,6 @@
                                }
                        } catch (RemoteException e) {
                                log.warn("Host "+sh.host+" for "+sh.iid+" still 
down.",e);
-                               //noRetryHosts.add(sh.host);
                        } catch (Exception e) {
                                e.printStackTrace();
                        }
diff --git a/src/org/wikimedia/lsearch/search/SearcherCache.java 
b/src/org/wikimedia/lsearch/search/SearcherCache.java
index e70797a..3b6bfb0 100644
--- a/src/org/wikimedia/lsearch/search/SearcherCache.java
+++ b/src/org/wikimedia/lsearch/search/SearcherCache.java
@@ -233,6 +233,9 @@
        /** Number of threads to use for initial deployment */
        protected int initialDeploymentThreads = 1;
        
+       /** non-existent host name */
+       protected String nullHost;
+
        /** If there is local searcher always use that */
        protected boolean forceLocal = true;
        
@@ -428,6 +431,10 @@
                        
                        if(!initialized.contains(iid.toString())){
                                for(String host : iid.getSearchHosts()){
+                                       if ( nullHost.equals( host ) ) {
+                                               log.debug( String.format( 
"Skipping initializeRemote for nullHost = %s, iid %s", nullHost, iid ) );
+                                               continue;
+                                       }
                                        if(!RMIMessengerClient.isLocal(host))
                                                initializeRemote(iid,host);
                                }
@@ -644,6 +651,9 @@
                        log.info("Excluding hosts: "+excludedHosts);
                }
                initialDeploymentThreads = config.getInt("SearcherPool", 
"initThreads",1);
+
+               nullHost = config.getString( "Search", "nullHost", "" );    // 
non-existent host
+               log.info( "nullHost = " + nullHost );
                
                forceLocal = config.getBoolean("SearcherPool", "forceLocal", 
true);
                

-- 
To view, visit https://gerrit.wikimedia.org/r/52543
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia68eef0307fe69843ccfcd678b62c42e91e1d3ec
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/lucene-search-2
Gerrit-Branch: master
Gerrit-Owner: Ram <r...@wikimedia.org>
Gerrit-Reviewer: Demon <ch...@wikimedia.org>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to