From 0ddb8a03d39c0902198b780752e0cf0934c8041a Mon Sep 17 00:00:00 2001 From: Varun Thacker Date: Wed, 25 Oct 2017 14:43:33 -0700 Subject: [PATCH] SOLR-11467: Remove additional logging to track test failures --- .../apache/solr/handler/CdcrReplicator.java | 19 --------------- .../solr/handler/CdcrRequestHandler.java | 11 --------- .../update/processor/CdcrUpdateProcessor.java | 3 --- .../apache/solr/cloud/CdcrBootstrapTest.java | 23 ++----------------- 4 files changed, 2 insertions(+), 54 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrReplicator.java b/solr/core/src/java/org/apache/solr/handler/CdcrReplicator.java index c40a2e5f67c..a151a43061a 100644 --- a/solr/core/src/java/org/apache/solr/handler/CdcrReplicator.java +++ b/solr/core/src/java/org/apache/solr/handler/CdcrReplicator.java @@ -21,7 +21,6 @@ import java.lang.invoke.MethodHandles; import java.nio.charset.Charset; import java.util.List; -import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CloudSolrClient; import org.apache.solr.client.solrj.request.UpdateRequest; @@ -63,9 +62,6 @@ public class CdcrReplicator implements Runnable { } try { - // check what's there in target before sending further - printDocsFromTargetForAdditionalDebugging(); - // create update request UpdateRequest req = new UpdateRequest(); // Add the param to indicate the {@link CdcrUpdateProcessor} to keep the provided version number @@ -81,10 +77,6 @@ public class CdcrReplicator implements Runnable { Object o = subReader.next(); if (o == null) break; // we have reached the end of the update logs, we should close the batch - //additional logging - List entry = (List) o; - log.info("cdcr: current tlog entry in replicator: " + entry); - if (isDelete(o)) { /* @@ -148,17 +140,6 @@ public class CdcrReplicator implements Runnable { state.resetConsecutiveErrors(); } - - private void printDocsFromTargetForAdditionalDebugging() throws IOException, SolrServerException, CdcrReplicatorException { - try { - log.info("cdcr: docs in target: "+ state + " in replicator: " - + state.getClient().query(new SolrQuery("*:*")).getResults()); - } catch (Exception e) { - log.warn("cdcr: exception while querying to target: " + e); - } - } - - private boolean isDelete(Object o) { List entry = (List) o; int operationAndFlags = (Integer) entry.get(0); diff --git a/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java index 7f57eee9a98..430237e5c8d 100644 --- a/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/CdcrRequestHandler.java @@ -416,8 +416,6 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw for (final Future future : parallelExecutor.invokeAll(callables)) { long version = future.get(); - //additional logging - log.info("cdcr: shardcheckpoint: versions on target: " + version); if (version < checkpoint) { // we must take the lowest checkpoint from all the shards checkpoint = version; } @@ -631,23 +629,16 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw } CountDownLatch latch = new CountDownLatch(1); // latch to make sure BOOTSTRAP_STATUS gives correct response - //additional logging - log.info("cdcr: bootstrap executing for collection: " + collectionName + " and shard: " + shard); - Runnable runnable = () -> { Lock recoveryLock = req.getCore().getSolrCoreState().getRecoveryLock(); boolean locked = recoveryLock.tryLock(); SolrCoreState coreState = core.getSolrCoreState(); try { if (!locked) { - //additional logging - log.info("cdcr: couldn't acquire lock for bootstrap, issue CANCEL"); handleCancelBootstrap(req, rsp); } else if (leaderStateManager.amILeader()) { coreState.setCdcrBootstrapRunning(true); latch.countDown(); // free the latch as current bootstrap is executing - //additional logging - log.info("cdcr: acquire lock for bootstrap, latch removed"); //running.set(true); String masterUrl = req.getParams().get(ReplicationHandler.MASTER_URL); BootstrapCallable bootstrapCallable = new BootstrapCallable(masterUrl, core); @@ -674,8 +665,6 @@ public class CdcrRequestHandler extends RequestHandlerBase implements SolrCoreAw latch.countDown(); // free the latch as current bootstrap is executing } } - //additional logging - log.info("cdcr: bootstrap status after action: " + coreState.getCdcrBootstrapRunning()); }; try { diff --git a/solr/core/src/java/org/apache/solr/update/processor/CdcrUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/CdcrUpdateProcessor.java index 9cb7a8a346c..ee454670767 100644 --- a/solr/core/src/java/org/apache/solr/update/processor/CdcrUpdateProcessor.java +++ b/solr/core/src/java/org/apache/solr/update/processor/CdcrUpdateProcessor.java @@ -67,9 +67,6 @@ public class CdcrUpdateProcessor extends DistributedUpdateProcessor { cmd.setFlags(cmd.getFlags() & ~UpdateCommand.PEER_SYNC); } - //additional logging - log.info("cdcr: version received at target: " + cmd.getVersion()); - return result; } diff --git a/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java b/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java index 0925a68f817..580c047d7f5 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CdcrBootstrapTest.java @@ -163,7 +163,7 @@ public class CdcrBootstrapTest extends SolrTestCaseJ4 { MiniSolrCloudCluster target = new MiniSolrCloudCluster(1, createTempDir("cdcr-target"), buildJettyConfig("/solr")); try { target.waitForAllNodes(30); - log.info("Target zkHost = " + target.getZkServer().getZkAddress()); + System.out.println("Target zkHost = " + target.getZkServer().getZkAddress()); System.setProperty("cdcr.target.zkHost", target.getZkServer().getZkAddress()); MiniSolrCloudCluster source = new MiniSolrCloudCluster(1, createTempDir("cdcr-source"), buildJettyConfig("/solr")); @@ -261,9 +261,6 @@ public class CdcrBootstrapTest extends SolrTestCaseJ4 { QueryResponse response = sourceSolrClient.query(new SolrQuery("*:*")); assertEquals("", numDocs, response.getResults().getNumFound()); - //additional logging - log.info("cdcr: numDocs after initial indexing in source: " + numDocs); - // setup the target cluster target.uploadConfigSet(configset("cdcr-target"), "cdcr-target"); CollectionAdminRequest.createCollection("cdcr-target", "cdcr-target", 1, 1) @@ -272,16 +269,8 @@ public class CdcrBootstrapTest extends SolrTestCaseJ4 { targetSolrClient.setDefaultCollection("cdcr-target"); Thread.sleep(1000); - //additional logging - log.info("cdcr: numDocs in target-1 : " + targetSolrClient.query(new SolrQuery("*:*")).getResults().getNumFound()); - cdcrStart(targetSolrClient); cdcrStart(sourceSolrClient); - - //additional logging - log.info("cdcr: cdcr is enabled on source and target both, bootstrap should be triggered"); - log.info("cdcr: current numDocs in target-2: " + targetSolrClient.query(new SolrQuery("*:*")).getResults().getNumFound()); - int c = 0; for (int k = 0; k < docs; k++) { UpdateRequest req = new UpdateRequest(); @@ -292,20 +281,13 @@ public class CdcrBootstrapTest extends SolrTestCaseJ4 { req.add(doc); } req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true); - log.info("Adding 100 docs with commit=true, numDocs=" + numDocs); + log.info("Adding " + docs + " docs with commit=true, numDocs=" + numDocs); req.process(sourceSolrClient); } - //additional logging - log.info("cdcr: current numDocs in target-3: " + targetSolrClient.query(new SolrQuery("*:*")).getResults().getNumFound()); - response = sourceSolrClient.query(new SolrQuery("*:*")); assertEquals("", numDocs, response.getResults().getNumFound()); - //additional logging - log.info("cdcr: numDocs after second indexing in source: " + numDocs); - log.info("cdcr: current numDocs in target-4: " + targetSolrClient.query(new SolrQuery("*:*")).getResults().getNumFound()); - response = getCdcrQueue(sourceSolrClient); log.info("Cdcr queue response: " + response.getResponse()); long foundDocs = waitForTargetToSync(numDocs, targetSolrClient); @@ -326,7 +308,6 @@ public class CdcrBootstrapTest extends SolrTestCaseJ4 { try { targetSolrClient.commit(); response = targetSolrClient.query(new SolrQuery("*:*")); - log.info("cdcr: numDocs in waitForTargetToSync: " + response.getResults().getNumFound()); if (response.getResults().getNumFound() == numDocs) { break; }