You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2023/04/06 14:25:16 UTC

[solr] branch main updated (684acf1c64c -> 748d0d1edf8)

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

epugh pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


    from 684acf1c64c SOLR-16728: Add changelog entry
     add c04e22f907e the npe fix, and a test..   however to get it to pass the ram checks, we need to filter the list
     add 78824508e82 i dont love what i added to deal with null filters...
     add d7c026b2492 add a test for nulls
     add fc6731a5cc5 Add test for nulls in Sort
     add e4f3873d08f i hate how i made the tests pass, and need someone with more java chops.  are we actually solving the right problem?
     add bbda9ffe54d Cleanup null check logic
     add 25b647b02ce tidy
     add cfd6b8b9a78 Merge remote-tracking branch 'upstream/main' into SOLR-9775
     add 864d2aa08df track changes
     new e7011b35334 Tolerate comments in versions.props (#1537)
     new 7d13e831119 Make it easy to build a non-snapshot version (#1544)
     new 8b8f9f67262 SOLR-16720: Defer PKI header creation to send-time (#1495)
     new 5a729895856 SOLR-16728: Fix SSL & HTTP2 classloading (#1542)
     new 74471941890 SOLR-16728: Add changelog entry
     new 748d0d1edf8 Merge branch 'epugh-SOLR-9775'

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 solr/CHANGES.txt                                   |  2 +
 .../org/apache/solr/search/QueryResultKey.java     | 33 ++++++++-----
 .../org/apache/solr/core/QueryResultKeyTest.java   | 57 ++++++++++++++++++++++
 3 files changed, 80 insertions(+), 12 deletions(-)


[solr] 02/06: Make it easy to build a non-snapshot version (#1544)

Posted by ep...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 7d13e83111911e3c92a66e8eee8d8775eafecc62
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Apr 5 09:29:36 2023 -0400

    Make it easy to build a non-snapshot version (#1544)
---
 build.gradle | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index 4ee6f785ecd..ebd9b85786a 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,7 +46,11 @@ version = {
   //  -Dversion.suffix=jenkins123
   
   String versionSuffix = propertyOrDefault('version.suffix', 'SNAPSHOT')
-  return propertyOrDefault('version.release', "${baseVersion}-${versionSuffix}")
+  String v = propertyOrDefault('version.release', "${baseVersion}-${versionSuffix}")
+  if (v.endsWith("-")) {
+    v = v.substring(0, v.length() - 1)
+  }
+  return v
 }()
 description = 'Grandparent project for Apache Solr'
 


[solr] 01/06: Tolerate comments in versions.props (#1537)

Posted by ep...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git

commit e7011b35334f25790cf14b04b72f0258a0e0c382
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Wed Apr 5 14:14:06 2023 +0200

    Tolerate comments in versions.props (#1537)
    
    Co-authored-by: David Smiley <ds...@apache.org>
---
 gradle/validation/versions-props-sorted.gradle | 9 +++++----
 versions.props                                 | 2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gradle/validation/versions-props-sorted.gradle b/gradle/validation/versions-props-sorted.gradle
index 670d2e8f691..3282faf8391 100644
--- a/gradle/validation/versions-props-sorted.gradle
+++ b/gradle/validation/versions-props-sorted.gradle
@@ -17,17 +17,18 @@
 
 // This ensures 'versions.props' file is sorted lexicographically.
 
+import java.util.stream.Collectors
+
 configure(rootProject) {
   task versionsPropsAreSorted() {
     doFirst {
       def versionsProps = file('versions.props')
-      def lines = versionsProps.readLines("UTF-8")
+      // remove # commented lines and blank lines
+      def lines = versionsProps.readLines("UTF-8").stream().filter(l -> !l.matches(/^(#.*|\s*)$/)).collect(Collectors.toList())
       def sorted = lines.toSorted()
 
       if (!Objects.equals(lines, sorted)) {
-        def sortedFile = file("${buildDir}/versions.props")
-        sortedFile.write(sorted.join("\n"), "UTF-8")
-        throw new GradleException("${versionsProps} file is not sorted lexicographically. I wrote a sorted file to ${sortedFile} - please review and commit.")
+        throw new GradleException("${versionsProps} file is not sorted lexicographically.")
       }
     }
   }
diff --git a/versions.props b/versions.props
index 68fa9be55b5..8c15fc3ef64 100644
--- a/versions.props
+++ b/versions.props
@@ -1,3 +1,5 @@
+# The lines in this file needs to be lexicographically sorted.
+# Please only add direct dependencies. Overrides of transitive versions should be called out in a comment.
 biz.aQute.bnd:biz.aQute.bnd.annotation=6.4.0
 com.adobe.testing:s3mock-junit4=2.1.34
 com.carrotsearch.randomizedtesting:*=2.8.1


[solr] 04/06: SOLR-16728: Fix SSL & HTTP2 classloading (#1542)

Posted by ep...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 5a729895856c2cf96010d5f96f966684a32c1b4f
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Apr 5 09:55:51 2023 -0400

    SOLR-16728: Fix SSL & HTTP2 classloading (#1542)
---
 solr/packaging/test/test_ssl.bats           | 61 +++++++++++++++++++++++++++++
 solr/server/contexts/solr-jetty-context.xml |  5 +--
 2 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/solr/packaging/test/test_ssl.bats b/solr/packaging/test/test_ssl.bats
new file mode 100644
index 00000000000..13ee4253928
--- /dev/null
+++ b/solr/packaging/test/test_ssl.bats
@@ -0,0 +1,61 @@
+#!/usr/bin/env bats
+
+# 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.
+
+load bats_helper
+
+setup() {
+  common_clean_setup
+}
+
+teardown() {
+  # save a snapshot of SOLR_HOME for failed tests
+  save_home_on_failure
+
+  solr stop -all >/dev/null 2>&1
+}
+
+@test "start solr with ssl" {
+  # Create a keystore
+  export ssl_dir="${BATS_TEST_TMPDIR}/ssl"
+  mkdir -p "$ssl_dir"
+  (
+    cd "$ssl_dir"
+    rm -f solr-ssl.keystore.p12 solr-ssl.pem
+    keytool -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass secret -storepass secret -validity 9999 -keystore solr-ssl.keystore.p12 -storetype PKCS12 -ext SAN=DNS:localhost,IP:127.0.0.1 -dname "CN=localhost, OU=Organizational Unit, O=Organization, L=Location, ST=State, C=Country"
+    openssl pkcs12 -in solr-ssl.keystore.p12 -out solr-ssl.pem -passin pass:secret -passout pass:
+  )
+
+  # Set ENV_VARs so that Solr uses this keystore
+  export SOLR_SSL_ENABLED=true
+  export SOLR_SSL_KEY_STORE=$ssl_dir/solr-ssl.keystore.p12
+  export SOLR_SSL_KEY_STORE_PASSWORD=secret
+  export SOLR_SSL_TRUST_STORE=$ssl_dir/solr-ssl.keystore.p12
+  export SOLR_SSL_TRUST_STORE_PASSWORD=secret
+  export SOLR_SSL_NEED_CLIENT_AUTH=false
+  export SOLR_SSL_WANT_CLIENT_AUTH=false
+  export SOLR_SSL_CHECK_PEER_NAME=true
+  export SOLR_HOST=localhost
+
+  solr start -c
+  solr assert --started https://localhost:8983/solr --timeout 5000
+
+  run curl --cacert "$ssl_dir/solr-ssl.pem" 'https://localhost:8983/solr/admin/collections?action=CREATE&collection.configName=_default&name=test&numShards=2&replicationFactor=1&router.name=compositeId&wt=json'
+  assert_output --partial '"status":0'
+
+  run curl --cacert "$ssl_dir/solr-ssl.pem" 'https://localhost:8983/solr/test/select?q=*:*'
+  assert_output --partial '"numFound":0'
+}
diff --git a/solr/server/contexts/solr-jetty-context.xml b/solr/server/contexts/solr-jetty-context.xml
index c5df3ab2105..ec646738c3b 100644
--- a/solr/server/contexts/solr-jetty-context.xml
+++ b/solr/server/contexts/solr-jetty-context.xml
@@ -29,10 +29,7 @@
       <New id="removeServerClasses" class="org.eclipse.jetty.webapp.ClassMatcher">
         <Arg>
           <Array type="java.lang.String">
-            <Item>-org.eclipse.jetty.io.</Item>
-            <Item>-org.eclipse.jetty.http.</Item>
-            <Item>-org.eclipse.jetty.http2.</Item>
-            <Item>-org.eclipse.jetty.util.</Item>
+            <Item>-org.eclipse.jetty.</Item>
           </Array>
         </Arg>
       </New>


[solr] 06/06: Merge branch 'epugh-SOLR-9775'

Posted by ep...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 748d0d1edf8ee52ab7dd819e31adc1c709a187e4
Merge: 684acf1c64c 74471941890
Author: Eric Pugh <ep...@opensourceconnections.com>
AuthorDate: Thu Apr 6 10:23:30 2023 -0400

    Merge branch 'epugh-SOLR-9775'

 solr/CHANGES.txt                                   |  2 +
 .../org/apache/solr/search/QueryResultKey.java     | 33 ++++++++-----
 .../org/apache/solr/core/QueryResultKeyTest.java   | 57 ++++++++++++++++++++++
 3 files changed, 80 insertions(+), 12 deletions(-)


[solr] 05/06: SOLR-16728: Add changelog entry

Posted by ep...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 744719418908a0fc1728c9d3f4433a58d00c0c29
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Apr 5 10:01:03 2023 -0400

    SOLR-16728: Add changelog entry
---
 solr/CHANGES.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 54c3f37b7ac..11b8566c883 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -104,6 +104,9 @@ Bug Fixes
 * SOLR-16720: PKI headers are now populated closer to when inter-node requests are actually sent,
   making TTL expiry less likely. (Jason Gerlowski, Alex Deparvu)
 
+* SOLR-16728: Fix Classloading Exception for inter-node requests when using SSL and HTTP2.
+  All Jetty classes are able to be shared between the Jetty server and webApp now. (Houston Putman)
+
 * NPE in QueryResultKey when running clustering search query in some cases.  (Roman Kagan, Christine Poerschke via Eric Pugh)
 
 Dependency Upgrades


[solr] 03/06: SOLR-16720: Defer PKI header creation to send-time (#1495)

Posted by ep...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 8b8f9f6726296749551a6edfffe7aa2ccae7dc0e
Author: Jason Gerlowski <ge...@apache.org>
AuthorDate: Wed Apr 5 09:55:08 2023 -0400

    SOLR-16720: Defer PKI header creation to send-time (#1495)
    
    Prior to this commit, the PKIAuthPlugin decorates outgoing requests at
    'queue' time instead of later when they're actually sent.  This can
    cause scenarios where, under heavy load, queue time and sending time are
    far enough apart that much or all of the TTL window for the outgoing
    request is expired by the time its even sent.
    
    This commit switches header-decoration to occur using a different
    lifecycle hook offered by Jetty, 'onBegin', so that it's done as close
    as possible to the actual time the request is sent.
    
    This won't eliminate the possibility of errant TTL expiry - a JVM might go
    into a long GC right after 'onBegin' for a request but before sending it on
    the wire.  But it should reduce errant TTL expiry substantially.
---
 solr/CHANGES.txt                                   |  3 ++
 .../solr/security/PKIAuthenticationPlugin.java     | 41 +++++++++++++++++-----
 2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c913303b45e..54c3f37b7ac 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -101,6 +101,9 @@ Bug Fixes
 * SOLR-16730: Fix NPE in SystemInfoHandler for inter-node requests that would cause the Nodes page not to load.
   SystemInfoHandler no longer populates the username, roles and permissions in inter-node requests. (Tomás Fernández Löbbe)
 
+* SOLR-16720: PKI headers are now populated closer to when inter-node requests are actually sent,
+  making TTL expiry less likely. (Jason Gerlowski, Alex Deparvu)
+
 * NPE in QueryResultKey when running clustering search query in some cases.  (Roman Kagan, Christine Poerschke via Eric Pugh)
 
 Dependency Upgrades
diff --git a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
index 6a005559f9b..82a77934dcc 100644
--- a/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
+++ b/solr/core/src/java/org/apache/solr/security/PKIAuthenticationPlugin.java
@@ -368,9 +368,20 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
   public void setup(Http2SolrClient client) {
     final HttpListenerFactory.RequestResponseListener listener =
         new HttpListenerFactory.RequestResponseListener() {
+          private static final String CACHED_REQUEST_USER_KEY = "cachedRequestUser";
+
           @Override
           public void onQueued(Request request) {
-            log.trace("onQueued: {}", request);
+            // The onBegin hook below (potentially) runs in a separate Jetty thread than was
+            // used to submit the request.  While we're still in the submitting thread, fetch
+            // the user information from the SolrRequestInfo thread local and cache it on the
+            // Request so it can be accessed accurately in onBegin
+            cachePreFetchedUserOnJettyRequest(request);
+          }
+
+          @Override
+          public void onBegin(Request request) {
+            log.trace("onBegin: {}", request);
             if (cores.getAuthenticationPlugin() == null) {
               log.trace("no authentication plugin, skipping");
               return;
@@ -379,10 +390,12 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
               if (log.isDebugEnabled()) {
                 log.debug("{} secures this internode request", this.getClass().getSimpleName());
               }
+
+              final Optional<String> preFetchedUser = getUserFromJettyRequest(request);
               if ("v1".equals(System.getProperty(SEND_VERSION))) {
-                generateToken().ifPresent(s -> request.header(HEADER, s));
+                generateToken(preFetchedUser).ifPresent(s -> request.header(HEADER, s));
               } else {
-                generateTokenV2().ifPresent(s -> request.header(HEADER_V2, s));
+                generateTokenV2(preFetchedUser).ifPresent(s -> request.header(HEADER_V2, s));
               }
             } else {
               if (log.isDebugEnabled()) {
@@ -392,6 +405,15 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
               }
             }
           }
+
+          private void cachePreFetchedUserOnJettyRequest(Request request) {
+            request.attribute(CACHED_REQUEST_USER_KEY, getUser());
+          }
+
+          private Optional<String> getUserFromJettyRequest(Request request) {
+            return Optional.ofNullable(
+                (String) request.getAttributes().get(CACHED_REQUEST_USER_KEY));
+          }
         };
     client.addListenerFactory(() -> listener);
   }
@@ -458,8 +480,8 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
   }
 
   @SuppressForbidden(reason = "Needs currentTimeMillis to set current time in header")
-  private Optional<String> generateToken() {
-    String usr = getUser();
+  private Optional<String> generateToken(Optional<String> preFetchedUser) {
+    String usr = preFetchedUser.orElse(getUser());
     if (usr == null) {
       return Optional.empty();
     }
@@ -472,8 +494,9 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
     return Optional.of(myNodeName + " " + base64Cipher);
   }
 
-  private Optional<String> generateTokenV2() {
-    String user = getUser();
+  private Optional<String> generateTokenV2(Optional<String> preFetchedUser) {
+
+    String user = preFetchedUser.orElse(getUser());
     if (user == null) {
       return Optional.empty();
     }
@@ -488,9 +511,9 @@ public class PKIAuthenticationPlugin extends AuthenticationPlugin
 
   void setHeader(HttpRequest httpRequest) {
     if ("v1".equals(System.getProperty(SEND_VERSION))) {
-      generateToken().ifPresent(s -> httpRequest.setHeader(HEADER, s));
+      generateToken(Optional.empty()).ifPresent(s -> httpRequest.setHeader(HEADER, s));
     } else {
-      generateTokenV2().ifPresent(s -> httpRequest.setHeader(HEADER_V2, s));
+      generateTokenV2(Optional.empty()).ifPresent(s -> httpRequest.setHeader(HEADER_V2, s));
     }
   }