You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/12/12 07:43:15 UTC

[1/2] lucene-solr:jira/http2: Improve test

Repository: lucene-solr
Updated Branches:
  refs/heads/jira/http2 2ccd9df19 -> 9def8c11a


Improve test


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/c9c946bd
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/c9c946bd
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/c9c946bd

Branch: refs/heads/jira/http2
Commit: c9c946bd71e0055f89dd124772c4e9998ec257b2
Parents: 2ccd9df
Author: Cao Manh Dat <da...@apache.org>
Authored: Wed Dec 12 07:39:12 2018 +0000
Committer: Cao Manh Dat <da...@apache.org>
Committed: Wed Dec 12 07:39:12 2018 +0000

----------------------------------------------------------------------
 solr/solrj/src/test-files/log4j2.xml            | 40 ++++++++++++++++++++
 .../impl/Http2SolrClientCompatibilityTest.java  | 11 ++++--
 2 files changed, 48 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c9c946bd/solr/solrj/src/test-files/log4j2.xml
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test-files/log4j2.xml b/solr/solrj/src/test-files/log4j2.xml
new file mode 100644
index 0000000..612cfe8
--- /dev/null
+++ b/solr/solrj/src/test-files/log4j2.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<Configuration>
+  <Appenders>
+    <Console name="STDERR" target="SYSTEM_ERR">
+      <PatternLayout>
+        <Pattern>
+          %-4r %-5p (%t) [%X{node_name} %X{collection} %X{shard} %X{replica} %X{core}] %c{1.} %m%n
+        </Pattern>
+      </PatternLayout>
+    </Console>
+  </Appenders>
+  <Loggers>
+    <Logger name="org.apache.zookeeper" level="WARN"/>
+    <Logger name="org.apache.hadoop" level="WARN"/>
+    <Logger name="org.apache.directory" level="WARN"/>
+    <Logger name="org.apache.solr.hadoop" level="INFO"/>
+    <Logger name="org.eclipse.jetty" level="INFO"/>
+
+    <Root level="INFO">
+      <AppenderRef ref="STDERR"/>
+    </Root>
+  </Loggers>
+</Configuration>

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/c9c946bd/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientCompatibilityTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientCompatibilityTest.java
index 2897304..e9220de 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientCompatibilityTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/Http2SolrClientCompatibilityTest.java
@@ -59,8 +59,9 @@ public class Http2SolrClientCompatibilityTest extends SolrJettyTestBase {
       try {
         client.query(new SolrQuery("*:*"), SolrRequest.METHOD.GET);
       } catch (ParseException ignored) {}
+    } finally {
+      afterSolrJettyTestBase();
     }
-    afterSolrJettyTestBase();
   }
 
   public void testConnectToNewNodesUsingHttp1() throws Exception {
@@ -78,8 +79,9 @@ public class Http2SolrClientCompatibilityTest extends SolrJettyTestBase {
       try {
         client.query(new SolrQuery("*:*"), SolrRequest.METHOD.GET);
       } catch (ParseException ignored) {}
+    } finally {
+      afterSolrJettyTestBase();
     }
-    afterSolrJettyTestBase();
   }
 
   public void testConnectToOldNodesUsingHttp2() throws Exception {
@@ -90,6 +92,8 @@ public class Http2SolrClientCompatibilityTest extends SolrJettyTestBase {
         .useOnlyHttp1(true)
         .build();
     createAndStartJetty(legacyExampleCollection1SolrHome(), jettyConfig);
+
+    System.clearProperty("solr.http1");
     try (Http2SolrClient client = new Http2SolrClient.Builder(jetty.getBaseUrl().toString() + "/debug/foo")
         .build()) {
       assertTrue(client.getHttpClient().getTransport() instanceof HttpClientTransportOverHTTP2);
@@ -101,7 +105,8 @@ public class Http2SolrClientCompatibilityTest extends SolrJettyTestBase {
       } catch (SolrServerException e) {
         // expected
       }
+    } finally {
+      afterSolrJettyTestBase();
     }
-    afterSolrJettyTestBase();
   }
 }


[2/2] lucene-solr:jira/http2: Preventing read stale value of defaultClient

Posted by da...@apache.org.
Preventing read stale value of defaultClient


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/9def8c11
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/9def8c11
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/9def8c11

Branch: refs/heads/jira/http2
Commit: 9def8c11a097632967c8ddff237b07d2245e0737
Parents: c9c946b
Author: Cao Manh Dat <da...@apache.org>
Authored: Wed Dec 12 07:43:03 2018 +0000
Committer: Cao Manh Dat <da...@apache.org>
Committed: Wed Dec 12 07:43:03 2018 +0000

----------------------------------------------------------------------
 .../org/apache/solr/handler/component/HttpShardHandlerFactory.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/9def8c11/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
index 3c16cf8..6c37e80 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/HttpShardHandlerFactory.java
@@ -89,7 +89,7 @@ public class HttpShardHandlerFactory extends ShardHandlerFactory implements org.
       false
   );
 
-  protected Http2SolrClient defaultClient;
+  protected volatile Http2SolrClient defaultClient;
   protected InstrumentedHttpListenerFactory httpListenerFactory;
   private LBHttp2SolrClient loadbalancer;