diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 5013e83b590..662f6dd6944 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -178,6 +178,8 @@ Other Changes * SOLR-6677: Reduced logging during Solr startup, moved more logs to DEBUG level (janhoy, Shawn Heisey) +* SOLR-6090: Remove unreachable printLayout usage in cloud tests. (Cao Manh Dat via shalin) + ================== 6.2.1 ================== Bug Fixes diff --git a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java index 17ddca4888b..906116e1d94 100644 --- a/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java @@ -87,7 +87,6 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String DEFAULT_COLLECTION = "collection1"; - protected static final boolean DEBUG = false; String t1="a_t"; String i1="a_i1"; String tlong = "other_tl1"; @@ -366,10 +365,6 @@ public class BasicDistributedZkTest extends AbstractFullDistribZkTestBase { testUpdateProcessorsRunOnlyOnce("distrib-dup-test-chain-implicit"); testStopAndStartCoresInOneInstance(); - // Thread.sleep(10000000000L); - if (DEBUG) { - super.printLayout(); - } } // Insure that total docs found is the expected number. diff --git a/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java b/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java index 1e3c303e8c1..0e9df87af0b 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ClusterStateUpdateTest.java @@ -45,8 +45,6 @@ import org.slf4j.LoggerFactory; public class ClusterStateUpdateTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final boolean VERBOSE = false; - protected ZkTestServer zkServer; protected String zkDir; @@ -239,9 +237,6 @@ public class ClusterStateUpdateTest extends SolrTestCaseJ4 { @Override public void tearDown() throws Exception { - if (VERBOSE) { - printLayout(zkServer.getZkHost()); - } container1.shutdown(); container2.shutdown(); container3.shutdown(); diff --git a/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java b/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java index 7b9e9e4d9b0..477641da974 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CustomCollectionTest.java @@ -65,8 +65,6 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final boolean DEBUG = false; - protected String getSolrXml() { return "solr.xml"; } @@ -99,9 +97,6 @@ public class CustomCollectionTest extends AbstractFullDistribZkTestBase { testCustomCollectionsAPI(); testRouteFieldForHashRouter(); testCreateShardRepFactor(); - if (DEBUG) { - super.printLayout(); - } } diff --git a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java index bd55614c286..b92f1f7dccd 100644 --- a/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java @@ -49,9 +49,7 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private final static int NUM_SHARD_REPLICAS = 5; - - private static final boolean VERBOSE = false; - + private static final Pattern HOST = Pattern .compile(".*?\\:(\\d\\d\\d\\d)_.*"); @@ -173,7 +171,6 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 { shard1Ports.remove(leaderPort); // kill the leader - if (VERBOSE) System.out.println("Killing " + leaderPort); containerMap.get(leaderPort).shutdown(); //printLayout(zkServer.getZkAddress()); @@ -231,7 +228,6 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 { // make sure we have waited long enough for the first leader to have come back Thread.sleep(ZkTestServer.TICK_TIME * 2 + 100); - if (VERBOSE) System.out.println("kill everyone"); // kill everyone but the first leader that should have reconnected by now for (Map.Entry entry : containerMap.entrySet()) { if (entry.getKey() != leaderPort) { @@ -270,7 +266,6 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 { int leaderPort = 0; if (m.matches()) { leaderPort = Integer.parseInt(m.group(1)); - if (VERBOSE) System.out.println("The leader is:" + Integer.parseInt(m.group(1))); } else { throw new IllegalStateException(); } @@ -279,9 +274,6 @@ public class LeaderElectionIntegrationTest extends SolrTestCaseJ4 { @Override public void tearDown() throws Exception { - if (VERBOSE) { - printLayout(zkServer.getZkHost()); - } if (zkClient != null) { zkClient.close(); diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java index 9166a431af2..ea833e57a6c 100644 --- a/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/OverseerTest.java @@ -77,8 +77,7 @@ public class OverseerTest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); static final int TIMEOUT = 30000; - private static final boolean DEBUG = false; - + private List overseers = new ArrayList<>(); private List readers = new ArrayList<>(); private List httpShardHandlerFactorys = new ArrayList<>(); @@ -286,11 +285,6 @@ public class OverseerTest extends SolrTestCaseJ4 { assertNotNull(reader.getLeaderUrl(collection, "shard3", 15000)); } finally { - if (DEBUG) { - if (zkController != null) { - zkClient.printLayoutToStdOut(); - } - } close(zkClient); if (zkController != null) { zkController.close(); @@ -360,11 +354,6 @@ public class OverseerTest extends SolrTestCaseJ4 { assertNotNull(reader.getLeaderUrl("collection2", "shard3", 15000)); } finally { - if (DEBUG) { - if (zkController != null) { - zkClient.printLayoutToStdOut(); - } - } close(zkClient); if (zkController != null) { zkController.close(); @@ -499,11 +488,6 @@ public class OverseerTest extends SolrTestCaseJ4 { } } finally { - if (DEBUG) { - if (controllers[0] != null) { - zkClient.printLayoutToStdOut(); - } - } close(zkClient); close(overseerClient); close(reader); diff --git a/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java index ccdd958323c..b77389be7d5 100644 --- a/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/UnloadDistributedZkTest.java @@ -68,10 +68,6 @@ public class UnloadDistributedZkTest extends BasicDistributedZkTest { testUnloadLotsOfCores(); // long testUnloadShardAndCollection(); - - if (DEBUG) { - super.printLayout(); - } } private void checkCoreNamePresenceAndSliceCount(String collectionName, String coreName, diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java b/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java index 4cadf87585e..8b29d4854bb 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java @@ -51,9 +51,7 @@ import org.slf4j.LoggerFactory; // files - there are a lot of them to upload public class ZkCLITest extends SolrTestCaseJ4 { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - private static final boolean VERBOSE = false; - + protected ZkTestServer zkServer; protected String zkDir; @@ -363,9 +361,6 @@ public class ZkCLITest extends SolrTestCaseJ4 { @Override public void tearDown() throws Exception { - if (VERBOSE) { - printLayout(zkServer.getZkHost()); - } zkClient.close(); zkServer.shutdown(); super.tearDown(); diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java index 01d815ab230..d9257747584 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java @@ -46,8 +46,6 @@ public class ZkControllerTest extends SolrTestCaseJ4 { static final int TIMEOUT = 10000; - private static final boolean DEBUG = false; - @BeforeClass public static void beforeClass() throws Exception { @@ -185,9 +183,6 @@ public class ZkControllerTest extends SolrTestCaseJ4 { + COLLECTION_NAME, Utils.toJSON(zkProps), CreateMode.PERSISTENT, true); - if (DEBUG) { - zkClient.printLayoutToStdOut(); - } zkClient.close(); cc = getCoreContainer(); diff --git a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java index 0805cf149a5..39ef1b8394d 100644 --- a/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java @@ -33,7 +33,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; public class ZkSolrClientTest extends AbstractSolrTestCase { - private static final boolean DEBUG = false; @BeforeClass public static void beforeClass() throws Exception { @@ -151,10 +150,6 @@ public class ZkSolrClientTest extends AbstractSolrTestCase { zkClient.makePath("collections/collection3", true); } - if (DEBUG) { - zkClient.printLayoutToStdOut(); - } - assertNotNull(zkClient.exists("/collections/collection3", null, true)); assertNotNull(zkClient.exists("/collections/collection1", null, true)); @@ -181,10 +176,6 @@ public class ZkSolrClientTest extends AbstractSolrTestCase { Thread.sleep(1000 * i); } - if (DEBUG) { - zkClient.printLayoutToStdOut(); - } - assertNotNull("Node does not exist, but it should", zkClient.exists("/collections/collection4", null, true)); } finally { @@ -278,9 +269,6 @@ public class ZkSolrClientTest extends AbstractSolrTestCase { @Override public void process(WatchedEvent event) { - if (DEBUG) { - System.out.println("children changed"); - } cnt.incrementAndGet(); // remake watch try { @@ -300,10 +288,6 @@ public class ZkSolrClientTest extends AbstractSolrTestCase { zkClient.makePath("collections/collection99/config=collection3", true); zkClient.makePath("/collections/collection97/shards", true); - - if (DEBUG) { - zkClient.printLayoutToStdOut(); - } // pause for the watches to fire Thread.sleep(700); diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java index 34a7a6b385a..03db71c44d0 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java @@ -43,7 +43,6 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes private static final String ZK_HOST = "zkHost"; private static final String ZOOKEEPER_FORCE_SYNC = "zookeeper.forceSync"; protected static final String DEFAULT_COLLECTION = "collection1"; - private static final boolean DEBUG = false; protected ZkTestServer zkServer; private AtomicInteger homeCount = new AtomicInteger(); @@ -269,9 +268,6 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes @Override public void distribTearDown() throws Exception { - if (DEBUG) { - printLayout(); - } System.clearProperty(ZK_HOST); System.clearProperty("collection"); System.clearProperty(ENABLE_UPDATE_LOG); diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java index 5f77f693d12..4c63bfb7847 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractZkTestCase.java @@ -39,8 +39,6 @@ public abstract class AbstractZkTestCase extends SolrTestCaseJ4 { public static final int TIMEOUT = 45000; - private static final boolean DEBUG = false; - private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -137,10 +135,6 @@ public abstract class AbstractZkTestCase extends SolrTestCaseJ4 { @Override public void tearDown() throws Exception { - if (DEBUG) { - printLayout(zkServer.getZkHost()); - } - super.tearDown(); }