Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-15089 - Various fixes for S3 Repository

Houston Putmanc112f0348264
diff --git a/solr/contrib/s3-repository/build.gradle b/solr/contrib/s3-repository/build.gradle
index 5aeb4b94d4d..bd5af516036 100644
--- a/solr/contrib/s3-repository/build.gradle
+++ b/solr/contrib/s3-repository/build.gradle
@@ -53,4 +53,8 @@ test {
// Without this, randomizedtesting will think our tests leak threads (b/c S3Mock's Jetty hasn't bothered to clean up yet)
environment "server.jetty.threads.idle-timeout", "3s"
+
+ // Reduce logging noise during the tests
+ environment "aws.accessKeyId", "foo"
+ environment "aws.secretKey", "bar"
}
diff --git a/solr/contrib/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java b/solr/contrib/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java
index c36a0f78a57..5f0c796f614 100644
--- a/solr/contrib/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java
+++ b/solr/contrib/s3-repository/src/java/org/apache/solr/s3/S3StorageClient.java
@@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory;
* docs</a> for details on where this client will fetch credentials from, and the order of
* precedence.
*/
-class S3StorageClient {
+public class S3StorageClient {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
@@ -523,11 +523,6 @@ class S3StorageClient {
sanitizedPath += S3_FILE_PATH_DELIMITER;
}
- // Trim file delimiter from end
- // if (sanitizedPath.length() > 1 && sanitizedPath.endsWith(S3_FILE_PATH_DELIMITER)) {
- // sanitizedPath = sanitizedPath.substring(0, path.length() - 1);
- // }
-
return sanitizedPath;
}
diff --git a/solr/contrib/s3-repository/src/test/org/apache/solr/s3/S3BackupRepositoryTest.java b/solr/contrib/s3-repository/src/test/org/apache/solr/s3/S3BackupRepositoryTest.java
index f8079bb2c27..3ff6dbfcd31 100644
--- a/solr/contrib/s3-repository/src/test/org/apache/solr/s3/S3BackupRepositoryTest.java
+++ b/solr/contrib/s3-repository/src/test/org/apache/solr/s3/S3BackupRepositoryTest.java
@@ -121,33 +121,32 @@ public class S3BackupRepositoryTest extends AbstractBackupRepositoryTest {
/** Check resolving paths. */
@Test
public void testResolve() throws Exception {
+ try (S3BackupRepository repo = getRepository()) {
+ // Add single element to root
+ assertEquals(new URI("s3:/root/path"), repo.resolve(new URI("s3:/root"), "path"));
- S3BackupRepository repo = new S3BackupRepository();
-
- // Add single element to root
- assertEquals(new URI("s3:/root/path"), repo.resolve(new URI("s3:/root"), "path"));
-
- // Root ends with '/'
- assertEquals(new URI("s3://root/path"), repo.resolve(new URI("s3://root/"), "path"));
- assertEquals(new URI("s3://root/path"), repo.resolve(new URI("s3://root///"), "path"));
+ // Root ends with '/'
+ assertEquals(new URI("s3://root/path"), repo.resolve(new URI("s3://root/"), "path"));
+ assertEquals(new URI("s3://root/path"), repo.resolve(new URI("s3://root///"), "path"));
- // Add to a sub-element
- assertEquals(
- new URI("s3://root/path1/path2"), repo.resolve(new URI("s3://root/path1"), "path2"));
+ // Add to a sub-element
+ assertEquals(
+ new URI("s3://root/path1/path2"), repo.resolve(new URI("s3://root/path1"), "path2"));
- // Add two elements to root
- assertEquals(
- new URI("s3://root/path1/path2"), repo.resolve(new URI("s3://root"), "path1", "path2"));
+ // Add two elements to root
+ assertEquals(
+ new URI("s3://root/path1/path2"), repo.resolve(new URI("s3://root"), "path1", "path2"));
- // Add compound elements
- assertEquals(
- new URI("s3:/root/path1/path2/path3"),
- repo.resolve(new URI("s3:/root"), "path1/path2", "path3"));
+ // Add compound elements
+ assertEquals(
+ new URI("s3:/root/path1/path2/path3"),
+ repo.resolve(new URI("s3:/root"), "path1/path2", "path3"));
- // Check URIs with an authority
- assertEquals(new URI("s3://auth/path"), repo.resolve(new URI("s3://auth"), "path"));
- assertEquals(
- new URI("s3://auth/path1/path2"), repo.resolve(new URI("s3://auth/path1"), "path2"));
+ // Check URIs with an authority
+ assertEquals(new URI("s3://auth/path"), repo.resolve(new URI("s3://auth"), "path"));
+ assertEquals(
+ new URI("s3://auth/path1/path2"), repo.resolve(new URI("s3://auth/path1"), "path2"));
+ }
}
/** Check - pushing a file to the repo (backup). - pulling a file from the repo (restore). */
diff --git a/solr/core/src/java/org/apache/solr/core/NodeConfig.java b/solr/core/src/java/org/apache/solr/core/NodeConfig.java
index 01ce8f387ac..039b0de2733 100644
--- a/solr/core/src/java/org/apache/solr/core/NodeConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/NodeConfig.java
@@ -376,7 +376,9 @@ public class NodeConfig {
"javax.net.ssl.trustStorePassword",
"basicauth",
"zkDigestPassword",
- "zkDigestReadonlyPassword"
+ "zkDigestReadonlyPassword",
+ "aws.secretKey", // AWS SDK v1
+ "aws.secretAccessKey" // AWS SDK v2
));
public NodeConfigBuilder(String nodeName, Path solrHome) {
diff --git a/solr/licenses/stax2-api-NOTICE.txt b/solr/licenses/stax2-api-NOTICE.txt
index a5f70fc088c..d75c973dad0 100644
--- a/solr/licenses/stax2-api-NOTICE.txt
+++ b/solr/licenses/stax2-api-NOTICE.txt
@@ -1,8 +1,18 @@
-Stax2 API is an extension to basic Stax 1.0 API that adds significant
-new functionality, such as full-featured bi-direction validation
-interface and high-performance Typed Access API.
+This copy of Stax2 API is licensed under the
+Simplified BSD License (also known as "2-clause BSD", or "FreeBSD License")
+See the License for details about distribution rights, and the
+specific rights regarding derivate works.
-(From http://repo1.maven.org/maven2/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.pom)
+You may obtain a copy of the License at:
+
+http://www.opensource.org/licenses/bsd-license.php
+
+with details of:
+
+<COPYRIGHT HOLDER> = FasterXML.com
+<YEAR> = 2010-
+
+(From https://github.com/FasterXML/stax2-api/blob/stax2-api-4.2.1/src/main/resources/META-INF/LICENSE)
Developer: Tatu Saloranta <[email protected]>
License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
Organization: fasterxml.com (http://fasterxml.com)
diff --git a/versions.lock b/versions.lock
index d77e315a021..4f977496551 100644
--- a/versions.lock
+++ b/versions.lock
@@ -199,7 +199,7 @@ org.checkerframework:checker-qual:3.10.0 (2 constraints: 490f9491)
org.codehaus.janino:commons-compiler:3.0.9 (2 constraints: d910f7d1)
org.codehaus.janino:janino:3.0.9 (1 constraints: 0e050336)
org.codehaus.mojo:animal-sniffer-annotations:1.14 (1 constraints: ea09d5aa)
-org.codehaus.woodstox:stax2-api:4.2.1 (4 constraints: 8b3d5b4c)
+org.codehaus.woodstox:stax2-api:4.2.1 (4 constraints: 8a3dc34b)
org.codehaus.woodstox:woodstox-core-asl:4.4.1 (1 constraints: 0b050c36)
org.eclipse.jetty:jetty-alpn-client:9.4.41.v20210516 (3 constraints: bc2cc8fa)
org.eclipse.jetty:jetty-alpn-java-client:9.4.41.v20210516 (1 constraints: 7907fe7c)
diff --git a/versions.props b/versions.props
index ca56d93888e..de85189b50c 100644
--- a/versions.props
+++ b/versions.props
@@ -110,7 +110,7 @@ org.carrot2:morfologik-*=2.1.5
org.ccil.cowan.tagsoup:tagsoup=1.2.1
org.checkerframework:checker-qual=3.10.0
org.codehaus.janino:*=3.0.9
-org.codehaus.woodstox:stax2-api=3.1.4
+org.codehaus.woodstox:stax2-api=4.2.1
org.codehaus.woodstox:woodstox-core-asl=4.4.1
org.eclipse.jetty.http2:*=9.4.41.v20210516
org.eclipse.jetty:*=9.4.41.v20210516